Available via license: CC BY 4.0

Content may be subject to copyright.

Phys. Fluids 34, 116126 (2022); https://doi.org/10.1063/5.0122277 34, 116126

© 2022 Author(s).

Thermodynamic modeling for numerical

simulations based on the generalized cubic

equation of state

Cite as: Phys. Fluids 34, 116126 (2022); https://doi.org/10.1063/5.0122277

Submitted: 23 August 2022 • Accepted: 03 November 2022 • Published Online: 16 November 2022

T. Trummler, M. Glatzle, A. Doehring, et al.

COLLECTIONS

This paper was selected as Featured

ARTICLES YOU MAY BE INTERESTED IN

Application of the Maxwell–Stefan theory in modeling gas diffusion experiments into isolated

oil droplets by water

Physics of Fluids 34, 113327 (2022); https://doi.org/10.1063/5.0119766

Simulation of liquid jet atomization and droplet breakup via a Volume-of-Fluid Lagrangian–

Eulerian strategy

Physics of Fluids 34, 113326 (2022); https://doi.org/10.1063/5.0122742

A review on deep reinforcement learning for fluid mechanics: An update

Physics of Fluids 34, 111301 (2022); https://doi.org/10.1063/5.0128446

Thermodynamic modeling for numerical

simulations based on the generalized cubic

equation of state

Cite as: Phys. Fluids 34, 116126 (2022); doi: 10.1063/5.0122277

Submitted: 23 August 2022 .Accepted: 3 November 2022 .

Published Online: 16 November 2022

T. Trummler,

1,a)

M. Glatzle,

2

A. Doehring,

1

N. Urban,

1

and M. Klein

1

AFFILIATIONS

1

Institute of Applied Mathematics and Scientiﬁc Computing, Bundeswehr University Munich Werner-Heisenberg-Weg 39,

85577 Neubiberg, Germany

2

BooleWorks GmbH, Radlkoferstrasse 2, 81373 Munich, Germany

a)

Author to whom correspondence should be addressed: theresa.trummler@unibw.de

ABSTRACT

We further elaborate on the generalized formulation for cubic equation of state proposed by Cismondi and Mollerup [Fluid Phase Equilib. 232,

74–89 (2005)]. With this formulation, all well-known cubic equations of state can be described with a certain pair of values, which allow for a

generic implementation of different equations of state. Based on this generalized formulation, we derive a complete thermodynamic model for

computational ﬂuid dynamics simulations by providing the resulting correlations for all required thermodynamic properties. For the transport

properties, we employ the Chung correlations. Our generic implementation includes the often used equations of state Soave–Redlich–Kwong and

Peng–Robinson and the Redlich–Kwong–Peng–Robinson equation of state. The ﬁrst two assume a universal critical compressibility factor and

are, therefore, only suitable for ﬂuids with a matching critical compressibility. The Redlich–Kwong–Peng–Robinson overcomes this limitation by

considering the equation of state parameter as a function of the critical compressibility. We compare the resulting thermodynamic modeling for

the three equations of state for selected ﬂuids with each other and CoolProp reference data. Additionally, we provide a Python tool called real gas

thermodynamic python library (realtpl). This tool can be used to evaluate and compare the results for a wide range of different ﬂuids. We

also provide an implementation of the generalized form in OpenFOAM.

V

C2022 Author(s). All article content, except where otherwise noted, is licensed under a Creative Commons Attribution (CC BY) license (http://

creativecommons.org/licenses/by/4.0/).https://doi.org/10.1063/5.0122277

I. INTRODUCTION

Numerical ﬂow simulations of super- and transcritical conditions

require appropriate thermodynamic models. A state-of-the-art ther-

modynamic model is based on a cubic equation of state (EoS) and

departure function formalism for the evaluation of enthalpy and

energy. This can be found in early

2–5

as well as recent computational

ﬂuid dynamics (CFD) investigations.

6–14

For the cubic EoS, mostly the

Peng–Robinson

15

(PR) or the Soave–Redlich–Kwong EoS

16,17

(SRK) is

employed. Both assume a universal critical compressibility and are,

therefore, only suitable for ﬂuids with a matching critical compressibil-

ity. Volume translation methods

18–21

represent one possible solution

to improve the density prediction for ﬂuids, which are not well

described by SRK or PR. Cismondi and Mollerup

1

suggested the

Redlich–Kwong–Peng–Robinson EoS (RKPR), introducing a third

EoS parameter and formulating all three EoS parameters as a function

of the critical compressibility. Building upon their work, Kim et al.

22

presented a thermodynamic modeling approach based on the RKPR

and demonstrated its advantages and suitability for different ﬂuids.

Despite its advantages, only a few studies

6,23

have employed the RKPR

EoS recently for real gas CFD simulations of n-dodecane injections.

Within the suggestion of the RKPR, Cismondi and Mollerup

1

and ear-

lier Mollerup (see Michelsen and Mollerup

24

) also proposed a general

formulation of the cubic EoS by which all of the well-known cubic EoS

can be described with a particular set of values. Such a formulation

allows for a modularized implementation of all these cubic EoS, thus,

less code duplication and a better readability.

An alternative to a cubic EoS is the PC-SAFT EoS (perturbed-

chain statistical associating ﬂuid theory),

25

which has successfully been

employed by Rodriguez et al.

26

and Rodriguez et al.

27

for two-

dimensional CFD simulations. Another approach is the usage of tabu-

lated reference data, yielding higher accuracy

28

and also a potentially

faster evaluation of the thermodynamic data.

29,30

Recently, also

Phys. Fluids 34, 116126 (2022); doi: 10.1063/5.0122277 34, 116126-1

V

CAuthor(s) 2022

