yaeos__models_ar_genericcubic Module



Abstract Interfaces

abstract interface

  • public subroutine abs_Bmix(self, n, bi, B, dBi, dBij)

    Arguments

    Type IntentOptional Attributes Name
    class(CubicMixRule), intent(in) :: self
    real(kind=pr), intent(in) :: n(:)
    real(kind=pr), intent(in) :: bi(:)
    real(kind=pr), intent(out) :: B
    real(kind=pr), intent(out) :: dBi(:)
    real(kind=pr), intent(out) :: dBij(:,:)

abstract interface

  • public subroutine abs_D1mix(self, n, d1i, D1, dD1i, dD1ij)

    Arguments

    Type IntentOptional Attributes Name
    class(CubicMixRule), intent(in) :: self
    real(kind=pr), intent(in) :: n(:)
    real(kind=pr), intent(in) :: d1i(:)
    real(kind=pr), intent(out) :: D1
    real(kind=pr), intent(out) :: dD1i(:)
    real(kind=pr), intent(out) :: dD1ij(:,:)

abstract interface

  • public subroutine abs_Dmix(self, n, T, ai, daidt, daidt2, D, dDdT, dDdT2, dDi, dDidT, dDij)

    Arguments

    Type IntentOptional Attributes Name
    class(CubicMixRule), intent(in) :: self
    real(kind=pr), intent(in) :: n(:)
    real(kind=pr), intent(in) :: T
    real(kind=pr), intent(in) :: ai(:)
    real(kind=pr), intent(in) :: daidt(:)
    real(kind=pr), intent(in) :: daidt2(:)
    real(kind=pr), intent(out) :: D
    real(kind=pr), intent(out) :: dDdT
    real(kind=pr), intent(out) :: dDdT2
    real(kind=pr), intent(out) :: dDi(:)
    real(kind=pr), intent(out) :: dDidT(:)
    real(kind=pr), intent(out) :: dDij(:,:)

abstract interface

  • public subroutine abs_alpha(self, Tr, a, dadt, dadt2)

    Arguments

    Type IntentOptional Attributes Name
    class(AlphaFunction), intent(in) :: self
    real(kind=pr), intent(in) :: Tr(:)
    real(kind=pr), intent(out) :: a(:)
    real(kind=pr), intent(out) :: dadt(:)
    real(kind=pr), intent(out) :: dadt2(:)

Derived Types

type, public, abstract ::  AlphaFunction

Abstract derived type that describe the required procedure for an alpha function.

Type-Bound Procedures

procedure(abs_alpha), public, deferred :: alpha

type, public, extends(ArModel) ::  CubicEoS

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:

Read more…

Components

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

Attractive critical parameter

class(AlphaFunction), public, allocatable :: alpha

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.

Read more…
real(kind=pr), public, allocatable :: b(:)

Repulsive parameter

type(Substances), public :: components

Substances contained in the module

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

paramter

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

paramter

class(CubicMixRule), public, allocatable :: mixrule

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.

Read more…
character(len=:), public, allocatable :: name

Name of the model

Type-Bound Procedures

procedure, public :: Cp_residual_vt
procedure, public :: Cv_residual_vt
procedure, public :: enthalpy_residual_vt
procedure, public :: entropy_residual_vt
procedure, public :: get_v0 => v0
procedure, public :: gibbs_residual_vt => gibbs_residual_VT
procedure, public :: lnphi_pt => fugacity_pt
procedure, public :: lnphi_vt => fugacity_vt
procedure, public :: pressure
procedure, public :: residual_helmholtz => GenericCubic_Ar
procedure, public :: set_delta1
procedure, public :: set_mixrule
procedure, public :: volume

type, public, abstract ::  CubicMixRule

Abstract derived type that describe the required procedure for a mixing rule on a Cubic EoS

Components

Type Visibility Attributes Name Initial
logical, public :: dn2 = .false.

Calculate second order derivatives

Type-Bound Procedures

procedure(abs_Bmix), public, deferred :: Bmix
procedure(abs_D1mix), public, deferred :: D1mix
procedure(abs_Dmix), public, deferred :: Dmix

Functions

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
real(kind=pr), intent(in) :: n(:)
real(kind=pr), intent(in) :: p
real(kind=pr), intent(in) :: t

Return Value real(kind=pr)


Subroutines

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
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))

public subroutine set_delta1(self, delta1)

Arguments

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

public subroutine set_mixrule(self, mixrule)

Arguments

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

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
real(kind=pr), intent(in) :: n(:)
real(kind=pr), intent(in) :: P
real(kind=pr), intent(in) :: T
real(kind=pr), intent(out) :: V
character(len=*), intent(in) :: root_type