辅导案例-MECH 5315M-Assignment 2

欢迎使用51辅导,51作业君孵化低价透明的学长辅导平台,服务保持优质,平均费用压低50%以上! 51fudao.top
MECH 5315M { Engineering Computational Methods
Assignment 2
Copyright
R
2019 University of Leeds UK. All rights reserved.
Please submit electronically via Minerva before noon Tuesday 28 January 2020.
Your report should not be longer than 4 pages in total. Please use at least a font size of 11pt and
2cm margins on all sides. All MATLAB code should be attached to the report as an appendix.
The appendix does not count towards the 4 page limit. All gures in the report must have
captions, properly labelled axes, legends where necessary and must be described and analysed
in the text.
Problem. In this exercise, we will study a combination of the transport and heat equation
called the advection-diusion equation
_u(x; t) + v
0
u
x
(x; t) = u
xx
(x; t): (1)
For all numerical examples, please consider 0 x 2, a nal time of t
end
= 2:0 and a value of
v
0
= 1:5.
Task 1. (25 marks)
1. (3 5 = 15 marks) Derive the initial value problem in spectral space that arises when
solving (1) using the pseudo-spectral method. Proceed along the following steps:
a) How does the equation for the residual R(u(x; t)) look like that comes out of plugging
the truncated Fourier series
u(x; t) =
1
N
N1
X
k=0
u^
k
(t)e
ikx
into (1)?
b) What are the N equations that result from enforcing R(u(x
n
; t)) = 0 at N equidistant
mesh points
x
n
=
2n
N
; n = 0; : : : ; N 1? (2)
1
c) How can those N equations be written compactly using the spectral dierentiation
matrix D? You do not need to comment on the \trick" we used the rewrite the
second part of D and may simply ignore the issue. However, in your MATLAB code,
be sure to use the matrix D that is dened in the provided examples.
2. (5 marks MATLAB plus 5 marks explanation) Write a MATLAB script that solves the
initial value problem coming out of Task 1.1 for = 0:1 using ode45 for u
0
(x) = cos(3x)
and then plots the solution at the end of the simulation in both physical and spectral
space using N = 64. How does the solution change for an initial value u
0
(x) = cos(7x)?
Describe how the solution behaves. You do not need to explain the results here, this will
be done in Task 2.5.
Task 2. (30 marks)
1. (5 marks) Apply the continuous Fourier transform in x to Equation (1). Write down the
resulting equation in spectral space. Make sure to clearly explain what identities from
Fourier analysis you have used to obtain your result.
2. (5 marks) Write down the general solution of the dierential equation arising from Task
1.1.
3. (5 marks) Find a text book that tells you what the Fourier transform of cos(3x) is. Write
down the result and cite your source.
4. (5 marks) How does the solution from Task 1.2 look like for initial values u(x; 0) = cos(3x)
and u(x; 0) = cos(7x)?
5. (10 marks) Based on your results from 2.4, explain your observations in Task 1.2.
Task 3. (30 marks)
1. (5 marks) Write a MATLAB function that solves Equation (1) using the pseudo-spectral
method and explicit Euler and returns the approximate solution at the end of the simu-
lation in physical space. The function should have input variables N (number of Fourier
modes), t
end
(nal time), v
0
(transport velocity), (viscosity) and u
0
(initial value in
physical space) .
2. (5 marks) Write a MATLAB function that solves Equation (1) using centred nite dif-
ferences for both u
x
and u
xx
and explicit Euler and returns the approximate solution at
the end of the simulation. The function should have input variables N
x
(number of nite
dierence points), t
end
(nal time), v
0
(transport velocity), (viscosity) and u
0
(initial
value in physical space). You can copy the code to generate the needed nite dierence
matrices from the examples provided in Minerva.
3. (5 marks) Write a MATLAB script that calls your functions from 3.1 and 3.2 for initial
values
u
(1)
0
(x) = exp


(x )
2
0:5
2

and
u
(2)
0
(x) = heaviside(x
2
3
) heaviside(x
4
3
):
Have the script generate four gures, each containing the solution from the pseudo-spectral
as well as from the nite dierence method. The four gures should show the resulting
solutions (in physical space) for u
(1)
0
and u
(2)
0
with = 1:0 and = 0:005. UseN = N
x
= 64
modes/nodes in all cases. For explicit Euler, use 4N = 256 time steps.
2
4. (15 marks) Describe the results in Task 3.3.
Task 4. (15 marks)
1. Explain your observations in Task 3.3. Where necessary, you can generate new gures
to help your explanations. For example, it could be instructive to replace the centred
nite dierence approximation of u
x
with an upwind approximation and see how the
results change. Make sure that all gures clearly explain what they show and are properly
discussed in the text.
3
51作业君

Email:51zuoyejun

@gmail.com

添加客服微信: abby12468