Physics of Fluids ARTICLE scitation.org/journal/phf

artiﬁcial neural networks, trained on tabulated data, have been

employed for thermodynamic modeling for real gas CFD simula-

tions.

31,32

However, cubic EoS are still mostly used due to their sim-

plicity and overall good accuracy. In addition to the EoS and the

relations for thermodynamic properties, CFD simulations also require

relations for the transport properties viscosity and thermal conductiv-

ity. Chung et al.

33

proposed correlations for these transport properties,

which are often employed for such real gas simulations.

6–9,21,34

Alternative methods are, for example, the Lucas method

35

for the vis-

cosity and the Stiel–Thodos method

35

for the thermal conductivity.

These methods have recently been employed by Sharan and Bellan

10

for nitrogen and showed a good agreement with NIST reference data.

Alternatively, the residual entropy scaling technique can be used for

the calculation of the thermal conductivity

36

and the viscosity

37

as

done by Koukouvinis et al.

28

In general, it is an important step in CFD

simulations to check the accuracy and suitability of a thermodynamic

model in advance, as included in several studies.

7,8,28

For different ﬂu-

ids, pressure, and temperature ranges, such an evaluation can be com-

plicated and time-consuming. Apart from that, such a veriﬁcation

requires an already successful implementation of the thermodynamic

model. This is usually not the case during the development or further

development of a CFD solver. The open source library CoolProp

38

provides implementations for the SRK and PR EoS. Bell et al.

39

wrote

a comprehensive thermodynamic library to evaluate chemical proper-

ties speciﬁcally targeted for chemical engineering. Our new tool

realtpl, on the other hand, has been speciﬁcally designed for appli-

cations in the context of CFD simulations and evaluates the entire

thermodynamic model required for these simulations.

In this paper, we aim to further promote the idea of the generalized

formulation of cubic EoS by Mollerup,

1,24

i.e., one formulation for all

three cubic EoS (PR, SRK, and RKPR). To this end, we describe in detail

how this formulation is solved and present the resulting relations for the

thermodynamic properties. We also outline the overall thermodynamic

model based on this generalized formulation. For the thermodynamic

model, we employ the Chung correlations for the evaluation of the

transport properties. We apply the thermodynamic model to selected

ﬂuids and study its suitability. Therewith, we also demonstrate the good

applicability of the RKPR for all ﬂuids with different critical compress-

ibility factors. In order to test the proposed thermodynamic model and

to apply it to different conﬁgurations, we provide an open source

Python tool called realtpl forarealgasthermodynamicpython

library. This tool can be used to evaluate and compare the results for a

wide range of different ﬂuids. Additionally, we also provide the imple-

mentation of the generalized form in OpenFOAM.

The paper is structured as follows: Sec. II presents the thermody-

namic model based on the generalized cubic EoS. Then, in Sec. III,the

applicability and suitability of the thermodynamic model are assessed

for selected ﬂuids comparing the model using SRK, PR, and RKPR.

Section IV contains information about the additionally provided

Python tool realtpl and the validation of the proposed

OpenFOAM implementation based on the generalized formulation.

Finally, the paper is summarized in Sec. V.

II. THERMODYNAMIC MODEL BASED ON A

GENERALIZED CUBIC EQUATION OF STATE

We present a thermodynamic model based on the generalized

cubic EoS. First, we present the EoS and describe in detail how it is

solved. Then, the correlations to evaluate the thermodynamic proper-

ties are presented and, ﬁnally, the Chung correlations for the transport

properties are brieﬂy described.

A. Generalized cubic equation of state

We here consider the generalized formulation of a cubic EoS sug-

gested by Cismondi and Mollerup

1

and already earlier by Mollerup

24

pðv;TÞ¼ RT

vbaa

ðvþd1bÞðvþd2bÞ:(1)

The pressure pis a function of the molar volume vand the temperature

T. R denotes the universal gas constant with R¼8314:472 J=ðkmol KÞ.

aand brepresent the two traditional EoS parameters, considering

attractive forces with aand repulsive forces by the effective molecular

volume b. Both are determined by a proportionality factor and the criti-

cal properties p

c

and T

c

of the ﬂuid (see Table I). Furthermore, ais mul-

tiplied by a correction factor athat is a function of reduced temperature

T=Tcand the acentric factor x. It is worth noting that for a¼0and

b¼0, the cubic EoS collapses to the ideal gas law. As a consequence,

mathematically, and also physically, the molar volume vhas to be larger

than the co-volume b(v>b). The common cubic EoS can be described

with special pairs of the values d

1

and d

2

,whered

2

is a supplementary

parameter deﬁned as ð1d1Þ=ð1þd1Þ. Multiplying the denominator

out results in the well-known and often used formulation of

pðv;TÞ¼ RT

vbaa

v2þubv þwb2;(2)

where u¼d1þd2and w¼d1d2. However, the ﬁrst formulation [Eq.

(1)] yields simpler expressions of the derivations required for evaluat-

ing the thermodynamic properties (see Sec. II B)thanEq.(2). For the

widely used EoS SRK and PR, the proportionality factor in aand bis

constant and d

1

, or, respectively, uand w, are constants with d1¼1

(u¼1, w¼0) for SRK and d1¼1þﬃﬃﬃ

2

p(u¼2, w¼1) for PR.

Hence, for SRK and PR, a universal critical compressibility has been

assumed, which is about 0.285 for SRK and 0.263 for PR.

22

Therefore,

these two EoS are only well suited for a certain set of ﬂuids with a cor-

responding similar critical compressibility. To overcome this limita-

tion, Cismondi and Mollerup

1

suggested to evaluate the EoS

parameters as a function of the critical compressibility resulting in the

