# Basics of Computational Fluid Dynamics and Numerical Heat Transfer

### From Thermal-FluidsPedia

Computational fluid dynamics (CFD) is one of the branches of fluid mechanics that uses numerical methods and algorithms to solve and analyze problems that involve fluid flows. Computers are used to perform the millions of calculations required to simulate the interaction of liquids and gases with surfaces defined by boundary conditions. Even with high-speed supercomputers only approximate solutions can be achieved in many cases. Ongoing research, however, may yield software that improves the accuracy and speed of complex simulation scenarios such as transonic or turbulent flows. Initial validation of such software is often performed using a wind tunnel with the final validation coming in flight test.

Even for the cases where analytical solution is available, the interpretation of the solution is often difficult because the solution is expressed as a very complicated series. Numerical solution therefore becomes a desirable approach for heat conduction under non-linear, complex geometric configurations, or complex boundary conditions. Instead of obtaining the analytical expression of the temperature distribution, the results of numerical solutions are given at discrete points. The numerical solution involves three steps: (1) discretization of the computational domain, (2) discretization of the governing equations, and (3) solution of the algebraic equations (Murthy et al., 2006).

## Contents |

## Overview

The most fundamental consideration in CFD is how one treats a continuous fluid in a discretized fashion on a computer. One method is to discretize the spatial domain into small cells to form a volume mesh or grid, and then apply a suitable algorithm to solve the equations of motion (Euler equations for inviscid, and Navier–Stokes equations for viscous flow). In addition, such a mesh can be either irregular (for instance consisting of triangles in 2D, or pyramidal solids in 3D) or regular; the distinguishing characteristic of the former is that each cell must be stored separately in memory. Where shocks or discontinuities are present, high resolution schemes such as Total Variation Diminishing (TVD), Flux Corrected Transport (FCT), Essentially NonOscillatory (ENO), or MUSCL schemes are needed to avoid spurious oscillations (Gibbs phenomenon) in the solution.

If one chooses not to proceed with a mesh-based method, a number of alternatives exist, notably :

- Smoothed particle hydrodynamics (SPH), a Lagrangian method of solving fluid problems,
- Spectral methods, a technique where the equations are projected onto basis functions like the spherical harmonics and Chebyshev polynomials,
- Lattice Boltzmann methods (LBM), which simulate an equivalent mesoscopic system on a Cartesian grid, instead of solving the macroscopic system (or the real microscopic physics).

It is possible to directly solve the Navier–Stokes equations for laminar flows and for turbulent flows when all of the relevant length scales can be resolved by the grid (a Direct numerical simulation). In general however, the range of length scales appropriate to the problem is larger than even today's massively parallel computers can model. In these cases, turbulent flow simulations require the introduction of a turbulence model. Large eddy simulations (LES) and the Reynolds-averaged Navier–Stokes equations (RANS) formulation, with the k-ε model or the Reynolds stress model, are two techniques for dealing with these scales.

In many instances, other equations are solved simultaneously with the Navier–Stokes equations. These other equations can include those describing species concentration (mass transfer), chemical reactions, heat transfer, etc. More advanced codes allow the simulation of more complex cases involving multi-phase flows (e.g. liquid/gas, solid/gas, liquid/solid), non-Newtonian fluids (such as blood), or chemically reacting flows (such as combustion).

## Methodology

In all of these approaches the same basic procedure is followed.

- During preprocessing
- The geometry (physical bounds) of the problem is defined.
- The volume occupied by the fluid is divided into discrete cells (the mesh). The mesh may be uniform or non uniform.
- The physical modeling is defined – for example, the equations of motions + enthalpy + radiation + species conservation
- Boundary conditions are defined. This involves specifying the fluid behaviour and properties at the boundaries of the problem. For transient problems, the initial conditions are also defined.

- The simulation is started and the equations are solved iteratively as a steady-state or transient.
- Finally a postprocessor is used for the analysis and visualization of the resulting solution.

- During preprocessing

### Discretization methods

The stability of the chosen discretization is generally established numerically rather than analytically as with simple linear problems. Special care must also be taken to ensure that the discretization handles discontinuous solutions gracefully. The Euler equations and Navier–Stokes equations both admit shocks, and contact surfaces.

Some of the discretization methods being used are:

- Finite volume method (FVM). This is the "classical" or standard approach used most often in commercial software and research codes. The governing equations are solved on discrete control volumes. FVM recasts the PDE's (Partial Differential Equations) of the N-S equation in the conservative form and then discretize this equation. This guarantees the conservation of fluxes through a particular control volume. Though the overall solution will be conservative in nature there is no guarantee that it is the actual solution. Moreover this method is sensitive to distorted elements which can prevent convergence if such elements are in critical flow regions. This integration approach yields a method that is inherently conservative (i.e. quantities such as density remain physically meaningful)

- where
*Q*is the vector of conserved variables,*F*is the vector of fluxes (see Euler equations or Navier–Stokes equations),*V*is the cell volume, and is the cell surface area.

- Finite element method (FEM). This method is popular for structural analysis of solids, but is also applicable to fluids. The FEM formulation requires, however, special care to ensure a conservative solution. The FEM formulation has been adapted for use with the Navier–Stokes equations. Although in FEM conservation has to be taken care of, it is much more stable than the FVM. approach (Interscience). Consequently it is the new direction in which CFD is moving. Generally stability/robustness of the solution is better in FEM though for some cases it might take more memory than FVM methods.(Huebner, 1995)

- In this method, a weighted residual equation is formed:

- where
*R*_{i}is the equation residual at an element vertex*i*,*Q*is the conservation equation expressed on an element basis,*W*_{i}is the weight factor and*V*^{e}is the volume of the element.

- Finite difference method. This method has historical importance and is simple to program. It is currently only used in few specialized codes. Modern finite difference codes make use of an embedded boundary for handling complex geometries making these codes highly efficient and accurate. Other ways to handle geometries are using overlapping-grids, where the solution is interpolated across each grid.

- Where
*Q*is the vector of conserved variables, and*F*,*G*, and*H*are the fluxes in the*x*,*y*, and*z*directions respectively.

- Boundary element method. The boundary occupied by the fluid is divided into surface mesh.
- High-resolution schemes are used where shocks or discontinuities are present. To capture sharp changes in the solution requires the use of second or higher order numerical schemes that do not introduce spurious oscillations. This usually necessitates the application of flux limiters to ensure that the solution is total variation diminishing.

## Other Numerical Methods

Other notable methods for numerical solution of heat conduction problems include boundary element method (BEM) that volume integrals are converted to surface integrals, as well as spectral methods that approximate solutions by a series of functions. The drawback of these methods is that they are very difficult to be extended to convective heat transfer.

## References

Murthy, J.Y., Minkowycz, W.J., Sparrow, E.M., and Mathur, S.R., “Survey of Numerical Methods,” *Handbook of Numerical Heat Transfer*, 2^{nd} ed., eds., Minkowycz, W.J., Sparrow, E.M., and Murthy, J.Y., pp. 3-51, Wiley, New York.

Patankar, S.V., 1980, *Numerical Heat Transfer and Fluid Flow*, Hemisphere, Washington, DC.

Huebner, K. H., Thornton, E. A., and Byron, T. D., The Finite Element Method for Engineers, 3^{rd} ed., Wiley Interscience(1995).