Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
type(CPSpecs), | public, | parameter | :: | spec_CP | = | CPSpecs() |
Specification variables for a critical point or critical line calculation. |
This derived type is used to store a critical line between two fluids.
The critical line is calculated using the critical_line
function. It
uses the continuation method.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
type(EquilibriumState), | public | :: | CEP |
Critical End Point |
|||
real(kind=pr), | public, | allocatable | :: | P(:) |
Pressure [bar] |
||
real(kind=pr), | public, | allocatable | :: | T(:) |
Temperature [K] |
||
real(kind=pr), | public, | allocatable | :: | V(:) |
Volume [L/mol] |
||
real(kind=pr), | public, | allocatable | :: | a(:) |
Molar fraction of the second fluid |
||
integer, | public, | allocatable | :: | iters(:) |
Iterations needed for this point |
||
integer, | public, | allocatable | :: | ns(:) |
Specified variable |
||
real(kind=pr), | public, | allocatable | :: | z0(:) |
Molar fractions of the first fluid |
||
real(kind=pr), | public, | allocatable | :: | zi(:) |
Molar fractions of the second fluid |
Enumerator to handle the possible specifications for a critical point.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer, | public | :: | P | = | 4 |
Specify |
|
integer, | public | :: | T | = | 3 |
Specify |
|
integer, | public | :: | V | = | 2 |
Specify |
|
integer, | public | :: | a | = | 1 |
Specify |
Function that should be equal to zero at a critical point is found.
The second criticality condition is calculated as a numerical
derivative with eps=1e-4
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ArModel), | intent(in) | :: | model |
Equation of state model |
||
real(kind=pr), | intent(in) | :: | X(4) |
Vector of variables |
||
integer, | intent(in) | :: | ns |
Position of the specification variable |
||
real(kind=pr), | intent(in) | :: | S |
Specification variable value |
||
real(kind=pr), | intent(in) | :: | z0(:) |
Molar fractions of the first fluid |
||
real(kind=pr), | intent(in) | :: | zi(:) |
Molar fractions of the second fluid |
||
real(kind=pr), | intent(inout) | :: | u(:) |
Eigen-vector |
Calculates the critical line between two mixtures using the continuation method. The two mixtures compositions are restricted to the relation between them, by a parameter , which represents the molar fraction of the second fluid with respect to the whole mixture.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ArModel), | intent(in) | :: | model |
Equation of state model |
||
real(kind=pr), | intent(in) | :: | a0 |
Initial value |
||
real(kind=pr), | intent(in) | :: | z0(:) |
Molar fractions of the first fluid |
||
real(kind=pr), | intent(in) | :: | zi(:) |
Molar fractions of the second fluid |
||
integer, | intent(in) | :: | ns0 |
Position of the specification variable |
||
real(kind=pr), | intent(in) | :: | S0 |
Specified value |
||
real(kind=pr), | intent(in) | :: | dS0 |
Initial step size |
||
real(kind=pr), | intent(in), | optional | :: | v0 |
Initial volume [L/mol] |
|
real(kind=pr), | intent(in), | optional | :: | t0 |
Initial temperature [K] |
|
real(kind=pr), | intent(in), | optional | :: | p0 |
Initial pressure [bar] |
|
integer, | intent(in), | optional | :: | max_points |
Maximum number of points |
|
real(kind=pr), | intent(in), | optional | :: | maxP |
Maximum pressure |
|
type(EquilibriumState), | intent(in), | optional | :: | first_point | ||
logical, | optional | :: | stability_analysis |
Calculates a single critical point of a mixture using a Newton-Raphson
method. It is possible to specify different variables to be fixed with
the spec
argument, the spec_CP
variable helps when selecting the
specified variable.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ArModel), | intent(in) | :: | model |
Equation of state model |
||
real(kind=pr), | intent(in) | :: | z0(:) |
Molar fractions of the first fluid |
||
real(kind=pr), | intent(in) | :: | zi(:) |
Molar fractions of the second fluid |
||
integer, | intent(in) | :: | spec |
Specification |
||
real(kind=pr), | intent(in) | :: | S |
Specification value |
||
integer, | intent(in) | :: | max_iters |
Maxiumum number of iterations |
||
real(kind=pr), | intent(in), | optional | :: | V0 |
Initial volume [L/mol]. |
|
real(kind=pr), | intent(in), | optional | :: | T0 |
Initial temperature [K]. |
|
real(kind=pr), | intent(in), | optional | :: | a0 |
Initial value |
|
real(kind=pr), | intent(in), | optional | :: | P0 |
Initial Pressure [bar] |
Calculates the Jacobian of the critical point function F_critical
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ArModel), | intent(in) | :: | model |
Equation of state model |
||
real(kind=pr), | intent(in) | :: | X(4) |
Vector of variables |
||
integer, | intent(in) | :: | ns |
Position of the specification variable |
||
real(kind=pr), | intent(in) | :: | S |
Specification variable value |
||
real(kind=pr), | intent(in) | :: | z0(:) |
Molar fractions of the first fluid |
||
real(kind=pr), | intent(in) | :: | zi(:) |
Molar fractions of the second fluid |
||
real(kind=pr), | intent(inout) | :: | u(:) |
Eigen-vector |
Jacobian of the critical point function
Calculation of the first restriction of a critical point.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ArModel), | intent(in) | :: | model | |||
real(kind=pr), | intent(in) | :: | X(4) |
Vector of variables |
||
real(kind=pr), | intent(in) | :: | s |
Distance between the two fluids compositions to the main composition |
||
real(kind=pr), | intent(in) | :: | z0(:) |
Molar fractions of the first fluid |
||
real(kind=pr), | intent(in) | :: | zi(:) |
Molar fractions of the second fluid |
||
real(kind=pr), | intent(in) | :: | u(:) |
Eigen-vector that defines the direction between the two compositions |
||
real(kind=pr), | intent(out), | optional | :: | u_new(:) |
Eigen-vector corresponding to the smallest eigenvalue of the matrix |
|
real(kind=pr), | intent(out), | optional | :: | P |
Pressure of the system [bar] |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ArModel), | intent(in) | :: | model |
Equation of state model |
||
integer, | intent(in) | :: | nc | |||
real(kind=pr), | intent(in) | :: | X(nc+4) |
Vector of variables |
||
real(kind=pr), | intent(in) | :: | z0(nc) |
Molar fractions of the first fluid |
||
real(kind=pr), | intent(in) | :: | zi(nc) |
Molar fractions of the second fluid |
||
real(kind=pr), | intent(inout) | :: | u(nc) |
Eigen-vector |
Calculates the Jacobian of the critical point function F_critical
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ArModel), | intent(in) | :: | model |
Equation of state model |
||
integer, | intent(in) | :: | nc | |||
real(kind=pr), | intent(in) | :: | X(nc+4) |
Vector of variables |
||
real(kind=pr), | intent(in) | :: | z0(nc) |
Molar fractions of the first fluid |
||
real(kind=pr), | intent(in) | :: | zi(nc) |
Molar fractions of the second fluid |
||
real(kind=pr), | intent(inout) | :: | u(nc) |
Eigen-vector |
Jacobian of the critical point function
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=pr), | intent(in) | :: | X |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=pr), | intent(in) | :: | a |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ArModel), | intent(in) | :: | model |
Equation of state model |
||
real(kind=pr), | intent(in) | :: | z0(:) |
Molar fractions of the first fluid |
||
real(kind=pr), | intent(in) | :: | zi(:) |
Molar fractions of the second fluid |
||
real(kind=pr), | intent(in) | :: | Pc |
Pressure [bar] |
||
real(kind=pr), | intent(in) | :: | Vc |
Volume [L/mol] |
||
real(kind=pr), | intent(in) | :: | Tc |
Temperature [K] |
||
real(kind=pr), | intent(in) | :: | a |
Molar fraction of the second fluid |
||
real(kind=pr), | intent(inout) | :: | u(:) |
Eigen-vector |
||
logical, | intent(out) | :: | found |
Found a Critical End Point |
||
type(EquilibriumState), | intent(out) | :: | CEP |
Critical End Point |
Check the stability of a point in the critical line. The stability is
determined by tpd
analysis.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ArModel), | intent(in) | :: | model |
Equation of state model |
||
real(kind=pr), | intent(in) | :: | z0(:) |
Molar fractions of the first fluid |
||
real(kind=pr), | intent(in) | :: | zi(:) |
Molar fractions of the second fluid |
||
real(kind=pr), | intent(in) | :: | Pc |
Pressure [bar] |
||
real(kind=pr), | intent(in) | :: | Vc |
Volume [L/mol] |
||
real(kind=pr), | intent(in) | :: | Tc |
Temperature [K] |
||
real(kind=pr), | intent(in) | :: | a |
Molar fraction of the second fluid |
||
logical, | intent(out) | :: | unstable |
Stability of the point) |
||
real(kind=pr), | intent(out) | :: | y_other(:) |
Molar fractions of the second fluid |
||
real(kind=pr), | intent(out) | :: | V_other |
Volume [L/mol] |