Computational Physics

(Rick Simeone) #1
A7 Differential equations 589
Level 5 Level 4 Level 3 Level 2 Level 1

Level 1 Level 2 Level 3 Level 4 Level 5

Level 5

Figure A.4. The evolution of the trial solution to Poisson’s equation in two dimen-
sions with a positive and a negative point charge. The upper row shows the solution
during coarsening, and the lower row during refinement. The rightmost picture
is the rightmost configuration of the lower row with some extra Gauss–Seidel
iterations performed.

Laplace operator coupling neighbouring sites:


∇D^2 φ=

1


4 x^2

(φi+1,j+φi−1,j+φi,j+ 1 +φi,j− 1 − 4 φi,j), (A.107)

wherexis taken twice as large as on the fine grid. We now have all the ingredients
for the multigrid method at our disposal and we can write down the general algorithm
in a recursive form:


ROUTINE MultiGrid(Level,ψ,Residual)
Perform a few Gauss–Seidel iterations:ψ→ψ′;
IF (Level>0) THEN
CalculateResidual;
RestrictResidualto coarser grid:→Residual′;
Setφequal zero;
Multigrid(Level-1,φ,Residual′);
END IF;
Prolongateφ:→φ′;
ψ′′=ψ′−φ′;
Perform a few Gauss–Seidel iterations:ψ′′→ψ′′′;
END MultiGrid.

The number of Gauss–Seidel iterations before and after the coarsening procedure
must be chosen – typical values are two to five iterations. This algorithm can be
coded directly (see Problem A.7).Figure A.4shows how the method works for a
two-dimensional Poisson problem with a positive and a negative charge.

Free download pdf