What Is Computational Fluid Dynamics (CFD) - And How Does It Really Work?
Cars and planes, air conditioners, and batteries, among others, all rely on fluids to function at their best. However, fluid problems are quite difficult to solve by hand. So how do engineers make design decisions based on fluid problems? Do they have to rely on physical testing only? Of course not! They use CFD, or Computational Fluid Dynamics. CFD is a tool that allows us to model the flow of fluids using computational power. In this blog, we will give a brief overview of what CFD is and show its history, applications, and the theory behind it.
A Very Brief History Of CFD
The basis of CFD is rooted in the Navier-Stokes equations, which were finalized by Sir George Stokes when he added the viscous terms in the mid-19th century. Using these equations, along with computers, Los Alamos National Lab developed many modeling techniques for fluid flow in the 1950s and 1960s. The first scientific paper that uses a 3D model in fluid flow problems was published by John Hess and A.M.O. Smith in 1967. Further algorithm development was carried out by Brian Spalding and Suhas V. Patankar at Imperial College London during the 1960s and 1970s, most notably the SIMPLE Algorithm. The first commercial CFD software, PHOENICS, was released in 1981. Today, with much more powerful computers, CFD has become an integral part of the design process for a variety of industries.
Why Use CFD?
Fluids play an important role in so many engineering applications, from aerodynamics of a racecar to water flow in a pipe. These flows are very rarely able to be solved by hand (as we’ll find out later in this blog!). CFD allows us to solve these flow problems and allows us to make decisions early in the design process, saving both time and money.
Check out these examples below of simulations using CFD:
Examples Of CFD
The Theory Of CFD
As we said earlier, the basis of CFD is rooted in the Navier-Stokes equations. Below we will go into the details of these equations and how they are applied to solve a CFD problem. This section might be a bit dry, but this is important.
For this blog, we will assume that the fluids are Newtonian, incompressible, and isothermal. An isothermal fluid just means that the temperature remains at a constant value. An incompressible fluid means that the density of the fluid does not change. Technically, all fluids are compressible, but the change in density is so miniscule that treating them as incompressible has no significant effect in the results for low Mach numbers (ratio of flow velocity to the speed of sound). The most compressible fluids are gases moving at hypersonic speeds, where compressibility and aeroelasticity occur. A Newtonian fluid means that the viscosity is independent of shear rate. Think of ketchup as a non-Newtonian fluid – it might not come out of the bottle quickly if you just tip it over but if you shake the bottle, it pours out much faster. If you did the same thing to a water bottle you would not find any difference whether you shake it or not.
With those assumptions out of the way, let’s get into the Navier-Stokes equations. These equations express the conservation of momentum. Shown below is the simplified form of the Navier-Stokes equations. This form encompasses three different equations since it can be separated into x, y, and z components in a 3D vector field.
where rho = density, u = fluid velocity, p = pressure, mu = fluid dynamic viscosity, and F = external forces.
Essentially, this equation states that Inertia forces = Pressure forces + Viscous forces + External forces. For incompressible flows, the conservation of mass equation is below:
where u = fluid velocity.
This equation means that at every point in a vector field, the sum of the velocities of fluid entering or leaving each point is 0. Using the conservation of mass equation and the Navier-Stokes equations, fluid flow for incompressible and isothermal Newtonian fluids can be described.
A quick note: Non-Newtonian, compressible, and heat transfer can be modelled using CFD, they just need additional terms and/or equations to solve besides what is described above, which will not be covered in this blog for the sake of brevity.
One big challenge in CFD is how to resolve turbulence. Turbulence is defined as chaotic changes in pressure and flow velocity (think of turbulence in an airplane – it is caused by changes in air around the plane). Comparatively, laminar flow is defined as a smooth flow with no disruptions or mixing. Usually, water leaving a faucet is laminar flow. If you put a spoon under the running faucet, water sprays everywhere (and usually onto you!) That is turbulent flow. Whether a flow is laminar or turbulent can be defined by a constant called the Reynolds number, the equation of which is shown below:
where rho = fluid density, u = velocity, L = characteristic length, and mu = fluid dynamic viscosity.
The Reynolds number is essentially the ratio between the inertial and viscous forces of the fluid. If the Reynolds number is low, the flow is considered to be laminar. If the Reynolds number is high, the flow is considered to be turbulent. The critical Reynolds number that marks the transition from laminar to turbulent flow is dependent on geometry type.
Turbulence appears in the form of eddies, which are currents of swirling fluid. Large eddies created by turbulence eventually diffuse into smaller and smaller eddies until all the energy is converted into thermal energy. While turbulence can be solved directly using the Navier-Stokes equations, more accurate turbulence modeling is much more computationally expensive and adds degrees of freedom to the model, so other turbulence models are used instead. See the table below for the different methods for turbulence flow calculation used in CFD:
The RANS model is the most popular in CFD software. Essentially, it applies an averaging operation to the Navier-Stokes equations to obtain mean equations for fluid flow. This creates an apparent stress term, also known as the Reynolds stress. The different models under the RANS umbrella aim to resolve this Reynolds stress. Knowing which one to use requires some expertise in fluid flow.
When CFD software solves these equations, it discretizes the Navier-Stokes equations since it can’t solve the PDEs directly. In other words, they are converted to a matrix form, which computers are able to solve. The most popular way these equations are discretized is using the Finite Volume Method, or FVM. The difference between FVM and FEM is that the FVM discretizes the conservation form of PDEs while FEM discretizes the weak form of PDEs. FVM is a natural choice for CFD because the Navier-Stokes equations are really just conservation laws.
FVM works by integrating the differential form of the equations over a control volume. This allows all quantities to be conserved, no matter what. The governing equations are solved for each control volume to solve the global problem. The boundary faces of each volume only need to be evaluated for flux. We will not be going over the equations for the FVM in this blog, as it would get very math-y.
The CFD Process
In order to apply the FVM, CFD requires a fluid domain that is discretized into smaller shapes called cells. Once the domain is modelled and discretized, boundary conditions and solver settings must be defined to allow the solver to solve the problem. Many different outputs are available, including pressure, velocity, temperature, forces, etc. Many different types of output plots are also available, including streamlines, isosurfaces, and surface plots. This is where CFD gets the reputation for generating very beautiful and colorful maps.
CFD is a very large and growing field that allows engineers to solve complicated fluid flow problems using computational power. Of course, like with any engineering simulation methodology, the goal is to reduce development cost and time and improve product quality and efficiency prior to expensive prototyping.
We should also keep in mind that this post has focused solely on the Navier-Stokes methodology that underpins CFD as we know it. As computational power has improved, other methods have become much more commercially viable, such as Lattice-Boltzmann, which takes a much more transient view of the process. Hopefully this blog served as a good introduction to the concept of CFD. Just be aware, however, that it is computationally expensive and requires expertise to utilize properly.
Luckily, we are here to help! If you are interested in learning more about the CFD solutions we offer, whether it be software or services, reach out to our expert team today!