How flexi-framework/galaexi works
1. Overall shape
This repository is a high-order CFD framework built around a main solver plus a separate postprocessing suite. The code is organized for HPC execution with MPI and GPU offload, and the primary runtime artifact is the galaexi executable built from src/.
2. Core simulation engine (src/)
src/ contains the production solver: mesh handling, interpolation, DGSEM operators, finite-volume fallback/blending, physics equations, time integration, output, restart, filtering, and analysis. The architecture is modular, with most physics- and method-specific behavior isolated in subdirectories rather than hard-coded into one main loop.
3. Discretization layer
The numerical core is DGSEM on hexahedral meshes. The DG machinery is split into volume/surface integration, lifting, overintegration, basis changes, Jacobian application, and mortar interfaces. This indicates the solver is built to handle high-order curved/unstructured elements and nonconforming interfaces.
4. Physics models
Equation families are separated under src/equations/: linear scalar advection, Navier–Stokes, and RANS-SA. Each has its own fluxes, Jacobians, Riemann solvers, timestep calculation, exact solutions, and boundary treatments. Navier–Stokes also includes ideal-gas thermodynamics and optional eddy-viscosity models such as Smagorinsky, Vreman, and sigma.
5. Numerics safety and shock handling
The solver includes a finite-volume subsystem in src/fv/ plus indicator and limiter/filter code. That tells you the DG method can locally switch to or blend with FV treatment for robustness on under-resolved or discontinuous flows, rather than relying purely on one discretization.
6. Time stepping, implicit support, and preconditioning
src/timedisc/ implements the time discretization framework. There is also src/implicit/ and src/precond/, including sparse ILU and Jacobian-based preconditioner code. So the solver supports both explicit and more advanced implicit/preconditioned workflows, which is important for stiff flows and convergence acceleration.
7. Mesh, geometry, and parallel runtime
Mesh reading and metrics are handled in src/mesh/, while MPI wrappers live in src/mpi/. The globals/ area contains shared runtime utilities, GPU hooks, command-line handling, math/vector helpers, and preprocessing support. The code is structured to run distributed across ranks and to offload compute-heavy parts to NVIDIA GPUs.
8. I/O and persistence
HDF5 is the main data exchange format through src/io_hdf5/. The solver writes state, restart, and derived outputs, and can also emit VTK-style visualization data. That makes HDF5 the primary simulation storage boundary, with output and restart files serving as the handoff between solver runs and downstream analysis.
9. Postprocessing suite (posti/)
posti/ is a separate set of Fortran executables for analysis and data transformation, not part of the main simulation loop. It includes tools such as averaging, FFT-based channel analysis, DMD, record-point preparation/visualization/evaluation, mesh swapping, conversion to 3D or DG formats, visualization readers, and wall-distance processing. The presence of a ParaView plugin under posti/visu/paraviewReader/ shows that visualization is a first-class postprocessing concern.
10. Workflow boundary: simulation vs analysis
A typical data flow is: parameter files and meshes from tutorials/ or ini/ feed the solver, the solver produces HDF5 state/restart/output files, and posti/ or external scripts consume those files for analysis and visualization. This cleanly separates runtime simulation from offline postprocessing and keeps the solver core focused on PDE execution.
11. Tutorials and input cases
tutorials/ and ini/ contain curated cases, meshes, and parameter files for canonical flows such as freestream, cavity, NACA0012, Taylor–Green vortex, Sod, cylinder, flat plate, channel flow, and linear advection. These are not just examples; they define the expected operational workflows and file layouts for preprocessing, simulation, and postprocessing.
12. Regression and unit testing
regressioncheck/ holds end-to-end reference cases with input decks, meshes, and golden outputs, covering solver variants like Riemann solvers, FV blending, preconditioning, turbulence cases, and time discretization. unitTests/ covers numerical kernels such as basis transforms, derivative matrices, prolongation, surface integration, and read-in tools. Together they validate both low-level math and full application behavior.
13. Build and integration
The project is CMake-based, with separate top-level CMake files for the core library/executable and the postprocessing tools. That suggests the repository produces multiple binaries from shared source, rather than a single application. CI and githooks are present, reinforcing that builds and regression runs are part of the repo’s expected workflow.
14. External dependencies that matter architecturally
The runtime model depends materially on MPI, HDF5, LAPACK, FFTW, CUDA, and NVIDIA HPC Fortran. MPI governs distributed decomposition, HDF5 governs persistent simulation data, FFTW supports spectral analysis in postprocessing, and CUDA/NVHPC define the accelerator execution boundary.
Main entry points: flexi.f90 Solver core · equation.f90 Physics models · CMakeLists.txt Posti suite · unittest.f90 Unit tests
Components 21
Build & packages
CMake-based build and packaging/integration files
- CMake · Top-level build configuration for solver and tools
CMakeLists.txt
Main solver
Production CFD runtime in src/
- Solver core · Main galaexi simulation executable and library entry points
src/flexi.f90 - Runtime infra · MPI, GPU, command-line, math, and preprocessing utilities
src/globals/globals.f90 - Mesh & metrics · Mesh reading, geometry preparation, and metric terms
src/mesh/mesh.f90 - Basis tools · Basis changes, prolongation, Jacobians, and interpolation support
src/interpolation/interpolation.f90 - DGSEM core · Volume/surface integration, lifting, overintegration, and flux assembly
src/dg/dg.f90 - Mortar interfaces · Nonconforming interface handling and mortar metrics
src/mortar/mortar.f90 - FV fallback · Finite-volume reconstruction, switching, blending, and limiter path
src/fv/fv.f90 - Time stepping · Explicit/implicit time discretization driver and timestep control
src/timedisc/timedisc.f90 - Implicit solve · Implicit predictor and residual coupling support
src/implicit/implicit.f90 - Preconditioners · Jacobian-based and sparse ILU preconditioning
src/precond/precond.f90 - HDF5 I/O · State, restart, and output exchange through HDF5
src/io_hdf5/io_hdf5.f90 - Physics models · Equation-specific fluxes, Riemann solvers, boundaries, and diagnostics
src/equations/navierstokes/equation.f90 - Linear advection · Scalar advection equation family and exact solutions
src/equations/linearscalaradvection/equation.f90 - Navier–Stokes · Compressible flow model with thermodynamics and eddy viscosity options
src/equations/navierstokes/equation.f90 - RANS-SA · Turbulence-aware Spalart–Allmaras equation family
src/equations/rans_sa/equation.f90
Postprocessing
Separate Fortran analysis and visualization tools
- Posti suite · Standalone Fortran postprocessing and transformation tools
posti/CMakeLists.txt - Visu plugin · ParaView reader and visualization bridge
posti/visu/paraviewReader/Reader/visuReader.cxx
Cases & docs
Tutorials, ini inputs, and repository documentation
- Tutorial cases · Curated meshes and parameter files for canonical workflows
tutorials/freestream/parameter_flexi.ini
Quality assurance
Regression and unit-test coverage
- Regression suite · End-to-end reference cases and golden outputs
regressioncheck/checks/run_basic/freestream_3D/parameter.ini - Unit tests · Low-level numerical and input parsing checks
unitTests/unittest.f90
Connections 25
- CMake → Solver core: builds · Configures the main solver targets
- CMake → Posti suite: builds · Configures postprocessing executables
- Solver core → Runtime infra: uses · Shares runtime services and preprocessing
- Solver core → Mesh & metrics: depends on · Loads and prepares computational meshes
- Solver core → Basis tools: uses · Transforms bases and prolongs data
- Solver core → DGSEM core: advances with · Applies DGSEM operators each step
- Solver core → Mortar interfaces: couples via · Handles nonconforming interfaces
- Solver core → FV fallback: falls back to · Switches or blends to FV for robustness
- Solver core → Time stepping: orchestrates · Coordinates the time-integration loop
- Time stepping → Implicit solve: optionally uses · Activates implicit workflow when needed
- Implicit solve → Preconditioners: accelerates with · Uses preconditioners for stiff solves
- Solver core → HDF5 I/O: reads/writes · Persists state, restart, and outputs
- Solver core → Physics models: instantiates · Selects a physics family at runtime
- Physics models → Linear advection: includes · Scalar advection specialization
- Physics models → Navier–Stokes: includes · Compressible flow specialization
- Physics models → RANS-SA: includes · Turbulence model specialization
- Navier–Stokes → FV fallback: supports · FV path is important for shocks and under-resolution
- Posti suite → HDF5 I/O: consumes · Reads solver HDF5 state and restart files
- Posti suite → Visu plugin: extends · Provides ParaView visualization integration
- Tutorial cases → Solver core: drives · Supplies canonical solver inputs and meshes
- Regression suite → Solver core: verifies · Exercises full solver workflows
- Regression suite → Posti suite: verifies · Checks postprocessing outputs and transforms
- Unit tests → Basis tools: checks · Validates basis and prolongation kernels
- Unit tests → DGSEM core: checks · Validates surface and volume integration kernels
- Unit tests → Runtime infra: checks · Covers input and utility helpers