4' - FDM - Examples
4' - FDM - Examples
Chapter
2
• Finite Difference Method
– Examples
Reference Text:
Fundamental of
Computational Fluid
Dynamics, J. Anderson
Computational Fluid Dynamics
Problem
Solution
Including boundary conditions
Dirichlet boundary conditions
Example
Solution
• Taking h=k=1/3 we have:
ui,j-1 + ui-1,j – 4ui,j + ui+1,j + ui,j+1 = 0
(i=2, j=2) u2,1 + u1,2 – 4u2,2 + u3,2 + u2,3 = 0
(i=3, j=2) u3,1 + u2,2 – 4u3,2 + u4,2 + u3,3 = 0
(i=2, j=3) u2,2 + u1,3 – 4u2,3 + u3,3 + u2,4 = 0
(i=3, j=3) u3,2 + u2,3 – 4u3,3 + u4,3 + u3,4 = 0
Rearranging in form of a matrix and solving:
Computational Fluid Dynamics
Example
Computational Fluid Dynamics
Solution
Computational Fluid Dynamics
Example
Computational Fluid Dynamics
Solution
Computational Fluid Dynamics
Solution
Computational Fluid Dynamics
Solution
Computational Fluid Dynamics
Solution
Computational Fluid Dynamics
Results
Computational Fluid Dynamics
Accuracy
Computational Fluid Dynamics
Accuracy
• Example: if Δx = Δ y = 0.1 then the error is of the order
0.12 = 0.01
• Suppose we double the number of mesh points in x & y
directions
• This halves the mesh spacing Δx = Δ y = 0.05
• So the error is now of the order 0.052 = 0.0025
• Much more accurate.
Computational Fluid Dynamics
Accuracy
• To test for accuracy we could just keep halving the mesh spacing
• If the solution doesn’t change when we do this, we can assume that the
truncation error is insignificant and the discretisation is accurate.
• However as the mesh spacing tends to zero, the number of grid points
(and hence the solution time) tend to infinity.
• This is not a problem for the simple examples with just a few grid points
that we look at in this course, but in real-life cases, with millions of grid
points, it can be a major headache.
Computational Fluid Dynamics
Numerical solution is stable if it does not magnify errors that appear during the
Stability course of solution. For example with iterative methods the solution does not
diverge.
The numerical scheme used ensures that the dependent variable, for example
Conservation
temperature, is conserved. (i.e energy is not created nor destroyed).
Numerical solution should lie within specific bounds. For example temperature
Boundedness
should be within boundary conditions or temperature cannot be less than -273 K.
Computational Fluid Dynamics
Discretization Difference between the exact solution to the mathematical model and the
Errors discretized equations used to approximate it.
Convergence Difference between the iterative solution results and the exact solution to the
Errors discretized equations
Other errors, such as rounding errors and overflow errors, can creep in if the
Other Errors
programmer is not careful.