Class PhaseBWRSEos

All Implemented Interfaces:
Serializable, Cloneable, PhaseEosInterface, PhaseInterface, ThermodynamicConstantsInterface

public class PhaseBWRSEos extends PhaseSrkEos

PhaseBWRSEos 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.
    • MBWR_UNIT_FACTOR

      private static final double MBWR_UNIT_FACTOR
      Unit conversion factor for MBWR-32 parameters. The database coefficients are calibrated in MPa-based units (density in mol/L, pressure in MPa), using R_MPa = 0.008314 L·MPa/(mol·K). The framework uses R_SI = 8.3144621 J/(mol·K). Since getFpol() divides by R_SI·T, the resulting Helmholtz function is 1000× too small (R_SI / R_MPa = 1000). This factor compensates.
      See Also:
    • OP

      int OP
    • OE

      int OE
    • mixBP

      private double[] mixBP
      Mole-fraction-weighted polynomial MBWR coefficients for the mixture.
    • mixBE

      private double[] mixBE
      Mole-fraction-weighted exponential MBWR coefficients for the mixture.
    • mixBPdT

      private double[] mixBPdT
      Mole-fraction-weighted polynomial temperature derivatives for the mixture.
    • mixBEdT

      private double[] mixBEdT
      Mole-fraction-weighted exponential temperature derivatives for the mixture.
    • mixBPdTdT

      private double[] mixBPdTdT
      Mole-fraction-weighted polynomial second temperature derivatives for the mixture.
    • mixBEdTdT

      private double[] mixBEdTdT
      Mole-fraction-weighted exponential second temperature derivatives for the mixture.
    • mixGamma

      private double mixGamma
      Mixed gamma parameter = 1/rhoc_mix^2 for one-fluid mixing.
  • Constructor Details

    • PhaseBWRSEos

      public PhaseBWRSEos()

      Constructor for PhaseBWRSEos.

  • Method Details

    • clone

      public PhaseBWRSEos clone()

      clone.

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

      private void computeMixedParameters()
      Computes mole-fraction-weighted MBWR parameters for the one-fluid mixture. Linear mixing: mixBP[i] = sum_j x_j * BP_j[i], similarly for BE, BPdT, BEdT. For gamma (critical density), rhoc_mix = sum_j x_j * rhoc_j, then mixGamma = 1/rhoc_mix^2.
    • recomputeLight

      private void recomputeLight()
      Lightweight recomputation for numerical derivatives. Updates mole fractions and mixed BWRS parameters without triggering a full init/Finit cycle.
    • 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.
    • 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.
    • getMolarDensity

      public double getMolarDensity()

      getMolarDensity.

      Returns:
      a double
    • getdRhodV

      public double getdRhodV()

      getdRhodV.

      Returns:
      a double
    • getdRhodVdV

      public double getdRhodVdV()

      getdRhodVdV.

      Returns:
      a double
    • getdRhodVdVdV

      public double getdRhodVdVdV()

      getdRhodVdVdV.

      Returns:
      a double
    • getGammadRho

      public double getGammadRho()

      getGammadRho.

      Returns:
      a double
    • getFpol

      public double getFpol()

      getFpol.

      Returns:
      a double
    • getFpoldV

      public double getFpoldV()

      getFpoldV.

      Returns:
      a double
    • getFpoldRho

      public double getFpoldRho()
      Derivative of the polynomial F-term with respect to molar density.
      Returns:
      dFpol/dρ
    • getFpoldVdV

      public double getFpoldVdV()

      getFpoldVdV.

      Returns:
      a double
    • getFpoldVdVdV

      public double getFpoldVdVdV()

      getFpoldVdVdV.

      Returns:
      a double
    • getFpoldT

      public double getFpoldT()

      getFpoldT.

      Returns:
      a double
    • getFpoldTdRho

      private double getFpoldTdRho()
      Cross derivative of the polynomial F-term with respect to temperature and molar density.
      Returns:
      d2Fpol/dT dρ
    • getFpoldTdV

      private double getFpoldTdV()
      Cross derivative of the polynomial F-term with respect to temperature and molar volume.
      Returns:
      d2Fpol/dT dV
    • getFpoldTdT

      private double getFpoldTdT()
      Second derivative of the polynomial F-term with respect to temperature.
      Returns:
      d2Fpol/dT2
    • getFdRho

      public double getFdRho()
      Total derivative of F with respect to molar density.
      Returns:
      dF/dρ
    • getEL

      public double getEL()

      getEL.

      Returns:
      a double
    • getELdRho

      public double getELdRho()

      getELdRho.

      Returns:
      a double
    • getELdRhodedRho

      public double getELdRhodedRho()
      Second derivative of the exponential EL term with respect to molar density.
      Returns:
      d2EL/dρ2
    • getELdRhodedRhodedRho

      public double getELdRhodedRhodedRho()
      Third derivative of the exponential EL term with respect to molar density.
      Returns:
      d3EL/dρ3
    • getFexp

      public double getFexp()

      getFexp.

      Returns:
      a double
    • getFexpdRho

      private double getFexpdRho()
      First derivative of Fexp with respect to molar density.
      Returns:
      dFexp/dρ
    • getFexpdRhodRho

      private double getFexpdRhodRho()
      Second derivative of Fexp with respect to molar density.
      Returns:
      d2Fexp/dρ2
    • getFexpdRhodRhodRho

      private double getFexpdRhodRhodRho()
      Third derivative of Fexp with respect to molar density.
      Returns:
      d3Fexp/dρ3
    • getFexpdV

      public double getFexpdV()
      First derivative of Fexp with respect to molar volume.
      Returns:
      dFexp/dV
    • getFexpdVdV

      public double getFexpdVdV()
      Second derivative of Fexp with respect to molar volume.
      Returns:
      d2Fexp/dV2
    • getFexpdVdVdV

      public double getFexpdVdVdV()
      Third derivative of Fexp with respect to molar volume.
      Returns:
      d3Fexp/dV3
    • getFexpdTdRho

      private double getFexpdTdRho()
      Cross derivative of Fexp with respect to temperature and molar density.
      Returns:
      d2Fexp/dT dρ
    • getFexpdTdV

      private double getFexpdTdV()
      Cross derivative of Fexp with respect to temperature and molar volume.
      Returns:
      d2Fexp/dT dV
    • getFexpdT

      public double getFexpdT()

      getFexpdT.

      Returns:
      a double
    • getFexpdTdT

      private double getFexpdTdT()
      Second derivative of Fexp with respect to temperature.
      Returns:
      d2Fexp/dT2
    • calcPressure2

      public double calcPressure2()

      calcPressure2.

      Returns:
      a double
    • calcPVT

      public void calcPVT()

      calcPVT.

    • getF

      public double getF()

      getF.

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

      public double getdFdN(int compNumb)
      Numerical dF/dn_i at constant T, V. Perturbs component moles, adjusts molar volume to keep total volume constant, recomputes mix parameters, and evaluates F.
      Parameters:
      compNumb - component index to perturb
      Returns:
      numerical dF/dn_i
    • getdFdNdV

      public double getdFdNdV(int compNumb)
      Numerical d2F/(dn_i dV) at constant T, n.
      Parameters:
      compNumb - component index
      Returns:
      numerical d2F/(dn_i dV)
    • getdFdNdT

      public double getdFdNdT(int compNumb)
      Numerical d2F/(dn_i dT) at constant V, n.
      Parameters:
      compNumb - component index
      Returns:
      numerical d2F/(dn_i dT)
    • getdFdNdN

      public double getdFdNdN(int compI, int compJ)
      Numerical d2F/(dn_i dn_j) at constant T, V.
      Parameters:
      compI - component i index
      compJ - component j index
      Returns:
      numerical d2F/(dn_i dn_j)
    • 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
    • dFdTdT

      public double dFdTdT()

      dFdTdT.

      Specified by:
      dFdTdT in interface PhaseInterface
      Overrides:
      dFdTdT 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
    • getJouleThomsonCoefficient

      public double getJouleThomsonCoefficient()
      Get the Joule Thomson Coefficient of a phase.
      Specified by:
      getJouleThomsonCoefficient in interface PhaseInterface
      Overrides:
      getJouleThomsonCoefficient in class PhaseEos
      Returns:
      Joule Thomson coefficient in K/bar
    • molarVolume2

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

      molarVolume2.

      Overrides:
      molarVolume2 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.