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

  • proc~~px_envelope_2ph~~UsesGraph proc~px_envelope_2ph px_envelope_2ph module~yaeos__auxiliar yaeos__auxiliar proc~px_envelope_2ph->module~yaeos__auxiliar module~yaeos__constants yaeos__constants module~yaeos__auxiliar->module~yaeos__constants iso_fortran_env iso_fortran_env module~yaeos__constants->iso_fortran_env

px_envelope_2ph

Description

PX two-phase envelope calculation procedure.

Phase envelope calculation using the continuation method. Defaults to specifying (specified_variable_0 = nc+2) and continuing with increments in it. The variable to specify can be changed by modifying specified_variable_0 with the corresponding variable number.

Loop/index variable.

Arguments

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

Thermodynamic 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

Maximum 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 specification step , defaults to 0.1

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)


Calls

proc~~px_envelope_2ph~~CallsGraph proc~px_envelope_2ph px_envelope_2ph df df proc~px_envelope_2ph->df dfds dfds proc~px_envelope_2ph->dfds dx dx proc~px_envelope_2ph->dx f f proc~px_envelope_2ph->f fdx fdx proc~px_envelope_2ph->fdx fdx2 fdx2 proc~px_envelope_2ph->fdx2 interface~optval optval proc~px_envelope_2ph->interface~optval none~foo foo proc~px_envelope_2ph->none~foo numdiff numdiff proc~px_envelope_2ph->numdiff proc~continuation continuation proc~px_envelope_2ph->proc~continuation proc~get_z get_z proc~px_envelope_2ph->proc~get_z proc~optval_character optval_character interface~optval->proc~optval_character proc~optval_integer optval_integer interface~optval->proc~optval_integer proc~optval_logical optval_logical interface~optval->proc~optval_logical proc~optval_real optval_real interface~optval->proc~optval_real none~foo->proc~get_z proc~lnphi_pt ArModel%lnphi_pt none~foo->proc~lnphi_pt proc~full_newton full_newton proc~continuation->proc~full_newton proc~solve_system solve_system proc~continuation->proc~solve_system proc~full_newton->proc~solve_system proc~lnphi_vt ArModel%lnphi_vt proc~lnphi_pt->proc~lnphi_vt proc~volume~2 ArModel%volume proc~lnphi_pt->proc~volume~2 none~dgesv dgesv proc~solve_system->none~dgesv residual_helmholtz residual_helmholtz proc~lnphi_vt->residual_helmholtz get_v0 get_v0 proc~volume~2->get_v0 interface~newton newton proc~volume~2->interface~newton proc~newton_1d newton_1d interface~newton->proc~newton_1d

Variables

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

Initial specification value

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

Initial specification step

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

Maximum number of iterations

integer, private :: max_points

Maximum number of points

integer, private :: nc

Number of components

integer, private :: ns

Number of specified variable

real(kind=pr), private :: 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)

Evaluate the two-phase PX saturation equations at a continuation state.

Read more…

Arguments

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

Packed log-K, pressure, and composition unknowns.

integer, intent(in) :: ns

Index of the specified unknown.

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

Value of the continuation specification.

real(kind=pr), intent(out) :: F(:)

Phase-equilibrium residuals.

real(kind=pr), intent(out) :: dF(:,:)

Residual Jacobian with respect to X.

real(kind=pr), intent(out) :: dFdS(:)

Residual derivative with respect to S.

subroutine save_point(X, iters)

Save the converged point

Read more…

Arguments

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

Converged variables .

integer, intent(in) :: iters

Newton iterations used to converge the point.

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

Update the specification during continuation.

Read more…

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