RKPR EoS. For the detailed evaluation of the EoS parameters, see

Table I. For the RKPR, a different correlation than for SRK and PR is

used to evaluate a. Consequently, also the derivatives by temperature

@a=@Tand @2a=@ T2, required for the evaluation of the thermody-

namic properties, differ for the EoS. Concluding, all three cubic EoS

SRK, PR, and RKPR can be described by Eq. (1), where only the EoS

parameters a,b,andd

1

as well as the evaluation of achanges.

Figure 1 shows a reduced pressure–volume diagram for n-hexane

including cubic isotherms evaluated using the PR EoS. A subcritical

(T<Tc), a critical (T¼T

c

), and a supercritcal (T>Tc) isotherm are

plotted to illustrate the behavior in the different regimes. The subcriti-

cal isotherm crosses the two-phase region, which is bounded by the

bubble-point-line and the dew point-line. In thermodynamic equilib-

rium, the phase change follows the dashed line and the pressure

remains constant (see Fig. 1, dashed brown line). The cubic isotherm

shows a different path within the two-phase region describing meta-

stable states. Note that the part with the positive slope has physically

Physics of Fluids ARTICLE scitation.org/journal/phf

Phys. Fluids 34, 116126 (2022); doi: 10.1063/5.0122277 34, 116126-2

V

CAuthor(s) 2022

no meaning since pressure increases with volume (@p=@vjT).

Therefore, solving cubic EoS at subcritical conditions can be challeng-

ing, as described in more detail below.

In order to solve the cubic EoS [Eq. (1)], the equation is reformu-

lated using the dimensionless compressibility factor as follows:

Z¼pv

RT ;(3)

as well as dimensionless expressions for aand bwith A¼paaðRTÞ2

and B¼pbðRTÞ1. Therewith, one obtains from Eq. (1)

Z¼1

1B=ZA

B

B=Z

ð1þd1B=ZÞð1þd2B=ZÞ:(4)

Recasting results in the cubic form of all considered EoS in terms of Z,

which reads

Z3þa2Z2þa1Zþa0¼0 (5)

with the coefﬁcients

a2¼Bðd1þd21Þ1;(6)

a1¼Aþd1d2B2ðd1þd2ÞBðBþ1Þ;(7)

a0¼Bðd1d2B2þd1d2BþAÞ:(8)

The obtained cubic equation can be solved for real roots, which is well

described in the literature.

34,40,41

A cubic equation has either one real

and two imaginary roots or three real roots (see also Fig. 1). At super-

critical conditions usually only one real root is present. For this reason,

we recommend ﬁrst checking for the existence of one real root when

evaluations are focused on supercritical conditions. Three real roots

are generally associated with the two-phase region present at subcriti-

cal conditions. As mentioned above, the volume has to be larger than

the co-volume b(v>b) or expressed in terms of the compressibility

factor Z>B. If the physical constraint Z>Bis full-ﬁlled, the smallest

root represents the liquid state and the largest root the vapor or gas

state (see also Fig. 1). From a thermodynamic perspective, the center

root is not stable and, therefore, physically meaningless. The correct

root of the two physically stable roots can be identiﬁed by comparing

the Gibbs energy (see Sec. II B). An alternative approach is to take

always the largest root, which usually corresponds to the vapor/gaseous

state (exception see below).

FIG. 1. Reduced pressure–volume (p–v) diagram for n-hexane evaluated using the

PR EoS.

TABLE I. Parameters of the EoS adopted from Kim et al.

22

SRK

16

PR

15

RKPR

1

d

1

11þﬃﬃﬃ

2

pd2þd1ðd3czZcÞd4þd5ðd3czZcÞd6with cz¼1:168;

d1¼0:428 363;d2¼18:496 215;

d3¼0:338 426;d4¼0:660 000;

d5¼789:723 105;d6¼2:512 392

d

2

01ﬃﬃﬃ

2

pð1d1Þ=ð1þd1Þ

A0:427 47 R2T2

c

pc

! 0:457 24 R2T2

c

pc

! 3y2þ3yd þd2þd1

ð3yþd1Þ2

R2T2

c

pc

!

B0:086 64 RTc

pc

0:0778 RTc

pc

1

3yþd1

RTc

pc

with d¼1þd2

1

1þd1

y¼1þ½2ð1þd1Þ1

3þ4

1þd1

1

3

Að1þjð1ﬃﬃﬃﬃﬃﬃﬃﬃﬃﬃ

T=Tc

pÞÞ2ð1þjð1ﬃﬃﬃﬃﬃﬃﬃﬃﬃﬃ

T=Tc

pÞÞ2

ð3=ð2þT=TcÞÞj

K0:485 08

þ1:551 71x

0:156 13x2

0:374 64

þ1:542 26x

0:269 92x2

ð66:125czZc23:359Þx2

þð40:594czZcþ16:855Þx

þð5:273 45czZc0:258 26Þ

Physics of Fluids ARTICLE scitation.org/journal/phf

Phys. Fluids 34, 116126 (2022); doi: 10.1063/5.0122277 34, 116126-3

V

CAuthor(s) 2022

At very high and low pressures, the smallest root can be

smaller than the co-volume (ZB). In this case, there is only one

physical meaningful root, which is the largest one. At high pres-

sures, this root then corresponds to a liquid state, while at very low

pressures it corresponds to the gaseous/vapor state. It is important

to note that this can also occur in a clearly supercritical regime,

such as for n-dodecane at the ECN-Spray A condition with

p¼8 MPa in the temperature range T¼1097–1500 K us ing PR o r

RKPR. Consequently, a missing check for Z>Bresults in high

deviations for both EoS, while including the check yields moderate

deviations. Figure 4 illustrates the modeling of n-dodecane at the

