Flash algorithm using successive substitutions.
Available specifications:
This algorithm assumes that the specified T and P/V correspond to vapor-liquid separation predicted by the provided model () and solves the equilibria and mass-balance equations with a fixed-point method.
Iterates until or 500
iterations. If the iteration fails or converges to the trivial
solution (), the result has kind = "failed" and
P = -1; otherwise kind = "split".
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(BaseModel), | intent(in) | :: | model |
Thermodynamic model |
||
| real(kind=pr), | intent(in) | :: | z(:) |
Global composition (molar fractions) |
||
| real(kind=pr), | intent(in) | :: | t |
Temperature [K] |
||
| real(kind=pr), | intent(in), | optional | :: | v_spec |
Specified Volume [L/mol] |
|
| real(kind=pr), | intent(in), | optional | :: | p_spec |
Specified Pressure [bar] |
|
| real(kind=pr), | intent(in), | optional | :: | k0(:) |
Initial K factors (y/x) |
|
| integer, | intent(out), | optional | :: | iters |
Number of iterations (also stored in the result’s |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| real(kind=pr), | private, | dimension(size(z)) | :: | K |
Equilibrium ratios . |
||
| real(kind=pr), | private | :: | P | ||||
| real(kind=pr), | private | :: | V | ||||
| real(kind=pr), | private | :: | Vx | ||||
| real(kind=pr), | private | :: | Vy | ||||
| real(kind=pr), | private | :: | beta |
total fraction of vapour (molar base) |
|||
| real(kind=pr), | private | :: | bmax | ||||
| real(kind=pr), | private | :: | bmin | ||||
| real(kind=pr), | private, | dimension(size(z)) | :: | dK | |||
| real(kind=pr), | private, | dimension(size(z)) | :: | dKold | |||
| real(kind=pr), | private | :: | g0 |
function g valuated at beta=0 and 1, based on Wilson K factors |
|||
| real(kind=pr), | private | :: | g1 |
function g valuated at beta=0 and 1, based on Wilson K factors |
|||
| integer, | private | :: | its |
Iteration counter; copied to |
|||
| real(kind=pr), | private, | dimension(size(z)) | :: | lnK | |||
| real(kind=pr), | private, | dimension(size(z)) | :: | lnKold | |||
| real(kind=pr), | private, | dimension(size(z)) | :: | lnfug_x | |||
| real(kind=pr), | private, | dimension(size(z)) | :: | lnfug_y | |||
| character(len=2), | private | :: | spec |
Flash specification [PT | VT] |
|||
| real(kind=pr), | private, | dimension(size(z)) | :: | x |
composition of liquid (molar fractions) |
||
| real(kind=pr), | private, | dimension(size(z)) | :: | y |
composition of vapour (molar fractions) |