px_envelope_2ph Function

public function px_envelope_2ph(model, z0, alpha0, z_injection, first_point, points, iterations, delta_0, specified_variable_0, solver, stop_conditions) result(envelopes)

Uses

    • stdlib_optval

PX two-phase envelope calculation procedure.

Phase envelope calculation using the continuation method. Defaults to solving the saturation temperature and continues with an increment in it. The variable to specify can be changed by modifying specified_variable_0 with the corresponding variable number.

Arguments

Type IntentOptional Attributes Name
class(ArModel), intent(in) :: model

Thermodyanmic model

real(kind=pr), intent(in) :: z0(:)

Vector of molar fractions of the global composition (main phase)

real(kind=pr), intent(in) :: alpha0

First point of

real(kind=pr), intent(in) :: z_injection(:)

Vector of molar fractions of the injection fluid

type(EquilibriumState) :: first_point
integer, intent(in), optional :: points

Maxmimum number of points, defaults to 500

integer, intent(in), optional :: iterations

Point solver maximum iterations, defaults to 100

real(kind=pr), intent(in), optional :: delta_0

Initial extrapolation

integer, intent(in), optional :: specified_variable_0

Position of specified variable, since the vector of variables is the values for specification will be for the equilibria constants, for and for .

procedure(continuation_solver), optional :: solver

Specify solver for each point, defaults to a full newton procedure

procedure(continuation_stopper), optional :: stop_conditions

Function that returns true if the continuation method should stop

Return Value type(PXEnvel2)


Variables

Type Visibility Attributes Name Initial
real(kind=pr), public :: S0

Initial specification value

real(kind=pr), public :: T
real(kind=pr), public :: X(size(z)+2)
real(kind=pr), public, allocatable :: XS(:,:)
real(kind=pr), public :: dS0

Initial specification step

character(len=14), public :: kind
integer, public :: max_iterations

Maximum number of iterations

integer, public :: max_points

Maximum number of points

integer, public :: nc

Number of components

integer, public :: ns

Number of specified variable

real(kind=pr), public :: z(size(z0))

Composition at some point


Subroutines

subroutine detect_critical(X, dXdS, ns, S, dS)

Critical point detection

Read more…

Arguments

Type IntentOptional Attributes Name
real(kind=pr), intent(inout) :: X(:)

Vector of variables

real(kind=pr), intent(inout) :: dXdS(:)

Variation of variables wrt S

integer, intent(inout) :: ns

Number of specified variable

real(kind=pr), intent(inout) :: S

Specification value

real(kind=pr), intent(inout) :: dS

Step in specification

recursive subroutine foo(X, ns, S, F, dF, dFdS)

Function that needs to be solved at each envelope point

Arguments

Type IntentOptional Attributes Name
real(kind=pr), intent(in) :: X(:)
integer, intent(in) :: ns
real(kind=pr), intent(in) :: S
real(kind=pr), intent(out) :: F(:)
real(kind=pr), intent(out) :: dF(:,:)
real(kind=pr), intent(out) :: dFdS(:)

subroutine save_point(X, iters)

Save the converged point

Arguments

Type IntentOptional Attributes Name
real(kind=pr), intent(in) :: X(:)
integer, intent(in) :: iters

subroutine update_spec(X, ns, S, dS, dXdS, step_iters)

Update the specification during continuation.

Arguments

Type IntentOptional Attributes Name
real(kind=pr), intent(inout) :: X(:)

Vector of variables

integer, intent(inout) :: ns

Number of specified variable in the vector

real(kind=pr), intent(inout) :: S

Variable specification value

real(kind=pr), intent(inout) :: dS

Step in specification

real(kind=pr), intent(inout) :: dXdS(:)

Variation of variables with respect to specification

integer, intent(in) :: step_iters

Iterations used in the solver