Consider the problem

<jsm>u_t=u_{xx}</jsm>, <jsm> t\ge0,</jsm> and <jsm>0<x<1</jsm>

with initial condition

<jsm>u(x,0)=\sin(\pi x)</jsm>

and boundary conditions

<jsm>u(0,t)=0</jsm> for <jsm> t\ge0,</jsm>

and

<jsm>u(1,t)=0</jsm> for <jsm> t\ge0.</jsm>

Implement the Forward Euler method, the Backward Euler method and the Crank-Nicholson method for the heat equation..

Task 1 Implement the above mentioned methods. Verify the order in time and space for each of the implemented techniques. Compare the numerical solution with a reference solution obtained using one of the three techniques with very small step sizes in space and time. Think about what you should do to compare the reference solution to the numerical approximations given by the three methods. Derive the exact solution of this problem (use separation of variables) and verify that everything works as with the reference solution also when comparing the numerical approximations to the analytic exact solution.

Task 2 Make numerical experiments with rather large values of the time-step. What do you observe?

Task 3 Consider now a heat equation problem with Neumann boundary conditions. Implement these boundary conditions using different strategies (order 1 and 2, with and without fictitious nodes) and verify the order for each strategy.

Task 4 Consider periodic boundary conditions, implement the three methods again and check the order in space and time.

2014-01-20, Elena Celledoni