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 | |||
---|---|---|---|---|---|---|---|
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-10
.
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(in) | :: | 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) | :: | ns |
Position of the specification variable |
||
real(kind=pr), | intent(in) | :: | S |
Specified value |
||
real(kind=pr), | intent(in) | :: | dS0 |
Initial step size |
||
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 |
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 | :: | u0(:) |
Initial eigen-vector |
|
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 |
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(in) | :: | 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] |