Compatibility layer for older applications that use global EOS state and procedure pointers.
This module stores model configuration, component data, and mixing
parameters in module variables, then dispatches properties through the
ar_fun and vinit pointers from ar_interface. It is retained for
compatibility only: it is not reentrant or thread-safe, and new code
should use the object-oriented model types exported by yaeos.
call setup(nc, nmodel, ntdep, ncomb)
call PR78_factory(z, ac, b, Tc, Pc, omega, k)
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| real(kind=pr), | public, | allocatable | :: | ac(:) |
Critical attractive parameter [bar (L/mol)^2] |
||
| real(kind=pr), | public, | allocatable | :: | b(:) |
repulsive parameter [L] |
||
| real(kind=pr), | public, | allocatable | :: | bij(:,:) |
Pair covolume matrix used by quadratic mixing. |
||
| real(kind=pr), | public, | allocatable | :: | dc(:) |
Critical density [mol/L] |
||
| real(kind=pr), | public, | allocatable | :: | del1(:) |
parameter |
||
| real(kind=pr), | public, | allocatable | :: | k(:) |
Attractive parameter constant |
||
| real(kind=pr), | public, | allocatable | :: | kij(:,:) |
Attractive BIP |
||
| real(kind=pr), | public, | allocatable | :: | kij0(:,:) |
Low-temperature binary interaction coefficients. |
||
| real(kind=pr), | public, | allocatable | :: | kinf(:,:) |
Asymptotic binary interaction coefficients. |
||
| real(kind=pr), | public, | allocatable | :: | lij(:,:) |
Repulsive BIP |
||
| integer, | public | :: | mixing_rule |
Legacy integer selector for the mixing rule. |
|||
| integer, | public | :: | nc |
Number of active components. |
|||
| real(kind=pr), | public, | allocatable | :: | pc(:) |
Critical pressure [bar] |
||
| real(kind=pr), | public, | allocatable | :: | tc(:) |
Critical temperature [K] |
||
| integer, | public | :: | tdep |
Legacy selector for temperature-dependent binary interactions. |
|||
| integer, | public | :: | thermo_model |
Legacy integer selector for the cubic EOS alpha/covolume formulation. |
|||
| real(kind=pr), | public, | allocatable | :: | tstar(:,:) |
Reference temperatures for the binary interaction law. |
||
| real(kind=pr), | public, | allocatable | :: | w(:) |
Acentric factor |
||
| real(kind=pr), | public, | allocatable | :: | z(:) |
Mole fractions vector |
Return a cubic-EOS liquid-volume initial estimate for legacy solvers.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=pr) | :: | z(:) |
Feed or overall composition. |
|||
| real(kind=pr) | :: | p | ||||
| real(kind=pr) | :: | t |
Dispatch the configured legacy residual Helmholtz implementation.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | nc |
Number of active components. |
||
| integer, | intent(in) | :: | nder |
Get compositional derivatives |
||
| integer, | intent(in) | :: | ntemp |
Get temperature derivatives |
||
| real(kind=pr), | intent(in) | :: | z(nc) |
Component mole amounts/composition vector. |
||
| real(kind=pr), | intent(in) | :: | V |
Total volume [L]. |
||
| real(kind=pr), | intent(in) | :: | T |
Temperature [K]. |
||
| real(kind=pr), | intent(out) | :: | ar |
Residual Helmholtz energy. |
||
| real(kind=pr), | intent(out) | :: | arv |
First volume derivative of residual Helmholtz energy. |
||
| real(kind=pr), | intent(out) | :: | artv |
Mixed volume-temperature derivative of residual Helmholtz energy. |
||
| real(kind=pr), | intent(out) | :: | arv2 |
Second volume derivative of residual Helmholtz energy. |
||
| real(kind=pr), | intent(out), | dimension(size(z)) | :: | Arn |
Composition gradient of residual Helmholtz energy. |
|
| real(kind=pr), | intent(out), | dimension(size(z)) | :: | ArVn |
Mixed volume-composition derivatives. |
|
| real(kind=pr), | intent(out), | dimension(size(z)) | :: | ArTn |
Mixed temperature-composition derivatives. |
|
| real(kind=pr), | intent(out) | :: | Arn2(size(z),size(z)) |
Composition Hessian of residual Helmholtz energy. |
Evaluate the legacy quadratic-mixture covolume and derivatives.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | nc |
Number of active components. |
||
| real(kind=pr), | intent(in) | :: | rn(nc) |
Component mole amounts used in mixture rules. |
||
| real(kind=pr), | intent(out) | :: | Bmix |
Mixture covolume. |
||
| real(kind=pr), | intent(out) | :: | dBi(nc) |
Mole-number gradient of the mixture covolume. |
||
| real(kind=pr), | intent(out) | :: | dBij(nc,nc) |
Mole-number Hessian of the mixture covolume. |
Evaluate the mole-averaged cubic denominator parameter and derivatives.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | nc |
Number of active components. |
||
| real(kind=pr), | intent(in) | :: | rn(nc) |
Component mole amounts used in mixture rules. |
||
| real(kind=pr), | intent(out) | :: | D1m |
Mixture cubic denominator parameter. |
||
| real(kind=pr), | intent(out) | :: | dD1i(nc) |
Mole-number gradient of the cubic denominator parameter. |
||
| real(kind=pr), | intent(out) | :: | dD1ij(nc,nc) |
Mole-number Hessian of the cubic denominator parameter. |
Evaluate the legacy mixture attractive parameter and derivatives.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | ntd |
Flag selecting temperature-dependent derivative calculations. |
||
| integer, | intent(in) | :: | nc |
Number of active components. |
||
| real(kind=pr), | intent(in) | :: | T |
Temperature [K]. |
||
| real(kind=pr), | intent(in) | :: | rn(nc) |
Component mole amounts used in mixture rules. |
||
| real(kind=pr), | intent(out) | :: | D |
Mixture attractive parameter. |
||
| real(kind=pr), | intent(out) | :: | dDi(nc) |
. |
||
| real(kind=pr), | intent(out) | :: | dDiT(nc) |
. |
||
| real(kind=pr), | intent(out) | :: | dDij(nc,nc) |
. |
||
| real(kind=pr), | intent(out) | :: | dDdT |
. |
||
| real(kind=pr), | intent(out) | :: | dDdT2 |
. |
Calculate the reduced residual Helmholtz Energy and it’s derivatives with the RKPR EOS
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | nco |
Number of components in the mixture. |
||
| integer, | intent(in) | :: | NDE |
Compositional derivative order; |
||
| integer, | intent(in) | :: | NTD |
Flag selecting temperature-dependent derivative calculations. |
||
| real(kind=pr), | intent(in) | :: | rn(nco) |
Component mole amounts used in mixture rules. |
||
| real(kind=pr), | intent(in) | :: | V |
Total volume [L]. |
||
| real(kind=pr), | intent(in) | :: | T |
Temperature [K]. |
||
| real(kind=pr), | intent(out) | :: | Ar |
Residual Helmholtz energy. |
||
| real(kind=pr), | intent(out) | :: | ArV |
First volume derivative of residual Helmholtz energy. |
||
| real(kind=pr), | intent(out) | :: | ArTV |
Mixed volume-temperature derivative of residual Helmholtz energy. |
||
| real(kind=pr), | intent(out) | :: | ArV2 |
Second volume derivative of residual Helmholtz energy. |
||
| real(kind=pr), | intent(out) | :: | Arn(nco) |
Mole-number gradient of residual Helmholtz energy. |
||
| real(kind=pr), | intent(out) | :: | ArVn(nco) |
Mixed volume/mole-number derivative of residual Helmholtz energy. |
||
| real(kind=pr), | intent(out) | :: | ArTn(nco) |
Mixed temperature/mole-number derivative of residual Helmholtz energy. |
||
| real(kind=pr), | intent(out) | :: | Arn2(nco,nco) |
Mole-number Hessian of residual Helmholtz energy. |
Evaluate the SRK/PR-family residual Helmholtz expression and derivatives.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | nc |
Number of components |
||
| integer, | intent(in) | :: | nd |
Compositional derivatives |
||
| integer, | intent(in) | :: | nt |
Temperature derivatives |
||
| real(kind=pr), | intent(in) | :: | rn(nc) |
Number of moles |
||
| real(kind=pr), | intent(in) | :: | v |
Volume [L] |
||
| real(kind=pr), | intent(in) | :: | t |
Temperature [K] |
||
| real(kind=pr), | intent(out) | :: | ar |
Residual Helmholtz |
||
| real(kind=pr), | intent(out) | :: | arv |
dAr/dV |
||
| real(kind=pr), | intent(out) | :: | artv |
dAr2/dTV |
||
| real(kind=pr), | intent(out) | :: | arv2 |
dAr2/dV2 |
||
| real(kind=pr), | intent(out) | :: | Arn(nc) |
dAr/dn |
||
| real(kind=pr), | intent(out) | :: | ArVn(nc) |
dAr2/dVn |
||
| real(kind=pr), | intent(out) | :: | ArTn(nc) |
dAr2/dTn |
||
| real(kind=pr), | intent(out) | :: | Arn2(nc,nc) |
dAr2/dn2 |
PengRobinson 76 factory
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=pr), | intent(in) | :: | moles_in(nc) |
Component mole amounts or feed composition used to initialize the legacy model. |
||
| real(kind=pr), | intent(in), | optional | :: | ac_in(nc) |
Optional precomputed critical attractive parameters. |
|
| real(kind=pr), | intent(in), | optional | :: | b_in(nc) |
Optional precomputed covolumes. |
|
| real(kind=pr), | intent(in), | optional | :: | tc_in(nc) |
Optional critical temperatures [K]. |
|
| real(kind=pr), | intent(in), | optional | :: | pc_in(nc) |
Optional critical pressures [bar]. |
|
| real(kind=pr), | intent(in), | optional | :: | w_in(nc) |
Optional acentric factors. |
|
| real(kind=pr), | intent(in), | optional | :: | k_in(nc) |
Optional alpha-function parameters. |
PengRobinson 78 factory
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=pr), | intent(in) | :: | moles_in(nc) |
Component mole amounts or feed composition used to initialize the legacy model. |
||
| real(kind=pr), | intent(in), | optional | :: | ac_in(nc) |
Optional precomputed critical attractive parameters. |
|
| real(kind=pr), | intent(in), | optional | :: | b_in(nc) |
Optional precomputed covolumes. |
|
| real(kind=pr), | intent(in), | optional | :: | tc_in(nc) |
Optional critical temperatures [K]. |
|
| real(kind=pr), | intent(in), | optional | :: | pc_in(nc) |
Optional critical pressures [bar]. |
|
| real(kind=pr), | intent(in), | optional | :: | w_in(nc) |
Optional acentric factors. |
|
| real(kind=pr), | intent(in), | optional | :: | k_in(nc) |
Optional alpha-function parameters. |
SoaveRedlichKwong factory
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=pr), | intent(in) | :: | moles_in(nc) |
Component mole amounts or feed composition used to initialize the legacy model. |
||
| real(kind=pr), | intent(in), | optional | :: | ac_in(nc) |
Optional precomputed critical attractive parameters. |
|
| real(kind=pr), | intent(in), | optional | :: | b_in(nc) |
Optional precomputed covolumes. |
|
| real(kind=pr), | intent(in), | optional | :: | tc_in(nc) |
Optional critical temperatures [K]. |
|
| real(kind=pr), | intent(in), | optional | :: | pc_in(nc) |
Optional critical pressures [bar]. |
|
| real(kind=pr), | intent(in), | optional | :: | w_in(nc) |
Optional acentric factors. |
|
| real(kind=pr), | intent(in), | optional | :: | k_in(nc) |
Optional alpha-function parameters. |
Evaluate the configured cubic alpha correction and its temperature derivatives.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=pr), | intent(in) | :: | ac |
Pure-component critical attractive parameter. |
||
| real(kind=pr), | intent(in) | :: | Tc |
Pure-component critical temperature [K]. |
||
| real(kind=pr), | intent(in) | :: | k |
Alpha-function parameter. |
||
| real(kind=pr), | intent(in) | :: | T |
Temperature [K]. |
||
| real(kind=pr), | intent(out) | :: | a |
Attractive parameter at the state. |
||
| real(kind=pr), | intent(out) | :: | dadT |
First temperature derivative of the attractive parameter. |
||
| real(kind=pr), | intent(out) | :: | dadT2 |
Second temperature derivative of the attractive parameter. |
Build pair attractive parameters and their temperature derivatives.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | ntd |
Flag selecting temperature-dependent derivative calculations. |
||
| integer, | intent(in) | :: | nc |
Number of active components. |
||
| real(kind=pr), | intent(in) | :: | T |
Temperature [K]. |
||
| real(kind=pr), | intent(out) | :: | aij(nc,nc) |
Pair attractive-parameter matrix. |
||
| real(kind=pr), | intent(out) | :: | daijdT(nc,nc) |
Temperature derivative of the pair attractive parameters. |
||
| real(kind=pr), | intent(out) | :: | daijdT2(nc,nc) |
Second temperature derivative of the pair attractive parameters. |
Evaluate residual Helmholtz derivatives for the legacy RKPR model.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=pr), | intent(in) | :: | z(:) |
Number of moles |
||
| real(kind=pr), | intent(in) | :: | v |
Volume [L] |
||
| real(kind=pr), | intent(in) | :: | t |
Temperature [K] |
||
| real(kind=pr), | intent(out) | :: | ar |
Residual Helmholtz |
||
| real(kind=pr), | intent(out) | :: | arv |
dAr/dV |
||
| real(kind=pr), | intent(out) | :: | artv |
dAr2/dTV |
||
| real(kind=pr), | intent(out) | :: | arv2 |
dAr2/dV2 |
||
| real(kind=pr), | intent(out) | :: | Arn(size(z)) |
dAr/dn |
||
| real(kind=pr), | intent(out) | :: | ArVn(size(z)) |
dAr2/dVn |
||
| real(kind=pr), | intent(out) | :: | ArTn(size(z)) |
dAr2/dTn |
||
| real(kind=pr), | intent(out) | :: | Arn2(size(z),size(z)) |
dAr2/dn2 |
Wrapper subroutine to the SRK/PR Residula Helmholtz function to use the general interface
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=pr), | intent(in) | :: | z(:) |
Number of moles |
||
| real(kind=pr), | intent(in) | :: | v |
Volume [L] |
||
| real(kind=pr), | intent(in) | :: | t |
Temperature [K] |
||
| real(kind=pr), | intent(out) | :: | ar |
Residual Helmholtz |
||
| real(kind=pr), | intent(out) | :: | arv |
dAr/dV |
||
| real(kind=pr), | intent(out) | :: | artv |
dAr2/dTV |
||
| real(kind=pr), | intent(out) | :: | arv2 |
dAr2/dV2 |
||
| real(kind=pr), | intent(out) | :: | Arn(size(z)) |
dAr/dn |
||
| real(kind=pr), | intent(out) | :: | ArVn(size(z)) |
dAr2/dVn |
||
| real(kind=pr), | intent(out) | :: | ArTn(size(z)) |
dAr2/dTn |
||
| real(kind=pr), | intent(out) | :: | Arn2(size(z),size(z)) |
dAr2/dn2 |
Calculate Zc, OMa and OMb from the delta_1 parameter.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=pr), | intent(in) | :: | del1(:) |
delta_1 parameter |
||
| real(kind=pr), | intent(out) | :: | Zc(:) |
Critical compressibility factor |
||
| real(kind=pr), | intent(out) | :: | OMa(:) |
OMa |
||
| real(kind=pr), | intent(out) | :: | OMb(:) |
OMb |
Initialize the global configuration and allocate legacy model arrays.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | n |
Number of components |
||
| integer, | intent(in) | :: | nmodel |
Number of model |
||
| integer, | intent(in) | :: | ntdep |
Kij dependant of temperature |
||
| integer, | intent(in) | :: | ncomb |
Combining rule |