PT two-phase envelope calculation procedure.
Phase envelope calculation using the continuation method.
Defaults to solving the saturation temperature and continues with
an increment in it. The variable to specify can be changed by modifying
specified_variable_0 with the corresponding variable number.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(ArModel), | intent(in) | :: | model |
Thermodynamic model |
||
| real(kind=pr), | intent(in) | :: | z(:) |
Vector of molar fractions |
||
| type(EquilibriumState), | intent(in) | :: | first_point |
Initial point of the envelope |
||
| integer, | intent(in), | optional | :: | points |
Maximum number of points, defaults to 500 |
|
| integer, | intent(in), | optional | :: | iterations |
Point solver maximum iterations, defaults to 100 |
|
| real(kind=pr), | intent(in), | optional | :: | delta_0 |
Initial specification step , defaults to 0.01 |
|
| integer, | intent(in), | optional | :: | specified_variable_0 |
Position of specified variable, since the vector of variables is the values for specification will be for the equilibria constants, for and for . Defaults to (). |
|
| procedure(continuation_solver), | optional | :: | solver |
Specify solver for each point, defaults to a full newton procedure |
||
| procedure(continuation_stopper), | optional | :: | stop_conditions |
Function that returns true if the continuation method should stop |
||
| real(kind=pr), | intent(in), | optional | :: | maximum_pressure |
Maximum pressure to calculate [bar] |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| real(kind=pr), | private | :: | S0 |
Initial specification value |
|||
| real(kind=pr), | private | :: | X(size(z)+2) |
Vector of variables used in the continuation method |
|||
| real(kind=pr), | private, | allocatable | :: | XS(:,:) |
All the calculated variables that are returned on the continuation method procedure (unused since each point is saved on the fly) |
||
| real(kind=pr), | private | :: | dS0 |
Initial specification step |
|||
| integer, | private | :: | i |
Loop/index variable. |
|||
| character(len=14), | private | :: | kind | ||||
| character(len=14), | private | :: | kind_w | ||||
| character(len=14), | private | :: | kind_x(1) | ||||
| integer, | private | :: | max_iterations |
Maximum number of iterations |
|||
| integer, | private | :: | max_points |
Maximum number of points |
|||
| type(PTEnvelMP), | private | :: | mp_env | ||||
| integer, | private | :: | nc |
Number of components |
|||
| integer, | private | :: | ns |
Number of specified variable |
|||
| real(kind=pr), | private | :: | w0(size(z)) | ||||
| real(kind=pr), | private | :: | x_l0(1,size(z)) |
Critical point detection
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=pr), | intent(inout) | :: | X(:) |
Vector of variables |
||
| real(kind=pr), | intent(inout) | :: | dXdS(:) |
Variation of variables wrt S |
||
| integer, | intent(inout) | :: | ns |
Number of specified variable |
||
| real(kind=pr), | intent(inout) | :: | S |
Specification value |
||
| real(kind=pr), | intent(inout) | :: | dS |
Step in specification |
Evaluate the two-phase saturation equations at a continuation state.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=pr), | intent(in) | :: | X(:) |
Packed log-K and log-state unknowns. |
||
| integer, | intent(in) | :: | ns |
Index of the specified unknown. |
||
| real(kind=pr), | intent(in) | :: | S |
Value of the continuation specification. |
||
| real(kind=pr), | intent(out) | :: | F(:) |
Phase-equilibrium residuals. |
||
| real(kind=pr), | intent(out) | :: | dF(:,:) |
Residual Jacobian with respect to |
||
| real(kind=pr), | intent(out) | :: | dFdS(:) |
Residual derivative with respect to |
Save the converged point
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=pr), | intent(in) | :: | X(:) |
Converged variables . |
||
| integer, | intent(in) | :: | iters |
Newton iterations used to converge the point. |
Update the specification during continuation.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=pr), | intent(inout) | :: | X(:) |
Vector of variables |
||
| integer, | intent(inout) | :: | ns |
Number of specified variable in the vector |
||
| real(kind=pr), | intent(inout) | :: | S |
Variable specification value |
||
| real(kind=pr), | intent(inout) | :: | dS |
Step in specification |
||
| real(kind=pr), | intent(inout) | :: | dXdS(:) |
Variation of variables with respect to specification |
||
| integer, | intent(in) | :: | step_iters |
Iterations used in the solver |