f Wave Equation - University of Notre Damegtryggva/CFD-Course/2013-Lecture-9.pdfWave equation!...
Transcript of f Wave Equation - University of Notre Damegtryggva/CFD-Course/2013-Lecture-9.pdfWave equation!...
Computational Fluid Dynamics
Wave Equation!
Grétar Tryggvason!Spring 2013!
http://www.nd.edu/~gtryggva/CFD-Course/!Computational Fluid Dynamics
�
∂ 2 f∂t 2
− c 2 ∂2 f∂x 2
= 0
First write the equation as a system of first order equations!
�
u = ∂f∂t; v = ∂f
∂x;
�
∂u∂t
− c 2 ∂v∂x
= 0
∂v∂t
− ∂u∂x
= 0
yielding!
Introduce!
from the pde!
since!
�
∂ 2 f∂t∂x
= ∂ 2 f∂x∂t
Wave equation!
Computational Fluid Dynamics
�
∂u∂t
− c 2 ∂v∂x
= 0
∂v∂t
− ∂u∂x
= 0
∂u∂t∂v∂t
⎡
⎣
⎢⎢⎢⎢
⎤
⎦
⎥⎥⎥⎥
+ 0 −c2
−1 0⎡
⎣⎢
⎤
⎦⎥
∂u∂x∂v∂x
⎡
⎣
⎢⎢⎢⎢
⎤
⎦
⎥⎥⎥⎥
= 0
det AT −αI( ) = det −α −1−c2 −α
⎡
⎣⎢⎢
⎤
⎦⎥⎥= α 2 − c2( ) = 0
�
⇒α = ±c
α =12a
b ± b2 − 4ac( )
�
b = 0; a =1; c = −c 2We can also use!
with!
To find the characteristics!
Wave equation!Computational Fluid Dynamics
t
x
P
Two characteristic lines!
�
dtdx
= +1c; dtdx
= −1c
�
dtdx
= +1c
�
dtdx
= −1c
Wave equation!
Computational Fluid Dynamics
l1∂u∂t
− c2∂v∂x
= 0⎛⎝⎜
⎞⎠⎟
+l2∂v∂t
−∂u∂x
= 0⎛⎝⎜
⎞⎠⎟
−α −1−c2 −α
⎡
⎣⎢⎢
⎤
⎦⎥⎥
l1l2
⎡
⎣⎢⎢
⎤
⎦⎥⎥= 0
�
⇒α = ±cTo find the solution we need to find the eigenvectors!
Take l1=1!
�
−c l1 − l2 = 0 ⇒ l2 = −cFor!
�
α = +c
�
+c l1 − l2 = 0 ⇒ l2 = +cFor!
�
α = −c
Wave equation!Computational Fluid Dynamics
�
1 ∂u∂t
− c 2 ∂v∂x
= 0⎛ ⎝ ⎜
⎞ ⎠ ⎟ − c
∂v∂t
− ∂u∂x
= 0⎛ ⎝ ⎜
⎞ ⎠ ⎟ Add the
equations!�
l1 =1 l2 = −cFor!
�
α = +c
For!
�
α = −c
�
l1 =1 l2 = +c�
∂u∂t
+ c ∂u∂x
⎛ ⎝ ⎜
⎞ ⎠ ⎟ − c
∂v∂t
+ c ∂v∂x
⎛ ⎝ ⎜
⎞ ⎠ ⎟ = 0
�
dudt
− c dvdt
= 0 on dxdt
= +c
�
dudt
+ c dvdt
= 0 on dxdt
= −c
Relation between the total derivative on the characteristic!Similarly:!
Wave equation!
Computational Fluid Dynamics
For constant c!�
dudt
− c dvdt
= 0 on dxdt
= +c
�
dudt
+ c dvdt
= 0 on dxdt
= −c
�
dr1dt
= 0 on dxdt
= +c where r1 = u − cv
�
dr2dt
= 0 on dxdt
= −c where r2 = u + cv
r1 and r2 are called the Rieman invariants!
Wave equation!Computational Fluid Dynamics
The general solution can therefore be written as:!
�
f x, t( ) = r1 x − ct( ) + r2 x + ct( )
�
r1 x( ) = ∂f∂t
− c ∂f∂x
⎡ ⎣ ⎢
⎤ ⎦ ⎥ t= 0
r2 x( ) = ∂f∂t
+ c ∂f∂x
⎡ ⎣ ⎢
⎤ ⎦ ⎥ t= 0
where!
Can also be verified by direct substitution!
Wave equation!
Computational Fluid Dynamics
Domain of !Influence!
Domain of !Dependence
t
x
P
Two characteristic lines!
�
dtdx
= +1c; dtdx
= −1c
�
dtdx
= +1c
�
dtdx
= −1c
Wave equation-general!Computational Fluid Dynamics
Ill-posed problems!
Computational Fluid Dynamics Ill-posed Problems!
∂ 2 f∂t2
= −∂ 2 f∂x2
Consider the initial value problem:!
∂ 2 f∂t2
+∂ 2 f∂x2
= 0
This is simply Laplace’s equation!
which has a solution if ∂f/∂t or f are given on the boundaries!
Computational Fluid Dynamics
Here, however, this equation appeared as an initial value problem, where the only boundary conditions available are at t = 0. Since this is a second order equation we will need two conditions, which we may assume are that f and ∂f/∂x are specified at t =0.!
Ill-posed Problems!
Computational Fluid Dynamics
Look for solutions of the type:!
�
f = ak (t)eikx
�
d2akdt 2
= k 2ak
Substitute into:!∂ 2 f∂t2
+∂ 2 f∂x2
= 0
to get:!
Ill-posed Problems!
�
f x, t( ) = ak (t)eikx
k∑
The general solution can be written as:!where the a’s depend on the initial conditions!
Computational Fluid Dynamics
)0( ;)0( ikaa�
d2akdt 2
= k 2ak
determined by initial conditions !
General solution!
�
ak (t) = Aekt + Be−kt
BA,
Therefore:! ∞→)(ta as! ∞→t
Ill-posed Problem!
Ill-posed Problems!
Generally, both A and B are non-zero!
Computational Fluid Dynamics Ill-posed Problems!
Long wave with short wave perturbations!
Computational Fluid Dynamics
∂f∂t
= D∂2 f∂x2 ; D < 0
has solutions with unbounded growth rate for high wave number modes and is therefore an ill-posed problem!
Similarly, it can be shown that the diffusion equation with a negative diffusion coefficient!
Ill-posed Problems!
Computational Fluid Dynamics
Ill-posed problems generally appear when the initial or boundary data and the equation type do not match.!!Frequently arise because small but important higher order effects have been neglected!!Ill-posedness generally manifests itself in the exponential growth of small perturbations so that the solution does not “depend continuously on the initial data” !!Inviscid vortex sheet rollup, multiphase flow models and some viscoelastic constitutive models are examples of problems that exhibit ill-posedness. !
Ill-posed Problems!Computational Fluid Dynamics
Classical Methods!for Hyperbolic!
Equations!
Computational Fluid Dynamics
�
∂ 2 f∂t 2
− c 2 ∂2 f
∂x 2= 0
�
∂u∂t
− c 2 ∂v∂x
= 0
∂v∂t
− ∂u∂x
= 0
The wave equation:!
Write as:!
In general:!
∂u∂t∂v∂t
⎡
⎣
⎢⎢⎢⎢
⎤
⎦
⎥⎥⎥⎥
+a11 a12a21 a22
⎡
⎣⎢⎢
⎤
⎦⎥⎥
∂u∂x∂v∂x
⎡
⎣
⎢⎢⎢⎢
⎤
⎦
⎥⎥⎥⎥
= 0
Most of the issues involved can be addressed by examining:!
�
∂f∂t
+U ∂f∂x
= 0
Methods for Advection!Computational Fluid Dynamics
Forward in Time, Centered in Space
(FTCS) and Upwind!
Computational Fluid Dynamics
We will start by examining the linear advection equation:!∂f∂t
+ U∂f∂x
= 0
The characteristic for this equation are:!dxdt
=U; dfdt
= 0;
Showing that the initial conditions are simply advected by a constant velocity U!
t
f
f
x
Methods for Advection!Computational Fluid Dynamics
A simple forward in time, centered in space discretization yields!
∂f∂t
+ U∂f∂x
= 0
fjn+1 = fj
n −Δt2hU ( fj+1
n − fj−1n )
j-1 j j+1 n
n+1
Methods for Advection!
Computational Fluid Dynamics
This scheme is O(Δt, h2) accurate, but a stability analysis shows that the error grows as!
ε n+1
ε n= 1− i
UΔt2h
sin kh
Since the amplification factor has the form 1+i() the absolute value of this complex number is always larger than unity and the method is unconditionally unstable for this case.!
iUΔt2h
sinkh
1
ε n+1
ε n
Methods for Advection!Computational Fluid Dynamics
A simple forward in time but “upwind” in space discretization yields!
∂f∂t
+ U∂f∂x
= 0
fjn+1 = fj
n −ΔthU ( fj
n − fj−1n )
j-1 j n
n+1 This scheme is O(Δt, h) accurate. !
Another scheme for!
Flow direction!
Methods for Advection!
Computational Fluid Dynamics
To examine the stability we use the von Neuman’s method:! !
ε jn+1 − ε j
n
Δt+Uh(ε j
n − ε j−1n ) = 0
ε jn = εneikx j
ε n+1 − ε n
Δt+U ε n
h(1− e− ikh) = 0
The evolution of the error is governed by:!
Write the error as:!
�
εn+1
εn=1−UΔt
h(1− e−ikh )
�
G = εn+1
εn=1− λ(1− e−ikh ), λ = UΔt
h
Amplification factor!
�
G =1− λ + λe− ikhOr:!
�
G <1Need to find when!
Methods for Advection!Computational Fluid Dynamics
Stable!
Im(G)
1
1
kh
λ 1-λ
G
UΔth
≤ 1
This restriction was first derived by Courant, Fredrik, and Levy in 1932, and is usually called the Courant condition, or the CFL condition. !
�
G =1− λ + λe− ikh, λ = UΔth
Stability condition: λ<1!
Graphically:!
Methods for Advection!
Computational Fluid Dynamics
�
G =1− λ + λe− ikh =1− λ + λcoskh − iλ sinkh
�
G 2 = 1− λ + λcoskh( )2 + λ2 sin2 kh
= 1− λ( )2 + 2 1− λ( )λcoskh + λ2 cos2 kh + λ2 sin2 kh
= 1− λ( )2 + 2 1− λ( )λcoskh + λ2
=1− 2λ + 2λ2 + 2 1− λ( )λcoskh
�
G 2 =1− 2λ 1− λ( ) if coskh = 0
G 2 =1 if coskh =1
G 2 =1− λ 4 − 3λ( ) if coskh = −1
�
G 2 ≤1 if λ ≤1
Another way: Find the absolute value of the amplification factor!
1!
�
G 2
�
λ1!�
coskh = 0
�
coskh = −1
Methods for Advection!Computational Fluid Dynamics
The CFL condition implies that a signal has to travel less than one grid spacing in one time step!
�
UΔt ≤ h
Flow direction!
j-1 j
n
n+1
Allowable characteristics!
Not allowable characteristics!
Methods for Advection!
Computational Fluid Dynamics
fjn+1 = fj
n −ΔthU ( fj
n − fj−1n )
j-1 j n
n+1
O(Δt, h) accurate. !
For the linear advection equation:!
Flow direction!
UΔth
≤ 1
U h
The Upwind Scheme!
�
∂f∂t
+U ∂f∂x
= 0
Methods for Advection!Computational Fluid Dynamics
dt=0.25*h!
20 40 60 80-0.5
0
0.5
1
1.5
Upwind
Although the upwind method is exceptionally robust, its low accuracy in space and time makes it unsuitable for most serious computations !
Methods for Advection!
Computational Fluid Dynamics
Finite Volume point of view:!
xj-1/2 xj+1/2 !
�
f j−1
�
f j
x!
f
�
f j+1
�
f jn+1 = f j
n − Δth(Fj+1/ 2
n − Fj−1/ 2n ) = f j
n − ΔthU( f j
n − f j−1n )
�
Fj+1/ 2=Uf jn
�
Fj−1/ 2=Uf j−1n
Methods for Advection!Computational Fluid Dynamics
Generalized Upwind Scheme (for both U > 0 and U < 0 )!
�
f jn+1 = f j
n −UΔth( f j
n − f j−1n ), U > 0
�
f jn+1 = f j
n −UΔth( f j+1
n − f jn ), U < 0
Define:!
�
U + = 12U + U( ), U− = 1
2U − U( )
The two cases can be combined into a single expression:!
�
f jn+1 = f j
n − ΔthU +( f j
n − f j−1n ) +U−( f j+1
n − f jn )[ ]
Or, substituting! −+ UU ,
�
f jn+1 = f j
n −U Δt2h( f j+1
n − f j−1n ) +
U Δt2h
( f j+1n − 2 f j
n + f j−1n )
central difference + numerical viscosity! Dnum =U h2
Computational Fluid Dynamics
Other First Order Schemes!
Computational Fluid Dynamics
Implicit (Backward Euler) Method!
- Unconditionally stable!- 1st order in time, 2nd order in space!- Forms a tri-diagonal matrix (Thomas algorithm)!
( ) 02
11
11
1
=−+Δ− +
−++
+nj
nj
nj
nj ff
hU
tff
nj
nj
nj
nj f
tf
hUf
tf
hU
Δ=−
Δ+ +
−++
+
12
12
11
111
jnjj
njj
njj Cfbfdfa =++ +
−++
+11
111
Methods for Advection!
Computational Fluid Dynamics
Lax-Fredrichs method!
- stable for λ < 1!- 1st order in time, 1nd order in space!- Conditionally consistent!
f jn+1 − 1
2 f j+1n + f j−1
n( )Δt
+U2h
f j+1n − f j−1
n( ) = 0
( ) xxxxx fUh
fUh 2
2
13
12
λλλ
−+⎟⎠⎞⎜
⎝⎛ −
Error term:!
λ =UΔth
hλ=
h2
UΔt
Methods for Advection!Computational Fluid Dynamics
Second Order Schemes!
Computational Fluid Dynamics
)(2
211
tOtff
tf n
jnj Δ+
Δ−
=∂∂ −+
Leap Frog Method!
The simplest stable second-order accurate (in time) method:!
Modified equation!
( )nj
nj
nj
nj ff
htUff 11
11−+
−+ −Δ−=
( ) +−=∂∂+
∂∂
xxxfUh
xf
Utf 1
62
2
λ
- Stable for ! 1<λ- Dispersive (no dissipation) – error will not damp out!- Initial conditions at two time levels !- Oscillatory solution in time (alternating) !
λ =UΔth
Methods for Advection!Computational Fluid Dynamics
+Δ∂∂+Δ
∂∂+Δ
∂∂+=Δ+
62)()(
3
3
32
2
2 ttft
tft
tftfttf
Lax-Wendroff’s Method (LW-I)!
First expand the solution in time!
Then use the original equation to rewrite the time derivatives!
xf
Utf
∂∂−=
∂∂
2
22
2
2
xf
Utf
xU
xf
Utt
ftt
f∂∂=
∂∂
∂∂−=⎟
⎠⎞⎜
⎝⎛
∂∂
∂∂−=⎟
⎠⎞⎜
⎝⎛∂∂
∂∂=
∂∂
Methods for Advection!
Computational Fluid Dynamics
)(2
)()( 32
2
22 tOtxfUt
xfUtfttf Δ+Δ
∂∂+Δ
∂∂−=Δ+
Substituting!
Using central differences for the spatial derivatives!
�
f jn+1 = f j
n −UΔt2h
f j+1n − f j−1
n( ) + U2Δt 2
2h2f j+1n − 2 f j
n + f j−1n( )
2nd order accurate in space and time!
Stable for! 1<ΔhtU
Methods for Advection!Computational Fluid Dynamics
Two-Step Lax-Wendroff’s Method (LW-II)!
LW-I into two steps:!
For the linear equations, LW-II is identical to LW-I!
02/
2/)( 112/12/1 =
−+
Δ+− ++
++
hff
Ut
fff nj
nj
nj
nj
nj
02/12/1
2/12/1
1
=−
+Δ− +
−++
+
hff
Utff n
jnj
nj
nj
Step 1 (Lax)!
Step 2 (Leapfrog)!
- Stable for ! 1/ <Δ htU- Second order accurate in time and space !
Methods for Advection!
Computational Fluid Dynamics
MacCormack Method!
Similar to LW-II, without !
( )njnj
nj
tj ff
htUff −Δ−= +1
( )⎥⎦⎤
⎢⎣⎡ −Δ−+= −
+ tj
tj
tj
nj
nj ff
htUfff 1
1
21
Predictor!
Corrector!
- A fractional step method!!- Predictor: forward differencing!!- Corrector: backward differencing!
- For linear problems, accuracy and stability ! properties are identical to LW-I. !
2/1,2/1 −+ jj
Methods for Advection!Computational Fluid Dynamics
Second-Order Upwind Method!
Warming and Beam (1975) – Upwind for both steps!
( )nj
nj
nj
tj ff
htUff 1−−Δ−=
f j
n+1 =12
f jn + f j
t −U Δth
f jt − f j−1
t( ) −U Δth
f jn − 2 f j−1
n + f j−2n( )⎡
⎣⎢
⎤
⎦⎥
Predictor! Corrector!
Combining the two:!
f j
n+1 = f jn − λ f j
n − f j−1n( ) + 1
2λ(λ −1) f j
n − 2 f j−1n + f j−2
n( )- Stable if!- Second-order accurate in time and space !
20 ≤≤ λ
Methods for Advection!
Computational Fluid Dynamics
The one-step Lax-Wendroff is not easily extended to non-linear or multi-dimensional problems. The split version is.!!In the Lax-Wendroff and the MacCormack methods the spatial and the temporal discretization are not independent.!!Other methods have been developed where the time integration is independent of the spatial discretization, such as the Beam-Warming and various Runge-Kutta methods!
Methods for Advection!Computational Fluid Dynamics
FTCS!Unconditionally
Unstable!
Upwind!Stable for!
!
Implicit!Unconditionally!
Stable!
Lax-Friedrichs! Conditionally consistent!
Stable for !
0=+ xt Uff
02
111
=−
+Δ− −+
+
hff
Utff n
jnj
nj
nj ( ) xxxxx f
Uhf
Ut 2
22
2162
λ+−Δ−
011
=−
+Δ− −
+
hff
Utff n
jnj
nj
nj
( )
( ) xxx
xx
fUh
fUh
1326
12
22
+−−
−
λλ
λ
1≤λ
( ) xxxxx fUh
fUh 2
2
13
12
λλλ
−+⎟⎠⎞⎜
⎝⎛ −
( )0
2
11
11
1
=−
+Δ− +
−++
+
hff
Utff n
jnj
nj
nj
xxxxx ftUUhftU
⎥⎦⎤
⎢⎣⎡ Δ+−Δ 232
2
31
61
2
( )
( )0
2
2/
11
111
=−
+
Δ+−
−+
−++
hff
U
tfff
nj
nj
nj
nj
nj
1≤λ
Summary!
Computational Fluid Dynamics
Leap Frog!Stable for!
!
Lax-Wendroff I!Stable for!
!
Lax-Wendroff II!Same as LW-I!
Stable for!!
MacCormack!Same as LW-I!
Stable for!!
0=+ xt Uff
022
1111
=−
+Δ− −+
−+
hff
Utff n
jnj
nj
nj ( ) xxxf
Uh 16
22
−λ
( )
( ) xxxx
xxx
fUh
fUh
23
22
18
16
λλ
λ
−−
−−
1≤λ
1≤λ
1≤λ
( )
( )0
222
21122
111
=+−
Δ−
−+
Δ−
−+
−++
hfff
tU
hff
Utff
nj
nj
nj
nj
nj
nj
nj
02/
2/)( 112/12/1 =
−+
Δ+− ++
++
hff
Ut
fff nj
nj
nj
nj
nj
02/12/1
2/12/1
1
=−
+Δ− +
−++
+
hff
Utff n
jnj
nj
nj 1≤λ
( )01 =
−+
Δ− +
hff
Utff n
jnj
nj
tj
( ) ( )0
2/ 11
=−
+Δ+− −
+
hff
Utfff t
jtj
tj
nj
nj
Summary!Computational Fluid Dynamics
Beam-Warming!Stable for!
!
QUICK!Stable for!
!
ENO!
WENO!
0=+ xt Uff
( )
( ) 022
243
212
2
211
=+−Δ−
+−+
Δ−
−−
−−+
nj
nj
nj
nj
nj
nj
nj
nj
fffhtU
hfff
Utff
20 ≤≤ λ
( )( )
( ) ( ) xxxx
xxx
fUh
fUh
λλ
λλ
−−−
−−
218
216
23
2
�
f jn+1 − f j
n
Δt+
U3 f j
n + 6 f j−1n − f j−2
n( ) − 3 f j+1n + 6 f j
n − f j−1n( )
8h1≤λ
A large number of (conditionally) stable and accurate methods exists for hyperbolic equations with smooth solutions !
And Many More!!
Summary!