PX two-phase envelope calculation procedure.
Phase envelope calculation using the continuation method.
Defaults to specifying (specified_variable_0 = nc+2)
and continuing with increments in it. The variable to specify can be changed by modifying
specified_variable_0 with the corresponding variable number.
Loop/index variable.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(ArModel), | intent(in) | :: | model |
Thermodynamic model |
||
| real(kind=pr), | intent(in) | :: | z0(:) |
Vector of molar fractions of the global composition (main phase) |
||
| real(kind=pr), | intent(in) | :: | alpha0 |
First point of |
||
| real(kind=pr), | intent(in) | :: | z_injection(:) |
Vector of molar fractions of the injection fluid |
||
| type(EquilibriumState) | :: | first_point | ||||
| 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.1 |
|
| 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 . |
|
| 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 |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| real(kind=pr), | private | :: | S0 |
Initial specification value |
|||
| real(kind=pr), | private | :: | T | ||||
| real(kind=pr), | private | :: | X(size(z)+2) | ||||
| real(kind=pr), | private, | allocatable | :: | XS(:,:) | |||
| real(kind=pr), | private | :: | dS0 |
Initial specification step |
|||
| character(len=14), | private | :: | kind | ||||
| integer, | private | :: | max_iterations |
Maximum number of iterations |
|||
| integer, | private | :: | max_points |
Maximum number of points |
|||
| integer, | private | :: | nc |
Number of components |
|||
| integer, | private | :: | ns |
Number of specified variable |
|||
| real(kind=pr), | private | :: | z(size(z0)) |
Composition at some point |
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 PX saturation equations at a continuation state.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=pr), | intent(in) | :: | X(:) |
Packed log-K, pressure, and composition 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 |