yaeos__m_s_sp Module

Saturation-point nonlinear systems

Residual equations, Jacobians, and point solvers for bubble, dew, and liquid-liquid states.

Description

The routines in this module encode saturation unknowns in logarithmic coordinates and enforce isofugacity, material-balance, and specification equations. They are implementation-level solvers used by the public saturation_pressure and saturation_temperature routines.

Examples

Application code should call the public saturation-point functions rather than these solver helpers.


Uses

  • module~~yaeos__m_s_sp~~UsesGraph module~yaeos__m_s_sp yaeos__m_s_sp module~yaeos__constants yaeos__constants module~yaeos__m_s_sp->module~yaeos__constants module~yaeos__models_ar yaeos__models_ar module~yaeos__m_s_sp->module~yaeos__models_ar iso_fortran_env iso_fortran_env module~yaeos__constants->iso_fortran_env module~yaeos__models_ar->module~yaeos__constants module~yaeos__models_base yaeos__models_base module~yaeos__models_ar->module~yaeos__models_base module~yaeos__substance yaeos__substance module~yaeos__models_base->module~yaeos__substance module~yaeos__substance->module~yaeos__constants

Used by

  • module~~yaeos__m_s_sp~~UsedByGraph module~yaeos__m_s_sp yaeos__m_s_sp proc~saturation_pressure saturation_pressure proc~saturation_pressure->module~yaeos__m_s_sp proc~saturation_temperature saturation_temperature proc~saturation_temperature->module~yaeos__m_s_sp

Subroutines

public subroutine saturation_F(model, z, X, ns, S, F, dF, dPdVz, dPdVy)

Evaluate the saturation residual system in log-volume coordinates.

Read more…

Arguments

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

EOS used to evaluate phase fugacities.

real(kind=pr) :: z(size(model))

Feed composition

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

Unknowns

integer, intent(in) :: ns

Index of the specified unknown.

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

Value imposed on unknown ns.

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

Saturation residual vector.

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

Residual Jacobian.

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

Pressure derivative with respect to the feed-phase volume.

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

Pressure derivative with respect to the incipient-phase volume.

public subroutine saturation_TP(model, kind, z, X, ns, S, F, dF, dFdS)

Evaluate a saturation residual system at fixed pressure or temperature.

Read more…

Arguments

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

EOS used for phase properties.

character(len=*), intent(in) :: kind

"bubble", "dew", or "liquid-liquid"; any other value uses stable roots.

real(kind=pr), intent(in) :: z(size(model))

Feed composition.

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

Unknowns

integer, intent(in) :: ns

Index of the specified unknown.

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

Value imposed on unknown ns.

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

Residual vector.

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

Jacobian with respect to the unknown vector.

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

Residual derivative with respect to the specification.

public subroutine solve_TP(model, kind, z, X, ns, S, tol, max_iterations, its)

Correct a fixed-pressure or fixed-temperature saturation point.

Read more…

Arguments

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

EOS used for phase fugacities.

character(len=*), intent(in) :: kind

"bubble", "dew", or "liquid-liquid"; any other value uses stable roots.

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

Feed composition.

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

Initial packed unknowns; corrected state on return.

integer, intent(in) :: ns

Index of the specified variable.

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

Specified value of X(ns) (log coordinates)

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

Residual tolerance.

integer, intent(in) :: max_iterations

Maximum corrector iterations.

integer, intent(out) :: its

Iterations used.

public subroutine solve_VxVyT(model, z, X, ns, S, tol, max_iterations, its)

Solve saturation equations using log phase volumes and temperature.

Read more…

Arguments

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

EOS used for phase properties.

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

Feed composition.

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

Initial unknown vector; corrected state on return.

integer, intent(in) :: ns

Index of the specified variable.

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

Specification value in solver coordinates.

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

Residual tolerance.

integer, intent(in) :: max_iterations

Maximum Newton iterations.

integer, intent(out) :: its

Iterations used.