CubicEoS Derived Type

type, public, extends(ArModel) :: CubicEoS

CubicEoS

Generic cubic equation of state with configurable alpha and mixing rules.

Description

Generic Cubic Equation of State as defined by Michelsen and Mollerup with a parameter that is not constant, and a parameter that depends on it. In the case of a two parameter EoS like PengRobinson the is the same for all components so it can be considered as a constant instead of a variable. The expression of the Equation is:

Examples

model = PengRobinson76(Tc, Pc, omega)
call model%pressure(n, V, T, P)

Inherits

type~~cubiceos~~InheritsGraph type~cubiceos CubicEoS type~alphafunction AlphaFunction type~cubiceos->type~alphafunction alpha type~armodel ArModel type~cubiceos->type~armodel type~cubicmixrule CubicMixRule type~cubiceos->type~cubicmixrule mixrule type~basemodel BaseModel type~armodel->type~basemodel type~substances Substances type~basemodel->type~substances components

Inherited by

type~~cubiceos~~InheritedByGraph type~cubiceos CubicEoS type~gerg2008 Gerg2008 type~gerg2008->type~cubiceos srk

Components

Type Visibility Attributes Name Initial
real(kind=pr), public, allocatable :: ac(:)

Pure-component attractive parameters at , [bar L^2/mol^2]

class(AlphaFunction), public, allocatable :: alpha

AlphaFunction derived type.

Uses the abstract derived type AlphaFunction to define the Alpha function that the CubicEoS will use. The Alpha function receives the reduced temperature and returns the values of alpha and its derivatives, named a, dadt and dadt2 respectively.

Examples

Calling the AlphaFunction of a configured model.

use yaeos, only: CubicEoS, PengRobinson76

type(CubicEoS) :: eos
eos = PengRobinson76(tc, pc, w)
call eos%alpha%alpha(Tr, a, dadt, dadt2)
real(kind=pr), public, allocatable :: b(:)

Pure-component covolumes [L/mol]

type(Substances), public :: components

Pure-component properties for the model’s component order.

real(kind=pr), public, allocatable :: del1(:)

parameter

real(kind=pr), public, allocatable :: del2(:)

parameter

class(CubicMixRule), public, allocatable :: mixrule

CubicMixRule derived type.

Uses the abstract derived type CubicMixRule to define the mixing rule that the CubicEoS will use. It includes internally three methods to calculate the corresponding parameters for the Cubic EoS: Dmix, Bmix and D1mix.

Examples

Calculation of the B parameter.

use yaeos, only: CubicEoS, PengRobinson76
type(CubicEoS) :: eos
eos = PengRobinson76(tc, pc, w)
call eos%mixrule%Bmix(n, eos%b, B, dBi, dBij)

Calculation of the D parameter.

use yaeos, only: CubicEoS, PengRobinson76
type(CubicEoS) :: eos
eos = PengRobinson76(tc, pc, w)

! The mixing rule takes the `a` parameters of the components so
! they should be calculated externally
call eos%alpha%alpha(Tr, a, dadt, dadt2)
a = a * eos%ac
dadt = dadt * eos%ac / eos%components%Tc
dadt2 = dadt2 * eos%ac / eos%components%Tc**2
! Calculate parameter
call eos%mixrule%Dmix(&
   n, V, T, a, dadt, dadt2, D, &
   dDdV, dDdT, dDdV2, dDdT2, dDi, dDdTV, dDidV, dDidT, dDij &
   )

Calculation of the D1 parameter.

use yaeos, only: CubicEoS, PengRobinson76
type(CubicEoS) :: eos
eos = PengRobinson76(tc, pc, w)
call eos%mixrule%D1mix(n, eos%del1, D1, dD1i, dD1ij)
character(len=:), public, allocatable :: name

Name of the model


Type-Bound Procedures

