Skip to content

Latest commit

 

History

History
134 lines (95 loc) · 5.1 KB

File metadata and controls

134 lines (95 loc) · 5.1 KB

MULTIFID-TH

pytest docs

MULTIFID-TH — multifidelity surrogates for thermal-hydraulics — is a PhysicsNeMo-based ETL pipeline that converts MOOSE thermal-hydraulics outputs (Exodus + CSV probes) into ML-ready Zarr datasets and trains low-fidelity ML surrogates against the high-fidelity simulations.

Pipeline overview

flowchart LR
    A["MOOSE outputs (.e + CSV probes)"]
    B["ETL pipeline (read, transform, validate)"]
    C["Processed dataset (*.zarr)"]
    D["Training interface: MOOSEDataset (graph | point_cloud | grid)"]
    A --> B --> C --> D
Loading

What It Does

  • Reads simulation outputs from Exodus .e files and CSV line-probe files.
  • Normalizes fields and creates graph and regular-grid representations.
  • Writes one compressed .zarr store per simulation run.
  • Provides a PyTorch dataset interface for graph, point-cloud, and grid training.

Quick Start

git submodule update --init physicsnemo-curator physicsnemo
docker compose build etl-dev
docker compose run --rm etl-dev bash -lc 'cd src && python cases/moose_grid/run_etl.py'

The default config is the lid-driven flow at src/cases/moose_grid/configs/etl.yaml, which writes output to data/processed/lid-driven/*.zarr.

You can override values on the command line if needed:

docker compose run --rm etl-dev bash -lc 'cd src && python cases/moose_grid/run_etl.py etl.processing.num_processes=8'

To create a new dataset config, copy src/cases/moose_grid/configs/etl.yaml to src/cases/moose_grid/configs/<your_config>.yaml, update the source/sink paths, then run:

docker compose run --rm etl-dev bash -lc 'cd src && python cases/moose_grid/run_etl.py --config-name <your_config>'

Train an FNO with PhysicsNeMo

After ETL generates *.zarr stores, train with the generic framework using the FNO example config at src/cases/moose_grid/configs/train_fno.yaml.

docker compose build etl
docker compose run --rm etl bash -lc 'cd src && python train.py --config-path cases/moose_grid/configs --config-name train_fno'

Use etl-ngc instead of etl if you prefer the NGC PhysicsNeMo base image. Override config values directly on the CLI, for example:

docker compose run --rm etl bash -lc 'cd src && python train.py --config-path cases/moose_grid/configs --config-name train_fno training.epochs=50'

Evaluate an FNO Checkpoint

docker compose run --rm etl bash -lc 'cd src && python evaluate.py --config-path cases/moose_grid/configs --config-name train_fno'

To save ground-truth vs predicted velocity-field plots during evaluation:

docker compose run --rm etl bash -lc 'cd src && python evaluate.py --config-path cases/moose_grid/configs --config-name train_fno \
  output.plot_dir=../data/models/lid_driven_fno_plots'

Train an MLP Surrogate for Darcy Resistance

The alpha-D workflow extracts Darcy resistance coefficient profiles from a parametric study of flow contraction-expansion simulations, then trains a PhysicsNeMo FullyConnected MLP surrogate.

# 1. Extract alpha_D profiles from CFD output
docker compose run --rm etl bash -lc 'cd src && python cases/alpha_d/run_etl.py'

# 2. Train (HPO + retrain best, all in one command)
docker compose run --rm etl bash -lc 'cd src && python train.py --config-path cases/alpha_d/configs --config-name train_mlp'

# 2b. Or skip HPO and train directly
docker compose run --rm etl bash -lc 'cd src && python train.py --config-path cases/alpha_d/configs --config-name train_mlp hpo=null'

# 3. Evaluate
docker compose run --rm etl bash -lc 'cd src && python evaluate.py --config-path cases/alpha_d/configs --config-name train_mlp'

See Alpha-D Surrogate Tutorial for the full walkthrough.

Documentation

📘 Rendered site: https://mengnanli91.github.io/multifid-th/ — auto-deployed from main by .github/workflows/docs.yml.

The Markdown files below are the same source the site renders from; they read correctly both on GitHub and on the hosted site.

User docs

Developer docs

Build the docs locally

pip install -e ".[docs]"
make -C docs html
# Open docs/_build/html/index.html in a browser

For live reload while editing: make -C docs livehtml and browse to http://localhost:8000. See docs/dev/building_docs.md for strict mode, the Apptainer fallback, and the full target list.