Residual equations, Jacobians, and point solvers for bubble, dew, and liquid-liquid states.
The routines in this module encode saturation unknowns in logarithmic
coordinates and enforce isofugacity, material-balance, and specification
equations. They are implementation-level solvers used by the public
saturation_pressure and saturation_temperature routines.
Application code should call the public saturation-point functions rather than these solver helpers.
Evaluate the saturation residual system in log-volume coordinates.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(ArModel), | intent(in) | :: | model |
EOS used to evaluate phase fugacities. |
||
| real(kind=pr) | :: | z(size(model)) |
Feed composition |
|||
| real(kind=pr), | intent(in) | :: | X(:) |
Unknowns |
||
| integer, | intent(in) | :: | ns |
Index of the specified unknown. |
||
| real(kind=pr), | intent(in) | :: | S |
Value imposed on unknown |
||
| real(kind=pr), | intent(out) | :: | F(:) |
Saturation residual vector. |
||
| real(kind=pr), | intent(out), | optional | :: | dF(:,:) |
Residual Jacobian. |
|
| real(kind=pr), | intent(out) | :: | dPdVz |
Pressure derivative with respect to the feed-phase volume. |
||
| real(kind=pr), | intent(out) | :: | dPdVy |
Pressure derivative with respect to the incipient-phase volume. |
Evaluate a saturation residual system at fixed pressure or temperature.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(ArModel), | intent(in) | :: | model |
EOS used for phase properties. |
||
| character(len=*), | intent(in) | :: | kind |
|
||
| real(kind=pr), | intent(in) | :: | z(size(model)) |
Feed composition. |
||
| real(kind=pr), | intent(in) | :: | X(:) |
Unknowns |
||
| integer, | intent(in) | :: | ns |
Index of the specified unknown. |
||
| real(kind=pr), | intent(in) | :: | S |
Value imposed on unknown |
||
| real(kind=pr), | intent(out) | :: | F(:) |
Residual vector. |
||
| real(kind=pr), | intent(out) | :: | dF(:,:) |
Jacobian with respect to the unknown vector. |
||
| real(kind=pr), | intent(out) | :: | dFdS(:) |
Residual derivative with respect to the specification. |
Correct a fixed-pressure or fixed-temperature saturation point.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(ArModel), | intent(in) | :: | model |
EOS used for phase fugacities. |
||
| character(len=*), | intent(in) | :: | kind |
|
||
| real(kind=pr), | intent(in) | :: | z(:) |
Feed composition. |
||
| real(kind=pr), | intent(inout) | :: | X(:) |
Initial packed unknowns; corrected state on return. |
||
| integer, | intent(in) | :: | ns |
Index of the specified variable. |
||
| real(kind=pr), | intent(in) | :: | S |
Specified value of |
||
| real(kind=pr), | intent(in) | :: | tol |
Residual tolerance. |
||
| integer, | intent(in) | :: | max_iterations |
Maximum corrector iterations. |
||
| integer, | intent(out) | :: | its |
Iterations used. |
Solve saturation equations using log phase volumes and temperature.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(ArModel), | intent(in) | :: | model |
EOS used for phase properties. |
||
| real(kind=pr), | intent(in) | :: | z(:) |
Feed composition. |
||
| real(kind=pr), | intent(inout) | :: | X(:) |
Initial unknown vector; corrected state on return. |
||
| integer, | intent(in) | :: | ns |
Index of the specified variable. |
||
| real(kind=pr), | intent(in) | :: | S |
Specification value in solver coordinates. |
||
| real(kind=pr), | intent(in) | :: | tol |
Residual tolerance. |
||
| integer, | intent(in) | :: | max_iterations |
Maximum Newton iterations. |
||
| integer, | intent(out) | :: | its |
Iterations used. |