Class Home

Class 5: Numerical Solutions of Partial Differential Equation


Problem (9.1): Wave Equation

An initial pulse is applied to a single node at time t=0. Response does not converge when there is no numerical damping, even when the Courant condition, which should ensure stability, is satisfied comfortably. When numerical damping is included for stability, the response convergence and behaves well

Python (2.6) source code for solution to wave equation. Uses numpy and Tkinter


Problem (9.2): Diffusion Equation

Solved using both explicit and implicit methods, with three different time steps (dt = 0.1, 0.5 and 1.0). In each case, dx = 1 and diffusion coefficient, D = 1. Explicit method converges for dt = 0.1. For dt = 0.5, it moves towards convergence, but with a lot of local noise. Explicit method blows up for dt = 1. Implicit method converges for all three time steps

Python (2.6) source code for explicit and implicit numerical solutions. Both use Tkinter and numpy


Problem (9.3): Solution of Laplace Equation using ADI

Adapted from code for implicit method in (9.2). Solved on a grid of 100 x 100 nodes, with a diffusion coefficient, D, of 1. With dx = 1, a time step of dt = 0.7 converges. Current code starts with two blobs of ink. Commented-out code sets initial values at nodes to random floats between 0 and 2. Boundary conditions are fixed

Python (2.6) source code. Uses Tkinter and numpy


Problem (9.4): SOR

SOlved on a grid of 100 x 100 nodes. Alpha of 1.7 is used. Optimumvalue of alpha, according to class notes, should be 1.94. This changed the solution so, since solutions should be insensitive to parameters, I used a lower alpha (less aggressive)

Python (2.6) source code. Uses Tkinter and numpy