Solve a multiphase phase equilbiria at a fixed $T,P,\beta^w$
This subroutine uses the Newton method to solve the system of equations for the calculation of a multiphase phase eqiulibria point. To help with convergence, damping on the at each step is done, avoiding divergence and undesired big steps.
| 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 |
||
| real(kind=pr), | intent(in) | :: | beta_w |
Fraction of the reference (incipient) phase |
||
| 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(inout) | :: | X(:) |
Vector of variables |
||
| integer, | intent(in) | :: | ns |
Number of specification |
||
| real(kind=pr), | intent(in) | :: | S |
Specification value |
||
| real(kind=pr), | intent(in) | :: | dXdS(size(X)) | |||
| real(kind=pr), | intent(out) | :: | F(size(X)) |
Vector of functions valuated |
||
| real(kind=pr), | intent(out) | :: | df(size(X),size(X)) |
Jacobian matrix |
||
| real(kind=pr), | intent(out) | :: | Vl(np) |
Main phases volumes |
||
| real(kind=pr), | intent(out) | :: | Vw |
Reference phase volume |
||
| integer, | intent(out) | :: | iters |
Number of iterations to solve the current point |
||
| integer, | intent(in) | :: | max_iterations |
Maximum number of iterations to solve the point |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| real(kind=pr), | private | :: | P |
Pressure |
|||
| real(kind=pr), | private | :: | T |
Temperature |
|||
| real(kind=pr), | private | :: | X0(size(X)) |
Initial value of |
|||
| real(kind=pr), | private | :: | betas(np) |
Mole fraction of each main phase |
|||
| real(kind=pr), | private | :: | dX(size(X)) |
Newton step |
|||
| integer, | private | :: | i |
Indexing variable |
|||
| integer, | private | :: | iBetas(np) |
Index of beta variables |
|||
| integer, | private | :: | iP |
Pressure variable index |
|||
| integer, | private | :: | iT |
Temperature variable index |
|||
| integer, | private | :: | l |
Phase index |
|||
| integer, | private | :: | nc |
NUmber of components |
|||
| real(kind=pr), | private | :: | w(size(z)) |
Composition of reference phase |
|||
| real(kind=pr), | private | :: | x_l(np,size(z)) |
Composition of the main phases |