# irmb/virtualfluids architecture

> Architecture diagram of the GitHub repository irmb/virtualfluids, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/irmb/virtualfluids
- Repository: https://github.com/irmb/virtualfluids

## Overview

VirtualFluids is a research CFD solver using the lattice Boltzmann method for turbulent and multicomponent flows, with distributed pre- and postprocessing for very large simulations. A user configures a case through an application; the application sets up a domain and simulation, the CPU or GPU solver advances the flow, and observers or output components produce results. The README documents broad capabilities, while sampled source gives only a partial view of runtime wiring; links without direct source evidence are therefore limited to documented relationships.

Main entry points: [`src/gpu/core/Calculation/Calculation.h`](https://github.com/irmb/virtualfluids/blob/main/src/gpu/core/Calculation/Calculation.h) (GPU calculation), [`apps/gpu/ResearchCrossingNeighbourhoodGpu/ResearchCrossingNeighbourhoodGpu.cpp`](https://github.com/irmb/virtualfluids/blob/main/apps/gpu/ResearchCrossingNeighbourhoodGpu/ResearchCrossingNeighbourhoodGpu.cpp) (GPU applications), [`src/cpu/core/Simulation/Block3D.h`](https://github.com/irmb/virtualfluids/blob/main/src/cpu/core/Simulation/Block3D.h) (CPU blocks), [`src/cpu/core/SimulationObservers/AverageValuesSimulationObserver.cpp`](https://github.com/irmb/virtualfluids/blob/main/src/cpu/core/SimulationObservers/AverageValuesSimulationObserver.cpp) (Simulation observers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_setup["Case setup"]
  node_cpu_app["CPU applications"]
  node_gpu_app["GPU applications"]
  node_grid["Grid generation"]
end

subgraph group_solver["LBM solver"]
  node_cpu_grid["CPU grid<br/>[Grid3D.h]"]
  node_cpu_blocks["CPU blocks<br/>[Block3D.h]"]
  node_cpu_lbm["CPU LBM<br/>[LBMKernel.h]"]
  node_gpu_calculation["GPU calculation<br/>[Calculation.h]"]
  node_gpu_parameters["GPU parameters<br/>[Parameter.h]"]
  node_gpu_memory["GPU memory"]
  node_gpu_boundary["GPU boundaries"]
  node_gpu_scaling["Grid scaling"]
  node_gpu_turbulence["Turbulence models"]
end

subgraph group_parallel["Distributed execution"]
  node_mpi["MPI communication"]
  node_preprocess["Distributed preprocessing"]
end

subgraph group_results["Analysis and output"]
  node_observers["Simulation observers"]
  node_time_averages["Time averages"]
  node_vtk["VTK output"]
  node_postprocess["Distributed postprocessing"]
end

node_user(("Research user"))

node_user -.->|"configures case"| node_cpu_app
node_user -.->|"configures case"| node_gpu_app
node_cpu_app -.->|"sets up simulation"| node_cpu_grid
node_gpu_app -->|"builds domain"| node_grid
node_gpu_app -->|"configures simulation"| node_gpu_calculation
node_cpu_grid -.->|"organizes blocks"| node_cpu_blocks
node_cpu_blocks -->|"provides kernels"| node_cpu_lbm
node_gpu_calculation -.->|"uses state"| node_gpu_parameters
node_gpu_calculation -.->|"manages device data"| node_gpu_memory
node_gpu_calculation -.->|"applies boundaries"| node_gpu_boundary
node_gpu_calculation -.->|"scales grid"| node_gpu_scaling
node_gpu_calculation -.->|"selects models"| node_gpu_turbulence
node_preprocess -.->|"prepares domain"| node_grid
node_cpu_lbm -.->|"distributes execution"| node_mpi
node_observers -->|"reads simulation data"| node_cpu_blocks
node_time_averages -.->|"writes averages"| node_vtk
node_observers -.->|"writes results"| node_vtk
node_mpi -.->|"supports distributed results"| node_postprocess

click node_cpu_app "https://github.com/irmb/virtualfluids/tree/main/apps/cpu"
click node_gpu_app "https://github.com/irmb/virtualfluids/blob/main/apps/gpu/ResearchCrossingNeighbourhoodGpu/ResearchCrossingNeighbourhoodGpu.cpp"
click node_grid "https://github.com/irmb/virtualfluids/tree/main/src/gpu/GridGenerator"
click node_cpu_grid "https://github.com/irmb/virtualfluids/blob/main/src/cpu/core/Simulation/Grid3D.h"
click node_cpu_blocks "https://github.com/irmb/virtualfluids/blob/main/src/cpu/core/Simulation/Block3D.h"
click node_cpu_lbm "https://github.com/irmb/virtualfluids/blob/main/src/cpu/core/LBM/LBMKernel.h"
click node_gpu_calculation "https://github.com/irmb/virtualfluids/blob/main/src/gpu/core/Calculation/Calculation.h"
click node_gpu_parameters "https://github.com/irmb/virtualfluids/blob/main/src/gpu/core/Parameter/Parameter.h"
click node_gpu_memory "https://github.com/irmb/virtualfluids/blob/main/src/gpu/core/Cuda/CudaMemoryManager.cpp"
click node_gpu_boundary "https://github.com/irmb/virtualfluids/blob/main/src/gpu/core/BoundaryConditions/BoundaryConditionKernelManager.cpp"
click node_gpu_scaling "https://github.com/irmb/virtualfluids/blob/main/src/gpu/core/GridScaling/GridScalingKernelManager.cpp"
click node_gpu_turbulence "https://github.com/irmb/virtualfluids/blob/main/src/gpu/core/TurbulenceModels/TurbulenceModelManager.cpp"
click node_mpi "https://github.com/irmb/virtualfluids/blob/main/src/parallel/MPICommunicator.cpp"
click node_preprocess "https://github.com/irmb/virtualfluids/tree/main/src/gpu/GridGenerator"
click node_observers "https://github.com/irmb/virtualfluids/blob/main/src/cpu/core/SimulationObservers/AverageValuesSimulationObserver.cpp"
click node_time_averages "https://github.com/irmb/virtualfluids/blob/main/src/cpu/core/SimulationObservers/TimeAveragedValuesSimulationObserver.cpp"
click node_vtk "https://github.com/irmb/virtualfluids/blob/main/src/basics/writer/WbWriterVtkXmlASCII.h"
click node_postprocess "https://github.com/irmb/virtualfluids/tree/main/Python"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cpu_app,node_gpu_app,node_grid,node_user toneBlue
class node_cpu_grid,node_cpu_blocks,node_cpu_lbm,node_gpu_calculation,node_gpu_parameters,node_gpu_memory,node_gpu_boundary,node_gpu_scaling,node_gpu_turbulence toneAmber
class node_mpi,node_preprocess toneMint
class node_observers,node_time_averages,node_vtk,node_postprocess toneRose
```

## Components

### Case setup

- [CPU applications](https://github.com/irmb/virtualfluids/tree/main/apps/cpu): `apps/cpu`
- [GPU applications](https://github.com/irmb/virtualfluids/blob/main/apps/gpu/ResearchCrossingNeighbourhoodGpu/ResearchCrossingNeighbourhoodGpu.cpp): `apps/gpu/ResearchCrossingNeighbourhoodGpu/ResearchCrossingNeighbourhoodGpu.cpp`
- [Grid generation](https://github.com/irmb/virtualfluids/tree/main/src/gpu/GridGenerator): `src/gpu/GridGenerator`

### LBM solver

- [CPU grid](https://github.com/irmb/virtualfluids/blob/main/src/cpu/core/Simulation/Grid3D.h): `src/cpu/core/Simulation/Grid3D.h`
- [CPU blocks](https://github.com/irmb/virtualfluids/blob/main/src/cpu/core/Simulation/Block3D.h): `src/cpu/core/Simulation/Block3D.h`
- [CPU LBM](https://github.com/irmb/virtualfluids/blob/main/src/cpu/core/LBM/LBMKernel.h): `src/cpu/core/LBM/LBMKernel.h`
- [GPU calculation](https://github.com/irmb/virtualfluids/blob/main/src/gpu/core/Calculation/Calculation.h): `src/gpu/core/Calculation/Calculation.h`
- [GPU parameters](https://github.com/irmb/virtualfluids/blob/main/src/gpu/core/Parameter/Parameter.h): `src/gpu/core/Parameter/Parameter.h`
- [GPU memory](https://github.com/irmb/virtualfluids/blob/main/src/gpu/core/Cuda/CudaMemoryManager.cpp): `src/gpu/core/Cuda/CudaMemoryManager.cpp`
- [GPU boundaries](https://github.com/irmb/virtualfluids/blob/main/src/gpu/core/BoundaryConditions/BoundaryConditionKernelManager.cpp): `src/gpu/core/BoundaryConditions/BoundaryConditionKernelManager.cpp`
- [Grid scaling](https://github.com/irmb/virtualfluids/blob/main/src/gpu/core/GridScaling/GridScalingKernelManager.cpp): `src/gpu/core/GridScaling/GridScalingKernelManager.cpp`
- [Turbulence models](https://github.com/irmb/virtualfluids/blob/main/src/gpu/core/TurbulenceModels/TurbulenceModelManager.cpp): `src/gpu/core/TurbulenceModels/TurbulenceModelManager.cpp`

### Distributed execution

- [MPI communication](https://github.com/irmb/virtualfluids/blob/main/src/parallel/MPICommunicator.cpp): `src/parallel/MPICommunicator.cpp`
- [Distributed preprocessing](https://github.com/irmb/virtualfluids/tree/main/src/gpu/GridGenerator): `src/gpu/GridGenerator`

### Analysis and output

- [Simulation observers](https://github.com/irmb/virtualfluids/blob/main/src/cpu/core/SimulationObservers/AverageValuesSimulationObserver.cpp): `src/cpu/core/SimulationObservers/AverageValuesSimulationObserver.cpp`
- [Time averages](https://github.com/irmb/virtualfluids/blob/main/src/cpu/core/SimulationObservers/TimeAveragedValuesSimulationObserver.cpp): `src/cpu/core/SimulationObservers/TimeAveragedValuesSimulationObserver.cpp`
- [VTK output](https://github.com/irmb/virtualfluids/blob/main/src/basics/writer/WbWriterVtkXmlASCII.h): `src/basics/writer/WbWriterVtkXmlASCII.h`
- [Distributed postprocessing](https://github.com/irmb/virtualfluids/tree/main/Python): `Python`

### Other components

- **Research user**

## Connections

- Research user → CPU applications: configures case (evidence: `README.md`)
- Research user → GPU applications: configures case (evidence: `README.md`)
- CPU applications → CPU grid: sets up simulation (evidence: `README.md`)
- GPU applications → Grid generation: builds domain (evidence: `apps/gpu/ResearchCrossingNeighbourhoodGpu/ResearchCrossingNeighbourhoodGpu.cpp`)
- GPU applications → GPU calculation: configures simulation (evidence: `apps/gpu/ResearchCrossingNeighbourhoodGpu/ResearchCrossingNeighbourhoodGpu.cpp`)
- CPU grid → CPU blocks: organizes blocks (evidence: `src/cpu/core/Simulation/Block3D.h`)
- CPU blocks → CPU LBM: provides kernels (evidence: `src/cpu/core/SimulationObservers/AverageValuesSimulationObserver.cpp`)
- GPU calculation → GPU parameters: uses state (evidence: `src/gpu/core/Parameter/Parameter.h`)
- GPU calculation → GPU memory: manages device data (evidence: `src/gpu/core/Cuda/CudaMemoryManager.cpp`)
- GPU calculation → GPU boundaries: applies boundaries (evidence: `src/gpu/core/BoundaryConditions/BoundaryConditionKernelManager.cpp`)
- GPU calculation → Grid scaling: scales grid (evidence: `src/gpu/core/GridScaling/GridScalingKernelManager.cpp`)
- GPU calculation → Turbulence models: selects models (evidence: `src/gpu/core/TurbulenceModels/TurbulenceModelManager.cpp`)
- Distributed preprocessing → Grid generation: prepares domain (evidence: `README.md`)
- CPU LBM → MPI communication: distributes execution (evidence: `README.md`)
- Simulation observers → CPU blocks: reads simulation data (evidence: `src/cpu/core/SimulationObservers/AverageValuesSimulationObserver.cpp`)
- Time averages → VTK output: writes averages (evidence: `src/cpu/core/SimulationObservers/TimeAveragedValuesSimulationObserver.cpp`)
- Simulation observers → VTK output: writes results (evidence: `src/cpu/core/SimulationObservers/AverageValuesSimulationObserver.cpp`)
- MPI communication → Distributed postprocessing: supports distributed results (evidence: `README.md`)
