10 Partial Differential Equations

Numerical Methods · Unit 10

Partial Differential Equations

Exam-focused notes for Partial Differential Equations (Numerical Methods, BIT203): what the TU syllabus asks and how it has actually been tested, with 4 solved past questions from this unit.

Partial Differential Equations in short

Partial differential equations (PDEs) describe heat flow, electric fields, fluid flow and many other physical systems. We solve them numerically by replacing derivatives with differences on a grid of points.

Partial Differential Equations: notes

Poisson's equation and finite difference method

Poisson's equation in two variables is

$$\frac{\partial^2 f}{\partial x^2} + \frac{\partial^2 f}{\partial y^2} = g(x, y)$$

When $g = 0$ it is called Laplace's equation.

Finite difference method. Cover the region by a grid with spacing $h$ in both directions. Write $f_{i,j} = f(x_i, y_j)$. Use the central difference formula for second derivatives.

$$\frac{\partial^2 f}{\partial x^2} \approx \frac{f_{i+1,j} - 2f_{i,j} + f_{i-1,j}}{h^2}, \qquad \frac{\partial^2 f}{\partial y^2} \approx \frac{f_{i,j+1} - 2f_{i,j} + f_{i,j-1}}{h^2}$$

Add them and put the sum equal to $g_{i,j}$. The result is the five point formula.

$$f_{i+1,j} + f_{i-1,j} + f_{i,j+1} + f_{i,j-1} - 4f_{i,j} = h^2 g_{i,j}$$

Each interior point gives one linear equation. The unknowns are the values at the interior points.

Example. Solve $\nabla^2 f = 2x^2y^2$ on the square $0 \le x, y \le 3$. Take $f = 0$ on the boundary and $h = 1$.

The interior points are $(1,1)$, $(2,1)$, $(1,2)$ and $(2,2)$. Compute $h^2 g = 2x^2y^2$ at each.

Point$(1,1)$$(2,1)$$(1,2)$$(2,2)$
$2x^2y^2$28832

Boundary values are zero. Let $f_{1,1} = a$, $f_{2,1} = f_{1,2} = b$ and $f_{2,2} = c$. The problem is symmetric about the line $x = y$, so the two middle values are equal.

$$\begin{aligned} (1,1):\quad 0 + b + 0 + b - 4a &= 2 ;\Rightarrow; -4a + 2b = 2 \ (2,1):\quad 0 + a + 0 + c - 4b &= 8 ;\Rightarrow; a - 4b + c = 8 \ (2,2):\quad b + b + 0 + 0 - 4c &= 32 ;\Rightarrow; 2b - 4c = 32 \end{aligned}$$

From the first, $a = (2b - 2)/4 = 0.5b - 0.5$. From the third, $c = (2b - 32)/4 = 0.5b - 8$. Put both in the second equation.

$$\begin{aligned} (0.5b - 0.5) - 4b + (0.5b - 8) &= 8 \ -3b - 8.5 &= 8 \ b &= -5.5 \end{aligned}$$

Then $a = -3.25$ and $c = -10.75$. The solution is $f(1,1) = -3.25$, $f(2,1) = f(1,2) = -5.5$ and $f(2,2) = -10.75$.

What this unit covers

  • Poisson's equation and finite difference method
  • Laplace equation and steady state problems
  • Grid discretization and boundary conditions
  • Iterative solution of PDE systems
  • Heat conduction and temperature distribution problems

Poisson's equation and finite difference method

2080 · 5 marks

Solve the Poisson's equation ∂2f/∂x2+∂2f/∂y2=2x2y2\partial^2f/\partial x^2+\partial^2f/\partial y^2 = 2x^2y^2∂2f/∂x2+∂2f/∂y2=2x2y2 over the square domain 0<=x<=3 and 0<=y<=3 with f=0 on the boundary and h = 1. [5]

  • PDE: $\dfrac{\partial^2 f}{\partial x^2} + \dfrac{\partial^2 f}{\partial y^2} = 2x^2 y^2$, so $g(x,y) = 2x^2y^2$ - Domain: $0 \le x \le 3$, $0 \le y \le 3$ (square) - Boundary condition: $f = 0$ on all boundaries - Mesh spacing: $h = 1$ --- With $h = 1$: nodes at $x = 0,1,2,3$ and $y = 0,1,2,3$...
