yaeos__models_ar_cubic_mixing_base Module

Mixing rules core math

Procedures of the core calculations of CubicEoS mixing rules.

Description

This module holds all the basic math to use mixing rules in other codes. Keeping it simple and accessible.

Examples

bi = [0.2_pr, 0.3_pr]
lij = reshape([0.0_pr, 0.2_pr, 0.2_pr, 0.0_pr], [2,2])

! Calculate B parameter with Quadratic Mixing Rules.
call bmix_qmr(n, bi, lij, b, dbi, dbij)

References


Uses

  • module~~yaeos__models_ar_cubic_mixing_base~~UsesGraph module~yaeos__models_ar_cubic_mixing_base yaeos__models_ar_cubic_mixing_base module~yaeos__constants yaeos__constants module~yaeos__models_ar_cubic_mixing_base->module~yaeos__constants iso_fortran_env iso_fortran_env module~yaeos__constants->iso_fortran_env

Used by

  • module~~yaeos__models_ar_cubic_mixing_base~~UsedByGraph module~yaeos__models_ar_cubic_mixing_base yaeos__models_ar_cubic_mixing_base module~yaeos__models_ar_cubic_cubic_mixing yaeos__models_ar_cubic_cubic_mixing module~yaeos__models_ar_cubic_cubic_mixing->module~yaeos__models_ar_cubic_mixing_base module~yaeos__models_ar_cubic_quadratic_mixing yaeos__models_ar_cubic_quadratic_mixing module~yaeos__models_ar_cubic_quadratic_mixing->module~yaeos__models_ar_cubic_mixing_base module~yaeos__models_cubic_mixing_rules_huron_vidal yaeos__models_cubic_mixing_rules_huron_vidal module~yaeos__models_cubic_mixing_rules_huron_vidal->module~yaeos__models_ar_cubic_mixing_base module~yaeos__models_cubic_mixing_rules_huron_vidal->module~yaeos__models_ar_cubic_quadratic_mixing proc~bmix CMR%Bmix proc~bmix->module~yaeos__models_ar_cubic_mixing_base proc~bmixhv HV%BmixHV proc~bmixhv->module~yaeos__models_ar_cubic_mixing_base proc~bmixhvnrtl HV_NRTL%BmixHVNRTL proc~bmixhvnrtl->module~yaeos__models_ar_cubic_mixing_base proc~bmixmhv MHV%BmixMHV proc~bmixmhv->module~yaeos__models_ar_cubic_mixing_base proc~d1mixhv HV%D1MixHV proc~d1mixhv->module~yaeos__models_ar_cubic_mixing_base proc~d1mixhvnrtl HV_NRTL%D1MixHVNRTL proc~d1mixhvnrtl->module~yaeos__models_ar_cubic_mixing_base proc~d1mixmhv MHV%D1MixMHV proc~d1mixmhv->module~yaeos__models_ar_cubic_mixing_base proc~dmix CMR%Dmix proc~dmix->module~yaeos__models_ar_cubic_mixing_base proc~dmixhv HV%DmixHV proc~dmixhv->module~yaeos__models_ar_cubic_mixing_base proc~dmixhvnrtl HV_NRTL%DmixHVNRTL proc~dmixhvnrtl->module~yaeos__models_ar_cubic_mixing_base proc~kijk_constant CMR%kijk_constant proc~kijk_constant->module~yaeos__models_ar_cubic_mixing_base proc~kijk_exp_tdep CMRTD%kijk_exp_tdep proc~kijk_exp_tdep->module~yaeos__models_ar_cubic_mixing_base proc~rkpr_d1mix CMR%RKPR_D1mix proc~rkpr_d1mix->module~yaeos__models_ar_cubic_mixing_base proc~rkpr_d1mix~2 QMR%RKPR_D1mix proc~rkpr_d1mix~2->module~yaeos__models_ar_cubic_mixing_base module~yaeos__models yaeos__models module~yaeos__models->module~yaeos__models_ar_cubic_cubic_mixing module~yaeos__models->module~yaeos__models_ar_cubic_quadratic_mixing module~yaeos__models->module~yaeos__models_cubic_mixing_rules_huron_vidal module~yaeos__models_ar_cubic_mixing_sddlc yaeos__models_ar_cubic_mixing_sddlc module~yaeos__models->module~yaeos__models_ar_cubic_mixing_sddlc module~yaeos__models_ar_cubic_mixing_sddlc->module~yaeos__models_ar_cubic_quadratic_mixing proc~pengrobinson76 PengRobinson76 proc~pengrobinson76->module~yaeos__models_ar_cubic_quadratic_mixing proc~pengrobinson78 PengRobinson78 proc~pengrobinson78->module~yaeos__models_ar_cubic_quadratic_mixing proc~psrk PSRK proc~psrk->module~yaeos__models_cubic_mixing_rules_huron_vidal proc~rkpr RKPR proc~rkpr->module~yaeos__models_ar_cubic_quadratic_mixing proc~soaveredlichkwong SoaveRedlichKwong proc~soaveredlichkwong->module~yaeos__models_ar_cubic_quadratic_mixing module~yaeos yaeos module~yaeos->module~yaeos__models module~yaeos__extra_fluids yaeos__extra_fluids module~yaeos__extra_fluids->module~yaeos__models proc~co2_h2o_isop co2_h2o_isop proc~co2_h2o_isop->module~yaeos__models

