setup_unifac Function

public function setup_unifac(molecules, parameters)

Setup UNIFAC

Instantiate a UNIFAC model

Description

Subroutine used to instantiate a UNIFAC model.

Examples

 ! Instantiate an UNIFAC model with ethanol-water mix and calculate gammas
 use yaeos, only: pr, Groups, setup_unifac, UNIFAC

 type(UNIFAC) :: model
 type(Groups) :: molecules(2)
 real(pr) :: ln_gammas(2)

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

 ! Water definition [H2O]
 molecules(2)%groups_ids = [16]
 molecules(2)%number_of_groups = [1]

 ! Model setup
 model = setup_unifac(molecules)

 ! Calculate ln_gammas
 call model%ln_activity_coefficient([0.5_pr, 0.5_pr], 298.0_pr, ln_gammas)

 print *, ln_gammas ! result: 0.18534142000449058    0.40331395945417559

References

  1. Dortmund Data Bank Software & Separation Technology

Arguments

Type IntentOptional Attributes Name
type(Groups), intent(in) :: molecules(:)

Molecules (Group type) objects

type(GeGCModelParameters), intent(in), optional :: parameters

UNIFAC parameters

Return Value type(UNIFAC)


Variables

Type Visibility Attributes Name Initial
real(kind=pr), public, allocatable :: Aij(:,:)
integer, public :: gi
integer, public :: i
integer, public :: j
integer, public :: k
type(GeGCModelParameters), public :: params
type(UNIFACPsi), public :: psi_function
real(kind=pr), public, allocatable :: qks(:)
type(Groups), public :: soup
integer, public, allocatable :: vij(:,:)