# mehdiansari-cfd/cfdsolver architecture

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

- Interactive diagram: https://gitdiagram.com/mehdiansari-cfd/cfdsolver
- Repository: https://github.com/mehdiansari-cfd/cfdsolver

## Overview

Euler Laboratory is a browser-based playground for 1D shock tubes, quasi-1D nozzles, and 2D Cartesian Euler flows. Users open a page, select a preset and solver options, run or replay a simulation, and inspect plots or field views against analytical references where available. The numerical solvers are DOM-free; the shared UI handles time-budgeted computation and playback. The README and excerpts support the main solver relationships, but the page source was not sampled, so page-to-UI wiring is shown only where documented.

Main entry points: [`index.html`](https://github.com/mehdiansari-cfd/cfdsolver/blob/main/index.html) (1D lab page), [`nozzle.js`](https://github.com/mehdiansari-cfd/cfdsolver/blob/main/nozzle.js) (Nozzle evolution), [`index2d.html`](https://github.com/mehdiansari-cfd/cfdsolver/blob/main/index2d.html) (2D lab page), [`labui.js`](https://github.com/mehdiansari-cfd/cfdsolver/blob/main/labui.js) (Plots and probes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Browser experience"]
  node_tube_page["1D lab page<br/>[index.html]"]
  node_cart_page["2D lab page<br/>[index2d.html]"]
  node_playback["Solve and playback<br/>[labui.js]"]
  node_plots["Plots and probes<br/>[labui.js]"]
end

subgraph group_tube["Shock tube"]
  node_tube_setup["Tube presets and state<br/>[solver.js]"]
  node_tube_flux["1D fluxes and update<br/>[solver.js]"]
  node_tube_reference["Exact Riemann reference<br/>[solver.js]"]
end

subgraph group_nozzle["Nozzle flow"]
  node_nozzle_setup["Area and nozzle state<br/>[nozzle.js]"]
  node_nozzle_boundaries["Reservoir and exit bounds<br/>[nozzle.js]"]
  node_nozzle_update["Nozzle evolution<br/>[nozzle.js]"]
  node_nozzle_reference["Isentropic reference<br/>[nozzle.js]"]
end

subgraph group_cartesian["2D flow"]
  node_cart_setup["2D presets and state<br/>[solver2d.js]"]
  node_cart_flux["2D fluxes and update<br/>[solver2d.js]"]
  node_cart_fields["Field extraction<br/>[solver2d.js]"]
end

node_learner(("Learner / researcher"))

node_learner -->|"opens 1D lab"| node_tube_page
node_learner -->|"opens 2D lab"| node_cart_page
node_tube_page -.->|"runs simulations"| node_playback
node_cart_page -.->|"runs simulations"| node_playback
node_tube_page -.->|"selects preset"| node_tube_setup
node_tube_page -.->|"selects nozzle"| node_nozzle_setup
node_cart_page -.->|"selects preset"| node_cart_setup
node_playback -.->|"drives views"| node_plots
node_tube_setup -->|"initializes state"| node_tube_flux
node_tube_flux -->|"compares solution"| node_tube_reference
node_nozzle_setup -->|"initializes state"| node_nozzle_update
node_nozzle_update -->|"applies boundaries"| node_nozzle_boundaries
node_nozzle_update -->|"reuses flux update"| node_tube_flux
node_nozzle_update -->|"compares solution"| node_nozzle_reference
node_cart_setup -->|"initializes state"| node_cart_flux
node_cart_flux -->|"extracts fields"| node_cart_fields
node_plots -->|"shows overlay"| node_tube_reference
node_plots -->|"shows theory"| node_nozzle_reference

click node_tube_page "https://github.com/mehdiansari-cfd/cfdsolver/blob/main/index.html"
click node_cart_page "https://github.com/mehdiansari-cfd/cfdsolver/blob/main/index2d.html"
click node_playback "https://github.com/mehdiansari-cfd/cfdsolver/blob/main/labui.js"
click node_plots "https://github.com/mehdiansari-cfd/cfdsolver/blob/main/labui.js"
click node_tube_setup "https://github.com/mehdiansari-cfd/cfdsolver/blob/main/solver.js"
click node_tube_flux "https://github.com/mehdiansari-cfd/cfdsolver/blob/main/solver.js"
click node_tube_reference "https://github.com/mehdiansari-cfd/cfdsolver/blob/main/solver.js"
click node_nozzle_setup "https://github.com/mehdiansari-cfd/cfdsolver/blob/main/nozzle.js"
click node_nozzle_boundaries "https://github.com/mehdiansari-cfd/cfdsolver/blob/main/nozzle.js"
click node_nozzle_update "https://github.com/mehdiansari-cfd/cfdsolver/blob/main/nozzle.js"
click node_nozzle_reference "https://github.com/mehdiansari-cfd/cfdsolver/blob/main/nozzle.js"
click node_cart_setup "https://github.com/mehdiansari-cfd/cfdsolver/blob/main/solver2d.js"
click node_cart_flux "https://github.com/mehdiansari-cfd/cfdsolver/blob/main/solver2d.js"
click node_cart_fields "https://github.com/mehdiansari-cfd/cfdsolver/blob/main/solver2d.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_tube_page,node_cart_page,node_playback,node_plots toneBlue
class node_tube_setup,node_tube_flux,node_tube_reference toneAmber
class node_nozzle_setup,node_nozzle_boundaries,node_nozzle_update,node_nozzle_reference toneMint
class node_cart_setup,node_cart_flux,node_cart_fields toneRose
class node_learner toneIndigo
```

## Components

### Browser experience

- [1D lab page](https://github.com/mehdiansari-cfd/cfdsolver/blob/main/index.html): `index.html`
- [2D lab page](https://github.com/mehdiansari-cfd/cfdsolver/blob/main/index2d.html): `index2d.html`
- [Solve and playback](https://github.com/mehdiansari-cfd/cfdsolver/blob/main/labui.js): `labui.js`
- [Plots and probes](https://github.com/mehdiansari-cfd/cfdsolver/blob/main/labui.js): `labui.js`

### Shock tube

- [Tube presets and state](https://github.com/mehdiansari-cfd/cfdsolver/blob/main/solver.js): `solver.js`
- [1D fluxes and update](https://github.com/mehdiansari-cfd/cfdsolver/blob/main/solver.js): `solver.js`
- [Exact Riemann reference](https://github.com/mehdiansari-cfd/cfdsolver/blob/main/solver.js): `solver.js`

### Nozzle flow

- [Area and nozzle state](https://github.com/mehdiansari-cfd/cfdsolver/blob/main/nozzle.js): `nozzle.js`
- [Reservoir and exit bounds](https://github.com/mehdiansari-cfd/cfdsolver/blob/main/nozzle.js): `nozzle.js`
- [Nozzle evolution](https://github.com/mehdiansari-cfd/cfdsolver/blob/main/nozzle.js): `nozzle.js`
- [Isentropic reference](https://github.com/mehdiansari-cfd/cfdsolver/blob/main/nozzle.js): `nozzle.js`

### 2D flow

- [2D presets and state](https://github.com/mehdiansari-cfd/cfdsolver/blob/main/solver2d.js): `solver2d.js`
- [2D fluxes and update](https://github.com/mehdiansari-cfd/cfdsolver/blob/main/solver2d.js): `solver2d.js`
- [Field extraction](https://github.com/mehdiansari-cfd/cfdsolver/blob/main/solver2d.js): `solver2d.js`

### Other components

- **Learner / researcher**

## Connections

- Learner / researcher → 1D lab page: opens 1D lab (evidence: `README.md`)
- Learner / researcher → 2D lab page: opens 2D lab (evidence: `README.md`)
- 1D lab page → Solve and playback: runs simulations
- 2D lab page → Solve and playback: runs simulations
- 1D lab page → Tube presets and state: selects preset
- 1D lab page → Area and nozzle state: selects nozzle
- 2D lab page → 2D presets and state: selects preset
- Solve and playback → Plots and probes: drives views (evidence: `labui.js`)
- Tube presets and state → 1D fluxes and update: initializes state (evidence: `solver.js`)
- 1D fluxes and update → Exact Riemann reference: compares solution (evidence: `README.md`)
- Area and nozzle state → Nozzle evolution: initializes state (evidence: `nozzle.js`)
- Nozzle evolution → Reservoir and exit bounds: applies boundaries (evidence: `nozzle.js`)
- Nozzle evolution → 1D fluxes and update: reuses flux update (evidence: `nozzle.js`)
- Nozzle evolution → Isentropic reference: compares solution (evidence: `README.md`)
- 2D presets and state → 2D fluxes and update: initializes state (evidence: `solver2d.js`)
- 2D fluxes and update → Field extraction: extracts fields (evidence: `solver2d.js`)
- Plots and probes → Exact Riemann reference: shows overlay (evidence: `README.md`)
- Plots and probes → Isentropic reference: shows theory (evidence: `README.md`)