mentioned conditions and shows that with the included check for

Z>Bonly small deviations occur.

The presented EoS can be extended to model a homogeneous

mixture for an arbitrary number of components. To this end, the EoS

parameter aaand bhave to be evaluated as a function of the mixture.

Details can be found in the literature.

6,8,22,34

B. Thermodynamic properties

In addition to the correlation of density, pressure, and tempera-

ture, also expressions for thermodynamic properties, such as the inter-

nal energy e, entropy s,enthalpyh, and speciﬁc heats cpand cv,are

needed for CFD simulations. The evaluation of these quantities

includes several thermodynamic derivatives, which can be solved using

the departure function formalism. For more detailed information, we

refer to Poling et al.

35

and Elliott and Lira,

40

and for details on the for-

mulations for the RKPR to Fathi et al.

6

and Kim et al.

22

The presented

formulations are obtained from Matheis

34

and recast to be valid for

the more generic formulation.

For the internal energy, this can be written as

eðv;TÞ¼e0ðTÞþðv

1

T@p

@Tjvp

dv;(9)

where the subscript 0 refers to the ideal reference state. The solution of

the integral reads

ee0¼aaT@aa

@T

K;(10)

where the term Kcontains the following expression:

K¼1

bðd1d2Þln vþd1b

vþd2b

:(11)

Consequently, the enthalpy his calculated with

hh0¼ee0þpv RT;(12)

resulting in the expression

hh0¼aaT@aa

@T

Kþpv RT:(13)

The entropy sis obtained with

sðv;TÞ¼s0ðTÞþðv

1

@p

@TjvR

v

dvþRln ðZÞ;(14)

resulting in

ss0¼KT @aa

@TþRln 1 b

v

:(15)

Finally, the Gibbs energy gis calculated using Eqs. (12) and (14),

gg0¼hh0Tðss0Þ;(16)

gg0¼aaKþpv RT 1þln 1 b

v

:(17)

As mentioned above, the Gibbs energy can be used to determine the

most stable root out of three real roots. If the smallest root is larger

than B[min(Z)>B], then the smallest root represents the liquid state

[Zl¼minðZÞ] and the largest one the vapor state [Zv¼maxðZÞ].

TherelativedifferencebetweentheGibbsenergyofthetwosolutions

can be evaluated with

dg ¼gvgl

RT ¼A

Bðd1d2Þln ðZlþd1BÞðZvþd2BÞ

ðZlþd2BÞðZvþd1BÞ

ðZlZvÞþln ZlB

ZvB

:(18)

If dg <0(gv<gl), the vapor state is stable. Contrary, if dg >0

(gv>gl), the liquid state is stable.

Theheatcapacityatconstantvolumecvis calculated with

ðcvcv0Þ¼T@2aa

@T2K;(19)

where cv0is evaluated using cv0¼cp0R.cp0, the heat capacity at

constant pressure at ideal reference state, is determined with the 7-

coefﬁcient or the 9-coefﬁcient NASA polynomials. For the corre-

sponding data for the 7-coefﬁcient polynomials, we refer to Goos

et al.,

42

and for the 9-coefﬁcient ones to McBride.

43

Special atten-

tion should be paid to the fact that the polynomials are adapted for

certain temperature ranges and that for a smooth calculation over

several temperature ranges an appropriate implementation has to

be done. Then, the heat capacity at constant pressure cpcan be

evaluated using

cp¼cvT@p

@Tv

!

2@p

@v

T(20)

with

@p

@Tv¼R

vbþ@aa

@T

1

D(21)

and

@p

@vT¼ RT

ðvbÞ2þaað2vþðd1þd2ÞbÞ

D2(22)

with the denominator D

D¼ðvþd1bÞðvþd2bÞ¼v2þðd1þd2Þbv þd1d2b2:(23)

The speed of sound cis calculated using

c¼ﬃﬃﬃﬃﬃﬃﬃﬃﬃﬃﬃﬃﬃﬃﬃﬃﬃﬃﬃﬃ

cp

cv

@p

@vT

v2

M

s:(24)

Physics of Fluids ARTICLE scitation.org/journal/phf

Phys. Fluids 34, 116126 (2022); doi: 10.1063/5.0122277 34, 116126-4

V

CAuthor(s) 2022

C. Transport properties viscosity and heat conductivity

with the Chung correlations

For CFD simulations, also suitable relations for the transport

properties viscosity land heat conductivity kare necessary, where the

correlations by Chung et al.

33

are often employed.

6–9,21,34

Both quanti-

ties are composed of two terms referring to different pressure levels,

l¼lkþlp(25)

and

k¼kkþkp:(26)

The ﬁrst summand l

k

,andk

k

, respectively, dominates at low pressures

and is based on the Chapman–Enskog theory for diluted gases. The

second term, l

p

and k

p

, dominates at higher pressures and is based on

empirical correlations. The input for the model is composed of the

ﬂuid properties, the temperature, the density, and the heat capacity cv,

where the latter only affects the evaluation of k. For a detailed descrip-

tion, see Chung et al.

33

and Poling et al.

35

III. ASSESSMENT OF THE ACCURACY OF THE

THERMODYNAMIC MODEL

Figure 2 shows the density q,theheatcapacityc

p

, the viscosity l,

and heat conductivity kfor the n-alkane methane (Zc¼0:2863), the

cycloalkane cyclopentane (Zc¼0:2813), the n-alkanes n-hexane

(Zc¼0:2664), and n-dodecane (Zc¼0:2497). All data have been

evaluated at a reduced pressure of p=pc¼1:5. Overall, the thermody-

namic modeling is able to reproduce the non-linear behavior for all

