Starting from:

$25

MATH281-Project 1 Solved

1  Project Outline
The term project is divided into three section, each with a corresponding Jupyter workbook. Each workbook will ask you to investigate various aspects of numerical methods or PDEs. You will then be expected to submit a PDF report for each workbook, answering the questions.

1             Workbook Questions [20 points total]
(a) [2 marks] Suppose that we have a spatial domain x ∈ [0,1]. Using u(x) = sin(2πx), numerically compute the derivative for three grids:{0,0.1,0.2,...,0.9}
{0.05,0.15,0.25,...,0.95}
{0,0.1,0.2,...,1.0}
A partial solution is provided in the workbook that computes the derivative for the first grid. Create a plot comparing the three solutions (basic plot started in sample solution). What differences, if any, are there between the three solutions, and what causes them?

You should create a final plot that shows the three derivatives together to support your answer.

(b) [2 marks] Consider the function u(x) = exp(−x2) on a series of grids ranging from x ∈ [−1,1], x ∈ [−2,2], x ∈ [−3,3], and x ∈ [−5,5], each with the same spacing of ∆x = 0.1.

Compute du/dx for each grid using the second-order scheme, and plot the derivatives on the same graph. Nominally, these would all be the same (they’re derivatives of the same function). What differences do your observe, and what causes them?

The last case (Lx = 10) is already completed in the workbook.

[5 marks]
The provided code uses 2nd and 4th order finite difference approximations to compute the derivative of sin(x) for various values of ∆x. The error is then plotted as a function of the resolution, which illustrates the order of convergence. That is, as ∆x decreases, the error in the computed derivative decreases. More-over, the second order scheme decreases at the same rate as ∆x2, while the fourth order scheme decreases at the same rate as ∆x4.

If you change the variable ‘Nmodes’ to be 10, the code will produce the results for sin(10πx).

Describe the change in the error curve, and provide an explanation [hint: what happens for large ∆x?].

The plots of the derivatives (also included in the provided code) may be useful.

[5 marks] We saw that a basic scheme for stepping forwards in time is
In this question you will investigate the impact of the choice of ∆t on the solution.

For the set of ODEs below, you need to:

Compute the analytic (true) solution
Numerically integrate over the specified time range to get the approximate solution.
Compare the numerical results to the analytic results, and discuss the impact of ∆t
What can you say about the long-term trend in the error? Is this different from the other cases?
Why or why not?

ODEs to consider:

) from t = 0 to t = 2. u(0) = 0. Use ∆t = 0.01,0.05,0.2  from t = 0 to t = 100. u(0) = 0.01. Use ∆t = 0.001,0.01,0.05. You may want to use a

log-y plot.

= 2 from t = 0 to t = 10. u(0) = 0.. Use ∆t = 0.01,0.1,1.0.

The workbook includes a sample solution for .

[6 marks]
Consider the following PDE:

∂u∂t = ∂u∂x
u(0,x) = exp(−x2)
x ∈ [−5,5] (periodic domain)
t ∈ [0,10]
Recall that our (simplest) differentiation schemes are:

Putting these into our PDE, we get

The provided code computes a numerical solution for a given ∆x and CFL coefficient. Repeat the process for a selection of CFL coefficients: 0.5, 0.1, 0.01.

What kind of errors do you observe? (i.e. describe the physical appearance of the error terms).

Using trial and error (i.e. pick some numbers to try), how large can you reasonable take your CFL factor? Explain your reasoning. [Note: we’re not looking for a specific answer here, but rather your reasoning and justification].

More products