Expand description
Real 2-D incompressible Navier–Stokes finite-volume solver (Chorin projection
method on a staggered Cartesian grid). Backs perform_fluid_analysis. Split
into its own library submodule (PROJECT RULE §11); carries its own correctness
tests (lid-driven cavity, channel flow, pressure outlet).
Real 2-D incompressible Navier–Stokes finite-volume solver.
Implements Chorin’s projection method on a staggered Cartesian grid:
- Predictor — compute intermediate velocity
u*from the momentum equation’s advection and diffusion terms (explicit Euler in time). - Pressure Poisson — solve
∇²p = (ρ/Δt) ∇·u*for the pressure field using Gauss–Seidel iteration. - Corrector — project
u*onto the divergence-free space:u = u* − (Δt/ρ) ∇p.
The staggered arrangement (u on vertical faces, v on horizontal faces, p at cell centres) avoids the checkerboard pressure decoupling that plagues collocated grids.
Boundary conditions supported:
- No-slip wall: velocity = 0 at the wall (Dirichlet).
- Inflow: prescribed velocity (Dirichlet).
- Outflow: zero normal gradient (Neumann ∂u/∂n = 0).
- Pressure outlet: fixed pressure, velocity extrapolated.
The solver is genuinely implemented — no fabricated results. Missing
material properties (density, viscosity) or an empty geometry return
InsufficientData. The solver converges or reports ConvergenceError.
Honesty boundary: this is a 2-D laminar incompressible solver. Turbulence
modelling (RANS k-ε, LES) is not implemented — the TurbulenceModeling
struct exists for configuration but the solver runs laminar. Compressible
flow and 3-D are flagged, not faked.
Structs§
- CfdBc
- CfdSolution
- CFD solution fields returned to the caller.
- Solver
Config - Solver configuration.
- Staggered
Grid - Staggered Cartesian grid for a 2-D domain
[x0, x0+Lx] × [y0, y0+Ly].
Enums§
- BcKind
- Boundary condition specification for each of the four domain edges.
Functions§
- cfd_
to_ analysis_ results - Convert a
CfdSolutioninto the library’sAnalysisResultsformat. - run_cfd
- Run a 2-D incompressible Navier–Stokes simulation.