AERO 300: AEROSPACE ENGINEERING
ANALYSIS
Spring 2021
Cal Poly San Luis Obispo
Homework 6
Assigned 05/21 — Due by 5pm on 05/28
Problem 1 (25 points)
In this problem, we consider the Crank-Nicolson method for the 1-D heat equation problem:
ut = Duxx , x ∈ [0 , L] , t ≥ 0
u(x, 0) = f(x) , x ∈ [0 , L]
u(0, t) = l(t) , t ≥ 0
u(L, t) = r(t) , t ≥ 0
,
where we have taken the 1-D spatial domain to have left endpoint x = 0 and right endpoint x = L .
The method uses the two-point centered difference to approximate the spatial derivative and integrate
the heat equation in time between two consecutive time steps tj and tj+1 using the trapezoid rule.
Let wi,j be the approximation of the exact solution u at the grid point (xi, tj) .
As shown in class, the resulting equation governing the temperature distribution at the inner grid points
is given by
− σwi−1,j XXXXXXXXXX2σ)wi,j+1 − σwi+1,j+1 = σwi−1,j + (2− 2σ)wi,j + σwi+1,j (1)
where
• σ ≡ Dk
h2
, with h and k the spatial and temporal step sizes respectively,
• i = 1, 2, . . . ,m , with m the number of (spatial) inner grid points, and
• j = 1, 2, . . . , n , with n chosen to reflect the specific time at which an approximation is desired.
1
1. (8 points) Let wj ∈ Rm and sj ∈ Rm be defined as follows:
wj =
w1,j
w2,j
...
wm−1,j
wm,j
and sj = σ
w0,j
0
...
0
wm+1,j
.
Determine the matrices A and B so that Equation (1) can be written in matrix form as
Awj+1 = Bwj + sj + sj+1 . (2)
2. (17 points) Implement your answer to the question above in a Matla
®
function similarly to those
shown in class for the Forward Difference and Backward Difference methods. Call your function
heatEquation1DCN.m. You may use the script example1.m from class to verify that your function
works as intended. Be sure to provide a mesh plot of your solution.
Problem 2 (40 points)
Consider the following 1-D heat equation problem:
ut =
1
π
uxx , x ∈ [0 , 1] , t ≥ 0
u(x, 0) = sin(πx) , x ∈ [0 , 1]
u(0, t) = 0 , t ≥ 0
u(1, t) = 0 , t ≥ 0
.
1. (10 points) Show that u(x, t) = exp(−πt) sin(πx) is the exact solution to the above problem.
Note that this means verifying that the provided function satisfies all the constraints of the above
heat equation problem.
2. (5 points) For a spatial step size of h = 0.1 , provide constraints on the temporal step size k required
for stability of the Forward Difference method applied to this problem.
3. (20 points) For a judicious choice of k , compute an approximate solution to the problem using
the Forward Difference method with h = 0.1 . Repeat using the Backward Difference method and
Crank-Nicolson method. Plot your results (along with the exact solution) at t = 1 .
4. (5 points) Which of the three methods most closely resemble the exact solution? Does this match
your expectations?
2
Problem 3 (35 points)
Consider the following 1-D wave equation problem:
utt = 4uxx , x ∈ [0 , 1] , t ≥ 0
u(x, 0) = 0 , x ∈ [0 , 1]
ut(x, 0) = 2π sin(πx) , x ∈ [0 , 1]
u(0, t) = 0 , t ≥ 0
u(1, t) = 0 , t ≥ 0
.
1. (10 points) Show that u(x, t) = sin(πx) sin(2πt) is the exact solution to the above problem.
2. (5 points) For a spatial step size of h = 0.05 , provide constraints on the temporal step size k
equired for stability of the three-point centered difference scheme applied to the wave equation.
3. (13 points) For a judicious choice of k , compute an approximate solution to the problem using
h = XXXXXXXXXXPlot your result (along with the exact solution) at t = 1 .
4. (7 points) Create a video showing the vi
ation of the string for t ∈ [0 , 1] .
3