procedure, public :: Cp_residual_pt

  • private subroutine Cp_residual_pt(eos, n, P, T, root_type, Cp)

    Calculate residual heat capacity at constant pressure given pressure and temperature.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(ArModel), intent(in) :: eos

    Model

    real(kind=pr), intent(in) :: n(:)

    Moles number vector

    real(kind=pr), intent(in) :: P

    Pressure [bar]

    real(kind=pr), intent(in) :: T

    Temperature [K]

    character(len=*), intent(in) :: root_type

    Desired root-type to solve. Options are: ["liquid", "vapor", "stable"]

    real(kind=pr), intent(out) :: Cp

    Residual heat capacity at constant pressure [bar L K^-1]

procedure, public :: Cp_residual_vt

  • private subroutine Cp_residual_vt(eos, n, V, T, Cp)

    Calculate residual heat capacity pressure constant given V and T.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(ArModel), intent(in) :: eos

    Model

    real(kind=pr), intent(in) :: n(:)

    Moles number vector

    real(kind=pr), intent(in) :: V

    Volume [L]

    real(kind=pr), intent(in) :: T

    Temperature [K]

    real(kind=pr), intent(out) :: Cp

    heat capacity P constant [bar L / K]

procedure, public :: Cv_residual_pt

  • private subroutine Cv_residual_pt(eos, n, P, T, root_type, Cv)

    Calculate residual heat capacity at constant volume given pressure and temperature.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(ArModel), intent(in) :: eos

    Model

    real(kind=pr), intent(in) :: n(:)

    Moles number vector

    real(kind=pr), intent(in) :: P

    Pressure [bar]

    real(kind=pr), intent(in) :: T

    Temperature [K]

    character(len=*), intent(in) :: root_type

    Desired root-type to solve. Options are: ["liquid", "vapor", "stable"]

    real(kind=pr), intent(out) :: Cv

    Residual heat capacity at constant volume [bar L K^-1]

procedure, public :: Cv_residual_vt

  • private subroutine Cv_residual_vt(eos, n, V, T, Cv)

    Calculate residual heat capacity volume constant given V and T.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(ArModel), intent(in) :: eos

    Model

    real(kind=pr), intent(in) :: n(:)

    Moles number vector

    real(kind=pr), intent(in) :: V

    Volume [L]

    real(kind=pr), intent(in) :: T

    Temperature [K]

    real(kind=pr), intent(out) :: Cv

    heat capacity V constant [bar L / K]

procedure, public :: Psat_pure

  • private function Psat_pure(eos, ncomp, T, Vl, Vv, converged)

    Calculation of saturation pressure of a pure component. Liquid and vapor volumes are initialized at 100 bar and 0.001 bar, then solve_point_psat applies Newton iterations at fixed temperature. The returned value is the pressure evaluated at the converged liquid volume [bar].

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(ArModel), intent(in) :: eos

    Model that will be used

    integer, intent(in) :: ncomp

    Number of component in the mixture from which the saturation pressure will be calculated

    real(kind=pr), intent(in) :: T

    Temperature [K]

    real(kind=pr), intent(out) :: Vl

    Liquid volume [L]

    real(kind=pr), intent(out) :: Vv

    Vapor volume [L]

    logical, intent(out), optional :: converged

    The calculation converged

    Return Value real(kind=pr)

procedure, public :: calculate_attractive_parameters

  • public subroutine calculate_attractive_parameters(self, T, a, dadt, dadt2)

    Pure-component attractive parameters and their temperature derivatives.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(CubicEoS), intent(inout) :: self

    Model

    real(kind=pr), intent(in) :: T

    Temperature [K]

    real(kind=pr), intent(out) :: a(:)

    Attractive parameters [bar L^2/mol^2]

    real(kind=pr), intent(out) :: dadt(:)

    [bar L^2/(mol^2 K)]

    real(kind=pr), intent(out) :: dadt2(:)

    [bar L^2/(mol^2 K^2)]