depicted quantities. As expected, the ﬂuids with a critical compressibil-

ity close to 0.285 are well described by SRK, while for n-hexane

with Zc¼0:2664 PR (optimized for Zc¼0:263) gives good results.

FIG. 2. Comparison of the modeled density q, heat capacity c

p

, viscosity l, and heat conductivity kusing the thermodynamic model employing different EoS with reference val-

ues from CoolProp.

38

(a) Methane (Zc¼0:2863), (b) cyclopentane (Zc¼0:2813), (c) n-hexane (Zc¼0:2664), and (d) n-dodecane (Zc¼0:2497). All data have been evalu-

ated at a reduced pressure of p=pc¼1:5.

Physics of Fluids ARTICLE scitation.org/journal/phf

Phys. Fluids 34, 116126 (2022); doi: 10.1063/5.0122277 34, 116126-5

V

CAuthor(s) 2022

For n-dodecane, RKPR yields the best results. In all cases, the density

is modeled very well with the RKPR EoS. It is either comparable to

SRK and PR or much better, if the critical compressibility differs from

the values for which the two were designed.

Figure 3 visualizes the density variation qover the temperature

for these four ﬂuids at different pressures p=pc¼f0:75;1:5;3:0g.

Again, the EoS can reproduce the non-linear density behavior at all

pressure levels. Furthermore, it can be seen that at all depicted pressure

levels, the trend of the suitability of a particular EoS remains about the

same.

In Fig. 2, we have also included other thermodynamic quantities

and in the following we discuss the accuracy of the modeling of these

quantities. The speciﬁc heat capacity c

p

is evaluated with Eq. (20).The

peak at the pseudo-boiling is well captured by all EoS, but the maxi-

mum value is underestimated.

The overall behavior of the transport properties (l,k)iswell

described by the Chung correlations. In comparison with the density

evolution for the different cubic EoS, one can see that the error in the

modeling of the density qcorresponds to the error in the modeling of

these two quantities, see PR in Figs. 2(a) and 2(b). This is due to the

fact that the density qis an input parameter for the Chung model,

which directly affects the calculation of the high pressure empirical

terms l

p

and k

p

. Hence, the error of the Chung correlations increases

with an increasing modeling error of the density. Furthermore, for k,

the error of cvaffects the calculation of k

k

. As a consequence, the

Chung correlations yield better results the more accurate qand cvare

modeled. In addition to our ﬁndings, we refer to the recent work by

Longmire and Banuti,

32

who also evaluated and discussed the suitabil-

ity of the Chung correlations for modeling transport properties.

IV. PYTHON TOOL AND OPENFOAM IMPLEMENTATION

We provide an open source Python tool called realtpl (real

gas thermodynamic python library) for the presented thermodynamic

model. Additionally, we also provide the implementation of the gener-

alized form in OpenFOAM.

A. Python framework realtpl

Checking the accuracy of a thermodynamic model in advance is

a central step before conducting CFD simulations. For different ﬂuids

as well as different pressure and temperature ranges, such an evalua-

tion can be complicated and especially time consuming. To this end,

we have written an open source Python tool to easily compare the

results obtained with the here described thermodynamic model based

on cubic EoS. The Python tool is called realtpl standing for our

real gas thermodynamic python library. It is directly coupled to the

open source library CoolProp

38

obtaining experimental reference data,

as well as ﬂuid properties, such as, for example, molar mass and critical

properties. In addition, a database was created for the NASA coefﬁ-

cients, which is also directly coupled to realtpl.Usingrealtpl,

thermodynamic modeling based on the cubic EoS PR, SRK, RKPR can

be compared and also contrasted with the reference data from

CoolProp. The current implementation is designed to evaluate results

over a temperature range (with deﬁned number of temperature steps)

for a given pressure level. The data are displayed graphically and can

FIG. 3. Comparison of the modeled density qusing different EoS with reference values from CoolProp

38

at different pressures. Columns from left to right: (a) methane

(Zc¼0:2863), (b) cyclopentane (Zc¼0:2813), (c) n-hexane (Zc¼0:2664), and (d) n-dodecane (Zc¼0:2497). Rows from top to bottom: p=pc¼0:75;p=pc¼1:5, and

p=pc¼3:0.

Physics of Fluids ARTICLE scitation.org/journal/phf

Phys. Fluids 34, 116126 (2022); doi: 10.1063/5.0122277 34, 116126-6

V

CAuthor(s) 2022

also be exported to a csv ﬁle for further processing. Moreover, also

evaluations over temperature and pressure ranges can be done, which

allows for table generation.

28–30

To this end, the ranges and also the

step width can be speciﬁed as conﬁguration parameter. Apart from

that, this open source Python tool can serve as an inspiration for

implementing the present model into an internal ﬂow solver.

Table II lists the process time for the evaluation of a representa-

tive conﬁguration to provide estimates for the evaluation times using

realtpl. The data have been evaluated for 10, 10

2

,10

3

,and10

4

tem-

perature steps using a standard laptop (Intel i5, seventh generation).

Startup refers to the reading of the conﬁg ﬁles and corresponding ﬂuid

properties. Ref. data stands for extracting the reference data from

CoolProp. In the current version, the ﬁve quantities density, heat

capacity, speed of sound, viscosity, and heat conductivity are extracted.

This extraction from CoolProp cannot be vectorized and, thus, it has

to be looped over the temperature steps. Therefore, the evaluation

time required scales roughly linearly with the number of temperature

evaluations. This is the main time consumer when about 3 103tem-

perature evaluations are exceeded. For the thermodynamic model, we

have here listed the average of all three cubic EoS named Thermo.

model. To improve performance, the implementation of the thermo-

dynamic models has been recast as vectors, avoiding time-consuming

