You are on page 1of 3

MATH3700 Practice Questions Sem 2, 2021

Practice Questions Set: Numerical Methods


1. Consider a numerical scheme for the linear advection equation ut + cux = 0 with u(x, 0) =
f (x) and c > 0. Let ρ = δx/δt, xi = iδx, tj = jδt and uij ≈ u(xi , tj ).

(a) Let f (x) =  cos πx



δx oscillating exactly with the spacing of the mesh points xi on
the x-axis with the amplitude . Consider the scheme
c
ui,j+1 = ui,j − (ui+1,j − ui,j ) . (1)
ρ
Show that
c j
 
ui,j = 1+2 (−1)i .
ρ
Explain why the scheme is not stable. Show that the same initial condition to the
scheme  
c c
ui,j+1 = 1 − ui,j + ui−1,j .
ρ ρ
leads to
c j
 
ui,j = 1−2 (−1)i .
ρ
State the numerical domain of dependence of the solution at (xi , tj ) in each case.
(b) Assume that we have the finite difference approximation
c c
ui,j+1 = − ui+1,j + ui,j + ui−1,j
2ρ 2ρ

for the advection equation ut + cux = 0 with u(x, 0) = f (x) and c > 0. Verify that
the CFL condition for this method is also c ≤ ρ. Is this scheme stable?
(c) Show that the finite difference approximation
c c
ui,j+1 = − ui+1,j + ui,j + ui−1,j
2ρ 2ρ

for the advection equation ut + cux = 0 with u(x, 0) = f (x) and c > 0 is consistent.

2. Let u(x, t) be a function of x and t, and F (u) is a function of u. How do you write the
forward and backward difference scheme for ∂F∂x(u) ? Using the scheme for ∂F∂x(u) , write a
finite difference scheme for
ut + (F (u))x = 0.

3. Let the flux function F (u) = u2 /2 + u, so that the advection equation is

ut + (u + 1)ux = 0.

Let the initial data be f (x) = x/(1 + x2 ). Find cmax , and hence determine the restriction
on δx and δt which satisfies the CFL condition.

4. Using the centred or central difference scheme in x and y directions, find the finite difference
scheme for the mixed partial derivative uxy of u. Show that the resulting is scheme is of
second order.

5. Show that the Crank-Nicolson scheme is consistent.


MATH3700 Practice Questions Sem 2, 2021

6. Consider the the heat equation

∂u ∂2u
= in (0, 1),
∂t ∂x2
subject to the initial condition u(x, 0) = x + 2 and the boundary conditions u(0, t) =
u(1, t) = 0. We want to use the explicit numerical scheme with k = 1:

k 2 δt
 
δt 2 δt
ui,j+1 = k 2 2
ui+1,j + 1 − 2k 2
ui,j + ui−1,j .
(δx) (δx) (δx)2

(a) Consider the above numerical scheme with the time step δt = 0.1 and the spatial step
δx = 0.2. Does this scheme satisfy the stability condition?
(b) Find the numerical solution of the heat equation at the grid points 0.2, 0.4, 0.6, 0.8 at
time t = 0.02 using the time step δt = 0.01 and spatial step δx = 0.2.
(c) Now apply the Crank-Nicolson scheme
 
ui,j+1 − ui,j 2 ui+1,j − 2ui,j + ui−1,j ui+1,j+1 − 2ui,j+1 + ui−1,j+1
=k w + (1 − w) ,
δt (δx)2 (δx)2

where w = 1/2 and k = 1 to compute the solution at the grid points 0.2, 0.4, 0.6, 0.8
at time t = 0.02 using the time step δt = 0.01 and spatial step δx = 0.2.

7. Consider the Poisson problem −∆u = x + y in the domain Ω = (0, 1) × (0, 1) with the
boundary condition u = 0 on the boundary of the domain. Using 4 equidistant points
in x and y direction as given in the picture below and using five-point stencil write the
linear system of equations for the discrete solution at 4 inner points (filled circles) of the
domain Ω. The grid points are displayed in the picture below, where interior mesh points
are indicated by filled circles. Solve the linear system using matlab or any other software
and write solutions at these 4 grid points. Include at least four digits after the decimal
point.

(0,1) (1,1)

(0,0) (1,0)

8. Consider the Burger’s equation ut + uux = 0 in R × R+ with the initial condition u(x, 0) =
f (x). Using the forward difference scheme for the time and spatial derivatives, write a
finite difference for the equation. Let the magnitude of the solution be bounded by 1.

(a) Find the CFL condition for the scheme. Is the scheme upwind if u is always positive?
If not, change the difference scheme for the spatial derivative and check if the new
scheme is an upwind scheme.
(b) What happens if u is always negative?

9. Consider the viscous Burger’s equation ut +uux = νuxx in R×R+ with the initial condition
u(x, 0) = f (x). Write a simple numerical scheme for this equation.
MATH3700 Practice Questions Sem 2, 2021

10. Let h > 0. Find A, B and C so that the approximation formula


f 0 (x) ≈ Af (x − 2h) + Bf (x − h) + Cf (x)
is exact for f (x) = x2 . Check the formula for f (x) = 1 and f (x) = x.
11. Let h > 0. Find A, B and C so that the approximation formula
f 00 (x) ≈ Af (x − h) + Bf (x) + Cf (x + h)
is exact for f (x) = x2 .
12. Consider the advection equation
ut + cux = 0, u(x, 0) = f (x).
Apply the forward difference approximation for the time derivative and the central differ-
ence approximation for the spatial derivative to get the finite difference approximation
c c c
ui,j+1 = − ui+1,j + ui,j + ui−1,j = ui,j − (ui+1,j − ui−1,j ) .
2ρ 2ρ 2ρ
This FTCS is not stable. We now derive Lax scheme using this by replacing ui,j with
1
2 (ui+1,j + ui−1,j ) to get
1 c
ui,j+1 = (ui+1,j + ui−1,j ) − (ui+1,j − ui−1,j ) .
2 2ρ

We now consider a solution in the form ui,j = G(j)erxi I , where xi = iδx, I = −1 and
r ∈ R. This results in the following formula for G(j + 1)
 
rxi I 1 rxi+1 I rxi−1 I
 c rxi+1 I rxi−1 I

G(j + 1)e = G(j) e +e − e −e
2 2ρ
(a) Show that the amplification factor
G(j + 1) cI
= cos(rδx) − sin(rδx).
G(j) ρ
(b) Show that
G(j + 1) |c|
G(j) < 1 if < 1.

ρ
13. Consider the partial differential equation
ut = uxx + ux in (0, 1).
Using the forward difference approximation for ut , and centred difference approximations
for uxx and ux , find an explicit finite difference scheme for the given partial differential
equation. Use ui,j ≈ u(xi , tj ), where xi = iδx, i = 0, 1, · · · , n with δx = n1 , and tj = jδt.
14. Consider the finite difference scheme
δt
ui,j+1 = βui+1,j + (1 − 2β) ui,j + βui−1,j , β=
(δx)2
for the the heat equation
∂u ∂2u
= in (0, 1),
∂t ∂x2
subject to the initial condition u(x, 0) = x + 2 and the boundary conditions u(0, t) =
u(1, t) = 0. Compute the truncation error of the scheme and show that the scheme is
consistent.

You might also like