Prateek CompGasdyn
Prateek CompGasdyn
di erent from incompressible uid dynamics because of extreme compressibility e ects such as shocks & rarefactions
1
ff
fl
ff
2
• equations have been studied for centuries by physicists, engineers & mathematicians;
over past decades computers have allowed numerical experiments
• limited analytic solutions: linear analysis (waves & instabilities), nonlinear solutions
(e.g., Bondi accretion, Sedov-Taylor blast wave); very basic phenomenological
understanding of turbulence (Kolmogorov model)
same at t+dt
Dρ
= − ρ( ∇ ⋅ u) mass velocity eld u
Dt
Lagrangian/material/total derivative
mass density bulk/ uid velocity in nitesimal uid element at t
D f(x + uδt, t + δt) − f(x, t)
f(x, t) = lim
Dt δt→0 δt
Du ∇p = lim
f(x + uδt, t + δt) − f(x, t + δt) + f(x, t + δt) − f(x, t)
=− +g δt→0 δt
Dt ρ Newton’s laws of motion applied to a uid element ∂f
= + (u ⋅ ∇)f
surface force body force ∂t
Eulerian/partial derivative
De p
Dt ( ρ γ )
= − ( ∇ ⋅ u) 1st law of thermodynamics without heating/cooling, D p
= 0
Dt ρ reduces to adiabatic EoS in absence of shocks
pdV work Smooth Particle Hydrodynamics (SPH) approach uses Lagrangian form
internal energy density
cosmological galaxy formation codes: Gadget, Gasoline,…
Kernel with contribution of nearby `particles’ to calculate RHS
fi
fl
fi
fl
fl
4
independent variables: t, x
dependent variables: ρ, u, p, e meshes can be complex for complicated domains
boundary condition
boundary condition
& to resolve regions with interesting physics (boundary layers)
5 equations, 6 unknowns!
t
x x x x x xx x x x
algebraic equation of state/constitutive relation, e.g., ideal gas law: p = (γ − 1)e x x x x x xx x x
x x x x x xx x x
x
x
x x x x x xx x x x
x x x x x xx x x x
Cp/Cv=5/3 for ideal monoatomic gas x x x x x xx x x x
x x x x x xx x x x
ideal gas a good approx if distance between particles >> their size, ne for astrophysical gases/plasmas initial condition
x
in addition to governing equations, need initial (init.c) & boundary (boundary.c) conditions need to discretise space & time
solve PDEs on a grid/mesh at discrete times
ff
fi
5
Conservative form
Eulerian form of Euler eqs control volume
mass
∂ρ
+ ∇ ⋅ (ρu) = 0
∂t source terms on RHS ux leaving through surface
momentum
∂
di erential form
∂
(ρu) + ∇ ⋅ (ρuu + pI) = ρg ∂t
U+∇⋅F=0
∂t Integral form
external body force
total energy = kinetic + thermal d
dt ∫ ∮
UdV + F ⋅ dS = 0
∂t ( 2 ) [ 2 γ − 1]
2
∂ 1 2 ρu γp
ρu + e + ∇ ⋅ + u = ρu ⋅ g
rate of change of conserved quantity
=
power injected by external force integral of ux over all enclosing surfaces
integral/weak form more fundamental
Eulerian ( nite di erence/volume/element) approach used in Zeus, Enzo, Athena, Pluto, Ramses, Arepo applies even at discontinuities
fl
ff
fi
fl
ff
6
Navier-Stokes equation
∂u ∇p 2
+ (u ⋅ ∇)u = − + ν∇ u equation of motion with viscosity
∂t ρ
∇ ⋅ u = 0, ρ = ρ0 incompressible, constant density
2
− ∇ p = ρ0( ∇u : ∇u) = ρ0∂iuj∂jui Poisson eq. for pressure
not an evolution eq
quite di erent from inviscid Euler equations; applicable in ℳ⟶0 (in nite sound speed) limit
viscosity crucial in and around shear/boundary layers (Newtonian viscosity)
lot of classical uid dynamics is based on these equations
u0L
∂u 1 2 Re = ≫1
+ (u ⋅ ∇)u = − ∇p + ∇ u dimensionless form ν
∂t Re Reynolds number for astrophysical systems
ff
fl
fi
7
Euler vs Navier-Stokes
Euler Navier-Stokes
∂ρ ∂u ∇p 2
+ ∇ ⋅ (ρu) = 0 + (u ⋅ ∇)u = − + ν∇ u
∂t ∂t ρ0
3 evolution equations; Euler reduces to these in subsonic limit
∂
∂t
(ρu) + ∇ ⋅ (ρuu + pI) = 0
∇⋅u=0
∂t ( 2 γ − 1) [ 2 γ − 1]
2
∂ 1 2 p ρu γp one constraint equation
ρu + +∇⋅ + u =0
2
∇ p = − ρ0( ∇u : ∇u)
γ − 1 ( ργ )
Ds kB p
≥ 0; s = ln speci c entropy
Dt Poisson eq. for pressure (elliptic equation, global solution,
pressure at any point determined by velocity at all points)
5 evolution equations based on conservation of mass, momentum, energy
u⋅u p
E=ρ +
2 γ−1
[ x y z]
∂ ∂ ∂
ff
fl
9
Isothermal γ=1
linear advection (one-way wave) eq. building block of sophisticated schemes to solve hyperbolic eqs.
0
trivial solution u(x, t) = u(x − at,0) = u (x − at)
10
Hyperbolic equations
classi cation of PDEs: hyperbolic; parabolic; elliptic
2 2
∂ψ 2 ∂ ψ
hyperbolic: describes wave propagation at nite speed = c
∂t 2 ∂x 2
2
∂ψ ∂ψ
parabolic: di usive transport; e.g., conduction, viscosity =D 2
∂t ∂x
2 2 2
∂ψ ∂ψ ∂ψ
elliptic: global solution (spooky action at a distance); e.g., Laplace/Poisson eq. + + = 0
∂x 2 ∂y 2 ∂z 2
since the nature of solutions is very di erent, numerical solution techniques also di er
fi
ff
ff
fi
ff
11
Characteristic curves
∂u ∂u
+ a(u, x, t) =0 a 1D scalar hyperbolic equation in primitive/characteristic form
∂t ∂x
u4
dx u3
= a(u(x, t), x, t) a characteristic curve in x-t space along which u = constant
dt t u2
[ ∂x ∂t ]
T u1
∂u ∂u ∂u ∂u
δu = δt + δx = [δx, δt] , =0 u = constant along δx/δt = a
∂t ∂x
x
How do we solve the PDE using characteristics? Map every point (x,t) to initial/boundary condition by solving x(t) for characteristics
Not so fast, Watson!
initial/boundary should neither be under or over speci ed for problem to be well posed t
Advection equation
0
solution: u(x, t) = u(x − at,0) = u (x − at)
u0(x) 0 0
∂u du ∂ξ du
initial condition
= =−a with ξ = x − at
∂t dξ ∂t dξ
at
0 0
∂u du ∂ξ du
x = =
∂x dξ ∂x dξ
u0(x)
after time t satis es advection equation for any initial condition u0
initial pro le moves useful model problem for hyperbolic equations, since analytic solution
to right by at
x
t a>0
characteristic curves
of linear advection eq characteristics similar to contact waves in Euler equations
are parallel everywhere
with slope dx/dt=a
x
fi
fi
13
Burgers example
multiple values at a location not allowed, viscosity must intervene & a shock must form!
[ ∂t ∂x ]
∂t ∂x ∂u ∂
∬
Δt
dxdt + f(u) = 0 t uL
Δx
∂u ∂u
+ a(u) =0
∂t ∂x
Δx(uL − uR) + Δt[ f(uR) − f(uL)] = 0
x
df
a(u) = characteristic speed
Δx fR − fL shock speed for u >u
du S= = L R
dx df
S= = = a(u) characteristic speed for continuous u
dt du
fi
15
u(x,0) =
Burgers eq
0 for x ≤ 0
1 for x > 0 Rarefactions
shocks (entropy increases as uid elements cross shocks),
rarefactions (entropy preserved along uid paths)
shock
extremely important for nonlinear hyperbolic eqs
rarefaction
u(x, t) = 0 for x ≤ 0
rarefaction fan x/t for 0 < x ≤ t
1 for x > t satis es the PDE & far-left & far-right conditions
fi
fl
fl
16
[ ∂t ∂x ]
tn+1
∂u ∂
∬
Δt
dxdt + f(u) = 0
tn
Δx
n+1
xi+1/2 t
∫x ∫tn
xi-1/2 xi xi+1/2 x
n+1 n
dx(ui − ui ) + dt( fi+1/2 − fi−1/2) = 0
i−1/2
volume average u only changes because of boundary uxes
xi+1/2 t n+1
1 1
Δx ∫xi−1/2 Δt ∫tn
‘volume’ avg u U n ≡ n
dx u(x, t ) time avg ux F Fi−1/2 ≡
n+1/2
dt f(x , t) Δt
( R )
i i−1/2 Uin+1 Uin n+1/2 n+1/2
∑ ∑
= − F − FL
i i
Δx
Δt
Δx ( )
Uin+1 = Uin − F n+1/2
i+1/2 − F n+1/2
i−1/2
exact nite volume evolution equation; summing over all cells in domain
since we do not know the solution we need to approximate time-averaged uxes at interfaces
Godunov method: assuming piecewise constant u in cells, solve the Riemann problem at the interface
this gives ui-1/2(t) & we can calculate Fi-1/2(ui-1/2[t]) and hence an approximate Fn+1/2i-1/2
aim: more accurate approximations Fn+1/2i-1/2 (using higher order reconstruction w limiters) which are also non-oscillatory
fi
fl
fl
fl
17
primitive to conservative transformation vice-versa for Euler eqs. HW: derive this!
similarity transform
from conservative to primitive variables
eigenvalues u, u±cs HW: derive this!
18
can be converted to diagonal form via a similarity transform; diagonal elements real for hyperbolic eqs
AQ = Qλ rows are left eigenvectors of A
−1
columns of Q are right eigenvectors of A 1 0
a2
−1
Q −1 = 0 1 ρa
1
0 1 ρa
transformation to characteristic variables
not analytically integrable, in general
2a
u+
γ−1
Riemann invariants, can be integrated if s = const
2a
u−
γ−1
20
Riemann Problem
can’t solve Euler eqs with general ICs (Riemann invariants non-integrable) but a speci c initial condition can be solved
CD 2-wave
rarefaction 1-wave shock 3-wave
RP: a speci c initial condition with constant dependent variables on either side of a jump
solution is simpler, a similarity solution x ∂f(u)
u(x, t) = u(x/t) ⟹ du = ⋅ du
t
jump evolves into N nonlinear waves that propagate independently as simple waves
ρ(x,0)
References
• The Physics of Fluids & Plasmas, Arnab Rai Choudhuri (basic big picture)
• Stone & Norman Zeus hydro paper, 1992, ApJS, 80, 753 ( nite di erence
for hydro; arti cial viscosity; unwinding of advection term)