IntroductionLegendre transform
Mixtures thermodynamicsFast Legendre Transform
Numerical experimentsConclusion
Pressure laws and fast Legendre transform
Philippe HELLUY1, Hélène MATHIS1
1Université de Strasbourg, IRMA
Philippe HELLUY, Hélène MATHIS Pressure laws and fast Legendre transform
IntroductionLegendre transform
Mixtures thermodynamicsFast Legendre Transform
Numerical experimentsConclusion
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 pressurelaw π = p(τ,e). It has to satisfy some convexity properties in orderthat the Euler system is stable (hyperbolic).General framework for constructing pressure laws of fluid mixtureswith phase transition?
Philippe HELLUY, Hélène MATHIS Pressure laws and fast Legendre transform
IntroductionLegendre transform
Mixtures thermodynamicsFast Legendre Transform
Numerical experimentsConclusion
Outlines
1 Legendre transform
2 Mixtures thermodynamics
3 Fast Legendre Transform
4 Numerical experiments
Philippe HELLUY, Hélène MATHIS Pressure laws and fast Legendre transform
IntroductionLegendre transform
Mixtures thermodynamicsFast Legendre Transform
Numerical experimentsConclusion
Legendre transform
Let f : Rn→ R∪+∞. In the following, we always suppose that1 domf := x , f (x)<+∞ 6= /0;2 f is minorized by an affine function.
The Legendre transform (or conjugate) f ∗ of f is defined by
f ∗(s) = supx
(s · x− f (x)) .
The conjugate f ∗ also satisfies the conditions 1 and 2.
Philippe HELLUY, Hélène MATHIS Pressure laws and fast Legendre transform
IntroductionLegendre transform
Mixtures thermodynamicsFast Legendre Transform
Numerical experimentsConclusion
Graphical interpretation
Philippe HELLUY, Hélène MATHIS Pressure laws and fast Legendre transform
IntroductionLegendre transform
Mixtures thermodynamicsFast Legendre Transform
Numerical experimentsConclusion
Example: Conjugate of a regular convex function
If f : Rn→ R is a C 1 strictly convex function with
f (x)‖x‖
→‖x‖→∞
∞,
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 .
Philippe HELLUY, Hélène MATHIS Pressure laws and fast Legendre transform
IntroductionLegendre transform
Mixtures thermodynamicsFast Legendre Transform
Numerical experimentsConclusion
Example: enthalpy
In thermodynamics, the energy E is a function of the volume Vand the entropy S . The temperature is defined by T = ∂SE andthe pressure by p =−∂V E . The partial Legendre transform of Ewith 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
TdS = dH− vdp.
Philippe HELLUY, Hélène MATHIS Pressure laws and fast Legendre transform
IntroductionLegendre transform
Mixtures thermodynamicsFast Legendre Transform
Numerical experimentsConclusion
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) = supg(x),g affine function, g ≤ f .
(inf i fi )∗ = supi f ∗i . A useful consequence is thatmax(f ∗,g∗) = (comin(f ,g))∗.For two convex functions f and g , we define theinf-convolution operation by
f g(x) = infy(f (y)+g(x− y)) ,
then(f g)∗ = f ∗+g∗.
Philippe HELLUY, Hélène MATHIS Pressure laws and fast Legendre transform
IntroductionLegendre transform
Mixtures thermodynamicsFast Legendre Transform
Numerical experimentsConclusion
Mixtures thermodynamics [Cal85]
We consider two fluids (i), i = 1,2 with volume Vi ≥ 0, massMi ≥ 0 and entropy Si ≥ 0. Each fluid is characterized by its energyfunction
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 ).
Philippe HELLUY, Hélène MATHIS Pressure laws and fast Legendre transform
IntroductionLegendre transform
Mixtures thermodynamicsFast Legendre Transform
Numerical experimentsConclusion
Example: perfect gas
The perfect gas energy is
E = V(
MV
)γ
exp(
SCvM
)where γ > 1 is the polytropic exponent and Cv > 0 is the specificheat at constant volume.
Philippe HELLUY, Hélène MATHIS Pressure laws and fast Legendre transform
IntroductionLegendre transform
Mixtures thermodynamicsFast Legendre Transform
Numerical experimentsConclusion
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 miscibilityof the mixture
Philippe HELLUY, Hélène MATHIS Pressure laws and fast Legendre transform
IntroductionLegendre transform
Mixtures thermodynamicsFast Legendre Transform
Numerical experimentsConclusion
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) = E1E2.
Philippe HELLUY, Hélène MATHIS Pressure laws and fast Legendre transform
IntroductionLegendre transform
Mixtures thermodynamicsFast Legendre Transform
Numerical experimentsConclusion
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 , ·).
Philippe HELLUY, Hélène MATHIS Pressure laws and fast Legendre transform
IntroductionLegendre transform
Mixtures thermodynamicsFast Legendre Transform
Numerical experimentsConclusion
Intensive variables
The function α : W 7→ α(W ) is “intensive” if
∀λ ≥ 0,α(λW ) = α(W ).
We introduce the following intensive quantitiesspecific volume τi =
1ρi= Vi
Mi, density ρi =
MiVi,
specific entropy si = Si/Mi , volumic entropy σi = Si/Vi = ρi si .
Philippe HELLUY, Hélène MATHIS Pressure laws and fast Legendre transform
IntroductionLegendre transform
Mixtures thermodynamicsFast Legendre Transform
Numerical experimentsConclusion
Intensive energies
We also introduce two intensive energy functions defined byspecific 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).
Philippe HELLUY, Hélène MATHIS Pressure laws and fast Legendre transform
IntroductionLegendre transform
Mixtures thermodynamicsFast Legendre Transform
Numerical experimentsConclusion
Non-miscible case
For a non-miscible mixture, the intensive equilibrium energies aregiven by
e = comin(e1,e2)
andε = comin(ε1,ε2).
Philippe HELLUY, Hélène MATHIS Pressure laws and fast Legendre transform
IntroductionLegendre transform
Mixtures thermodynamicsFast Legendre Transform
Numerical experimentsConclusion
Proof
E ∗i (V′,M ′,S ′) = sup
V ,M,S≥0VV ′+MM ′+SS ′−Ei (V ,M,S)
= supV ,ρ,σ≥0
V(V ′+ρM ′+σS ′− εi (ρ,σ)
)= sup
V≥0V (V ′+ ε
∗i (M
′,S ′))
=
0 if ε∗i (M
′,S ′)≤−V ′,+∞ else.
We introduce Ai = (V ′,M ′,S ′),ε∗i (M ′,S ′)≤−V ′ then E ∗i is theconvex indicator of Ai . Then, E ∗ = E ∗1 +E ∗2 is the convex indicatorof A1∩A2 = (V ′,M ′,S ′),max(ε∗1(M
′,S ′),ε∗2(M′,S ′))≤−V ′ we
deduce that ε∗ =max(ε∗1 ,ε∗2) and then ε = comin(ε1,ε2).
Philippe HELLUY, Hélène MATHIS Pressure laws and fast Legendre transform
IntroductionLegendre transform
Mixtures thermodynamicsFast Legendre Transform
Numerical experimentsConclusion
Miscible case
For a miscible mixture, the equilibrium volumic energy is given by
ε = ε1ε2.
The proof is immediate.
Philippe HELLUY, Hélène MATHIS Pressure laws and fast Legendre transform
IntroductionLegendre transform
Mixtures thermodynamicsFast Legendre Transform
Numerical experimentsConclusion
Thermodynamics relations
The temperature T , pressure p and chemical potential µ aredefined by
TdS = dE +pdV −µdM.
Because E is extensive, we also get from the Euler relation
E (W ) = ∇E (W ) ·W ,
orµ = e+pτ−Ts.
Philippe HELLUY, Hélène MATHIS Pressure laws and fast Legendre transform
IntroductionLegendre transform
Mixtures thermodynamicsFast Legendre Transform
Numerical experimentsConclusion
Conjugate of the volumic energy
We also havedε = µdρ +Tdσ ,
which implies that ∂ρε = µ and ∂σ ε = T . The Legendre transformof ε is thus
ε∗ = µρ +Tσ − ε
considered as a function of (µ,T ). From the expression of µ abovewe deduce that the Legendre transform of the volumic energy is thepressure
ε∗(µ,T ) = p(µ,T ).
Philippe HELLUY, Hélène MATHIS Pressure laws and fast Legendre transform
IntroductionLegendre transform
Mixtures thermodynamicsFast Legendre Transform
Numerical experimentsConclusion
Physical interpretation
non-miscible case:
p(µ,T ) =max(p1(µ,T ),p2(µ,T )).
The coexistence of the two phases corresponds top(µ,T ) = p1(µ,T ) = p2(µ,T ) (saturation curve).miscible case:
p(µ,T ) = p1(µ,T )+p2(µ,T ).
The pressure is the sum of the partial pressures (Dalton’s law).
Philippe HELLUY, Hélène MATHIS Pressure laws and fast Legendre transform
IntroductionLegendre transform
Mixtures thermodynamicsFast Legendre Transform
Numerical experimentsConclusion
(max,+) (or idempotent) analysis [Mas87]
classical analysis (max,+) analysis
a ·b ab = a+b
a+b a⊕b = max(a,b) (a⊕a = a)∫Ω f (x)dx ⊕
x∈Ωf (x) = max
x∈Ωf (x)
characters: χ(s,x +y) = χ(s,x) ·χ(s,y) χ(s,x +y) = χ(s,x)χ(s,y)
χ(s,x) = exp(−isx) χ(s,x) = s ·x
Fourier: f (s) =∫
f (x)exp(−isx)dx f ∗(s) =⊕xf (x)χ(s,x) = max
xsx + f (x)
Convolution: (f ∗g)(x) =∫y f (x−y)g(y)dy f g(x) = sup
yf (x−y) +g(y)
(f ∗g)∧ = f · g (f g)∗ = f g (f ,g concave usc)
Philippe HELLUY, Hélène MATHIS Pressure laws and fast Legendre transform
IntroductionLegendre transform
Mixtures thermodynamicsFast Legendre Transform
Numerical experimentsConclusion
Mixtures and (max,+) analysis [Mas87]
non-miscible mixture:
ε∗ =max(ε∗1 ,ε
∗2) = ε
∗1 ⊕ ε
∗2 .
miscible mixture:
ε∗ = ε
∗1 + ε
∗2 = ε
∗1 ε
∗2 .
Philippe HELLUY, Hélène MATHIS Pressure laws and fast Legendre transform
IntroductionLegendre transform
Mixtures thermodynamicsFast Legendre Transform
Numerical experimentsConclusion
Discrete conjugate: 1D case
Let f : [a,b]→ R. We extend f by +∞ outside [a,b]. We considera 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.
The naive algorithm to compute f ∗(s) for N ′ values of s wouldhave a O(NN ′) complexity.
Philippe HELLUY, Hélène MATHIS Pressure laws and fast Legendre transform
IntroductionLegendre transform
Mixtures thermodynamicsFast Legendre Transform
Numerical experimentsConclusion
Fast algorithm [Luc97]
We know that f ∗ = (cof )∗, thus we first compute the convex hullof f , which is still piecewise linear on [a,b]. 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 < s0xi s− 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 such afunction is very similar.
Philippe HELLUY, Hélène MATHIS Pressure laws and fast Legendre transform
IntroductionLegendre transform
Mixtures thermodynamicsFast Legendre Transform
Numerical experimentsConclusion
2D version
Let f : [a,b]× [c ,d ]→ R. We extend f by +∞ (or by linear maps)outside [a,b]× [c ,d ]. We “apply Fubini”
f ∗(s, t) = supx ,y
(sx + ty − f (x ,y)) = supy(ty + sup
x(sx− f (x ,y)))
= supy(ty + f ∗,x(s,y))
= (−f ∗,x)∗,y .
In practice, we apply the 1D algorithm on all the rows and then allthe columns of the samples. For this, we need to sample f ∗(s,y) atthe same points in s for each y .
Philippe HELLUY, Hélène MATHIS Pressure laws and fast Legendre transform
IntroductionLegendre transform
Mixtures thermodynamicsFast Legendre Transform
Numerical experimentsConclusion
Maxwell equal area rule
We consider a van der Waals gas with dimensionless specific energy
e(τ,s) =es
(3τ−1)8/3− 3
τif τ > 1/3,s > 0,
=+∞ else.
The critical point corresponds to Tc = 1, pc = 1 and τc = 1. Thisenergy is not convex. Therefore we replace it by e∗∗ = coe. This isequivalent to the well known Maxwell equal area rule construction.
Philippe HELLUY, Hélène MATHIS Pressure laws and fast Legendre transform
IntroductionLegendre transform
Mixtures thermodynamicsFast Legendre Transform
Numerical experimentsConclusion
Numerical illustration
It is classical to plot the isotherms in the (p,τ) plane.This is very easy practically with the FLT.First we compute f (τ,T ) := e∗,s(τ,T ) = Ts− e(τ,s), withT = ∂se.Then we fix T and plot p = ∂τ f for a varying τ .
Philippe HELLUY, Hélène MATHIS Pressure laws and fast Legendre transform
IntroductionLegendre transform
Mixtures thermodynamicsFast Legendre Transform
Numerical experimentsConclusion
Isotherms of e
Philippe HELLUY, Hélène MATHIS Pressure laws and fast Legendre transform
IntroductionLegendre transform
Mixtures thermodynamicsFast Legendre Transform
Numerical experimentsConclusion
Isotherms of e∗∗
Philippe HELLUY, Hélène MATHIS Pressure laws and fast Legendre transform
IntroductionLegendre transform
Mixtures thermodynamicsFast Legendre Transform
Numerical experimentsConclusion
Maxwell equal area rule
Philippe HELLUY, Hélène MATHIS Pressure laws and fast Legendre transform
IntroductionLegendre transform
Mixtures thermodynamicsFast Legendre Transform
Numerical experimentsConclusion
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) andp(τ,s).The saturation curve is simply
p = κT
(κ = κ(γ1,γ2) has a complicated expression).
Philippe HELLUY, Hélène MATHIS Pressure laws and fast Legendre transform
IntroductionLegendre transform
Mixtures thermodynamicsFast Legendre Transform
Numerical experimentsConclusion
Saturation curves
Philippe HELLUY, Hélène MATHIS Pressure laws and fast Legendre transform
IntroductionLegendre transform
Mixtures thermodynamicsFast Legendre Transform
Numerical experimentsConclusion
Numerical saturation zone
We simply set e =min(e1,e2) and plot e− e∗∗ in the plane (s,τ).
Philippe HELLUY, Hélène MATHIS Pressure laws and fast Legendre transform
IntroductionLegendre transform
Mixtures thermodynamicsFast Legendre Transform
Numerical experimentsConclusion
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
Philippe HELLUY, Hélène MATHIS Pressure laws and fast Legendre transform
IntroductionLegendre transform
Mixtures thermodynamicsFast Legendre Transform
Numerical experimentsConclusion
A simple miscible mixture
We 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
Philippe HELLUY, Hélène MATHIS Pressure laws and fast Legendre transform
IntroductionLegendre transform
Mixtures thermodynamicsFast Legendre Transform
Numerical experimentsConclusion
Mass fraction
But the mass fraction of the gas (1) depends on the pressure andthe temperature.
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
Philippe HELLUY, Hélène MATHIS Pressure laws and fast Legendre transform
IntroductionLegendre transform
Mixtures thermodynamicsFast Legendre Transform
Numerical experimentsConclusion
Conclusion
we have found a natural mathematical framework for studyingEOS of mixtures;the FLT is a useful numerical tool for practically computetabulated 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.
Philippe HELLUY, Hélène MATHIS Pressure laws and fast Legendre transform
IntroductionLegendre transform
Mixtures thermodynamicsFast Legendre Transform
Numerical experimentsConclusion
H. B. Callen. Thermodynamics and an introduction tothermostatistics, second edition. Wiley and Sons, 1985.
P. Helluy, H. Mathis. Pressure laws and fast Legendretransform. http://hal.archives-ouvertes.fr/hal-00424061/fr/
J.-B. Hiriart-Urruty and C. Lemaréchal. Fundamentals ofconvex analysis. Grundlehren Text Editions. Springer-Verlag,Berlin, 2001.
Y. Lucet. Faster than the fast Legendre transform, thelinear-time Legendre transform. Numer. Algorithms 16 (1997),no. 2, 171–185 (1998).
V. Maslov. Méthodes opératorielles. Éditions Mir, Moscou,1987.
Philippe HELLUY, Hélène MATHIS Pressure laws and fast Legendre transform
Top Related