| name | cfd-fundamentals |
| description | CFD fundamentals — Navier-Stokes equations, discretization (FVM/FDM/FEM), pressure-velocity coupling (SIMPLE), solver settings, boundary conditions, post-processing, y+ wall treatment. |
| metadata | {"priority":8,"promptSignals":{"phrases":["CFD","computational fluid dynamics","Navier-Stokes","SIMPLE","Fluent","OpenFOAM","pressure velocity coupling","boundary condition CFD","flow simulation"],"minScore":3}} |
CFD Fundamentals — Complete Skill
Governing Equations (Navier-Stokes, Incompressible)
Continuity (Mass Conservation)
∇·u = 0 [incompressible: ρ = constant]
∂ρ/∂t + ∇·(ρu) = 0 [compressible]
Momentum (Newton's 2nd Law)
ρ(∂u/∂t + u·∇u) = -∇p + μ∇²u + ρg
Each direction:
x: ρ(∂u/∂t + u∂u/∂x + v∂u/∂y + w∂u/∂z) = -∂p/∂x + μ(∂²u/∂x² + ∂²u/∂y² + ∂²u/∂z²)
Energy (with Heat Transfer)
ρc_p(∂T/∂t + u·∇T) = ∇·(k∇T) + Q_source + viscous dissipation
Discretization Methods
Finite Volume Method (FVM) — Industry Standard (Fluent, OpenFOAM)
Integrate governing equations over each control volume (cell)
Conservative by construction: flux through face = same for adjacent cells
Fluxes at cell faces: linear interpolation or upwind schemes
∫_V ∂ρu/∂t dV + ∮_S ρu(u·n)dA = ∮_S (τ·n)dA - ∮_S pn dA
Finite Difference Method (FDM) — simple, structured grids
Replace derivatives with Taylor series approximations
∂u/∂x ≈ (u_{i+1} - u_{i-1})/(2Δx) [2nd order central difference]
∂u/∂x ≈ (u_{i+1} - u_i)/Δx [1st order upwind, diffusive but stable]
Finite Element Method (FEM) — COMSOL, structural CFD
Weak (Galerkin) form; complex geometry; less common in pure CFD
Pressure-Velocity Coupling
SIMPLE (Semi-Implicit Method for Pressure-Linked Equations)
- Guess pressure field p*
- Solve momentum equations → u* (using p*)
- Solve pressure correction equation → p'
- Update: p = p* + αp × p', u = u* + u' (from p')
- Iterate until convergence
Relaxation factors: α_p = 0.3 (pressure), α_u = 0.7 (velocity) — standard
Smaller factors → more stable, slower convergence
At convergence: continuity and momentum residuals < 10⁻³ to 10⁻⁶
SIMPLEC: better pressure correction (α_p up to 1.0 possible)
PISO: better for transient (non-iterative per time step)
Coupled solver (Fluent): solves p-u simultaneously → fewer iterations, more memory
Boundary Conditions
Inlet
Velocity inlet: specify U, turbulence intensity (I = u'/U, typ. 1-5%), length scale L_t
Pressure inlet: specify total pressure p₀ = p + ½ρU² (good for internal flows with known p₀)
Mass flow inlet: specify ṁ [kg/s] (useful for compressors, fans)
Turbulence at inlet: k = 1.5(U×I)², ε = C_μ^(3/4) k^(3/2) / L_t (L_t ≈ 0.07 × D_hydraulic)
Outlet
Pressure outlet: specify static gauge pressure p = 0 (common for external flows)
Outflow: parabolic/fully-developed (don't use if backflow expected)
Pressure far-field: compressible, specifies M, T, p at free stream
Walls
No-slip: u = 0 (stationary wall) or u = u_wall (moving wall, rotating)
Thermal: specified T, specified q̇ [W/m²], or convection h,T_inf
Symmetry: ∂u_n/∂n = 0, u_n = 0 (mirror BC, reduces domain)
Periodic
Translational: inlet = outlet shifted (duct flow without entrance effects)
Rotational: fan/pump sector models
Wall Treatment and y⁺
y⁺ (Dimensionless Wall Distance)
y⁺ = y × u_τ / ν
u_τ = √(τ_w/ρ) [friction velocity]
τ_w = C_f × ½ρU² [wall shear stress, C_f from flat plate correlation]
Near-Wall Regions
y⁺ < 5: viscous sublayer (linear: u⁺ = y⁺)
5 < y⁺ < 30: buffer layer (transition)
y⁺ > 30: log-law region: u⁺ = (1/κ)ln(y⁺) + B, κ=0.41, B=5.2
Wall Treatment Choice
Low-Reynolds (resolve sublayer): y⁺ < 1, full boundary layer resolution
- Required for: k-ω SST, Spalart-Allmaras
- Best accuracy for separation, heat transfer, adverse pressure gradient
Wall functions (log-law): y⁺ = 30-300, boundary layer NOT resolved
- Works with: k-ε realizable, k-ε standard
- Faster (fewer cells), adequate for attached flows
First cell height (for y⁺ = 1):
y₁ = L × Re_L^(-7/8) × ... exact from flat plate friction: y₁ ≈ L × y⁺ × √(0.037/Re_L^0.2) / U
Convergence Criteria
Residuals: scaled residual < 10⁻³ (adequate), 10⁻⁴ (good), 10⁻⁶ (excellent)
- Always monitor: continuity, x-velocity, y-velocity, z-velocity, k, ε (or ω)
- Energy residual: 10⁻⁷ (heat transfer simulations)
Monitor additional quantities: drag coefficient C_d, lift C_l, outlet temperature, pressure drop
Convergence: residuals flat AND monitored quantities flat (last 100 iterations)
Stalling residuals: stuck at 10⁻³ → reduce relaxation, check mesh quality, check BCs
Discretization Schemes
First-order upwind: stable but diffusive (adds numerical viscosity), use for initial run
Second-order upwind: more accurate, needed for final results (default for accurate production runs)
QUICK (3rd order): good for structured hex meshes
Bounded central differencing: LES and scale-resolving
Pressure interpolation: Standard (p-u decoupled), PRESTO! (curved domains, rotating), Body-Force Weighted (gravity)
CFD Software Guide
| Software | Type | Strength |
|---|
| ANSYS Fluent | Commercial | Industry standard, all physics, GUI + scripting |
| ANSYS CFX | Commercial | Coupled solver, rotating machinery, multiphase |
| OpenFOAM | Open source | Full control, HPC, scripting |
| STAR-CCM+ (Siemens) | Commercial | Best CAD integration, overset mesh |
| COMSOL | Commercial | Multiphysics, FEM-based |
| Simscale | Cloud | Web-based, OpenFOAM backend |
Post-Processing
Streamlines/pathlines: flow visualization, recirculation zones
Velocity vectors/contours: flow field understanding
Wall y⁺ plot: verify y⁺ is in target range everywhere
Pressure coefficient: Cp = (p - p∞)/(½ρU∞²)
Drag/lift: integrate pressure + wall shear over surfaces
Heat flux: q" = -k(∂T/∂y)|_wall
Q-criterion: vortex identification (Q > 0 where rotation > strain)
Output
Provide: governing equations for flow regime (laminar/turbulent/compressible), BC setup, turbulence model recommendation, y⁺ target, solver settings, convergence criteria, key post-processing quantities.