You are on page 1of 15

Fluid Phase Equilibria, 74 (1992) 1-15

Elsevier 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.

ABSTRACT A formalism for calculation of equilibrium properties from a model of the Helmholtz function is presented. A modular approach which enables modification of single features of the model without rewriting the entire computer code is emphasized. The formalism ensures a fully thermodynamic consistent set of relations and leads to efficient code. Identity tests for checking calculated fugacities and their partial derivatives are presented.

INTRODUCTION Calculation of thermodynamic properties from an equation of state may appear a trivial problem which only requires adherence to basic definitions. The increasing complexity of thermodynamic models, however, requires a systematic approach in order to avoid inefficient or even incorrect code, and we therefore find it appropriate to present some ideas which we have found valuable for generating modular and efficient code for calculation of thermodynamic properties. Our main aim is to describe a procedure which ensures that the resulting thermodynamic model is fully consistent. An additional objective is to present a formalism based on a modular approach, which enables us to modify a single feature of the model, e.g. a mixing rule for one of the model parameters, without rewriting the entire code. Finally we wish to demonstrate that the suggested approach leads to a computationally efficient code, in particular when derived 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

J.M. Mollerup and M.L. Michelsen /Fluid Phase Equilibria 74 (1992) l-15

THE HELMHOLTZ SURFACE AND ITS DERIVATIVES Given an equation of state P - WPJ) (1)

where x is the vector of mixture mole fractions, the textbook approach to calculate mixture fugacity 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 differentiation in eqn. (2) leads to the equivalent, more convenient expression

and

RTLn9,--$/(P-F)dV-RTenz 1* - aA (T,V,n)/%, - RT &J z

(3)

where

