8/16/2019 Flux Conservative Problem
1/33
Outline
Flux Conservative Problems
Claret FelicitasJoe Reyes
Institute of MathematicsUniversity of the Philippines - Diliman
2 April 2016Math 271.2
Claret Felicitas Joe Reyes Flux Conservative Problems
http://find/
8/16/2019 Flux Conservative Problem
2/33
Outline
Outline
1 Flux Conservative Equation
2 1st Order Flux Conservative EquationStability Analysis of Numerical SolutionsForward Time Centered Space (FTCS)Lax Method
3 Sources of Error
Claret Felicitas Joe Reyes Flux Conservative Problems
http://find/
8/16/2019 Flux Conservative Problem
3/33
Outline
Outline
1 Flux Conservative Equation
2 1st Order Flux Conservative EquationStability Analysis of Numerical SolutionsForward Time Centered Space (FTCS)Lax Method
3 Sources of Error
Claret Felicitas Joe Reyes Flux Conservative Problems
http://find/
8/16/2019 Flux Conservative Problem
4/33
Outline
Outline
1 Flux Conservative Equation
2 1st Order Flux Conservative EquationStability Analysis of Numerical SolutionsForward Time Centered Space (FTCS)Lax Method
3 Sources of Error
Claret Felicitas Joe Reyes Flux Conservative Problems
http://find/
8/16/2019 Flux Conservative Problem
5/33
Flux Conservative Equation1st Order Flux Conservative Equation
Sources of Error
Flux Conservative Equation
A large class of PDEs can be cast into the form of a ux
conservative equation:∂ U ∂ t
= −∂ f ∂ x
∂ U , ∂ U x , ∂ U xx , . . .
Claret Felicitas Joe Reyes Flux Conservative Problems
http://find/
8/16/2019 Flux Conservative Problem
6/33
Flux Conservative Equation1st Order Flux Conservative Equation
Sources of Error
Flux Conservative Equation
Example: Flux Conservative Form for the Wave EquationWe consider the 1-D wave equation U tt = c 2U xx .If we let:
w = r s , where r = c ∂ U ∂ x and s = ∂ U
∂ t .
Then ∂ w ∂ t =∂ r ∂ t ∂ s ∂ t
= ∂ ∂ t c
∂ U ∂ x
∂ ∂ t
∂ U ∂ t
=c ∂ ∂ x
∂ U ∂ t
∂ 2U ∂ t 2
=c ∂ s ∂ x c ∂ r ∂ x
.
That is,∂ w ∂ t
= − ∂ ∂ x
0 − c − c 0
w = − ∂ ∂ x
f ( w ).
Claret Felicitas Joe Reyes Flux Conservative Problems
f
http://find/
8/16/2019 Flux Conservative Problem
7/33
Flux Conservative Equation1st Order Flux Conservative Equation
Sources of Error
Stability Analysis of Numerical SolutionsForward Time Centered Space (FTCS)Lax Method
1st Order Flux Conservative Equation
∂ U ∂ t
= − c ∂ U ∂ x
(1)
We introduce the change of variable ξ = x − ct and:
∂ ∂ t
= ∂ξ ∂ t
∂ ∂ξ
= − c ∂ ∂ξ
∂ ∂ x
= ∂ξ ∂ x
∂ ∂ξ
= ∂ ∂ξ
Then (1) holds.So U (x , t ) = U (ξ ) = f (x − ct ) is the analytic general solution of (1).
Claret Felicitas Joe Reyes Flux Conservative Problems
Fl C i E i S bili A l i f N i l S l i
http://find/
8/16/2019 Flux Conservative Problem
8/33
Flux Conservative Equation1st Order Flux Conservative Equation
Sources of Error
Stability Analysis of Numerical SolutionsForward Time Centered Space (FTCS)Lax Method
1st Order Flux Conservative Equation
We study the stability of different nite difference schemes insolving the 1st order Flux Conservative or 1-D Advection Equation:
U t = − cU x , x 0 ≤ x ≤ x 1, t 0 ≤ t ≤ T
We discretize the problem: ∆ x = x 1− x 0n+1 , ∆ t = T − t 0
m .And let the following:
x j = x 0 + j ∆ x , j = 0 , . . . , n + 1 ,
t k = t 0 + k ∆ t , k = 0 , . . . , m , and
U k j = U (x j , t k ).
Claret Felicitas Joe Reyes Flux Conservative Problems
Fl C ti Eq ti St bilit A l i f N i l S l ti
http://find/
8/16/2019 Flux Conservative Problem
9/33
Flux Conservative Equation1st Order Flux Conservative Equation
Sources of Error
Stability Analysis of Numerical SolutionsForward Time Centered Space (FTCS)Lax Method
Forward Time Centered Space (FTCS)
Using forward difference in time t and central difference in space x:
∂ U k j ∂ t
=U k +1 j − U
k j
∆ t + O (∆ t )
∂ U k j ∂ x
=U k j +1 − U
k j − 1
2∆ x + O (∆ x 2)
Using FTCS Method on U t = − cU x , we get:
U k +1 j = U k
j − c ∆ t 2∆ x
[U k j +1 − U k
j − 1] (2)
Claret Felicitas Joe Reyes Flux Conservative Problems
Flux Conservative Equation Stability Analysis of Numerical Solutions
http://find/http://goback/
8/16/2019 Flux Conservative Problem
10/33
Flux Conservative Equation1st Order Flux Conservative Equation
Sources of Error
Stability Analysis of Numerical SolutionsForward Time Centered Space (FTCS)Lax Method
von Neumann Stability Analysis of FTCS Method
DenitionLet p be a real spatial wavenumber and ξ = ξ (p ) be a complexnumber that depends on p . Then a difference equation is unstableif |ξ (p )| > 1 for some p . ξ is called the amplication factor .
Claret Felicitas Joe Reyes Flux Conservative Problems
Flux Conservative Equation Stability Analysis of Numerical Solutions
http://find/
8/16/2019 Flux Conservative Problem
11/33
Flux Conservative Equation1st Order Flux Conservative Equation
Sources of Error
Stability Analysis of Numerical SolutionsForward Time Centered Space (FTCS)Lax Method
von Neumann Stability Analysis of FTCS Method
We assume that independent solutions (eigenmodes) of ( 2) (or anydifference equation) are of the form:
U k j = ξ k e ipj ∆ x (3)
Claret Felicitas Joe Reyes Flux Conservative Problems
Flux Conservative Equation Stability Analysis of Numerical Solutions
http://find/
8/16/2019 Flux Conservative Problem
12/33
Flux Conservative Equation1st Order Flux Conservative Equation
Sources of Error
Stability Analysis of Numerical SolutionsForward Time Centered Space (FTCS)Lax Method
von Neumann Stability Analysis of FTCS Method
To nd ξ (p ) for FTCS Method, substitute ( 3) into (2):
ξ k +1 e ipj ∆ x = ξ e ipj ∆ x − c ∆ t 2∆ x
(ξ e ip ( j +1)∆ x − ξ e ip ( j − 1)∆ x )
= ξ e ipj ∆ x − c ∆ t 2∆ x (ξ e ipj ∆ x + ip ∆ x − ξ e ipj ∆ x − ip ∆ x )
= ξ k e ipj ∆ x 1 − c ∆ t 2∆ x
(e ip ∆ x − e − ip ∆ x )
⇒ ξ (p ) = 1 − ic ∆ t
∆ x sin(p ∆ x )⇒ | ξ (p )| ≥ 1 ∀p ⇒ FTCS Method is unconditionally unstable for solvingU t = − cU x .
Claret Felicitas Joe Reyes Flux Conservative Problems
Flux Conservative Equation Stability Analysis of Numerical Solutions
http://find/
8/16/2019 Flux Conservative Problem
13/33
Flux Conservative Equation1st Order Flux Conservative Equation
Sources of Error
Stability Analysis of Numerical SolutionsForward Time Centered Space (FTCS)Lax Method
Lax Method
Again, we are solving the Flux Conservative Equation: U t = − cU x .Instead of U k j in approximating U t , the Lax Method uses the
average for U k j = U k j +1 + U
k j − 1
2 :
∂ U k j ∂ t
=U k +1 j −
12 [U
k j +1 + U
k j − 1]
∆ t
Using centered difference again for U x , U t = − cU x becomes:
U k +1 j = 12
[U k j +1 + U k
j − 1] − c ∆ t 2∆ x
[U k j +1 − U k
j − 1] (4)
Claret Felicitas Joe Reyes Flux Conservative Problems
Flux Conservative Equation Stability Analysis of Numerical Solutions
http://find/
8/16/2019 Flux Conservative Problem
14/33
q1st Order Flux Conservative Equation
Sources of Error
y yForward Time Centered Space (FTCS)Lax Method
von Neumann Stability Analysis of Lax Method
Substituting U k j = ξ k e ipj ∆ x into (4):
ξ k +1 e ipj ∆ x = 1
2[ξ k e ip ( j +1)∆ x + ξ k e ip ( j − 1)∆ x ]
− c ∆ t 2∆ x
[ξ k e ip ( j +1)∆ x − ξ k e ip ( j − 1)∆ x ]
= ξ k e ipj ∆ x 12
(e ip ∆ x + e − ip ∆ x ) − c ∆ t 2∆ x
(e ip ∆ x − e − ip ∆ x )
⇒ ξ = cos (p ∆ x ) − ic ∆ t ∆ x sin(p ∆ x )
Claret Felicitas Joe Reyes Flux Conservative Problems
Flux Conservative Equation Stability Analysis of Numerical Solutions
http://find/
8/16/2019 Flux Conservative Problem
15/33
q1st Order Flux Conservative Equation
Sources of Error
y yForward Time Centered Space (FTCS)Lax Method
von Neumann Stability Analysis of Lax Method
The Lax Method is stable when |ξ |2 ≤ 1 :
|cos 2(p ∆ x ) + c 2∆ t 2
∆ x 2 sin
2(p ∆ x )| ≤ 1
⇒ | (1 − sin2(p ∆ x )) + c 2∆ t 2∆ x 2 sin
2(p ∆ x )| ≤ 1⇒ | 1 − (1 − c
2∆ t 2∆ x 2 )sin
2(p ∆ x )| ≤ 1⇒ 1 − c
2∆ t 2∆ x 2 ≥ 0
⇒ c 2∆ t
2
∆ x 2 ≤ 1⇒ ∆ t ≤ ∆ x c , (c > 0)
Claret Felicitas Joe Reyes Flux Conservative Problems
Flux Conservative Equation Stability Analysis of Numerical Solutions
http://find/
8/16/2019 Flux Conservative Problem
16/33
1st Order Flux Conservative EquationSources of Error
Forward Time Centered Space (FTCS)Lax Method
Courant Condition
DenitionThe Courant Condition means Lax Method is stable when∆ t ≤ ∆ x c .
Claret Felicitas Joe Reyes Flux Conservative Problems
Flux Conservative Equationd l
Stability Analysis of Numerical Solutionsd d ( )
http://find/
8/16/2019 Flux Conservative Problem
17/33
1st Order Flux Conservative EquationSources of Error
Forward Time Centered Space (FTCS)Lax Method
Courant Condition: Stable SchemesGeometrically, if U k
j is computed from information at points j − 1
and j + 1 at time k ,the scheme is stable when U k +1 j does notrequire information from points outside [U k j − 1, U
k j +1 ].
Claret Felicitas Joe Reyes Flux Conservative Problems
Flux Conservative Equation1 t O d Fl C ti E ti
Stability Analysis of Numerical SolutionsF d Ti C t d S (FTCS)
http://find/http://goback/
8/16/2019 Flux Conservative Problem
18/33
1st Order Flux Conservative EquationSources of Error
Forward Time Centered Space (FTCS)Lax Method
Courant Condition: Unstable SchemesSimilarly, unstable schemes arise when the time step ∆ t becomestoo large because U k +1 j requires information from points outside[U k j − 1, U
k j +1 ].
Claret Felicitas Joe Reyes Flux Conservative Problems
Flux Conservative Equation1st Order Flux Conservative Equation
Stability Analysis of Numerical SolutionsForward Time Centered Space (FTCS)
http://find/
8/16/2019 Flux Conservative Problem
19/33
1st Order Flux Conservative EquationSources of Error
Forward Time Centered Space (FTCS)Lax Method
von Neumann Stability Analysis for Wave Equation
U tt = c 2U xx .
Let w =
r s =
cU x U t
.
∂ w ∂ t =
∂ r ∂ t ∂ s ∂ t
=c ∂ s ∂ x c ∂ r ∂ x
= c ∂ ∂ x r s .
Claret Felicitas Joe Reyes Flux Conservative Problems
Flux Conservative Equation1st Order Flux Conservative Equation
Stability Analysis of Numerical SolutionsForward Time Centered Space (FTCS)
http://find/http://goback/
8/16/2019 Flux Conservative Problem
20/33
1st Order Flux Conservative EquationSources of Error
Forward Time Centered Space (FTCS)Lax Method
Lax Method
We will solve the wave equation using the Lax method:r t = cs x becomes
r k +1
j = 12[r
k j − 1 + r
k j +1 ] +
c ∆ t 2∆ x (s
k j +1 + s
k j − 1) (5)
s t = cr x becomes
s k +1 j = 1
2[s k j − 1 + s
k j +1 ] +
c ∆ t
2∆ x (r k j +1 + r
k j − 1) (6)
where r k j = r (x j , t k ) and s k
j = s (x j , t k )
Claret Felicitas Joe Reyes Flux Conservative Problems
Flux Conservative Equation1st Order Flux Conservative Equation
Stability Analysis of Numerical SolutionsForward Time Centered Space (FTCS)
http://find/
8/16/2019 Flux Conservative Problem
21/33
1st Order Flux Conservative EquationSources of Error
Forward Time Centered Space (FTCS)Lax Method
Lax Method
For von Neumann Stability Analysis assume eigen modes forr k j and s
k j are of the form
r k j s k j
= ξ k +1 e ipj ∆ x r 0 j s 0 j
⇒ solution is stable if |ξ | ≤ 1Equations (5) and (6) give
ξ − cos (p ∆ x ) − ic ∆ t ∆ x sin(p ∆ x )− ic ∆ t ∆ x sin(p ∆ x ) ξ − cos (p ∆ x )
Claret Felicitas Joe Reyes Flux Conservative Problems
Flux Conservative Equation1st Order Flux Conservative Equation
Stability Analysis of Numerical SolutionsForward Time Centered Space (FTCS)
http://find/
8/16/2019 Flux Conservative Problem
22/33
1st Order Flux Conservative EquationSources of Error
Forward Time Centered Space (FTCS)Lax Method
Lax Method
Remark
This has a solution only if determinant = 0.This gives ξ = cos (p ∆ x ) ± i c ∆ t ∆ x sin(p ∆ x ).This is stable if |ξ |2 ≤ 1 which gives same Courant condition∆ t ≤ ∆ x c .
Claret Felicitas Joe Reyes Flux Conservative Problems
Flux Conservative Equation1st Order Flux Conservative Equation
http://find/
8/16/2019 Flux Conservative Problem
23/33
st O de u Co se vat ve quat oSources of Error
Phase Errors through dispersion
We will show the effects of phase errors by studying the numericalsolution of the 1-D advection equation using different time stepswhich lead to dispersion being absent or present.
The Fourier mode U (x , t ) = e i (px + ω t ) is an exact solution of U t = − cU x if ω and p satisfy the dispersion relation ω = − cp ,then U (x , t ) = e ip (x − ct ) = f (x − ct ) gives the exact solution of U t = − cU x .
This mode is completely undamped and the amplitude is constantfor the numerical solution using a time step which satises thedispersion relation.
Claret Felicitas Joe Reyes Flux Conservative Problems
Flux Conservative Equation1st Order Flux Conservative Equation
http://find/
8/16/2019 Flux Conservative Problem
24/33
qSources of Error
Dispersion relation for the Lax Method
The dispersion relation is only satised if ∆ = ∆ x c .
Consider U k j = ξ k e ipj ∆ x
ξ = cos (p ∆ x ) − ic ∆ t
∆ x sin(p ∆ x )
= e − ip ∆ x + i (1 − c ∆ t ∆ x
)sin(p ∆ x )
If we let ∆t ≤ ∆ x c
⇒ ξ = e ip ∆ x and U k j
= ξ k e ipj ∆ x =e ip (− k ∆ x + j ∆ x ) . When we substitute x j = j ∆ x , t k = k ∆ t and thedispersion relation ∆x = c ∆ t then U k j = e
ip (− ck ∆ x + j ∆ x )
= e ip (x j − ct k ) = f (x j − ctk ).
Claret Felicitas Joe Reyes Flux Conservative Problems
Flux Conservative Equation1st Order Flux Conservative Equation
http://goforward/http://find/http://goback/
8/16/2019 Flux Conservative Problem
25/33
Sources of Error
Dispersion in the numerical solution of the 1-D advectionequation using the Lax Method
Use Lax Method to solve:
U t + U x = 0 , 0 ≤ x ≤ 2 ≈ ∞ , 0 ≤ t ≤ 1
initial conditions:
U (x , 0) = 1,0.2≤ x ≤ 0.40, otherwise = U 0(x )
boundary conditions:
U (0, t ) = U (2, t ) = 0
Claret Felicitas Joe Reyes Flux Conservative Problems
Flux Conservative Equation1st Order Flux Conservative Equation
http://goforward/http://find/http://goback/
8/16/2019 Flux Conservative Problem
26/33
Sources of Error
Dispersion in the numerical solution of the 1-D advectionequation using the Lax Method
U (x , t ) = U 0(x − ct )U 0(x − t )(c = 1)We compare the above exact solution with the numerical solutionusing the Lax method with different time steps:
∆ t = ∆ x c → no dispersion matches analytic solution.∆ t = ∆ x 2c → dispersion present but pulse matches speed of wave.∆ t = 1.001∆ x c → courant condition not met : unstable!
Claret Felicitas Joe Reyes Flux Conservative Problems
Flux Conservative Equation1st Order Flux Conservative Equation
S f E
http://find/
8/16/2019 Flux Conservative Problem
27/33
Sources of Error
Dispersion in the numerical solution of the 1-D advectionequation using the Lax Method
Equation (4) gives U k +1 j = 12 [U
k j +1 + U
k j − 1] −
c ∆ t 2∆ x [U
k j +1 − U
k j − 1]
Let s = c∆ t ∆ x
⇒ U k +1 j
= 1
2(1 − s )U k
j +1 + U k
j − 1 +
1
2(1 + s )U k
j − 1
Solve for U k +1 j for 0 ≤ k ≤ m, 1 ≤ j ≤ 3 with boundaryconditions: U k 0 = 0, U
k 4 = 0. We have:
Claret Felicitas Joe Reyes Flux Conservative Problems
Flux Conservative Equation1st Order Flux Conservative Equation
S f E
http://find/
8/16/2019 Flux Conservative Problem
28/33
Sources of Error
Dispersion in the numerical solution of the 1-D advectionequation using the Lax Method
or U k +1 = A U k b
Dispersion means the initial pulse changes shape (unlike analyticalsolution) because wave components with different frequenciestravel at different speeds.
Claret Felicitas Joe Reyes Flux Conservative Problems
Flux Conservative Equation1st Order Flux Conservative Equation
Sources of Error
http://find/
8/16/2019 Flux Conservative Problem
29/33
Sources of Error
Dispersion in the numerical solution of the 1-D advectionequation using the Lax Method
(a) ∆ t = ∆ x 2c where dispersion is present but the pulse matches theanalytical solution for the speed of the wave.
Claret Felicitas Joe Reyes Flux Conservative Problems
Flux Conservative Equation1st Order Flux Conservative Equation
Sources of Error
http://find/http://goback/
8/16/2019 Flux Conservative Problem
30/33
Sources of Error
Dispersion in the numerical solution of the 1-D advectionequation using the Lax Method
(b) ∆ t = ∆ x c where no dispersion is present and numerical solutionmatches analytical solution exactly.
Claret Felicitas Joe Reyes Flux Conservative Problems
Flux Conservative Equation1st Order Flux Conservative Equation
Sources of Error
http://find/
8/16/2019 Flux Conservative Problem
31/33
Sources of Error
Dispersion in the numerical solution of the 1-D advectionequation using the Lax Method
(c) ∆ t = 1.001∆ x c where the Courant condition is not met andsolution is becoming unstable.
Claret Felicitas Joe Reyes Flux Conservative Problems
Flux Conservative Equation1st Order Flux Conservative Equation
Sources of Error
http://goforward/http://find/http://goback/
8/16/2019 Flux Conservative Problem
32/33
Sources of Error
Error due to nonlinear terms
Example: Shock wave equation
U t + UU x = 0
nonlinear term causes wave prole to steepen resulting in ashock.
schemes stable for linear problems can become unstable.
Claret Felicitas Joe Reyes Flux Conservative Problems
Flux Conservative Equation1st Order Flux Conservative Equation
Sources of Error
http://find/
8/16/2019 Flux Conservative Problem
33/33
Aliasing error
Example:Aliasing error occurs when a short wavelength (λ 1) is notrepresented well by the mesh-spacing (∆x ), and may bemisinterpreted as a longer wavelength oscillation (λ 2).
Claret Felicitas Joe Reyes Flux Conservative Problems
http://find/