# ulton321/fluidbench architecture

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

- Interactive diagram: https://gitdiagram.com/ulton321/fluidbench
- Repository: https://github.com/ulton321/fluidbench

## Overview

FluidBench compares CPU and GPU execution of a shared 2D lattice-Boltzmann workload, with commands for backend discovery, benchmarking, size sweeps, validation, and visualization. Its principal path is CLI request → configuration/backend selection → solver and benchmark execution → reported results. It also includes a separate 3D solver and two browser experiences: a local benchmark dashboard and an independent WebGL flow viewer. Source excerpts establish core solver, backend, CLI, and viewer relationships; unsampled benchmark and server internals are represented conservatively.

Main entry points: [`fluidbench/cli.py`](https://github.com/ulton321/fluidbench/blob/main/fluidbench/cli.py) (CLI commands), [`fluidbench/server.py`](https://github.com/ulton321/fluidbench/blob/main/fluidbench/server.py) (Local dashboard), [`fluidbench/lbm.py`](https://github.com/ulton321/fluidbench/blob/main/fluidbench/lbm.py) (D2Q9 solver), [`fluidbench/web/app.js`](https://github.com/ulton321/fluidbench/blob/main/fluidbench/web/app.js) (Viewer controls)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User interfaces"]
  node_cli["CLI commands<br/>[cli.py]"]
  node_dashboard["Local dashboard<br/>[server.py]"]
end

subgraph group_compute["Simulation compute"]
  node_backend["Array backends<br/>[backends.py]"]
  node_solver2d["D2Q9 solver<br/>[lbm.py]"]
  node_solver3d["D3Q19 solver<br/>[lbm3d.py]"]
end

subgraph group_analysis["Benchmarking"]
  node_benchmark["Benchmark engine<br/>[benchmark.py]"]
  node_renderer["Flow visualization<br/>[visualize.py]"]
end

subgraph group_webview["Browser viewer"]
  node_viewerapp["Viewer controls<br/>[app.js]"]
  node_websolver["WebGL simulation<br/>[lbm-gl.js]"]
end

node_engineer(("Engineer"))
node_browseruser(("Browser user"))

node_engineer -->|"runs commands"| node_cli
node_cli -->|"selects backend"| node_backend
node_cli -->|"configures runs"| node_solver2d
node_cli -->|"runs benchmarks"| node_benchmark
node_cli -->|"renders simulation"| node_renderer
node_cli -->|"starts server"| node_dashboard
node_solver2d -->|"uses array operations"| node_backend
node_solver3d -->|"uses array operations"| node_backend
node_renderer -->|"advances solver"| node_solver2d
node_dashboard -->|"runs shared benchmarks"| node_benchmark
node_browseruser -->|"controls viewer"| node_viewerapp
node_viewerapp -->|"drives simulation"| node_websolver
node_dashboard -.->|"serves browser UI"| node_viewerapp

click node_cli "https://github.com/ulton321/fluidbench/blob/main/fluidbench/cli.py"
click node_dashboard "https://github.com/ulton321/fluidbench/blob/main/fluidbench/server.py"
click node_backend "https://github.com/ulton321/fluidbench/blob/main/fluidbench/backends.py"
click node_solver2d "https://github.com/ulton321/fluidbench/blob/main/fluidbench/lbm.py"
click node_solver3d "https://github.com/ulton321/fluidbench/blob/main/fluidbench/lbm3d.py"
click node_benchmark "https://github.com/ulton321/fluidbench/blob/main/fluidbench/benchmark.py"
click node_renderer "https://github.com/ulton321/fluidbench/blob/main/fluidbench/visualize.py"
click node_viewerapp "https://github.com/ulton321/fluidbench/blob/main/fluidbench/web/app.js"
click node_websolver "https://github.com/ulton321/fluidbench/blob/main/fluidbench/web/lbm-gl.js"

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_cli,node_dashboard,node_browseruser toneBlue
class node_backend,node_solver2d,node_solver3d toneAmber
class node_benchmark,node_renderer toneMint
class node_viewerapp,node_websolver toneRose
class node_engineer toneIndigo
```

## Components

### User interfaces

- [CLI commands](https://github.com/ulton321/fluidbench/blob/main/fluidbench/cli.py): `fluidbench/cli.py`
- [Local dashboard](https://github.com/ulton321/fluidbench/blob/main/fluidbench/server.py): `fluidbench/server.py`

### Simulation compute

- [Array backends](https://github.com/ulton321/fluidbench/blob/main/fluidbench/backends.py): `fluidbench/backends.py`
- [D2Q9 solver](https://github.com/ulton321/fluidbench/blob/main/fluidbench/lbm.py): `fluidbench/lbm.py`
- [D3Q19 solver](https://github.com/ulton321/fluidbench/blob/main/fluidbench/lbm3d.py): `fluidbench/lbm3d.py`

### Benchmarking

- [Benchmark engine](https://github.com/ulton321/fluidbench/blob/main/fluidbench/benchmark.py): `fluidbench/benchmark.py`
- [Flow visualization](https://github.com/ulton321/fluidbench/blob/main/fluidbench/visualize.py): `fluidbench/visualize.py`

### Browser viewer

- [Viewer controls](https://github.com/ulton321/fluidbench/blob/main/fluidbench/web/app.js): `fluidbench/web/app.js`
- [WebGL simulation](https://github.com/ulton321/fluidbench/blob/main/fluidbench/web/lbm-gl.js): `fluidbench/web/lbm-gl.js`

### Other components

- **Engineer**
- **Browser user**

## Connections

- Engineer → CLI commands: runs commands (evidence: `README.md`)
- CLI commands → Array backends: selects backend (evidence: `fluidbench/cli.py`)
- CLI commands → D2Q9 solver: configures runs (evidence: `fluidbench/cli.py`)
- CLI commands → Benchmark engine: runs benchmarks (evidence: `fluidbench/cli.py`)
- CLI commands → Flow visualization: renders simulation (evidence: `fluidbench/cli.py`)
- CLI commands → Local dashboard: starts server (evidence: `fluidbench/cli.py`)
- D2Q9 solver → Array backends: uses array operations (evidence: `fluidbench/lbm.py`)
- D3Q19 solver → Array backends: uses array operations (evidence: `fluidbench/lbm3d.py`)
- Flow visualization → D2Q9 solver: advances solver (evidence: `fluidbench/visualize.py`)
- Local dashboard → Benchmark engine: runs shared benchmarks (evidence: `README.md`)
- Browser user → Viewer controls: controls viewer (evidence: `README.md`)
- Viewer controls → WebGL simulation: drives simulation (evidence: `fluidbench/web/app.js`)
- Local dashboard → Viewer controls: serves browser UI
