Skip to content
SHD Sim
Menu

Learn/Fundamentals

What is CFD (computational fluid dynamics)?

What the solver is doing, why the mesh and the turbulence model decide the answer, and how to tell a good result from a pretty one.

12 minute read

What CFD is

Computational fluid dynamics is the numerical solution of fluid flow. You give it a region of space, what enters and leaves at the boundaries, and the properties of the fluid; it returns the velocity, pressure and — if you asked — temperature and species concentration at every point, along with the forces and heat transfer those imply on your surfaces.

The governing equations are conservation of mass, momentum and energy. In their usual form for a viscous fluid, momentum conservation is the Navier–Stokes equations. They have no general analytical solution, which is the entire reason CFD exists: for any geometry more complicated than a textbook pipe, numerical solution is the only route.

Practically, CFD answers questions like: how much drag does this shape produce, will this heat exchanger keep the electronics under temperature, does this manifold distribute flow evenly between its outlets, how far does this plume travel, will this pump cavitate.

What the solver is really doing

The region is divided into cells. Within each cell the conservation laws are enforced: whatever mass flows in must flow out or accumulate, and the same for momentum and energy. That turns partial differential equations into a large sparse system of algebraic equations relating each cell to its neighbours. This is the finite volume method, and it is what most general-purpose CFD codes — including OpenFOAM — use, precisely because conservation is built into the formulation rather than hoped for.

The system is nonlinear, because momentum transports itself, so it is solved iteratively. Each iteration reduces the imbalance in the equations, and the size of that imbalance is the residual. Watching residuals fall is how you know the solver is making progress; watching them stall or climb is how you know it is not.

One number worth understanding early is the Courant number, which compares how far fluid moves in one time step against the size of a cell. Push it too high in a transient run and the solution goes unstable, usually spectacularly.

Turbulence: the modelling decision that matters most

Almost all engineering flow is turbulent — chaotic, three-dimensional and unsteady across a huge range of scales. Resolving every one of those scales directly is possible in principle and unaffordable in practice for real geometry.

So turbulence is modelled, and the choice sets both cost and credibility:

  • RANS (Reynolds-averaged Navier–Stokes) solves for the mean flow and models all the turbulence. Models like k-ε, k-ω SST and Spalart–Allmaras live here. It is the default for engineering work because it is affordable and, for attached flows, reliable.
  • LES resolves the large eddies and models only the small ones. Considerably more expensive, inherently transient, and the right choice when the unsteady structure is the answer rather than a nuisance.
  • Hybrids such as DES use RANS near walls and LES away from them, to get separated-flow behaviour without paying for LES everywhere.

Tied to this is y+, a dimensionless measure of how close your first cell sits to the wall in the boundary layer. Different wall treatments expect different y+ ranges, and a mesh whose y+ is far outside what its turbulence model assumes will produce a confident, plausible, wrong answer for drag and heat transfer. It is the most common way a good-looking CFD result is quietly invalid.

The mesh decides more than the solver

A CFD result is a property of the mesh as much as of the physics. Cells must be small where gradients are steep — near walls, around leading edges, through shear layers, across shocks — and can be large where nothing much happens. Getting that distribution right is most of the skill.

Three things to watch:

  • Boundary layers. Thin, wall-aligned cell layers that resolve the steep velocity gradient at a surface. Without them, wall shear stress — and therefore drag and convective heat transfer — is guesswork.
  • Cell quality. Highly skewed or non-orthogonal cells degrade accuracy and destabilise the solver. Most divergence that looks like a physics problem is a mesh problem.
  • Mesh independence. Run at two or three densities and watch your output quantity. If it is still moving with refinement, the mesh is still setting your answer.

Reading a result you can defend

A contour plot is a starting point, not a conclusion. Before quoting a number, check that the residuals converged and flattened, that integrated quantities such as drag or mass flow reached a steady value rather than still drifting, that mass is balanced between inlets and outlets, and that the mesh study showed the answer stabilising.

Then be explicit about what the number is worth. CFD is at its strongest comparing candidate designs run with identical setup, where consistent errors largely cancel. Absolute values quoted to three significant figures need validation evidence behind them — a benchmark of the same class of flow, against measurement.

Getting started without a six-month learning curve

The traditional open-source route is OpenFOAM, which is a genuinely first-class solver with a text-file interface: cases are directories of dictionaries edited by hand. That is powerful and scriptable, and it is also the reason many engineers who need CFD never get a first result — covered in OpenFOAM and the case for a GUI.

Whichever tool you use, the fastest way in is a worked example whose answer you can check — flow over a cylinder, a backward-facing step, a lid-driven cavity — because these have published data and known behaviour, so you find out immediately whether your setup is sound before pointing it at geometry that matters.

Try it on your own geometry

SHD Sim is a desktop application: import geometry, mesh it, set the physics in panels, run it and get a report — without writing a solver dictionary by hand. The free tier runs real cases up to 250,000 cells of fluids, or 100,000 nodes of solid, with no account needed to download and no time limit.

All guides · Written by the team building SHD Sim.