Base types and the generic implementation of a cubic equation of state. The module defines the abstract AlphaFunction and CubicMixRule types, and the CubicEoS model that combines them. Specific cubic equations are provided in yaeos__models_ar_cubic_implementations. Defines the alpha-function and mixing-rule contracts, evaluates generic cubic Helmholtz expressions, and provides model configuration methods.
model = PengRobinson76(Tc, Pc, omega)
call model%set_alpha(alpha_function)
Evaluate the repulsive mixture parameter and its composition derivatives.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(CubicMixRule), | intent(in) | :: | self |
Mixing-rule implementation. |
||
| real(kind=pr), | intent(in) | :: | n(:) |
Component mole amounts [mol]. |
||
| real(kind=pr), | intent(in) | :: | bi(:) |
Pure-component covolumes. |
||
| real(kind=pr), | intent(out) | :: | B |
Mixture covolume [L]. |
||
| real(kind=pr), | intent(out) | :: | dBi(:) |
Mole-number gradient of the mixture covolume. |
||
| real(kind=pr), | intent(out) | :: | dBij(:,:) |
Mole-number Hessian of the mixture covolume. |
Evaluate the first denominator parameter and its composition derivatives.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(CubicMixRule), | intent(in) | :: | self |
Mixing-rule implementation. |
||
| real(kind=pr), | intent(in) | :: | n(:) |
Component mole amounts [mol]. |
||
| real(kind=pr), | intent(in) | :: | d1i(:) |
Pure-component values. |
||
| real(kind=pr), | intent(out) | :: | D1 |
Mixture parameter. |
||
| real(kind=pr), | intent(out) | :: | dD1i(:) |
Gradient of |
||
| real(kind=pr), | intent(out) | :: | dD1ij(:,:) |
Hessian of |
Evaluate the attractive mixture parameter and its state/composition derivatives for a cubic mixing rule.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(CubicMixRule), | intent(in) | :: | self |
Mixing-rule implementation. |
||
| real(kind=pr), | intent(in) | :: | n(:) |
Component mole amounts [mol]. |
||
| real(kind=pr), | intent(in) | :: | V |
Total volume [L]. |
||
| real(kind=pr), | intent(in) | :: | T |
Temperature [K]. |
||
| real(kind=pr), | intent(in) | :: | ai(:) |
Pure-component attractive parameters. |
||
| real(kind=pr), | intent(in) | :: | daidt(:) |
Temperature derivatives of pure-component attractive parameters. |
||
| real(kind=pr), | intent(in) | :: | daidt2(:) |
Second temperature derivatives of pure-component attractive parameters. |
||
| real(kind=pr), | intent(out) | :: | D |
Attractive mixture parameter. |
||
| real(kind=pr), | intent(out) | :: | dDdV |
Volume derivative of the attractive mixture parameter. |
||
| real(kind=pr), | intent(out) | :: | dDdT |
Temperature derivative of the attractive mixture parameter. |
||
| real(kind=pr), | intent(out) | :: | dDdV2 |
Second volume derivative of the attractive mixture parameter. |
||
| real(kind=pr), | intent(out) | :: | dDdT2 |
Second temperature derivative of the attractive mixture parameter. |
||
| real(kind=pr), | intent(out) | :: | dDi(:) |
Mole-number gradient of the attractive mixture parameter. |
||
| real(kind=pr), | intent(out) | :: | dDdTV |
Mixed temperature/volume derivative of the attractive mixture parameter. |
||
| real(kind=pr), | intent(out) | :: | dDidV(:) |
Volume derivative of the attractive mole-number gradient. |
||
| real(kind=pr), | intent(out) | :: | dDidT(:) |
Temperature derivative of the attractive mole-number gradient. |
||
| real(kind=pr), | intent(out) | :: | dDij(:,:) |
Mole-number Hessian of the attractive mixture parameter. |
Evaluate a cubic alpha function and its reduced-temperature derivatives.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(AlphaFunction), | intent(in) | :: | self |
Alpha-function implementation. |
||
| real(kind=pr), | intent(in) | :: | Tr(:) |
Reduced temperatures, one per component. |
||
| real(kind=pr), | intent(out) | :: | a(:) |
Alpha-function values. |
||
| real(kind=pr), | intent(out) | :: | dadt(:) |
First reduced-temperature derivative of alpha. |
||
| real(kind=pr), | intent(out) | :: | dadt2(:) |
Second reduced-temperature derivative of alpha. |
Abstract contract for temperature corrections to cubic attraction.
| procedure(abs_alpha), public, deferred :: alpha |
Generic cubic equation of state with configurable alpha and mixing rules.
| 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 |
Uses the abstract derived type |
||
| 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 |
Uses the abstract derived type |
||
| character(len=:), | public, | allocatable | :: | name |
Name of the model |
| procedure, public :: Cp_residual_pt | |
| procedure, public :: Cp_residual_vt | |
| procedure, public :: Cv_residual_pt | |
| procedure, public :: Cv_residual_vt | |
| procedure, public :: Psat_pure | |
| procedure, public :: calculate_attractive_parameters | |
| procedure, public :: enthalpy_excess | |
| procedure, public :: enthalpy_residual_pt | |
| procedure, public :: enthalpy_residual_vt | |
| procedure, public :: entropy_excess | |
| procedure, public :: entropy_residual_pt | |
| procedure, public :: entropy_residual_vt | |
| procedure, public :: get_v0 => v0 | |
| procedure, public :: gibbs_excess | |
| procedure, public :: gibbs_residual_pt | |
| procedure, public :: gibbs_residual_vt | |
| procedure, public :: helmholtz_excess | |
| procedure, public :: helmholtz_residual_pt | |
| procedure, public :: internal_energy_excess | |
| procedure, public :: internal_energy_residual_pt | |
| procedure, public :: internal_energy_residual_vt | |
| procedure, public :: ln_activity_coefficient | |
| procedure, public :: lnfug_vt | |
| procedure, public :: lnphi_pt | |
| procedure, public :: lnphi_vt | |
| procedure, public :: pressure | |
| procedure, public :: residual_helmholtz => GenericCubic_Ar | |
| procedure, public :: set_alpha | |
| procedure, public :: set_delta1 | |
| procedure, public :: set_mixrule | |
| procedure, public :: volume | |
| procedure, public :: volume_excess |
Abstract contract for cubic-EOS mixture parameter calculations.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| logical, | public | :: | dn2 | = | .false. |
Calculate second-order mole-number derivatives |
|
| logical, | public | :: | is_D_ddlc | = | .false. |
Mixing rule D parameter depends on volume (density) |
| procedure(abs_Bmix), public, deferred :: Bmix | |
| procedure(abs_D1mix), public, deferred :: D1mix | |
| procedure(abs_Dmix), public, deferred :: Dmix |
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.
| Type | Intent | Optional | 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]. |
Residual Helmholtz Energy for a generic Cubic Equation of State.
| Type | Intent | Optional | 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)) |
|
Pure-component attractive parameters and their temperature derivatives.
| Type | Intent | Optional | 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)] |
Set the alpha function used to calculate the attractive parameter.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(CubicEoS), | intent(inout) | :: | self |
Model whose alpha function is replaced. |
||
| class(AlphaFunction), | intent(in) | :: | alpha |
Alpha function |
Set the parameter of the cubic equation.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(CubicEoS) | :: | self | ||||
| real(kind=pr), | intent(in) | :: | delta1(:) |
values |
Set the mixing rule used to calculate mixture attractive parameters.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(CubicEoS), | intent(inout) | :: | self |
Model whose mixing rule is replaced. |
||
| class(CubicMixRule), | intent(in) | :: | mixrule |
Mixing rule |
Volume solver optimized for Cubic Equations of State.
| Type | Intent | Optional | 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 |