Lecture 10 18.086

advertisement
Lecture 10
18.086
Info
•
No lecture on Thursday in a week
(March 17)
•
PSet back tonight
Nonlinear transport &
conservation laws
•
What if transport becomes nonlinear?
on will explain
Thishow
section
explain
how p = without
p =will
2 has
been attained
2 has been
oscillation
attainedatwithout
shocks.oscillation at sh
oothersNonlinear
are addedsmoot
to LaxhersWendroff
are added
(I to
think
Lax-only
Wendroff
nonlinear
(I think
termsonly
cannonlinear terms
Gibbs). truly
Do not
defeat
underestimate
Gibbs). Dothat
not achievement.
underestimateSecond
that achievement.
order accuracy
Second order accu
p forward,
is the
andbigoscillation
step forward,
was once
and oscillation
thought towas
be unavoidable.
once thought to be unavoidable.
Remember: Nonlinear
transport
Burgers' Equation
Burgers'
and Characteristics
Equation and Characteris
A first attempt at understanding what is going on comes from analyzing the
characteristic
lineswith
example,
The
outstanding
together
example,
traffictogether
flow, is with
Burgers'
traffic eflow,
q u a t iiso nBurgers'
with
•
ing
equation
$u2. The
flux
"inviscid"
f (u) = $u2.
equation
The has
"inviscid"
no viscosity
equation
vu,, has
to no
prevent
viscosity
shocks:
vu,, to prevent sh
• Simplest example:
urgers' equation
lnviscid Burgers' equation
du
dx
du
dx
u(x,
= u(x
ut,ways:
0)
We
useapproach
the implicit
ansatz
pproach• this
Wecan
conservation
will
lawthis
in
three
conservation
ways:t) law
in three
for initial conditions 1.Characteristics
owing characteristics
By following
until
characteristics
they separate or
until
collide
they(trouble
separatearrives)
or collide (trouble arrives)
•
u(x, 0) = 1
x
all meet in (x,t)=(1,1)!
2.
xact formula
By
(17),
an which
exact formula
is possible
(17),
in which
one space
is possible
dimension
in one space dimension
e difference
By finite
finite difference
volume methods,
and finite
which
volume
are methods,
the practical
which
choice.
are the practical ch
3. and
•
Solution is not defined at (x,t)=(1,1) => so what do we do?
od) wayAadds
fourth
vu,,.(good)
Theway
limiting
adds uvu,,.
as v The
-+0 limiting
is the viscosity
u as v -+
solution.
0 is the viscosity solu
+
+
h the linearStart
equation
with the
equation
ut =linear
c u, and
u(x, t)
ut ==u(x
c u, and
ct, 0).
u(x,The
t) =initial
u(x ct, 0). The i
bs). Do not underestimate that achievement. Second order accuracy
orward, and oscillation was once thought to be unavoidable.
Nonlinear
transport
&
Burgers' Equation and Characteristics
conservation
example, together with
traffic flow, is Burgers' e qlaws
uation with
520
Chapter 6
Initial Value Problems
When characteristic lines have different slopes, they can meet (carrying different uo).
u2. TheIn "inviscid"
equation has no viscosity vu,, to prevent shocks:
this extreme example, all lines x - (1- xo)t = xo meet at the same point x = 1, t = 1.
ers'
•
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:
equation
problem:
du
A more fundamental example is the R i e m a n n problem,
dxwhich 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
the left side problem:
of Figure 6.15,How
with A
•OnRiemann
does
evolve
in On
time
oach 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: arrives)
ng characteristics
until
they
separate
or collide
(trouble
t
t
u(x, 0) = A, x < 0 , and u(x, 0) = B, x
0
ct formula (17), which is possible in one space dimension
ifference and finite volume methods, which are the practical choice.
way adds vu,,.
The limiting u as v
-+0
is the viscosity solution.
+
he linear equation ut = c u, and u(x, t) = u(x ct, 0). The initial
ried along the characteristic line x ct = xo. Those lines are parallel
A > B: shock
A < B: fan
y c is a constant. No chance that characteristic lines will meet.
+
Figure 6.15: A shock when characteristics meet, a fan when they separate.
conditions
How to find shock wave or
fan solution?
•
Physically, we could add a bit of diffusion to avoid
discontinuities, then let D -> 0
•
Not very feasible numerically…
•
Note: There is an example in the book (analytical) for
ut + uux = ✏ux x
see Lect.
is the big step forward, and oscillation was once thought to be unavoidable.
Burgers' Equation and Characteri
Conservation laws
The outstanding example, together with traffic flow, is Burgers' e q u a t i o n
flux f (u) = $u2. The "inviscid" equation has no viscosity vu,, to prevent sh
•
•
•
Burger’s equation
lnvisciddiscontinuities
Burgers' equation
creates
du
dx
Mathematical
description
using integral
We will approach
this conservation
law in form
three(=conservation
ways:
law)
1.
By following characteristics until they separate or collide (trouble arrives
In general, conservation laws read
2.
By an exact formula (17),
Z b which is possible in one space dimension
d
ut + f (u, ux , . . .)x = 0 ()
udx + f (u(b), ux (b), . . .) f (u(a), ux (a), . . .) = 0
dt afinite volume methods, which are the practical ch
By finite difference and
3.
A fourth (good) way adds vu,,.
•
The limiting u as v
-+0
is the viscosity solu
Special form above: Diffusion is also a conservation law…
Start with the linear equation ut = c u, and u(x, t) = u(x
+ ct, 0).
The
value at xo is carried along the characteristic line x ct = xo. Those lines are pa
when the velocity c is a constant. No chance that characteristic lines will meet
+
The conservation law ut
+ uu,
= 0 will be solved by u(x, t) = u(x
-
Weak solutions
•
520 forChapter
6 and
Initialall
Value
Problems
Integral form is not very handy, because we have to show it holds
all times
intervals
•
Instead: Use the weak form: Multiply PDE with a test function ɸ and
integrate
overlines
time
and
When
characteristic
have
different s
space.
In this extreme example, all lines x - (1- xo)
•
Assuming ɸ has compact support (almost everywhere
Burger’s equation):
ut + fx (u) = 0 ,
•
Z
1
0
Z
1
[ tu +
1
For Burgers eq: One can show (PSet 2) that
the Riemann
( problem with initial condition
uL
uR
u(x, 0) =
x<0
x>0
The solution u = (1- x ) / ( l - t) becomes 01
characteristics
cannotgives
decide (for
u(x, t).
zero), the
integration
by parts
A more fundamental example
is the R i
Lecture
1 u = A and u = B. Everyth
constantZ values
of Figure
6.15,
with A >
= the left side (x,
0)u(x,
0)dx
x f (u)]dxdtOn
side, with A
1< B, the characteristics separ
characteristic through each point that is saf
the shock in Riemann problem has two characteristics t
t
uL
uR
with uL>uR
here: uL=0, uR =-1
is solved by:
u(x, t) =
(
uL
uR
x < st
uL + uR
with shock speed s =
2
x > st
uL
A
uR
> B: shock
RH jump condition
•
The previous example was specific for Burger’s equation. But there is a
general condition that determines the shock speed.
•
Rankine-Hugoniot (RH) jump condition:
The shock speed s of a conservation law with flux f is
f (uL )
s=
uL
f (uR )
[f ]
=
uR
[u]
Lecture
•
uL, uR: value of u on the left & right of the shock
•
Also valid for initial conditions that are not piecewise linear. Then uL, uR: value of u infinitesimally close to shock
have different slopes, they can meet (carrying different uo).
es x - (1- xo)t = xo meet at the same point x = 1, t = 1.
t) becomes 010 at that point. Beyond their meeting point,
de u(x, t).
Rarefaction waves
mple is the R i e m a n n problem, which starts from two
= B. Everything depends on whether A > B or A < B.
15, with A > B, the characteristics meet. On the right
cteristics separate. In both cases, we don't have a single
oint that is safely carrying one correct initial value. This
• How does the Riemann problem look like when there are no shocks?
haracteristics through some points, or none:
t
• Correct (weak) solution (for Burgers eq): Rarefaction wave:
uL
8
>
>
<uxL
u(x, t) =
t
>
>
:u
R
uR
uL
uR
uAL <uB:
R fan
hen characteristics
meet,
a fan when
they separate.
• Think
of cars
starting
to drive
x < uL t
uL t  x  uR t
x > uR t
at green light…
collide
(light goes red: speed drops from 60 to 0)
Unfortunately,
a shock
separate •(light
goes green: speed up
from 0 to would
60)
w to connect
60 with 0, when the characteristics don't
• We
need another criterium
ill be sharp braking. Drivers only see the car ahead in
adual acceleration, as the cars speed up and spread out.
Shocks
also be a weak solution in this case!!!
to decide for a shock vs. a fan…
Entropy condition
•
Note that characteristics must collide for a shock to occur, while
they separate for fans. This can be formulated in the entropy
condition:
0
0
If f (uL ) > s > f (uR ) => shocks
otherwise: fans with u(x,t) = x/t
Difference Methods and Flux Function
Difference Methods and Flux
Difference
Methods
and
Now we turn to numerical methods
for conservation
laws.
TheFlux
key t o Funct
a reliab
A first numerical try
Now
we turn
to numerical
for conservation
The key
! Replace df /dx laws.
by dzflerences
A
difference
method
is t o maintainmethods
the conservation
Now we
to method
numerical
conservation
key
t obya dz
re
of turn
the flux.
Don't take
derivative for
df
= u u, and work
withThe
u df
times
! laws.
Replace
/dxAu:
difference
is the
t omethods
maintain
the/dx
conservation
Replace
df /dx
dzflerence
difference
method
is t o maintain
conservation
of the
flux. Don't
take the the
derivative
df /dx! =
u u, and
workbywith
u tim
d u derivative
d
dwork
u
du
of the flux. Don't
take
the
df
/dx
=
u
u,
and
with
u times
Au:
and
not
from
Start
from
+
f
'(u)
=
0
.
+
f
(u)
=
0
• Simple idea: Discretize flux, not PDE!
at
dx
at
dx
du
d
du
du
and not from
Start from
- du
f '(u) - f (u) = 0
d
u
d
d
u
You
will from
see the idea
immediately
first-order
upwind
a t f (u)
dx=for0 theand
t - = 0d. x
not from
Start
-approximation:
+
f a'(u)
-+
at
dx
at
dx
Uj,n+l - Uj,n
f
(Uj+l,n)
- f (Uj,n)
You
will
see
the
idea
immediately
for+the
first-order
upwind
approximat
Upwind
(for
f
'>o)
=
0
•
E.g.
finite
differences
f’ > 0)
You will
seeupwind
the idea
immediately
for
upwind
approximation:
A(assuming
tthe first-order
A
x
+
+
- Uj,n preserves
f
(Uj+l,n)the
- fconservation
(Uj,n)
f , thisUj,n+l
approximation
By
staying (for
with f the flux Uj,n+l
Upwind
= 0 form
- Uj,n
f
(Uj+l,n)
- f (Uj,n)
Upwind
f
A t u(x, t)dx is replaced
A x by
= a0 sum of Uj
Since(for
the equation
is discrete, the integral
At
Ax
The integral over a 5 x b in equation (1) becomes a sum of the equations (24) ove
• By
Thestaying
advantage
of
this
approach
(apart
fromofallowing
discont.
u) isdifference:
that conserv
f , this
approximation
preserves
the
with
the
flux time
any
integers
A
5
j
5
B.
The
derivative
u
becomes
a
forward
fautomatically
, this approximation
preserves the conservation
By staying
with the flux
the
conservation
law
is
fulfilled:
Since the equation is discrete, the integral u(x, t)dx is replaced by a s
'>o)
'>o)
<
+
+
Since the equation is discrete, the integral u(x,
t)dx is replaced by a sum of
B
The
integral
over
a
5
x
b
in
equation
(1)
becomes
a
sum
of
the
equatio
Discrete
conservation
uj,n+l
uj, a sum of the equations
- FA,^) = 0(24)
(25
The integral
over
a 5 x b in equation
(1)-becomes
j=A
any integers A 5 j 5 B. The time derivative
of u becomes a forward dif
any integers A 5 j 5 B. The time derivative of u becomes a forward difference
<
<
The change in mass
C Ujn still comes from the flux.B Notice how the flux f (Ujn) a
Lecture
B
intermediate
points
between
A
and
B
was
added
Discrete
conservation
uj,n+l
-and subtracted (so it disappeared
- FA
Discrete
conservation
uj,n+l
- FA,^) = 0
j=A
the continuous
integral form in (1).
The discrete sum form in (25) is parallel toj=A
uj, uj,
Numerical flux function
•
In fact, we have just seen that any scheme of the form
Uj,n+1
Uj,n
t
526
Chapter 6
1
=
[F (Uj p,n , Uj
x
F (Uj p+1,n , Uj
Initial Value Problems
p+1,n , . . . , Uj+q,n )
p+2,n , . . . , Uj+q+1,n )]
is a conservative scheme (meaning total U inside a domain is determined
onlyfunctions
by flux F that
at boundaries)
flux
depend on several neighboring U's. We need a consistency co
tion to guarantee that the numerical flux F is in line with the true flux f :
• Of course we cannot freely combine values of U into a flux:
Consistency
•
The flux F (Uj+,, . . . , Uj-,)
satisfies F (u, . . . ,u) = f (u).
Question: How to choose flux F in the best way…
Under this condition, a convergent method will solve the right conservation law. T
construction of numerical methods rest on a good choice of the flux function F.
Example 8
Watch how nonlinear Lax-Friedrichs fits into this conservation form:
of the flux. Don't take the derivative df /dx
du
at
=u
u, and work with u tim
d
+f (u) = 0 and not from
dx
du
at
A first numerical try
Start from
•
You will see the idea immediately for the first-order upwind approximat
Upwind finite differences (assuming f’ > 0)
Upwind (for f
•
+
du
f '(u) dx
Uj,n+l - Uj,n
At
'>o)
f
(Uj+l,n) - f (Uj,n)
+
=0
Ax
Using
Fj,n = with
f(Uj,n),the
this flux
can be
as
f , written
this approximation
preserves the conserv
By
staying
Since
the equation
Uj,n+1
Uj,n
1is discrete, the integral u(x, t)dx is replaced by a s
=
[Fj+1,n Fj,n ]
The integral
over a x5 x b in equation (1) becomes a sum of the equatio
t
any integers A 5 j 5 B. The time derivative of u becomes a forward dif
<
We can extend this scheme to capture both Bflux directions:
(
Discrete conservation0
uj,n+l - FA
f (Uj,n )
f (Uj,n ) > 0
j=A
Fj,n =
f (Uj 1,n ) f 0 (Uj,n ) < 0
The change in mass Ujn still comes from the flux. Notice how the flu
• intermediate
points
A and
B conditions
was added
and
subtracted
First-order method,
but between
fails for certain
initial
(see
LeVeque.
p. 134)(so it d
The discrete sum form in (25) is parallel to the continuous integral form
•
uj,
C
Lecture 11
18.086
is the big step forward, and oscillation was once thought to be unavoidable.
Burgers' Equation and Characteri
Last
time:
Conservation
laws
The outstanding example, together with traffic flow, is Burgers' e q u a t i o n
flux f (u) = $u2. The "inviscid" equation has no viscosity vu,, to prevent sh
•
•
•
Burger’s equation
lnvisciddiscontinuities
Burgers' equation
creates
du
dx
Mathematical
description
using integral
We will approach
this conservation
law in form
three(=conservation
ways:
law)
1.
By following characteristics until they separate or collide (trouble arrives
In general, conservation laws read
2.
By an exact formula (17),
Z b which is possible in one space dimension
d
ut + f (u, ux , . . .)x = 0 ()
udx + f (u(b), ux (b), . . .) f (u(a), ux (a), . . .) = 0
dt afinite volume methods, which are the practical ch
By finite difference and
3.
A fourth (good) way adds vu,,.
•
The limiting u as v
-+0
is the viscosity solu
Special form above: Diffusion is also a conservation law…
Start with the linear equation ut = c u, and u(x, t) = u(x
+ ct, 0).
The
value at xo is carried along the characteristic line x ct = xo. Those lines are pa
when the velocity c is a constant. No chance that characteristic lines will meet
+
The conservation law ut
+ uu,
= 0 will be solved by u(x, t) = u(x
-
Last time: RH jump
condition
•
The previous example was specific for Burger’s equation. But there is a
general condition that determines the shock speed.
•
Rankine-Hugoniot (RH) jump condition:
The shock speed s of a conservation law with flux f is
f (uL )
s=
uL
f (uR )
[f ]
=
uR
[u]
Lecture
•
uL, uR: value of u on the left & right of the shock
•
Also valid for initial conditions that are not piecewise linear. Then uL, uR: value of u infinitesimally close to shock
Difference Methods and Flux
Difference Methods and Flux Funct
Now we turn to numerical methods for conservation laws. The key
Replace
dfkey
/dxt obya dz
difference
is t omethods
maintainfor
theconservation
conservation ! laws.
Now we
turn to method
numerical
The
re
of the
flux. Don't
take the the
derivative
df /dx! =
u u, and
workbywith
u tim
Replace
df /dx
dzflerence
difference
method
is t o maintain
conservation
of the flux. Don't take the derivative df /dx = u u, and work with u times Au:
• Simple idea: Discretize flux, not PDE!
du
d
du
du
and not from
Start from
f '(u) - f (u) = 0
du d
d
u
du
a t f (u)
dx= 0 and not from - + f a'(u)
t - = 0d. x
Start from - + at
dx
at
dx
You will see the idea immediately for the first-order upwind approximat
• E.g. upwind finite differences (assuming f’ > 0)
You will see the idea immediately for the first-order upwind approximation:
Uj,n+l - Uj,n f (Uj+l,n) - f (Uj,n)
Upwind (for f '>o)
=0
Uj,n+l
- Uj,n
A t f (Uj+l,n) - f (Uj,n)
Ax = 0
Upwind (for f '>o)
At
Ax
• Using Fj,n = f(Uj,n), this can be written as
By staying with the flux f , this approximation preserves the conserv
, this approximation
thereplaced
conservation
By staying
withequation
the flux
Uj,n+1
Uj,n
1is fdiscrete,
Since
the
the integral preserves
u(x, t)dx is
by a s
=
[Fj+1,n
Fj,n ] u(x, t)dx is replaced by a sum of
Since The
the equation
is
discrete,
the
integral
integral
over a x5 x b in equation (1) becomes a sum of the equatio
t
The integral
over aA55x j 5b B.
in equation
becomes of
a sum
of the equations
any integers
The time(1)
derivative
u becomes
a forward(24)
dif
Advantage:
lawderivative
is automatically
fulfilled!
any •integers
A 5 j conservation
5 B. The time
of u becomes
a forward difference
Last time: Conservation laws
+
+
+
<
+
<
We can extend this scheme to capture both Bflux directions:
B ( conservation
Discrete
uj,n+l
f (Uj,n )
f 0 (Uj,n ) > 0 uj,n+l Discrete
conservation
j=A
Fj,n =
j=A
f (Uj 1,n ) f 0 (Uj,n ) < 0
•
uj,
uj,
-
-
FA,^)
FA
=0
is a pure exponential and eikx is factored out:
flux functions that depend G
on=several
neighboring
U's.-We need a consistency
l
+
e
ikAx
Te-ikAx
Unstable:
IGI
>
1
-We
1 need
ir sin
kAx .
flux
functions
that
depend
on
several
neighboring
U's.
a
consistenc
tion to guarantee that the numerical2 flux F is2in line with the true flux f :
tion to guarantee that the numerical flux F is in line with the true flux f :
The real part is 1. The magnitude is I GI 2 1. Its graph is on the left side of Fig
Consistency The flux F (Uj+,, . . . , Uj-,)
satisfies F (u, . . . ,u) = f (u).
3.Consistency
Lax-F'riedrichs
stability
differences
th
Therecovers
flux F (Uj+,,
. . . ,for
Uj-,)centered
satisfies
F (u, .by
. . ,changing
u) = f (u).
Replace
U j , by for
thelinear
average
f ( ~ j + ~
, ~ of its neighbors:
•difference.
Remember
Lax-Friedrichs
1-way
wave eq:Uj-l,n)
Under this condition, a convergent method will solve the right conservation la
1
Under
this condition,
auj,n+l
convergent
method
solve
the
right
conservation
construction
of numerical
methods
rest onuj-1,n)
awill
good
choice
of the
flux functionl
- 5(uj+l,n
Uj+l,n
- Uj-l,n
Lax- Friedrichs
C
construction
of numerical methods rest on a good=choice
of the flux function
At
2Ax
Example 8 Watch how nonlinear Lax-Friedrichs fits into this conservation form
Two
values
Uj+l,n
andnonlinear
Uj_l,n
produce
valuethis
Uj,,+1.
Movingform
te
•Example
The old
nonlinear,
conservative
formulation
is: each new
8 Watch
how
Lax-Friedrichs
fits into
conservation
the right-hand side, the coefficients are f (1 r) and (1- r). The growth fa
+
Lax-Friedrichs for nonlinear
conservation laws
+
G=-
'+
,ikAx
'
+- 2
-
4
+
e
-ikAz -
cos k A x
+ i r sin k A x .
2 the standard discrete conservative form (see before)
This can be written in
To
match
equation
insert
Uj,n-UJ,n
the parentheses
and insert
f (U,,,)
= (cos
AX)^ into
r2(sin
AX)^. In Figure
6.8,
IGI The
absolute
value (26),
is1 [GI2
Uj,n+1
Uj,n
= (26),
[F
To
equation
insert
into
the
and ainsert
(U,,,)
into
theThis
brackets.
Thiscondition
produces
AFtj,n
U ]/ A
t A
z Fparentheses
/the
A x CFL
= 0 with
new fflux
F:j+1,nUj,n-UJ,n
r2
5match
1.
stability
agrees
again
with
condition.
t
x
into the brackets. This produces A t U / A t
A z F / A x = 0 with a new flux F :
•
++
+
Forward 1
in time-centered inAx
space
by introducing the LF flux
Lax-Friedrichs flux + G
F~~
5i r[fs (i nu k~A)+xf (u3+l)] 2at(U3+l
= =
l +1
Ax
Lax-Friedrichs flux
F~~
j+1 = 5 [f ( u ~ )+ f (u3+l)] 2at(U3+l
-
-
Lax-F'riedrichs
<
UJ).
- UJ).
-
is cancels the first-order error and upgrades the accuracy to
Lax-Wendroff
with
Flux
Limiter
ations come in. We write the Lax-Wendroff flux in this linear
the new term that is added to the upwind flux F UP = aU.
ut + au, = 0 with r = a A t l A x , the Lax-Wendroff method adds ~ T ~ A ~ U
Lax-Friedrichs for nonlinear , , ~
x-Friedrichs formula for UJ,n+l. Equivalently, it adds i(r2 r)A:U,,
to
conservation
laws
d formula. This cancels the first-order error and upgrades the accuracy to
FUN = au3 + a (I (uj+1- u ~ ) .
g)
I+T
-
As in the linear
Lax-Friedrichs
is only first-order
accurate.
oscillations
comecase,
in. 2We
write the Lax-Wendroff
flux in
this linear
= au, to
show the new term that is added to the upwind flux F UP = aU.
• It captures both directions, but the central difference flux term creates extra
er.
ft
But•
g)
at thatdiffusion!
last term. It has taken a lot of care to modify this
ndroff flux
FUN
I +A
T good
= au3 +
a
(I - of the
(uj+1
-u~).
ons
are
controlled.
measure
oscillation
of this
both
•
We
could
just
try
to
use
Lax-Wendroff
(which
was
second
order), but
wind from left
2
creates
oscillations…
riation,
which
adds all movements up and down:
y looks •closely
at that
thatavoid
last oscillations
term. It has
a lotvariation
of care to
modify this
Schemes
are taken
called total
diminishing
(TVD)
that oscillations
methods are controlled. A good measure of the oscillation of both
03
the t o t a l variation, which adds all movements
up and down:
•
(u) =
riation
/__ 1
1
O"
du
Define
total variation (TV):
TV(u) =
dx
/__ 1
O"
du
1
TV(U) =
x
-03
dx
TV(U) =
IUJ+I - U,I
x
(36)
03
IUJ+I - U,I
(36)
-03
<
• A TVDdiminishing)
method has the achieves
property TV(Un+l)
al variation
TV(Un). This
Dymethod
diminishing)
achieves never
TV(Un+l)
< TV(Un).Shocks
This
of the(total
truevariation
solution,
that TV(u(t))
increases.
ve the property of the true solution, that TV(u(t)) never increases. Shocks
Godunov’s method
•
Some problems so far:
•
Upwind is good, but we need to know direction (i.e. velocity) of wave. Problem:
System of equations!
•
Lax-Friedrichs has no upwind direction problems, but high diffusion and thus low
accuracy
•
2nd order methods (e.g. LW) are prone to oscillations.
•
How can we find schemes (in particular numerical flux functions) that are high order,
direction-independent and TVD?
•
Godunov’s method: A systematic way to construct TVD numerical flux functions (more
details in Strang’s book and in R.J. LeVeque, Numerical Methods for Conservation Laws)
•
But: Godunov’s theorem:
Linear numerical schemes for solving partial differential equations
(PDE’s) that are TVD can be at most first-order accurate.
method) that behaves well near discontinuities. We then attempt to
nto a single flux F in such a way that F reduces to F in smooth regio
continuities. The main idea is outlined here, although for nonlinear
hybridization may be more complicated.
view •the high order flux as consisting of the low order flux plus a co
Flux-limiting methods
Linear in Godunov’s theorem means a scheme where the scheme itself
(flux function, coefficients etc.) are constant, i.e do not change their form
depending on the current solution.
F,(U;j) = FL(U;j) + [F,(U;j) - Fr.(U;j)].
•
=> Use nonlinear numerical scheme, e.g. flux-limiter methods
miter method, the magnitude of this correction is limited dependin
• Idea: Combine high-order flux FH (good for smooth part) with low-order
flux becomes
flux FL (TVD, good for shock)
F(U;j) = FL(U;j) + 4'(U;j) [FH(U;j) - FL(U;j)]
Choose 𝚽 close to 0 near shock, near 1 away from shock
; j) is the limiter. If the data U is smooth near U; then 4(U; j) shoul
he vicinity of a discontinuity we want 4(U; j) to be near zero. (In
wider range of values for' often works better.)
at we can rewrite (16.10) as
•
Flux-limiter for Lax-Wendroff
•
Remember Lax-Wendroff for 1-way wave eq. ut+aux=0
Uj,n+1
Uj,n
t
•
=
Uj+1,n Uj
a
2 x
1,n
t 2 Uj+1,n
+
a
2
2Uj,n + Uj
x2
1,n
Lecture
Can write it like an “upwind plus correction” method:
Uj,n+1 = Uj,n
r(Uj,n
Uj
1,n )
1
r(1
2
r)(Uj+1,n
2Uj,n + Uj
•
The correction term increases accuracy (next term in series
expansion), but we have seen it leads to oscillations
•
Corresponding flux:
1
F (U, j) = aUj + a(1
2
Then, LW can be written as
r)(Uj+1
1,n )
Uj )
Uj,n+1
Uj,n
t
1
=
[Fj+1,n
x
Fj,n ]
(Fj+1,n = F(U,j+1) etc.)
Flux-limiter for Lax-Wendroff
•
Lax-Wendroff flux (prev. slide):
1
F (U, j) = aUj + a(1
2
r)(Uj+1
Uj )
•
This flux is an upwind flux (aUj) corrected with a high-order flux!
•
We replace F(U,j) by
1
F (U, j) = aUj + a(1
2
r)(Uj+1
•
How should we choose
j
•
Uj Uj 1
Naturally, it should depend on the quantity ✓j =
Uj+1 Uj
•
It can be shown: No oscillations for
0
•
Uj )
j
?
close to 1 for U smooth
far from 1 for shock in U
(✓)  2✓ and 0  (✓)  2 for all 𝛳
For nonlinear equations: replace speed a by the local speed (see LeVeque, p. 181)
A shock is diagnosed by the slope ratio rj that compares successive differences:
near 0 a t a shock
near 1 for smooth U
Slope ratio
Flux-limiter for Lax-Wendroff
The flux factor 4j+1will involve this ratio rj. A monotone flux function F in (37)
and a TVD difference method require two conditions derived in [ l o g , 1101 :
TVD conditions
O<#(r)<2r
• LW-flux with flux-limiter:
and
0<4(r)<2.
(39)
1
= aU
a(1 resolution
r)(Uj+1 without
Uj ) junacceptable oscillations.
j + high
Summary F (U,
We j)
have
reached
2
Linear Lax-Wendroff violates (39) for small r , but Figure 6.18 shows three choices of
the flux •limiter
$ ( r )for
that (✓)
will keep the flux function monotone. A key step forward.
Choices
𝜙(𝛳)
2tk
LW is not total
,
vari tion diminis
𝛳
Figure 6.18: Three flux limiters + ( r )that satisfy the conditions (39) for TVD.
methods do not think of Uj,, as an approximation to u(jAx,nAt).
connect directly to the integral form of the conservation
law.Volume
So it
Finite
Method
, to approximate the cell average Tij,, from ( j- $)Ax to ( j+ ;)Ax:
Finite Volume
Metho
Finite volume methods do not think of Uj,, as an approximation
to u(jAx,nA
1 to
( j the
+ i )integral
~x
These methods connect
directly
form of the conservation law. So
nAt)
dx
.from ( j-(30)
Uj,n approximates
, =doFinite
volume
not think
of u(x,
Uj,,
as anTij,,
approximation
to to
u(jAx,nA
is natural
for Umethods
j ,u
toj,
approximate
the cell
average
$)Ax
( j+ ;)A
AX (,-+)AX
These methods connect directly
to the integral form of the conservation law. S
Finite volume
method
/
Another interpretation of the discrete conservation law: Finite volume method
•
/
/
1 Tij,,
( j + ifrom
) ~ x ( j- $)Ax to ( j+ ;)A
is natural for U j , to approximate the cell
average
f (u), =
0Cell
overaverage
aapproximates
cell, the
exact
(1):dx .
• Directly
theaverage
integral satisfies
form:
u(x, nAt)
Uj,n
approximates
uj,, = the
-integral form
(3
AX
(,-+)AX
1
(j+i)~x
u(x,the
nAt)
dx . form ((
Cell average
Uj,n approximates
uj,, = Integrating
ut
+
f
(u),
=
0
over
a
cell,
the
exact
average
satisfies
integral
(3++)Ax
AX (,-+)AX
U(X, 1)dx
[f(uJ++,n)- i(uJ-+,n)] = 0 .
(31)
dtIntegrating
(J-;)*x
ut + f (u), = 0 over a cell, the exact average satisfies the integral form
Change in
(3++)Ax
U(X, 1)dx + [f(uJ++,n)- i(uJ-+,n)] = 0 .
(3
cell average
'dt' (J-;)*x
I
+
''
I
''I
+
e at theChange
midpoints
where (3++)Ax
cells meet. And if we integrate also
in
1)dx
+finite
[f(uJ++,n)
i(uJ-+,n)]
0.
, then •utcell
faverage
(u), in=time
0 isfrom
perfectly
over
a space-time
cell: =law
Integrate
n to n+1averaged
toU(X,
obtain
the
volume-conservation
s
ave
=o
(
+
The fluxes are atdtthe(J-;)*x
midpoints where cells meet. And if we integrate al
l-;)Ax
+
+
l-;)Ax
over( aj +time
= 0 is perfectly averaged over a space-time cell:
+ ) ~step,
x then ut f (u),(3+4)Ax
The fluxes U(X,
are tat
where
cells
meet. And if we integrate a
n +the
~dx
) midpoints
U(X,
tn)
dx
(
j
+
+
)
~
x
(3+4)Ax
over(j-+)AX
a time step, then ut f (u), = 0 is perfectly averaged over a space-time cell:
U(X, t n + ~dx
) U(X, tn)(32)
dx +
Cell integrals
(j-+)AX (n+l)At
(n+l)At
in x and t have
(j++)~x
(3+4)Ax
(3
f
(u,-;,
t)
dt
=
0
.
(n+l)At
(n+l)At
f
(uj+;,t)
d t - U(X, t n + ~dx
htc
A,T
=
o
) U(X, tn) dx +
Cell Lintegrals
L A ,f (uj+;,t)
A,
f (u,-;, t) dt = 0 .
dt(j-+)AX
/'
+
/'
/'
l-;)Ax
+ f (u),
= 0 over
a cell, the exact average
the Methods
integral form (1):
Finitesatisfies
Volume
I Finite volume method
ods do not(3++)Ax
think of Uj,, as an approximation to u(jAx,nAt).
1)dx form
[f(uJ++,n)
- i(uJ-+,n)]law.
= 0 .So it
nect directly to theU(X,
integral
of the conservation
dt (J-;)*x
approximate the cell average Tij,, from ( j- $)Ax to ( j+ ;)Ax:
+
''
(31)
/
re at the midpoints
where
And if we integrate also
1 cells
( j + i )meet.
~x
•ut Using
u(x, nAt)
. the integral
j,n
approximates
j,
= perfectly
(30)cell:form
p, then
f (u), u=
0,is
averaged
overdx
a space-time
AX (,-+)AX
(j++)~x
(3+4)Ax
), = 0 over a cell, the exact average satisfies the integral form (1):
U(X, t n + ~dx
) U(X, tn) dx +
ls
+
/'
l-;)Ax
(j-+)AX
have
= o (3++)Ax
I
'dt' (J-;)*x
(32)
(n+l)At
(n+l)At
U(X, 1)dx +
[f(uJ++,n)
0 . t) dt(31)
=0.
f (uj+;,t)
d t-- i(uJ-+,n)]f=(u,-;,
LA,
LA,
can be written as
Z (n+1) t
Z (n+1)
1
1
the midpoints
where cells1meet.
And if we integrate also 1 1
(ūj,n+1 ūj,n ) +
f (uj+ 12 , t)dt
en ut f (u),
t = 0 is perfectly averaged
t x nover
t x n t
t a space-time cell:
o
+
(j++)~x
l-;)Ax
Z
t
f (uj
1
2
, t)dt = 0
(n+1) t
1
Using
the
flux U(X,
f¯j+ 12tn)
f (uj+ 12 , t)dt this becomes
U(X,
t ntime-averaged
+ ~dx
) dx +
,n =
t n t
(j-+)AX
(32)
(n+l)At
(n+l)At
f (uj+;,t) d t - 1 ⇣ f (u,-;, t) dt = 0 .⌘
1
/'
LA,
t
(ūj,n+1
(3+4)Ax
ūj,n ) +L A , f¯j+ 12 ,n
x
f¯j
1
2 ,n
=0
Finite volume method
•
Treat
ūj,n as independent variables Uj,n, approximate average fluxes by Fj+ 12 ,n
1
(Uj,n+1
t
•
⌘
1 ⇣
1
1 Flow
Uj,n ) +
Fj+6.6
F
=
0
Nonlinear
and
Conservation Laws
,n
j
,n
2
2
x
:
527
Figurechoice
6.17: Flux
balance isflux
exact
for 'ii,f fand
approximate
F instep,
(33).ie.
Easiest
for numerical
F: Assume
is constant
over for
oneU,time
The
total
in
a cell changes
between
t, and tntl by the total flux into that cell.
1 mass
1
Fj+
=
f
(U
)
j+ 2 ,n
2 ,nvolume methods
Thus finite
comet with a staggered grid in space-time (Figure 6.17).
this staggered
we must write
thehalf-grid
numericalpoints!
flux as Fj+; rather than F,:
• On
Note:
We needgrid
to interpolate
U to
•
Note: Other choices1of F can lead to implicit
schemes
1
Finite volume
At (Uj.n+l - uj,n)
+
-5-1,)
=O.
( ~ j + $ , ~
2'
(33)
ation of
Surface
Integrals,
Cont’d
Why finite volumes?
Types of FV Grids, Cont’d
Grid can be arbitrary, conservation law always fulfilled
V)
•
yj+1
ts
Se
ertex
f dA
yj
ation:
order)
s
d as a product of
lar or
ll-face
center
or
on
of mean value
3D
he
cell-face area
r
ntified
NW
WW
W
yj-1
nw
w
n ne
P e ne
sw
s se
SW
y
∆x
j
xi-1
i
NE
N
EE
E
∆y
SE
S
xi
xi+1
x
Notation used for a Cartesian 2D and D grid. mage by M T
penCours
•
AREPO finite volume code (Volker Springel)
Example
533
6.7 Fluid Flow and Navier-Stokes
No-slip along a
u = 0 (from viscosity) and v = 0 (no crossing)
horizontal boundary
(8)
Navier-Stokes
/NAVIER-STOKES
Flow
problems
FLUID
FLOW
Along
a sloping
boundary,AND
the velocity
vector is separated into normal and tangen-
6.7
tial components. The inflow and no-slip conditions st ill prescribe both components,
and d/dx in (7) changes to d l d n for outflow (like a free end). Our examples will
incompressible
fluid is governed
by horizontal
the Navier-Stokes
equashow other possibilities,
staying with
and vertical boundaries.
• Tricky equation, tricky numerics…
form brings
the importance
ofuthe
Reynolds
number then
Re.div u = 0 would
If weout
prescribe
the outward flow
- n on
the whole boundary,
ds =Navier-Stokes
0. Please
note equation:
the
u n and duldn = Vu n,
nce-free
vectoruu= nand
the
pressure
is difference
a scalarbetween
p:
•require
Incompressible
a normal component and a normal derivative.
du
1
-+(u-V)u=-Vp+-nu+
dt
Re
f
divu=V=u=O
momentum balance
(1)
The Reynolds Number
continuity/incompr. (2)
equation
To reach the Reynolds number Re, the Navier-Stokes equations have been made
Physical with
conservation
laws
have normalized
dimensions.is The
key
•dimensionless.
Inthe
this momentum
dimensionless
form,
the
onlydensity
physical
parameter
the
Law for
mass
to Reynolds
1. to the physics
is number
the relative
importance of inertial forces and viscous forces.
Re
ften absent. Four terms deserve immediate comments:
-
inertial forces
(a velocity U ) (a length L)
pplies toReynoldsnumber
each component ofR eu=. viscous
Viscosity
produces
dissipation.
forces
(kinematic
viscosity v)
u
nd
%
(9)
Pressure 1
p is Flow
a Lagrange
multiplier,
adjusted
such
that the
incompressibility
Example
Here
L
would
be
the width
of the channel, and
in
a
long
channel
= 0condition
(no time
derivative
in
this
equation)
comes
from
fulfilled.
U could beisthe
inflow velocity. The number v is a ratio p l p of the material constant p
conservation
of mass : const ant density.
(the dynamic viscosity) t o the density p.
•
Poisson for p U* =
of a drag region
u"+'+ grad(pn+' -
Poisson is the equation we know best (also th
a divergence-free part Un+' and a curl-free
are orthogonal complements, with correct bo
p on a finite difference grid is usually called
Example: 2D flow in a lid-driven cavity
change to a backwards facing step
endent geometries
selected streamlines
with an• advection-di↵usion
equation
Consider 2D box, with
no-slip boundary
conditions at three boundaries:
domain ⌦ =Navier-Stokes
[0, lx ]⇥[0, ly ]. TheEquations
four domain boundaries are denoted North,
pressible
d East.
The domain is fixed in time, and we consider no-slip boundary
• In 2D, we can write the NS equations in
e incompressible
Navier-Stokes equations in two space dimensions
ch
wall, component
i.e.
form as
1
+ uyy
(1)
=pux N=(x)(u )x (uv)y + Re (uxxv(x,
ly))Figure
= 0 6.20: Lid-driven cavity
u(x, lyu)t +
flow u =(4)
(u,
on a rectangular
domain
⌦=
[0, lx ]⇥[0,
four
boundaries
a
on a rectangular
domain
⌦ =l[0,
]⇥[0,
ly ].domain
The four
domain bo
y ]. lThe
xLecture
1
2
u(x, 0)
=puy S=(x)
v(x,
0)
=
0
(5)
vt +
(uv)
(v
)
+
(v
+
v
)
(2)
x South,
y West,
xx East.
yy The
South, West,
and
East. and
The
domain
is domain
fixed in istime,
we consider
fixedand
in time,
and we
Re
conditions conditions
on each wall,
on i.e.
eachv(0,
wall,y)
i.e.= vW (y)
u(0, y)
=
0
(6)
ux + vy = 0
(3) on an actua
Those steps need to be executed
2
u(lx , y) = 0
, y)
=different
(y)points, asv(x,
in Figure
uvNE(x)
lThe
ly )at=
uu(x,
ly ) =6.20.
0v(x,(7)
u(x, ly ) =v(l
y)
Nx(x)
of the i,j cell. The horizontal velocity U is
• The boundary conditions will
be
(x)(p and U arev(x,
v(x,
u(x, 0) = uu(x,
0) = 0on
S (x)0)
of =
theuScell
staggered
row0)2
2
he Navier-Stokes equations can be
in [2].
momentum
(againv(0,
on the
cellvv(0,
edges
so
y)below
= The
0 the center
y)
u(0,found
y) = 0u(0,
y)equations
=
W (y)
The
three
gridsinertial
for p, U, V and
bring many
conve
ibe the time evolution of the velocity
field
(u,
v)
under
viscous
u(lx , y) = 0u(lx , y) = 0
v(lx , y) = vv(l
x , y)
E (y)
A first question is notationcondition
for the grid va
sure p is a Lagrange multiplier to satisfy the incompressibility
Download