loops. For this reason, there is no linear scaling of the evaluation pro-

cess. Also at 10

4

temperature evaluations, the time per thermodynamic

model is still about 0.05 s. Here, it has to be noted that ﬁve quantities

areevaluated.AmongdifferentcubicEoS,wehaveseenthatitvaries

depending on how often the check for B and the Gibbs evaluation has

to be done. The next contributions are then output and postprocessing

related. Figures refers to the visualization of all ﬁvequantities including

the write out of the ﬁgures. For less than 3 103, this is the most time

consuming part. The last part Data-output is the write out of all evalu-

ated data to a csv ﬁle and does not consume signiﬁcant time. For the

entire evaluation at, e.g., 10

3

temperature steps, approxim ately 6 s are

required with writing out of the ﬁgures and approximately 2.2 s with-

out. realtpl is available as a PIP Python package and also on

github github.com/ttrummler/realtpl.

B. Generalized Formulation in OpenFOAM

V

R

OpenFOAM is a widely used open source software for simula-

tions, where currently the most recent versions are the foundation ver-

sion OpenFOAM-10

44

and the ESI version OpenFOAM2206.

45

In

both, the PR EoS is available as PengRobinsonGas.Insomein-house

extensions of OpenFOAM,

46–48

the SRK has additionally been imple-

mented. Despite the identical structure of SRK and PR, these two EoS

are often hard coded and, thus, lead to code duplicates. Following the

generalized formulation proposed above, we propose a more general

implementation of cubic EoS to avoid code duplication and to

improve readability. We provide this extension for OpenFOAM under

github.com/ttrummler/realFOAM. In order to keep the traditional

OpenFOAM code structure and to not change the input ﬁles, we have

created three separate folders for the different EoS.

Figure 4 shows a validation of our OpenFOAM implementations

comparing the density distribution with that obtained using the Python

tool realtpl. As test conﬁguration, we consider n-dodecane at a

pressure of p¼8 MPa and a temperature range of T¼500–1500 K,

matching the conditions of one operating point of the ECN Spray

A.

8,28

As expected, both implementations lead to nearly identical

results. For RKPR, a very small deviation is visible, which is due to

rounding errors.

V. CONCLUSIONS

We have presented a thermodynamic model for real gas CFD

simulations based on the generalized formulation of cubic EoS. Using

this generalized formulation, all of the well-known cubic EoS can be

described with a particular value for d

1

[d2¼ð1d1Þ=ð1þd1Þ]. We

have provided a detailed presentation of the resulting generalized cubic

equation in Zand practical hints for solving it. To evaluate the ther-

modynamic properties, we presented formulations of the derivatives.

The transport properties are modeled with the Chung correlations.

The thermodynamic model allows for a modularized implementation

of several EoS.

For the cubic EoS, we have considered the well-known formula-

tions SRK and PR. These two are speciﬁcally designed for an assumed

critical compressibility factor and, therefore, their suitability is limited.

Additionally, we also considered the RKPR, where the EoS parameters

are functions of the critical compressibility factor. In this study, we

have assessed the applicability of the three EoS for selected ﬂuids and

showed that the RKPR could be a good universally applicable choice

for the EoS. In addition to this, we have demonstrated that overall the

presented thermodynamic model can capture and reproduce the

TABLE II. Overall process time for different numbers of temperature evaluations

(t-ev), for details, see text.

10 t-ev (s) 10

2

t-ev (s) 10

3

t-ev (s) 10

4

t-ev (s)

Startup 0.020 0.020 0.020 0.020

Ref. data 0.037 0.179 1.489 15.894

Thermo. model 0.002 0.002 0.006 0.046

Figures 3.860 3.860 3.860 3.860

Data-output 0.018 0.034 0.146 0.365

Total 3.941 4.099 5.533 20.276

FIG. 4. Comparison of the modeled density for n-dodecane at a pressure of

p¼8 MPa. Comparison of python implementation in realtpl (colored solid

lines) and OpenFOAM implementation (colored dots) with the reference data (black

solid line) taken from CoolProp.

38

Physics of Fluids ARTICLE scitation.org/journal/phf

Phys. Fluids 34, 116126 (2022); doi: 10.1063/5.0122277 34, 116126-7

V

CAuthor(s) 2022

non-linear behavior of relevant thermodynamic quantities with an

acceptable error.

We provide our Python implementation of the generalized EoS

in the form of a ready-to-use open source tool, which can produce

results as those shown in this work for a wide range of ﬂuids.

Additionally, we provide an implementation in OpenFOAM.

ACKNOWLEDGMENTS

This project received funding by dtec.bw—Digitalization and

Technology Research Center of the Bundeswehr—under the project

MaST: Macro/Micro-simulation of Phase Decomposition in the

Transcritical Regime.

AUTHOR DECLARATIONS

Conflict of Interest

The authors have no conﬂicts to disclose.

Author Contributions

Theresa Trummler: Conceptualization (lead); Data curation (equal);

Formal analysis (lead); Investigation (equal); Methodology (equal);

Software (equal); Validation (supporting); Writing – original draft

(lead); Writing – review & editing (lead). Martin Glatzle: Methodology

(equal); Software (equal); Validation (lead); Writing – review & editing

(supporting). Alexander Doehring: Conceptualization (supporting);

Data curation (supporting); Investigation (supporting); Methodology

(supporting); Validation (supporting); Visualization (supporting);

Writing – original draft (supporting); Writing – review & editing

(supporting). Noah Urban: Data curation (supporting); Methodology

(supporting); Visualization (supporting); Writing – original draft (sup-

porting). Markus Klein: Funding acquisition (lead); Writing – original

draft (supporting); Writing – review & editing (supporting).

