Presentation is loading. Please wait.

Presentation is loading. Please wait.

Elliptic PDEs and Solvers

Similar presentations


Presentation on theme: "Elliptic PDEs and Solvers"— Presentation transcript:

1 Elliptic PDEs and Solvers
LECTURE 3 Elliptic PDEs and Solvers

2 Aim of Lecture This week we will discuss
Overview of Finite Difference Method for Elliptic PDEs Taylor series Forward, Backward, Central Differences Boundary conditions Using EXCEL to solve PDEs Jacobi Gauss-Seidel

3 Taylor Series Consider the function u expanded about the point i,j. i
k

4 Finite Difference Equations
Consider the function u expanded about the point x. Forward Difference Backward Difference NOTE: Order of Truncation Error

5 Taylor Series Central difference approximations obtained by:
Similar approximation for y. i i+1 i-1 j j +1 j - 1 Central Difference

6 Finite Difference Method
Method based on truncated Taylor series i i+1 i -1 j -1 j j+1 ui,j - Forward difference - Backward difference - Central difference - Central difference Above approximations can be substituted for differentials in the PDE.

7 Laplace Equation - FDM Consider the Laplace equation. i i+1 i -1 j -1
ui,j Difference formula for each node: When h = k we have:

8 Poisson Equation - FDM Consider the Poisson equation. i i+1 i -1 j -1
ui,j Difference formula for each node: When h = k we have:

9 Including Boundary Conditions
u = a i i+1 i -1 j -1 j j+1 ui,j Two types of boundary conditions Dirichlet u = a Neumann Boundary conditions must be included into the discretised equations j -1 j ui,j j - 2 i -1 i i+1

10 Dirichlet Boundary Conditions
ui,j+1 = 2 i i+1 i -1 j -1 j j+1 ui,j Dirichlet Boundary Conditions: e.g. u = 2 Include boundary value directly

11 Example i = j = Consider the following square domain and its representation using a Finite Difference Grid. Finite difference approximation u = 1 Y X (1,0) (0,0) (0,1) (1,1) u = 0 Need to solve for internal nodal values

12 Example Taking h = k = 1/3 we have: Can show that j = 1 2 3 4

13 Neumann Boundary Conditions
j - 2 j -1 j ui,j Either use backward/forward difference so that Or use central difference (need to introduce artificial nodes outside the boundary, but note error) Alternatively, for derivatives in x direction, if then i i+1 i -1 j - 2 j -1 j ui,j

14 Example i = j = Consider the following square domain and its representation using a Finite Difference Grid. Y X (1,0) (0,0) (0,1) (1,1) u = 1

15 Example Taking h = k = 1/2 we have: So that
j = Taking h = k = 1/2 we have: So that Dirichlet boundary conditions give Using central difference approximation Artificial Node

16 EXCEL FOR SOLVING FINITE DIFFERENCE EQUATIONS

17 USING EXCEL Ideal for solving Finite Difference Equations i i+1 i-1 j

18 Setting Parameters Write Parameter in Name Box: Name Box Formula Box

19 IF command in Excel Using the IF Command
IF(CONDITION, THEN DO THIS, ELSE DO THIS)

20 Setting up FD Grid in EXCEL
Consider Tutorial 3, Question 2 Boundary conditions (grey) Unknowns (white) x values (peach)

21 Input FD Formula Formula for D16 Formula for D9 Previous Iteration
Latest Iteration

22 Iteration in Excel The Function key (F9) updates all values (1 Iteration) Use the FLAG Parameter FLAG = 0 (sets all cell values back to 0) FLAG = 1 (Starts Iterations) Keep pressing F9 to increment iteration count. EXCEL updates cells in Columns. Can program both Jacobi and Gauss-Seidel.

23 Iteration in Excel Consider two iterations (Press F9 twice)
First Iteration Second Iteration

24 Solution converged to 4 decimal places
Iteration in Excel Continue Iterating (Pressing F9) until convergence Solution converged to 4 decimal places

25 Gauss Seidel in Excel Even easier than Jacobi (don’t require the old values of the previous iteration) Each cell just uses most up-to-date values Don’t even know/care which order the cells are calculated in Consider Tutorial 3, Question 1

26 Using Excel – summary/list of tasks
Set up the parameters of the problem such as FLAG, h, k, g NB when solving a Laplace equation it is better to set up Excel to solve Poisson and then just set g = 0 Set up the domain (size, x/y values) Fill in the known (Dirichlet) boundary values Work out the general FD formula and copy it across all cells with unknown values Work out FD formulas for all unknown (Neumann) boundary values and copy to relevant cells – next week There should be no cells inside the domain that reference cells outside the domain (apart from parameters like g or h) Double click each boundary cell to check


Download ppt "Elliptic PDEs and Solvers"

Similar presentations


Ads by Google