You are on page 1of 24

Computational Fluid Dynamics

Chapter

2
• Finite Difference Method
– Examples

Reference Text:
Fundamental of
Computational Fluid
Dynamics, J. Anderson
Computational Fluid Dynamics

Problem

• Discretize the 1D convection diffusion eq. using given


central difference approximation

• Then, with Δx = 0.01, Γ = 2,ρ = 1.23 and u = 3, α=2 solve


the following problem with suitable initial conditions.
Computational Fluid Dynamics

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

Neumann boundary condition


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

Extensions to finite difference method


• We now have a set of tools which we can apply to
non-standard cases
• Non-square geometries (easy … provided they are
composed of rectangular objects)
• Non-standard equations
• Non-standard boundary conditions
• Most real-life cases are non-standard.
Non-standard equations
Computational Fluid Dynamics

Non-standard boundary conditions

• (once again this introduces artificial nodes, ui,j+1, outside the


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

Quality of numerical solution


Discretization method should become exact as mesh spacing tends to zero.
Consistency
Therefore truncation error becomes zero as mesh spacing tends to zero.

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

Errors in numerical solutions


Modelling These are the difference between the mathematical model and the real world it
Errors is trying to represent.

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.

You might also like