ar_consistency Subroutine

public subroutine ar_consistency(eos, n, V, T, eq31, eq33, eq34, eq36, eq37)

ar_consistency

models consistency tests.

Description

The evaluated equations are taken from Fundamentals & Computational Aspects 2 ed. by Michelsen and Mollerup Chapter 2 section 3. The “eq” are evaluations of the left hand side of the following expressions:

Equation 31:

Equation 33:

Equation 34:

Equation 36:

Equation 37:

The consistency test could be applied to any instantiated ArModel as shown in the following example.

Examples

 use yaeos, only: pr, SoaveRedlichKwong, ArModel
 use yaeos__consistency_armodel, only: ar_consistency

 class(ArModel), allocatable :: model
 real(pr) :: tc(4), pc(4), w(4)

 real(pr) :: n(4), T, V

 real(pr) :: eq31, eq33(size(n), size(n)), eq34(size(n)), eq36, eq37

 n = [1.5, 0.2, 0.7, 2.3]
 tc = [190.564, 425.12, 300.11, 320.25]
 pc = [45.99, 37.96, 39.23, 40.21]
 w = [0.0115478, 0.200164, 0.3624, 0.298]

 T = 600_pr
 V = 0.5_pr

 model = SoaveRedlichKwong(tc, pc, w)

 call ar_consistency(&
    model, n, V, T, eq31=eq31, eq33=eq33, eq34=eq34, eq36=eq36, eq37=eq37 &
    )

All eqXX variables should be close to zero.

References

  1. Michelsen, M. L., & Mollerup, J. M. (2007). Thermodynamic models: Fundamentals & computational aspects (2. ed). Tie-Line Publications.

Arguments

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

Equation of state

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

Moles number vector

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

Volume [L]

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

Temperature [K]

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

MM Eq. 31

real(kind=pr), intent(out), optional :: eq33(size(n),size(n))

MM Eq. 33

real(kind=pr), intent(out), optional :: eq34(size(n))

MM Eq. 34

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

MM Eq. 36

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

MM Eq. 37


Variables

Type Visibility Attributes Name Initial
real(kind=pr), public :: Grp
real(kind=pr), public :: Grv
real(kind=pr), public :: Hrv
real(kind=pr), public :: P
real(kind=pr), public :: dPdn(size(n))
real(kind=pr), public :: dlnPhidP(size(n))
real(kind=pr), public :: dlnPhidT(size(n))
real(kind=pr), public :: dlnPhidn(size(n),size(n))
integer, public :: i
integer, public :: j
real(kind=pr), public :: lnphi(size(n))
real(kind=pr), public :: ntot
real(kind=pr), public :: z