0% found this document useful (0 votes)
22 views21 pages

Prateek CompGasdyn

The document discusses computational gas dynamics, focusing on the Euler and Navier-Stokes equations that describe fluid dynamics in astrophysical systems. It highlights the need for numerical solutions to understand complex phenomena such as turbulence and shock waves, which are critical in astrophysics. Additionally, it covers various mathematical formulations and methods used to solve these equations, including the characteristics and weak solutions relevant to hyperbolic equations.

Uploaded by

morgan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views21 pages

Prateek CompGasdyn

The document discusses computational gas dynamics, focusing on the Euler and Navier-Stokes equations that describe fluid dynamics in astrophysical systems. It highlights the need for numerical solutions to understand complex phenomena such as turbulence and shock waves, which are critical in astrophysics. Additionally, it covers various mathematical formulations and methods used to solve these equations, including the characteristics and weak solutions relevant to hyperbolic equations.

Uploaded by

morgan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

Computational Gasdynamics

Prateek Sharma, IISc

di erent from incompressible uid dynamics because of extreme compressibility e ects such as shocks & rarefactions

1
ff
fl
ff
2

What & why?


• Euler/Navier-Stokes/MHD equations with additional terms describe astrophysical
systems ranging from accretion onto compact objects to the evolution of Universe as
a whole

• 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)

• need to numerically solve these equations in extreme nonlinear regime to understand


astrophysical objects qualitatively (accretion physics) & quantitatively (e.g., space
weather prediction)
3

Euler Equations PDEs


independent variables: t, x
dependent variables: ρ, u, p
Euler equations in Lagrangian form subtler than ODEs like Newton’s laws of motion

same at t+dt

= − ρ( ∇ ⋅ 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

Solving Euler Equations


Euler equations can also be derived from Boltzmann eq in the high collisionality limit: Lattice-Boltzmann methods

partial di erential equations (PDEs)

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

while we do not include viscosity explicitly, it is assumed implicitly,


for periodic BCs, (pseudo)spectral (Fourier) methods most popular
must for dissipative structures like shocks & turbulence
2nd law of thermodynamics: entropy must be non-decreasing
explicit resolved viscosity: direct numerical simulation (DNS)
no explicit viscosity, just numerical one implicit large-eddy simulation (LES)
fi
8

Vector conservative form


T
u = (u, v, w)
di usive uxes, viscous & conductive, can be added explicitly; covered later

u⋅u p
E=ρ +
2 γ−1

[ x y z]
∂ ∂ ∂
ff
fl
9

Some model equations


∂F
a 1D set of hyperbolic eqs F(U)x = Ux = A(U)Ux
∂U
for hyperbolic eqs, eigenvalues of A are real

isentropic equations no evolution eq. for energy; only 2 dependent variables

Isothermal γ=1

scalar conservation laws:

inviscid Burgers equation


(nonlinear)

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

along tangent in x-t plane gradient of u in x-t plane

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

di erential form of eqs. apply everywhere except shocks u2


shocks, where characteristics merge,
at shocks, we need the integral/weak form as jump conditions can form with nonlinear uxes u1
entropy must increase as uid elements cross shocks
x
ff
fl
fl
fi
12

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!

analogous to nonlinear sound


waves/shocks in Euler eqs

shock forms at t=0.16 when characteristics collide


14

Weak solutions & shock jump


Euler/Burgers (nonlinear hyperbolic equations in general) allow discontinuous physical solutions that do not satisfy the PDEs
Integral form is satis ed by the weak solutions, which may be the physically realisable solution (weak solutions not unique!)

∂u ∂ integrating the PDE over the control volume,


+ f(u) = 0 uR

[ ∂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

Δt uR − uL Rankine-Hugoniot jump condition

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

what about here?


shocks, rarefactions, and contact discontinuities also occur in Euler eqs
Sod shock tube problem in hands-on session

shock speed for Burgers eq: S = (fR-fL)/(uR-uL) = (uL+uR)/2

u(x, t) = 0 for x ≤ t/2 consistent with shock jump condition


shock 1 for x > t/2 incorrect since characteristic speed
on left = 0! signal can’t emerge from a shock

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

Integral form motivates FV approach


integrating the PDE over the control volume [xi-1/2, xi+1/2]x[tn, tn+1], t

[ ∂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

The big picture


-start with the set of hyperbolic conservation laws, e.g., Euler equations
-can write it in both conservative (ρ, ρu, e+ρu2/2), primitive (ρ, u, p), and diagonal/characteristic (v1, v2, v3) forms
-decompose the system of equations into independent simple/characteristic waves (speeds u, u±cs); not analytically solvable in general
-combine these simple waves to obtain solution for given initial/boundary conditions
ρ ρu
quasilinear form in conservative variables:
ρu ρu + p 2
u= 2
f= p
ρu p ρu 3
γpu eT =
2
+ γ−1 + (γ − 1)ρ
2 γ−1
eigenvalues u, u±cs

quasilinear form in primitive variables:

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

The characteristic form


Euler eq in conservative variables

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

3 decoupled (nonlinear) characteristic eqs


19

Characteristic form of Euler eqs


a≡ γp/ρ

HW: show that eigenvalues of A(u) are u-a, u, u+a


& derive following invariants using methods of last slides

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

centered at the jump t ∂u

jump evolves into N nonlinear waves that propagate independently as simple waves
ρ(x,0)

N-dimensional nonlinear hyperbolic system decouples to N independent scalar nonlinear eqs


RP can be solved analytically for 1D Euler eqs

in general, 1 & 3 waves can be shocks/rarefactions but 2-wave is a contact wave

(approximate) solutions of RP are building blocks of modern computational gasdynamics


Godunov’s nite volume approach based on solution of RPs
only 1st order accurate since piecewise constant reconstruction

higher order accuracy in Δx via linear/parabolic reconstruction: Boris+Book, van Leer,…


no jump at CD in p, u higher order accuracy in time: PDEs as a set of ODEs & Runge-Kutta evolution
multi-D: dimensional splitting & combining evolution in 3 directions & unsplit
Sod shock tube Riemann problem
more in Dipanjan’s talk
fi
fi
fi
21

References
• The Physics of Fluids & Plasmas, Arnab Rai Choudhuri (basic big picture)

• books by Laney (basic physics of gasdynamics, lot of methods), Leveque


(general hyperbolic eqs, ideas explained well), Toro (Euler eqs, Riemann
solvers w detailed derivations)

• Stone & Norman Zeus hydro paper, 1992, ApJS, 80, 753 ( nite di erence
for hydro; arti cial viscosity; unwinding of advection term)

• Numerical Recipes by Press+

• a lot of material borrowed from above!


Thank You!
fi
fi
ff

You might also like