Class ComponentSAFTVRMie

All Implemented Interfaces:
Serializable, Cloneable, ComponentEosInterface, ComponentInterface, ThermodynamicConstantsInterface

public class ComponentSAFTVRMie extends ComponentSrk
Component class for the SAFT-VR Mie equation of state.

Implements the Lafitte et al. (2013) SAFT-VR Mie formulation with variable-range Mie potential. The Mie potential generalizes the Lennard-Jones potential with adjustable repulsive (lambda_r) and attractive (lambda_a) exponents.

Reference: Lafitte, T., Apostolakou, A., Avendano, C., Galindo, A., Adjiman, C.S., Mueller, E.A., Jackson, G. (2013). Accurate statistical associating fluid theory for chain molecules formed from Mie segments. J. Chem. Phys., 139, 154504.

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

    • serialVersionUID

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

      protected double dSAFTi
      Temperature-dependent effective diameter for component i.
    • componentTemperature

      protected double componentTemperature
      Temperature at which dSAFTi was last computed.
    • dnSAFTdi

      protected double dnSAFTdi
      Derivative of packing fraction with respect to moles of component i.
    • dghsSAFTdi

      protected double dghsSAFTdi
      Derivative of hard-sphere RDF with respect to moles of component i.
    • dahsSAFTdi

      protected double dahsSAFTdi
      Derivative of hard-sphere Helmholtz energy with respect to moles of component i.
    • dmSAFTdi

      protected double dmSAFTdi
      Derivative of mean segment number with respect to moles of component i.
    • dlogghsSAFTdi

      protected double dlogghsSAFTdi
      Derivative of log(ghs) with respect to moles of component i.
    • dF_HC_SAFTdN

      private double dF_HC_SAFTdN
    • dF_DISP_SAFTdN

      private double dF_DISP_SAFTdN
    • F1dispSumTermdn

      private double F1dispSumTermdn
    • F1dispVolTermdn

      private double F1dispVolTermdn
    • F1dispI1dn

      private double F1dispI1dn
    • F2dispSumTermdn

      private double F2dispSumTermdn
    • F2dispVolTermdn

      private double F2dispVolTermdn
    • F2dispI2dn

      private double F2dispI2dn
    • F2dispZHCdn

      private double F2dispZHCdn
    • xsiteAssoc

      private double[] xsiteAssoc
      Association site fractions X_A for this component.
    • nAssocSites

      private int nAssocSites
      Number of association sites on this component (as used in SAFT-VR Mie).
  • Constructor Details

    • ComponentSAFTVRMie

      public ComponentSAFTVRMie(String name, double moles, double molesInPhase, int compNumber)
      Constructor for ComponentSAFTVRMie.
      Parameters:
      name - component name
      moles - number of moles
      molesInPhase - number of moles in phase
      compNumber - component number
  • Method Details

    • getmSAFTi

      public double getmSAFTi()

      getmSAFTi.

      Returns the SAFT-VR Mie specific segment number, not the PC-SAFT value.

      Specified by:
      getmSAFTi in interface ComponentInterface
      Overrides:
      getmSAFTi in class Component
      Returns:
      a double
    • getSigmaSAFTi

      public double getSigmaSAFTi()

      getSigmaSAFTi.

      Returns the SAFT-VR Mie specific segment diameter, not the PC-SAFT value.

      Specified by:
      getSigmaSAFTi in interface ComponentInterface
      Overrides:
      getSigmaSAFTi in class Component
      Returns:
      a double
    • getEpsikSAFT

      public double getEpsikSAFT()

      getEpsikSAFT.

      Returns the SAFT-VR Mie specific energy parameter, not the PC-SAFT value.

      Specified by:
      getEpsikSAFT in interface ComponentInterface
      Overrides:
      getEpsikSAFT in class Component
      Returns:
      a double
    • clone

      public ComponentSAFTVRMie clone()

      clone.

      Specified by:
      clone in interface ComponentInterface
      Overrides:
      clone in class ComponentSrk
      Returns:
      a ComponentInterface object
    • initAssociationArrays

      public void initAssociationArrays(int nSites)
      Initializes the association site fraction arrays. Called from PhaseSAFTVRMie.initAssociationSchemes.
      Parameters:
      nSites - number of association sites for this component
    • getXsiteAssoc

      public double[] getXsiteAssoc()
      Returns the association site fraction array.
      Returns:
      xsiteAssoc array
    • setXsiteAssoc

      public void setXsiteAssoc(int siteIndex, double value)
      Sets a site fraction value.
      Parameters:
      siteIndex - site index
      value - new XA value
    • getNAssocSites

      public int getNAssocSites()
      Returns the number of association sites used in SAFT-VR Mie.
      Returns:
      number of sites
    • dFCPAdN

      public double dFCPAdN(PhaseInterface phase, int numberOfComponents, double temperature, double pressure)
      Calculates the association contribution to dF/dNi. dFCPAdN = sum_A [ln(X_A^i)] - hcpatot/2 * d(ln I)/d(ni), where I is the Dufal 2015 association integral used for the SAFT-VR Mie association strength.
      Parameters:
      phase - the phase
      numberOfComponents - number of components
      temperature - temperature in K
      pressure - pressure in Pa
      Returns:
      dF_ASSOC/dNi
    • calcMiePrefactor

      public static double calcMiePrefactor(double lr, double la)
      Calculates the Mie potential prefactor C.
      Parameters:
      lr - repulsive exponent
      la - attractive exponent
      Returns:
      Mie potential prefactor
    • init

      public void init(double temperature, double pressure, double totalNumberOfMoles, double beta, int initType)
      Initializes component temperature-dependent diameter using the Barker-Henderson integral for the Mie potential (evaluated analytically following Lafitte et al. 2013).
      Specified by:
      init in interface ComponentInterface
      Overrides:
      init in class ComponentEos
      Parameters:
      temperature - temperature in K
      pressure - pressure in Pa
      totalNumberOfMoles - total moles
      beta - phase fraction
      initType - initialization type
    • recalcSAFTDiameter

      public void recalcSAFTDiameter(double temperature)
      Recalculates the temperature-dependent effective BH diameter without running the full Component.init(). Used by numerical derivatives that perturb temperature on cloned phases.
      Parameters:
      temperature - temperature in K
    • calcEffectiveDiameter

      public static double calcEffectiveDiameter(double sigma, double epsk, double temperature, double lr, double la)
      Calculates effective BH diameter by numerical Gauss-Legendre quadrature of the Mie potential.
      Parameters:
      sigma - segment diameter in m
      epsk - energy parameter eps/k in K
      temperature - temperature in K
      lr - repulsive exponent
      la - attractive exponent
      Returns:
      effective diameter in m
    • Finit

      public void Finit(PhaseInterface phase, double temperature, double pressure, double totalNumberOfMoles, double beta, int numberOfComponents, int initType)
      Initializes SAFT-VR Mie component derivatives within the phase context.
      Specified by:
      Finit in interface ComponentInterface
      Overrides:
      Finit in class ComponentEos
      Parameters:
      phase - the phase
      temperature - temperature in K
      pressure - pressure in Pa
      totalNumberOfMoles - total moles
      beta - phase fraction
      numberOfComponents - number of components
      initType - initialization type
    • dFdN

      public double dFdN(PhaseInterface phase, int numberOfComponents, double temperature, double pressure)
      Returns the derivative of the reduced residual Helmholtz energy with respect to moles of component i at constant T and total volume V.

      For a pure component, uses the exact thermodynamic identity: dF/dN = F/n - v * dF/dV_neqsim, where v is the molar volume and dF/dV is the already-computed analytical volume derivative from the phase. This avoids numerical differentiation issues where perturbing moles at constant total volume causes the packing fraction eta to cancel.

      Specified by:
      dFdN in interface ComponentEosInterface
      Overrides:
      dFdN in class ComponentEos
      Parameters:
      phase - the phase
      numberOfComponents - number of components
      temperature - temperature in K
      pressure - pressure in Pa
      Returns:
      dF/dNi
    • dFdNdT

      public double dFdNdT(PhaseInterface phase, int numberOfComponents, double temperature, double pressure)

      dFdNdT.

      Analytical formula: dFdNdT = dFdT/n - v * dFdTdV, derived from d/dT of dFdN = F/n - v*dFdV.

      Specified by:
      dFdNdT in interface ComponentEosInterface
      Overrides:
      dFdNdT in class ComponentEos
      Parameters:
      phase - a PhaseInterface object
      numberOfComponents - a int
      temperature - a double
      pressure - a double
      Returns:
      a double
    • dFdNdV

      public double dFdNdV(PhaseInterface phase, int numberOfComponents, double temperature, double pressure)

      dFdNdV.

      Analytical formula: dFdNdV = -v * dFdVdV, derived from d/dV of dFdN = F/n - v*dFdV at constant N (where v = V/n, so dv/dV = 1/n).

      Specified by:
      dFdNdV in interface ComponentEosInterface
      Overrides:
      dFdNdV in class ComponentEos
      Parameters:
      phase - a PhaseInterface object
      numberOfComponents - a int
      temperature - a double
      pressure - a double
      Returns:
      a double
    • dFdNdN

      public double dFdNdN(int j, PhaseInterface phase, int numberOfComponents, double temperature, double pressure)

      dFdNdN.

      Numerical differentiation of dFdN with respect to moles of component j. Clones the phase, perturbs N_j while keeping total volume constant, and computes the central difference of the analytical dFdN. The reinit helper only calls init + volInit (no Finit) to avoid infinite recursion.

      Specified by:
      dFdNdN in interface ComponentEosInterface
      Overrides:
      dFdNdN in class ComponentEos
      Parameters:
      j - a int
      phase - a PhaseInterface object
      numberOfComponents - a int
      temperature - a double
      pressure - a double
      Returns:
      a double
    • reinitSAFTOnPhase

      private void reinitSAFTOnPhase(PhaseSAFTVRMie phase, int numberOfComponents, double temperature, double pressure)
      Reinitializes SAFT quantities on a cloned phase for numerical differentiation. Updates component mole fractions based on the perturbed numberOfMolesInPhase values and recalculates SAFT variables via volInit. Does NOT call Component.init to avoid corrupting system-level moles.
      Parameters:
      phase - the phase to reinitialize
      numberOfComponents - number of components
      temperature - temperature in K
      pressure - pressure in Pa
    • calcdnSAFTdi

      public double calcdnSAFTdi(PhaseInterface phase, int nc, double temp, double pres)
      Derivative of packing fraction with respect to moles of component i.
      Parameters:
      phase - the phase
      nc - number of components
      temp - temperature
      pres - pressure
      Returns:
      dnSAFT/dNi
    • calcdghsSAFTdi

      public double calcdghsSAFTdi(PhaseInterface phase, int nc, double temp, double pres)
      Derivative of hard-sphere RDF with respect to moles of component i.
      Parameters:
      phase - the phase
      nc - number of components
      temp - temperature
      pres - pressure
      Returns:
      dghs/dNi
    • calcdahsSAFTdi

      public double calcdahsSAFTdi(PhaseInterface phase, int nc, double temp, double pres)
      Derivative of hard-sphere Helmholtz energy with respect to moles of component i.
      Parameters:
      phase - the phase
      nc - number of components
      temp - temperature
      pres - pressure
      Returns:
      dahs/dNi
    • calcdmSAFTdi

      public double calcdmSAFTdi(PhaseInterface phase, int nc, double temp, double pres)
      Derivative of segment number with respect to moles of component i.
      Parameters:
      phase - the phase
      nc - number of components
      temp - temperature
      pres - pressure
      Returns:
      dm/dNi
    • calcdF1dispVolTermdn

      public double calcdF1dispVolTermdn(PhaseInterface phase, int nc, double temp, double pres)
      Derivative of dispersion volume term with respect to moles of component i.
      Parameters:
      phase - the phase
      nc - number of components
      temp - temperature
      pres - pressure
      Returns:
      dVolTerm/dNi
    • calcF1dispSumTermdn

      public double calcF1dispSumTermdn(PhaseInterface phase, int nc, double temp, double pres)
      Calculates derivative of first-order dispersion sum term w.r.t. moles.
      Parameters:
      phase - the phase
      nc - number of components
      temp - temperature
      pres - pressure
      Returns:
      d(F1dispSumTerm)/dNi
    • calcF1dispI1dn

      public double calcF1dispI1dn(PhaseInterface phase, int nc, double temp, double pres)
      Calculates derivative of first-order dispersion integral (I1) w.r.t. moles.
      Parameters:
      phase - the phase
      nc - number of components
      temp - temperature
      pres - pressure
      Returns:
      dI1/dNi
    • calcF2dispSumTermdn

      public double calcF2dispSumTermdn(PhaseInterface phase, int nc, double temp, double pres)
      Calculates derivative of second-order dispersion sum term w.r.t. moles.
      Parameters:
      phase - the phase
      nc - number of components
      temp - temperature
      pres - pressure
      Returns:
      d(F2dispSumTerm)/dNi
    • calcF2dispZHCdn

      public double calcF2dispZHCdn(PhaseInterface phase, int nc, double temp, double pres)
      Calculates derivative of second-order compression factor correction w.r.t. moles.
      Parameters:
      phase - the phase
      nc - number of components
      temp - temperature
      pres - pressure
      Returns:
      d(F2dispZHC)/dNi
    • dF_HC_SAFTdN

      public double dF_HC_SAFTdN(PhaseInterface phase, int nc, double temp, double pres)
      Hard-chain contribution to dF/dNi. Computes all intermediate derivatives from the phase to work correctly on cloned phases (no reliance on cached component fields).
      Parameters:
      phase - the phase
      nc - number of components
      temp - temperature
      pres - pressure
      Returns:
      dF_HC/dNi
    • dF_DISP_SAFTdN

      public double dF_DISP_SAFTdN(PhaseInterface phase, int nc, double temp, double pres)
      Dispersion contribution to dF/dNi. Uses the pair-summed quantities from volInit. Computes deta/dn_i inline to work on cloned phases.
      Parameters:
      phase - the phase
      nc - number of components
      temp - temperature
      pres - pressure
      Returns:
      dF_DISP/dNi
    • getdSAFTi

      public double getdSAFTi()
      Gets the temperature-dependent effective segment diameter.
      Returns:
      effective diameter in m
    • getDnSAFTdi

      public double getDnSAFTdi()
      Gets the packing fraction derivative w.r.t. moles.
      Returns:
      dnSAFT/dNi
    • getDmSAFTdi

      public double getDmSAFTdi()
      Gets the mean segment number derivative w.r.t. moles.
      Returns:
      dm/dNi
    • getDdSAFTidT

      public double getDdSAFTidT()
      Gets the temperature derivative of the BH effective diameter for this component. Computed by central finite difference of the Gauss-Legendre BH quadrature.
      Returns:
      dd_i/dT in m/K
    • getTemperature

      private double getTemperature()
      Gets the temperature stored for this component (for derivative calculations).
      Returns:
      temperature in K