DATA AVAILABILITY

The data that support the ﬁndings of this study are openly avail-

ableinpythontoolrealtpl as a PIP Python package https://

pypi.org/project/realtpl and github https://github.com/ttrummler/

realtpl. The data that support the ﬁndings of this study are openly

available in OpenFOAM on github https://github.com/ttrummler/

realFOAM with separate branches for the ESI and Foundation

versions.

REFERENCES

1

M. Cismondi and J. Mollerup, “Development and application of a three-

parameter RK–PR equation of state,” Fluid Phase Equilib. 232, 74–89 (2005).

2

N. Zong, H. Meng, S.-Y. Hsieh, and V. Yang, “A numerical study of cryogenic

ﬂuid injection and mixing under supercritical conditions,” Phys. Fluids 16,

4248–4261 (2004).

3

T. Kim, Y. Kim, and S.-K. Kim, “Numerical study of cryogenic liquid nitrogen

jets at supercritical pressures,” J. Supercrit. Fluids 56, 152–163 (2011).

4

T. S. Park, “LES and RANS simulations of cryogenic liquid nitrogen jets,”

J. Supercrit. Fluids 72, 232–247 (2012).

5

X. Petit, G. Ribert, G. Lartigue, and P. Domingo, “Large-eddy simulation of

supercritical ﬂuid injection,” J. Supercrit. Fluids 84, 61–73 (2013).

6

M. Fathi, S. Hickel, and D. Roekaerts, “Large eddy simulations of reacting and

non-reacting transcritical fuel sprays using multiphase thermodynamics,”

Phys. Fluids 34, 085131 (2022).

7

C. Traxinger, H. M€

uller,M.Pﬁtzner,S.Baab,G.Lamanna,B.Weigand,J.Matheis,

C. Stemmer, N. Adams, and S. Hickel, “Experimental and numerical investigation

of phase separation due to multi-component mixing at high-pressure conditions,”

in 28th European Conference on Liquid Atomization and Spray Systems (Editorial

Universitat Polite`cnica de Vale`ncia, 2018), pp. 130–137.

8

J. Matheis and S. Hickel, “Multi-component vapor-liquid equilibrium model

for LES of high-pressure fuel injection and application to ECN Spray A,” Int. J.

Multiphase Flow 99, 294–311 (2018).

9

H. M€uller, C. A. Niedermeier, J. Matheis, M. Pﬁtzner, and S. Hickel, “Large-

eddy simulation of nitrogen injection at trans- and supercritical conditions,”

Phys. Fluids 28, 015102 (2016).

10

N. Sharan and J. Bellan, “Investigation of high-pressure turbulent jets using

direct numerical simulation,” J. Fluid Mech. 922, A24 (2021).

11

C. Lagarza-Cort

es, J. Ram

ırez-Cruz, M. Salinas-V

azquez, W. Vicente-

Rodr

ıguez, and J. M. Cubos-Ram

ırez, “Large-eddy simulation of transcritical

and supercritical jets immersed in a quiescent environment,” Phys. Fluids 31,

025104 (2019).

12

J. Poblador-Ibanez and W. A. Sirignano, “A volume-of-ﬂuid method for

variable-density, two-phase ﬂows at supercritical pressure,” Phys. Fluids 34,

053321 (2022).

13

R. Olmeda, A. Doehring, and C. Stemmer, “Study and application of wall-

roughness models in LES ﬂows,” Int. J. Heat Fluid Flow 95, 108948 (2022).

14

N. Ly, A. Majumdar, and M. Ihme, “Regimes of evaporation and mixing behav-

iors of nanodroplets at transcritical conditions,” Fuel 331, 125870 (2023).

15

D.-Y. Peng and D. B. Robinson, “A new two-constant equation of state,” Ind.

Eng. Chem. Fundam. 15, 59–64 (1976).

16

M. S. Graboski and T. E. Daubert, “A modiﬁed soave equation of state for phase

equilibrium calculations. 1. Hydrocarbon systems,” Ind. Eng. Chem. Process

Des. Dev. 17, 443–448 (1978).

17

G. Soave, “Equilibrium constants from a modiﬁed Redlich-Kwong equation of

state,” Chem. Eng. Sci. 27, 1197–1203 (1972).

18

A. M. Abudour, S. A. Mohammad, R. L. Robinson, Jr., and K. A. Gasem,

“Volume-translated Peng–Robinson equation of state for saturated and single-

phase liquid densities,” Fluid Phase Equilib. 335, 74–87 (2012).

19

J. J. Martin, “Cubic equations of state-which?,” Ind. Eng. Chem. Fundam. 18,

81–97 (1979).

20

K. G. Harstad, R. S. Miller, and J. Bellan, “Efﬁcient high-pressure state equa-

tions,” AIChE J. 43, 1605–1610 (1997).

21

J. Matheis, H. M€

uller, C. Lenz, M. Pﬁtzner, and S. Hickel, “Volume translation

methods for real-gas computational ﬂuid dynamics simulations,” J. Supercrit.

Fluids 107, 422–432 (2016).

22

S.-K. Kim, H.-S. Choi, and Y. Kim, “Thermodynamic modeling based on a gen-

eralized cubic equation of state for kerosene/LOx rocket combustion,”

Combust. Flame 159, 1351–1365 (2012).

23

K. Jung, Y. Kim, and N. Kim, “Real-ﬂuid modeling for turbulent mixing pro-

cesses of n-dodecane spray jet under superciritical pressure,” Int. J. Automot.

Technol. 21, 397–406 (2020).

24

M. L. Michelsen and J. Mollerup, Thermodynamic Modelling: Fundamentals

and Computational Aspects (Tie-Line Publications, 2004).