Subroutines

public pure subroutine CMR_Bmix(n, bijk, Bmix, dBi, dBij)

Evaluate the ternary cubic repulsive mixture parameter and derivatives.

Read more…

Arguments

Type IntentOptional Attributes Name
real(kind=pr), intent(in) :: n(:)

Component mole amounts [mol]

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

Ternary covolume tensor [L/mol]

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

[L]

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

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

public subroutine CMR_Dmix(n, V, T, a, dadt, dadt2, D, dDdV, dDdT, dDdV2, dDdT2, dDi, dDdTV, dDidV, dDidT, dDij)

Evaluate the ternary cubic attractive mixture parameter and derivatives.

Read more…

Arguments

Type IntentOptional Attributes Name
real(kind=pr), intent(in) :: n(:)

Moles vector [mol]

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

Volume [L] (unused)

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

Temperature [K]

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

tensor (see CMR_aijk)

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

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

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

Mixture attractive parameter

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

(zero)

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

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

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

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

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

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

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

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

public pure subroutine CMR_aijk(ai, daidt, daidt2, k, dkdt, dkdt2, a, dadt, dadt2)

Calculate the tensor of the CMR.

Read more…

Arguments

Type IntentOptional Attributes Name
real(kind=pr), intent(in) :: ai(:)

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

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

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

tensor

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

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

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

matrix

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

matrix

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

matrix

public subroutine DmixHV(n, T, bi, B, dBi, dBij, D1, dD1i, dD1ij, ai, daidt, daidt2, Ge, GeT, GeT2, Gen, GeTn, Gen2, D, dDdT, dDdT2, dDi, dDidT, dDij)

Attractive parameter calculation for the Huron-Vidal mixing rule.

Read more…

Arguments

Type IntentOptional Attributes Name
real(kind=pr), intent(in) :: n(:)

Component mole amounts [mol]

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

Temperature [K]

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

Pure-component covolumes [L/mol]

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

Mixture covolume [L]

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

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

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

Mixture

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

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

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

Pure-component attractive parameters

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

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

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

Excess Gibbs energy [bar L]

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

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

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

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

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

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

Mixture attractive parameter [bar L^2]

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

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

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

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

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

public pure subroutine bmix_linear(n, bi, b, dbi, dbij)

Calculate the linear mixture covolume and composition derivatives.

Read more…

Arguments

Type IntentOptional Attributes Name
real(kind=pr), intent(in) :: n(:)

Component mole amounts.

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

Pure-component covolumes.

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

Mixture covolume.

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

Mole-number gradient of the mixture covolume.

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

Mole-number Hessian of the mixture covolume.

public pure subroutine bmix_qmr(n, bi, lij, b, dbi, dbij)

Calculate the QMR covolume and its first and second mole derivatives.

Read more…

Arguments

Type IntentOptional Attributes Name
real(kind=pr), intent(in) :: n(:)

Component mole amounts.

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

Pure-component covolumes.

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

Repulsive binary interaction matrix.

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

Mixture covolume.

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

Mole-number gradient of the mixture covolume.

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

Mole-number Hessian of the mixture covolume.

public pure subroutine d1mix_rkpr(n, d1i, D1, dD1i, dD1ij)

RKPR parameter mixing rule.

Read more…

Arguments

Type IntentOptional Attributes Name
real(kind=pr), intent(in) :: n(:)

Component mole amounts [mol]

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

Pure-component values

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

Mixture

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

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

public subroutine lamdba_hv(nc, d1, dd1i, dd1ij, L, dLi, dLij)

Infinite pressure limit parameter

Read more…

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: nc

Number of components

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

Mixture

real(kind=pr), intent(in), optional :: dd1i(nc)

real(kind=pr), intent(in), optional :: dd1ij(nc,nc)

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

real(kind=pr), intent(out), optional :: dLi(nc)

real(kind=pr), intent(out), optional :: dLij(nc,nc)