up x the euler equations uep (/)gtryggva/cfd-course/2013-lecture-14.pdfcomputational fluid dynamics!...
TRANSCRIPT
Computational Fluid Dynamics
Grétar Tryggvason !Spring 2013!
http://www.nd.edu/~gtryggva/CFD-Course/!
The Euler Equations!
Computational Fluid Dynamics
The Euler equations for 1D flow:! 0
)/(
2 =⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛
++
∂∂+
⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛
∂∂
ρρρρ
ρρρ
pEupu
u
xEu
t
�
E = e + u2 /2
Ideal Gas:!
where!
The Euler Equations!
�
p = ρRT; e = e T( ); cv = de /dT
�
h = h T( ); cp = dh /dT
R = cp − cv; γ = cp /cv; p = γ −1( )ρe�
H = h + u2 /2; h = e + p /ρDefine!
Computational Fluid Dynamics
The Euler equations for 1D flow:!
0)/(
2 =⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛
++
∂∂+
⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛
∂∂
ρρρρ
ρρρ
pEupu
u
xEu
t
�
E = e + u2 /2
Ideal Gas:!
where!
The Euler Equations!
�
p = ρRT; e = e T( ); cv = de /dT
h = h T( ); cp = dh / dT;h − e = RTR = h /T − e /T = cp − cv;γ = cp / cv;
p = ρ h − e( ) = h / e −1( )ρe = γ −1( )ρeSpeed of sound!
c2 = ∂p∂ρ
⎛⎝⎜
⎞⎠⎟ s
= γ RT = γ pρ
p = γ −1( )ρec2 = γ p / ρ
�
H = h + u2 /2; h = e + p /ρand we define!
Pressure and energy are related by!
Computational Fluid Dynamics
The Euler Equations!
0)/(
2 =⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛
++
∂∂+
⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛
∂∂
ρρρρ
ρρρ
pEupu
u
xEu
t
Expanding the derivative and rearranging the equations!
�
∂∂t
ρup
⎛
⎝
⎜ ⎜ ⎜
⎞
⎠
⎟ ⎟ ⎟
+u ρ 00 u 1/ρ0 ρc 2 u
⎛
⎝
⎜ ⎜ ⎜
⎞
⎠
⎟ ⎟ ⎟ ∂∂x
ρup
⎛
⎝
⎜ ⎜ ⎜
⎞
⎠
⎟ ⎟ ⎟
= 0
p = γ −1( )ρec2 = γ p / ρ
The Euler Equations!
�
∂f∂t
+A ∂f∂x
= 0
�
det(AT − λI) = 0The Characteristics for the Euler Equations are found by finding the eigenvalues for AT!
or!
Computational Fluid Dynamics
Therefore!
�
λ1 = u − c;λ2 = u + c;λ3 = u
�
detu − λ 0 0ρ u − λ ρc 2
0 1/ρ u − λ
⎛
⎝
⎜ ⎜ ⎜
⎞
⎠
⎟ ⎟ ⎟
= 0
�
det(AT − λI) = 0 or!
�
u − λ( ) u − λ( )2 − c 2( ) = 0
�
u − λ( ) = 0⇒ λ = u
u − λ( )2 − c 2( ) = 0
⇒ u − λ = ±c⇒ λ = u ± c
or:!
The Euler Equations!
Find!
Computational Fluid Dynamics Exact Solution:!
The Rankine-Hugoniot conditions!
�
∂f∂t
+ ∂F∂x
= 0
For a hyperbolic system!
The speed of a discontinuity (shock) is found by moving to a frame where a shock moving with speed s is stationary!
�
s f[ ] = F[ ]�
∂f∂t
− s ∂f∂x
+ ∂F∂x
= 0
Integrating across the shock yields!
0!
Computational Fluid Dynamics Exact Solution:!
For the Euler equations:!
0)/(
2 =⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛
++
∂∂+
⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛
∂∂
ρρρρ
ρρρ
pEupu
u
xEu
t
�
s ρL − ρR( ) = ρu( )L − ρu( )R( )s ρu( )L − ρu( )R( ) = ρu2 + p( )L − ρu2 + p( )R( )s ρE( )L − ρE( )R( ) = ρu(E + p /ρ)( )L − ρu(E + p /ρ)( )R( )
The Rankine-Hugoniot conditions are:!
Computational Fluid Dynamics
The Shock-Tube Problem!Exact Solution!
Computational Fluid Dynamics The shock tube problem!
L! R!
Shock!Contact!Expansion Fan!
uL, pL, ρL! uR, pR, ρR!
L! R!3! 2!5!
Computational Fluid Dynamics
L! R!
Shock!Contact!Expansion Fan!
Pressure!
Density!
Computational Fluid Dynamics Exact Solution:!
Consider the case pL > pR:!!Shock separates R and 2!!Contact discontinuity separates 2 and 3!!Expansion fan separates 3 and L!
given:!
�
pL , ρL , uL ,
�
pR , ρR , uR
L! R!2!3!4!
�
α = γ +1γ −1
cR = γ pR ρRcL = γ pL ρL
Computational Fluid Dynamics Exact Solution:!
P =pLpR
1−γ −1( ) cR / cL( )(P −1)
2γ 2γ + γ +1( ) P −1( )( )⎡
⎣
⎢⎢
⎤
⎦
⎥⎥
2γ / γ −1( )
�
P = p2pR
The Rankine-Hugoniot conditions give a nonlinear relation for the pressure jump across the shock !
which can be solved by iteration!
given:!
�
pL , ρL , uL ,
�
pR , ρR , uR
L! R!2!3!4!
Computational Fluid Dynamics
The speed of the shock and velocity behind the shock are found using RH conditions:!
�
sshock = uR + cRγ −1+ γ +1( )P
2γ⎛
⎝ ⎜
⎞
⎠ ⎟ 1/ 2
�
scontact = u3 = u2 = uL + 2cLγ −1
1− P pRpL
⎛
⎝ ⎜
⎞
⎠ ⎟
γ −12γ
⎛
⎝
⎜ ⎜ ⎜
⎞
⎠
⎟ ⎟ ⎟
Exact Solution:!
The speed of the contact is!
The left hand side of the fan moves with speed!
The right hand side of the fan moves with speed!
�
sfL = −cL
s fR = u2 − c3
�
x fR = x0 + sfR t�
x fL = x0 + sfL t�
xcontact = x0 + scontact t�
xshock = x0 + sshockt
L! R!2!3!4!
�
P = p2pR
Computational Fluid Dynamics
In the expansion fan (4)!
�
p4 = p41+ (s− x)cLα t
⎛
⎝ ⎜
⎞
⎠ ⎟
2γγ −1
Exact Solution:!
�
ρ4 = ρ41+ (s− x)cLα t
⎛
⎝ ⎜
⎞
⎠ ⎟
2γγ −1
�
u4 = uL + 2γ +1
s− xt
⎛ ⎝ ⎜
⎞ ⎠ ⎟
L! R!2!3!4!
�
pL , ρL , uL ,given:!
�
cL = γpL ρL
Left uniform state!
Behind the contact (3)!
�
p3 = p2
�
u3 = u2
�
ρ3 = ρL P pRpL
⎛
⎝ ⎜
⎞
⎠ ⎟ 1/γ
�
P = p2pR
Computational Fluid Dynamics Exact Solution:!
L! R!2!3!4!
Behind the shock (2)!
ρ2 =1+αPα + P
⎛⎝⎜
⎞⎠⎟ρR
u2 = uL +2cLγ −1
1− P pRpL
⎛⎝⎜
⎞⎠⎟
γ −12γ
⎛
⎝
⎜⎜
⎞
⎠
⎟⎟�
p2 = P pR
�
pR , ρR , uR
given:!
Right uniform state!
cR = γ pR ρR
�
α = γ +1γ −1
Behind the contact (3)!
�
p3 = p2
ρ3 = ρL P pRpL
⎛⎝⎜
⎞⎠⎟
1/γ
�
u3 = u2
�
P = p2pR
Computational Fluid Dynamics Exact Solution:!
The velocity relative to the speed of sound defines the flow regime!
c = γ pρ
�
Ma = uc
The Mach number is defined as the ratio of the local velocity over the speed of sound!
�
Ma <1Ma >1
subsonic!supersonic !
Computational Fluid Dynamics
0 100 200 300 400 5000
2
4
6
8
10x 104 pressure
Exact Solution:!
0 100 200 300 400 5000
0.2
0.4
0.6
0.8
1
density
0 100 200 300 400 5000
100
200
300velocity
Pressure!
Density!
Velocity!
0 100 200 300 400 5000
0.2
0.4
0.6
0.8
1Mach number
t=0.0005!
Mach Number!
Test case:!
�
pL =105; ρL =1.0; uL = 0pR =104; ρR = 0.125; uR = 0
Shocktube problem of G.A. Sod, JCP 27:1, 1978 !
�
t final = 0.005x0 = 0.5
Subsonic case!
Computational Fluid Dynamics Exact Solution:!
0 100 200 300 400 5000
0.2
0.4
0.6
0.8
1
density
0 100 200 300 400 5000
2
4
6
8
10
x 104 pressure
0 100 200 300 400 5000
50
100
150
200
250
300
velocity
0 100 200 300 400 5000
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1Mach number
Computational Fluid Dynamics Exact Solution:!
Pressure!
Density!
Velocity!
Mach Number!
Test case:!
�
pL =105; ρL =1.0; uL = 0pR =104; ρR = 0.01; uR = 0
Shocktube problem of G.A. Sod, JCP 27:1, 1978 !
�
t final = 0.0025x0 = 0.5
Supersonic case!
Computational Fluid Dynamics
Solve using second order Lax-Wendroff !
Computational Fluid Dynamics
For the fluid-dynamic system of equations (Euler equations):!
0)/(
2 =⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛
++
∂∂+
⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛
∂∂
ρρρρ
ρρρ
pEupu
u
xEu
t
epueE ργ )1(;2/2 −=+=Add the artificial viscosity to RHS:!
where!
⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛
∂∂
∂∂
∂∂=
xu
xu
uh
x10
2ρα
L-W with artificial viscosity!Computational Fluid Dynamics
�
f j+ 12
* = 0.5 f jn + f j+1
n( ) − 0.5Δth F j+1n −F j
n( )f jn+1 = f j
n − ΔthF j+ 1
2
* −F j− 12*( )
Solutions of the 1D Euler equation using Lax-Wendroff !
F ' = F −αh2ρ01u
⎡
⎣
⎢⎢⎢
⎤
⎦
⎥⎥⎥
∂u∂x
∂u∂x
With an artificial viscosity term added to the corrector step!
L-W with artificial viscosity!
Lax Fredrich!
Leap Frog!
j-1 j j+1
Computational Fluid Dynamics L-W with artificial viscosity!
Test case:!
�
pL =105; ρL =1.0; uL = 0pR =104; ρR = 0.125; uR = 0
Shocktube problem of G.A. Sod, JCP 27:1, 1978 !
Final time: 0.005!
0 0.2 0.4 0.6 0.8 10
0.2
0.4
0.6
0.8
1
density
�
α = 0.5nx=128;
Computational Fluid Dynamics
0 0.2 0.4 0.6 0.8 10
0.2
0.4
0.6
0.8
1
density
�
α = 0.5α =1.0α =1.5α = 2.5
nx=128;
Effect of α !
0 0.2 0.4 0.6 0.8 10
2
4
6
8
10
x 104 pressure
�
α = 0.5α =1.0α =1.5α = 2.5
L-W with artificial viscosity!
Computational Fluid Dynamics
0 0.2 0.4 0.6 0.8 10
2
4
6
8
10
x 104 pressure
nx=64; nx=128; nx=256; time=0.5
�
α =1.5
Effect of resolution!
0 0.2 0.4 0.6 0.8 10
0.2
0.4
0.6
0.8
1
density
L-W with artificial viscosity!Computational Fluid Dynamics
for istep=1:2000!for i=1:nx,p(i)=…..; end!!
for i=2:nx-1 ! ! !%prediction step! rh(i)= …..! ruh(i)= …..! rEh(i)= …..!end!!for i=1:nx,ph(i)=…..; end!!
for i=2:nx-1 ! ! !%correction step! r(i)= …..! ru(i)= …..! rE(i)= ….. !end!!
for i=1:nx,u(i)=ru(i)/r(i);end!!for i=2:nx-1 ! ! !%artificial viscosity! ru(i)= …..! rE(i)= …..!end!time=time+dt,istep!
end!
Outline of L-W program!
L-W with artificial viscosity!
Computational Fluid Dynamics
nx=129; artvisc=0.5;!hold off!%gg=1.4;p_left=100000;p_right=1000;r_left=1;r_right=0.01;!gg=1.4;p_left=100000;p_right=10000;r_left=1;r_right=0.125;!xl=10.0;h=xl/(nx-1);time=0;!!r=zeros(1,nx);ru=zeros(1,nx);rE=zeros(1,nx);p=zeros(1,nx);!rh=zeros(1,nx);ruh=zeros(1,nx);rEh=zeros(1,nx);ph=zeros(1,nx);!!for i=1:nx,r(i)=r_right;ru(i)=0.0;rE(i)=p_right/(gg-1);end!for i=1:nx/2; r(i)=r_left; rE(i)=p_left/(gg-1); end!!rh=r;ruh=ru;rEh=rE;ph=p;!!dt=0.25*h/sqrt(1.4*max([700+p_right/r_right,700+p_left/r_left]) )!!
for istep=1:2000!!for i=1:nx,p(i)=(gg-1)*(rE(i)-0.5*(ru(i)*ru(i)/r(i)));end!!for i=2:nx-1 ! !%prediction step! rh(i)=0.5*(r(i)+r(i+1))-(0.5*dt/h)*(ru(i+1)-ru(i));! ruh(i)=0.5*(ru(i)+ru(i+1))-(0.5*dt/h)*((ru(i+1)^2/r(i+1))+p(i+1)-(ru(i)^2/r(i))-p(i));! rEh(i)=0.5*(rE(i)+rE(i+1))-...!
!(0.5*dt/h)*((rE(i+1)*ru(i+1)/r(i+1))+(ru(i+1)*p(i+1)/r(i+1))...!! ! -(rE(i)* ru(i) /r(i))- (ru(i) *p(i) /r(i)));!
end!!for i=1:nx,ph(i)=(gg-1)*(rEh(i)-0.5*(ruh(i)*ruh(i)/rh(i)));end!!for i=2:nx-1 ! !%correction step! r(i)=r(i)-(dt/h)*(ruh(i)-ruh(i-1));! ru(i)=ru(i)-(dt/h)*((ruh(i)^2/rh(i))-(ruh(i-1)^2/rh(i-1))+ph(i)-ph(i-1));! rE(i)=rE(i)-(dt/h)*((rEh(i)*ruh(i)/rh(i))-(rEh(i-1)*ruh(i-1)/rh(i-1))+...!
!(ruh(i)*ph(i)/rh(i))-(ruh(i-1)*ph(i-1)/rh(i-1)));!end!!for i=1:nx,u(i)=ru(i)/r(i);end!!for i=2:nx-1 ! !%artificial viscosity! ru(i)=ru(i)+artvisc*(0.5*dt/h)*( (r(i)+r(i+1))*(u(i+1)-u(i))*abs(u(i+1)-u(i))...! -(r(i)+r(i-1))*(u(i)-u(i-1))*abs(u(i)-u(i-1)) );!! rE(i)=rE(i)+artvisc*(0.25*dt/h)*...! ( (u(i+1)+u(i))*(r(i)+r(i+1))*(u(i+1)-u(i))*abs(u(i+1)-u(i))...! -(u(i)+u(i-1))*(r(i)+r(i-1))*(u(i)-u(i-1))*abs(u(i)-u(i-1)) );!end!time=time+dt,istep!plot(p,'b','linewidth',2),title('pressure'); pause!if(time > 0.005)break,end!end!
L-W with artificial viscosity!Computational Fluid Dynamics
Solve using first order upwinding with flux splitting!
Computational Fluid Dynamics
Define!
�
F = F + + F−
So that!
�
∂f∂t
+ ∂F+
∂x+ ∂F−
∂x= 0
Flux Splitting!
�
∂f∂t
+ ∂F∂x
= 0
For conservation law!
where!
Which can be written as!
�
∂f∂t
+ A[ ] ∂f∂x
= 0; A[ ] = ∂F∂f
�
λ[ ] = λ+[ ] + λ−[ ]
Are the positive and negative eigenvalues of A!
Computational Fluid Dynamics
For nonlinear equation the splitting is not unique, different matrices can have the same eigenvalues!
Flux Splitting!
Computational Fluid Dynamics
Here we solve the one-dimensional Euler equation using the van Leer vector flux splitting!
F− = −ρ4c
(u − c)2
1
(γ −1)u − 2cγ
2c − (γ −1)u⎡⎣ ⎤⎦2
2(γ 2 −1)
⎡
⎣
⎢⎢⎢⎢⎢⎢⎢⎢⎢
⎤
⎦
⎥⎥⎥⎥⎥⎥⎥⎥⎥
F+ =ρ4c
(u + c)2
1
(γ −1)u + 2cγ
(γ −1)u + 2c⎡⎣ ⎤⎦2
2(γ 2 −1)
⎡
⎣
⎢⎢⎢⎢⎢⎢⎢⎢⎢
⎤
⎦
⎥⎥⎥⎥⎥⎥⎥⎥⎥
Van Leer!
First order upwind!Computational Fluid Dynamics
van Leer vector flux splitting!
ρu
ρu2 + p
ρu(E +pρ
)
⎡
⎣
⎢⎢⎢⎢⎢⎢⎢
⎤
⎦
⎥⎥⎥⎥⎥⎥⎥
=ρ4c
(u + c)2
1
(γ −1)u + 2cγ
(γ −1)u + 2c⎡⎣ ⎤⎦2
2(γ 2 −1)
⎡
⎣
⎢⎢⎢⎢⎢⎢⎢⎢⎢
⎤
⎦
⎥⎥⎥⎥⎥⎥⎥⎥⎥
−ρ4c
(u − c)2
1
(γ −1)u − 2cγ
2c − (γ −1)u⎡⎣ ⎤⎦2
2(γ 2 −1)
⎡
⎣
⎢⎢⎢⎢⎢⎢⎢⎢⎢
⎤
⎦
⎥⎥⎥⎥⎥⎥⎥⎥⎥
�
ρ4c(u + c)2 − ρ
4c(u − c)2
= ρ4c
u2 + 2uc + c 2 − u2 + 2uc − c 2( ) = ρ4c4uc = ρu
For example, the mass flux:!
First order upwind!
Computational Fluid Dynamics
For 1D flow the fluxes are!
F± = ± ρ4c(u ± c)2
1
(γ −1)u ± 2cγ
2c ± (γ −1)u[ ]22(γ 2 −1)
⎡
⎣
⎢⎢⎢⎢⎢⎢⎢⎢⎢
⎤
⎦
⎥⎥⎥⎥⎥⎥⎥⎥⎥
= ± ρc4(M ±1)2
1
2cγ
γ −12
M ±1⎛⎝⎜
⎞⎠⎟
2c2
γ 2 −11± γ −1
2M⎛
⎝⎜⎞⎠⎟2
⎡
⎣
⎢⎢⎢⎢⎢⎢⎢⎢
⎤
⎦
⎥⎥⎥⎥⎥⎥⎥⎥
First order upwind!Computational Fluid Dynamics
For 2D flow the fluxes are!
F± = ± ρ4c(u ± c)2
1(γ −1)u ± 2c
γ
vv2
2+(γ −1)u ± 2c[ ]22(γ 2 −1)
⎡
⎣
⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢
⎤
⎦
⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥
; G± = ± ρ4c(v ± c)2
1u
(γ −1)v ± 2cγ
u2
2+(γ −1)v ± 2c[ ]22(γ 2 −1)
⎡
⎣
⎢⎢⎢⎢⎢⎢⎢⎢⎢
⎤
⎦
⎥⎥⎥⎥⎥⎥⎥⎥⎥
First order upwind!
∂f∂t
+ ∂F+
∂x+ ∂F−
∂x+ ∂G+
∂y+ ∂G−
∂y= 0
Computational Fluid Dynamics
F− =12ργ(u − c)
1u − c
12(u − c)2 + 1
2c2 3− γ
γ −1⎛⎝⎜
⎞⎠⎟
⎡
⎣
⎢⎢⎢⎢⎢
⎤
⎦
⎥⎥⎥⎥⎥
F+ =ρ2γ
(2γ −1)u + c2(γ −1)u2 + (u + c)2
(γ −1)u3 + 12(u + c)3 + 3− γ
2(γ −1)(u + c)c2
⎡
⎣
⎢⎢⎢⎢⎢
⎤
⎦
⎥⎥⎥⎥⎥
Steger-Warming!
Several other splitting schemes are possible, such as:!
First order upwind!Computational Fluid Dynamics
F+ = ρ4c(u + c )2
1
(γ −1)u + 2cγ
(γ −1)u + 2c⎡⎣ ⎤⎦2
2(γ 2 −1)
⎛
⎝
⎜⎜⎜⎜⎜⎜⎜⎜
⎞
⎠
⎟⎟⎟⎟⎟⎟⎟⎟
⎛
⎝
⎜⎜⎜⎜⎜⎜⎜⎜
⎞
⎠
⎟⎟⎟⎟⎟⎟⎟⎟
= ρc4uc+1
⎛⎝⎜
⎞⎠⎟
2
1
2cγ1+ γ −1
2uc
⎛⎝⎜
⎞⎠⎟
2c 2
γ 2 −11+ γ −1
2uc
⎛⎝⎜
⎞⎠⎟
2
⎛
⎝
⎜⎜⎜⎜⎜⎜⎜⎜
⎞
⎠
⎟⎟⎟⎟⎟⎟⎟⎟
⎛
⎝
⎜⎜⎜⎜⎜⎜⎜⎜
⎞
⎠
⎟⎟⎟⎟⎟⎟⎟⎟
= ρc4(M +1)2
1
2cγ1+ γ −1
2M⎛
⎝⎜⎞⎠⎟
2c 2
γ 2 −11+ γ −1
2M⎛
⎝⎜⎞⎠⎟
2
⎛
⎝
⎜⎜⎜⎜⎜⎜⎜⎜
⎞
⎠
⎟⎟⎟⎟⎟⎟⎟⎟
⎛
⎝
⎜⎜⎜⎜⎜⎜⎜⎜
⎞
⎠
⎟⎟⎟⎟⎟⎟⎟⎟
Rewrite the flux terms in terms of Mach number:!
First order upwind!
Computational Fluid Dynamics
∂∂t
ρρuρE
⎛
⎝
⎜⎜⎜
⎞
⎠
⎟⎟⎟+
∂∂x
ρc4
( M +1)2
1
2cγ
1+γ −1
2M
⎛⎝⎜
⎞⎠⎟
2c2
γ 2 −11+
γ −12
M⎛⎝⎜
⎞⎠⎟
2
⎛
⎝
⎜⎜⎜⎜⎜⎜⎜⎜
⎞
⎠
⎟⎟⎟⎟⎟⎟⎟⎟
⎛
⎝
⎜⎜⎜⎜⎜⎜⎜⎜⎜
⎞
⎠
⎟⎟⎟⎟⎟⎟⎟⎟⎟
+∂∂x
−ρc4
( M −1)2
1
2cγ
−1+γ −1
2M
⎛⎝⎜
⎞⎠⎟
2c2
γ 2 −11−
γ −12
M⎛⎝⎜
⎞⎠⎟
2
⎛
⎝
⎜⎜⎜⎜⎜⎜⎜⎜
⎞
⎠
⎟⎟⎟⎟⎟⎟⎟⎟
⎛
⎝
⎜⎜⎜⎜⎜⎜⎜⎜⎜
⎞
⎠
⎟⎟⎟⎟⎟⎟⎟⎟⎟
= 0
�
∂f∂t
+ ∂F+
∂x+ ∂F-
∂x= 0
First order upwind!Computational Fluid Dynamics
∂f∂t
+∂F+
∂x+∂F-
∂x= 0
f jn+1 = f j
n −Δth
⎛⎝⎜
⎞⎠⎟Fj+ − Fj -1
+( )n − Δth
⎛⎝⎜
⎞⎠⎟Fj+1- − Fj
-( )n
F+ =ρc4
( M +1)2
1
2cγ
1+γ −1
2M
⎛⎝⎜
⎞⎠⎟
2c2
γ 2 −11+
γ −12
M⎛⎝⎜
⎞⎠⎟
2
⎛
⎝
⎜⎜⎜⎜⎜⎜⎜⎜
⎞
⎠
⎟⎟⎟⎟⎟⎟⎟⎟
; F− = −ρc4
( M −1)2
1
2cγ
−1+γ −1
2M
⎛⎝⎜
⎞⎠⎟
2c2
γ 2 −11−
γ −12
M⎛⎝⎜
⎞⎠⎟
2
⎛
⎝
⎜⎜⎜⎜⎜⎜⎜⎜
⎞
⎠
⎟⎟⎟⎟⎟⎟⎟⎟
Where!
Solve by!
First order upwind!
Computational Fluid Dynamics
for istep=1:maxstep for i=1:nx,c(i)=sqrt( gg*(gg-1)*(rE(i)-0.5*(ru(i)^2/r(i)))/r(i) );end for i=1:nx,u(i)=ru(i)/r(i);end; for i=1:nx,m(i)=u(i)/c(i);end for i=2:nx-1 %upwind rn(i)=r(i)-(dt/h)*(... (0.25*r(i)*c(i)*(m(i)+1)^2) - (0.25*r(i-1)*c(i-1)*(m(i-1)+1)^2)+... (-0.25*r(i+1)*c(i+1)*(m(i+1)-1)^2) - (-0.25*r(i)*c(i)*(m(i)-1)^2) ); run(i)=ru(i)-(dt/h)*(... ( 0.25*r(i)*c(i) *(m(i)+1)^2) *(( 1+0.5*(gg-1)*m(i)) *2*c(i) /gg) - ... ( 0.25*r(i-1)*c(i-1)*(m(i-1)+1)^2)*(( 1+0.5*(gg-1)*m(i-1))*2*c(i-1)/gg) + ... (-0.25*r(i+1)*c(i+1)*(m(i+1)-1)^2)*((-1+0.5*(gg-1)*m(i+1))*2*c(i+1)/gg) - ... (-0.25*r(i)*c(i) *(m(i)-1)^2) *((-1+0.5*(gg-1)*m(i)) *2*c(i) /gg) ); rEn(i)=rE(i)-(dt/h)*(... ( 0.25*r(i)*c(i) *(m(i)+1)^2) *((1+0.5*(gg-1)*m(i))^2 *2*c(i)^2 /(gg^2-1)) - ... ( 0.25*r(i-1)*c(i-1)*(m(i-1)+1)^2)*((1+0.5*(gg-1)*m(i-1))^2*2*c(i-1)^2/(gg^2-1)) + ... (-0.25*r(i+1)*c(i+1)*(m(i+1)-1)^2)*((1-0.5*(gg-1)*m(i+1))^2*2*c(i+1)^2/(gg^2-1)) - ... (-0.25*r(i)*c(i) *(m(i)-1)^2) *((1-0.5*(gg-1)*m(i))^2 *2*c(i)^2 /(gg^2-1)) ); end
First order upwind!Computational Fluid Dynamics
�
pL =105; ρL =1.0; uL = 0pR =104; ρR = 0.125; uR = 0
Shocktube problem of G.A. Sod, JCP 27:1, 1978 !
0 2 4 6 8 100
0.2
0.4
0.6
0.8
1 DensityDensityDensityDensityDensity
Effect of resolution!
nx=64; maxstep=32!nx=128; maxstep=64!nx=256; maxstep=128!nx=512; maxstep=256!
0 2 4 6 8 100
2
4
6
8
10x 104
PressurePressure
nx=64; maxstep=32!nx=256; maxstep=128!
Final time: 0.005!
First order upwind!
Computational Fluid Dynamics
Numerical solutions of the one-dimensional Euler equations! Upwind/flux splitting! Lax-Wendroff/artificial viscosity !
Summary!