9 Handout
9 Handout
9 Handout
Notes
弱解 )
1. Weak solutions (弱
In LSWE and NSWE, shock waves (water waves with a discontinuous front) are known
to be solutions. However, since these solutions are not differentiable at the jumps, they
do not satisfy the governing equations in the traditional way (because some derivatives
do not exist). It is therefore convenient to regard these solutions as “weak solutions”
to the corresponding ODE or PDE. A weak solution must satisfy certain mathematical
conditions. You can see Wikipedia or the textbook for more details.
熵條 件 )
2. Entropy conditions (熵
In general, weak solutions are not unique, and there can be many weak solutions to a system
of equations. Additional mathematical conditions are needed to identify the physically
relevant weak solution. Such conditions are called the entropy conditions, because the
idea originated from the concept of “entropy” in the study of thermodynamics (熱力學).
Nowadays, the term “entropy condition” is widely used in many fields, such as shallow
water waves, even though they are not related to thermodynamics. You can see Wikipedia
or the textbook for more details on the entropy conditions.
有限 差 分 法 )
3. Finite difference method (有
Very simply speaking, a finite different method discretizes a system of equations using a
number of grid points based on finite difference formulas. The numerical value calculated
at each grid point represents the numerical solution at that location. There can be many
different ways to discretize a given set of equations using finite difference methods.
保守 方 法 )
5. Conservative methods (保
To ensure that numerical methods do not converge to non-solutions, we need to write the
discretized equation in conservation form, which means it has the form
1
ESOE 5136 2021 May 24 - Handout Lo
Figure 1: True (solid line) and computed (dots) solutions to Burgers’ equation using a
nonconservative method. From LeVeque (1992).
Example
Here we consider the Burger’s equation again. This time, we write it as
1
ut + ( u2 )x = 0 (5)
2
instead of (1).
We can use a simple finite difference method to discretize (5) as
拉文 定 理 )
6. Lax-Wendroff theorem (拉
The Lax-Wendroff theorem states that if a conservative numerical method converges to
some function as the grid is refined, then this function is a weak solution to the governing
equation.
However, the theorem does not guarantee that a numerical method will converge, nor does
it indicate which weak solution the numerical method converges to if there are multiple
weak solutions.
有限 體 積 法 )
7. Finite volume method (有
When we write equations in conservation form, it becomes more convenient to interpret
and solve these equations using finite volume methods (as opposed to the more general
finite difference methods).
2
ESOE 5136 2021 May 24 - Handout Lo
Even if the weak solution u(x, t) is nondifferentiable at certain points, it still satisfies the
integral form of the conservation law (since integration does not require differentiability),
Z xi+1/2
u(x, tn+1 )dx
xi−1/2
, (8)
Z xi+1/2 hZ tn+1
Z tn+1 i
= u(x, tn )dx − f u(xi+1/2 , tn ) dt − f u(xi−1/2 , tn ) dt
xi−1/2 tn tn
where f (u) is the flux of u(x, t). Dividing both sides by ∆x gives
Z xi+1/2
1
u(x, tn+1 )dx
∆x xi−1/2
.
Z xi+1/2 Z tn+1 Z tn+1
1 1 h i
= u(x, tn )dx − f u(xi+1/2 , tn ) dt − f u(xi−1/2 , tn ) dt
∆x xi−1/2 ∆x tn tn
(9)
If we define cell-averaged u(x, t) as
Z xi+1/2
(n) 1
ui = u(x, tn )dx, (10)
∆x xi−1/2
3
ESOE 5136 2021 May 24 - Handout Lo
Figure 2: A simple explanation of the difference between finite difference methods and finite
volume methods.
Godunov assumed that the distribution within each cell is constant. Namely,
(n)
u1 , x 1 ≤ x ≤ x 3
2 2
···
(n)
ui , xi− 1 ≤ x ≤ xi+ 1
u(x, t) = 2 2 , (13)
···
(n)
uN , xN − 1 ≤ x ≤ xN + 1
2 2
ui
ui+1
ui-1
xi-1 xi xi+1
xi-1/2 xi+1/2
Figure 3: An illustration of cell data distribution based on Godunov’s method.
To determine the flux at a cell interface, take xi−1/2 for example, one then have to solve
a local “dam-break” problem, where the quantity u(x, t) jumps from ui−1 to ui . Such an
intercell “dam-break” problem is formally referred to as a Riemann problem (黎曼問題).
For many commonly used PDEs, such as the NSWE, many Riemann solvers (which can
be exact or approximate) have been developed.
4
ESOE 5136 2021 May 24 - Handout Lo
In this course, we will use a second-order accurate in space (MUSCL) and third-order
accurate in time (SSP-RK) numerical scheme to solve the NSWE. This numerical scheme
is conservative and highly stable (it satisfies the “TVD” condition) near discontinuities.
Therefore, it is considered a “shock-capturing” numerical scheme.
Instead of assuming a piece-wise constant data distribution like in Godunov’s original
proposal, we can interpolate between cells to get a higher-order data distribution within
each cell. This interpolation process is often referred to as “data reconstruction”. A stable
and efficient method is the MUSCL data reconstruction method, which will be discussed
below.
A possible distribution of u(x, tn ) as an outcome of the MUSCL reconstruction process is
illustrated in Figure 4. In general, there will be jumps at each cell interface because there
are two possible values of u. For example, at the cell interface xi−1/2 , there are u− i−1/2
evaluated from the left (cell i − 1), and u+
i−1/2 evaluated from the right (cell i). Thus, local
Riemann problems must be solved to determine the fluxes at cell interfaces. We will use
the HLLC approximate Riemann solver, which will be discussed below.
u+i-1/2
u-i+1/2
u-i-1/2 u+i+1/2
xi-1 xi xi+1
xi-1/2 xi+1/2
Figure 4: Sketch of a possible distribution of u(x, tn ), as an outcome of the MUSCL
reconstruction process.
Once the cell interface fluxes are determined, we will use the SSP-RK method to advance
in time. The full details of the numerical scheme is provided at the end of the handout,
after the introduction of the MUSCL reconstruction method and the HLLC approximate
Riemann solver.
數據重建 ) method
10. MUSCL data reconstruction (數
Consider the cells sketched in Figure 4. The value of a cell-averaged quantity u(x, tn ) is
known at each cell at a certain instant tn : ui . If the intercell values of u are desired, e.g.,
ui−1/2 or ui+1/2 , a reconstruction method is needed to obtain the intercell values from the
known cell-averaged values.
There are many different ways to reconstruct the data. The superscript “+” is used in
u+i−1/2 to indicate that the interpolation is based on cell i, which is to the right of this
intercell location; the superscript “−” is used in u− i−1/2 to indicate that the interpolation
is based on cell i − 1, which is to the left of this intercell location.
Here we will discuss the second-order accurate MUSCL-TVD (total variation diminishing,
全差變遞減格式) method presented in Toro (2001). TVD is a mathematical condition
that makes a numerical scheme stable at resolving shock waves (discontinuous solutions)
and minimizes numerical oscillations. The intercell value between cell i − 1 and cell i,
5
ESOE 5136 2021 May 24 - Handout Lo
u+
i−1/2 calculated from the right (i.e., based on cell i) is determined as
1
u+
i−1/2 = ui − 2 ∆i , (14)
where ∆i is a limited slope (or a limited difference to be exact, since it’s technically not
defined as a slope here), which is designed to satisfy the TVD condition.
We will use a version of the van Leer slope limiter (there are many other slope limiters
available for use in the literature) to calculate the limited slope as
∆+i = ui+1 − ui
∆− = ui − ui−1
i
− − . (16)
∆+ +
i |∆i | + |∆i |∆i + −
∆ = , for |∆ | + |∆ | 6
= 0
i
− i i
|∆+
i | + |∆i |
for |∆+ | + |∆− | = 0
∆ = 0,
i i i
Note that the above expressions hold only for a constant step size ∆x.
近似 黎 曼 解 算 子 )
11. HLLC approximate Riemann solver (近
In general, an intercell value of a function f approximated from the left is different from
− +
that approximated from the right, e.g., fi−1/2 6= fi−1/2 . Therefore, additional treatment
is needed to determine the intercell value, fi−1/2 . One popular approach is to solve a
“dam-break” problem (also known as a Riemann problem) at each intercell boundary, as
sketched in Figure 5. Using H to denote the local water depth, U to denote the depth-
averaged velocity in the x-direction, we shall approximate the local Riemann problem in
the x-direction as
" #
H
HU
φ~t + f~x (φ)
~ = 0, φ
~= , f~ = 1 . (17)
HU HU 2 + g(η 2 + 2ηh)
2
fi--1/2
x
i-1/2
In our numerical scheme, we implement the HLLC (Harten-Lax-van Leer contact) approx-
imate Riemann solver discussed in Toro (1992), Toro (2001), and Shiach and Mingham
6
ESOE 5136 2021 May 24 - Handout Lo
(2009). The HLLC approximate Riemann solver determines the intercell value fi−1/2 (for
brevity, the subscript “i − 1/2” is dropped in the below expressions) as
f~− for 0 ≤ S −
~−
f + S − (φ ~− − φ
~ − ) for S − < 0 ≤ u∗
f~ = ∗
~ + ) for u∗ < 0 ≤ S + , (18)
f~+ + S + (φ
~+ − φ
∗
~+
f for S + < 0
where
U− + U+ p − p +
u∗ =
+ gH − gH
p 2
+ , (19)
p
− + −
c = gH + gH + U − U
∗
2 4
( p
−
min(U p− gH − , u∗ − c∗ ) for a wet cell i − 1
S− = , (20)
U + − 2 gH + for a dry cell i − 1
( p
+ max(U +p+ gH + , u∗ + c∗ ) for a wet cell i
S = , (21)
U − + 2 gH − for a dry cell i
and
− − + +
~− = H −( S − U )
φ
1 ~+ = H +( S − U )
, φ
1
. (22)
∗ ∗
S − − u∗ u∗ S + − u∗ u∗
As can be inferred from the expressions for S − and S + , wave runup, i.e., a moving wet-dry
boundary, is automatically captured by the HLLC approximate solver.
where
" # " #
H
HU
F
0
~=
φ , f~ = 1 = , ~s = ∂h . (25)
HU HU + g(η 2 + 2ηh)
2 G gη
2 ∂x
Solution procedure
To march in time, we will use the SSP-RK method to update H and [HU ] (note that U
can be recovered by dividing [HU ] by H). In each of the three time-iterations in SSP-RK,
we need to perform the MUSCL reconstruction on η and U in order to calculate F + , F − ,
7
ESOE 5136 2021 May 24 - Handout Lo
G+ , and G− at each cell interface. Then, we use the HLLC approximate Riemann solver
to determine the flux values F and G at each cell interface from the reconstructed F + ,
F − , G+ , and G− .
The derivative(s) in the source term ~s on the right hand side of (24) will be discretized
using the second-order central difference method.
Time-updating scheme
Written out fully, the numerical scheme is
First round:
Hi(∗) = Hi(n) − ∆t F (n) − F (n)
∆x i+1/2 i−1/2
(∗) (n) ∆t (n) (n)
∆t (n)
[HU ]i = [HU ]i − G − G + gη h i+1 − h i−1
∆x i+1/2 i−1/2 2∆x i
Second round:
H (∗∗) = 3 H (n) + 1 H (∗) − 1 ∆t F (∗) − F (∗)
i
4 i 4 i 4 ∆x i+1/2 i−1/2
.
(∗∗) 3 (n) 1 (∗) 1 ∆t
(∗) (∗)
1 ∆t (∗)
[HU ]i = [HU ]i + [HU ]i − Gi+1/2 − Gi−1/2 + gηi hi+1 − hi−1
4 4 4 ∆x 4 2∆x
Third round:
(n+1) 1 (n) 2 (∗∗) 2 ∆t (∗∗) (∗∗)
H = H + H − F − F
i 3 i 3 i 3 ∆x i+1/2 i−1/2
[HU ](n+1) = 1 [HU ](n) + 2 [HU ](∗∗) − 2 ∆t G(∗∗) − G(∗∗)
2 ∆t
(∗∗)
+ gη h − h
i i i i+1 i−1
3 3 3 ∆x i+1/2 i−1/2 3 2∆x i
(26)
Reconstruction and flux calculation
In practice, it may be more beneficial to perform the MUSCL reconstruction on η and U .
Recall that η is related to H by H = η + h, and U can be obtained as [HU ]/H.
Using the cell interface at xi−1/2 for example, before each round of the SSP-RK iteration,
+ − + −
we perform the MUSCL reconstruction to obtain ηi−1/2 , ηi−1/2 , Ui−1/2 , and Ui−1/2 . The
total water depth can be calculated as
+ + − −
Hi−1/2 = ηi−1/2 + hi−1/2 , Hi−1/2 = ηi−1/2 + hi−1/2 . (27)
Since the still water depth h(x) is a given and doesn’t change in time, we can simply use
linear interpolation to find its intercell values.
Then, we feed
+ +
Hi−1/2 Ui−1/2
" +
#
Hi−1/2
~+
φ , f~i−1/2
+
i−1/2 = = + 1 + .
+ + + +
Hi−1/2 Ui−1/2 Hi−1/2 (Ui−1/2 )2 + g (ηi−1/2 )2 + 2ηi−1/2 hi−1/2
2
(28)
and
− −
− Hi−1/2 Ui−1/2
" #
Hi−1/2
~−
φ −
, f~i−1/2
i−1/2 = = − 1 − .
− − − −
Hi−1/2 Ui−1/2 Hi−1/2 (Ui−1/2 )2 + g (ηi−1/2 )2 + 2ηi−1/2 hi−1/2
2
(29)
8
ESOE 5136 2021 May 24 - Handout Lo
into the HLLC solver to obtain the numerical fluxes, i.e., Fi−1/2 , Fi+1/2 , Gi−1/2 , and Gi+1/2
in (26).
Stability condition
The CFL condition needs to be satisfied:
∆x
∆t ≤ CCFL , (30)
uCFL
where uCFL is a characteristic speed. In nonlinear equations, the characteristic speed is
not easily known. For NSWE, it is generally estimated as
p
uCFL ' max(|U | + gH). (31)
Since U , H, and uCFL change in time, ∆t also changes in time. Thus, a dynamic time
step (動態時間步) is used – ∆t needs to be calculated at each time step using the latest
numerical results.
While the theoretical maximum Courant number CCFL of this numerical scheme can be
derived to be one for linearized equations, there is no theoretical proof for nonlinear equa-
tions. In my experience (and studies by other researchers), CCFL = 0.9 is stable for 1DH
problems.
References
Shiach, J. B. and C. G. Mingham (2009), “A temporally second-order accurate Godunov-type
scheme for solving the extended Boussinesq equations.” Coastal Eng., 56, 32–45.
Toro, E. F. (1992), “Riemann problems and the WAF method for solving two-dimensional
shallow water equations.” Philos. Trans. R. Soc. Lond., A., 338, 43–68.