px_envelope Function

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

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.

Return Value type(PXEnvelMP)


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 :: 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 :: 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(:)
integer, private :: i

Point calculation index

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

Number of times a failed point is retried to converge

integer, private :: its
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))
real(kind=pr), private :: x_l(np,size(z0))
real(kind=pr), private :: z(size(z0))