Skip to content

Examples¤

The PICT repository ships with sample scripts that range from a 90-line "hello world" to the full turbulence-learning setup of the paper. The examples in this section walk through the most instructive ones. Each page starts with a Source box that names the script and the origin of its setup. The code excerpts are verbatim copies of the scripts, with their line numbers. All visuals on these pages were produced with the solver: the flow fields and charts were rendered for this website with the current code, and the figures marked as such come from the paper.

Basic setups and learning¤

  • Lid-Driven Cavity


    Lid-driven cavity Lid-driven cavity

    The minimal setup: one wall-refined block, a moving lid, adaptive time stepping. 2D and 3D.

  • Vortex Street


    Vortex street

    Flow around a cylinder on a 4-block ring grid with inflow, advective outflow and an optional rotating obstacle.

  • NACA 0012 Airfoil


    Airfoil C-grid Airfoil C-grid

    A 3-block C-grid around an airfoil, interpolated from its border curves, with flipped block connections.

  • Buoyant Plume


    Buoyant plume

    A passive scalar couples back into the flow through callbacks: smoke inflow, a buoyancy force and clamping.

  • Learning a Forcing


    Learning a forcing Learning a forcing

    Gradient descent through the differentiable solver recovers an unknown forcing, and a CNN learns to predict it.

  • Turbulent Channel Flow SGS Model


    Channel flow

    The paper's flagship experiment: a 3D SGS model trained only on turbulence statistics.

Benchmark flows¤

Eight further forward-simulation samples, on seven pages, set up common benchmark flows. The backward-facing step and the Kármán vortex street are adapted from the code of INC (Wei et al., NeurIPS 2025). The cylinder, airfoil, Rayleigh–Bénard and channel flows are the uncontrolled flows of the FluidGym environments (Becktepe et al., ICML 2026).

All sample scripts¤

Script What it shows
minimal_lid_sample.py 2D lid-driven cavity on a single wall-refined block; start here
minimal_lid_sample3D.py the same cavity extruded to 3D
buoyancy_sample.py passive scalar transport and a buoyancy force via callbacks
vortex_street_torus_sample.py cylinder on a 4-block ring grid, inflow, advective outflow, rotating obstacle; 2D or 3D
vortex_street_sample.py channel with a square obstacle built from 8 blocks; periodic or closed walls; scalar inflow
vortex_street_refined_sample.py the 8-block obstacle channel with graded refinement around the obstacle
airfoil_sample.py NACA 0012 airfoil on a 3-block C-grid
test_BFS.py 2D backward-facing step on 3 refined blocks
backward_facing_step_sample.py backward-facing step on 5 refined blocks with an outflow buffer; 2D or 3D with a periodic span (from INC)
karman_vortex_street_sample.py rectangular obstacle in a closed channel on 8 refined blocks, wake perturbation (from INC)
decaying_turbulence_sample.py decaying turbulence in a periodic box, 2D or 3D
kolmogorov_flow_sample.py 2D Kolmogorov flow: sinusoidal forcing with linear damping
cylinder_channel_sample.py Schäfer & Turek cylinder channel on a 5-block O-grid; 2D or 3D with a periodic span (from FluidGym)
airfoil_channel_sample.py NACA 0012 in a channel on 6 blocks, 2D or 3D with a periodic span (from FluidGym)
rayleigh_benard_sample.py Rayleigh–Bénard convection in 2D or 3D, temperature as a buoyant passive scalar (from FluidGym)
turbulent_channel_flow_sample.py 3D turbulent channel flow at Reτ = 180 in a small channel (from FluidGym)
circle_square_grid.py grid generation only: a cylinder inside a square from 8 blocks
learning_sample.py optimize a forcing and train a forcing network through the solver
channel_flow_sim.py turbulent channel flow at Reτ = 550: validation runs and training data
channel_flow_learning.py statistics-based training of the channel-flow SGS model
run_tests.py, run_validations.py test suite and physical validation cases

All scripts are meant to be run from the repository root and write their output to ./test_runs/<timestamp>_<name>/. Most of them pick the least-used GPU automatically and can be stopped gracefully with Ctrl-C.