YAEOS__MODELS_AR_SAFT_PCSAFT Module

PC-SAFT equation of state

Implementation of the non-associating PC-SAFT residual Helmholtz model.

Description

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.

Examples

model = init_pcsaft(m, sigma, epsilon_k, kij)
call model%pressure(n, V, T, P)

References

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.


Uses

  • module~~yaeos__models_ar_saft_pcsaft~~UsesGraph module~yaeos__models_ar_saft_pcsaft YAEOS__MODELS_AR_SAFT_PCSAFT module~yaeos__constants yaeos__constants module~yaeos__models_ar_saft_pcsaft->module~yaeos__constants module~yaeos__models_solvers yaeos__models_solvers module~yaeos__models_ar_saft_pcsaft->module~yaeos__models_solvers module~yaeos__tapenade_ar_api yaeos__tapenade_ar_api module~yaeos__models_ar_saft_pcsaft->module~yaeos__tapenade_ar_api module~yaeos__tapenade_interfaces yaeos__tapenade_interfaces module~yaeos__models_ar_saft_pcsaft->module~yaeos__tapenade_interfaces iso_fortran_env iso_fortran_env module~yaeos__constants->iso_fortran_env module~yaeos__models_solvers->module~yaeos__constants module~yaeos__models_ar yaeos__models_ar module~yaeos__models_solvers->module~yaeos__models_ar module~yaeos__tapenade_ar_api->module~yaeos__constants module~yaeos__tapenade_ar_api->module~yaeos__models_ar module~yaeos__tapenade_interfaces->module~yaeos__constants module~yaeos__models_ar->module~yaeos__constants module~yaeos__models_base yaeos__models_base module~yaeos__models_ar->module~yaeos__models_base module~yaeos__substance yaeos__substance module~yaeos__models_base->module~yaeos__substance module~yaeos__substance->module~yaeos__constants

Used by

  • module~~yaeos__models_ar_saft_pcsaft~~UsedByGraph module~yaeos__models_ar_saft_pcsaft YAEOS__MODELS_AR_SAFT_PCSAFT module~yaeos__models yaeos__models module~yaeos__models->module~yaeos__models_ar_saft_pcsaft module~yaeos yaeos module~yaeos->module~yaeos__models module~yaeos__extra_fluids yaeos__extra_fluids module~yaeos__extra_fluids->module~yaeos__models proc~co2_h2o_isop co2_h2o_isop proc~co2_h2o_isop->module~yaeos__models

Variables

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.


Derived Types

type, public, extends(ArModelTapenade) ::  PCSAFT

Non-associating perturbed-chain statistical associating fluid model.

Read more…

Components

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]

Type-Bound Procedures

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

Functions

public function get_v0(self, n, P, T) result(v0)

Return the close-packed segment volume used to initialize a volume solve.

Read more…

Arguments

Type IntentOptional 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.

Return Value real(kind=pr)

public function init_pcsaft(m, sigma, epsilon_k, kij) result(model)

Create a PC-SAFT model.

Read more…

Arguments

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

Return Value type(PCSAFT)


Subroutines

public subroutine AR(model, n, v, t, arval)

Evaluate the primal PC-SAFT residual Helmholtz energy.

Read more…

Arguments

Type IntentOptional 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.

public subroutine AR_B(model, n, nb, v, vb, t, tb, arval, arvalb)

Evaluate the primal PC-SAFT energy and reverse-mode sensitivities.

Read more…

Arguments

Type IntentOptional 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.

public subroutine AR_D(model, n, nd, v, vd, t, td, arval, arvald)

Evaluate the PC-SAFT primal residual Helmholtz energy and one tangent.

Read more…

Arguments

Type IntentOptional 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 arval along the input seeds.

public subroutine AR_D_B(model, n, nb, nd, ndb, v, vb, vd, vdb, t, tb, td, tdb, arval, arvalb, arvald, arvaldb)

Evaluate mixed tangent-adjoint derivatives for PC-SAFT.

Read more…

Arguments

Type IntentOptional 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

public subroutine AR_D_D(model, n, nd, v, vd0, vd, t, td0, td, arval, arvald0, arvald, arvaldd)

Evaluate the primal energy, two first tangents, and their mixed second tangent.

Read more…

Arguments

Type IntentOptional 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 arval along the (vd0, td0) seed.

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

Tangent of arval along the (nd, vd, td) seed.

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

Mixed second directional derivative.

public subroutine AR_D_D_D(model, n, nd, v, vd1, vd0, vd, t, td1, td0, td, arval, arvald1, arvald0, arvald0d, arvald, arvaldd0, arvaldd, arvalddd)

Evaluate the primal PC-SAFT Helmholtz energy and third-level tangent outputs.

Read more…

Arguments

Type IntentOptional 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.

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

Find a PC-SAFT volume root at specified pressure and temperature.

Read more…

Arguments

Type IntentOptional 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: liquid, vapor, or stable.