This assignment is due Thursday December 5, 2019 at midnight (with a 5/100 points/day deducted for late submissions). Submit your assignment to the Assignment Dropbox tab on the course website as two python scripts. Do not submit the data your script creates (it'll be too big).

Note: there is no "submit" button, if your files are in the dropbox, we will see it.

1.

Take the python code heatimplicit.py which is similar to the one that was used in the partial differential equations lecture to solve the heat equation for various time steps.

  1. Strip out the plotting commands.
  2. Instead, save the time and space varying temperature as solved for each of the values of the time step dt (0.00005, 0.0005, 0.005, and 0.05) into a netcdf file. For each timestep, the file should contain a two dimensional array with time and space dependent T values
    Try to choose names and attributes in the netcdf file that would "self"-describe the data.

2.

Write a script to read the data from the netcdf file you just created. With this data, compute how much subsequent solutions change, as follows.

To compute how much the data for dt=0.00005 differs from that of dt=0.0005, substract the corresponding points in the two-dimensional arrays for dt=0.00005 and dt=0.0005 (not that the former contains 10x as many points, so pick every tenth point in the comparison). Take the average of the squares of these differences as a measure of the overal difference between dt=0.00005 and dt=0.0005 data. Repeat this to compare dt=0.0005 and dt=0.005, and finally compare dt=0.005 and dt=0.05.

The script should compute these and print the value of dt value and the corresponding average sum of squares.