Open this answer on its own page →

2078 · 5 marks

Solve the Poisson's Equation $\nabla^2 f = 2x^2 y^2$ over the square domain $0 \leq x \leq 3$ and $0 \leq y \leq 3$ with $f = 0$ on the boundary and $h = 1$. [5]

Show solved answer

Solving Poisson's Equation by Finite Difference Method

Given

  • PDE: $\nabla^2 f = f_{xx} + f_{yy} = 2x^2y^2$
  • Domain: $0 \le x \le 3$, $0 \le y \le 3$ (square)
  • Boundary condition: $f = 0$ on all boundaries
  • Step size: $h = 1$

With $h=1$ over $[0,3]$, interior nodes are at $x=1,2$ and $y=1,2$ (four interior points).


Solution

Five-point formula: $$f_{i+1,j}+f_{i-1,j}+f_{i,j+1}+f_{i,j-1}-4f_{i,j}=h^2 g(x_i,y_j)=2x_i^2 y_j^2$$

Interior points and RHS $=2x^2y^2$:

Label$(x,y)$RHS
$f_1$$(1,1)$$2$
$f_2$$(2,1)$$8$
$f_3$$(1,2)$$8$
$f_4$$(2,2)$$32$

Equations (boundaries = 0):

$(1,1):; -4f_1+f_2+f_3=2$ ...(1)

$(2,1):; f_1-4f_2+f_4=8$ ...(2)

$(1,2):; f_1-4f_3+f_4=8$ ...(3)

$(2,2):; f_2+f_3-4f_4=32$ ...(4)

Symmetry: (2) and (3) give $f_2=f_3$.

From (1): $-4f_1+2f_2=2 \Rightarrow f_1=\dfrac{2f_2-2}{4}=\dfrac{f_2-1}{2}$ ...(5)

From (4): $2f_2-4f_4=32 \Rightarrow f_4=\dfrac{2f_2-32}{4}=\dfrac{f_2-16}{2}$ ...(6)

Substitute into (2): $f_1-4f_2+f_4=8$

$$\frac{f_2-1}{2}-4f_2+\frac{f_2-16}{2}=8$$

$$\frac{(f_2-1)+(f_2-16)}{2}-4f_2=8$$

$$\frac{2f_2-17}{2}-4f_2=8$$

$$f_2-8.5-4f_2=8$$

$$-3f_2=16.5 \Rightarrow f_2=-5.5$$

Back-substitute:

$$f_3=f_2=-5.5$$

$$f_1=\frac{f_2-1}{2}=\frac{-5.5-1}{2}=\frac{-6.5}{2}=-3.25$$

$$f_4=\frac{f_2-16}{2}=\frac{-5.5-16}{2}=\frac{-21.5}{2}=-10.75$$

Verification with (1): $-4(-3.25)+(-5.5)+(-5.5)=13-11=2$ ✓ With (4): $-5.5-5.5-4(-10.75)=-11+43=32$ ✓


Final Result

$$\boxed{f_1=f(1,1)=-3.25,\quad f_2=f(2,1)=-5.5,\quad f_3=f(1,2)=-5.5,\quad f_4=f(2,2)=-10.75}$$

Open this answer on its own page →

0 · 5 marks

Solve the Poisson's equation $\nabla^2 f = xy$ with $f = 2$ on boundary by assuming square domain $0 \leq x \leq 3$, $0 \leq y \leq 3$ and $h = 1$. [5]

Show solved answer

Solving Poisson's Equation ∇²f = xy

Given

  • PDE: $\nabla^2 f = xy$, i.e. $g(x,y) = xy$
  • Domain: $0 \le x \le 3$, $0 \le y \le 3$
  • Step size: $h = 1$
  • Boundary condition: $f = 2$ on all boundaries

