Post on 07-Sep-2020
Pressure laws and fast Legendre transform
Philippe HELLUY, Hélène MATHIS
Université de Strasbourg
Strasbourg, 2010 April
Hélène MATHIS (Université de Strasbourg) Pressure laws and fast Legendre transform April 14, 2010 1 / 34
Motivations
Euler equations for a compressible fluid
∂tρ +∂x(ρu) = 0,
∂t(ρu)+∂x(ρu2 +π) = 0,
∂t(ρQ)+∂x((ρQ+π)u) = 0.
The pressure is related to e = Q−u2/2 and τ = 1/ρ by a pressure lawπ = p(τ,e).It has to satisfy some convexity properties in order that the Eulersystem is stable (hyperbolic).
General framework for constructing pressure laws of fluid mixtures withphase transition?
Hélène MATHIS (Université de Strasbourg) Pressure laws and fast Legendre transform April 14, 2010 1 / 34
Outlines
1 Legendre transform
2 Mixtures thermodynamics
3 Fast Legendre Transform
4 Numerical experiments
Hélène MATHIS (Université de Strasbourg) Pressure laws and fast Legendre transform April 14, 2010 2 / 34
Outlines
1 Legendre transform
2 Mixtures thermodynamics
3 Fast Legendre Transform
4 Numerical experiments
Hélène MATHIS (Université de Strasbourg) Pressure laws and fast Legendre transform April 14, 2010 3 / 34
Legendre transform
Let f : Rn → R∪{+∞}.In the following, we always suppose that
1 dom f := {x, f (x) < +∞} 6= /0;2 f is minorized by an affine function.
The conjugate f ∗ of f is defined by
f ∗(s) = supx
(s · x− f (x)) , (1)
and the transformation f 7→ f ∗ is called the Legendre transform.
The conjugate f ∗ also satisfies the conditions 1 and 2.
Hélène MATHIS (Université de Strasbourg) Pressure laws and fast Legendre transform April 14, 2010 4 / 34
Graphical interpretation
Hélène MATHIS (Université de Strasbourg) Pressure laws and fast Legendre transform April 14, 2010 5 / 34
Example: Conjugate of a regular convex function
If f : Rn → R is C2 strictly convex and
f (x)‖x‖
→‖x‖→∞
∞, (2)
thenf ∗(s) = sx− f (x), with ∇ f (x) = s.
We deduce that∇ f ∗(s) = x ⇔ ∇ f (x) = s.
It is then easy to check that in this case the Legendre transform isinvolutive
f ∗∗ = f .
Hélène MATHIS (Université de Strasbourg) Pressure laws and fast Legendre transform April 14, 2010 6 / 34
Example: enthalpyIn thermodynamics, the energy E is a function of the volume V and theentropy S.The temperature and the pressure are defined by
T = ∂SE p =−∂V E
Thermodynamics first principle: T dS = dE + pdV .The partial Legendre transform of E with respect to V is formally
E∗,V = V ′V −E, with V ′ = ∂V E =−p.
ThusE∗,V =−(E + pV ) =−H
is the opposite of the enthalpy (expressed as a function of (−p,S)).And we have the relation
T dS = dH−V d p.
Hélène MATHIS (Université de Strasbourg) Pressure laws and fast Legendre transform April 14, 2010 7 / 34
Main properties [HL01]
• f ∗ is convex and lower semi-continuous (lsc).• f ∗∗ = co( f ) is the lsc convex enveloppe (or convex hull) of f
∀x ∈ Rn, co( f )(x) = sup{g(x),g affine function, g ≤ f}.
• The Legendre transform satisfies : max( f ∗,g∗) = (comin( f ,g))∗.• For two convex functions f and g, we define the inf-convolution
operation byf �g(x) = inf
y( f (y)+g(x− y)) , (3)
then( f �g)∗ = f ∗+g∗.
Hélène MATHIS (Université de Strasbourg) Pressure laws and fast Legendre transform April 14, 2010 8 / 34
Outlines
1 Legendre transform
2 Mixtures thermodynamics
3 Fast Legendre Transform
4 Numerical experiments
Hélène MATHIS (Université de Strasbourg) Pressure laws and fast Legendre transform April 14, 2010 9 / 34
Mixtures thermodynamics [Cal85]
We consider two fluids (i), i = 1,2 with volume Vi ≥ 0, mass Mi ≥ 0 andentropy Si ≥ 0. Each fluid is characterized by its energy function
Ei : (Vi,Mi,Si) 7→ Ei(Vi,Mi,Si).
We extend Ei by +∞ outside C = (R+)3. We suppose that Ei is convex,lsc and “extensive”, i.e.
∀λ ≥ 0,∀W ∈ R3,Ei(λW ) = λEi(W ).
Hélène MATHIS (Université de Strasbourg) Pressure laws and fast Legendre transform April 14, 2010 10 / 34
Example: perfect gas
The perfect gas energy is
E = V(
MV
)γ
exp(
SCvM
)(4)
where γ > 1 is the polytropic exponent and Cv > 0 is the specific heat atconstant volume.
Hélène MATHIS (Université de Strasbourg) Pressure laws and fast Legendre transform April 14, 2010 11 / 34
Mixture equilibrium
The mixture energy is
E(W1,W2) = E1(W1)+E2(W2).
At equilibrium the mixture achieves a minimum of the energy.The mixture volume, mass and entropy are noted respectively V , Mand S. We also note W = (M,V,S).Because of mass conservation,
M = M1 +M2.
The entropy being an additive variable,
S = S1 +S2.
For the volume, two cases are possible depending on the miscibility ofthe mixture
Hélène MATHIS (Université de Strasbourg) Pressure laws and fast Legendre transform April 14, 2010 12 / 34
Non-miscible case
We setV = V1 +V2,
thusW = W1 +W2.
The mixture equilibrium energy is then given by an inf-convolutionoperation
E(W ) = minW1∈R3
E1(W1)+E2(W −W1) = E1�E2.
Hélène MATHIS (Université de Strasbourg) Pressure laws and fast Legendre transform April 14, 2010 13 / 34
Miscible case
We haveV = V1 = V2,
andZi = (Mi,Si), Z = (M,S) = Z1 +Z2.
The mixture equilibrium energy is also given by an inf-convolutionoperation
E(V,Z) = minZ1∈R2
E1(V,Z1)+E2(V,Z−Z1),
E(V, ·) = E1(V, ·)�E2(V, ·).
Hélène MATHIS (Université de Strasbourg) Pressure laws and fast Legendre transform April 14, 2010 14 / 34
Intensive variables
The function α : W 7→ α(W ) is “intensive” if
∀λ ≥ 0,α(λW ) = α(W ).
We introduce the following intensive quantities• specific volume τi = 1
ρi= Vi
Mi, density ρi = Mi
Vi,
• specific entropy si = Si/Mi, volumic entropy σi = Si/Vi = ρisi.
Hélène MATHIS (Université de Strasbourg) Pressure laws and fast Legendre transform April 14, 2010 15 / 34
Intensive energies
We also introduce two intensive energy functions defined by• specific energy
ei(τi,si) =1
MiEi(Vi,Mi,Si) = Ei(
Vi
Mi,1,
Si
Mi) = Ei(τi,1,si),
• volumic energy
εi(ρi,σi) =1Vi
Ei(Vi,Mi,Si) = Ei(1,Mi
Vi,
Si
Vi) = Ei(1,ρi,σi).
The intensive energy functions are convex lsc and
εi(ρi,σi) = ρiei(1ρi
,σi
ρi).
Hélène MATHIS (Université de Strasbourg) Pressure laws and fast Legendre transform April 14, 2010 16 / 34
Non-miscible case
For a non-miscible mixture, the intensive equilibrium energies aregiven by
e = comin(e1,e2)
andε = comin(ε1,ε2).
Hélène MATHIS (Université de Strasbourg) Pressure laws and fast Legendre transform April 14, 2010 17 / 34
Miscible case
For a miscible mixture, the equilibrium volumic energy is given by
ε = ε1�ε2.
Hélène MATHIS (Université de Strasbourg) Pressure laws and fast Legendre transform April 14, 2010 18 / 34
Conjugate of the volumic energy
We also havedε = µdρ +T dσ ,
which implies that ∂ρε = µ and ∂σ ε = T . The Legendre transform of ε
is thusε∗ = µρ +T σ − ε (5)
considered as a function of (µ,T ). From the expression of µ above wededuce that the Legendre transform of the volumic energy is thepressure
ε∗(µ,T ) = p(µ,T ).
Hélène MATHIS (Université de Strasbourg) Pressure laws and fast Legendre transform April 14, 2010 19 / 34
Physical interpretation
• non-miscible case:
ε∗ = (comin(ε1,ε2))∗ = max(ε∗1 ,ε∗2 ),
p(µ,T ) = max(p1(µ,T ), p2(µ,T )).
The coexistence of the two phases corresponds top(µ,T ) = p1(µ,T ) = p2(µ,T ) (saturation curve).
• miscible case:
ε∗ = (ε1�ε2)∗ = ε
∗1 + ε
∗2 ,
p(µ,T ) = p1(µ,T )+ p2(µ,T ).
The pressure is the sum of the partial pressures (Dalton’s law).
→ (max,+) analysis [Mas87]
Hélène MATHIS (Université de Strasbourg) Pressure laws and fast Legendre transform April 14, 2010 20 / 34
Outlines
1 Legendre transform
2 Mixtures thermodynamics
3 Fast Legendre Transform
4 Numerical experiments
Hélène MATHIS (Université de Strasbourg) Pressure laws and fast Legendre transform April 14, 2010 21 / 34
Discrete conjugate: 1D case
Let f : [a,b]→ R. We extend f by +∞ outside [a,b].We consider a subdivision of [a,b] with N +1 points
a = x0 < x1 < · · ·< xN = b.
We suppose that f is piecewise linear
f (xi) = yi
f (x) = yi + si(x− xi), x ∈ [xi,xi+1], i = 0 · · ·N−1. (6)
Hélène MATHIS (Université de Strasbourg) Pressure laws and fast Legendre transform April 14, 2010 22 / 34
Fast algorithm [Luc97]
We know that f ∗ = (co f )∗, thus we first compute the convex hull of f ,which is still piecewise linear on [a,b] (and continuous). Without loss ofgenerality, we can thus suppose that the sequence of slopes(si)i=0···N−1 is strictly increasing. Then
f ∗(s) =
as− f (a) if s < s0xis− f (xi) if si−1 < s < si, i = 1 · · ·N−1bs− f (b) if s > sN−1
The global algorithm to compute N′ values of f ∗ has a O(N +N′)complexity.We observe that f ∗ is linear outside [s0,sN−1].The algorithm to compute the Legendre transform of a functionextended by affine maps is very similar.
Hélène MATHIS (Université de Strasbourg) Pressure laws and fast Legendre transform April 14, 2010 23 / 34
2D version
Let f : [a,b]× [c,d]→R. We extend f by +∞ (or by linear maps) outside[a,b]× [c,d].
f ∗(s, t) = supx,y
(sx+ ty− f (x,y)) = supy
(ty+ supx
(sx− f (x,y))
= supy
(ty+ f ∗,x(s,y))
= (− f ∗,x)∗,y . (7)
In practice, we apply the 1D algorithm on all the rows and then all thecolumns of the samples.
Hélène MATHIS (Université de Strasbourg) Pressure laws and fast Legendre transform April 14, 2010 24 / 34
Outlines
1 Legendre transform
2 Mixtures thermodynamics
3 Fast Legendre Transform
4 Numerical experiments
Hélène MATHIS (Université de Strasbourg) Pressure laws and fast Legendre transform April 14, 2010 25 / 34
Maxwell equal area ruleWe consider a van der Waals gas with dimensionless specific energy
e(τ,s) =
{es
(3τ−1)8/3 − 3τ
if τ > 1/3,s > 0,
+∞ elsewhere.
This energy is not convex.Therefore we replace it by
e∗∗ = coe.
⇔ Maxwell equal area ruleconstruction.
Hélène MATHIS (Université de Strasbourg) Pressure laws and fast Legendre transform April 14, 2010 26 / 34
Numerical illustration
It is classical to plot the isotherms in the (p,τ) plane.In practice, it is very easy using the FLT.First we compute
f (τ,T ) := e∗,s(τ,T ) = T s− e(τ,s),
with T = ∂se.Then we fix T and plot p = ∂τ f for a varying τ.
Hélène MATHIS (Université de Strasbourg) Pressure laws and fast Legendre transform April 14, 2010 27 / 34
Isotherms of e
5e+06
1e+07
1.5e+07
2e+07
2.5e+07
3e+07
3.5e+07
4e+07
4.5e+07
5e+07
5e-05 0.0001 0.00015 0.0002 0.00025 0.0003
Pre
ssur
e
Specific volume
Isotherms
Hélène MATHIS (Université de Strasbourg) Pressure laws and fast Legendre transform April 14, 2010 28 / 34
Isotherms of e∗∗
Hélène MATHIS (Université de Strasbourg) Pressure laws and fast Legendre transform April 14, 2010 29 / 34
A simple non-miscible mixture
We consider a mixture of two perfect gases (γ1 > γ2)
ei(τi,si) = exp(si)τ1−γii
It is possible to compute analytically e(τ,s) = comin(e1,e2) and p(τ,s)[1].
The saturation curve is simply
p = κT
(κ = κ(γ1,γ2) has a complicatedexpression).
Hélène MATHIS (Université de Strasbourg) Pressure laws and fast Legendre transform April 14, 2010 30 / 34
IsothermsWe simply set e = min(e1,e2) and the isotherms.
7.5
8
8.5
9
9.5
10
10.5
11
11.5
0.8 0.85 0.9 0.95 1 1.05 1.1 1.15 1.2
Pre
ssur
e
Specific volume
Isotherms
Hélène MATHIS (Université de Strasbourg) Pressure laws and fast Legendre transform April 14, 2010 31 / 34
A simple miscible mixtureWe take the same perfect gases and now construct the misciblemixture
ε = ε1�ε2
The isotherms are very similar to those of a perfect gas
2
4
6
8
10
12
0.2 0.4 0.6 0.8 1 1.2 1.4
Pre
ssur
e
Specific volume
Isotherms
T = 6.47 T = 6.95 T = 7.43
Hélène MATHIS (Université de Strasbourg) Pressure laws and fast Legendre transform April 14, 2010 32 / 34
Mass fractionThe mass fraction ϕ of the gas (1) reads :
ϕ =
∂ p∂ µ
(µ,T )
∂ p1
∂ µ(µ,T )
.
0.35
0.4
0.45
0.5
0.55
0.6
0.65
0.7
2 4 6 8 10 12
Phi
Pressure
Mass fraction
T = 6.47 T = 6.95 T = 7.43
Hélène MATHIS (Université de Strasbourg) Pressure laws and fast Legendre transform April 14, 2010 33 / 34
Conclusion
• We have found a natural mathematical framework for studyingEOS of mixtures.
• The FLT is a useful numerical tool for practically computetabularized EOS of mixtures.
Next steps:• real EOS for more than two fluids,• coupling with CFD computations,• use the ideas of idempotent analysis for more general mixtures.
Hélène MATHIS (Université de Strasbourg) Pressure laws and fast Legendre transform April 14, 2010 34 / 34
H. B. Callen. Thermodynamics and an introduction tothermostatistics, second edition. Wiley and Sons, 1985.
P. Helluy, H. Mathis. Pressure laws and fast Legendre transform.http://hal.archives-ouvertes.fr/hal-00424061/fr/
J.-B. Hiriart-Urruty and C. Lemaréchal. Fundamentals of convexanalysis. Grundlehren Text Editions. Springer-Verlag, Berlin, 2001.
JAOUEN, S., Etude mathématique et numérique de stabilité pourdes modèles hydrodynamiques avec transition de phase, PhDThesis, 2001.
Y. Lucet. Faster than the fast Legendre transform, the linear-timeLegendre transform. Numer. Algorithms 16 (1997), no. 2, 171–185(1998).
V. Maslov. Méthodes opératorielles. Éditions Mir, Moscou, 1987.
Hélène MATHIS (Université de Strasbourg) Pressure laws and fast Legendre transform April 14, 2010 34 / 34
Appendix
Hélène MATHIS (Université de Strasbourg) Pressure laws and fast Legendre transform April 14, 2010 34 / 34
Proof
E∗i (V ′,M′,S′) = supV,M,S≥0VV ′+MM′+SS′−Ei(V,M,S) (8)
= supV,ρ,σ≥0V (V ′+ρM′+σS′− εi(ρ,σ)) (9)= supV≥0V (V ′+ ε∗i (M′,S′)) (10)
={
0 if ε∗i (M′,S′)≤−V ′,+∞ else.
(11)
We introduce Ai = {(V ′,M′,S′),ε∗i (M′,S′)≤−V ′}.Then E∗
i is the convex indicator of Ai.Then, E∗ = E∗
1 +E∗2 is the convex indicator of
A1∩A2 = {(V ′,M′,S′),max(ε∗1 (M′,S′),ε∗2 (M′,S′)
)≤−V ′}
We deduce that ε∗ = max(ε∗1 ,ε∗2 ) and then ε = comin(ε1,ε2).�
Hélène MATHIS (Université de Strasbourg) Pressure laws and fast Legendre transform April 14, 2010 34 / 34