procedure, public :: enthalpy_excess

  • private subroutine enthalpy_excess(eos, n, P, T, root_type, He)

    Calculate excess enthalpy given pressure and temperature.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(ArModel), intent(in) :: eos

    Model

    real(kind=pr), intent(in) :: n(:)

    Moles number vector

    real(kind=pr), intent(in) :: P

    Pressure [bar]

    real(kind=pr), intent(in) :: T

    Temperature [K]

    character(len=*), intent(in) :: root_type

    Desired root-type to solve. Options are: ["liquid", "vapor", "stable"]

    real(kind=pr), intent(out) :: He

    Excess enthalpy [bar L]

procedure, public :: enthalpy_residual_pt

  • private subroutine enthalpy_residual_pt(eos, n, P, T, root_type, Hr, HrP, HrT, Hrn)

    Calculate residual enthalpy given pressure and temperature.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(ArModel), intent(in) :: eos

    Model

    real(kind=pr), intent(in) :: n(:)

    Moles number vector

    real(kind=pr), intent(in) :: P

    Pressure [bar]

    real(kind=pr), intent(in) :: T

    Temperature [K]

    character(len=*), intent(in) :: root_type

    Desired root-type to solve. Options are: ["liquid", "vapor", "stable"]

    real(kind=pr), intent(out), optional :: Hr

    Residual enthalpy [bar L]

    real(kind=pr), intent(out), optional :: HrP

    real(kind=pr), intent(out), optional :: HrT

    real(kind=pr), intent(out), optional :: Hrn(size(n))

procedure, public :: enthalpy_residual_vt

  • private subroutine enthalpy_residual_vt(eos, n, V, T, Hr, HrV, HrT, Hrn)

    Calculate residual enthalpy given volume and temperature.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(ArModel), intent(in) :: eos

    Model

    real(kind=pr), intent(in) :: n(:)

    Moles number vector

    real(kind=pr), intent(in) :: V

    Volume [L]

    real(kind=pr), intent(in) :: T

    Temperature [K]

    real(kind=pr), intent(out), optional :: Hr

    Residual enthalpy [bar L]

    real(kind=pr), intent(out), optional :: HrV

    real(kind=pr), intent(out), optional :: HrT

    real(kind=pr), intent(out), optional :: Hrn(size(n))

procedure, public :: entropy_excess

  • private subroutine entropy_excess(eos, n, P, T, root_type, Se)

    Calculate excess entropy given pressure and temperature.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(ArModel), intent(in) :: eos

    Model

    real(kind=pr), intent(in) :: n(:)

    Moles number vector

    real(kind=pr), intent(in) :: P

    Pressure [bar]

    real(kind=pr), intent(in) :: T

    Temperature [K]

    character(len=*), intent(in) :: root_type

    Desired root-type to solve. Options are: ["liquid", "vapor", "stable"]

    real(kind=pr), intent(out) :: Se

    Excess entropy [bar L K^-1]

procedure, public :: entropy_residual_pt

  • private subroutine entropy_residual_pt(eos, n, P, T, root_type, Sr, SrP, SrT, Srn)

    Calculate residual entropy given pressure and temperature.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(ArModel), intent(in) :: eos

    Model

    real(kind=pr), intent(in) :: n(:)

    Moles number vector

    real(kind=pr), intent(in) :: P

    Pressure [bar]

    real(kind=pr), intent(in) :: T

    Temperature [K]

    character(len=*), intent(in) :: root_type

    Desired root-type to solve. Options are: ["liquid", "vapor", "stable"]

    real(kind=pr), intent(out), optional :: Sr

    Residual entropy [bar L K^-1]

    real(kind=pr), intent(out), optional :: SrP

    real(kind=pr), intent(out), optional :: SrT

    real(kind=pr), intent(out), optional :: Srn(size(n))

procedure, public :: entropy_residual_vt

  • private subroutine entropy_residual_vt(eos, n, V, T, Sr, SrV, SrT, Srn)

    Calculate residual entropy given volume and temperature.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(ArModel), intent(in) :: eos

    Model

    real(kind=pr), intent(in) :: n(:)

    Moles number vector

    real(kind=pr), intent(in) :: V

    Volume [L]

    real(kind=pr), intent(in) :: T

    Temperature [K]

    real(kind=pr), intent(out), optional :: Sr

    Entropy [bar L / K]

    real(kind=pr), intent(out), optional :: SrV

    real(kind=pr), intent(out), optional :: SrT

    real(kind=pr), intent(out), optional :: Srn(size(n))