Solution

Grid

With $h = 1$: nodes at $x = 0,1,2,3$ and $y = 0,1,2,3$.

Interior unknowns:

  • $f_1 = f(1,1)$
  • $f_2 = f(2,1)$
  • $f_3 = f(1,2)$
  • $f_4 = f(2,2)$

All boundary nodes have $f = 2$.

Finite Difference Formula

$$f_{i+1,j} + f_{i-1,j} + f_{i,j+1} + f_{i,j-1} - 4f_{i,j} = h^2, g(x_i,y_j)$$

With $h=1$, RHS $= xy$ at each interior node.

Node Equations

$f_1=f(1,1)$, $g = 1$; neighbors $f_2, 2, f_3, 2$: $$f_2 + 2 + f_3 + 2 - 4f_1 = 1 \Rightarrow -4f_1 + f_2 + f_3 = -3 \quad (1)$$

$f_2=f(2,1)$, $g = 2$; neighbors $2, f_1, f_4, 2$: $$2 + f_1 + f_4 + 2 - 4f_2 = 2 \Rightarrow f_1 - 4f_2 + f_4 = -2 \quad (2)$$

$f_3=f(1,2)$, $g = 2$; neighbors $f_4, 2, 2, f_1$: $$f_4 + 2 + 2 + f_1 - 4f_3 = 2 \Rightarrow f_1 - 4f_3 + f_4 = -2 \quad (3)$$

$f_4=f(2,2)$, $g = 4$; neighbors $2, f_3, 2, f_2$: $$2 + f_3 + 2 + f_2 - 4f_4 = 4 \Rightarrow f_2 + f_3 - 4f_4 = 0 \quad (4)$$

Solve

Equations (2) and (3) are identical, so $f_2 = f_3 = p$.

From (1): $-4f_1 + 2p = -3 \Rightarrow f_1 = \dfrac{2p+3}{4}$

From (4): $2p - 4f_4 = 0 \Rightarrow f_4 = \dfrac{p}{2}$

Substitute into (2): $f_1 - 4p + f_4 = -2$

$$\frac{2p+3}{4} - 4p + \frac{p}{2} = -2$$

Multiply by 4: $$2p + 3 - 16p + 2p = -8$$ $$-12p = -11 \Rightarrow p = \frac{11}{12}$$

Back-substitute:

$$f_1 = \frac{2(11/12)+3}{4} = \frac{11/6 + 18/6}{4} = \frac{29/6}{4} = \frac{29}{24} \approx 1.208$$

$$f_2 = f_3 = \frac{11}{12} \approx 0.917$$

$$f_4 = \frac{p}{2} = \frac{11}{24} \approx 0.458$$

Verification (Eq. 4): $\frac{11}{12} + \frac{11}{12} - 4\cdot\frac{11}{24} = \frac{11}{6} - \frac{11}{6} = 0$ ✓

Final Results

Node(x,y)f value
$f_1$(1,1)$29/24 \approx 1.208$
$f_2$(2,1)$11/12 \approx 0.917$
$f_3$(1,2)$11/12 \approx 0.917$
$f_4$(2,2)$11/24 \approx 0.458$
Open this answer on its own page →

Laplace equation and steady state problems

2079 · 5 marks

Consider a steel plate of size 24cm x 24cm. If two of the opposite sides are held at 100 degree Celsius and the other two opposite sides at 0 degree Celsius, find the steady state temperatures of interior points, assuming a grid size of 8cm x 8cm. [5]

  • Plate size: $24 \text{ cm} \times 24 \text{ cm}$ - Grid spacing: $h = 8 \text{ cm}$ - Boundary conditions: - Two opposite sides held at $100^\circ$C - Other two opposite sides held at $0^\circ$C - Interior points required (steady state) With $h = 8$ cm, the $24 \times 24$ plate is divided into ...
Open this answer on its own page →