2079 12

CSC212 ยท 2079 ยท 5 marks

Solve the Poisson's equation nabla2 f = 3x2y over the square domain 0 leq x leq 3, 0 leq y leq 3 with f = 0 on the boundary and h = 1.

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

Numerical MethodChapter 6: Solution of Partial Differential EquationsLaplacian equation and Poisson's equationNumerical: Poisson's equation finite difference

Poisson's Equation $\nabla^2 f = 3x^2y$ over $[0,3]\times[0,3]$, $f=0$ on boundary, $h=1$

Given

  • PDE: $\nabla^2 f = 3x^2y$, so source $g(x,y) = 3x^2y$
  • Domain: $0 \le x \le 3$, $0 \le y \le 3$ (square)
  • Boundary condition: $f = 0$ on all boundaries
  • Mesh size: $h = 1$

Solution

Grid

With $h=1$, interior nodes at $x=1,2$ and $y=1,2$. Four unknowns.

Label (using standard layout):

$x=1$$x=2$
$y=2$$f_1$$f_2$
$y=1$$f_3$$f_4$

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

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)$$

with $h^2=1$.

Source term $g=3x^2y$

Node$x$$y$$g=3x^2y$
$f_1$126
$f_2$2224
$f_3$113
$f_4$2112

Equations (boundary values = 0)

At $f_1(1,2)$: neighbors $f_2$ (right), $0$ (left), $0$ (top, y=3), $f_3$ (bottom): $$-4f_1+f_2+f_3=6 \quad (1)$$

At $f_2(2,2)$: neighbors $0$ (right), $f_1$ (left), $0$ (top), $f_4$ (bottom): $$f_1-4f_2+f_4=24 \quad (2)$$

At $f_3(1,1)$: neighbors $f_4$ (right), $0$ (left), $f_1$ (top), $0$ (bottom): $$f_1-4f_3+f_4=3 \quad (3)$$

At $f_4(2,1)$: neighbors $0$ (right), $f_3$ (left), $f_2$ (top), $0$ (bottom): $$f_2+f_3-4f_4=12 \quad (4)$$

Solving

Sum of all four: $$-2(f_1+f_2+f_3+f_4)=45 \Rightarrow S = f_1+f_2+f_3+f_4 = -22.5 \quad (5)$$

Subtract (1)-(3): $$(-4f_1+f_2+f_3)-(f_1-4f_3+f_4)=6-3$$ $$-5f_1+f_2+5f_3-f_4=3 \quad (6)$$

Subtract (2)-(4): $$(f_1-4f_2+f_4)-(f_2+f_3-4f_4)=24-12$$ $$f_1-5f_2-f_3+5f_4=12 \quad (7)$$

Solve directly. From symmetry-free direct elimination, use variables.

Add (1)+(3): $-3f_1+f_2-3f_3+f_4=9 \quad (A)$ Add (2)+(4): $f_1-3f_2+f_3-3f_4=36 \quad (B)$

Let $P=f_1+f_3$, $Q=f_2+f_4$. Then $P+Q=-22.5$.

(A): $-3P+Q=9$ (B): $P-3Q=36$

From (A): $Q=9+3P$. Substitute into (B): $P-3(9+3P)=36 \Rightarrow P-27-9P=36 \Rightarrow -8P=63 \Rightarrow P=-7.875$. Then $Q=9+3(-7.875)=9-23.625=-14.625$. Check: $P+Q=-22.5$ โœ“

Now subtract (1)-(3): $-5f_1+f_2+5f_3-f_4=3 \quad (6)$ Group as $-5(f_1-f_3)+(f_2-f_4)=3$. Let $U=f_1-f_3,\ V=f_2-f_4$: $$-5U+V=3 \quad (6')$$

Subtract (2)-(4): $f_1-5f_2-f_3+5f_4=12$ $= (f_1-f_3)-5(f_2-f_4)=12 \Rightarrow U-5V=12 \quad (7')$

From (6'): $V=3+5U$. Sub into (7'): $U-5(3+5U)=12 \Rightarrow U-15-25U=12 \Rightarrow -24U=27 \Rightarrow U=-1.125$. Then $V=3+5(-1.125)=3-5.625=-2.625$.

Recover values:

  • $f_1=(P+U)/2=(-7.875-1.125)/2=-9/2=-4.5$
  • $f_3=(P-U)/2=(-7.875+1.125)/2=-6.75/2=-3.375$
  • $f_2=(Q+V)/2=(-14.625-2.625)/2=-17.25/2=-8.625$
  • $f_4=(Q-V)/2=(-14.625+2.625)/2=-12/2=-6.0$

Verification in original equations

(1): $-4(-4.5)+(-8.625)+(-3.375)=18-12=6$ โœ“ (2): $-4.5-4(-8.625)+(-6.0)=-4.5+34.5-6=24$ โœ“ (3): $-4.5-4(-3.375)+(-6.0)=-4.5+13.5-6=3$ โœ“ (4): $-8.625+(-3.375)-4(-6.0)=-12+24=12$ โœ“

Final Result

$$\boxed{f_1=f(1,2)=-4.5,\quad f_2=f(2,2)=-8.625,\quad f_3=f(1,1)=-3.375,\quad f_4=f(2,1)=-6.0}$$

Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.