Computational Fluid Dynamics (CFD) is the simulation of the dynamics of fluids using Computers, which is useful because we exist in fluids that are dynamic! From Rocketry to Power Plants, when a failure in the field can mean people die, being able to predict how your design will fare is of the utmost importance.
Governing Equations
In CFD, we use discretize the Navier Stokes Equations to predict fluid dynamics, meaning we translate the continuous equations into a system of Algebraic Equations that a computer can solve. We specifically examine the Incompressible Navier Stokes Equations for simplicity.
Navier Stokes Equations
The Navier-Stokes equations are a set of Partial Differential Equations that describe almost all fluid dynamics. They describe how the velocity, pressure, temperature, and density of a moving fluid are related.
Incompressible Navier Stokes Equations
For incompressible fluids; if one part of the fluid is displaced, the opposite side is also displaced equally and instantly. Incompressibility means constant density .
- where is the velocity vector
- where is time
- where is the density of the fluid
- where is the pressure of the fluid
- where is the kinematic viscosity
- where is the external force
Link to original
- The first equation is the moment equation.
- The Advection term
- Says that the fluid moves on its own, and moves faster in regions of higher velocity. Shocker.
- The Pressure term
- Says that the fluid flow is along a pressure gradient.
- This term causes divergence, which is illegal is zero-divergence land, and can be omitted.
- We can correct for this omission through Projection, which uses Helmholtz-Hodge Decomposition to isolate the zero-divergence component for a given point in the field. This involves solving the Poisson Equation and then subtracting the Gradient.
- The Diffusion term
- Says that the fluid flow tends to diffuse along the velocity gradient, and that the more the fluid diffuses, the smooth the velocity field gets.
- The External Force term
- Says “Hello, I am external force”
- The second equation is the continuity equation, which enforces incompressibility.
- At any point, the velocity flow into that point and out of that point must net to zero, i.e. the Divergence is zero.
- These equations generally cannot be solved analytically, and instead require Numerical Methods
Approaches
There are a variety of approaches to actually carrying out the simulation.
Eulerian
Imagine standing on a bridge and watching the water flow past. You focus on fixed points in space and track how velocity and pressure change at those specific locations over time. #todo https://www.montana.edu/mowkes/research/source-codes/GuideToCFD.pdf
Lagrangian
Imagine being a tiny particle floating in the river. You follow individual “fluid parcels” as they move through space and time.
Hybrid
Stable Fluids
Stable Fluids
todo https://dmorris.net/projects/summaries/dmorris.stable_fluids.notes.pdf
Stable fluids uses an Eulerian grid for pressure, diffusion, and final velocity. It uses Semi-Lagrangian advection.
Link to original