Part A: Consider the Poisson equation
∇²u = f(x)
for 0 < x < 1.
Figure 1: Discretization of the second derivative on a uniform mesh
1. Discretize (∇²u) on a uniform mesh using the following approximation for the second derivatives (see Fig.1):
u(x+1) = u(x) + Δx²/2 * (u(x+1) - 2u(x) + u(x-1))
u(x-1) = u(x) + Δx²/2 * (u(x+1) - 2u(x) + u(x-1))
This expression is second-order accurate on a uniform grid. Use an analogous expression for the y-derivatives. Use the cell-centered grid arrangement shown in Fig.2. The ghost points (shaded) can be used to evaluate the boundary condition.
Figure 2: Grid system for the solution of the Poisson equation. The shaded points are ghost points.