Lecture 7 18.086

advertisement
Lecture 7
18.086
Last time: Diffusion Numerical scheme (FD)
•
Heat equation is dissipative, so why not try Forward Euler:
Uj,n+1
Uj,n
t
•
•
•
•
=
Uj+1,n
2Uj,n + Uj
x2
1,n
Expected accuracy: O(Δt) in time, O(Δx2) in space.
t
1
Stability in the usual way gives R =

2
x
2
We can use previous ODE methods using the old method of lines, of course…
-2
Or implicit methods (see book, 6.5). Notice that matrix contains O(Δx ) terms and is stiff!
Advection + diffusion
For incompressible flows, a concentration c advects and diffuses via a
combination of a heat with 1-way wave equation:
1D:
ct = Dcxx + vcx
Peclet number measures dominance of diffusion vs. advection:
cL
=
D
Remember: Diffusion is easy, but advection (1-way!) is tricky: numerical
dispersion, oscillations (e.g. Lax-Wendroff). So, for Pe<<1, it is usually ok to
just solve the diffusion problem!
What about Pe>>1? Can we do the same (drop diffusion term)?
Advection + diffusion
For a characteristic scale of L0=D/c:
Length scales below L0: Diffusion-dominated
Length scales above L0: Advection-dominated
Small L0=D/c (i.e. large Peclet number)
creates a boundary layer, where the
solution significantly deviates from the
pure advection solution u(x) = 0
L0=D/c=1/40
L0=D/c=1/20
L0=D/c=1/10
Lecture:
Example
~L0
Advection + diffusion
In other words: To correctly resolve physics at smaller scales L<L0 (in
particular inside the boundary layer!), one typically wants
x  L0
We can express this using the Cell-Peclet number:
=> Can define Cell-Peclet number:
x
c x
r
P =
=
=
2L0
2D
2R
CFL for advection, e.g.
t
r=c
1
x
Stability for diffusion, e.g.
D t
1
R=

2
x
2
The difficulty is now to choose a numerical scheme that is good for advection
& diffusion, while keeping P below 1 (to resolve small features, e.g. boundary
layers)
me, centered convection, centered explicit diffusion
FD
schemes
for
AD
me, upwind convection, centered explicit diffusion
problems
ection (centered or upwind), with implicit diffusion.
510
Chapter 6
Explicit
w
Initial Value Problems
U j , n + l = ( 1 - 2 R ) U j , n + ( R + R P ) U J + l , n + ( R - R P ) U J - 1 , n . (38)
Those three coefficients add to 1, and U = constant certainly solves equation (37).
If all three coeficients are positive, the method is surely stable. More
ut = cux + duxx
that, oscillations
will not appear.
the effects of r andthan
R and
(we replace
7-12Positivity
by R Pof) :1- 2R requires R 5 $, as usual
First try: Centered for
differences:
diffusion. Positivity of the other two coefficients requires IPI <
- 1. In avoiding
numerical oscillations, cell sizes Ax 5 2d/c are crucial to the quality of U .
Uj+l,n
Uj-1,n
Uj,n+l - Uj,n
+ d[146]
A
:
4 , nthe oscillations for P > 1. Notice how
Figure
6.14from
Strikwerda
shows
=the
c initial hat function is smoothed and spread and shrunk
(37)
by diffusion. The
At
2Ax
'
oscillations might pass the usual stability test IGI 5 1, but they are unacceptable.
P
AX)^
new
1
|1
Stable Uj,n+l
for R  is , a|Pcombination
value
2
Second order accurate in
space
Potentially stable for P>1, but oscillations!
see Lecture
of three values at time n.
FD schemes for AD
problems
ut = and
cux +
duxx numerical oscillations from P > 1.
usion with
without
.14: Convection-diffusion
with and without numerical oscillations from P > 1.
Upwind differences (c>0)
2
0

r
 2R 
1to oscillations
Stable
dropped
toforfirst
But
are oscillations
eliminated are eliminated
-sided
accuracy
hasorder.
dropped
first order. But
+
r + 2R

