yaeos__equilibria_multiphase_flash
Module for multiphase flash calculations.
This module contains routines and functions to perform multiphase flash calculations.
type(MPEquilibriumState) :: mpfr
type(ArModel) :: model
real(pr) :: z(3), P, T, Tc(3), Pc(3), w(3)
Tc = [374, 31, -83] + 273
Pc = [221, 74, 46]
w = [0.344, 0.293, 0.011]
z = [0.03_pr, 1-0.13_pr, 0.1_pr]
P = 45.6_pr
T = 190._pr
mpfr = pt_mp_flash(model, z, P, T)
print *, "Number of phases:", mpfr%np
print *, "Phase compositions:"
do i=1, mpfr%np
print *, "Phase", i, "composition:", mpfr%x_l(i, :)
end do
print *, "Reference phase composition:", mpfr%w(:)
Perform a multiphase flash calculation at constant zPT.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ArModel), | intent(in) | :: | model | |||
real(kind=pr), | intent(in) | :: | z(:) | |||
real(kind=pr), | intent(in) | :: | P | |||
real(kind=pr), | intent(in) | :: | T |
Function to solve at each point of a multi-phase envelope.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ArModel), | intent(in) | :: | model |
Model to use. |
||
real(kind=pr), | intent(in) | :: | z(:) |
Mixture global composition. |
||
integer, | intent(in) | :: | np |
Number of main phases. |
||
character(len=14), | intent(in) | :: | kinds_x(np) |
Kind of the main phases. |
||
character(len=14), | intent(in) | :: | kind_w |
Kind of the reference phase. |
||
real(kind=pr), | intent(in) | :: | X(:) |
Vector of variables. |
||
integer, | intent(in) | :: | ns1 |
Number of first specification. |
||
real(kind=pr), | intent(in) | :: | S1 |
First specification value. |
||
integer, | intent(in) | :: | ns2 |
Number of second specification. |
||
real(kind=pr), | intent(in) | :: | S2 |
Second specification value. |
||
real(kind=pr), | intent(out) | :: | F(size(X)) |
Vector of functions valuated. |
||
real(kind=pr), | intent(out) | :: | df(size(X),size(X)) |
Jacobian matrix. |
Function to solve the multiphase flash problem.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ArModel), | intent(in) | :: | model |
Model to use. |
||
real(kind=pr), | intent(in) | :: | z(:) |
Mixture global composition. |
||
integer, | intent(in) | :: | np |
Number of x phases. |
||
character(len=14), | intent(in) | :: | kinds_x(np) |
Kind of the x phases. |
||
character(len=14), | intent(in) | :: | kind_w |
Kind of the w phase. |
||
real(kind=pr), | intent(inout) | :: | X(:) |
Vector of variables. |
||
integer, | intent(in) | :: | ns1 |
Number of first specification. |
||
real(kind=pr), | intent(in) | :: | S1 |
First specification value. |
||
integer, | intent(in) | :: | ns2 |
Number of second specification. |
||
real(kind=pr), | intent(in) | :: | S2 |
Second specification value. |
||
integer, | intent(in) | :: | max_iters |
Maximum number of iterations. |
||
real(kind=pr), | intent(out) | :: | F(size(X)) |
Vector of functions valuated. |
||
logical, | intent(out) | :: | less_phases |
True if the solution has less phases than expected. |
||
integer, | intent(out) | :: | beta_0_index |
Index of beta that equals zero. |
||
integer, | intent(out) | :: | iters |
Number of iterations performed. |