The analysis in this section follows the methodologies proposed in the GERG 2004 monograph published in 2007
System of Equations
Our residual vector F is equal to
Fi=lnϕ(T,p,y)−lnϕ(T,p,x)+lnKi=0,i=1,2,3...Nwhere
xi=zi1−β+βKiand
yi=Kizi1−β+βKiDO NOT NORMALIZE x and y !!!!
FN+2=Xs−S=0and the system to be solved is equal to
JΔX=−FThis is the trickiest part of this method. There are a lot of derivatives to implement, and we want to implement all of them analytically.
∂Fi∂lnT=T[(∂lnϕi∂T)″p,n−(∂lnϕi∂T)′p,n]ζ is the Kronecker delta or ζ=0 for i≠j , and ζ=0 for i=j. Also
ϕij=n(∂lnϕi∂nj)T,pFor the FN+1 term,
∂FN+1∂lnKj=Kjzj(1−β+βKj)2and all other partials of FN+1 in the Jacobian are zero. For the specified term
∂FN+2Xs=1and all other partials of FN+2 in the Jacobian are zero.
From GERG 2004 Monograph, Eqn 7.27:
lnϕi=(∂nαr∂ni)T,V,nj−lnZand (Kunz, 2012, Table B4)
(∂nαr∂ni)T,V,nj=αr+n(∂αr∂ni)T,V,njso
lnϕi=αr+n(∂αr∂ni)T,V,nj−lnZAnother two alternatives have been proposed in A DENSITY MARCHING METHOD FOR CALCULATING PHASE ENVELOPES Gadhiraju Venkatarathnam, I&ECR, 2014
In this paper, density marching methods are proposed rather than methods that march in temperature, pressure, or K-factor.
The system of equations to be solved is similar to that of the GERG 2004 formulation, where the unknowns are ln(T), ln(p), and ln(Ki)
(A1) - OK Fi=lnKi+lnϕ(T,p,y)−lnϕ(T,p,x)=0,i=1,2,3...N
(A2) - OK FN+1=N∑i=1zi(Ki−1)1−β+βKi=0
(A3) - TYPO, should be ln(ρ) rather than ρ, and should be all on left-hand-side FN+2=lnρ″−lnρ″S=0
(A6) - TYPO, missing an n to multiply the terms (∂lnϕi∂nj)T,p ∂Fi∂lnKj=Kjzj(1−β+βKj)2[(1−β)ϕ″ij+βϕ′ij]+ζ
ζ is the Kronecker delta or ζ=0 for i≠j , and ζ=0 for i=j.
(A7) - OK ∂Fi∂lnT=T[(∂lnϕi∂T)″p,n−(∂lnϕi∂T)′p,n]
(A8) - OK ∂Fi∂lnp=p[(∂lnϕi∂p)″T,n−(∂lnϕi∂p)′T,n]
(A9) - OK ∂FN+1∂lnKj=Kjzj(1−β+βKj)2
(A11) - OK ∂FN+2∂lnKj=Kjzj(1−β)β(1−β+βKj)2(n(∂ρ∂nj)″T,p)(1ρ″S)
(A12) - OK ∂FN+2∂lnT=(∂ρ∂T)″p,nTρ″S
(A13) - OK ∂FN+2∂lnp=(∂ρ∂p)″T,npρ″S
From Gadhiraju Venkatarathnam, 2014, Density Marching Method for Calculating Phase Envelopes I&ECR (http://pubs.acs.org/doi/abs/10.1021/ie403633d)
The system of equations to be solved is similar to that of the GERG 2004 formulation, here the unknowns are ln(Ki), ln(T), and ln(ρ′). The vapor density ρ″ is imposed
(A14) - OK Fi=lnKi+lnϕ(T,ρ″,y)−lnϕ(T,ρ′,x)=0,i=0,1,2,3...N−1
(A15) - OK FN=N∑i=1zi(Ki−1)1−β+βKi=0
(A16) - OK FN+1=p(T,ρ′,x)−p(T,ρ″,y)=0
(A17) - TYPO, missing an n to multiply the terms (∂lnϕi∂nj)T,p ∂Fi∂lnKj=Kjzj(1−β+βKj)2[(1−β)ϕ″ij+βϕ′ij]+ζ
ζ is the Kronecker delta or ζ=0 for i≠j , and ζ=0 for i=j.
(A18) - OK ∂Fi∂lnT=T[(∂lnϕi∂T)″p,n−(∂lnϕi∂T)′p,n]
(A19) - OK ∂Fi∂lnρ′=−ρ′(∂lnϕi∂ρ)′T,n
(A20) - OK ∂FN∂lnKj=Kjzj(1−β+βKj)2
(A22) - TYPO Second derivative of ln(phi) with respect to rho' needs constraints, first needs to have the constraints in the right place ∂FN+1∂lnKj=RTKjzj(1−β+βKj)2[(1−β)(∂lnϕi∂ρ)″T,n+β(∂lnϕi∂ρ)′T,n]
(A23) - TYPO Should be A23 ∂FN+1∂lnT=T[(∂p∂T)′ρ′,n−(∂p∂T)″ρ″,n]
(A24) - TYPO Should be A24 ∂FN+1∂lnp′=ρ′(∂p∂ρ)′T,n
Three analyic derivatives are not provided in GERG and need to be rederived. The last is for T,p marching, the first two are for density marching:
(∂lnϕi∂ρ)T,nThe fact that derivatives are taken with n constant implies that the mole fractions of the components are constant, and therefore the reducing temperatures and densities are also constant.
GERG 2007 Monograph Equation 7.32 gives
ˆvi=(∂V∂ni)T,p,nj=−(∂p∂ni)T,V,nj(∂p∂V)T,nexpand the left hand side with
V=vn=nρ
n held constant in derivative, so get
(∂V∂ni)T,p,nj=n(∂(1/ρ)∂ni)T,p,nj=−nρ2(∂ρ∂ni)T,p,njso
n(∂ρ∂ni)T,p,nj=−ρ2(∂V∂ni)T,p,njFrom Michelsen and Mollerup
p. 30 Eq. III RT(∂lnϕi∂p)T,n=ˆvi−RTp=F(i)P
p. 30 Eq. IV RT(∂lnϕi∂ni)T,P=(∂2nαr∂ni∂nj)T,V+ˆviˆvj(∂p∂V)T,n+RTn=F(i)j
p. 30 Eq. VII RT(∂lnϕi∂ni)T,V=F(i)j+F(i)P(∂p∂nj)T,V
Divide through by RT and multiply through by n n(∂lnϕi∂ni)T,V=nF(i)jRT+nF(i)PRT(∂p∂nj)T,V
Derivatives needed for product rule: ∂xj∂Kj=−zjβ(1−β+βKj)2
Derivative of the residual function ∂Fi∂Kj|T,p=∂lnϕ″i∂yjdyjdKjdKjdlnKj−∂lnϕ′i∂xjdxjdKjdKjdlnKj+Dij
Grouping terms like GERG
∂Fi∂Kj|T,p=Kjzj(1−β+βKj)2[(1−β)∂lnϕ″i∂yj|T,p+β∂lnϕ′i∂xj|T,p]+DijMagic key:
xj=njntherefore dxjdnj=1n
GERG 2004 monograph Eqn. 7.36 (∂ln(fi/ni)∂T)V,ˉn=1T+(∂2nαr∂T∂ni)V,nj
Since derivatives are taken with ρ and n held constant, that also implies that V is held constant in the derivative.
∂[ln(pn)]∂T=1pn(∂p∂T)ρ,nEquivalent fugacities for the i-th component
FAk=lnfi(T,p,x)−lnfi(T,p,y)=0 for k=i=1...NMaterial balance
FBk=zi−xiyi−xi−zN−1−xN−1yN−1−xN−1 for i=1..N−2;k=i+N;k=N+1..2N−2The independent variables to be obtained are
$$
Lemmon 2009 (propane) FOR PURE FLUID ONLY (I think) lnϕ=Z−1−lnZ+αr
GERG 2007 Monograph 7.27 lnϕi=(∂nαr∂ni)T,V,nj−lnZ
GERG 2007 Monograph 7.34 ln(fini)=ln(RTV)+(∂nαr∂ni)T,V,nj
thus equating factors of (∂nαr∂ni)T,V,nj yields lnϕi=ln(fini)−ln(RTV)−ln(Z)
and Z=(pV)/(nRT),
lnϕi=ln(fini)−ln(RTV)−ln(pVnRT)
To convert partial with T, V, xk held constant to one with τ, δ, xk held constant, use Gernert 3.118, or
∂∂xj[Y]T,V,xk=∂∂xj[Y]τ,δ,xk+(∂δ∂xj)T,V,xk∂Y∂δ|τ,ˉx+(∂τ∂xj)T,V,xk∂Y∂τ|δ,ˉxTo convert pressure,
p=ρRT(1+δαδ)convert ρ and T to reduced variables
p=ρr(ˉx)δRTr(ˉx)τ(1+δαδ)=ρr(ˉx)RTr(ˉx)τδ(1+δαδ)All the derivatives
dpdτ×dτdxj=−ρr(ˉx)δRTr(ˉx)τ2(1+δαδ)×1T∂Tr∂xj|T,V,xkwith δ factored out
Turn back into normal variables dpdτ×dτdxj=−ρRτ(1+δαδ)∂Tr∂xj|T,V,xk
First term cancels with a term in the third one, yielding
dpdδ×dδdxj=−δRT[(1+δαδ)+δ(αδ+δαδδ)]∂ρr∂xj|T,V,xkFirst term in first line cancels with term at end of second line, yielding
dpdδ×dδdxj=−δRT[δ(αδ+δαδδ)]∂ρr∂xj|T,V,xkTotal equation is
∂p∂xj|T,V,xk=ρRT(δ∂∂xj[αδ]τ,δ,xk−δρr(αδ+δαδδ)∂ρr∂xj|T,V,xk)import numpy as np
import matplotlib.pyplot as plt
import CoolProp.CoolProp as CP
%matplotlib inline
p = np.linspace(1000, 12000, 100)
mix = 'REFPROP-MIX:Water[0.7]&Ethanol[0.3]'
rhoL = CP.Props('D','P',p,'Q',0,mix)
rhoV = CP.Props('D','P',p,'Q',1,mix)
plt.plot(rhoL,p,rhoV,p)
[<matplotlib.lines.Line2D at 0x5d5e350>, <matplotlib.lines.Line2D at 0x5d5e530>]
K_i=\frac{y_i}{x_i}