procedure, public :: get_v0 => v0

  • public function v0(self, n, p, t)

    Cubic EoS volume initializer. For a Cubic Equation of State, the covolume calculated with the mixing rule is a good estimate for the initial volume solver on the liquid region.

    Arguments

    Type IntentOptional Attributes Name
    class(CubicEoS), intent(in) :: self

    Cubic model with component covolumes and mixing rule.

    real(kind=pr), intent(in) :: n(:)

    Component mole amounts [mol].

    real(kind=pr), intent(in) :: p

    Pressure [bar].

    real(kind=pr), intent(in) :: t

    Temperature [K].

    Return Value real(kind=pr)

procedure, public :: gibbs_excess

  • private subroutine gibbs_excess(eos, n, P, T, root_type, Ge, GeP, GeT, Gen)

    Calculate excess Gibbs energy and its derivatives given pressure and temperature.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(ArModel), intent(in) :: eos

    Model

    real(kind=pr), intent(in) :: n(:)

    Moles number vector

    real(kind=pr), intent(in) :: P

    Pressure [bar]

    real(kind=pr), intent(in) :: T

    Temperature [K]

    character(len=*), intent(in) :: root_type

    Desired root-type to solve. Options are: ["liquid", "vapor", "stable"]

    real(kind=pr), intent(out), optional :: Ge

    Excess Gibbs energy [bar L]

    real(kind=pr), intent(out), optional :: GeP

    real(kind=pr), intent(out), optional :: GeT

    real(kind=pr), intent(out), optional :: Gen(size(n))

procedure, public :: gibbs_residual_pt

  • private subroutine gibbs_residual_pt(eos, n, P, T, root_type, Gr, GrP, GrT, Grn)

    Calculate residual Gibbs energy given pressure and temperature.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(ArModel), intent(in) :: eos

    Model

    real(kind=pr), intent(in) :: n(:)

    Moles number vector

    real(kind=pr), intent(in) :: P

    Pressure [bar]

    real(kind=pr), intent(in) :: T

    Temperature [K]

    character(len=*), intent(in) :: root_type

    Desired root-type to solve. Options are: ["liquid", "vapor", "stable"]

    real(kind=pr), intent(out), optional :: Gr

    Residual Gibbs energy [bar L]

    real(kind=pr), intent(out), optional :: GrP

    real(kind=pr), intent(out), optional :: GrT

    real(kind=pr), intent(out), optional :: Grn(size(n))

procedure, public :: gibbs_residual_vt

  • private subroutine gibbs_residual_vt(eos, n, V, T, Gr, GrV, GrT, Grn)

    Calculate residual Gibbs energy given volume and temperature.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(ArModel), intent(in) :: eos

    Model

    real(kind=pr), intent(in) :: n(:)

    Moles number vector

    real(kind=pr), intent(in) :: V

    Volume [L]

    real(kind=pr), intent(in) :: T

    Temperature [K]

    real(kind=pr), intent(out), optional :: Gr

    Gibbs energy [bar L]

    real(kind=pr), intent(out), optional :: GrV

    real(kind=pr), intent(out), optional :: GrT

    real(kind=pr), intent(out), optional :: Grn(size(n))

procedure, public :: helmholtz_excess

  • private subroutine helmholtz_excess(eos, n, P, T, root_type, Ae)

    Calculate excess Helmholtz energy given pressure and temperature.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(ArModel), intent(in) :: eos

    Model

    real(kind=pr), intent(in) :: n(:)

    Moles number vector

    real(kind=pr), intent(in) :: P

    Pressure [bar]

    real(kind=pr), intent(in) :: T

    Temperature [K]

    character(len=*), intent(in) :: root_type

    Desired root-type to solve. Options are: ["liquid", "vapor", "stable"]

    real(kind=pr), intent(out) :: Ae

    Excess Helmholtz energy [bar L]

