# paulinotech1/cfd-simulator architecture

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

- Interactive diagram: https://gitdiagram.com/paulinotech1/cfd-simulator
- Repository: https://github.com/paulinotech1/cfd-simulator

## Overview

Karman is a browser-based 2D incompressible-flow bench: users choose a scene, run and interact with the simulation, then inspect rendered fields and statistics. The README identifies the browser solver as the reference implementation and lists seven presets; it also describes hardware/kernel information in the UI, but the referenced kernel source files are not in the supplied tree. The UI implementation is likewise absent, so its internal behavior is not expanded beyond the route-to-bench reference. Connections are limited to documented or indexed relationships.

Main entry points: [`src/cfd/solver.ts`](https://github.com/paulinotech1/cfd-simulator/blob/main/src/cfd/solver.ts) (Flow solver), [`src/components/bench.tsx`](https://github.com/paulinotech1/cfd-simulator/blob/main/src/components/bench.tsx) (Interactive bench), [`src/cfd/render.ts`](https://github.com/paulinotech1/cfd-simulator/blob/main/src/cfd/render.ts) (Field renderer), [`src/routes/index.tsx`](https://github.com/paulinotech1/cfd-simulator/blob/main/src/routes/index.tsx) (Home route)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Web bench"]
  node_route["Home route<br/>[index.tsx]"]
  node_bench["Interactive bench<br/>[bench.tsx]"]
end

subgraph group_simulation["CFD simulation"]
  node_presets["Scene presets<br/>[presets.ts]"]
  node_solver["Flow solver<br/>[solver.ts]"]
  node_render["Field renderer<br/>[render.ts]"]
  node_colormap["Color mapping<br/>[colormap.ts]"]
  node_types["Simulation types<br/>[types.ts]"]
end

node_user(("Bench user"))

node_user -->|"opens bench"| node_route
node_route -->|"renders"| node_bench
node_bench -.->|"selects scenes"| node_presets
node_bench -.->|"runs simulation"| node_solver
node_solver -.->|"produces fields"| node_render
node_render -->|"uses colors"| node_colormap
node_presets -->|"uses types"| node_types
node_solver -->|"uses types"| node_types
node_render -->|"reads simulation"| node_solver

click node_route "https://github.com/paulinotech1/cfd-simulator/blob/main/src/routes/index.tsx"
click node_bench "https://github.com/paulinotech1/cfd-simulator/blob/main/src/components/bench.tsx"
click node_presets "https://github.com/paulinotech1/cfd-simulator/blob/main/src/cfd/presets.ts"
click node_solver "https://github.com/paulinotech1/cfd-simulator/blob/main/src/cfd/solver.ts"
click node_render "https://github.com/paulinotech1/cfd-simulator/blob/main/src/cfd/render.ts"
click node_colormap "https://github.com/paulinotech1/cfd-simulator/blob/main/src/cfd/colormap.ts"
click node_types "https://github.com/paulinotech1/cfd-simulator/blob/main/src/cfd/types.ts"

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_route,node_bench,node_user toneBlue
class node_presets,node_solver,node_render,node_colormap,node_types toneAmber
```

## Components

### Web bench

- [Home route](https://github.com/paulinotech1/cfd-simulator/blob/main/src/routes/index.tsx): `src/routes/index.tsx`
- [Interactive bench](https://github.com/paulinotech1/cfd-simulator/blob/main/src/components/bench.tsx): `src/components/bench.tsx`

### CFD simulation

- [Scene presets](https://github.com/paulinotech1/cfd-simulator/blob/main/src/cfd/presets.ts): `src/cfd/presets.ts`
- [Flow solver](https://github.com/paulinotech1/cfd-simulator/blob/main/src/cfd/solver.ts): `src/cfd/solver.ts`
- [Field renderer](https://github.com/paulinotech1/cfd-simulator/blob/main/src/cfd/render.ts): `src/cfd/render.ts`
- [Color mapping](https://github.com/paulinotech1/cfd-simulator/blob/main/src/cfd/colormap.ts): `src/cfd/colormap.ts`
- [Simulation types](https://github.com/paulinotech1/cfd-simulator/blob/main/src/cfd/types.ts): `src/cfd/types.ts`

### Other components

- **Bench user**

## Connections

- Bench user → Home route: opens bench (evidence: `src/routes/index.tsx`)
- Home route → Interactive bench: renders (evidence: `src/routes/index.tsx`)
- Interactive bench → Scene presets: selects scenes
- Interactive bench → Flow solver: runs simulation
- Flow solver → Field renderer: produces fields (evidence: `src/cfd/render.ts`)
- Field renderer → Color mapping: uses colors (evidence: `src/cfd/render.ts`)
- Scene presets → Simulation types: uses types (evidence: `src/cfd/presets.ts`)
- Flow solver → Simulation types: uses types (evidence: `src/cfd/solver.ts`)
- Field renderer → Flow solver: reads simulation (evidence: `src/cfd/render.ts`)
