Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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

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

GoalUseStart at
Get receptor values and checks in Pythoncfd_craft.check, cfd_craft.simulatechapter 1
Keep fields, a verified archive, restart, preview, profilethe cfd-craft commandchapter 3
Script many archived runsthe command through subprocesschapters 11 and 12
Embed the solver in a Rust programcfd_craft::solver::runchapter 20
Run optimization jobs or campaignsthe fcmaes worker and optimization-runchapters 13 and 14
Run or compare with OpenFOAMintegrations/openfoam_backend.pychapter 15
Import buildings from a map, run a wind-direction campaignintegrations/urban_map.py, validation/urban_campaign.pychapter 22
Simulate a sensor ridea path receptor and integrations/virtual_ride.pychapter 23
Infer street emissions from rides, plan routestutorials/mobile_measurements.py, integrations/mobile_inference.pychapter 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 python or bash block is meant to be run as it stands, in the order of its section, after the Setup section of its chapter. A sh block shows commands that install, build or take long; adapt them before you run them.
  • Every section starts from what Setup left, 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 text block is the real output of the block before it. Outputs show a few chosen fields, never wall times or hashes.
  • A json block is a complete case, or a fragment that the text names.
  • scripts/check_docs.py runs 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.