procedure, public :: helmholtz_residual_pt

  • private subroutine helmholtz_residual_pt(eos, n, P, T, root_type, Ar, ArP, ArT, Arn)

    Calculate residual Helmholtz energy given pressure and temperature.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(ArModel), intent(in) :: eos

    Model

    real(kind=pr), intent(in) :: n(:)

    Moles number vector

    real(kind=pr), intent(in) :: P

    Pressure [bar]

    real(kind=pr), intent(in) :: T

    Temperature [K]

    character(len=*), intent(in) :: root_type

    Desired root-type to solve. Options are: ["liquid", "vapor", "stable"]

    real(kind=pr), intent(out), optional :: Ar

    Residual Helmholtz energy [bar L]

    real(kind=pr), intent(out), optional :: ArP

    real(kind=pr), intent(out), optional :: ArT

    real(kind=pr), intent(out), optional :: Arn(size(n))

procedure, public :: internal_energy_excess

  • private subroutine internal_energy_excess(eos, n, P, T, root_type, Ue)

    Calculate excess internal energy given pressure and temperature.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(ArModel), intent(in) :: eos

    Model

    real(kind=pr), intent(in) :: n(:)

    Moles number vector

    real(kind=pr), intent(in) :: P

    Pressure [bar]

    real(kind=pr), intent(in) :: T

    Temperature [K]

    character(len=*), intent(in) :: root_type

    Desired root-type to solve. Options are: ["liquid", "vapor", "stable"]

    real(kind=pr), intent(out) :: Ue

    Excess internal energy [bar L]

procedure, public :: internal_energy_residual_pt

  • private subroutine internal_energy_residual_pt(eos, n, P, T, root_type, Ur, UrP, UrT, Urn)

    Calculate residual internal energy given pressure and temperature.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(ArModel), intent(in) :: eos

    Model

    real(kind=pr), intent(in) :: n(:)

    Moles number vector

    real(kind=pr), intent(in) :: P

    Pressure [bar]

    real(kind=pr), intent(in) :: T

    Temperature [K]

    character(len=*), intent(in) :: root_type

    Desired root-type to solve. Options are: ["liquid", "vapor", "stable"]

    real(kind=pr), intent(out), optional :: Ur

    Residual internal energy [bar L]

    real(kind=pr), intent(out), optional :: UrP

    real(kind=pr), intent(out), optional :: UrT

    real(kind=pr), intent(out), optional :: Urn(size(n))

procedure, public :: internal_energy_residual_vt

  • private subroutine internal_energy_residual_vt(eos, n, V, T, Ur, UrV, UrT, Urn)

    Calculate residual internal energy given volume and temperature.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(ArModel), intent(in) :: eos

    Model

    real(kind=pr), intent(in) :: n(:)

    Moles number vector

    real(kind=pr), intent(in) :: V

    Volume [L]

    real(kind=pr), intent(in) :: T

    Temperature [K]

    real(kind=pr), intent(out), optional :: Ur

    Internal energy [bar L]

    real(kind=pr), intent(out), optional :: UrV

    real(kind=pr), intent(out), optional :: UrT

    real(kind=pr), intent(out), optional :: Urn(size(n))

procedure, public :: ln_activity_coefficient

  • private subroutine ln_activity_coefficient(eos, n, P, T, root_type, lngamma, dlngammadP, dlngammadT, dlngammadn)

    Calculate natural logarithm of activity coefficients and its derivatives given pressure and temperature.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(ArModel), intent(in) :: eos

    Model

    real(kind=pr), intent(in) :: n(:)

    Moles number vector

    real(kind=pr), intent(in) :: P

    Pressure [bar]

    real(kind=pr), intent(in) :: T

    Temperature [K]

    character(len=*), intent(in) :: root_type

    Desired root-type to solve. Options are: ["liquid", "vapor", "stable"]

    real(kind=pr), intent(out), optional :: lngamma(size(n))

    Natural logarithm of activity coefficient

    real(kind=pr), intent(out), optional :: dlngammadP(size(n))

    real(kind=pr), intent(out), optional :: dlngammadT(size(n))

    real(kind=pr), intent(out), optional :: dlngammadn(size(n),size(n))

