We can work on Write a MATLAB script that solves the initial value problem coming out of Task 1.1 for = 0:1 using ode45 for u0(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 u0(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.

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-di usion equation

 

u_ (x; t) + v0ux(x; t) =  uxx(x; t):                                                                                                       (1)

 

For all numerical examples, please consider 0 x 2 , a nal time of tend = 2:0 and a value of v0 = 1:5.

 

Task 1. (25 marks)

 

(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:

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 1

u^k

N

k=0

(t)eikx

 

 

into (1)?

 

What are the N equations that result from enforcing R(u(xn; t)) = 0 at N equidistant mesh points

 

xn =

2 n

 

N

;  n = 0; : : : ; N     1?                                       (2)

 

How can those N equations be written compactly using the spectral di erentiation 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 However, in your MATLAB code, be sure to use the matrix D that is de ned in the provided examples.

 

(5 marks MATLAB plus 5 marks explanation) Write a MATLAB script that solves the initial value problem coming out of Task 1 for = 0:1 using ode45 for u0(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 u0(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)

(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.
(5 marks) Write down the general solution of the di erential equation arising from Task 1.
(5 marks) Find a text book that tells you what the Fourier transform of cos(3x) is. Write down the result and cite your
(5 marks) How does the solution from Task 2 look like for initial values u(x; 0) = cos(3x) and u(x; 0) = cos(7x)?
(10 marks) Based on your results from 4, explain your observations in Task 1.2.

 

Task 3. (30 marks)

(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), tend ( nal time), v0 (transport velocity), (viscosity) and u0 (initial  value  in physical space) .
(5 marks) Write a MATLAB function that solves Equation (1) using centred nite dif- ferences for both ux and uxx and explicit Euler and returns the approximate solution at the end of the simulation. The function should have input variables Nx (number of nite di erence points), tend ( nal time), v0 (transport velocity), (viscosity) and u0 (initial value in physical space). You can copy the code to generate the needed nite di erence matrices from the examples provided in

(5 marks) Write a MATLAB script that calls your functions from 3.1 and 3.2 for initial values

u(1)(x) = exp     (x      )  

 

 

and

0

 

 

(2)

0:52

 

2                                  4

 

u0 (x) = heaviside(x 3 ) heaviside(x 3 ):

Have the script generate four gures, each containing the solution from the pseudo-spectral as well as from the   nite di erence method.  The four   gures should show the resulting

solutions (in physical space) for u(1) and u(2) with  = 1:0 and  = 0:005. Use N = Nx = 64

0            0

modes/nodes in all cases. For explicit Euler, use 4 N = 256 time steps.

 

(15 marks) Describe the results in Task 3.

 

Task 4. (15 marks)

 

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 di erence approximation of ux 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.

Is this question part of your Assignment?

We can help

Our aim is to help you get A+ grades on your Coursework.

We handle assignments in a multiplicity of subject areas including Admission Essays, General Essays, Case Studies, Coursework, Dissertations, Editing, Research Papers, and Research proposals

Header Button Label: Get Started NowGet Started Header Button Label: View writing samplesView writing samples