How gladk/palabos works
Purpose and entry points
Palabos is a C++ lattice-Boltzmann CFD framework for 2D/3D simulation, not a single deployable application. Users build the library and write/run scenario executables. Primary public aggregation headers are src/palabos2D.h and src/palabos3D.h; representative executable entry points are examples/showCases/cavity3d/cavity3d.cpp and examples/showCases/generalExternalFlow/generalExternalFlow.cpp.
Build, runtime, and dependencies
The native runtime is C++ with serial and MPI-distributed execution. Top-level build entry points are CMakeLists.txt and SConstruct, with source-library build definition in src/CMakeLists.txt. Bundled dependencies include Eigen linear algebra (externalLibraries/Eigen3/Core), TinyXML (externalLibraries/tinyxml/tinyxml.h), nanoflann, and sitmo PRNG. MPI coordination is centralized by src/parallelism/mpiManager.h; MPI-aware output is in src/io/mpiParallelIO.cpp.
Core lattice model and dynamics
The core object model represents cells, blocks, lattice state, dynamics, and statistics. src/core/cell.h, src/core/dynamics.h, and src/core/blockLatticeBase3D.h define the foundational abstractions. Collision/streaming math and descriptors are template-oriented in src/latticeBoltzmann/dynamicsTemplates3D.h, src/latticeBoltzmann/latticeTemplates3D.h, and src/latticeBoltzmann/mrtLattices.h. Basic BGK-like, thermal, and forced models build on this in src/basicDynamics/isoThermalDynamics.h and src/basicDynamics/externalForceDynamics.h.
Domain decomposition and parallel execution
Atomic blocks hold local lattice/data-field regions; multi-block layers assemble and manage distributed sparse domains. Key boundaries are src/atomicBlock/atomicBlock3D.h, src/multiBlock/multiBlockLattice3D.h, and src/multiBlock/multiBlockManagement3D.h. During each simulation step, halo/non-local transfers and reductions cross this boundary through src/multiBlock/nonLocalTransfer3D.h and src/parallelism/parallelBlockCommunicator3D.h; parallel lattice wrappers are in src/parallelism/parallelMultiBlockLattice3D.h.
Simulation composition: boundaries, physics, geometry
Applications configure a lattice, assign dynamics, impose boundaries, then repeatedly execute time steps and processors. Boundary implementations are separated from bulk dynamics in src/boundaryCondition/boundaryCondition3D.h, src/boundaryCondition/bounceBackModels3D.h, and src/boundaryCondition/zouHeBoundary3D.h. Extended models include turbulence/non-Newtonian/advection-diffusion in src/complexDynamics/smagorinskyDynamics.h and src/complexDynamics/carreauDynamics.h, plus multiphase/free-surface coupling in src/multiPhysics/shanChenProcessor3D.h and src/multiPhysics/freeSurfaceModel3D.h. STL/triangle geometry is converted into off-lattice boundary handling via src/offLattice/triangleSet.h, src/offLattice/voxelizer.h, and src/offLattice/offLatticeBoundaryCondition3D.h.
Processing, analysis, and persistence
Functional/wrapper APIs apply initialization and analysis over fields/lattices: src/dataProcessors/dataInitializerWrapper3D.h, src/dataProcessors/dataAnalysisWrapper3D.h, and src/atomicBlock/dataProcessorWrapper3D.h. Results and checkpoints cross into file formats through src/io/serializerIO_3D.h, src/io/multiBlockWriter3D.h, and src/io/vtkDataOutput.h. XML input is mediated through src/libraryInterfaces/TINYXML_xmlIO.h, as used by XML-configured example scenarios.
Adaptive and language integration layers
Multi-resolution simulation is a distinct orchestration layer over multi-block lattices: src/multiGrid/multiGridLattice3D.h, src/multiGrid/gridRefinement3D.h, and octree-oriented src/gridRefinement/octreeGridGenerator.h. The repository also ships Jlabos: Java APIs backed by SWIG/C++ wrappers, with public Java lattice classes in jlabos/src/jlabos/MultiBlockLattice3D.java, native binding interfaces in jlabos/src/swig/javaInterface3D.i, and wrapper implementations in jlabos/src/plbWrapper/lattice/multiBlockGenerator3D.cpp.
Main entry points: multiBlockLattice3D.h Multi-block domain · cavity3d.cpp Scenario executables · CMakeLists.txt Source library build · palabos3D.h 2D/3D public headers
Components 21
Build & Dependencies
- CMake & SCons · Builds the C++ library and scenario executables.
CMakeLists.txt - Source library build
src/CMakeLists.txt - Bundled dependencies
externalLibraries/Eigen3/Core
Lattice Core
- 2D/3D public headers
src/palabos3D.h - Cell, dynamics & lattice
src/core/blockLatticeBase3D.h - Descriptors & lattice math
src/latticeBoltzmann/dynamicsTemplates3D.h - Basic dynamics
src/basicDynamics/isoThermalDynamics.h
Distributed Execution
- Atomic blocks
src/atomicBlock/atomicBlock3D.h - Multi-block domain
src/multiBlock/multiBlockLattice3D.h - Domain management
src/multiBlock/multiBlockManagement3D.h - Halo exchange & reductions
src/parallelism/parallelBlockCommunicator3D.h - MPI runtime
src/parallelism/mpiManager.h
Simulation Features
- Boundary conditions
src/boundaryCondition/boundaryCondition3D.h - Advanced physics · Turbulence, non-Newtonian, multiphase, and free-surface models.
src/multiPhysics/shanChenProcessor3D.h - Off-lattice geometry
src/offLattice/offLatticeBoundaryCondition3D.h - Initialization & analysis
src/dataProcessors/dataAnalysisWrapper3D.h - Adaptive multi-grid
src/multiGrid/multiGridLattice3D.h
I/O & Language Integration
- Output & checkpoints
src/io/multiBlockWriter3D.h - XML input
src/libraryInterfaces/TINYXML_xmlIO.h - Jlabos Java bindings · Java lattice APIs backed by native C++ wrappers.
jlabos/src/swig/javaInterface3D.i
Other components
- Scenario executables
examples/showCases/cavity3d/cavity3d.cpp
Connections 23
- CMake & SCons → Source library build: configures
- Source library build → 2D/3D public headers: builds
- Source library build → Bundled dependencies: uses
- 2D/3D public headers → Cell, dynamics & lattice: aggregates
- Cell, dynamics & lattice → Descriptors & lattice math: uses kernels
- Descriptors & lattice math → Basic dynamics: implements
- Basic dynamics → Atomic blocks: assigned to
- Atomic blocks → Multi-block domain: compose
- Domain management → Multi-block domain: partitions
- Multi-block domain → Halo exchange & reductions: exchanges halos
- Halo exchange & reductions → MPI runtime: coordinates through
- Multi-block domain → Boundary conditions: applies
- Multi-block domain → Advanced physics: couples
- Off-lattice geometry → Boundary conditions: creates geometry-aware
- Multi-block domain → Initialization & analysis: runs processors
- Multi-block domain → Adaptive multi-grid: refines
- Initialization & analysis → Output & checkpoints: produces results
- Multi-block domain → Output & checkpoints: serializes
- XML input → Bundled dependencies: uses TinyXML
- Jlabos Java bindings → Multi-block domain: wraps
- Scenario executables → 2D/3D public headers: includes
- Scenario executables → Multi-block domain: configures and steps
- Scenario executables → XML input: may load configuration