Implementation of the non-associating PC-SAFT residual Helmholtz model.
The module defines the model type PCSAFT, its parameter constructor init_pcsaft, and the primal and Tapenade-generated directional and adjoint derivative routines. PC-SAFT includes hard-chain and dispersion contributions but not the association contribution.
model = init_pcsaft(m, sigma, epsilon_k, kij)
call model%pressure(n, V, T, P)
Gross, J., and G. Sadowski (2001). Perturbed-Chain SAFT: An Equation of State Based on a Perturbation Theory for Chain Molecules. Industrial & Engineering Chemistry Research, 40, 1244-1260.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| real(kind=pr), | public, | DIMENSION(0:2, 0:6), SAVE | :: | a_coeffs | = | RESHAPE((/0.9105631445, -0.3084016918, -0.0906148351, 0.6361281449, 0.1860531159, 0.4527842806, 2.6861347891, -2.5030047259, 0.5962700728, -26.547362491, 21.419793629, -1.7241829131, 97.759208784, -65.255885330, -4.1302112531, -159.59154087, 83.318680481, 13.776631870, 91.297774084, -33.746922930, -8.6728470368/), (/3, 7/)) |
Universal PC-SAFT constants of the dispersion integral ; second index is the power of . |
| real(kind=pr), | public, | DIMENSION(0:2, 0:6), SAVE | :: | b_coeffs | = | RESHAPE((/0.7240946941, -0.5755498075, 0.0976883116, 2.2382791861, 0.6995095521, -0.2557574982, -4.0025849485, 3.8925673390, -9.1558561530, -21.003576815, -17.215471648, 20.642075974, 26.855641363, 192.67226447, -38.804430052, 206.55133841, -161.82646165, 93.626774077, -355.60235612, -165.20769346, -29.666905585/), (/3, 7/)) |
Universal PC-SAFT constants of the dispersion integral ; second index is the power of . |
| real(kind=pr), | public, | parameter | :: | n_avo | = | 6.02214076e23_pr |
Avogadro constant [molecules/mol]. |
| real(kind=pr), | public, | parameter | :: | pi | = | 3.14159265359_pr |
Mathematical constant . |
| real(kind=pr), | public, | parameter | :: | units_factor | = | 0.000602214086_pr |
Converts mol/L and Angstrom-based packing calculations to dimensionless density. |
Non-associating perturbed-chain statistical associating fluid model.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| type(Substances), | public | :: | components |
Pure-component properties for the model’s component order. |
|||
| real(kind=pr), | public, | ALLOCATABLE | :: | epsilon_k(:) |
Energy / k_B [K] |
||
| real(kind=pr), | public, | ALLOCATABLE | :: | kij(:,:) |
Binary interaction parameters (optional) |
||
| real(kind=pr), | public, | ALLOCATABLE | :: | m(:) |
Number of segments |
||
| character(len=:), | public, | allocatable | :: | name |
Name of the model |
||
| real(kind=pr), | public, | ALLOCATABLE | :: | sigma(:) |
Segment diameter [Angstrom] |
| 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 :: ar => AR | |
| procedure, public :: ar_b => AR_B | |
| procedure, public :: ar_d => AR_D | |
| procedure, public :: ar_d_b => AR_D_B | |
| procedure, public :: ar_d_d => AR_D_D | |
| 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 | |
| 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 | |
| procedure, public :: volume | |
| procedure, public :: volume_excess |
Return the close-packed segment volume used to initialize a volume solve.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(PCSAFT), | intent(in) | :: | self |
PC-SAFT model and segment data. |
||
| real(kind=pr), | intent(in) | :: | n(:) |
Component mole amounts [mol]. |
||
| real(kind=pr), | intent(in) | :: | P |
Pressure [bar]; unused in the close-packed initializer. |
||
| real(kind=pr), | intent(in) | :: | T |
Temperature [K]; unused in the close-packed initializer. |
Create a PC-SAFT model.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=8), | intent(in) | :: | m(:) |
Number of segments |
||
| real(kind=8), | intent(in) | :: | sigma(:) |
Segment diameter [Angstrom] |
||
| real(kind=8), | intent(in) | :: | epsilon_k(:) |
Energy / k_B [K] |
||
| real(kind=8), | intent(in), | optional | :: | kij(:,:) |
Binary interaction parameters (optional) |
Evaluate the primal PC-SAFT residual Helmholtz energy.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(PCSAFT), | intent(in) | :: | model |
Model supplying segment parameters. |
||
| 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(out) | :: | arval |
Residual Helmholtz energy in library units. |
Evaluate the primal PC-SAFT energy and reverse-mode sensitivities.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(PCSAFT), | intent(in) | :: | model |
Model supplying PC-SAFT segment parameters. |
||
| real(kind=pr), | intent(in) | :: | n(:) |
Component mole amounts [mol]. |
||
| real(kind=pr) | :: | nb(:) |
Adjoint value for component mole amounts. |
|||
| real(kind=pr), | intent(in) | :: | v |
Total volume [L]. |
||
| real(kind=pr) | :: | vb |
Adjoint value for volume. |
|||
| real(kind=pr), | intent(in) | :: | t |
Temperature [K]. |
||
| real(kind=pr) | :: | tb |
Adjoint value for temperature. |
|||
| real(kind=pr) | :: | arval |
Primal residual Helmholtz energy. |
|||
| real(kind=pr) | :: | arvalb |
Incoming adjoint seed for the energy output. |
Evaluate the PC-SAFT primal residual Helmholtz energy and one tangent.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(PCSAFT), | intent(in) | :: | model |
Model supplying PC-SAFT segment parameters. |
||
| real(kind=pr), | intent(in) | :: | n(:) |
Component mole amounts [mol]. |
||
| real(kind=pr), | intent(in) | :: | nd(:) |
Tangent seed for component mole amounts (nd). |
||
| real(kind=pr), | intent(in) | :: | v |
Total volume [L]. |
||
| real(kind=pr), | intent(in) | :: | vd |
Tangent seed for volume (vd). |
||
| real(kind=pr), | intent(in) | :: | t |
Temperature [K]. |
||
| real(kind=pr), | intent(in) | :: | td |
Tangent seed for temperature (td). |
||
| real(kind=pr), | intent(out) | :: | arval |
Primal residual Helmholtz energy. |
||
| real(kind=pr), | intent(out) | :: | arvald |
Directional derivative of |
Evaluate mixed tangent-adjoint derivatives for PC-SAFT.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(PCSAFT), | intent(in) | :: | model |
Model supplying PC-SAFT segment parameters. |
||
| real(kind=pr), | intent(in) | :: | n(:) |
Component mole amounts [mol]. |
||
| real(kind=pr) | :: | nb(:) |
Adjoint value for component mole amounts. |
|||
| real(kind=pr), | intent(in) | :: | nd(:) |
Tangent seed for component mole amounts (nd). |
||
| real(kind=pr) | :: | ndb(:) |
Mixed tangent-adjoint value for component mole amounts. |
|||
| real(kind=pr), | intent(in) | :: | v |
Total volume [L]. |
||
| real(kind=pr) | :: | vb |
Adjoint value for volume. |
|||
| real(kind=pr), | intent(in) | :: | vd |
Tangent seed for volume (vd). |
||
| real(kind=pr) | :: | vdb |
Mixed tangent-adjoint value for volume. |
|||
| real(kind=pr), | intent(in) | :: | t |
Temperature [K]. |
||
| real(kind=pr) | :: | tb |
Adjoint value for temperature. |
|||
| real(kind=pr), | intent(in) | :: | td |
Tangent seed for temperature (td). |
||
| real(kind=pr) | :: | tdb |
Mixed tangent-adjoint value for temperature. |
|||
| real(kind=pr) | :: | arval | ||||
| real(kind=pr) | :: | arvalb | ||||
| real(kind=pr) | :: | arvald | ||||
| real(kind=pr) | :: | arvaldb |
Evaluate the primal energy, two first tangents, and their mixed second tangent.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(PCSAFT), | intent(in) | :: | model |
Model supplying PC-SAFT segment parameters. |
||
| real(kind=pr), | intent(in) | :: | n(:) |
Component mole amounts [mol]. |
||
| real(kind=pr), | intent(in) | :: | nd(:) |
Tangent seed for component mole amounts (nd). |
||
| real(kind=pr), | intent(in) | :: | v |
Total volume [L]. |
||
| real(kind=pr), | intent(in) | :: | vd0 |
Tangent seed for volume (vd0). |
||
| real(kind=pr), | intent(in) | :: | vd |
Tangent seed for volume (vd). |
||
| real(kind=pr), | intent(in) | :: | t |
Temperature [K]. |
||
| real(kind=pr), | intent(in) | :: | td0 |
Tangent seed for temperature (td0). |
||
| real(kind=pr), | intent(in) | :: | td |
Tangent seed for temperature (td). |
||
| real(kind=pr), | intent(out) | :: | arval |
Primal residual Helmholtz energy. |
||
| real(kind=pr), | intent(out) | :: | arvald0 |
Tangent of |
||
| real(kind=pr), | intent(out) | :: | arvald |
Tangent of |
||
| real(kind=pr), | intent(out) | :: | arvaldd |
Mixed second directional derivative. |
Evaluate the primal PC-SAFT Helmholtz energy and third-level tangent outputs.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(PCSAFT), | intent(in) | :: | model |
Model supplying PC-SAFT segment parameters. |
||
| real(kind=pr), | intent(in) | :: | n(:) |
Component mole amounts [mol]. |
||
| real(kind=pr), | intent(in) | :: | nd(:) |
Tangent seed for component mole amounts (nd). |
||
| real(kind=pr), | intent(in) | :: | v |
Total volume [L]. |
||
| real(kind=pr), | intent(in) | :: | vd1 |
Tangent seed for volume (vd1). |
||
| real(kind=pr), | intent(in) | :: | vd0 |
Tangent seed for volume (vd0). |
||
| real(kind=pr), | intent(in) | :: | vd |
Tangent seed for volume (vd). |
||
| real(kind=pr), | intent(in) | :: | t |
Temperature [K]. |
||
| real(kind=pr), | intent(in) | :: | td1 |
Tangent seed for temperature (td1). |
||
| real(kind=pr), | intent(in) | :: | td0 |
Tangent seed for temperature (td0). |
||
| real(kind=pr), | intent(in) | :: | td |
Tangent seed for temperature (td). |
||
| real(kind=pr), | intent(out) | :: | arval |
Primal residual Helmholtz energy. |
||
| real(kind=pr), | intent(out) | :: | arvald1 |
First tangent output for direction 1. |
||
| real(kind=pr), | intent(out) | :: | arvald0 |
First tangent output for direction 0. |
||
| real(kind=pr), | intent(out) | :: | arvald0d |
Mixed tangent output for directions 0 and d. |
||
| real(kind=pr), | intent(out) | :: | arvald |
First tangent output for direction d. |
||
| real(kind=pr), | intent(out) | :: | arvaldd0 |
Mixed second tangent output for directions d and 0. |
||
| real(kind=pr), | intent(out) | :: | arvaldd |
Second tangent output for the d direction. |
||
| real(kind=pr), | intent(out) | :: | arvalddd |
Third nested tangent output. |
Find a PC-SAFT volume root at specified pressure and temperature.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(PCSAFT), | intent(in) | :: | eos |
PC-SAFT equation-of-state model. |
||
| 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 |
Root selector: |