UNIVERSITY OF EXETER
Engineering
August 2024
ENGM003: resit exam2
Module convenors: Prof G Hrkac
Duration: 90 min
Answer question 1 and 2. Full marks (50 (subject to moderation at the Examination Board).
The maximum marks attainable are indicated in square brackets.
This is a ‘open book’ examination.
1. Write a code that calculates the power series for x; a random value between []0,2π] suppose that i=√
−1 is the imaginary unit
(i) using a for loop and run it for 3, 4, 5, 7, 9, 11, 13 and 15 times. Plot the solution as function of loop iterations. [8,2]
(ii) using a while loop where the error is smaller than 0.0001. [10]
(iii) Modify the while loop code so that you can read in a vector x of dimension 10 with random values ranging from 0 to 2π and plot the solution. [5]
2. Write a code that solves the following 2-dim transient heat equation
thermal diffusivity α = 0.01
The plates dimensions in x and y are 10 units by 10 units. The space resolution (dx and dy) should be 0.1 in x and y,the final time is 20s and the time step is dt=0.01.
The initial conditions are T0=250 everywhere except at the boundary elements.
The boundary condition for the 4 edges (T1,T2,T3,T4) is T1=T2=100 and T3=T4=200, the boundaries are labeled clockwise.
(a) Write a code to solve the transient Heat equation (see above) using finite difference and make sure that teh boundary conditions are preserved. [10]
(b) Change the code in such a way that the Laplace term is solved in a separate function. [5]
(c) Change your code so that you can plot and see the updates of the temperature solution on the screen immediately. [5]
(d) Change the code to include one source terms, first in the centre of the plate (2units x 2units area) with the value of 450 K and write a ploting function to visualise the result. [5]