# Finite Difference Method (FDM)

This section describes the formulation and methodology of finite difference method to solve the governing equations on a computational domain.

The finite difference method is the oldest method for the numerical solution of partial differential equations. It is also the easiest to formulate and program for problems which have a simple geometry.

When calculating derivatives finite difference replaces the infinitesimal limiting process with a finite quantity. The derivative of a function at point expressed as:

is replaced by:

The preceding expression is commonly referred to as the forward difference approximation. This derivative can have more refined approximations using a number of approaches such as truncated Taylor series expansions and polynomial fitting.

The term $O\left(\Delta x\right)$ gives an indication of the magnitude of the error as a function of the mesh spacing and is therefore termed as the order of magnitude of the finite difference method. In the above formulation, the finite difference approximation employed is first-order accurate. A second-order approximation would have the order of magnitude expressed as $O\left(\Delta {x}^{2}\right)$ . Most of the finite difference methods used in practice are second-order accurate. An example of a second-order method is the central difference approximation of the first derivative. It is expressed as:

The finite difference formulation generally employs a structured grid. The most commonly used indices are $i$ , $j$ and $k$ for the grid lines at $x={x}_{i}$ , $y={y}_{j}$ and $z={z}_{k}$ , respectively. The function value at such a grid point is expressed as ${f}_{i,j,k}\equiv {f}_{ijk}\equiv f\left({x}_{i},{y}_{j},{z}_{k}\right)$ .

Consider the one dimension advection-diffusion equation for a scalar quantity $\phi $ governed by

where $u$ is the specified velocity, $\rho $ is the density of the fluid and $\u03f5$ is the diffusivity.

If the domain is defined by the boundary $x=0$ and $x=L$ and the boundary conditions by $\phi \left(0\right)={\phi}_{0}$ and $\phi \left(L\right)={\phi}_{L}$ , the domain can be discretised (non-uniformly) by a total of $N+1$ grid points for the finite difference solution of the problem.

The diffusion term can be approximated using the central difference (both the inner and outer derivative) as:

The convection term can also be approximated using the central difference as:

If the grid is uniform and the values of density, velocity and coefficient of diffusion are constant throughout the domain the above equations reduce to:

The resulting set of linear algebraic equations can be solved to get the values of at the grid points.

Finite difference methods are advantageous for the numerical solution of partial differential equations because of their simplicity, efficiency and low computational cost. Their major drawback is their geometrical inflexibility, such as application on an unstructured grid or moving boundaries. Their formulation increases in complexity as the complexity of the domain increases.

The restrictions resulting from the above mentioned geometrical complexities can be alleviated by the use of methods such as grid transformation and immersed boundary techniques.