Esquemas Para Ec. de Convedascción
-
Upload
agustina-ravettino -
Category
Documents
-
view
217 -
download
0
Transcript of Esquemas Para Ec. de Convedascción
-
8/18/2019 Esquemas Para Ec. de Convedascción
1/8
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
! x2= 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
! =1
2ab ± b2
" 4ac( )
b = 0; a =1; c =!c2
We can also use
with
To find the characteristics
Wave equation
Computational Fluid Dynamics
t
x
P
Two characteristic lines dt
dx= +
1
c; dt
dx= !
1
c
dt
dx= +
1
c
dt
dx= !
1
c
Wave equation
Computational Fluid Dynamics
l1
! u
! t " c2
! v
! x= 0
# $ %
& ' (
+l2
! v
! t "
! u
! x = 0
# $ %
& ' (
!" !1
!c2 !"
#
$%%
&
'((
l1
l2
#
$
%%
&
'
((= 0
!" = cTo find the solution we needto find the eigenvectors
Take l1=1
!c l1! l
2= 0 " l
2=!cFor ! = +c
+c l1! l
2= 0 " l
2= +cFor ! ="c
Wave equation
Computational Fluid Dynamics
1 ! u
! t " c2
! v
! x = 0
# $ %
& ' ( " c
! v
! t " ! u
! x = 0
# $ %
& ' ( Add the
equations
l1=1 l
2=!cFor ! = +c
For ! ="c
l1=1 l
2= +c
! u
! t + c
! u
! x
"
# $
%
& ' ( c
! v
! t + c
! v
! x
"
# $
%
& ' = 0
du
dt ! c
dv
dt = 0 on
dx
dt = +c
du
dt + c
dv
dt = 0 on
dx
dt = !c
Relationbetween the
total derivative
on thecharacteristic Similarly:
Wave equation
-
8/18/2019 Esquemas Para Ec. de Convedascción
2/8
Computational Fluid Dynamics
For constant c
du
dt
! c dv
dt
= 0 on dx
dt
= +c
du
dt + c
dv
dt = 0 on
dx
dt = !c
dr1
dt = 0 on
dx
dt = +c where r
1= u ! cv
dr2
dt = 0 on
dx
dt = !c where r
2= 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 ofInfluence
Domain ofDependence
t
x
P
Two characteristic lines dt
dx= +
1
c; dt
dx= !
1
c
dt
dx= +
1
c
dt
dx= !
1
c
Wave equation-general
Computational Fluid Dynamics
Ill-posedproblems
Computational Fluid Dynamics
Ill-posed Problems
! 2 f
! t 2 = "
! 2 f
! x2
Consider the initial value problem:
! 2 f
! t 2 +
! 2 f
! x2 = 0
This is simply Laplace’s equation
which has a solution if " f / "t or f are given onthe boundaries
Computational Fluid Dynamics
Here, however, this equation appeared as an initialvalue problem, where the only boundary conditionsavailable 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
-
8/18/2019 Esquemas Para Ec. de Convedascción
3/8
Computational Fluid Dynamics
Look for solutions of the type:
f = ak (t )eikx
d 2a
k
dt 2
= k 2a
k
Substitute into: !
2 f
! t 2 +
! 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 dependon the initial conditions
Computational Fluid Dynamics
)0(;)0( ikaa
d 2a
k
dt 2
=
k
2
ak
determined by initial conditions
General solution
ak (t ) = Ae
kt + Be
!kt
B A,
Therefore: !")(t a 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 wavenumber modes and is therefore an ill-posed problem
Similarly, it can be shown that the diffusionequation with a negative diffusion coefficient
Ill-posed Problems
Computational Fluid Dynamics
Ill-posed problems generally appear when the initial orboundary data and the equation type do not match.
Frequently arise because small but important higher ordereffects 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 andsome viscoelastic constitutive models are examples ofproblems that exhibit ill-posedness.
Ill-posed Problems
Computational Fluid Dynamics
Classical Methodsfor Hyperbolic
Equations
-
8/18/2019 Esquemas Para Ec. de Convedascción
4/8
Computational Fluid Dynamics
! 2 f
! t 2 " c 2 !
2 f
! x2= 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
a12
a21
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) andUpwind
Computational Fluid Dynamics
We will start by examining the linear advection equation:
! f
! t + U
! f
! x= 0
The characteristic for this equation are:
dx
dt =U ;
df
dt = 0;
Showing that theinitial 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 spacediscretization yields
! f
! t + U
! f
! x= 0
f j n+1
= f j n! "t
2hU ( f j +1
n! f j !1
n)
j-1 j j+1
n
n+1
Methods for Advection
Computational Fluid Dynamics
This scheme is O(#t, h2) accurate, but a stabilityanalysis shows that the error grows as
! n+1
! n =1" i
U #t
2hsin kh
Since the amplificationfactor has the form 1+i()
the absolute value of this
complex number is alwayslarger than unity and the
method is unconditionallyunstable for this case.
iU !t
2hsinkh
1
! n+1
! n
Methods for Advection
Computational Fluid Dynamics
A simple forward in time but “upwind” in spacediscretization yields
! f
! t + U
! f
! x= 0
f j n+1
= f j n! " t
hU ( f j
n! f j !1
n)
j-1 j
n
n+1 This schemeis O(#t, h)
accurate.
Another scheme for
Flow direction
Methods for Advection
-
8/18/2019 Esquemas Para Ec. de Convedascción
5/8
Computational Fluid Dynamics
To examine the stability we use the von Neuman’s method:
! j
n+1" ! j
n
#t +U
h(! j
n" ! j "1
n) = 0
! j n= !
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! ikh
Or: G
-
8/18/2019 Esquemas Para Ec. de Convedascción
6/8
Computational Fluid Dynamics
Finite Volume point of view:
x j -1/2 x j +1/2
f j !1 f j
x
f
f j +1
f j n+1
= f j n! "t
h(F j +1/ 2
n! F j !1/ 2
n) = f j
n! "t
hU ( f j
n! f j !1
n)
F j +1/ 2=Uf j n
F j !1/ 2=Uf j !1n
Methods for Advection
Computational Fluid Dynamics
Generalized Upwind Scheme (for both U > 0 and U < 0 )
f j n+1
= f j n!U "t
h( f j
n! f j !1
n ), U > 0
f j
n+1= f j
n!U "t
h( f j +1
n! f j
n), U < 0
Define: U +
=1
2U + U ( ), U ! =
1
2U ! U ( )
The two cases can be combined into a single expression:
f j
n+1= f j
n! "t
hU +( f j
n! f j !1
n)+ U
!( f j +1
n! f j
n)[ ]
Or, substituting !+
U U ,
f j n+1
= f j n!U
"t
2h( f j +1
n! f j !1
n)+
U "t
2h( f j +1
n! 2 f j
n+ f j !1
n)
central difference + numerical viscosity Dnum =U h
2
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
1
1
1
1
1
=!+"
!+
!
+
+
+
n
j
n
j
n
j
n
j f f
h
U
t
f f
n
j
n
j
n
j
n
j f
t f
h
U f
t f
h
U
!="
!+
+
"
++
+
1
2
1
2
1
1
11
1
j
n
j j
n
j j
n
j j C f b f d f a =++
+
!
++
+
1
1
11
1
Methods for Advection
Computational Fluid Dynamics
Lax-Fredrichs method
- stable for $ < 1
- 1st order in time, 1nd order in space - Conditionally consistent
f j n+1
! 1
2 f j +1
n+ f j !1
n( )"t
+U
2h f j +1
n! f j !1
n( ) = 0
( ) xxx xx
f Uh
f Uh
2
2
13
1
2! !
! "+#
$ %
&' ( "
Error term:
! =U "t
h
h
! =
h2
U "t
Methods for Advection
Computational Fluid Dynamics
Second Order Schemes
-
8/18/2019 Esquemas Para Ec. de Convedascción
7/8
Computational Fluid Dynamics
)(2
2
11
t Ot
f f
t
f n
j
n
j!+
!
"=
#
# "+
Leap Frog Method
The simplest stable second-order accurate (in time) method:
Modified equation
( )n j
n
j
n
j
n
j f f h
t U f f
11
11
!+
!+!
"!=
( ) !+!="
"+
"
" xxx
f Uh
x
f U
t
f 1
6
2
2
#
- Stable for 1
- Dispersive (no dissipation) – error will not damp out
- Initial conditions at two t ime levels- Oscillatory solution in time (alternating)
! =U "t
h
Methods for Advection
Computational Fluid Dynamics
!+!
"
"+
!
"
"+!
"
"+=!+
62)()(
3
3
32
2
2 t
t
f t
t
f t
t
f t f t t f
Lax-Wendroff’s Method (LW-I)
First expand the solution in time
Then use the original equation to rewrite the time derivatives
x
f U
t
f
!
!"=
!
!
2
2
2
2
2
x
f U
t
f
xU
x
f U
t t
f
t t
f
!!
=
!!
!!
"=# $ %
&' (
!!
!!
"=# $ %
&' ( !!
!!
=
!!
Methods for Advection
Computational Fluid Dynamics
)(2
)()( 32
2
22 t O
t
x
f U t
x
f U t f t t f !+
!
"
"+!
"
"#=!+
Substituting
Using central differences for the spatial derivatives
f j
n+1= f j
n!U "t
2h f
j +1
n! f j !1
n( ) +U 2"t 2
2h2
f j +1
n! 2 f j
n+ f j !1
n( )
2nd order accurate in space and time
Stable for 1<!
h
t U
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/)(11
2/1
2/1=
!+
"
+!++
+
+
h
f f U
t
f f f n
j
n
j
n
j
n
j
n
j
0
2/1
2/1
2/1
2/1
1
=
!+
"
! +
!
+
+
+
h
f f U
t
f f n
j
n
j
n
j
n
j
Step 1 (Lax)
Step 2 (Leapfrog)
- Stable for 1/
- Second order accurate in time and space
Methods for Advection
Computational Fluid Dynamics
MacCormack Method
Similar to LW-II, without
( )n j
n
j
n
j
t
j f f h
t U f f !
"!=
+1
( )!"#$%
& '('+= '+ t
j
t
j
t
j
n
j
n
j f f
ht U f f f
1
1
2
1
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 !+ j j
Methods for Advection
Computational Fluid Dynamics
Second-Order Upwind Method
Warming and Beam (1975) – Upwind for both steps
( )n j
n
j
n
j
t
j f f h
t U f f
1!!
"!=
f j
n+1=
1
2 f
j
n+ f
j
t !U "t h
f j
t ! f j!1
t ( ) !U "t h
f j
n ! 2 f j!1
n+ f
j!2
n( )#$% &
'(
Predictor Corrector
Combining the two:
f j
n+1= f
j
n! " f
j
n! f
j!1
n( ) +1
2" (" ! 1) f
j
n! 2 f
j!1
n+ f
j!2
n( )
- Stable if - Second-order accurate in time and space
20 !! "
Methods for Advection
-
8/18/2019 Esquemas Para Ec. de Convedascción
8/8
Computational Fluid Dynamics
The one-step Lax-Wendroff is not easily extended tonon-linear or multi-dimensional problems. The splitversion is.
In the Lax-Wendroff and the MacCormack methodsthe spatial and the temporal discretization are notindependent.
Other methods have been developed where the time
integration is independent of the spatial discretization,
such as the Beam-Warming and various Runge-Kuttamethods
Methods for Advection
Computational Fluid Dynamics
FTCSUnconditionally
Unstable
UpwindStable for
ImplicitUnconditionally
Stable
Lax-Friedrichs Conditionallyconsistent
Stable for
0=+ xt
Uf f
02
11
1
=
!+
"
!!+
+
h
f f U
t
f f n jn
j
n
j
n
j ( ) xxx xx f Uh
f U
t 222
2162
! +"#"
01
1
=
!+
"
!!
+
h
f f U
t
f f n jn
j
n
j
n
j
( )
( ) xxx
xx
f Uh
f Uh
1326
12
2
2
+!!
!
" "
"
1!"
( ) xxx xx f Uh
f Uh
2
2
13
1
2! !
! "+#
$ %
&' ( "
( )0
2
1
1
1
1
1
=!
+"
! +
!
+
+
+
h
f f U
t
f f n j
n
j
n
j
n
j xxx xx f t U Uh f
t U !"
#$%
&'+(
' 232
2
3
1
6
1
2
( )0
2
2/
11
11
1
=!
+
"
+!
!+
!+
+
h
f f U
t
f f f
n
j
n
j
n
j
n
j
n
j
1!"
Summary
Computational Fluid Dynamics
Leap FrogStable for
Lax-Wendroff IStable for
Lax-Wendroff II
Same as LW-IStable for
MacCormack
Same as LW-IStable for
0=+ xt
Uf f
022
11
11
=
!+
"
!!+
!+
h
f f U
t
f f n j
n
j
n
j
n
j ( ) xxx f Uh
16
2
2
!"
( )
( ) xxxx
xxx
f Uh
f Uh
2
3
2
2
18
16
! !
!
""
""
1!"
1!"
1!"
( )0
2
2
2
2
1122
11
1
=+!
"!
!+
"
!
!+
!+
+
h
f f f t U
h
f f U
t
f f
n
j
n
j
n
j
n
j
n
j
n
j
n
j
02/
2/)(11
2/1
2/1=
!+
"
+!++
+
+
h
f f U
t
f f f n j
n
j
n
j
n
j
n
j
0
2/1
2/1
2/1
2/1
1
=
!+
"
! +
!
+
+
+
h
f f U
t
f f n j
n
j
n
j
n
j 1!"
( )0
1
=!
+"
!+
h
f f U
t
f f n j
n
j
n
j
t
j
0
2/1
1
=
!
+"
+!!
+
h
f f
U t
f f f t j
t
j
t
j
n
j
n
j
Summary
Computational Fluid Dynamics
Beam-WarmingStable for
QUICKStable for
ENO
WENO
0=+ xt
Uf f
( ) 022
2
43
212
2
21
1
=+!"
!
+!+
"
!
!!
!!
+
n
j
n
j
n
j
n
j
n
j
n
j
n
j
n
j
f f f h
t U
h
f f f U
t
f f
20 !! "
( )( )
( ) ( ) xxxx
xxx
f Uh
f Uh
! !
! !
"""
""
218
216
2
3
2
f j n+1! f j
n
"t +
U 3 f j
n+ 6 f j !1
n! f j !2
n( ) ! 3 f j +1n+ 6 f j
n! f j !1
n( )8h
1!"
A large number of (conditionally) stable andaccurate methods exists for hyperbolic equationswith smooth solutions
And Many More!
Summary