yaeos__equilibria_multiphase_flash Module

yaeos__equilibria_multiphase_flash

Module for multiphase flash calculations.

Description

This module contains routines and functions to perform multiphase flash calculations.

Examples

 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(:)

References



Functions

public function pt_mp_flash(model, z, P, T)

Perform a multiphase flash calculation at constant zPT.

Read more…

Arguments

Type IntentOptional 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

Return Value type(MPEquilibriumState)


Subroutines

public subroutine pt_F_NP(model, z, np, kinds_x, kind_w, X, ns1, S1, ns2, S2, F, df)

Function to solve at each point of a multi-phase envelope.

Arguments

Type IntentOptional 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.

public subroutine solve_mp_flash_point(model, z, np, kinds_x, kind_w, X, ns1, S1, ns2, S2, max_iters, F, less_phases, beta_0_index, iters)

Function to solve the multiphase flash problem.

Arguments

Type IntentOptional 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.