How cfd-go/tclb works
TCLB is a distributed, accelerator-capable computational-fluid-dynamics solver using the Lattice Boltzmann Method. The principal workflow is: a user supplies an XML run configuration; the executable initializes MPI and a solver, sizes its lattice, and dispatches XML elements to handlers that control the run; model-specific dynamics update the simulation, with callbacks and output handlers providing results. The tree and excerpts support the main dispatch and several internal layers; README-described subsystems with unsampled implementations are included at their exact enclosing paths, with uncertain wiring omitted.
Main entry points: src Solver state · main.cpp Runtime entry · Handlers.h Handler dispatch · HandlerFactory.h Handler factory
Components 24
Run orchestration
- Runtime entry
src/main.cpp - Handler dispatch
src/Handlers.h - Handler factory
src/HandlerFactory.h - Handler lifecycle
src/Handlers/vHandler.h
LBM simulation
- Solver state
src - Lattice state
src - LBM dynamics
models - Geometry and regions
src/Geometry.h
Control and optimization
- Run controls
src/Handlers - Design handlers
src/Handlers/Design.cpp - Adjoint optimization
src/Handlers/OptimalControl.cpp - Model parameters
src/Handlers/acParam.cpp
Sampling and output
- Runtime callbacks
src/Handlers/Callback.cpp - Field sampling
src/Sampler.cpp - Output handlers
src/Handlers - HDF5 output
src/hdf5Lattice.cpp - VTK output
src/vtkOutput.cpp
Coupling and parallelism
- Particle coupling
src/lammps.cpp - Remote force
src/RemoteForceInterface.cpp - Synthetic turbulence
src/SyntheticTurbulence.cpp - MPI runtime
- GPU runtime
Other components
- Simulation user
- XML configuration
Connections 25
- Simulation user → Runtime entry: launches
- Simulation user → XML configuration: provides
- Runtime entry → XML configuration: parses
- Runtime entry → Solver state: initializes
- Runtime entry → Handler dispatch: constructs
- Handler dispatch → Handler factory: creates
- Handler dispatch → Handler lifecycle: dispatches lifecycle
- Handler factory → Run controls: selects handlers
- Handler factory → Design handlers: selects handlers
- Handler dispatch → Solver state: passes solver
- Solver state → Lattice state: owns state
- LBM dynamics → Lattice state: updates fields
- Geometry and regions → Solver state: defines regions
- Runtime entry → Runtime callbacks: registers callback
- Runtime callbacks → Solver state: reports progress
- Field sampling → Lattice state: samples fields
- Output handlers → HDF5 output: writes HDF5
- Output handlers → VTK output: writes VTK
- Design handlers → Adjoint optimization: supports adjoint control
- Adjoint optimization → Model parameters: gets and sets parameters
- Solver state → MPI runtime: uses MPI
- Solver state → GPU runtime: uses CUDA or HIP
- Solver state → Particle coupling: couples DEM
- Solver state → Remote force: couples force interface
- Solver state → Synthetic turbulence: uses turbulence model