程序代写代做 AERO40003 Computing and Numerical Methods 1 Coursework Project 2019-2020

AERO40003 Computing and Numerical Methods 1 Coursework Project 2019-2020
Dr. Maria Ribera Vicent & Dr. Elnaz Naghibi
Due Date: 20 March 2020
PART 1 – MATLAB [50%]
Conduction: Temperature distribution on a 2-dimensional plate.
There are three basic modes in which heat is transferred: conduction, convection and radiation. Conduction is the transfer of heat by virtue of the temperature gradients in the medium (you will learn more about heat transfer soon in your Thermodynamics and Heat Transfer module).
The heat conduction equation can be used to calculate the variation of temperature on the plate as a function of time, and after some assumptions (i.e. constant thermal conductivity) it simplifies to:
(1)
where is the thermal diffusivity of the material.
The time derivative can be discretise with some time step and equation (1) can be rewritten as: (2)
The spatial derivatives can also be approximated by finite differences, so that:
(3)
To solve the conduction equation above, all that is missing are the initial condition at time zero and/or some boundary conditions defining the temperature at the walls of the plate.
Part (a) [20%]
Consider a rectangular plate of a conductive material with dimensions w = 2m and h = 1m. Initially, this plate is at ambient temperature, 273K. Choose an adequate spatial discretisation for your domain.
The sides of the plate are suddenly and instantaneously heated. The left side of the plate is heated to 500K; the top side is heated to 400k; the bottom side is at 420K, while the right side as at 350K.

Plot the discretised domain and the initial temperature profile (use an adequate plotting function such as surf or contourf).
Iterate for 10 minutes. Use a time step of 0.1 seconds.
Display the temperature profile after 1 minute, 3 minutes, 5 minutes and 10 minutes. Put labels and a title in your plots, and save as JPEG figures.
Take .
% Enter your code here
% If you need to write any functions, please save them in a separate .m
% file.
Part (b) [10%]
Use the function fit to obtain a surface to approximate the data in part (a) after 1 minute. There are many types of surface fit possible, try with two different types of your choice (i.e. interpolant, polynomial…). Make sure you output the goodness-of-fit statistics of each surface approximation (see the documentation for explanation).
Which of the two gives the better approximation to your data? Explain briefly.
Plot both surfaces in separate plots, with the corresponding labels and title. Save as a JPEG file.
In a single figure, plot the values of both functions along the line y=0.5 for all values of x (i.e., the line that splits the plate in half), along with the original points from part (a) at the same location. Make sure you add labels, title and a legend. Save the figures as JPEG file.
Hints:
• the function fit requires the input in columns, so reorganise your data to have both the coordinates and the temperature each in a column vector.
• save the data above corresponding to the first minute in a separate array to use later.
• The output of the fit function is a sfit object, which works similarly to function handles. You can read more about them in here.

Part (c) [10%]
Use the fmincon function to find the minimum temperature in the plate above, and the location where it occurs, in the same snapshot after 1 minute. (Note: we are not applying any constraints other than the bounds on the x and y dimensions so that the search takes place within the plate; all the other input to fmincon must be defined, but can be an empty array – see documention for examples).
Start your search from the point [2,1], corresponding to the upper right corner.
Display your answer neatly (you may use disp or fprintf but either case format your string nicely) Hint: remember you can use the sfit object as a function handle when using fmincon. *OPTIONAL, for fun :)*
You can play with the options to fmincon, for instance you can display all the iterations in the search.
You could also explore what other outputs you can get from the function in structures that group different values of interest, such as the gradient of the function at the solution or the Lagrange multipliers.
Part (d) [10%]
Now repeat the above with different boundary conditions. Rather than a uniform temperature for each side, we consider the entire plate at ambient temperature except the following nodes/regions that will be heated to 500K:
T(0,0-0.45) = 500K
T(0,0.75-1) = 500K
T(1-1.6,0) = 500K
T(1-0.7,1)= 500K
T(1.2-1.7,1)= 500K
T(2,0.3-0.6) = 500K
Rather than repeating the entire code again, you may choose one of the following two options:
• Ask the user which case to run, then use a switch to define the boundary conditions. or • Use a loop to repeat the process for each set of boundary conditions.
Do the approximation functions you used for part (b) work as well in this part? If not, consider using a higher degree polynomial or other functions to give you a better fit.
Start the search of the minimum from [0,1], corresponding to the top left corner.

Hints:
• make sure you don’t overwrite your saved figures.
• you could also use your condition to have the different starting values in each case.
*Some general tips:*
*•* make sure you don’t overwrite your figures!
• look at your results and see if they make sense. If not, what can you change? the step size? the type or degree of the interpolating function? While an exact interpolant for part (d) might be difficult, at least think about it.
• read the markscheme and make sure that your code is well commented and indented.
• when asked to save the figures, remember to put them in your folder together with your livescripts, before zipping and uploading the compressed folder.