A(T,V,@

- -

(4)

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

pm_-

av

a,,+?

(5)

The expression for the residual Helmholtz energy is thus the key equation in equilibrium thermodynamics (Michelsen 1981), where all other residual properties are calculated as partial derivatives in the independent variables T, V, and n, as shown in Table I in the Appendix. In

J.M. Mollerup and M.L. Michelsen /Fluid

Phase Equilibrfa 74 (1992) 1-15

particular, it is important to recognize that mole numbers rather than mole fractions are the independent variables. Derivatives with respect to mole fractions are best avoided, as they require a definition of the dependent mole fraction and in addition lead to more complex expressions missing many important symmetry properties. Should we wish to modify our thermodynamic model, it is far most convenient to introduce such modifications directly in the expression for A. Modified mixture parameters should depend only on T, V, and n and preserve the homogeneity of A. This approach reduces the risk of errors and inconsistencies or misconceptions such as pressure dependent interaction coefficients. In addition many model concepts relate directly to the Hehnholtx function rather than to a pressure equation. This applies for example to a corresponding states model, to a chemical model, and to a model based on statistical mechanics, where the Helmholtx function is given directly in terms of the canonical partition function, A = - kT In Q. Finally since the Helmholtx energy is a first order homogeneous function in the extensive variables V and n we can from Eulers theorem of a homogeneous function write the following mathematical constraint

A,dT

- WA, -

Crt&,
i

- 0

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

F with

A,-

a4 y(aT 1

(7)

A,-

(M 1
av

rr - -

(9)

Equation

(6) is known as the Gibbs-Duhem

equation.

4 CALKULATION

J.M. Mollerup and M.L. Michelsen /Fluid Phase Equilibria 74 (19%) l-15

OF THE DERIVATIVES OF THE HELMHOLTZ

SURFACE.

When a particular mathematical model is chosen for the Hehnholtz energy derived properties such as fugacity coefficients, enthalpy, heat capacity etc. are obtained as partial derivatives with respect to the independent variables T, V, and n, cf. Table I in the Appendix. Although not necessary it is somewhat more convenient to work with the reduced residual Helmholtz energy, defined by

F-A
RT

(10)

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

where the mixture that making these sure, converts the following we shall ture, volume, and

parameters are prescribed functions of T, V, and n. It is important to realize parameters functions of other thermodynamic properties, such as e.g. presalgebraic model into a probably intractable differential equation. In the assume that mixture parameters are specified explicit functions of temperacomposition.

We recommend that the calculation of the derivatives of F is performed as a two-step procedure. In the first step; F is differentiated with respect to its primary variables, i.e. T, V, n, and the mixture parameters, and in the second step the derivatives of the mixture parameters are evaluated. This results in a set of model derivatives independent of the chosen mixing rules and a set of parameter derivatives which are not directly affected by the form of the chosen model. The partial derivatives of F needed for calculation of thermodynamic properties are:

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

(12)

(13)

(14)

.I.M. Mollerup and M.L. Michelsen/Fluid Phase Equilibria 74 (I 992) I-15

where 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 derivatives are b, b,., bv and the corresponding terms for the a-parameter. Second order derivatives are found by repeated differentiation and straightforward application of the chain rule. As an example the second composition derivatives are given by

(=) - F, an,anj IT

+ 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 structured approach for deriving thermodynamic properties but is also very likely to provide an efficient code, in particular when derivatives of fugacity coefficients are required. An illustration is given in Table II in the Appendix for the Density Dependent Local Composition Model developed by Mollerup (1983, 1985) and Math& and Copeman (1983). Additional examples can be found in Michelsen and Mollerup (1986).

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

The pressure equation is:

p_RT_v-b

o(T)
v(v+b)

(16)

were v is the molar volume, and mixing rules for mixture parameters b and a are conventionally given by:

(17)

(18)

J.M. Mollerup and M.L. Michelsen / Fluid Phase Equilibria 74 (1992) I-15

where xi and xj are mixture mole fractions. First we substitute mole numbers for mole fractions and define the two new molar mixture parameters B and D, where

B - nb - c

n,b,

(19)

D - n*a(T)

- cc

nj~p~(T)

(20)

and substitute the total volume V for the molar volume v, yielding
nRT P ---V-B D v(V+B)

(21)

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

A(T,V,n) -

nRTllL -

(22)

and F, the reduced residual Helmholtz energy

F(n,T,VWJ)

- n ln v V-B

(W

The model derivatives needed for calculation of fugacity coefficients are thus F,, FP F,, F, and Fn, given by

F,-lay

V-B

(24)

(25)

F -

_)_D(_1) n(l V V-B

BRT

V+B

(26)

F,,

V-B

(27)

J.M. Moilerup and M.L. Micheisen /Fluid Phase Equilibria 74 (1992) 1-15

Derivatives of the fugacity coefficients with respect to temperature, pressure, and composition require the second order model derivatives F,,, F,,r, F,,,, F nB,F nD,F TP F TV, F TB, F TIM F,, Fva, and it is immehtDt Fee, FBD, and FDD- These are readily found by repeated differentiation, 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 yield the derivatives required according to Table I in the Appendix, i.e. - F,, + F,B, + F,D, to

(29)

l-1
a@ y
V

8F

- F,, + FybB1 + F,D,

(30)

- (Fm + Fm Da B, + FmD, + FDDrr

(31)

- F,(B,+B$

+ F,B,B,+F,B,,+F,,(B,D,+B,D,)+F,D,,

(32)

The derivatives of the mixture parameters are

(33)

Dii - 2au

(35)

(36)

8 D,

J.M.Mollerup and M.L. Michelsen/Fluid Phase Equilibria 74 (1992) I-15 - 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 using a quadratic rather than a linear mixing rule, i.e. b - CCx*Jr& i i B is in this case given by nB - n*b (40) (39)

and its derivatives are found from B + nBi - 2 cnjbU I B, + Bj + nB,, - 2bu (41)

(42)

The expressions derived above can be simplified further. The explicit temperature dependence in the model can be removed by absorbing the RT-term in the D-parameter, defining a new mixture parameter D = D/(RT). This reduces F to a function of only four independent variables 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~
Cnjbj j

(43)

BBT

This substitution results in simpler model derivatives at the expense of more complicated expressions for the derivatives of E.

J.M. Mollerup and M.L. Michelsen/Fluid Phase Equilibria 74 (1992) 1-15 As an additional example we shall consider the use of a Huron-Vidal a-parameter (Huron and Vidal, 1979):

type mixing rule for the

where g is a local composition based expression for the excess Gibbs energy at infinite pressure. The only modifications required to utilize the derivatives derived earlier is the expressions for 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 evaluation of 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 the parameter E is more convenient, as it leads to simpler expressions for both the model derivatives and the parameter derivatives. The mixing rule for E becomes:

E-D-C
BRT i

n,-RTb,

411

1 ?lg
GRT

TEST OF CALCULATED FUGACITY COEFFICIENTS

AND PARTIAL DERIVATIVES.

Unfortunately, even a systematic approach does not prevent coding errors, and it is important that computer codes for calculation of fugacity coefficients and their partial derivatives are tested for internal consistency. We have found the identities listed in Table III in the Appendix very 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 i)n,-

fin,* ,..., n, + c,..n> - finI,% ,...p, - e,..nJ 2s

(47)

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

10 to the test relations

J. M. Mollerup and M.L. Michelsen /Fluid Phase Equilibria 74 (1992) l-15

(48)

and

(49)

NOTATION A= a b B G&V
C

D E F G g H
MW iaj n n

P R S V
V XI4 x

Total residual Hehnholtz energy Mixture parameter in Cubic Equation of State Mixture parameter (covolume) in Cubic Equation of State Scaled b-parameter B = nb Heat capacities for n moles Number of components in mixture Scaled a-parameter D = n2a Modified mixture parameter E = D/(BRT) Reduced residual Hehnholtz energy AT/(RT) Total residual Gibbs Energy Excess molar Gibbs energy expression Total residual Enthalpy Mixture molar weight Molar amounts of components i and j Total moles in mixture Vector of total moles Pressure The Gas constant Total residual Entropy Total volume Molar volume Mole fractions of components i and j Vector of mixture mole fractions Mixture compressibility factor Z = PV/(nRT)

J.M. Mollerup and M.L. Michelsen /Fluid


SUperscriptS

Phase Equilibria 74 (1992) l-15

11

Residual property = real property minus ideal gas property at the same state variables.

Greek Joule-Thompson Component coefficient

fugacity coefficient

REFERENCES Huron, M.J. and Vidal,J., 1979. New mixing rules in simple equations of state for representing vapour-liquid equilibria of strongly non-ideal mixtures. Fluid Phase Equilibria, 3: 255-271. Michelsen, M.L., 1981. Partial derivatives of thermodynamic state. Department of Chemical Engineering, DTH. Mollerup, J.M., 1983. Correlation of thermodynamic reference state. Fluid Phase Equilibria, 15: 139-154. properties from equations of

properties

using a random-mixture

Math& P.M. and Copeman,T.W., 1983. Extension of the Peng-Robinson equation of state to complex mixtures: Evaluation of various forms of the local composition concept. Fhrid Phase 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 Journal, 32: no. 8, 1389-1392. properties. AJChE

Mollerup, J.M., 1986. Thermodynamic properties from a cubic equation of state. Department of Chemical Engineering, DTH.

12 APPENDIX

J.M. Molierup and M.L. Michelsen/Fluid Phase Equilibtia 74 (1992)

I-IS

TABLE I

Thermodynamic properties calculated as derivatives of the residual Helmholtz surface

A(T,V,n)--

0)

(2)

Pressure and derivatives

(3)

2 - PV7nRT

(4)

(1

dP dT,=-?

P_JQ (

A??

avar1"

(9

(7)

J.M. Mollerup and M.L. Michelsen /Fluid

Phase Equilibria 74 (1992) I-15

13 (8)

The fugacity coefficient and derivatives

(9)

(10)

(11)

(12)

Other thermodynamic

properties

(13)

04)

14

J.M. Molierup and ML

Michelsen /Fluid Phase Equilibria 74 (1992) 1 -IS

(16)

S(Tg,n)

- SfzV+)

+ nR ln2

07)

H(T,P,n)

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

(18)

G (TT,n)

- A (T,V,nj

+ PV - nZtT - nRT faZ

(19)

TqT$,n) - RThlcp,

(21)

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

J.M. Mollerup and M.L. Michelsen /Fluid

Phase Equilibria 74 (1992) 1-15

15

TABLE II Relative computer time consumption

of the DDLC model

Number of components Calculated properties

14

Time consumed

Mathias and Copeman, (1983); Mollerup, (1985);

ZandPnQi ZandFn$, Z, On +,, and derivatives

1 1 1.4

75 16 32

TABLE III Identity tests of calculated fugacity coefficients and partial derivatives

(2)

(3)

i-

1,2,...,c

(4)

(5)

You might also like