MTH3007b Weekly Problems 10
Original Documents: Problem Sheet / Provided Solutions
Vibes: …
Used Techniques:
- …
10.1. Liebmann’s Method: Definition and Scope
Question
What is Liebmann’s method and what type of equation can it solve?
Liebmann’s method (also called Gauss-Seidel iteration applied to PDEs, or successive overrelaxation at ) is an iterative scheme for solving elliptic PDEs, specifically the 2D Laplace equation and 2D Poisson equation:
These are steady-state equations - there is no time derivative. They arise in heat conduction (steady state), electrostatics, and fluid potential flow.
The method: On a uniform grid with spacing , the centred finite difference discretisation of the Laplace equation at interior node gives:
Liebmann’s method iterates this update rule (using the most recently updated values in-place, Gauss-Seidel style) until the maximum change between iterations falls below a tolerance :
The boundary nodes are fixed at their prescribed Dirichlet boundary conditions throughout.
10.2. Liebmann’s Method for a 2D Plate
Question
Use Liebmann’s method to find the steady-state temperature distribution on a cm plate with: top C, bottom C, left C, right C, cm. Find .
import numpy as np
domain_size = 10 # cm
spatial_step = 1 # cm
number_of_nodes = domain_size // spatial_step + 1 # 11 nodes in each direction
u_grid = np.zeros((number_of_nodes, number_of_nodes))
u_grid[0, :] = 100.0 # top boundary
u_grid[number_of_nodes - 1, :] = 0.0 # bottom boundary
u_grid[:, 0] = 75.0 # left boundary
u_grid[:, number_of_nodes - 1] = 50.0 # right boundary
convergence_tolerance = 1e-4
max_iterations = 10000
for iteration in range(max_iterations):
u_new = u_grid.copy()
for row_index in range(1, number_of_nodes - 1):
for col_index in range(1, number_of_nodes - 1):
u_new[row_index, col_index] = (
u_grid[row_index + 1, col_index]
+ u_grid[row_index - 1, col_index]
+ u_grid[row_index, col_index + 1]
+ u_grid[row_index, col_index - 1]
) / 4.0
max_error = np.amax(np.abs(u_new - u_grid))
u_grid = u_new.copy()
if max_error < convergence_tolerance:
print(f"Converged in {iteration + 1} iterations (max_error = {max_error:.2e})")
break
print(f"u(5, 5) = {u_grid[5, 5]:.2f} degrees C")Grid convention: with and nodes, the node at corresponds to the physical centre of the plate at cm.
The Lax Equivalence Theorem guarantees that because the Liebmann iteration implements a consistent discretisation of the Laplace equation and the iteration converges, the result converges to the true solution of the boundary value problem.
Expected result: C (the arithmetic average of the four boundary values: ). This is an exact result for this symmetric geometry by the mean value property of harmonic functions, confirming the numerical answer.
Visualisation:
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(6, 5))
im = ax.imshow(u_grid, origin='upper', extent=[0, domain_size, 0, domain_size], cmap='hot')
plt.colorbar(im, ax=ax, label='Temperature (deg C)')
ax.set_xlabel('x (cm)')
ax.set_ylabel('y (cm)')
ax.set_title('Steady-state temperature distribution (Liebmann)')
plt.tight_layout()
plt.show()