Professional Documents
Culture Documents
Advection Equation in Scilab
Advection Equation in Scilab
Nanjing China
Pro ject :
Purpose :
1 Advection equation
with c ∈ R.
1. Which kind of phenomena can we model with this equation ? How can
we get this model more realistic (a simple answer is expected) ?
2. Solve this equation by hand (1) with the Method Of Characteristics
(MOC). How is behaving the solution ?
3. Show that we can write equation (1) under the following form
what is the name of function f ? Give the expression for f (c(t, x)).
4. We consider the following nite volume scheme
n+1/2 n+1/2
cn+1 − cni fi+1/2 − fi−1/2
i
+ = 0, (3)
∆t ∆x
n+1/2
in order to solve the advection equation. What is fi+1/2 ?
n+1/2
5. For fi+1/2 we consider the following function
0 n
n+1/2 f (cni ) + f (cni+1 ) f (ci+1/2 ) n
fi+1/2 = F(cni , cni+1 ) = − (ci+1 − cni ) (4)
2 2
1
with
f 0 (cni+1/2 ) = max(|f 0 (cni )|, |f 0 (cni+1 )|). (5)
Scheme (4)-(5) is stable under the following stability condition
∆t
max(f 0 (cni+1/2 )). ≤ 1. (6)
∆x
2 Burgers' equation
u(t, x)2
∂t u(t, x) + ∂x = 0, (7)
2
with u(t, x) the unknown, t the variable in time and x the variable in space.
1. Show that we can write Burgers' equation (7), under the following
form
∂t u(t, x) + ∂x f (u(t, x)) = 0, (8)
and give the formula/function f (u(t, x)).
2. Thus it is possible to use an explicit nite volume scheme to solve this
equation
n+1/2 n+1/2
un+1 − uni fi+1/2 − fi−1/2
i
+ =0 (9)
∆t ∆x
2
which writes under the form
n+1/2 n+1/2
fi+1/2 − fi−1/2
un+1
i = uni − ∆t = 0. (10)
∆x
with
n
n+1/2 f (uni ) + f (uni+1 ) ai+1/2 n
fi+1/2 = F(uni , uni+1 ) = − .(ui+1 − uni ) (11)
2 2
with the velocity ani+1/2 = max(|f 0 (uni )| , f 0 (uni+1 )) and the CFL condi-
tion writes
n ∆t
0< max ai+1/2 . ≤ 1. (12)
i∈{1,...,J−1} ∆x
Question : Give the expression of f 0 (uni ), then apply the nite volume
scheme with a scilab code to the wave rarefaction with the following
initial condition
−1, if x ≤ 0
u0 (x) = (13)
1, if x > 0
and the following data.
Data : For x ∈ [−1, 1] and t ∈ [0, 2].
with h(t, x) is the water height [m], u(t, x) the ow velocity [m/s], q(t, x) =
h(t, x)u(t, x) the unit discharge [m2 /s], g = 9.81 the constant of gravity
3
[m/s2 ], S0 = −∂x z(x) the opposite of the bed slope, z(x) the topography
[m], Sf the friction term depending of the considered friction law. We consi-
der here the Manning friction law Sf = n2 q|q|/h10/3 . The rst equation of
system (14) is the mass conservation equation and the second one is the mo-
mentum equation. Under some ow conditions, the shallow water equations
can simplify under the kinematic wave's equations
∂t h + ∂x (hu) = 0
, (15)
S0 − Sf = 0
or again
∂t h + ∂x q = 0
, (16)
S0 − Sf = 0
1. Show that with Manning friction's formulation and the kinematic wa-
ve's model (15), we have
r
|S0 | 10/3
q(t, x) = sgn(S0 ) h , (17)
n2
with sgn the sign function.
2. With relation (17) we have q(t, x) as a function of h(t, x). Starting
form relation (17), show that we can write h(t, x) as a function of
q(t, x).
Indication : It writes under the form h(t, x) = (q(t, x) n /|S0 |) , with
α β γ
4
4. Thus it is possible to use an explicit nite volume scheme to solve this
equation
n+1/2 n+1/2
hn+1 − hni fi+1/2 − fi−1/2
i
+ =0 (20)
∆t ∆x
which writes under the form
n+1/2 n+1/2
fi+1/2 − fi−1/2
hn+1
i = hni − ∆t = 0. (21)
∆x
with
n
n+1/2 f (hni ) + f (hni+1 ) ai+1/2 n
fi+1/2 = F(hni , hni+1 ) = − .(hi+1 − hni ) (22)
2 2
with the velocity ani+1/2 = max(|f 0 (hni )| , f 0 (hni+1 )) and the CFL condi-
tion writes
n ∆t
0< max ai+1/2 . ≤ 1. (23)
i∈{1,...,J−1} ∆x
Question : Give the expression of f 0 (hni ), then apply the nite volume
scheme with a scilab code to get the evolution of z + h as a function
of x (plot z and z + h at dierent time steps) with the following data.
Data : S0 = 0.005, n = 0.02, J = 200 the number of cells in space,