Abstract residual Helmholtz model.
This derived type defines the basics needed for the calculation
of residual properties.
The basics of a residual Helmholtz model is a routine that calculates
all the needed derivatives of
residual_helmholtz
and
a volume initializer function, that is used to initialize a Newton
solver of volume when specifying pressure.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
type(Substances), | public | :: | components |
Substances contained in the module |
|||
character(len=:), | public, | allocatable | :: | name |
Name of the model |
Calculate residual heat capacity pressure constant given v and t.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ArModel), | intent(in) | :: | eos |
Model |
||
real(kind=pr), | intent(in) | :: | n(:) |
Moles number vector |
||
real(kind=pr), | intent(in) | :: | V |
Volume [L] |
||
real(kind=pr), | intent(in) | :: | T |
Temperature [K] |
||
real(kind=pr), | intent(out) | :: | Cp |
heat capacity p constant [bar L / K] |
Calculate residual heat capacity volume constant given v and t.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ArModel), | intent(in) | :: | eos |
Model |
||
real(kind=pr), | intent(in) | :: | n(:) |
Moles number vector |
||
real(kind=pr), | intent(in) | :: | V |
Volume [L] |
||
real(kind=pr), | intent(in) | :: | T |
Temperature [K] |
||
real(kind=pr), | intent(out) | :: | Cv |
heat capacity v constant [bar L / K] |
Calculate residual enthalpy given volume and temperature.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ArModel), | intent(in) | :: | eos |
Model |
||
real(kind=pr), | intent(in) | :: | n(:) |
Moles number vector |
||
real(kind=pr), | intent(in) | :: | v |
Volume [L] |
||
real(kind=pr), | intent(in) | :: | t |
Temperature [K] |
||
real(kind=pr), | intent(out) | :: | Hr |
Residual enthalpy [bar L] |
||
real(kind=pr), | intent(out), | optional | :: | HrT |
|
|
real(kind=pr), | intent(out), | optional | :: | HrV |
|
|
real(kind=pr), | intent(out), | optional | :: | Hrn(size(n)) |
|
Calculate residual entropy given volume and temperature.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ArModel), | intent(in) | :: | eos |
Model |
||
real(kind=pr), | intent(in) | :: | n(:) |
Moles number vector |
||
real(kind=pr), | intent(in) | :: | V |
Volume [L] |
||
real(kind=pr), | intent(in) | :: | T |
Temperature [K] |
||
real(kind=pr), | intent(out) | :: | Sr |
Entropy [bar L / K] |
||
real(kind=pr), | intent(out), | optional | :: | SrT |
|
|
real(kind=pr), | intent(out), | optional | :: | SrV |
|
|
real(kind=pr), | intent(out), | optional | :: | Srn(size(n)) |
|
Function that provides an initializer value for the liquid-root
of newton solver of volume. In the case the model will use the
volume_michelsen
routine this value should provide the co-volume
of the model.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ArModel), | intent(in) | :: | self |
Ar Model |
||
real(kind=pr), | intent(in) | :: | n(:) |
Moles vector |
||
real(kind=pr), | intent(in) | :: | p |
Pressure [bar] |
||
real(kind=pr), | intent(in) | :: | t |
Temperature [K] |
Initial volume [L]
Calculate residual Gibbs energy given volume and temperature.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ArModel), | intent(in) | :: | eos |
Model |
||
real(kind=pr), | intent(in) | :: | n(:) |
Moles number vector |
||
real(kind=pr), | intent(in) | :: | V |
Volume [L] |
||
real(kind=pr), | intent(in) | :: | T |
Temperature [K] |
||
real(kind=pr), | intent(out) | :: | Gr |
Gibbs energy [bar L] |
||
real(kind=pr), | intent(out), | optional | :: | GrT |
|
|
real(kind=pr), | intent(out), | optional | :: | GrV |
|
|
real(kind=pr), | intent(out), | optional | :: | Grn(size(n)) |
|
Calculate logarithm of fugacity, given pressure and temperature.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ArModel), | intent(in) | :: | eos |
Model |
||
real(kind=pr), | intent(in) | :: | n(:) |
Mixture mole numbers |
||
real(kind=pr), | intent(in) | :: | P |
Pressure [bar] |
||
real(kind=pr), | intent(in) | :: | T |
Temperature [K] |
||
real(kind=pr), | intent(out), | optional | :: | V |
Volume [L] |
|
character(len=*), | intent(in) | :: | root_type |
Type of root desired [“liquid”, “vapor”, “stable”] |
||
real(kind=pr), | intent(out), | optional | :: | lnPhi(size(n)) |
vector |
|
real(kind=pr), | intent(out), | optional | :: | dlnPhidP(size(n)) |
ln(phi) Presssure derivative |
|
real(kind=pr), | intent(out), | optional | :: | dlnPhidT(size(n)) |
ln(phi) Temp derivative |
|
real(kind=pr), | intent(out), | optional | :: | dlnPhidn(size(n),size(n)) |
ln(phi) compositional derivative |
|
real(kind=pr), | intent(out), | optional | :: | dPdV |
|
|
real(kind=pr), | intent(out), | optional | :: | dPdT |
|
|
real(kind=pr), | intent(out), | optional | :: | dPdn(size(n)) |
|
Calculate fugacity coefficent given volume and temperature.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ArModel) | :: | eos |
Model |
|||
real(kind=pr), | intent(in) | :: | n(:) |
Mixture mole numbers |
||
real(kind=pr), | intent(in) | :: | V |
Volume [L] |
||
real(kind=pr), | intent(in) | :: | T |
Temperature [K] |
||
real(kind=pr), | intent(out), | optional | :: | P |
Pressure [bar] |
|
real(kind=pr), | intent(out), | optional | :: | lnPhi(size(n)) |
vector |
|
real(kind=pr), | intent(out), | optional | :: | dlnPhidP(size(n)) |
Presssure derivative |
|
real(kind=pr), | intent(out), | optional | :: | dlnPhidT(size(n)) |
Temp derivative |
|
real(kind=pr), | intent(out), | optional | :: | dlnPhidn(size(n),size(n)) |
compositional derivative |
|
real(kind=pr), | intent(out), | optional | :: | dPdV |
|
|
real(kind=pr), | intent(out), | optional | :: | dPdT |
|
|
real(kind=pr), | intent(out), | optional | :: | dPdn(:) |
|
Pressure calculation.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ArModel), | intent(in) | :: | eos |
Model |
||
real(kind=pr), | intent(in) | :: | n(:) |
Moles number vector |
||
real(kind=pr), | intent(in) | :: | v |
Volume [L] |
||
real(kind=pr), | intent(in) | :: | t |
Temperature [K] |
||
real(kind=pr), | intent(out) | :: | p |
Pressure [bar] |
||
real(kind=pr), | intent(out), | optional | :: | dPdV |
|
|
real(kind=pr), | intent(out), | optional | :: | dPdT |
|
|
real(kind=pr), | intent(out), | optional | :: | dPdn(:) |
|
Residual Helmholtz model generic interface.
This interface represents how an Ar model should be implemented. By our standard, a Resiudal Helmholtz model takes as input:
All the output arguments are optional. While this keeps a long signature for the implementation, this is done this way to take advantage of any inner optimizations to calculate derivatives inside the procedure.
Once the model is implemented, the signature can be short like
model%residual_helmholtz(n, v, t, ArT2=dArdT2)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ArModel), | intent(in) | :: | self |
ArModel |
||
real(kind=pr), | intent(in) | :: | n(:) |
Moles vector |
||
real(kind=pr), | intent(in) | :: | v |
Volume [L] |
||
real(kind=pr), | intent(in) | :: | t |
Temperature [K] |
||
real(kind=pr), | intent(out), | optional | :: | Ar |
Residual Helmoltz energy |
|
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)) |
|
Solves volume roots using newton method. Given pressure and temperature.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ArModel), | intent(in) | :: | eos | |||
real(kind=pr), | intent(in) | :: | n(:) |
Moles number vector |
||
real(kind=pr), | intent(in) | :: | P |
Pressure [bar] |
||
real(kind=pr), | intent(in) | :: | T |
Temperature [K] |
||
real(kind=pr), | intent(out) | :: | V |
Volume [L] |
||
character(len=*), | intent(in) | :: | root_type |
Desired root-type to solve. Options are:
|