This repository supports the workflow:
- Generate design samples (LHS)
- Convert design samples to porous parameters (Darcy–Forchheimer: 1/K, C2, etc.)
- Train GP surrogate models (Q'' and ΔP) and optionally run GA optimization / prediction
- Validate the Value with CFD Data
From the repository root (HeatExchanger/):
# Go to repo root
cd /path/to/HeatExchanger
# (Recommended) create & activate a venv
python3 -m venv .venv
source .venv/bin/activate
# install dependencies
pip install -U pip
pip install numpy pandas scipy scikit-learn pygadcd /path/to/HeatExchanger
conda create -n wind-hx python=3.10 -y
conda activate wind-hx
# install dependencies
pip install -U pip
pip install -r requirements.txtPick one environment manager: venv or conda (you don't need both).
You need a dataset with (at minimum) these design variables:
S1_mmfin_height_fh_mmfin_spacing_fs_mm
There are two options.
Download porousdata.xlsx (or an equivalent prepared dataset) and place it into:
cd /path/to/HeatExchanger
mkdir -p data
# put your downloaded file into HeatExchanger/data/
ls -lh dataExpected examples:
data/porousdata.xlsxdata/total_2D_Data.xlsx
Run the sampling script (LHS sampling + porous parameter calculation):
- Script:
HeatExchanger/scripts/surrogate/sampling.py - Output directory:
HeatExchanger/data/(recommended convention)
cd /path/to/HeatExchanger
python3 scripts/surrogate/sampling.py
# Check generated file(s)
ls -lh data | tail -n 20Expected output example:
data/LHS_Porous_Params_Result.csv
If you select representative points after sampling:
- Script:
HeatExchanger/scripts/finding_similar.py - Output directory:
HeatExchanger/data/(recommended)
cd /path/to/HeatExchanger
python3 scripts/finding_similar.py
# Check generated file(s)
ls -lh data | tail -n 20If you already have a design-only CSV (S1/FH/FS) and want to convert it into a porous-parameter CSV:
- Script:
HeatExchanger/scripts/porous_calc/porous_converter.py - Input directory:
HeatExchanger/data/ - Output directory:
HeatExchanger/data/
cd /path/to/HeatExchanger
# Example:
# input : data/LHS_design_samples.csv
# output : data/porous_from_design.csv
python3 scripts/porous_calc/porous_converter.py --in data/LHS_design_samples.csv --out data/porous_from_design.csv --T 14.8 --v 2.019 --Dc 24.0 --delta_f 0.5 --pitch_ratio 1.0 --N 4 --v_min 0.5 --v_max 3.5 --n_points 50 --check_constraint
# Verify output
ls -lh data/porous_from_design.csvColumn name requirements (input CSV)
The input CSV must contain these columns (case-insensitive matching is supported):
- S1:
S1_mm/S1/s1_mm/s1 - fin height:
fin_height_fh_mm/fh_mm/fin_height/fh/hf_mm/hf - fin spacing:
fin_spacing_fs_mm/fs_mm/fin_spacing/Fs_mm/Fs/fs
This stage trains Gaussian Process models for:
Q''(heat flux, W/m²)ΔP(pressure drop, Pa)
Your surrogate training script(s) may differ by filename. Use the commands below as a template.
cd /path/to/HeatExchanger
# Example: run a surrogate training script
python3 scripts/surrogate/train_surrogate.py --data data/total_2D_Data.xlsxIf your script is a plain Python file without CLI args, just run it directly:
cd /path/to/HeatExchanger
python3 scripts/surrogate/train_surrogate.pycd /path/to/HeatExchanger
python3 scripts/surrogate/train_surrogate.py --mode ga --data data/total_2D_Data.xlsxcd /path/to/HeatExchanger
python3 scripts/surrogate/train_surrogate.py --mode predict --data data/total_2D_Data.xlsx --s1 181.0394 --fh 28.9923 --fs 2.6038Compare:
- Surrogate-predicted
Q''andΔPvs. - CFD-evaluated
Q''andΔP
Put your CFD results into HeatExchanger/data/ as a CSV or Excel file.
Recommended columns
- Inputs:
S1_mm,fin_height_fh_mm,fin_spacing_fs_mm
- CFD outputs (suggested names):
Q_CFD(orQpp_CFD)dP_CFD(orDeltaP_CFD)
cd /path/to/HeatExchanger
ls -lh data | grep -i cfdcd /path/to/HeatExchanger
python3 scripts/validation/validate_with_cfd.py --train data/total_2D_Data.xlsx --cfd data/CFD_validation.csv --out data/validation_report.csvExpected outputs:
data/validation_report.csv(per-sample error summary)- (Optional) parity plots / error histograms (if implemented)
Common validation metrics:
- R² (CFD vs surrogate)
- MAE / RMSE for
Q''andΔP - Parity plot (y = x) and error distribution
- Worst-case error samples (top-k)
Place into:
HeatExchanger/data/
| Dataset | Purpose | Target path (repo) | File name | Download link | Notes |
|---|---|---|---|---|---|
| porousdata | Prebuilt porous parameters dataset (1/K, C2, etc.) | data/ |
porousdata.xlsx |
Download | Put the file exactly at HeatExchanger/data/porousdata.xlsx |
| total_2D_Data | CFD/2D training dataset for surrogate (Q'', ΔP) | data/ |
total_2D_Data.xlsx |
Download | Used by GP surrogate training + GA optimization |
Examples:
data/porousdata.xlsxdata/total_2D_Data.xlsx
Generated by:
scripts/surrogate/sampling.py
Output example:
data/LHS_Porous_Params_Result.csv