procedure, public :: lnfug_vt

  • private subroutine lnfug_vt(eos, n, V, T, P, lnf, dlnfdV, dlnfdT, dlnfdn, dPdV, dPdT, dPdn)

    Calculate natural logarithm of fugacity given volume and temperature.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(ArModel) :: eos

    Model

    real(kind=pr), intent(in) :: n(:)

    Mixture mole numbers

    real(kind=pr), intent(in) :: V

    Volume [L]

    real(kind=pr), intent(in) :: T

    Temperature [K]

    real(kind=pr), intent(out), optional :: P

    Pressure [bar]

    real(kind=pr), intent(out), optional :: lnf(size(n))

    vector

    real(kind=pr), intent(out), optional :: dlnfdV(size(n))

    Volume derivative

    real(kind=pr), intent(out), optional :: dlnfdT(size(n))

    Temp derivative

    real(kind=pr), intent(out), optional :: dlnfdn(size(n),size(n))

    compositional derivative

    real(kind=pr), intent(out), optional :: dPdV

    real(kind=pr), intent(out), optional :: dPdT

    real(kind=pr), intent(out), optional :: dPdn(:)

procedure, public :: lnphi_pt

  • private subroutine lnphi_pt(eos, n, P, T, V, root_type, lnPhi, dlnPhidP, dlnPhidT, dlnPhidn, dPdV, dPdT, dPdn, lnPhiP)

    Calculate natural logarithm of fugacity given pressure and temperature.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(ArModel), intent(in) :: eos

    Model

    real(kind=pr), intent(in) :: n(:)

    Mixture mole numbers

    real(kind=pr), intent(in) :: P

    Pressure [bar]

    real(kind=pr), intent(in) :: T

    Temperature [K]

    real(kind=pr), intent(out), optional :: V

    Volume [L]

    character(len=*), intent(in) :: root_type

    Type of root desired [“liquid”, “vapor”, “stable”]

    real(kind=pr), intent(out), optional :: lnPhi(size(n))

    vector

    real(kind=pr), intent(out), optional :: dlnPhidP(size(n))

    [1/bar]

    real(kind=pr), intent(out), optional :: dlnPhidT(size(n))

    [1/K]

    real(kind=pr), intent(out), optional :: dlnPhidn(size(n),size(n))

    real(kind=pr), intent(out), optional :: dPdV

    real(kind=pr), intent(out), optional :: dPdT

    real(kind=pr), intent(out), optional :: dPdn(size(n))

    real(kind=pr), intent(out), optional :: lnPhiP(:)

    . It is useful to calculate fugacity coefficients at negatives pressures.

procedure, public :: lnphi_vt

  • private subroutine lnphi_vt(eos, n, V, T, P, lnPhi, dlnPhidP, dlnPhidT, dlnPhidn, dPdV, dPdT, dPdn, lnPhiP)

    Calculate natural logarithm of fugacity coefficent.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(ArModel) :: eos

    Model

    real(kind=pr), intent(in) :: n(:)

    Mixture mole numbers

    real(kind=pr), intent(in) :: V

    Volume [L]

    real(kind=pr), intent(in) :: T

    Temperature [K]

    real(kind=pr), intent(out), optional :: P

    Pressure [bar]

    real(kind=pr), intent(out), optional :: lnPhi(size(n))

    vector

    real(kind=pr), intent(out), optional :: dlnPhidP(size(n))

    Pressure derivative

    real(kind=pr), intent(out), optional :: dlnPhidT(size(n))

    Temp derivative

    real(kind=pr), intent(out), optional :: dlnPhidn(size(n),size(n))

    compositional derivative

    real(kind=pr), intent(out), optional :: dPdV

    real(kind=pr), intent(out), optional :: dPdT

    real(kind=pr), intent(out), optional :: dPdn(:)

    real(kind=pr), intent(out), optional :: lnPhiP(:)

    . It is useful to calculate fugacity coefficients at negatives pressures.

