Fluid Phase Equilibria 74 (1992) L-15

download Fluid Phase Equilibria 74 (1992) L-15

of 15

Transcript of Fluid Phase Equilibria 74 (1992) L-15

  • 7/27/2019 Fluid Phase Equilibria 74 (1992) L-15

    1/15

    Flui d Phase Equil i bri a, 74 (1992) 1-15Elsevier Science Publishers B.V., Amsterdam

    Calculation of Thermodynamic Equilibrium Properties.

    Jorgen M. Mollerup and Michael L. Michelsen.Department of Chemical Engineering.Building 229, DTH, 2800 Lyngby, Denmark.(Received October 4, 1991; accepted in final form January 27 1991)

    Keywords: Calculation procedure, Helmholtz surface, derived properties.

    ABSTRACTA formalism for calculation of equilibrium properties from a model of the Helmholtz functionis presented. A modular approach which enables modification of single features of the modelwithout rewriting the entire computer code is emphasized. The formalism ensures a fullythermodynamic consistent set of relations and leads to efficient code. Identity tests for checkingcalculated fugacities and their partial derivatives are presented.

    INTRODUCTIONCalculation of thermodynamic properties from an equation of state may appear a trivialproblem which only requires adherence to basic definitions. The increasing complexity ofthermodynamic models, however, requires a systematic approach in order to avoid inefficientor even incorrect code, and we therefore find it appropriate to present some ideas which wehave found valuable for generating modular and efficient code for calculation of thermodyna-mic properties.Our main aim is to describe a procedure which ensures that the resulting thermodynamicmodel is fully consistent. An additional objective is to present a formalism based on a modularapproach, which enables us to modify a single feature of the model, e.g. a mixing rule for oneof the model parameters, without rewriting the entire code. Finally we wish to demonstratethat the suggested approach leads to a computationally efficient code, in particular whenderived properties, such as composition derivatives of fugacity coefficients, are desired.

    0378-3812/92/$05.00 0 1992 Elsevier Science Publishers B.V. All rights reserved

  • 7/27/2019 Fluid Phase Equilibria 74 (1992) L-15

    2/15

    2 J.M. M ol l erup and M .L. M i chel sen /Flui d Phase Equi l i bri a 74 (1992) l -15THE HELMHOLTZ SURFACE AND ITS DERIVATIVESGiven an equation of state

    P - WPJ) (1)where x is the vector of mixture mole fractions, the textbook approach to calculate mixturefugacity coefficients is by means of an integral, i.e.

    (2)

    where Z is the compressibility factor, Z=Pv/RT. Interchange of the order of integration anddifferentiation in eqn. (2) leads to the equivalent, more convenient expression

    VRTLn9,--$/(P-F)dV-RTenz

    1*- aA (T,V,n)/%, - RT & J z

    where

    A(T,V,@ - -

    (3)

    (4)

    A is the residual Helmholtz function, i.e. the Helmholtz function of the mixture, given as afunction of temperature T, total volume V, and the vector of mixture mole numbers II, minusthat of the equivalent ideal gas mixture at (T,V,n). R is a homogeneous function of degree 1in the extensive variables (V,n) and, given an expression for A, all other properties can bederived solely by differentiation. The pressure equation itself, normally used to define theequation of state, is actually just one of these derivatives given by

    pm_- a,,+?av (5)The expression for the residual Helmholtz energy is thus the key equation in equilibriumthermodynamics (Michelsen 1981), where all other residual properties are calculated as partialderivatives in the independent variables T, V, and n, as shown in Table I in the Appendix. In

  • 7/27/2019 Fluid Phase Equilibria 74 (1992) L-15

    3/15

    J.M . Mol l erup and M .L. M i chel sen /Flui d Phase Equi l i brfa 74 (1992) 1-15 3particular, it is important to recognize that mole numbers rather than mole fractions are theindependent variables. Derivatives with respect to mole fractions are best avoided, as they re-quire a definition of the dependent mole fraction and in addition lead to more complex ex-pressions missing many important symmetry properties.Should we wish to modify our thermodynamic model, it is far most convenient to introducesuch modifications directly in the expression for A. Modified mixture parameters shoulddepend only on T, V, and n and preserve the homogeneity of A. This approach reduces therisk of errors and inconsistencies or misconceptions such as pressure dependent interactioncoefficients.In addition many model concepts relate directly to the Hehnholtx function rather than to apressure equation. This applies for example to a corresponding states model, to a chemicalmodel, and to a model based on statistical mechanics, where the Helmholtx function is givendirectly in terms of the canonical partition function, A = - kT In Q.Finally since the Helmholtx energy is a first order homogeneous function in the extensivevariables V and n we canfrom Eulers theorem of a homogeneous function write the followingmathematical constraint

    A,dT - WA, - Crt&, - 0i

    In general we use the notation F,, for the partial derivative of the function or parameter F withrespect to the variable y keeping all other variables constant. That is

    A,- a4( 1T y- sA,- M( 1v rr - - P

    (7)

    (9)

    Equation (6) is known as the Gibbs-Duhem equation.

  • 7/27/2019 Fluid Phase Equilibria 74 (1992) L-15

    4/15

    4 J.M . M ol l erup and M .L. M i chel sen /Flui d Phase Equi l i bri a 74 (19%) l -15CALKULATION OF THE DERIVATIVES OF THE HELMHOLTZ SURFACE.When a particular mathematical model is chosen for the Hehnholtz energy derived propertiessuch as fugacity coefficients, enthalpy, heat capacity etc. are obtained as partial derivatives withrespect to the independent variables T, V, and n, cf. Table I in the Appendix. Although notnecessary it is somewhat more convenient to work with the reduced residual Helmholtz energy,defined byF-ART (10)

    Normally our model provides an expression for F in terms of T, V, total moles n, and one ormore mixture parameters, a, b, . e.g.,

    where the mixture parameters are prescribed functions of T, V, and n. It is important to realizethat making these parameters functions of other thermodynamic properties, such as e.g. pres-sure, converts the algebraic model into a probably intractable differential equation. In thefollowing we shall assume that mixture parameters are specified explicit functions of tempera-ture, volume, and composition.We recommend that the calculation of the derivatives of F is performed as a two-step proce-dure. In the first step; F is differentiated with respect to its primary variables, i.e. T, V, n, andthe mixture parameters, and in the second step the derivatives of the mixture parameters areevaluated. This results in a set of model derivatives independent of the chosen mixing rulesand a set of parameter derivatives which are not directly affected by the form of the chosenmodel.The partial derivatives of F needed for calculation of thermodynamic properties are:

    ( aF/ m v, ,FT + Fsbr + F8, (12)

    (13)

    (14)

  • 7/27/2019 Fluid Phase Equilibria 74 (1992) L-15

    5/15

    .I . . M ol l erup and M . . M i chel sen Flui d Phase Equil i bri a 74 (I 992) I -15 5where we use bi and a, as abbreviated notations for the composition derivatives of b and a.The model derivatives are thus the terms F,,, F,, Fv, Fb, and F,, and the parameter derivati-ves are b, b,., bv and the corresponding terms for the a-parameter.Second order derivatives are found by repeated differentiation and straightforward applicationof the chain rule. As an example the second composition derivatives are given by

    (= )an,anj T - F, + F& b, + F,bu + F,,,,ai + & a, (15)

    where we have utilized the symmetry in the second order model derivatives, i.e. Fsb=F,,, etc.Adaption of the procedures described here does not only lead to an easier and better struc-tured approach for deriving thermodynamic properties but is also very likely to provide anefficient code, in particular when derivatives of fugacity coefficients are required. An illustra-tion is given in Table II in the Appendix for the Density Dependent Local Composition Modeldeveloped by Mollerup (1983, 1985) and Math& and Copeman (1983). Additional examplescan be found in Michelsen and Mollerup (1986).

    An example: The Kedlich-Kwong Equation of State (Mollerup 1986)

    The pressure equation is:p_RT_- o(T)v-b v(v+b) (16)were v is the molar volume, and mixing rules for mixture parameters b and a are conventional-ly given by:

    (17)

    (18)

  • 7/27/2019 Fluid Phase Equilibria 74 (1992) L-15

    6/15

    6 J.M . Mol l erup and M .L. M i chel sen / Fl ui d Phase Equi l i bri a 74 (1992) I -15where xi and xj are mixture mole fractions.First we substitute mole numbers for mole fractions and define the two new molar mixtureparameters B and D, whereB - nb - c n,b,I (19)

    D - n*a(T) - cc nj~p~(T)i Iand substitute the total volume V for the molar volume v, yieldingP nRT D--- -V- B v(V+B)

    We integrate according to equation (4) to obtain the residual Hehnholtz energy

    A(T,V,n) - nRTllL -and F, the reduced residual Helmholtz energy

    F(n,T,VWJ) - n l n v -V-B

    (20)

    (21)

    (22)

    (W

    The model derivatives needed for calculation of fugacity coefficients are thus F,, FP F,, F,and Fn, given byF,-layV-B (24)

    (25)

    F - n(lV _)_D(_1)V-B BRT V+B V (26)F,, _ n _V-B (27)

  • 7/27/2019 Fluid Phase Equilibria 74 (1992) L-15

    7/15

    J.M . M oi l erup and M .L. M i chei sen /Flui d Phase Equi l i bri a 74 (1992) 1-15

    Derivatives of the fugacity coefficients with respect to temperature, pressure, and compositionrequire the second order model derivatives F,,, F,,r, F,,,, F F F F F FnB, nD, TP TV, TB, TIMF,, Fva,htDt Fee, FBD, and FDD- These are readily found by repeated differentiation, and it is imme-diately evident that the terms F,,, FnT, F,,u, and Fun are identically zero.These model derivatives of F are combined with the derivatives of the mixture parameters toyield the derivatives required according to Table I in the Appendix, i.e.

    - F,, + F,B, + F,D ,

    8Fl-1@ y - F,, + FybB1 + F,D ,- (Fm + Fm Da B, + FmD , + FDD rr

    V

    - F,(B,+B$ + F,B,B,+F,B,,+F,,(B,D,+B ,D,)+F,D ,,

    The derivatives of the mixture parameters are

    (33)

    D i i 2au (35)

    (29)

    (30)

    (31)

    (32)

    (36)

  • 7/27/2019 Fluid Phase Equilibria 74 (1992) L-15

    8/15

    8 J .M.M ol l erup and M .L. M i chel sen Flui d Phase Equi l i bri a 74 (1992) I -15D , - 7 ni 7 n,@*a~ l ~* ) (37)

    and the derivatives of B,

    B, - b, BU 0 (38)

    In order to improve model performance the covolume parameter b is often calculated usinga quadratic rather than a linear mixing rule, i.e.

    b - CCx*Jr& (39)i i

    B is in this case given bynB - n*b (40)

    and its derivatives are found fromB + nBi - 2 cnjbU

    I (41)

    B, + Bj + nB,, - 2bu (42)The expressions derived above can be simplified further. The explicit temperature dependencein the model can be removed by absorbing the RT-term in the D-parameter, defining a newmixture parameter D = D/(RT). This reduces F to a function of only four independent vari-ables V, n, B and D.

    Introduction of new mixing rules.An alternative possibility is to introduce a new mixture parameter E, defined by

    E-D_ qvj~BBT Cnjbjj (43)This substitution results in simpler model derivatives at the expense of more complicatedexpressions for the derivatives of E.

  • 7/27/2019 Fluid Phase Equilibria 74 (1992) L-15

    9/15

    J.M . M ol l erup and M .L. M i chel sen Fl ui d Phase Equil i bri a 74 (1992) 1-15 9As an additional example we shall consider the use of a Huron-Vidal type mixing rule for thea-parameter (Huron and Vidal, 1979):

    where g is a local composition based expression for the excess Gibbs energy at infinite pres-sure. The only modifications required to utilize the derivatives derived earlier is the expressionsfor the D-parameter and its composition and temperature derivatives:

    It is important to realize that D is still treated as an independent parameter in the evaluationof the model derivatives, although it formally depends on both n and B.If desired, D is readily replaced by D, but in the present case a formulation in terms of theparameter E is more convenient, as it leads to simpler expressions for both the model deriva-tives and the parameter derivatives. The mixing rule for E becomes:E-D-C 411 1 ?lgBRT i n,-- - GRTRTb,

    TEST OF CALCULATED FUGACITY COEFFICIENTS AND PARTIAL DERIVATIVES.Unfortunately, even a systematic approach does not prevent coding errors, and it is importantthat computer codes for calculation of fugacity coefficients and their partial derivatives aretested for internal consistency. We have found the identities listed in Table III in the Appendixvery useful.The analytical derivatives can always be tested by numerical evaluation of the derivatives,preferably carried out by means of central differences, i.e.

    q fi n,* ,..., n, + c,..n> - fi nI ,% ... , - e,..nJi)n,- 2s (47)

    For composition derivatives e should be chosen as about l@ times the sum of moles, whichshould yield results accurate to 8-10 digits. Note that the composition derivatives are homoge-neous functions of degree -1 in the composition.Algorithms for calculation of mgacity coefficients which, given temperature, pressure, andcomposition, return only fugacity coefficients and the compressibility factor Z can be subjected

  • 7/27/2019 Fluid Phase Equilibria 74 (1992) L-15

    10/15

    10 J. M . M ol l erup and M .L. M i chel sen /Flui d Phase Equi l i bri a 74 (1992) l -15to the test relations

    and

    NOTATIONA=abBG&VCDEFGgHMWiajnnPRSVVXI 4xZ

    Total residual Hehnholtz energyMixture parameter in Cubic Equation of StateMixture parameter (covolume) in Cubic Equation of StateScaled b-parameter B = nbHeat capacities for n molesNumber of components in mixtureScaled a-parameter D = n2aModified mixture parameter E = D/(BRT)Reduced residual Hehnholtz energy AT/(RT)Total residual Gibbs EnergyExcess molar Gibbs energy expressionTotal residual EnthalpyMixture molar weightMolar amounts of components i and jTotal moles in mixtureVector of total molesPressureThe Gas constantTotal residual EntropyTotal volumeMolar volumeMole fractions of components i and jVector of mixture mole fractionsMixture compressibility factor Z = PV/(nRT)

    (48)

    (49)

  • 7/27/2019 Fluid Phase Equilibria 74 (1992) L-15

    11/15

    J.M . Mol l erup and M .L. M i chel sen /Fl ui d Phase Equi l i bri a 74 (1992) l -15SUperscriptS

    11

    r Residual property = real property minus ideal gas property at the same statevariables.

    GreekJoule-Thompson coefficientComponent fugacity coefficient

    REFERENCESHuron, M.J. and Vidal,J., 1979. New mixing rules in simple equations of state for representingvapour-liquid equilibria of strongly non-ideal mixtures. Fluid Phase Equilibria, 3: 255-271.Michelsen, M.L., 1981. Partial derivatives of thermodynamic properties from equations ofstate. Department of Chemical Engineering, DTH.Mollerup, J.M., 1983. Correlation of thermodynamic properties using a random-mixturereference state. Fluid Phase Equilibria, 15: 139-154.Math& P.M. and Copeman,T.W., 1983. Extension of the Peng-Robinson equation of stateto complex mixtures: Evaluation of various forms of the local composition concept. FhridPhase Equilibria, 13: 91-108.Mollerup, J.M., 1985. Correlation of gas solubilities in water and methanol at high pressure.Fluid Phase Equilibria, 22: 139-154.Michelsen, M.L. and Mollerup, J.M., 1986. Derivatives of thermodynamic properties. AJChEJournal, 32: no. 8, 1389-1392.Mollerup, J.M., 1986. Thermodynamic properties from a cubic equation of state. Departmentof Chemical Engineering, DTH.

  • 7/27/2019 Fluid Phase Equilibria 74 (1992) L-15

    12/15

    12APPENDIX

    J.M . M oli erup and M .L. M i chel sen Flui d Phase Equil i bti a 74 (1992) I-IS

    TABLE IThermodynamic properties calculated as derivatives of the residual Helmholtz surface

    A(T,V,n)--

    Pressure and derivatives

    2 - PV7nRT

    dP( 1 P_JQ A??dT,=-? ( 1var "

    0)

    (2)

    (3)

    (4)

    (9

    (7)

  • 7/27/2019 Fluid Phase Equilibria 74 (1992) L-15

    13/15

    J.M. M ol l erup and M .L. M i chel sen /Flui d Phase Equi l i bri a 74 (1992) I -15

    The fugacity coefficient and derivatives

    Other thermodynamic properties

    13

    (8)

    (9)

    (10)

    (11)

    (12)

    (13)

    04)

  • 7/27/2019 Fluid Phase Equilibria 74 (1992) L-15

    14/15

    14 J.M . M ol i erup and M L M i chel sen /Fl ui d Phase Equi l i bri a 74 (1992) 1 I S

    S(Tg,n) - SfzV+) + nR ln2

    H(T,P,n) A (T,V$l) + zs(T,Vp] + PV - MT

    G (TT,n) - A (T,V,nj + PV - nZt T - nRT faZ

    (16)

    07)

    (18)

    (19)

    TqT$,n) - RThlcp, (21)

    * Since the ideal gas energy, enthalpy, and heat capacity do not depend on pressure orvolume, their residual properties are independent of whether they are calculated atspecified (n,T,P) or (n,T,V). This is not the case with the entropy, the Gibbs energy andthe Helmholtz energy since g = - 4 and -$ - $ for an ideal gas.

  • 7/27/2019 Fluid Phase Equilibria 74 (1992) L-15

    15/15

    J.M . Mol l erup and M .L. M i chel sen /Flui d Phase Equi l i bri a 74 (1992) 1-15 15TABLE IIRelative computer time consumption of the DDLC model

    Number of components 2 14Calculated properties Time consumed

    Mathias and Copeman, (1983); ZandPnQi 1 75Mollerup, (1985); ZandFn$, 1 16

    Z, On +,, and derivatives 1.4 32

    TABLE IIIIdentity tests of calculated fugacity coefficients and partial derivatives

    i- 1,2,...,c

    (2)

    (3)

    (4)

    (5)