Lab Exercises )

Recommended reading from Numerical Recipes ("NR"):
 
Ch. 19.


Exercise 1.

Solve the 1-d wave equation (d^2u/dx^2=c^2*d^2u/dt^2) for a gaussian wave form u(x) of unit height and std dev of 1/20, traveling at a speed c=1 toward positive values on the x axis. (The units here are "machine units"!). Choose computational domain of lenght L = 1, such that x=[-L/2,L/2], and start the packet centered on x=0 at t=0. Simulate for t=2, finding the solution at a sufficient number of times in between to make an animation. Use hard reflecting boundaries (u(-L/2)=u(L/2)=0).

Repeat with "soft" reflecting boundary at L/2 (du/dt=0) and outgoing baundary condition at -L/2 (c*du/dt=du/dx)

Exercise 2.

An electric potential phi(x,y) in a 2-D square domain x,y=[0..1,0..1] is held fixed at phi(0,y) = 1 V, and 0 V on its three other outer boundaries. Use a finite difference method + SOR to solve for phi at a set of regular grid points in the square's interior.

As a second part, deform the outer boundaries, fix the potential at some region in the square's interior, or put a source (charge) in there somewhere, turning the Laplace equation into a Poisson equation.