About the guide
The guide teaches CFD-craft in 24 chapters, ordered by difficulty. Each chapter is self-contained: it starts with a setup, uses one small case and ends with links to the next steps. It covers the native solver (constant-density incompressible flow with passive gas and particles on uniform Cartesian grids), its Python binding, the tools for city blocks and mobile measurements, and the separate OpenFOAM backend.
Version 0.2.0 is a research prototype. A numerically accepted run is not an experimentally validated prediction.
Chapters
| Part | Chapters |
|---|---|
| I First steps | 1 First run · 2 The case file · 3 The command line and the run archive · 4 Can I trust this result? · 5 Sources, receptors and transport |
| II Flow | 6 Compute a flow · 7 Before you spend compute · 8 Checkpoint and restart · 9 Opt-in numerics · 10 Buildings and a street canyon |
| III Automation | 11 Python · 12 Many runs · 13 Optimization lessons F1 to F3 · 14 Optimization jobs |
| IV OpenFOAM backend | 15 Install and run a cavity · 16 Compare solvers and measurements · 17 Continue a solve, start a finer mesh · 18 Audit a wall-resolved backstep · 19 A bounded refinement campaign |
| V Embedding and help | 20 The Rust library · 21 Troubleshooting |
| VI City blocks and mobile measurements | 22 Urban geometry, particles and vegetation · 23 Mobile paths and virtual rides · 24 Source inference and route selection from rides |
Chapters 1 and 2 need only pip install cfd-craft. From chapter 3 on, commands
run from the root of a checkout. Part IV needs Linux and an OpenFOAM
Foundation 13 runtime, which chapter 15 installs. Part VI builds on chapters
5 and 10; its map and inference tools need the optional Python packages of
integrations/requirements-mobile.txt.
Which interface
| Goal | Use | Start at |
|---|---|---|
| Get receptor values and checks in Python | cfd_craft.check, cfd_craft.simulate | chapter 1 |
| Keep fields, a verified archive, restart, preview, profile | the cfd-craft command | chapter 3 |
| Script many archived runs | the command through subprocess | chapters 11 and 12 |
| Embed the solver in a Rust program | cfd_craft::solver::run | chapter 20 |
| Run optimization jobs or campaigns | the fcmaes worker and optimization-run | chapters 13 and 14 |
| Run or compare with OpenFOAM | integrations/openfoam_backend.py | chapter 15 |
| Import buildings from a map, run a wind-direction campaign | integrations/urban_map.py, validation/urban_campaign.py | chapter 22 |
| Simulate a sensor ride | a path receptor and integrations/virtual_ride.py | chapter 23 |
| Infer street emissions from rides, plan routes | tutorials/mobile_measurements.py, integrations/mobile_inference.py | chapter 24 |
The Python package installs from PyPI without a toolchain. The command and the library are built with Rust 1.88 or newer. The analysis scripts, the map and ride tools and the OpenFOAM tools are run from a checkout. The native solver does not need OpenFOAM, and the adapter starts OpenFOAM as separate programs.
How to read the code blocks
- A
pythonorbashblock is meant to be run as it stands, in the order of its section, after theSetupsection of its chapter. Ashblock shows commands that install, build or take long; adapt them before you run them. - Every section starts from what
Setupleft, not from the section before it. When you run a whole chapter in order, first remove an output directory that an earlier section made (rm -r runs/point): a run never writes into an existing directory (CFD-E062, chapter 3). - A
textblock is the real output of the block before it. Outputs show a few chosen fields, never wall times or hashes. - A
jsonblock is a complete case, or a fragment that the text names. scripts/check_docs.pyruns the blocks of the chapters and compares the outputs: floating-point numbers within the tolerance a chapter states, everything else exactly. Part IV runs only where the runtime is installed.
Three words are kept apart on every page. A run completed or stopped (termination). A result is numerically accepted or not (assessment). A model is validated against measurements or not; in 0.2.0 none is.