px_envelope Function

public function px_envelope(model, z0, zi, np, T, x_l0, w0, betas0, P0, alpha0, ns0, dS0, beta_w, points, kinds_x, kind_w, max_pressure)

Uses

  • proc~~px_envelope~~UsesGraph proc~px_envelope px_envelope module~yaeos__auxiliar yaeos__auxiliar proc~px_envelope->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

Calculation of a multiphase Px envelope.

Description

Calculates a phase envelope at costant temperature, using a numerical continuation method.

Arguments

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

Model to use.

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

Original fluid composition.

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

Other fluid compostion.

integer, intent(in) :: np

Number of phases, without including the reference phaes

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

Temperature [K]

real(kind=pr), intent(in) :: x_l0(np,size(z0))

Initial guess for composition of phases.

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

Initial guess for composition of reference phase.

real(kind=pr), intent(in) :: betas0(np)

Mole fractions of each phase. Excluding the reference phase.

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

Initial guess for pressure [bar]

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

Initial guess for relation between two fluids

integer, intent(in) :: ns0

First specified variable.

The first nc*np values correspond to the different , which are sorted like .

From nc*np+1 to nc*np + np, the different values.

nc*np+np+1 and cp*np+np+2 are and , respectively.

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

First step to extrapolate for next point calculation. After that It will use an adaptive algorithm.

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

Fraction of the reference (incipient) phase.

integer, intent(in), optional :: points

Maximum number of points to calculate.

character(len=14), intent(in), optional :: kinds_x(np)
character(len=14), intent(in), optional :: kind_w
real(kind=pr), intent(in), optional :: max_pressure

Return Value type(PXEnvelMP)


Calls

proc~~px_envelope~~CallsGraph proc~px_envelope px_envelope interface~optval optval proc~px_envelope->interface~optval proc~check_critical_jump check_critical_jump proc~px_envelope->proc~check_critical_jump proc~detect_critical~3 detect_critical proc~px_envelope->proc~detect_critical~3 proc~get_values_from_x PXEnvelMP%get_values_from_X proc~px_envelope->proc~get_values_from_x proc~solve_point PXEnvelMP%solve_point proc~px_envelope->proc~solve_point proc~update_specification update_specification proc~px_envelope->proc~update_specification proc~optval_character optval_character interface~optval->proc~optval_character proc~optval_integer optval_integer interface~optval->proc~optval_integer proc~optval_real optval_real interface~optval->proc~optval_real proc~interpol interpol proc~check_critical_jump->proc~interpol proc~detect_critical~3->proc~interpol proc~get_z get_z proc~get_values_from_x->proc~get_z proc~px_f_np px_F_NP proc~solve_point->proc~px_f_np proc~solve_system solve_system proc~solve_point->proc~solve_system proc~update_specification->proc~solve_system proc~px_f_np->proc~get_z proc~lnphi_pt ArModel%lnphi_pt proc~px_f_np->proc~lnphi_pt none~dgesv dgesv proc~solve_system->none~dgesv proc~lnphi_vt ArModel%lnphi_vt proc~lnphi_pt->proc~lnphi_vt proc~volume~3 ArModel%volume proc~lnphi_pt->proc~volume~3 residual_helmholtz residual_helmholtz proc~lnphi_vt->residual_helmholtz get_v0 get_v0 proc~volume~3->get_v0 interface~newton newton proc~volume~3->interface~newton proc~newton_1d newton_1d interface~newton->proc~newton_1d

Variables

Type Visibility Attributes Name Initial
real(kind=pr), private :: F(size(z0)*np+np+2)
real(kind=pr), private :: P
real(kind=pr), private :: Pc
real(kind=pr), private :: Pmax
real(kind=pr), private :: S

Specified value

real(kind=pr), private :: X(size(z0)*np+np+2)
real(kind=pr), private :: X0(size(X))

Initial guess for the point

real(kind=pr), private :: X_last_converged(size(X))

Last converged point

real(kind=pr), private :: Xc(size(X))

Critical variables

real(kind=pr), private :: Xold(size(X))

Old vector of variables

real(kind=pr), private :: ac
real(kind=pr), private :: alpha
real(kind=pr), private, allocatable :: alphas(:)
real(kind=pr), private :: betas(np)
real(kind=pr), private :: dF(size(z0)*np+np+2,size(z0)*np+np+2)
real(kind=pr), private :: dS

Step size of the specification for the next point

real(kind=pr), private :: dX(size(z0)*np+np+2)
real(kind=pr), private :: dXdS(size(z0)*np+np+2)
type(MPPoint), private, allocatable :: env_points(:)
logical, private :: found_critical

If true, a critical point was found

integer, private :: i

Point calculation index

integer, private :: iP
integer, private :: ia
integer, private :: inner

Number of times a failed point is retried to converge

integer, private :: its
logical, private :: jumped_critical

If true, a critical point was jumped

integer, private :: lb

Lower bound, index of the first component of a phase

integer, private :: max_iterations = 100
integer, private :: nc
integer, private :: ns

Number of the specified variable

integer, private :: number_of_points
type(MPPoint), private :: point
integer, private :: ub

Upper bound, index of the last component of a phase

real(kind=pr), private :: w(size(z0))
character(len=14), private :: w_kind
character(len=14), private :: x_kinds(np)
real(kind=pr), private :: x_l(np,size(z0))
real(kind=pr), private :: z(size(z0))