关键词 > MATH4064
MATH4064 - COURSEWORK 2 SPRING SEMESTER 2021-2022
发布时间:2022-04-25
Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit
SPRING SEMESTER 2021-2022
MATH4064 - COURSEWORK 2
1. Problem set 1: Parabolic PDEs
Consider the following system of Partial Differential Equations (PDEs)
with Neumann boundary conditions |
in |
= 0 |
=0,
,
where ᵆ and
are the diffusion coefficients (
≫
ᵆ ). The forcing term is given by
(
,
) ≔
(
0 +
) −
,
[30 marks]
(1)
(2)
(3)
where 0 = 0.067.
(a) Write down the Crank– Nicolson scheme for this system of PDEs using first-order finite difference
approximations (using the two ending grid points) for the Neumann boundary conditions.
(b) Treating the forcing term explicitly, implement and solve part (a) for = 1 and
= 200 with the initial
condition be given by
(
, 0) = {0.1 for 0 ≤
≤ 0.9,
(
, 0) =
(4)
(5)
where = 2.26,
= 1/10,
ᵆ = 0.01
, using ℎ =
/99 and
=
/999. Plot your solution (two heatmaps, for
and
, on the plane (
,
), and one plot for
and
, versus
at final simulation time). [check https://www.tutorialspoint.com/matplotlib/matplotlib_contour_plot.htm for plotting heatmaps.]
(c) Let ℐ1 be the index set of all nodes (grid points) for a discretization with ℎ 1 =
/99, ℐ2 for ℎ2 = ℎ 1 /2, ℐ3 for ℎ3 = ℎ2 /2, and ℐ4 for ℎ4 = ℎ3 /2. Compute
where and
are given functions. Your code should use central finite differences to approximate the Laplacian operator
on a uniform grid with
+ 1 nodal points in each coordinate direction. Note, your code will need to solve the linear system of size (
− 1)2
=
, (8)
where is the vector of approximate nodal values, and should include separate routines to find
and
given
,
and
.
(b) Suppose
(
,
) = cos(4
) cos(4
) solves the above Poisson’s equation on
= [0, 1]2 . Find
and
and hence test your code by selecting
= 16, 32, 64, 128, 256, 512, 1024 and computing
of the approximate solution when = 64. [Hint: You will need to use a sparse matrix format for
, otherwise the system will not fit in memory for large N. Check https://www.geeksforgeeks.org/ how-to-create-a-sparse-matrix-in-python/andhttps://docs.scipy.org/doc/scipy/reference/ generated/scipy.sparse.linalg.spsolve.html]
[40 marks]
Consider the hyperbolic PDE (scalar transport)
(9)
(10)
(d) (two-dimensional) Using the solver implemented in (b), solve the scalar transport equation with the following parameters:
= (1, 0.5),
0 = (1 − cos
)(1 − cos
),
=
= 2
/20, and
= 1/10. Compare (plotting) your solution with the analytical one and compute the discrete
2 using the grid norm function for the final simulation time.