# ambystomatechnologies/wind-tunnel-simulator architecture

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

- Interactive diagram: https://gitdiagram.com/ambystomatechnologies/wind-tunnel-simulator
- Repository: https://github.com/ambystomatechnologies/wind-tunnel-simulator

## Overview

This is a browser-based 2D fluid-dynamics and wind-tunnel simulator. Users configure a tunnel, add or sculpt bodies and probes, run either fluid engine, inspect visualizations and aerodynamic telemetry, and optionally save scenes or generate reports. The graph separates UI orchestration, geometry, simulation engines, and presentation/reporting. Scene persistence and several UI capabilities are documented in the README but their implementation details were not sampled, so their internal links are limited.

Main entry points: [`js/canvas.js`](https://github.com/ambystomatechnologies/wind-tunnel-simulator/blob/main/js/canvas.js) (Canvas Controller), [`js/app.js`](https://github.com/ambystomatechnologies/wind-tunnel-simulator/blob/main/js/app.js) (App Controls), [`js/report.js`](https://github.com/ambystomatechnologies/wind-tunnel-simulator/blob/main/js/report.js) (HD Report Export), [`js/physics.js`](https://github.com/ambystomatechnologies/wind-tunnel-simulator/blob/main/js/physics.js) (Navier-Stokes Solver)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["User Interface"]
  node_app["App Controls<br/>[app.js]"]
  node_language["Bilingual UI<br/>[i18n.js]"]
  node_scene["Scene Save and Load<br/>[app.js]"]
end

subgraph group_geometry["Geometry and Sensors"]
  node_shapes["Bodies and NACA<br/>[elements.js]"]
  node_probes["Flow Probes<br/>[elements.js]"]
  node_image_import["Image Contours<br/>[elements.js]"]
end

subgraph group_simulation["Simulation Engines"]
  node_navier_stokes["Navier-Stokes Solver<br/>[physics.js]"]
  node_lbm["Lattice Boltzmann<br/>[lbm.js]"]
  node_telemetry["Aerodynamic Telemetry<br/>[physics.js]"]
end

subgraph group_presentation["Visualization and Reporting"]
  node_canvas["Canvas Controller<br/>[canvas.js]"]
  node_visualizations["Flow Visualizations<br/>[canvas.js]"]
  node_report["HD Report Export<br/>[report.js]"]
end

node_engineer(("Simulator User"))
node_download["Downloaded Files"]

node_engineer -->|"uses controls"| node_app
node_app -->|"creates controller"| node_canvas
node_app -->|"sets flow regime"| node_navier_stokes
node_app -->|"creates bodies"| node_shapes
node_app -.->|"switches language"| node_language
node_app -.->|"saves and loads"| node_scene
node_canvas -->|"initializes solver"| node_navier_stokes
node_canvas -->|"initializes engine"| node_lbm
node_canvas -->|"creates obstacles"| node_shapes
node_canvas -->|"creates probes"| node_probes
node_canvas -->|"renders flow"| node_visualizations
node_engineer -->|"imports image"| node_image_import
node_engineer -->|"requests report"| node_report
node_report -->|"renders frame"| node_canvas
node_report -.->|"reads telemetry"| node_navier_stokes
node_report -->|"exports PNG"| node_download
node_engineer -->|"selects view"| node_visualizations

click node_app "https://github.com/ambystomatechnologies/wind-tunnel-simulator/blob/main/js/app.js"
click node_language "https://github.com/ambystomatechnologies/wind-tunnel-simulator/blob/main/js/i18n.js"
click node_shapes "https://github.com/ambystomatechnologies/wind-tunnel-simulator/blob/main/js/elements.js"
click node_probes "https://github.com/ambystomatechnologies/wind-tunnel-simulator/blob/main/js/elements.js"
click node_image_import "https://github.com/ambystomatechnologies/wind-tunnel-simulator/blob/main/js/elements.js"
click node_canvas "https://github.com/ambystomatechnologies/wind-tunnel-simulator/blob/main/js/canvas.js"
click node_navier_stokes "https://github.com/ambystomatechnologies/wind-tunnel-simulator/blob/main/js/physics.js"
click node_lbm "https://github.com/ambystomatechnologies/wind-tunnel-simulator/blob/main/js/lbm.js"
click node_scene "https://github.com/ambystomatechnologies/wind-tunnel-simulator/blob/main/js/app.js"
click node_visualizations "https://github.com/ambystomatechnologies/wind-tunnel-simulator/blob/main/js/canvas.js"
click node_telemetry "https://github.com/ambystomatechnologies/wind-tunnel-simulator/blob/main/js/physics.js"
click node_report "https://github.com/ambystomatechnologies/wind-tunnel-simulator/blob/main/js/report.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_app,node_language,node_scene,node_engineer toneBlue
class node_shapes,node_probes,node_image_import toneAmber
class node_navier_stokes,node_lbm,node_telemetry toneMint
class node_canvas,node_visualizations,node_report toneRose
class node_download toneIndigo
```

## Components

### User Interface

- [App Controls](https://github.com/ambystomatechnologies/wind-tunnel-simulator/blob/main/js/app.js): `js/app.js`
- [Bilingual UI](https://github.com/ambystomatechnologies/wind-tunnel-simulator/blob/main/js/i18n.js): `js/i18n.js`
- [Scene Save and Load](https://github.com/ambystomatechnologies/wind-tunnel-simulator/blob/main/js/app.js): `js/app.js`

### Geometry and Sensors

- [Bodies and NACA](https://github.com/ambystomatechnologies/wind-tunnel-simulator/blob/main/js/elements.js): `js/elements.js`
- [Flow Probes](https://github.com/ambystomatechnologies/wind-tunnel-simulator/blob/main/js/elements.js): `js/elements.js`
- [Image Contours](https://github.com/ambystomatechnologies/wind-tunnel-simulator/blob/main/js/elements.js): `js/elements.js`

### Simulation Engines

- [Navier-Stokes Solver](https://github.com/ambystomatechnologies/wind-tunnel-simulator/blob/main/js/physics.js): `js/physics.js`
- [Lattice Boltzmann](https://github.com/ambystomatechnologies/wind-tunnel-simulator/blob/main/js/lbm.js): `js/lbm.js`
- [Aerodynamic Telemetry](https://github.com/ambystomatechnologies/wind-tunnel-simulator/blob/main/js/physics.js): `js/physics.js`

### Visualization and Reporting

- [Canvas Controller](https://github.com/ambystomatechnologies/wind-tunnel-simulator/blob/main/js/canvas.js): `js/canvas.js`
- [Flow Visualizations](https://github.com/ambystomatechnologies/wind-tunnel-simulator/blob/main/js/canvas.js): `js/canvas.js`
- [HD Report Export](https://github.com/ambystomatechnologies/wind-tunnel-simulator/blob/main/js/report.js): `js/report.js`

### Other components

- **Simulator User**
- **Downloaded Files**

## Connections

- Simulator User → App Controls: uses controls (evidence: `README.md`)
- App Controls → Canvas Controller: creates controller (evidence: `js/app.js`)
- App Controls → Navier-Stokes Solver: sets flow regime (evidence: `js/app.js`)
- App Controls → Bodies and NACA: creates bodies (evidence: `js/app.js`)
- App Controls → Bilingual UI: switches language
- App Controls → Scene Save and Load: saves and loads (evidence: `js/app.js`)
- Canvas Controller → Navier-Stokes Solver: initializes solver (evidence: `js/canvas.js`)
- Canvas Controller → Lattice Boltzmann: initializes engine (evidence: `js/canvas.js`)
- Canvas Controller → Bodies and NACA: creates obstacles (evidence: `js/canvas.js`)
- Canvas Controller → Flow Probes: creates probes (evidence: `js/canvas.js`)
- Canvas Controller → Flow Visualizations: renders flow (evidence: `js/canvas.js`)
- Simulator User → Image Contours: imports image (evidence: `README.md`)
- Simulator User → HD Report Export: requests report (evidence: `README.md`)
- HD Report Export → Canvas Controller: renders frame (evidence: `js/report.js`)
- HD Report Export → Navier-Stokes Solver: reads telemetry
- HD Report Export → Downloaded Files: exports PNG (evidence: `js/report.js`)
- Simulator User → Flow Visualizations: selects view (evidence: `README.md`)
