Skip to content

Foehncraft v0.5

Choose a tag to compare

@github-actions github-actions released this 16 Nov 14:19
· 499 commits to main since this release
116c231
Version Stage Highlights
0.5 (2026-11-16) 5 Transient flow, run control, Python Transient incompressible flow: PISO with variable-step BDF2 and Crank–Nicolson, outer correctors for large time steps, a time step from the integration error, output at exact times, restart files and control files; the whole flow loop on NVIDIA GPUs; adjoint-ready kernels (dual numbers, transposed matrices, checkpointing); the run contract for scripts and agents (--json, --set, result.json, run record, exit codes and signals, case schema, diagnostic codes, estimate, limits, provenance); the conservation ledger and the divergence report; the bounded central scheme and the boundary conditions of D29 (slip, wedge, tables, backflow, convective outlet); derived fields; expressions, the material database and regions; the Python package foehncraft with studies; the grid convergence index of every sweep and a generated verification manual; all scripts in Python. Taylor–Green time order 2.0–2.4 and space order 2.1; Schäfer & Turek 2D-1 inside all reference ranges, C_D extrapolated to 5.5797 ± 0.0004 from three meshes; GPU flow loop bitwise equal to the CPU on a Tesla T4 (722 ns per cell and iteration on 970 225 polyhedra); a case built in Python is bitwise its TOML file. Commands foehn materials, foehn post derive, foehn schema; gallery 14–25, recipes 21–35

0.5 (2026-11-16) – stage 5: transient laminar flow, run control and Python

Highlights.

  • Transient flow. PISO with variable-step BDF2 and Crank–Nicolson,
    outer correctors (Courant number 9 at time order 2), an adaptive time
    step from the integration error with exact step rejection, output at
    exact simulated times, potential-flow start, restart files that
    continue a run bit for bit, control files and re-reading the case file
    during a run, probes and force histories. Verified on the Taylor–Green
    vortex (time order 2.0–2.4, space order 2.1) and the cylinder benchmark
    of Schäfer & Turek (Re 20 and Re 100).
  • GPU. The whole flow loop runs on NVIDIA GPUs from the same kernel
    source as the CPU, bitwise equal to the CPU on a Tesla T4.
  • Adjoint-ready kernels. Dual-number derivatives of every kernel,
    transposed matrices as gathers, binomial checkpointing (D59).
  • Run contract and health. --json, --set, result.json, the run
    record, exit codes and signals, the case schema, diagnostic codes, the
    estimate before a run, limits, provenance; the mass and kinetic-energy
    ledger and a divergence report with ranked causes and fixes.
  • Numerics and boundary conditions. The bounded central scheme, slip
    walls, wedges, inlet profiles from tables, backflow treatment and
    convective outlets; derived fields (vorticity, Q, λ₂, wall shear stress,
    y⁺) with the output and from restart files.
  • Expressions and materials. Boundary values, body forces and the
    viscosity as expressions of x, y, z and t; a material database with
    sources; regions.
  • Python. The package foehncraft: cases, expression objects, runs in
    process with callbacks, results, materials and parametric studies; all
    scripts of the repository are Python now.
  • Verification. The grid convergence index of every sweep of three or
    more meshes or time steps, and the generated verification manual.

The parts in detail, newest first:

Scripts in Python (stage 5 part 6d, D61 (2)). The shell scripts are
ported to Python and tools/ is split into groups that run as modules
from the repository root: tools/check/ (ci_cases, compare_runs,
backend, c_free, kernels, vtkhdf), tools/bench/ (build_hypre
and the cloud GPU drivers with their shared steps in cloud),
tools/mesh/, tools/plot/ (the charts), tools/release/
(verification_manual) and tools/notebooks/ (the Colab notebooks).
tools/ci_cases.sh SET is now python3 -m tools.check.ci_cases SET,
gpu/ptx-kernels/build.sh is python3 gpu/ptx-kernels/build.py; CI,
docs, examples and error messages are updated, and CI lints the scripts
(ruff, syntax and names). See tools/README.md.

