# ihmegroup/stanshock architecture

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

- Interactive diagram: https://gitdiagram.com/ihmegroup/stanshock
- Repository: https://github.com/ihmegroup/stanshock

## Overview

StanShock is a quasi-1D gas-dynamics solver for shock-tube experiments and scramjet engines, with a separate method-of-characteristics inlet-design package in the same source tree. The principal workflow is to define a flow geometry and initial state, configure gas physics and numerical methods, run the solver, then inspect or export results. The inlet package separately builds characteristic nets and solves shock interactions. README-level capabilities are included, but wiring between unsampled solver modules is intentionally limited.

Main entry points: [`src/stanshock/system/base.py`](https://github.com/ihmegroup/stanshock/blob/develop/src/stanshock/system/base.py) (Simulation system), [`src/inlet_moc/char_net.py`](https://github.com/ihmegroup/stanshock/blob/develop/src/inlet_moc/char_net.py) (Characteristic net), [`src/stanshock/system/geometry.py`](https://github.com/ihmegroup/stanshock/blob/develop/src/stanshock/system/geometry.py) (Geometry), [`src/inlet_moc/shock_solvers/net_shock.py`](https://github.com/ihmegroup/stanshock/blob/develop/src/inlet_moc/shock_solvers/net_shock.py) (Shock solver)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_setup["Flow setup"]
  node_geometry["Geometry<br/>[geometry.py]"]
  node_initialization["Initial conditions<br/>[initialize.py]"]
end

subgraph group_solver["Quasi-1D solver"]
  node_fluid["Fluid state<br/>[fluid_base.py]"]
  node_thermo["Thermo models<br/>[thermotable.py]"]
  node_chemistry["Chemistry"]
  node_numerics["Numerical methods<br/>[inviscid_flux.py]"]
  node_face["Face averaging<br/>[face_average.py]"]
  node_boundary["Boundary conditions"]
  node_integration["Time integration"]
  node_runner["Simulation system<br/>[base.py]"]
  node_models["Flow models<br/>[area_change.py]"]
  node_boundary_layer["Boundary layer<br/>[boundary_layer.py]"]
  node_jicf["Fuel injection<br/>[jicf.py]"]
end

subgraph group_analysis["Results and components"]
  node_shocktube["Shock tube<br/>[shocktube.py]"]
  node_combustor["Combustor<br/>[combustor.py]"]
  node_probe["Probes<br/>[probe.py]"]
  node_output["Output and plots<br/>[csv_writer.py]"]
end

subgraph group_inlet["MOC inlet design"]
  node_planar["Planar inlet<br/>[planar_inlet.py]"]
  node_net["Characteristic net<br/>[char_net.py]"]
  node_shock_solver["Shock solver<br/>[net_shock.py]"]
  node_shock_plot["Shock visualization<br/>[net_shock.py]"]
  node_postprocess["MOC processing<br/>[_processing.py]"]
end

node_engineer(("Engineer"))
node_inlet_user(("Inlet designer"))

node_engineer -->|"defines flow path"| node_geometry
node_engineer -->|"sets initial state"| node_initialization
node_geometry -->|"provides mesh"| node_initialization
node_initialization -->|"initializes"| node_runner
node_geometry -->|"configures domain"| node_runner
node_fluid -->|"thermodynamic properties"| node_thermo
node_runner -->|"advances state"| node_integration
node_numerics -->|"averages face states"| node_face
node_boundary -->|"constrains flow"| node_runner
node_chemistry -->|"adds source terms"| node_runner
node_models -->|"models area effects"| node_runner
node_boundary_layer -->|"models wall effects"| node_runner
node_jicf -->|"models injection"| node_runner
node_shocktube -->|"configures experiment"| node_runner
node_combustor -->|"models combustor"| node_runner
node_probe -->|"samples flow"| node_runner
node_output -->|"exports results"| node_runner
node_inlet_user -->|"defines inlet"| node_planar
node_planar -->|"sets wall geometry"| node_net
node_net -->|"supplies net"| node_shock_solver
node_shock_solver -->|"solves shock net"| node_net
node_shock_solver -->|"records shock steps"| node_shock_plot
node_postprocess -.->|"processes solution"| node_net

click node_geometry "https://github.com/ihmegroup/stanshock/blob/develop/src/stanshock/system/geometry.py"
click node_initialization "https://github.com/ihmegroup/stanshock/blob/develop/src/stanshock/processing/initialize.py"
click node_fluid "https://github.com/ihmegroup/stanshock/blob/develop/src/stanshock/physics/fluid_base.py"
click node_thermo "https://github.com/ihmegroup/stanshock/blob/develop/src/stanshock/physics/thermotable.py"
click node_chemistry "https://github.com/ihmegroup/stanshock/blob/develop/src/stanshock/physics/chemistry_source.py"
click node_numerics "https://github.com/ihmegroup/stanshock/blob/develop/src/stanshock/numerics/inviscid_flux.py"
click node_face "https://github.com/ihmegroup/stanshock/blob/develop/src/stanshock/numerics/face_average.py"
click node_boundary "https://github.com/ihmegroup/stanshock/blob/develop/src/stanshock/numerics/boundary_conditions.py"
click node_integration "https://github.com/ihmegroup/stanshock/blob/develop/src/stanshock/numerics/time_integration.py"
click node_runner "https://github.com/ihmegroup/stanshock/blob/develop/src/stanshock/system/base.py"
click node_models "https://github.com/ihmegroup/stanshock/blob/develop/src/stanshock/models/area_change.py"
click node_boundary_layer "https://github.com/ihmegroup/stanshock/blob/develop/src/stanshock/models/boundary_layer.py"
click node_jicf "https://github.com/ihmegroup/stanshock/blob/develop/src/stanshock/models/jicf.py"
click node_shocktube "https://github.com/ihmegroup/stanshock/blob/develop/src/stanshock/components/shocktube.py"
click node_combustor "https://github.com/ihmegroup/stanshock/blob/develop/src/stanshock/components/combustor.py"
click node_probe "https://github.com/ihmegroup/stanshock/blob/develop/src/stanshock/processing/probe.py"
click node_output "https://github.com/ihmegroup/stanshock/blob/develop/src/stanshock/processing/csv_writer.py"
click node_planar "https://github.com/ihmegroup/stanshock/blob/develop/src/inlet_moc/planar_inlet.py"
click node_net "https://github.com/ihmegroup/stanshock/blob/develop/src/inlet_moc/char_net.py"
click node_shock_solver "https://github.com/ihmegroup/stanshock/blob/develop/src/inlet_moc/shock_solvers/net_shock.py"
click node_shock_plot "https://github.com/ihmegroup/stanshock/blob/develop/src/inlet_moc/plot/net_shock.py"
click node_postprocess "https://github.com/ihmegroup/stanshock/blob/develop/src/inlet_moc/processing/_processing.py"

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_geometry,node_initialization toneBlue
class node_fluid,node_thermo,node_chemistry,node_numerics,node_face,node_boundary,node_integration,node_runner,node_models,node_boundary_layer,node_jicf toneAmber
class node_shocktube,node_combustor,node_probe,node_output toneMint
class node_planar,node_net,node_shock_solver,node_shock_plot,node_postprocess toneRose
class node_engineer,node_inlet_user toneIndigo
```

## Components

### Flow setup

- [Geometry](https://github.com/ihmegroup/stanshock/blob/develop/src/stanshock/system/geometry.py): `src/stanshock/system/geometry.py`
- [Initial conditions](https://github.com/ihmegroup/stanshock/blob/develop/src/stanshock/processing/initialize.py): `src/stanshock/processing/initialize.py`

### Quasi-1D solver

- [Fluid state](https://github.com/ihmegroup/stanshock/blob/develop/src/stanshock/physics/fluid_base.py): `src/stanshock/physics/fluid_base.py`
- [Thermo models](https://github.com/ihmegroup/stanshock/blob/develop/src/stanshock/physics/thermotable.py): `src/stanshock/physics/thermotable.py`
- [Chemistry](https://github.com/ihmegroup/stanshock/blob/develop/src/stanshock/physics/chemistry_source.py): `src/stanshock/physics/chemistry_source.py`
- [Numerical methods](https://github.com/ihmegroup/stanshock/blob/develop/src/stanshock/numerics/inviscid_flux.py): `src/stanshock/numerics/inviscid_flux.py`
- [Face averaging](https://github.com/ihmegroup/stanshock/blob/develop/src/stanshock/numerics/face_average.py): `src/stanshock/numerics/face_average.py`
- [Boundary conditions](https://github.com/ihmegroup/stanshock/blob/develop/src/stanshock/numerics/boundary_conditions.py): `src/stanshock/numerics/boundary_conditions.py`
- [Time integration](https://github.com/ihmegroup/stanshock/blob/develop/src/stanshock/numerics/time_integration.py): `src/stanshock/numerics/time_integration.py`
- [Simulation system](https://github.com/ihmegroup/stanshock/blob/develop/src/stanshock/system/base.py): `src/stanshock/system/base.py`
- [Flow models](https://github.com/ihmegroup/stanshock/blob/develop/src/stanshock/models/area_change.py): `src/stanshock/models/area_change.py`
- [Boundary layer](https://github.com/ihmegroup/stanshock/blob/develop/src/stanshock/models/boundary_layer.py): `src/stanshock/models/boundary_layer.py`
- [Fuel injection](https://github.com/ihmegroup/stanshock/blob/develop/src/stanshock/models/jicf.py): `src/stanshock/models/jicf.py`

### Results and components

- [Shock tube](https://github.com/ihmegroup/stanshock/blob/develop/src/stanshock/components/shocktube.py): `src/stanshock/components/shocktube.py`
- [Combustor](https://github.com/ihmegroup/stanshock/blob/develop/src/stanshock/components/combustor.py): `src/stanshock/components/combustor.py`
- [Probes](https://github.com/ihmegroup/stanshock/blob/develop/src/stanshock/processing/probe.py): `src/stanshock/processing/probe.py`
- [Output and plots](https://github.com/ihmegroup/stanshock/blob/develop/src/stanshock/processing/csv_writer.py): `src/stanshock/processing/csv_writer.py`

### MOC inlet design

- [Planar inlet](https://github.com/ihmegroup/stanshock/blob/develop/src/inlet_moc/planar_inlet.py): `src/inlet_moc/planar_inlet.py`
- [Characteristic net](https://github.com/ihmegroup/stanshock/blob/develop/src/inlet_moc/char_net.py): `src/inlet_moc/char_net.py`
- [Shock solver](https://github.com/ihmegroup/stanshock/blob/develop/src/inlet_moc/shock_solvers/net_shock.py): `src/inlet_moc/shock_solvers/net_shock.py`
- [Shock visualization](https://github.com/ihmegroup/stanshock/blob/develop/src/inlet_moc/plot/net_shock.py): `src/inlet_moc/plot/net_shock.py`
- [MOC processing](https://github.com/ihmegroup/stanshock/blob/develop/src/inlet_moc/processing/_processing.py): `src/inlet_moc/processing/_processing.py`

### Other components

- **Engineer**
- **Inlet designer**

## Connections

- Engineer → Geometry: defines flow path
- Engineer → Initial conditions: sets initial state
- Geometry → Initial conditions: provides mesh
- Initial conditions → Simulation system: initializes
- Geometry → Simulation system: configures domain
- Fluid state → Thermo models: thermodynamic properties
- Simulation system → Time integration: advances state
- Numerical methods → Face averaging: averages face states
- Boundary conditions → Simulation system: constrains flow
- Chemistry → Simulation system: adds source terms
- Flow models → Simulation system: models area effects
- Boundary layer → Simulation system: models wall effects
- Fuel injection → Simulation system: models injection
- Shock tube → Simulation system: configures experiment
- Combustor → Simulation system: models combustor
- Probes → Simulation system: samples flow
- Output and plots → Simulation system: exports results
- Inlet designer → Planar inlet: defines inlet
- Planar inlet → Characteristic net: sets wall geometry
- Characteristic net → Shock solver: supplies net
- Shock solver → Characteristic net: solves shock net
- Shock solver → Shock visualization: records shock steps
- MOC processing → Characteristic net: processes solution