25

J. Gross and G. Sadowski, “Perturbed-chain SAFT: An equation of state based

on a perturbation theory for chain molecules,” Ind. Eng. Chem. Res. 40,

1244–1260 (2001).

26

C. Rodriguez, P. Koukouvinis, and M. Gavaises, “Simulation of supercritical

diesel jets using the PC-SAFT EoS,” J. Supercrit. Fluids 145, 48–65 (2019).

27

C. Rodriguez, A. Vidal, P. Koukouvinis, M. Gavaises, and M. A. McHugh,

“Simulation of transcritical ﬂuid jets using the PC-SAFT EoS,” J. Comput.

Phys. 374, 444–468 (2018).

28

P. Koukouvinis, A. Vidal-Roncero, C. Rodriguez, M. Gavaises, and L. Pickett,

“High pressure/high temperature multiphase simulations of dodecane injection

to nitrogen: Application on ECN Spray-A,” Fuel 275, 117871 (2020).

29

A. Doehring, T. Kaller, S. J. Schmidt, and N. A. Adams, “Large-eddy simulation

of turbulent channel ﬂow at transcritical states,” Int. J. Heat Fluid Flow 89,

108781 (2021).

30

S. Jafari, H. Gaballa, C. Habchi, J.-C. De Hemptinne, and P. Mougin,

“Exploring the interaction between phase separation and turbulent ﬂuid

dynamics in multi-species supercritical jets using a tabulated real-ﬂuid model,”

J. Supercrit. Fluids 184, 105557 (2022).

Physics of Fluids ARTICLE scitation.org/journal/phf

Phys. Fluids 34, 116126 (2022); doi: 10.1063/5.0122277 34, 116126-8

V

CAuthor(s) 2022

31

P. Koukouvinis, C. Rodriguez, J. Hwang, I. Karathanassis, M. Gavaises, and L.

Pickett, “Machine learning and transcritical sprays: A demonstration study of

their potential in ECN Spray-A,” Int. J. Engine Res. 23, 1556–1572 (2022).

32

N. P. Longmire and D. T. Banuti, “Limits of ﬂuid modeling for high pressure

ﬂow simulations,” Aerospace 9, 643 (2022).

33

T. H. Chung, M. Ajlan, L. L. Lee, and K. E. Starling, “Generalized multiparame-

ter correlation for nonpolar and polar ﬂuid transport properties,” Ind. Eng.

Chem. Res. 27, 671–679 (1988).

34

J. Matheis, “Numerical simulation of fuel injection and turbulent mixing under

high-pressure conditions,” Ph.D. thesis (Technische Universit€

at M€unchen,

2018).

35

B. E. Poling, J. M. Prausnitz, and J. P. O’Connell et al.,The Properties of Gases

and Liquids (McGraw-Hill, New York, 2001), Vol. 5.

36

M. Hopp and J. Gross, “Thermal conductivity of real substances from excess

entropy scaling using PCP-SAFT,” Ind. Eng. Chem. Res. 56, 4527–4538 (2017).

37

O. L€

otgering-Lin and J. Gross, “Group contribution method for viscosities

based on entropy scaling using the perturbed-chain polar statistical associating

ﬂuid theory,” Ind. Eng. Chem. Res. 54, 7942–7952 (2015).

38

I. H. Bell, J. Wronski, S. Quoilin, and V. Lemort, “Pure and pseudo-pure ﬂuid

thermophysical property evaluation and the open-source thermophysical prop-

erty library CoolProp,” Ind. Eng. Chem. Res. 53, 2498–2508 (2014).

39

C. Bell and Contributors, “Thermo: Chemical properties component of chemi-

cal engineering design library (ChEDL),” https://pypi.org/project/thermo/

(2016–2021).

40

J. R. Elliott and C. T. Lira, Introductory Chemical Engineering Thermodynamics

(Prentice Hall, Upper Saddle River, NJ, 2012), Vol. 668.

41

See Penn-State-Colleage, https://www.e-education.psu.edu/png520/m1.html for

“Cubic EOS and Their Behavior” accessed 10 July 2022.

42

E. Goos, A. Burcat, and B. Ruscic, “Third millennium ideal gas and condensed

phase thermochemical database for combustion,” (2009).

43

B. J. McBride, NASA Glenn Coefﬁcients for Calculating Thermodynamic

Properties of Individual Species (National Aeronautics and Space

Administration, John H. Glenn Research Center, 2002).

44

See OpenFOAM-Foundation, https://openfoam.org/version/10/ for “OpenFOAM

Code (Foundation version) version 10” accessed 10 July 2022.

45

See OpenFOAM-ESI, https://www.openfoam.com/news/main-news/openfoam-

v2206 for “OpenFOAM Code (ESI version) version v2206” accessed 10 July

2022.

46

C. Traxinger, J. Zips, M. Banholzer, and M. Pﬁtzner, “A pressure-based solu-

tion framework for sub-and supersonic ﬂows considering real-gas effects and

phase separation under engine-relevant conditions,” Comput. Fluids 202,

104452 (2020).

47

C. Traxinger, J. Zips, and M. Pﬁtzner, “Single-phase instability in non-

premixed ﬂames under liquid rocket engine relevant conditions,” J. Propul.

Power 35, 675–689 (2019).

48

C. Traxinger, “Real-gas effects and single-phase instabilities during injection,

mixing and combustion under high-pressure conditions,” Ph.D. thesis

(Universit€

at der Bundeswehr M€

unchen, 2021).

Physics of Fluids ARTICLE scitation.org/journal/phf

Phys. Fluids 34, 116126 (2022); doi: 10.1063/5.0122277 34, 116126-9

V

CAuthor(s) 2022