Class PhaseModifiedFurstElectrolyteEos

All Implemented Interfaces:
Serializable, Cloneable, PhaseEosInterface, PhaseInterface, ThermodynamicConstantsInterface
Direct Known Subclasses:
PhaseElectrolyteCPA, PhaseElectrolyteCPAOld

public class PhaseModifiedFurstElectrolyteEos extends PhaseSrkEos

PhaseModifiedFurstElectrolyteEos class.

Version:
$Id: $Id
Author:
Even Solbraa
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      Serialization version UID.
      See Also:
    • logger

      static org.apache.logging.log4j.Logger logger
      Logger object for class.
    • dielectricMixingRule

      The dielectric constant mixing rule to use for mixed solvents.
    • gammaold

      double gammaold
    • alphaLRdTdV

      double alphaLRdTdV
    • W

      double W
    • WT

      double WT
    • WTT

      double WTT
    • eps

      double eps
    • epsdV

      double epsdV
    • epsdVdV

      double epsdVdV
    • epsIonic

      double epsIonic
    • bornX

      double bornX
    • epsIonicdV

      double epsIonicdV
    • epsIonicdVdV

      double epsIonicdVdV
    • alphaLR2

      double alphaLR2
    • alphaLRdT

      double alphaLRdT
    • alphaLRdTdT

      double alphaLRdTdT
    • alphaLRdV

      double alphaLRdV
    • XLR

      double XLR
    • XLRdT

      double XLRdT
    • shieldingParameterdT

      double shieldingParameterdT
    • solventDiElectricConstant

      double solventDiElectricConstant
    • solventDiElectricConstantdT

      double solventDiElectricConstantdT
    • solventDiElectricConstantdTdT

      double solventDiElectricConstantdTdT
    • shieldingParameter

      double shieldingParameter
    • gamma

      double gamma
    • diElectricConstantdV

      double diElectricConstantdV
    • diElectricConstantdVdV

      double diElectricConstantdVdV
    • alphaLRdVdV

      double alphaLRdVdV
    • diElectricConstantdT

      double diElectricConstantdT
    • diElectricConstantdTdT

      double diElectricConstantdTdT
    • diElectricConstantdTdV

      double diElectricConstantdTdV
    • electrolyteMixingRule

      ElectrolyteMixingRulesInterface electrolyteMixingRule
    • sr2On

      double sr2On
    • lrOn

      double lrOn
    • bornOn

      double bornOn
  • Constructor Details

    • PhaseModifiedFurstElectrolyteEos

      public PhaseModifiedFurstElectrolyteEos()

      Constructor for PhaseModifiedFurstElectrolyteEos.

  • Method Details

    • getElectrolyteMixingRule

      public ElectrolyteMixingRulesInterface getElectrolyteMixingRule()

      Getter for the field electrolyteMixingRule.

      Returns:
      a ElectrolyteMixingRulesInterface object
    • reInitFurstParam

      public void reInitFurstParam()

      reInitFurstParam.

    • init

      public void init(double totalNumberOfMoles, int numberOfComponents, int initType, PhaseType pt, double beta)

      init.

      initType used in component.init()

      Calls component.init(initType)

      Specified by:
      init in interface PhaseInterface
      Overrides:
      init in class PhaseEos
      Parameters:
      totalNumberOfMoles - Total number of moles in all phases of Stream.
      numberOfComponents - Number of components in system.
      initType - a int. Use 0 to init, and 1 to reset.
      pt - Type of phase.
      beta - Mole fraction of this phase in system.
    • clone

      clone.

      Specified by:
      clone in interface PhaseInterface
      Overrides:
      clone in class PhaseSrkEos
      Returns:
      a PhaseInterface object
    • volInit

      public void volInit()

      volInit.

    • addComponent

      public void addComponent(String name, double moles, double molesInPhase, int compNumber)

      Add component to component array and update moles variables.

      Specified by:
      addComponent in interface PhaseInterface
      Overrides:
      addComponent in class PhaseSrkEos
      Parameters:
      name - Name of component.
      moles - Total number of moles of component.
      molesInPhase - Number of moles in phase.
      compNumber - Index number of component in phase object component array.
    • calcSolventDiElectricConstant

      public double calcSolventDiElectricConstant(double temperature)

      calcSolventDiElectricConstant.

      Calculates the dielectric constant of the solvent mixture using the selected mixing rule. For mixed solvents like water-glycol, the VOLUME_AVERAGE rule gives better accuracy (2.4% avg error) compared to MOLAR_AVERAGE (4.2% avg error) based on Ma et al. (2010) data for EG-water.

      Parameters:
      temperature - a double
      Returns:
      a double
    • calcSolventDiElectricConstantMolarAvg

      private double calcSolventDiElectricConstantMolarAvg(double temperature)
      Calculate solvent dielectric constant using molar average mixing rule. This is the original NeqSim approach: eps_mix = sum(x_i * eps_i)
      Parameters:
      temperature - Temperature in K
      Returns:
      Molar-average dielectric constant
    • calcSolventDiElectricConstantVolumeAvg

      private double calcSolventDiElectricConstantVolumeAvg(double temperature)
      Calculate solvent dielectric constant using volume average mixing rule. eps_mix = sum(phi_i * eps_i) where phi_i = x_i*V_i/sum(x_j*V_j)

      This gives better accuracy for water-glycol mixtures (2.4% vs 4.2% for molar average).

      Parameters:
      temperature - Temperature in K
      Returns:
      Volume-average dielectric constant
    • calcSolventDiElectricConstantLooyenga

      private double calcSolventDiElectricConstantLooyenga(double temperature)
      Calculate solvent dielectric constant using Looyenga mixing rule. eps_mix^(1/3) = sum(phi_i * eps_i^(1/3))

      This has theoretical basis for polar molecule mixtures.

      Parameters:
      temperature - Temperature in K
      Returns:
      Looyenga-rule dielectric constant
    • setDielectricMixingRule

      public void setDielectricMixingRule(PhaseModifiedFurstElectrolyteEos.DielectricMixingRule rule)
      Set the dielectric constant mixing rule for mixed solvents.

      Warning: Only MOLAR_AVERAGE is thermodynamically consistent with complete composition derivatives. VOLUME_AVERAGE and LOOYENGA are suitable for dielectric constant estimation but may cause fugacity coefficient inconsistencies in phase equilibrium calculations.

      Parameters:
      rule - The mixing rule to use (MOLAR_AVERAGE, VOLUME_AVERAGE, or LOOYENGA)
    • getDielectricMixingRule

      Get the current dielectric constant mixing rule.
      Returns:
      The current mixing rule
    • calcSolventDiElectricConstantdT

      public double calcSolventDiElectricConstantdT(double temperature)

      calcSolventDiElectricConstantdT.

      Parameters:
      temperature - a double
      Returns:
      a double
    • calcSolventDiElectricConstantdTdT

      public double calcSolventDiElectricConstantdTdT(double temperature)

      calcSolventDiElectricConstantdTdT.

      Parameters:
      temperature - a double
      Returns:
      a double
    • calcEps

      public double calcEps()

      calcEps.

      Returns:
      a double
    • calcEpsV

      public double calcEpsV()

      calcEpsV.

      Returns:
      a double
    • calcEpsVV

      public double calcEpsVV()

      calcEpsVV.

      Returns:
      a double
    • calcEpsIonic

      public double calcEpsIonic()

      calcEpsIonic.

      Returns:
      a double
    • calcEpsIonicdV

      public double calcEpsIonicdV()

      calcEpsIonicdV.

      Returns:
      a double
    • calcEpsIonicdVdV

      public double calcEpsIonicdVdV()

      calcEpsIonicdVdV.

      Returns:
      a double
    • getF

      public double getF()

      getF.

      Overrides:
      getF in class PhaseEos
      Returns:
      a double
    • dFdT

      public double dFdT()

      Calculate derivative of F per Temperature, i.e., dF/dT.

      Specified by:
      dFdT in interface PhaseInterface
      Overrides:
      dFdT in class PhaseEos
      Returns:
      a double
    • dFdTdV

      public double dFdTdV()

      Calculate derivative of F per Temperature and Volume, i.e., dF/dT * 1/dV.

      Specified by:
      dFdTdV in interface PhaseInterface
      Overrides:
      dFdTdV in class PhaseEos
      Returns:
      a double
    • dFdV

      public double dFdV()

      Calculate derivative of F per Volume, i.e., dF/dV.

      Specified by:
      dFdV in interface PhaseInterface
      Overrides:
      dFdV in class PhaseEos
      Returns:
      a double
    • dFdVdV

      public double dFdVdV()

      dFdVdV.

      Specified by:
      dFdVdV in interface PhaseInterface
      Overrides:
      dFdVdV in class PhaseEos
      Returns:
      a double
    • dFdVdVdV

      public double dFdVdVdV()

      dFdVdVdV.

      Overrides:
      dFdVdVdV in class PhaseEos
      Returns:
      a double
    • dFdTdT

      public double dFdTdT()

      dFdTdT.

      Specified by:
      dFdTdT in interface PhaseInterface
      Overrides:
      dFdTdT in class PhaseEos
      Returns:
      a double
    • calcXLR

      public double calcXLR()

      calcXLR.

      Returns:
      a double
    • calcXLRdT

      public double calcXLRdT()
      Calculates the temperature derivative of XLR using the chain rule. XLR depends on gamma (shielding parameter) which depends on temperature.
      Returns:
      dXLR/dT
    • calcShieldingParameterdT

      public double calcShieldingParameterdT()
      Calculates the temperature derivative of the shielding parameter using implicit differentiation. The shielding parameter gamma satisfies: f(γ) = 4γ²/NA - αLR2 * Σ(ni/V * zi²/(1+γσi)²) = 0 By implicit differentiation: dγ/dT = -∂f/∂T / (∂f/∂γ)
      Returns:
      dγ/dT
    • calcGammaLRdV

      public double calcGammaLRdV()

      calcGammaLRdV.

      Returns:
      a double
    • calcShieldingParameter

      public double calcShieldingParameter()

      calcShieldingParameter.

      Returns:
      a double
    • molarVolume

      public double molarVolume(double pressure, double temperature, double A, double B, PhaseType pt) throws IsNaNException, TooManyIterationsException

      molarVolume.

      Specified by:
      molarVolume in interface PhaseInterface
      Overrides:
      molarVolume in class PhaseEos
      Parameters:
      pressure - a double
      temperature - a double
      A - a double
      B - a double
      pt - the PhaseType of the phase
      Returns:
      a double
      Throws:
      IsNaNException - if any.
      TooManyIterationsException - if any.
    • calcW

      public double calcW(PhaseInterface phase, double temperature, double pressure, int numbcomp)

      calcW.

      Parameters:
      phase - a PhaseInterface object
      temperature - a double
      pressure - a double
      numbcomp - a int
      Returns:
      a double
    • calcWi

      public double calcWi(int compNumb, PhaseInterface phase, double temperature, double pressure, int numbcomp)

      calcWi.

      Parameters:
      compNumb - a int
      phase - a PhaseInterface object
      temperature - a double
      pressure - a double
      numbcomp - a int
      Returns:
      a double
    • calcWiT

      public double calcWiT(int compNumb, PhaseInterface phase, double temperature, double pressure, int numbcomp)

      calcWiT.

      Parameters:
      compNumb - a int
      phase - a PhaseInterface object
      temperature - a double
      pressure - a double
      numbcomp - a int
      Returns:
      a double
    • calcWij

      public double calcWij(int compNumb, int compNumbj, PhaseInterface phase, double temperature, double pressure, int numbcomp)

      calcWij.

      Parameters:
      compNumb - a int
      compNumbj - a int
      phase - a PhaseInterface object
      temperature - a double
      pressure - a double
      numbcomp - a int
      Returns:
      a double
    • calcDiElectricConstant

      public double calcDiElectricConstant(double temperature)

      calcDiElectricConstant.

      Overrides:
      calcDiElectricConstant in class Phase
      Parameters:
      temperature - a double
      Returns:
      a double
    • calcDiElectricConstantdV

      public double calcDiElectricConstantdV(double temperature)

      calcDiElectricConstantdV.

      Parameters:
      temperature - a double
      Returns:
      a double
    • calcDiElectricConstantdVdV

      public double calcDiElectricConstantdVdV(double temperature)

      calcDiElectricConstantdVdV.

      Parameters:
      temperature - a double
      Returns:
      a double
    • calcDiElectricConstantdT

      public double calcDiElectricConstantdT(double temperature)

      calcDiElectricConstantdT.

      Overrides:
      calcDiElectricConstantdT in class Phase
      Parameters:
      temperature - a double
      Returns:
      a double
    • calcDiElectricConstantdTdT

      public double calcDiElectricConstantdTdT(double temperature)

      calcDiElectricConstantdTdT.

      Overrides:
      calcDiElectricConstantdTdT in class Phase
      Parameters:
      temperature - a double
      Returns:
      a double
    • calcDiElectricConstantdTdV

      public double calcDiElectricConstantdTdV(double temperature)

      calcDiElectricConstantdTdV.

      Parameters:
      temperature - a double
      Returns:
      a double
    • calcBornX

      public double calcBornX()

      calcBornX.

      Returns:
      a double
    • FLR

      public double FLR()

      FLR. MSA long-range ion-ion interaction contribution to Helmholtz free energy.

      Returns:
      a double
    • dFLRdT

      public double dFLRdT()

      dFLRdT. Temperature derivative of the long-range MSA contribution at constant V.

      FLR = -αLR*XLR/(4π) + n*V*γ³/(3π*NA) * 1e-5 dFLR/dT|V = -1/(4π) * (dαLR/dT * XLR + αLR * dXLR/dT) + n*V*1e-5/(3π*NA) * 3γ² * dγ/dT Note: This derivative is computed at constant V, which is correct for the Helmholtz free energy formulation. The relationship between constant-P and constant-V derivatives is handled through the pressure equation of state: dF/dT|P = dF/dT|V + (dF/dV)*dV/dT|P. Numerical tests at constant P will show ~15% difference which is expected behavior.
      Returns:
      a double
    • dFLRdTdV

      public double dFLRdTdV()

      dFLRdTdV.

      Returns:
      a double
    • dFLRdTdT

      public double dFLRdTdT()

      dFLRdTdT. Second temperature derivative of the long-range MSA contribution.

      Note: This is a simplified implementation that includes the main terms. The full second derivative would require d²γ/dT² and d²XLR/dT² which are not yet implemented.
      Returns:
      a double
    • dFLRdV

      public double dFLRdV()

      dFLRdV. Volume derivative of FLR.

      Returns:
      a double
    • dFLRdVdV

      public double dFLRdVdV()

      dFLRdVdV. Second volume derivative of FLR.

      Returns:
      a double
    • dFLRdVdVdV

      public double dFLRdVdVdV()

      dFLRdVdVdV.

      Returns:
      a double
    • FLRXLR

      public double FLRXLR()

      FLRXLR. Derivative of FLR with respect to XLR.

      Returns:
      a double
    • FLRGammaLR

      public double FLRGammaLR()

      FLRGammaLR. Derivative of FLR with respect to gamma (shielding parameter).

      Returns:
      a double
    • dFdAlphaLR

      public double dFdAlphaLR()

      dFdAlphaLR. Derivative of FLR with respect to alphaLR.

      Returns:
      a double
    • dFdAlphaLRdV

      public double dFdAlphaLRdV()

      dFdAlphaLRdV.

      Returns:
      a double
    • dFdAlphaLRdX

      public double dFdAlphaLRdX()

      dFdAlphaLRdX.

      Returns:
      a double
    • dFdAlphaLRdGamma

      public double dFdAlphaLRdGamma()

      dFdAlphaLRdGamma.

      Returns:
      a double
    • FLRV

      public double FLRV()

      FLRV. Volume derivative helper for FLR.

      Returns:
      a double
    • FLRVV

      public double FLRVV()

      FLRVV.

      Returns:
      a double
    • dFdAlphaLRdAlphaLR

      public double dFdAlphaLRdAlphaLR()

      dFdAlphaLRdAlphaLR.

      Returns:
      a double
    • XLRdndn

      public double XLRdndn(int i, int j)

      XLRdndn.

      Parameters:
      i - a int
      j - a int
      Returns:
      a double
    • XLRdGammaLR

      public double XLRdGammaLR()

      XLRdGammaLR.

      Returns:
      a double
    • XBorndndn

      public double XBorndndn(int i, int j)

      XBorndndn.

      Parameters:
      i - a int
      j - a int
      Returns:
      a double
    • FSR2

      public double FSR2()

      FSR2. Short-range ion-solvent and ion-ion interaction contribution to Helmholtz free energy.

      Returns:
      a double
    • dFSR2dT

      public double dFSR2dT()

      dFSR2dT.

      Returns:
      a double
    • dFSR2dTdT

      public double dFSR2dTdT()

      dFSR2dTdT.

      Returns:
      a double
    • dFSR2dV

      public double dFSR2dV()

      dFSR2dV.

      Returns:
      a double
    • dFSR2dTdV

      public double dFSR2dTdV()

      dFSR2dTdV.

      Returns:
      a double
    • dFSR2dVdV

      public double dFSR2dVdV()

      dFSR2dVdV.

      Returns:
      a double
    • dFSR2dVdVdV

      public double dFSR2dVdVdV()

      dFSR2dVdVdV.

      Returns:
      a double
    • FSR2W

      public double FSR2W()

      FSR2W. Partial derivative of FSR2 with respect to W.

      Returns:
      a double
    • FSR2V

      public double FSR2V()

      FSR2V. Partial derivative of FSR2 with respect to V.

      Returns:
      a double
    • FSR2T

      public double FSR2T()

      FSR2T.

      Returns:
      a double
    • FSR2n

      public double FSR2n()

      FSR2n.

      Returns:
      a double
    • FSR2eps

      public double FSR2eps()

      FSR2eps. Partial derivative of FSR2 with respect to epsilon.

      Returns:
      a double
    • FSR2nn

      public double FSR2nn()

      FSR2nn.

      Returns:
      a double
    • FSR2nT

      public double FSR2nT()

      FSR2nT.

      Returns:
      a double
    • FSR2nV

      public double FSR2nV()

      FSR2nV.

      Returns:
      a double
    • FSR2neps

      public double FSR2neps()

      FSR2neps.

      Returns:
      a double
    • FSR2nW

      public double FSR2nW()

      FSR2nW.

      Returns:
      a double
    • FSR2Tn

      public double FSR2Tn()

      FSR2Tn.

      Returns:
      a double
    • FSR2TT

      public double FSR2TT()

      FSR2TT.

      Returns:
      a double
    • FSR2TV

      public double FSR2TV()

      FSR2TV.

      Returns:
      a double
    • FSR2Teps

      public double FSR2Teps()

      FSR2Teps.

      Returns:
      a double
    • FSR2TW

      public double FSR2TW()

      FSR2TW.

      Returns:
      a double
    • FSR2VV

      public double FSR2VV()

      FSR2VV. Second partial derivative of FSR2 with respect to V.

      Returns:
      a double
    • FSR2epsV

      public double FSR2epsV()

      FSR2epsV. Mixed partial derivative of FSR2 with respect to epsilon and V.

      Returns:
      a double
    • FSR2epsW

      public double FSR2epsW()

      FSR2epsW. Mixed partial derivative of FSR2 with respect to epsilon and W.

      Returns:
      a double
    • FSR2WW

      public double FSR2WW()

      FSR2WW.

      Returns:
      a double
    • FSR2VW

      public double FSR2VW()

      FSR2VW. Mixed partial derivative of FSR2 with respect to V and W.

      Returns:
      a double
    • FSR2epseps

      public double FSR2epseps()

      FSR2epseps. Second partial derivative of FSR2 with respect to epsilon.

      Returns:
      a double
    • FSR2VVV

      public double FSR2VVV()

      FSR2VVV. Third partial derivative of FSR2 with respect to V.

      Returns:
      a double
    • FSR2epsepsV

      public double FSR2epsepsV()

      FSR2epsepsV.

      Returns:
      a double
    • FSR2VVeps

      public double FSR2VVeps()

      FSR2VVeps.

      Returns:
      a double
    • FSR2epsepseps

      public double FSR2epsepseps()

      FSR2epsepseps.

      Returns:
      a double
    • FBorn

      public double FBorn()

      FBorn. Born solvation contribution to Helmholtz free energy.

      Returns:
      a double
    • dFBorndT

      public double dFBorndT()

      dFBorndT.

      Returns:
      a double
    • dFBorndTdT

      public double dFBorndTdT()

      dFBorndTdT.

      Returns:
      a double
    • FBornT

      public double FBornT()

      FBornT. Temperature derivative of Born term.

      Returns:
      a double
    • FBornX

      public double FBornX()

      FBornX. Derivative of Born term with respect to bornX sum.

      Returns:
      a double
    • FBornD

      public double FBornD()

      FBornD. Derivative of Born term with respect to dielectric constant.

      Returns:
      a double
    • FBornTT

      public double FBornTT()

      FBornTT. Second temperature derivative of Born term.

      Returns:
      a double
    • FBornTD

      public double FBornTD()

      FBornTD. Mixed temperature-dielectric derivative of Born term.

      Returns:
      a double
    • FBornTX

      public double FBornTX()

      FBornTX. Mixed temperature-bornX derivative of Born term.

      Returns:
      a double
    • FBornDD

      public double FBornDD()

      FBornDD. Second dielectric derivative of Born term.

      Returns:
      a double
    • FBornDX

      public double FBornDX()

      FBornDX. Mixed dielectric-bornX derivative of Born term.

      Returns:
      a double
    • FBornXX

      public double FBornXX()

      FBornXX.

      Returns:
      a double
    • getEps

      public double getEps()

      Getter for the field eps.

      Returns:
      a double
    • getEpsIonic

      public double getEpsIonic()

      Getter for the field epsIonic.

      Returns:
      a double
    • getEpsIonicdV

      public double getEpsIonicdV()

      Getter for the field epsIonicdV.

      Returns:
      a double
    • getEpsdV

      public double getEpsdV()

      Getter for the field epsdV.

      Returns:
      a double
    • getEpsdVdV

      public double getEpsdVdV()

      Getter for the field epsdVdV.

      Returns:
      a double
    • getSolventDiElectricConstant

      public double getSolventDiElectricConstant()

      Getter for the field solventDiElectricConstant.

      Returns:
      a double
    • getSolventDiElectricConstantdT

      public double getSolventDiElectricConstantdT()

      Getter for the field solventDiElectricConstantdT.

      Returns:
      a double
    • getSolventDiElectricConstantdTdT

      public double getSolventDiElectricConstantdTdT()

      Getter for the field solventDiElectricConstantdTdT.

      Returns:
      a double
    • getAlphaLR2

      public double getAlphaLR2()

      Getter for the field alphaLR2.

      Returns:
      a double
    • getW

      public double getW()

      getW.

      Returns:
      a double
    • getWT

      public double getWT()

      getWT.

      Returns:
      a double
    • getDiElectricConstantdT

      public double getDiElectricConstantdT()

      Getter for the field diElectricConstantdT.

      Returns:
      a double
    • getDiElectricConstantdV

      public double getDiElectricConstantdV()

      Getter for the field diElectricConstantdV.

      Returns:
      a double
    • getXLR

      public double getXLR()

      getXLR.

      Returns:
      a double
    • getShieldingParameter

      public double getShieldingParameter()

      Getter for the field shieldingParameter.

      Returns:
      a double
    • getAlphaLRT

      public double getAlphaLRT()

      getAlphaLRT.

      Returns:
      a double
    • getAlphaLRV

      public double getAlphaLRV()

      getAlphaLRV.

      Returns:
      a double
    • getDielectricT

      public double getDielectricT()

      getDielectricT.

      Returns:
      a double
    • getDielectricV

      public double getDielectricV()

      getDielectricV.

      Returns:
      a double
    • getDielectricConstant

      public double getDielectricConstant()

      getDielectricConstant.

      Returns:
      a double
    • setFurstIonicCoefficient

      public void setFurstIonicCoefficient(double[] params)

      setFurstIonicCoefficient.

      Parameters:
      params - an array of type double
    • getEpsIonicdVdV

      public double getEpsIonicdVdV()

      Getter for the field epsIonicdVdV.

      Returns:
      a double