Professional Documents
Culture Documents
Adv Exam PDF
Adv Exam PDF
Because of the periodic boundary conditions, this solution should wrap back on itself at integer
times, t = 1, 2, 3, . . . We will consider a final time of T =4. At that time, the exact solution is
equal to the initial condition and therefore the difference between our numerical solution and the
initial condition provides a direct measure of the error. We will use the pointwise infinity norm to
measure the error:
where xj are n uniformly-spaced nodes and uj is the numerical approximation at those nodes.
du
= Cu, (2)
dt
where C is derived from centered finite differences being applied to ∂u ∂x with a uniform grid and
grid-spacing ∆x = 1/n. Defining xj = j · ∆x, j = 1, . . . , n, leads to unknowns u = [u1 u2 . . . un ]T ,
with u0 ≡ un because of the periodicity condition. The resultant system matrix is
0 1 −1
−1 0 1
c .. ..
C=−
−1 . . .
2∆x
. .
.. .. 1
1 −1 0
• Write a code to numerically solve (1) using RK4 in time coupled with centered finite differences
in space using grid spacing ∆x = 1/n.
• Answer the following questions using the value of n given on the Relate page.
(a) What is the largest value of the Courant number (CFL) for which this scheme is stable?
• ANS: CFLmax = ?
(b) For the given n, what is the largest time step size ∆tmax for which this approach is stable?
• ANS: ∆tmax = ?
(c) For the given value of n and CFL= 0.5, what is the error, n , at time T = 4?
• ANS: n = ?
(d) Solve (1) with your code using n, 2n, 4n, and 8n points while keeping CFL= 0.5. Make
a table with columns ∆x and error at time T = 4. (You do not need to submit the
table.) From the tabulated values, what is your observed order of convergence, p, such
that n = O(n−p ) = O(∆xp )?
• Let y = [u1 u2 . . . um ]T be the solution associated with m points and and let z =
[u2 u4 u6 . . . u2m ]T be every second point for a solution with 2m points. Respective en-
tries in y and z correspond to approximate solutions at xj = j · ∆x for j = 1, . . . , m with
∆x = 1/m. We can thus combine them using Richardson extrapolation to get an improved
answer at these points. Do this for m = n, 2n, and 4n. That is, construct a new numerical
solution
wj = αzj + (1 − α)yj , j = 1, . . . , m,
such that wj is a better approximation to ũ(xj , 4) than either yj or zj .
(e) What is the smallest error that you obtain in this case? That is, what is
:= max |u0 (xj ) − wj |
j