# dipeshpaudel-cell/ms-pigno architecture

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

- Interactive diagram: https://gitdiagram.com/dipeshpaudel-cell/ms-pigno
- Repository: https://github.com/dipeshpaudel-cell/ms-pigno

## Overview

This repository implements an AirfRANS surrogate-model workflow: prepare and partition simulation graphs, train a multi-scale physics-informed neural operator, then evaluate predictions with flow-field and aerodynamic metrics. The graph includes the model’s major architectural components and the physics-based loss stages. Relationships are supported by the README, excerpts, or SOURCE INDEX references; unsampled implementation details are not inferred.

Main entry points: [`src/models/ms_pigno.py`](https://github.com/dipeshpaudel-cell/ms-pigno/blob/main/src/models/ms_pigno.py) (MS-PIGNO model), [`scripts/evaluate.py`](https://github.com/dipeshpaudel-cell/ms-pigno/blob/main/scripts/evaluate.py) (Evaluation CLI), [`src/training/trainer.py`](https://github.com/dipeshpaudel-cell/ms-pigno/blob/main/src/training/trainer.py) (Training engine), [`scripts/train.py`](https://github.com/dipeshpaudel-cell/ms-pigno/blob/main/scripts/train.py) (Training CLI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data preparation"]
  node_preprocess_cli["Cache preprocessing CLI"]
  node_preprocessor["Graph preprocessor<br/>[preprocessor.py]"]
  node_splitter["Task splitter<br/>[splits.py]"]
  node_transforms["Feature transforms<br/>[transforms.py]"]
  node_dataset["Graph dataset<br/>[dataset.py]"]
end

subgraph group_model["Surrogate model"]
  node_film["FiLM conditioning"]
  node_anisotropic["Anisotropic graph blocks"]
  node_slicing["Slicing attention"]
  node_boundary_head["Boundary-layer head"]
  node_model["MS-PIGNO model<br/>[ms_pigno.py]"]
end

subgraph group_physics["Physics and losses"]
  node_gradients["LS-FV gradients<br/>[lsfv_gradients.py]"]
  node_rans["RANS residuals<br/>[rans_residuals.py]"]
  node_surface["Surface force integrator"]
  node_composite["Curriculum loss<br/>[composite_loss.py]"]
end

subgraph group_runtime["Training and evaluation"]
  node_curriculum["Curriculum manager"]
  node_trainer["Training engine<br/>[trainer.py]"]
  node_train_cli["Training CLI<br/>[train.py]"]
  node_metrics["Benchmark metrics<br/>[metrics.py]"]
  node_evaluate_cli["Evaluation CLI<br/>[evaluate.py]"]
  node_visualization["Flow visualizations<br/>[visualization.py]"]
end

node_engineer(("Benchmark user"))
node_airfrans[("AirfRANS simulations")]

node_engineer -->|"prepares cache"| node_preprocess_cli
node_airfrans -->|"provides simulations"| node_preprocess_cli
node_preprocess_cli -->|"runs preprocessing"| node_preprocessor
node_airfrans -->|"provides task data"| node_splitter
node_engineer -->|"selects benchmark"| node_train_cli
node_train_cli -->|"creates task splits"| node_splitter
node_train_cli -->|"configures normalization"| node_transforms
node_train_cli -->|"loads graph data"| node_dataset
node_dataset -->|"enriches uncached graphs"| node_preprocessor
node_dataset -->|"normalizes features"| node_transforms
node_dataset -->|"supplies graph inputs"| node_model
node_train_cli -->|"starts training"| node_trainer
node_trainer -->|"trains and validates"| node_model
node_trainer -->|"gets phase schedule"| node_curriculum
node_trainer -->|"computes training loss"| node_composite
node_trainer -->|"evaluates validation"| node_metrics
node_model -->|"conditions features"| node_film
node_model -->|"processes graph scales"| node_anisotropic
node_model -->|"applies attention"| node_slicing
node_model -->|"refines wall fields"| node_boundary_head
node_composite -->|"evaluates PDE residuals"| node_rans
node_composite -->|"computes force loss"| node_surface
node_rans -->|"computes derivatives"| node_gradients
node_surface -->|"computes wall gradients"| node_gradients
node_engineer -->|"requests evaluation"| node_evaluate_cli
node_evaluate_cli -->|"loads task split"| node_splitter
node_evaluate_cli -->|"loads test graphs"| node_dataset
node_evaluate_cli -->|"runs checkpoint model"| node_model
node_evaluate_cli -->|"calculates metrics"| node_metrics
node_evaluate_cli -->|"generates comparisons"| node_visualization
node_metrics -->|"integrates force coefficients"| node_surface

click node_preprocess_cli "https://github.com/dipeshpaudel-cell/ms-pigno/blob/main/scripts/preprocess_cache.py"
click node_preprocessor "https://github.com/dipeshpaudel-cell/ms-pigno/blob/main/src/data/preprocessor.py"
click node_splitter "https://github.com/dipeshpaudel-cell/ms-pigno/blob/main/src/data/splits.py"
click node_transforms "https://github.com/dipeshpaudel-cell/ms-pigno/blob/main/src/data/transforms.py"
click node_dataset "https://github.com/dipeshpaudel-cell/ms-pigno/blob/main/src/data/dataset.py"
click node_film "https://github.com/dipeshpaudel-cell/ms-pigno/blob/main/src/models/film_conditioning.py"
click node_anisotropic "https://github.com/dipeshpaudel-cell/ms-pigno/blob/main/src/models/anisotropic_conv.py"
click node_slicing "https://github.com/dipeshpaudel-cell/ms-pigno/blob/main/src/models/slicing_transformer.py"
click node_boundary_head "https://github.com/dipeshpaudel-cell/ms-pigno/blob/main/src/models/bl_refinement_head.py"
click node_model "https://github.com/dipeshpaudel-cell/ms-pigno/blob/main/src/models/ms_pigno.py"
click node_gradients "https://github.com/dipeshpaudel-cell/ms-pigno/blob/main/src/physics/lsfv_gradients.py"
click node_rans "https://github.com/dipeshpaudel-cell/ms-pigno/blob/main/src/physics/rans_residuals.py"
click node_surface "https://github.com/dipeshpaudel-cell/ms-pigno/blob/main/src/physics/surface_integrals.py"
click node_composite "https://github.com/dipeshpaudel-cell/ms-pigno/blob/main/src/losses/composite_loss.py"
click node_curriculum "https://github.com/dipeshpaudel-cell/ms-pigno/blob/main/src/training/curriculum_manager.py"
click node_trainer "https://github.com/dipeshpaudel-cell/ms-pigno/blob/main/src/training/trainer.py"
click node_train_cli "https://github.com/dipeshpaudel-cell/ms-pigno/blob/main/scripts/train.py"
click node_metrics "https://github.com/dipeshpaudel-cell/ms-pigno/blob/main/src/utils/metrics.py"
click node_evaluate_cli "https://github.com/dipeshpaudel-cell/ms-pigno/blob/main/scripts/evaluate.py"
click node_visualization "https://github.com/dipeshpaudel-cell/ms-pigno/blob/main/src/utils/visualization.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_preprocess_cli,node_preprocessor,node_splitter,node_transforms,node_dataset,node_engineer toneBlue
class node_film,node_anisotropic,node_slicing,node_boundary_head,node_model,node_airfrans toneAmber
class node_gradients,node_rans,node_surface,node_composite toneMint
class node_curriculum,node_trainer,node_train_cli,node_metrics,node_evaluate_cli,node_visualization toneRose
```

## Components

### Data preparation

- [Cache preprocessing CLI](https://github.com/dipeshpaudel-cell/ms-pigno/blob/main/scripts/preprocess_cache.py): `scripts/preprocess_cache.py`
- [Graph preprocessor](https://github.com/dipeshpaudel-cell/ms-pigno/blob/main/src/data/preprocessor.py): `src/data/preprocessor.py`
- [Task splitter](https://github.com/dipeshpaudel-cell/ms-pigno/blob/main/src/data/splits.py): `src/data/splits.py`
- [Feature transforms](https://github.com/dipeshpaudel-cell/ms-pigno/blob/main/src/data/transforms.py): `src/data/transforms.py`
- [Graph dataset](https://github.com/dipeshpaudel-cell/ms-pigno/blob/main/src/data/dataset.py): `src/data/dataset.py`

### Surrogate model

- [FiLM conditioning](https://github.com/dipeshpaudel-cell/ms-pigno/blob/main/src/models/film_conditioning.py): `src/models/film_conditioning.py`
- [Anisotropic graph blocks](https://github.com/dipeshpaudel-cell/ms-pigno/blob/main/src/models/anisotropic_conv.py): `src/models/anisotropic_conv.py`
- [Slicing attention](https://github.com/dipeshpaudel-cell/ms-pigno/blob/main/src/models/slicing_transformer.py): `src/models/slicing_transformer.py`
- [Boundary-layer head](https://github.com/dipeshpaudel-cell/ms-pigno/blob/main/src/models/bl_refinement_head.py): `src/models/bl_refinement_head.py`
- [MS-PIGNO model](https://github.com/dipeshpaudel-cell/ms-pigno/blob/main/src/models/ms_pigno.py): `src/models/ms_pigno.py`

### Physics and losses

- [LS-FV gradients](https://github.com/dipeshpaudel-cell/ms-pigno/blob/main/src/physics/lsfv_gradients.py): `src/physics/lsfv_gradients.py`
- [RANS residuals](https://github.com/dipeshpaudel-cell/ms-pigno/blob/main/src/physics/rans_residuals.py): `src/physics/rans_residuals.py`
- [Surface force integrator](https://github.com/dipeshpaudel-cell/ms-pigno/blob/main/src/physics/surface_integrals.py): `src/physics/surface_integrals.py`
- [Curriculum loss](https://github.com/dipeshpaudel-cell/ms-pigno/blob/main/src/losses/composite_loss.py): `src/losses/composite_loss.py`

### Training and evaluation

- [Curriculum manager](https://github.com/dipeshpaudel-cell/ms-pigno/blob/main/src/training/curriculum_manager.py): `src/training/curriculum_manager.py`
- [Training engine](https://github.com/dipeshpaudel-cell/ms-pigno/blob/main/src/training/trainer.py): `src/training/trainer.py`
- [Training CLI](https://github.com/dipeshpaudel-cell/ms-pigno/blob/main/scripts/train.py): `scripts/train.py`
- [Benchmark metrics](https://github.com/dipeshpaudel-cell/ms-pigno/blob/main/src/utils/metrics.py): `src/utils/metrics.py`
- [Evaluation CLI](https://github.com/dipeshpaudel-cell/ms-pigno/blob/main/scripts/evaluate.py): `scripts/evaluate.py`
- [Flow visualizations](https://github.com/dipeshpaudel-cell/ms-pigno/blob/main/src/utils/visualization.py): `src/utils/visualization.py`

### Other components

- **Benchmark user**
- **AirfRANS simulations**

## Connections

- Benchmark user → Cache preprocessing CLI: prepares cache (evidence: `README.md`)
- AirfRANS simulations → Cache preprocessing CLI: provides simulations (evidence: `README.md`)
- Cache preprocessing CLI → Graph preprocessor: runs preprocessing (evidence: `scripts/preprocess_cache.py`)
- AirfRANS simulations → Task splitter: provides task data (evidence: `src/data/splits.py`)
- Benchmark user → Training CLI: selects benchmark (evidence: `README.md`)
- Training CLI → Task splitter: creates task splits (evidence: `scripts/train.py`)
- Training CLI → Feature transforms: configures normalization (evidence: `scripts/train.py`)
- Training CLI → Graph dataset: loads graph data (evidence: `scripts/train.py`)
- Graph dataset → Graph preprocessor: enriches uncached graphs (evidence: `src/data/dataset.py`)
- Graph dataset → Feature transforms: normalizes features (evidence: `src/data/dataset.py`)
- Graph dataset → MS-PIGNO model: supplies graph inputs (evidence: `README.md`)
- Training CLI → Training engine: starts training (evidence: `scripts/train.py`)
- Training engine → MS-PIGNO model: trains and validates (evidence: `src/training/trainer.py`)
- Training engine → Curriculum manager: gets phase schedule (evidence: `src/training/trainer.py`)
- Training engine → Curriculum loss: computes training loss (evidence: `src/training/trainer.py`)
- Training engine → Benchmark metrics: evaluates validation (evidence: `src/training/trainer.py`)
- MS-PIGNO model → FiLM conditioning: conditions features (evidence: `src/models/ms_pigno.py`)
- MS-PIGNO model → Anisotropic graph blocks: processes graph scales (evidence: `src/models/ms_pigno.py`)
- MS-PIGNO model → Slicing attention: applies attention (evidence: `src/models/ms_pigno.py`)
- MS-PIGNO model → Boundary-layer head: refines wall fields (evidence: `src/models/ms_pigno.py`)
- Curriculum loss → RANS residuals: evaluates PDE residuals (evidence: `src/losses/composite_loss.py`)
- Curriculum loss → Surface force integrator: computes force loss (evidence: `src/losses/composite_loss.py`)
- RANS residuals → LS-FV gradients: computes derivatives (evidence: `src/physics/rans_residuals.py`)
- Surface force integrator → LS-FV gradients: computes wall gradients (evidence: `src/physics/surface_integrals.py`)
- Benchmark user → Evaluation CLI: requests evaluation (evidence: `README.md`)
- Evaluation CLI → Task splitter: loads task split (evidence: `scripts/evaluate.py`)
- Evaluation CLI → Graph dataset: loads test graphs (evidence: `scripts/evaluate.py`)
- Evaluation CLI → MS-PIGNO model: runs checkpoint model (evidence: `scripts/evaluate.py`)
- Evaluation CLI → Benchmark metrics: calculates metrics (evidence: `scripts/evaluate.py`)
- Evaluation CLI → Flow visualizations: generates comparisons (evidence: `scripts/evaluate.py`)
- Benchmark metrics → Surface force integrator: integrates force coefficients (evidence: `src/utils/metrics.py`)
