Expand description
§tpt-sci-cfd-core
A small, dependency-light incompressible Navier–Stokes solver built from
scratch (no wrapped engine — pravash was audited and rejected, GPL-3.0-only)
using a collocated finite-volume discretization on a uniform staggered
grid with a fractional-step (Chorin) pressure projection.
It provides the foundation that the biomedical/earth-science crates
(tpt-sci-hemodynamics, tpt-sci-ocean) build on. The core pieces:
- A
CollocatedGriduniform grid with cell-centred velocity storage. - An explicit advection–diffusion update
Step::momentumplus a pressure Poisson projectionStep::projectthat enforces∇·u = 0(the fractional-step scheme). - Optional algebraic
turbulence::eddy_viscosity(Smagorinsky) and a full two-equationkomega_sst::KOmegaSstMenter SST closure. - An implicit
simple::SimpleSolverpressure-correction (SIMPLE/PISO style) that solves the pressure Poisson equation with the sparse conjugate-gradient solver fromtpt-sci-gridand corrects the velocity. - An additive
unstructured::UnstructuredMeshfinite-volume path (triangular cells in 2-D) with a gradient/reconstruction helper and a diffusion + upwind-advection residual assembly that can solve a steady Laplace/Poisson problem converging to the analytic solution.
The structured explicit Step and algebraic turbulence model remain the
teaching / coupling primitive; the three additions above close the v1
“out of scope” items.
§Example
use tpt_sci_cfd_core::{CollocatedGrid, Step, Boundary};
use tpt_math_linalg::tpt_math_linalg_dense::DVector;
// 32×32 cavity, lid moving at u = 1.0 on the top wall.
let grid = CollocatedGrid::new(32, 32, 1.0, 1.0).unwrap();
let mut step = Step::new(grid, 1e-2, 0.01, 1.0);
step.set_boundary(Boundary::Top, 1.0);
// One fractional-step update (advect/diffuse + project).
let ok = step.advance();
assert!(ok);Re-exports§
pub use komega_sst::KOmegaSst;pub use scalar::ScalarTransport;pub use simple::SimpleSolver;pub use unstructured::Face;pub use unstructured::UnstructuredMesh;
Modules§
- komega_
sst - Two-equation
k-ωSST turbulence closure (Menter, 2003). - scalar
- Scalar transport (species or temperature) on the collocated grid.
- simple
- SIMPLE-style implicit pressure-correction solver.
- turbulence
- Lightweight algebraic turbulence modelling for
tpt-sci-cfd-core. - unstructured
- Unstructured (triangular) finite-volume/finite-element solver.
Structs§
- Collocated
Grid - A uniform 2-D collocated grid of
nx × nycells, physical sizelx × ly. Velocitiesu,vare stored cell-centred. - Step
- One fractional-step of the incompressible Navier–Stokes solver on a collocated grid.