Skip to content

Commit 4362e1a

Browse files
imMoyaandrinrMatteoSalvadordionhaefnerxalelax
authored
doc: Add Ansys Fluent QoI-based workflow example (#399)
<!-- Please use a PR title that conforms to *conventional commits*: "<commit_type>: Describe your change"; for example: "fix: prevent race condition". Some other commit types are: fix, feat, ci, doc, refactor... For a full list of commit types visit https://www.conventionalcommits.org/en/v1.0.0/ --> #### Relevant issue or PR <!-- If the changes resolve an issue or follow some other PR, link to them here. Only link something if it is directly relevant. --> #### Description of changes <!-- Add a high-level description of changes, focusing on the *what* and *why*. --> #### Testing done <!-- Describe how the changes were tested; e.g., "CI passes", "Tested manually in stagingrepo#123", screenshots of a terminal session that verify the changes, or any other evidence of testing the changes. --> --------- Co-authored-by: andrinr <[email protected]> Co-authored-by: Matteo Salvador <[email protected]> Co-authored-by: Dion Häfner <[email protected]> Co-authored-by: Alessandro Angioi <[email protected]>
1 parent fca9b75 commit 4362e1a

File tree

110 files changed

+8051
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+8051
-0
lines changed

demo/_showcase/ansys-qoi/README.md

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
# QoI-Based Surrogate Modeling Workflow
2+
3+
This showcase demonstrates an end-to-end workflow for building QoI-based surrogate models from Ansys simulation data using Tesseract.
4+
5+
## Overview
6+
7+
This workflow implements a **QoI-based surrogate modeling pipeline** that:
8+
1. Processes Ansys simulation runs (CAD files + simulation results)
9+
2. Extracts point clouds, CAD parameters, boundary conditions, and Quantities of Interest (QoI)
10+
3. Trains hybrid ML models (PointNet + Random Forest) to predict QoI
11+
4. Performs inference on new CAD designs
12+
13+
### Workflow Components
14+
15+
The workflow consists of three Tesseract components:
16+
17+
```
18+
+------------------+
19+
| qoi_dataset | <- Processes Ansys simulation runs
20+
| (Data Gen) | -> Generates NPZ datasets
21+
+--------+---------+
22+
|
23+
v
24+
+------------------+
25+
| qoi_train | <- Trains ML models on processed data
26+
| (Training) | -> Outputs trained models + scalers
27+
+--------+---------+
28+
|
29+
v
30+
+------------------+
31+
| qoi_inference | <- Import new geometry design
32+
| (Inference) | -> Generates QoI predictions
33+
+------------------+
34+
```
35+
## Input Data
36+
37+
The workflow expects **Ansys simulation runs** in the following structure:
38+
39+
```
40+
inputs/Ansys_Runs/
41+
├── Run_0001/
42+
│ ├── geometry.stl # CAD geometry file
43+
│ ├── metadata.json.series # BC and CAD parameteres
44+
│ ├── all_pressure.txt # QoI outputs
45+
│ └── ...
46+
├── Run_0002/
47+
│ └── ...
48+
└── ...
49+
```
50+
51+
Each simulation run directory should contain:
52+
- **CAD file** (`.stl` format): 3D geometry for point cloud sampling
53+
- **Boundary condition data**: Parameters varied across simulations
54+
- **CAD parameters**: Parameters used during the CAD design process
55+
- **Simulation results**: Target QoI values to predict
56+
57+
## Configuration
58+
59+
Each component uses a `config.yaml` file in `inputs/config.yaml` that specifies:
60+
- Point cloud sampling strategy
61+
- Parameter extraction rules
62+
- QoI definitions
63+
- Model architecture and training hyperparameters
64+
65+
## Running the Workflow
66+
67+
### Option 1: Run Complete Workflow
68+
69+
Execute all three components sequentially:
70+
71+
```bash
72+
cd demo/_showcase/ansys-qoi
73+
tesseract build ./qoi_dataset/
74+
tesseract build ./qoi_inference/
75+
tesseract build ./qoi_train/
76+
python workflow.py
77+
```
78+
79+
This will:
80+
1. Process all Ansys runs into NPZ datasets
81+
2. Train QoI-based surrogate models on the dataset
82+
3. Run inference using the latest trained model
83+
84+
**Output locations:**
85+
- Dataset: `outputs/dataset/*.npz`
86+
- Models: `outputs/models/experiment_hybrid_YYYYMMDD_HHMMSS/`
87+
- Predictions: `outputs/predictions_YYYYMMDD_HHMMSS.csv`
88+
89+
### Option 2: Run Components Individually
90+
91+
#### 1. Dataset Generation (`qoi_dataset`)
92+
93+
Process Ansys simulation runs into point cloud datasets:
94+
95+
```bash
96+
cd qoi_dataset
97+
tesseract build .
98+
python main.py
99+
```
100+
101+
**What it does:**
102+
- Samples point clouds from CAD files (`.stl`)
103+
- Extracts boundary condition parameters
104+
- Extracts CAD sketch design parameters
105+
- Parses QoI from simulation outputs
106+
- Generates compressed NPZ files with all data
107+
108+
**Outputs:** `outputs/dataset/*.npz` files
109+
110+
#### 2. Model Training (`qoi_train`)
111+
112+
Train hybrid ML models on the processed dataset:
113+
114+
```bash
115+
cd qoi_train
116+
tesseract build .
117+
python main.py
118+
```
119+
120+
**What it does:**
121+
- Loads NPZ dataset files
122+
- Creates train/val/test splits
123+
- Fits data scaler
124+
- Trains QoI-based surrogate model
125+
- Evaluates model performance
126+
- Saves trained models and scalers
127+
128+
**Outputs:**
129+
- `outputs/models/experiment_hybrid_YYYYMMDD_HHMMSS/`
130+
- `models/hybrid_pointnet_small.pkl` - Trained model weights
131+
- `scaler.pkl` - Data normalization scaler
132+
- `config.yaml` - Training configuration
133+
- `model_metrics.json` - Performance metrics
134+
135+
#### 3. Inference (`qoi_inference`)
136+
137+
Run predictions on new geometries using trained models:
138+
139+
```bash
140+
cd qoi_inference
141+
tesseract build .
142+
python main.py
143+
```
144+
145+
**What it does:**
146+
- Loads trained model and scaler
147+
- Processes input geometries
148+
- Generates QoI predictions
149+
- Saves predictions to CSV
150+
151+
**Outputs:**
152+
- `outputs/predictions_YYYYMMDD_HHMMSS.csv`
334 KB
Loading
343 KB
Loading
369 KB
Loading
157 KB
Loading
626 KB
Loading
221 KB
Loading
1.12 MB
Loading
216 KB
Loading
190 KB
Loading

0 commit comments

Comments
 (0)