1 , because
No oscillations
allincoefficients
are positive:
rcondition
r 2R
5 ensures
1. Thatforthree
condition
ensures
threethen
positive
coefficients
in (39):
positive
coefficients
(39):
First
order
accuracy…
nts
are
still
going,
comparing
the centered
the upwind method.
omparing the centered
method
and the method
upwindand
method.
erence between the two convection terms, upwind minus centered, is a
two convection
terms,see
upwind
minus centered, is a
Extra diffusion…
Lecture
n term hidden in (39): this is an interesting identity !
): this is an interesting identity !
diffusion
Summary
ll going, comparing the centered method and the upwind method.
tween the two convection terms, upwind minus centered, is a
den in (39): this is an interesting identity !
•
n U,+l
Simple explicit schemes: Low accuracy and / or dispersion and / or
extra
- U, diffusion.
- U3+1- U,-l
Ax
-
2Ax
(41)
Implicit schemes: Possible, unconditionally stable (see e.g. CrankNicholson
scheme
in
book),
but
usually
not
efficient
enough.
has this extra numerical diffusion or "art.ificia1 viscosity."
•
et hod
al damping
andpossibility:
it reduces
accuracy.
Theexcept
upwind
• Another
Dothe
everything
explicit,
the approximation
problematic
diffusion
term: Nobody is perfect.
the exact
solution.
ion
Uj,n+l - Uj,n
at
Uj+l,n
- Uj,n + d a:
=C
Ax
u,,n+l
(Ax)Z
Nonlinear transport &
conservation laws
•
What if transport becomes nonlinear?
This section will explain how p = 2 has been attained without oscillation at sh
Nonlinear smoothers are added to Lax-Wendroff (I think only nonlinear terms
truly defeat Gibbs). Do not underestimate that achievement. Second order accu
is the big step forward, and oscillation was once thought to be unavoidable.
Nonlinear transport &
conservation
laws
Burgers' Equation and Characteris
A first attempt at understanding what is going on comes from analyzing the
characteristic
lines example, together with traffic flow, is Burgers'
The
outstanding
•
equation
flux
f (u) = $u2. The "inviscid" equation has no viscosity vu,, to prevent sh
• Simplest example:
du
dx
lnviscid Burgers' equation
•
u(x, t) law
= u(x
ut,ways:
0)
We
useapproach
the implicit
ansatz
Wecan
will
this
conservation
in three
for initial conditions 1.Characteristics
By following
characteristics until they separate or collide (trouble arrives)
•
u(x, 0) = 1
x
all meet in (x,t)=(1,1)!
Lecture
2.
By an exact formula (17), which is possible in one space dimension
3.
By finite difference and finite volume methods, which are the practical ch
•
Solution is not defined at (x,t)=(1,1) => so what do we do?
A fourth (good) way adds vu,,.
The limiting u as v
-+0
is the viscosity solu
Start with the linear equation ut = c u, and u(x, t) = u(x
+ ct, 0).
The i
truly defeat Gibbs). Do not underestimate that achievement. Second order accurac
is the big step forward, and oscillation was once thought to be unavoidable.
NonlinearBurgers'
transport
&
Equation and Characteristic
laws
The outstanding conservation
example, together with traffic flow,
is Burgers' e q u a t i o n w i t
520
Chapter 6
Initial Value Problems
characteristic lines have different slopes, they can meet (carrying different uo).
fluxIn this
fWhen
(u)
=example,
$u2. allThe
equation
haspoint
no xviscosity
vu,, to prevent shock
extreme
lines x"inviscid"
- (1- xo)t = xo
meet at the same
= 1, t = 1.
•
moreufamous
of issues
with
characteristics
is the
TheAsolution
= (1- x ) /example
( l - t) becomes
010 at that
point.
Beyond their meeting
point,Riemann
the characteristics cannot decide u(x, t).
• Take again
Burger’s
equation:
lnviscid
Burgers'
equation
problem:
du
dx
1.
A more fundamental example is the R i e m a n n problem, which starts from two
constant values u = A and u = B. Everything depends on whether A > B or A < B.
> B, solution
the characteristics
meet.
the for
rightinitial conditions
the left side problem:
of Figure 6.15,How
with A
•OnRiemann
does
evolve
in On
time
We
will
approach
this
conservation
law
in
three
ways:
side, with A < B, the characteristics separate. In both cases, we don't have a single
characteristic through each point that is safely carrying one correct initial value. This
Riemann
problem has two
characteristics through
some
points,
or none: or collide (trouble arrives)
By following
characteristics
until
they
separate
t
t
u(x, 0) = A, x < 0 , and u(x, 0) = B, x
0
2.
By an exact formula (17), which is possible in one space dimension
3.
By finite difference and finite volume methods, which are the practical choice
A fourth (good) way adds vu,,.
The limiting u as v
-+0
is the viscosity solution
+
Start with the linear equation ut = c u, and u(x, t) = u(x ct, 0). The initi
value at xo is carried along the characteristic line x ct = xo. Those lines are parall
A > B: shock
A < B: fan
when the velocity c is a constant. No chance that characteristic lines will meet.
+
Figure 6.15: A shock when characteristics meet, a fan when they separate.
Download