Discretisation uncertainty and the verification manual (stage 5 part
6c, D67, D68).
A sweep of three or more meshes or time steps reports
for every monitored quantity (patch mass flows, mean pressures and forces,
force coefficients, benchmark values, viscous and numerical dissipation)
the observed order by the fixed-point iteration of Celik et al. (2008),
the extrapolated value, the band φ1 ± U, the grid convergence index and a
verdict (monotonic, oscillatory, divergent, unchanged): a table in
flow.md and uncertainty in flow.json and result.json (an
addition; Result.uncertainty in Python). Level sweeps no longer need an
exact solution or a benchmark; expected_order without [analytic] is
now refused (CASE005) instead of being ignored. New case
cylinder_re20_gci.toml (the benchmark 2D-1 on 6 144 to 98 304 cells,
long set): C_D extrapolates to 5.5797 ± 0.0004 inside the reference
range. New script tools/release/verification_manual.py writes
docs/verification/manual.md, results.json and a chart of the observed
orders from the case files and a catalogue run. Gallery 25, recipes 34
and 35 on new Verification pages; tools/gci_chart.py. Runs are bitwise
unchanged.

The Python package (stage 5 part 6b, D61, D62). python/ holds the
package foehncraft with a native module (crates/foehncraft-py, PyO3,
built with maturin, abi3 for Python 3.10+): Case (read, change with
dotted keys, write; the TOML round trip holds for every example case;
relative paths kept when saved elsewhere), expression objects with Python
operators that render the strings of the case file (foehncraft.expr,
evaluated with the solver's own compiler), run in process or through
foehn with callbacks on every iteration or time step that can stop the
run, Result (summary, CSV tables, VTKHDF fields), the material database
and material builders, and foehncraft.study (grid, list, Latin
hypercube, Sobol; one case file per variant, study.csv, resume). The
engine gains engine::Observer (sees every row of the run record) and
RunOptions::observer; runs are bitwise unchanged. New CI job "Python
package" (ruff, pytest). New scripts examples/python/poiseuille_inflow.py
and examples/studies/couette_viscosity_study.py; gallery 24, recipe 33
on the new Python pages, case catalogue page "Python scripts".

Expressions, materials and regions (stage 5 part 6a, D53, D102, D112,
D121, D124 W3/W4).
Boundary values (velocity, normal velocity, pressure,
total pressure, mass flow), the body force and the viscosity may be
strings of a small expression language in x, y, z and t, with
[constants] and piecewise linear [tables] (inline or from a file); the
strings are checked when the case is read (EXPR001–EXPR005, with the
place and a "did you mean") and compiled to a stack-machine program that
the solver evaluates with new in-house elementary functions
(foehncraft_core::math, D93 (6)), the same on every platform. Fluid
properties from a built-in material database (air, water, engine oil,
ethylene glycol, glycerol, each with its source) with [fluid] material,
temperature and operating_pressure; [materials.<name>] with base
and the forms constant, polynomial, Sutherland, power law, table (linear
or monotone cubic) and expression; the new command foehn materials
lists and evaluates them (also --json). [regions.<name>] assigns cell
zones to materials; non-fluid regions and unknown zones are refused
(REG001, REG002); different viscosities per region give a viscosity per
face. Walls take a mass_flux (blowing and suction), checked for closed
volumes (BC026), and expose per-face exchange coefficients
(derived::wall_exchange). The resolved property program is written into
case.resolved.toml; properties_hash and materials_database join the
provenance. The random-number key gains a stream word (rng::keyed;
meshes unchanged). foehn flow --check also checks the regions against
the mesh. New exact solutions couette-viscosity and
couette-transpiration; new cases flow/couette_viscosity.toml,
couette_transpiration.toml, poiseuille_water.toml,
poiseuille_expression.toml, taylor_green_expression.toml and
channel_ramp.toml; gallery 23, recipes 31 and 32 on the new
"Expressions and materials" pages; tools/property_chart.py. Cases
without the new keys run bitwise as before.

Derived fields of stage 5 (part 5c, D72). [output] derived adds
fields computed from the solution to every fields*.vtkhdf: vorticity
(components and magnitude), q-criterion, lambda2, enstrophy,
strain-rate, pressure-coefficient (reference state in
[output.reference]: velocity, pressure, density), total-pressure, and
on the patch blocks of the file wall-shear-stress and y-plus. The new
command foehn post derive CASE writes the same file afterwards from a
restart file (--restart, default latest; --fields, --file), equal
byte for byte to the file of the run. The VTKHDF writer gains boundary
face fields on the patch blocks; the units attribute lists the derived
datasets; the estimate counts them; output.derived and
output.reference may change during a run. tools/render_mesh.py gains
--diverging. New case flow/couette_derived.toml (exact on any mesh);
gallery 22, recipe 30 on the new Post-processing pages. Without derived
every output is as before.

Boundary conditions of stage 5 (part 5b, D29). New condition types
slip-wall, wedge and convective-outlet (∂u/∂t + U_c ∂u/∂n = 0 in
transient runs, the outlet flow balanced with the inflow, U_c by default
the mean outflow speed); inlet profiles from a table (profile = "table",
table, table_coordinate x, y, z or the radius about an axis, the
table's sha256 in the case hash); backflow treatment at static and total
pressure outlets (backflow = "total-pressure", the new default,
"zero-gradient", the treatment before, or "suppress", which closes the
faces where the flow would enter). Axisymmetric wedge meshes from any 2D
mesh of the box generator (mesh.generate.wedge, the axis without a
patch), and the exact solutions uniform and pipe-poiseuille. Seven new
diagnostic codes BC019–BC025. The restart file of a run with a
convective outlet gains the datasets ub_old_x|y|z. New cases
flow/channel_slip.toml, poiseuille_table.toml (with
poiseuille_profile.csv), pipe_wedge.toml, cylinder_re100_short.toml
and cylinder_re100_convective.toml; gallery 21, recipe 29. Runs whose
outlets see no backflow are bitwise as before; the Poiseuille cases on
perturbed prisms, polygons and mixed cells, where a few outlet faces see
inflow in the first iterations, change by 2e-6 relative
(backflow = "zero-gradient" gives the earlier results bitwise).

Wall film requirements (D123, D124). Requirements for the wall film of the Lagrangian sprays (L12): an Eulerian thin film on the wall faces with parcels for splash, rebound, separation and stripping; impingement regimes (Bai–Gosman, Kuhnke), capillarity and dry patches in the first version, CHT coupling of the heated film, ledger and reproducibility rules, staging F1 to F5 and validation cases; Milestone 1 keeps a surface mesh and surface halo of the wall faces, per-face wall boundary values including a wall mass flux, and gravity as a case vector. Documentation only.

Numerics of stage 5 (part 5a). A bounded central convection scheme
(solver.scheme = "central", D25) with the bound β and a blend with linear
upwind; the time step from the error estimate of BDF2 and Crank–Nicolson
(time.error_tolerance, D65), with steps above the tolerance taken back
exactly and repeated shorter (solves[].transient.rejected in
result.json, an error value in the step rows of run.jsonl); output in
simulated time that the steps land on (output.fields_interval,
fields_times, monitor_interval, run.restart_interval,
restart_times, D66); and a potential-flow start
(initial.potential_flow, D52). The restart file gains the attribute
dt_prev2 and, with the error estimate, the datasets u_old2_x|y|z;
older files still read. New cases flow/taylor_green_error.toml,
flow/cylinder_potential.toml and the variant bounded-central of
scalar/oblique_step_2d.toml; gallery 20, recipe 28,
tools/time_step_chart.py. Runs without the new keys are bitwise as
before.

Material property requirements (D94–D103, L23–L25). Requirements for a
material database and the handling of properties: database, case materials
and a resolved, hashed property program; property forms (constant,
polynomial, NASA-7 and NASA-9, Sutherland, tables with linear or monotone
cubic interpolation, polynomial c_p expressions, mixing rules, kinetic
theory, equations of state); checks; GPU evaluation; SI only; no property
changes at run time; a built-in starter set with IAPWS water and steam;
importers, table generators and a generic interface for external property
sources. Implementation starts in stage 5 PR 6 (μ and ρ) and continues with L1.

Renamed from CFDCraft (and the short-lived Ennecraft) to Foehncraft, after
the foehn wind of Innsbruck (see the README), so that the name cannot be
confused with other projects. Crates are now foehncraft-*, the command is foehn, the
environment variables are FOEHNCRAFT_*, and the repository is
chiefenne/Foehncraft. Entries below keep the names of their time.

Faster CI. Pull requests get a fast gate (about 5 minutes instead of
about 25): a ci build profile (release optimisation without LTO, results
bitwise equal), the case catalogue split over parallel jobs
(tools/ci_cases.sh), and a VTKHDF check that no longer computes unused
volumes of field files (11.5 minutes to seconds). Push to main, a nightly run
at 02:07 Vienna time and pull requests with the label full-ci run the full
tier: release profile, debug tests, every case including the cylinder at
Re 100, and the slow tests. One summary check, "CI OK". Main warms the ci-profile cache that pull
requests read (without it every PR compiled its dependencies from scratch).

Run contract for scripts and agents (stage 5, part 4a). foehn flow
can be driven by a program: --set key=value overrides (TOML values),
global --json (one JSON object on standard output, human text on
standard error) and --quiet, exit codes 0 finished, 1 error, 2 failed
checks, 3 stopped; SIGUSR1 writes a restart file, SIGTERM, SIGINT and
SIGUSR2 stop cleanly, --restart latest continues bitwise; budgets in
[run.limits] (wall time, steps or iterations, output volume). Every run
writes result.json (status, overrides, provenance with commit and case
hash, diagnostics, results, SHA-256 of the outputs; byte-identical between
identical runs) and the run record run.jsonl. 41 stable diagnostic
codes with key paths, locations and --set fixes; foehn schema prints
the JSON Schema of the case file, docs/keys.md is generated from it;
--check estimates memory, output and wall time; --read-root and
--write-root confine the files; CSV, VTKHDF and restart files describe
themselves; HDF5 files have no timestamps. The CLI is a thin layer on
foehncraft_flow::engine; foehncraft-flow without default features is
checked C-free in CI. Formats and codes: docs/interfaces.md; recipe 26,
gallery 18, case cavity_re100_budget.toml. No result changes: the
catalogue gives bitwise the fields of main.

Health checks: conservation ledger and divergence report (stage 5,
part 4b).
Every flow run books mass and kinetic energy (D88): storage,
the terms of each patch (viscous work, convected energy, pressure work,
mass flow), the body force, the viscous dissipation of the discrete
operator, and the remainder, the numerical dissipation, which the second
law wants positive (D90 part 4), split into its pressure part (the
momentum interpolation) and the part of the convection and time
schemes. Steady runs give the
table every [balance] every iterations and at the end; transient runs a
compact line with every progress line and a time-integrated ledger of the
run (trapezoidal rule). balance.csv, balance.svg, balance rows in
run.jsonl, solves[].balance in result.json, tolerances with the
codes BAL001–BAL003 (the new key [balance] tolerance_energy for
the negative numerical dissipation) and an optional stop. Measured: on the lid-driven
cavity the numerical dissipation is positive, about 1.5 % of the lid
power and falling with the mesh; on the Taylor–Green vortex it falls with
order 2.5, its pressure part with order 3. A run that diverges (D63) now writes its last valid state and
restart file, a VTKHDF snapshot of the failing cells and their
neighbours, and a report (divergence.md, divergence.json) with the
likely causes ranked by their evidence and a --set fix for each, and
ends with RUN014 (exit code 1). A linear-solver breakdown counts as a
divergence, and a NaN in the continuity residual no longer slips past the
check. The restart file can hold point coordinates and cell volumes
(D91). Recipe 27, gallery 19, case cavity_re100_energy.toml,
tools/balance_chart.py, tools/energy_budget_chart.py. No result
changes: the catalogue gives bitwise the fields of part 4a.

Adjoint-ready kernels (part 3)

Preparation for a discrete adjoint solver (D59; the solver itself is L17).
No result changes: all flow cases give bitwise the files of part 2.

  • Dual numbers: foehncraft_core::Dual<N> implements Real, so every
    kernel body also runs on dual numbers and returns the exact derivatives
    of its results, from the same source. Switches (upwind direction,
    limiter branch, clipping) follow the values, i.e. they are frozen at the
    linearisation state; the limiter array ψ can be held constant.
    Jacobians of 11 face, cell and boundary kernels agree with central
    differences in every input array (320 580 derivatives, largest relative
    difference 5e-7).
  • Shape derivatives: the geometry of foehncraft-mesh (face areas and
    centroids, cell volumes and centroids) is generic over the coordinate
    type, so derivatives with respect to the node coordinates come from the
    same code (165 024 derivatives against central differences, 2.8e-7).
  • Transposed matrices: a transpose map of the matrix storage gives Aᵀ
    in the storage of A and the product Aᵀx without storing it, both gathers
    without atomics (foehncraft_kernels::adjoint; flow-device calls
    transpose, matrix_product, transposed_product; PTX entries
    flow_transpose, flow_matrix_product, flow_transposed_product).
    ⟨Av, w⟩ = ⟨v, Aᵀw⟩ to 1e-14 on the matrices of a SIMPLEC solve; CG with
    the multigrid and BiCGStab solve the transposed systems.
  • Binomial checkpointing (foehncraft_flow::checkpoint, Griewank &
    Walther 2000): an optimal schedule (checked against a dynamic program),
    a driver for any primal run and the in-memory snapshot of the flow
    solver; the reverse sweep of a BDF2 run meets every level bitwise.
  • Gallery 17, recipe 25, tools/checkpoint_chart.py, report
    stage 5, part 3.

GPU flow loop (part 2)

  • The flow loop on the GPU: run.backend = "cuda" or
    foehn flow --backend cuda runs every flow case, steady and transient,
    on an NVIDIA GPU (compute capability 7.0 or newer), with all fields,
    matrices and old levels in GPU memory; results bitwise equal to the CPU
    (D31). Tesla T4 (Colab): all 8 cases bitwise equal to the CPU; 722 ns
    per cell and SIMPLEC iteration on 970 225 polyhedra (7.1 times the two
    CPU threads of the VM), 1 049 ns per cell and PISO step on 98 304 cells
    (9.2 times).
    Gallery 16.
  • One source down to the argument lists: the 27 operations of the flow
    loop are entries of foehncraft_kernels::entry (a #[repr(C)] argument
    block and a body per index). The CPU loops and the PTX entries flow_*
    run the same body with the same block; the flow device is written once
    over an executor (device::kernel).
  • CUDA in one crate (D60): new crate foehncraft-cuda holds all CUDA
    code (flow executor, the scalar and multigrid backend, the G1 backends
    and the CUDA C reference, moved from foehncraft-fv and
    foehncraft-bench); the solver crates find it through registered
    factories. CI lint tools/check_backend.py. The feature is now
    foehncraft-cuda/cuda (the CLI's cuda feature is unchanged).
  • New tools tools/compare_runs.py (bitwise comparison of two runs),
    tools/stage5_cloud.py and tools/stage5_colab.ipynb (CPU against GPU
    on eight cases up to one million polyhedra); new cases
    cavity_poly3d_gpu.toml, cylinder_re100_gpu.toml; recipe 24.
  • The CPU results of all flow cases are bitwise those of part 1. A missing
    NVIDIA driver now gives a message instead of a panic.

Transient laminar flow (part 1)

Stage 5 comes in several pull requests and is released as 0.5 when it is
complete. The first part, the transient core and its benchmarks
(stage 5):

  • PISO (Issa 1986) with variable-step BDF2, Crank–Nicolson (first step
    BDF1, the start of Rannacher 1984) and BDF1; two correctors with the
    neighbour correction between them; optional outer iterations per step
    (PIMPLE-type) with a residual tolerance; the convecting flux and the
    deferred corrections extrapolated to the new time, which keeps plain
    PISO second order. A case is transient when it has a [time] table.
  • Adaptive time step from the largest Courant number, with a growth
    limit inside the zero-stability range of BDF2.
  • Rhie–Chow time-step term (D27) whose steady state is exactly the
    steady solution, for any Δt (cavity: equal to SIMPLEC to 2e-12).
  • Restart files (D42, HDF5): a continued run is bit-identical to the
    run without the interruption. Control files and re-reading (D40):
    .stop, .result_N, .read_toml_N, run.reread_every. Monitors
    (D43):
    history.csv, forces.csv, probes.csv, field series,
    force coefficients.
  • Built-in cylinder mesh [mesh.cylinder] (O-grid and wake block) and
    the parabolic inlet profile; the Schäfer & Turek benchmarks 2D-1 and
    2D-2 with their evaluation (C_D, C_L, St, Δp).
  • Results: Taylor–Green time order 2.21 (BDF2) and 2.00
    (Crank–Nicolson) on the finest pair, space order 2.09, order 2 at
    Courant numbers up to 9 with outer iterations; cylinder Re 20 inside all
    reference ranges on 98 304 cells; Re 100 on 6 144 cells with C_D,max,
    St and Δp inside the ranges, on 24 576 cells C_L,max 0.5 % below its
    range and the others inside.
  • cfdcraft flow --restart FILE --end-time T; seven new case files,
    gallery 14–15, recipes 21–23. The Release workflow now refreshes the
    cached README badges (recipe 6).