procedure, public :: pressure

  • private subroutine pressure(eos, n, V, T, P, dPdV, dPdT, dPdn)

    Calculate pressure.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(ArModel), intent(in) :: eos

    Model

    real(kind=pr), intent(in) :: n(:)

    Moles number vector

    real(kind=pr), intent(in) :: V

    Volume [L]

    real(kind=pr), intent(in) :: T

    Temperature [K]

    real(kind=pr), intent(out) :: P

    Pressure [bar]

    real(kind=pr), intent(out), optional :: dPdV

    real(kind=pr), intent(out), optional :: dPdT

    real(kind=pr), intent(out), optional :: dPdn(:)

procedure, public :: residual_helmholtz => GenericCubic_Ar

  • public subroutine GenericCubic_Ar(self, n, v, t, ar, arv, ArT, artv, arv2, ArT2, Arn, ArVn, ArTn, Arn2)

    Residual Helmholtz Energy for a generic Cubic Equation of State.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(CubicEoS), intent(in) :: self

    Cubic model containing parameters and mixing-rule state.

    real(kind=pr), intent(in) :: n(:)

    Number of moles

    real(kind=pr), intent(in) :: v

    Volume [L]

    real(kind=pr), intent(in) :: t

    Temperature [K]

    real(kind=pr), intent(out), optional :: ar

    Residual Helmholtz

    real(kind=pr), intent(out), optional :: arv

    real(kind=pr), intent(out), optional :: ArT

    real(kind=pr), intent(out), optional :: artv

    real(kind=pr), intent(out), optional :: arv2

    real(kind=pr), intent(out), optional :: ArT2

    real(kind=pr), intent(out), optional :: Arn(size(n))

    real(kind=pr), intent(out), optional :: ArVn(size(n))

    real(kind=pr), intent(out), optional :: ArTn(size(n))

    real(kind=pr), intent(out), optional :: Arn2(size(n),size(n))

procedure, public :: set_alpha

  • public subroutine set_alpha(self, alpha)

    Set the alpha function used to calculate the attractive parameter.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(CubicEoS), intent(inout) :: self

    Model whose alpha function is replaced.

    class(AlphaFunction), intent(in) :: alpha

    Alpha function

procedure, public :: set_delta1

  • public subroutine set_delta1(self, delta1)

    Set the parameter of the cubic equation.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(CubicEoS) :: self
    real(kind=pr), intent(in) :: delta1(:)

    values

procedure, public :: set_mixrule

  • public subroutine set_mixrule(self, mixrule)

    Set the mixing rule used to calculate mixture attractive parameters.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(CubicEoS), intent(inout) :: self

    Model whose mixing rule is replaced.

    class(CubicMixRule), intent(in) :: mixrule

    Mixing rule

procedure, public :: volume

  • public subroutine volume(eos, n, P, T, V, root_type)

    Volume solver optimized for Cubic Equations of State.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(CubicEoS), intent(in) :: eos

    Cubic EOS and mixing-rule parameters.

    real(kind=pr), intent(in) :: n(:)

    Component mole amounts [mol].

    real(kind=pr), intent(in) :: P

    Pressure [bar].

    real(kind=pr), intent(in) :: T

    Temperature [K].

    real(kind=pr), intent(out) :: V

    Selected total volume [L].

    character(len=*), intent(in) :: root_type

    Requested liquid, vapor, or stable root.

procedure, public :: volume_excess

  • private subroutine volume_excess(eos, n, P, T, root_type, Ve)

    Calculate excess volume given pressure and temperature.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(ArModel), intent(in) :: eos

    Model

    real(kind=pr), intent(in) :: n(:)

    Moles number vector

    real(kind=pr), intent(in) :: P

    Pressure [bar]

    real(kind=pr), intent(in) :: T

    Temperature [K]

    character(len=*), intent(in) :: root_type

    Desired root-type to solve. Options are: ["liquid", "vapor", "stable"]

    real(kind=pr), intent(out) :: Ve

    Excess volume [L]