# elshraby/meshgraphnets-airfoil architecture

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

- Interactive diagram: https://gitdiagram.com/elshraby/meshgraphnets-airfoil
- Repository: https://github.com/elshraby/meshgraphnets-airfoil

## Overview

MeshGraphNets-Airfoil turns generated SU2 airfoil simulations into HDF5 trajectories, trains a graph-network surrogate, and evaluates and visualizes its flow predictions. The main stages are mesh creation, CFD case generation and execution, dataset packing, graph loading, training, autoregressive rollout, and diagnostics. Shared node-type definitions and dataset auditing form a supporting layer. The README documents the overall pipeline; source excerpts show key loader, model, training, evaluation, and generation behavior. Visualization internals and some data-generation wiring were not fully sampled, so uncertain links are omitted.

Main entry points: [`src/evaluate.py`](https://github.com/elshraby/meshgraphnets-airfoil/blob/main/src/evaluate.py) (Autoregressive Evaluation), [`src/train.py`](https://github.com/elshraby/meshgraphnets-airfoil/blob/main/src/train.py) (Checkpointed Training), [`src/dataset.py`](https://github.com/elshraby/meshgraphnets-airfoil/blob/main/src/dataset.py) (Graph Dataset Loader), [`data_gen/generate_and_run_cases.py`](https://github.com/elshraby/meshgraphnets-airfoil/blob/main/data_gen/generate_and_run_cases.py) (Case Generation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_simulation["Mesh And CFD"]
  node_meshgen["Mesh Generation<br/>[generate_meshes.py]"]
  node_casegen["Case Generation"]
  node_su2["SU2 CFD"]
  node_config["CFD Configuration"]
end

subgraph group_data["Dataset Preparation"]
  node_packer["Trajectory Packing"]
  node_hdf5[("HDF5 Splits")]
  node_graphloader["Graph Dataset Loader<br/>[dataset.py]"]
  node_shared["Shared Utilities<br/>[common.py]"]
end

subgraph group_learning["Model And Training"]
  node_trainer["Checkpointed Training<br/>[train.py]"]
  node_model["Airfoil MeshGraphNet<br/>[model.py]"]
  node_checkpoint["Model Checkpoint<br/>[train.py]"]
end

subgraph group_results["Evaluation And Diagnostics"]
  node_evaluator["Autoregressive Evaluation<br/>[evaluate.py]"]
  node_visualizer["Flow Diagnostics<br/>[visualize.py]"]
end

node_user(("Researcher"))

node_user -->|"generates meshes"| node_meshgen
node_user -->|"trains surrogate"| node_trainer
node_user -->|"evaluates model"| node_evaluator
node_meshgen -->|"provides meshes"| node_casegen
node_casegen -->|"renders cases"| node_config
node_casegen -->|"runs simulations"| node_su2
node_su2 -->|"writes simulation output"| node_packer
node_packer -->|"packs trajectories"| node_hdf5
node_hdf5 -->|"loads trajectories"| node_graphloader
node_graphloader -->|"provides graph pairs"| node_trainer
node_shared -->|"classifies nodes"| node_graphloader
node_trainer -->|"trains"| node_model
node_trainer -->|"saves weights"| node_checkpoint
node_checkpoint -->|"loads weights"| node_evaluator
node_evaluator -->|"loads test graphs"| node_graphloader
node_evaluator -->|"runs rollouts"| node_model
node_evaluator -.->|"supplies rollout diagnostics"| node_visualizer
node_user -->|"creates diagnostics"| node_visualizer

click node_meshgen "https://github.com/elshraby/meshgraphnets-airfoil/blob/main/data_gen/generate_meshes.py"
click node_casegen "https://github.com/elshraby/meshgraphnets-airfoil/blob/main/data_gen/generate_and_run_cases.py"
click node_config "https://github.com/elshraby/meshgraphnets-airfoil/blob/main/configs/airfoil_mgn_unsteady.cfg"
click node_packer "https://github.com/elshraby/meshgraphnets-airfoil/blob/main/data_gen/pack_su2_to_hdf5.py"
click node_hdf5 "https://github.com/elshraby/meshgraphnets-airfoil/blob/main/data_gen/pack_su2_to_hdf5.py"
click node_graphloader "https://github.com/elshraby/meshgraphnets-airfoil/blob/main/src/dataset.py"
click node_shared "https://github.com/elshraby/meshgraphnets-airfoil/blob/main/src/common.py"
click node_trainer "https://github.com/elshraby/meshgraphnets-airfoil/blob/main/src/train.py"
click node_model "https://github.com/elshraby/meshgraphnets-airfoil/blob/main/src/model.py"
click node_checkpoint "https://github.com/elshraby/meshgraphnets-airfoil/blob/main/src/train.py"
click node_evaluator "https://github.com/elshraby/meshgraphnets-airfoil/blob/main/src/evaluate.py"
click node_visualizer "https://github.com/elshraby/meshgraphnets-airfoil/blob/main/src/visualize.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_meshgen,node_casegen,node_su2,node_config toneBlue
class node_packer,node_hdf5,node_graphloader,node_shared toneAmber
class node_trainer,node_model,node_checkpoint toneMint
class node_evaluator,node_visualizer toneRose
class node_user toneIndigo
```

## Components

### Mesh And CFD

- [Mesh Generation](https://github.com/elshraby/meshgraphnets-airfoil/blob/main/data_gen/generate_meshes.py): `data_gen/generate_meshes.py`
- [Case Generation](https://github.com/elshraby/meshgraphnets-airfoil/blob/main/data_gen/generate_and_run_cases.py): `data_gen/generate_and_run_cases.py`
- **SU2 CFD**
- [CFD Configuration](https://github.com/elshraby/meshgraphnets-airfoil/blob/main/configs/airfoil_mgn_unsteady.cfg): `configs/airfoil_mgn_unsteady.cfg`

### Dataset Preparation

- [Trajectory Packing](https://github.com/elshraby/meshgraphnets-airfoil/blob/main/data_gen/pack_su2_to_hdf5.py): `data_gen/pack_su2_to_hdf5.py`
- [HDF5 Splits](https://github.com/elshraby/meshgraphnets-airfoil/blob/main/data_gen/pack_su2_to_hdf5.py): `data_gen/pack_su2_to_hdf5.py`
- [Graph Dataset Loader](https://github.com/elshraby/meshgraphnets-airfoil/blob/main/src/dataset.py): `src/dataset.py`
- [Shared Utilities](https://github.com/elshraby/meshgraphnets-airfoil/blob/main/src/common.py): `src/common.py`

### Model And Training

- [Checkpointed Training](https://github.com/elshraby/meshgraphnets-airfoil/blob/main/src/train.py): `src/train.py`
- [Airfoil MeshGraphNet](https://github.com/elshraby/meshgraphnets-airfoil/blob/main/src/model.py): `src/model.py`
- [Model Checkpoint](https://github.com/elshraby/meshgraphnets-airfoil/blob/main/src/train.py): `src/train.py`

### Evaluation And Diagnostics

- [Autoregressive Evaluation](https://github.com/elshraby/meshgraphnets-airfoil/blob/main/src/evaluate.py): `src/evaluate.py`
- [Flow Diagnostics](https://github.com/elshraby/meshgraphnets-airfoil/blob/main/src/visualize.py): `src/visualize.py`

### Other components

- **Researcher**

## Connections

- Researcher → Mesh Generation: generates meshes (evidence: `README.md`)
- Researcher → Checkpointed Training: trains surrogate (evidence: `README.md`)
- Researcher → Autoregressive Evaluation: evaluates model (evidence: `README.md`)
- Mesh Generation → Case Generation: provides meshes (evidence: `data_gen/generate_and_run_cases.py`)
- Case Generation → CFD Configuration: renders cases (evidence: `data_gen/generate_and_run_cases.py`)
- Case Generation → SU2 CFD: runs simulations (evidence: `data_gen/generate_and_run_cases.py`)
- SU2 CFD → Trajectory Packing: writes simulation output (evidence: `README.md`)
- Trajectory Packing → HDF5 Splits: packs trajectories (evidence: `data_gen/pack_su2_to_hdf5.py`)
- HDF5 Splits → Graph Dataset Loader: loads trajectories (evidence: `README.md`)
- Graph Dataset Loader → Checkpointed Training: provides graph pairs (evidence: `src/train.py`)
- Shared Utilities → Graph Dataset Loader: classifies nodes (evidence: `src/dataset.py`)
- Checkpointed Training → Airfoil MeshGraphNet: trains (evidence: `src/train.py`)
- Checkpointed Training → Model Checkpoint: saves weights (evidence: `README.md`)
- Model Checkpoint → Autoregressive Evaluation: loads weights (evidence: `src/evaluate.py`)
- Autoregressive Evaluation → Graph Dataset Loader: loads test graphs (evidence: `src/evaluate.py`)
- Autoregressive Evaluation → Airfoil MeshGraphNet: runs rollouts (evidence: `src/evaluate.py`)
- Autoregressive Evaluation → Flow Diagnostics: supplies rollout diagnostics (evidence: `src/visualize.py`)
- Researcher → Flow Diagnostics: creates diagnostics (evidence: `README.md`)
