ge_consistency Subroutine

public subroutine ge_consistency(model, n, t, eq58, eq59, eq60, eq61)

ge_consistency

models consistency tests

Description

Evaluate the models consistency tests described in Thermodynamic Models: Fundamentals & Computational Aspects 2 ed. by Michelsen and Mollerup (MM) Chapter 5 section 4. The “eq” are evaluations of the left hand side of the following expressions:

Equation 58

Equation 59

Equation 60

Equation 61

Examples

 use yaeos, only: pr
 use yaeos, only: Groups, setup_unifac, UNIFAC
 use yaeos__consistency_gemodel, only: ge_consistency

 type(UNIFAC) :: model

 integer, parameter :: nc = 4, ng = 4

 type(Groups) :: molecules(nc)

 real(pr) :: n(nc), T
 real(pr) :: dt, dn

 real(pr) :: eq58, eq59(nc), eq60(nc,nc), eq61(nc)

 T = 303.15
 n = [400.0, 100.0, 300.0, 200.0]

 ! Hexane [CH3, CH2]
 molecules(1)%groups_ids = [1, 2]
 molecules(1)%number_of_groups = [2, 4]

 ! Ethanol [CH3, CH2, OH]
 molecules(2)%groups_ids = [1, 2, 14]
 molecules(2)%number_of_groups = [1, 1, 1]

 ! Toluene [ACH, ACCH3]
 molecules(3)%groups_ids = [9, 11]
 molecules(3)%number_of_groups = [5, 1]

 ! Cyclohexane [CH2]
 molecules(4)%groups_ids = [2]
 molecules(4)%number_of_groups = [6]

 model = setup_unifac(molecules)

 ! ====================================================================
 ! Consistency tests
 ! --------------------------------------------------------------------
 call ge_consistency(model, n, t, eq58, eq59, eq60, eq61)

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(GeModel), intent(in) :: model

model

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

Moles number vector

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

Temperature [K]

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

MM Eq. 58

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

MM Eq. 59

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

MM Eq. 60

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

MM Eq. 61


Variables

Type Visibility Attributes Name Initial
real(kind=pr), public :: Ge
real(kind=pr), public :: Gen(size(n))
real(kind=pr), public :: Gen2(size(n),size(n))
integer, public :: i
integer, public :: j
real(kind=pr), public :: ln_gammas(size(n))