steady-rans-surrogates / code /ezflow_v3 /cfd /normalize_external.py
BlidReview's picture
weights, code, eval script
bdce880 verified
Raw
History Blame Contribute Delete
876 Bytes
"""Normalize an external STL (AhmedML / DrivAerML / NASA-CRM) to the EZFlow
convention: max-extent L=1, centred at origin, and compute the frontal (y-z
projected) reference area for Cd. Reuses the SAME normalizer the training data
used (family_to_stl._normalize_and_measure), so the zero-shot geometries enter
the model on exactly the same scale as training.
Usage:
python normalize_external.py <stl_in> <name> <out_dir>
Prints one line: NORM <name> Aref=<aref> -> <out_stl>
"""
import sys, os
sys.path.insert(0, r"C:\dev\EZFlow")
from ezflow_v3.cfd.family_to_stl import _normalize_and_measure
stl_in, name, out_dir = sys.argv[1], sys.argv[2], sys.argv[3]
os.makedirs(out_dir, exist_ok=True)
out_stl = os.path.join(out_dir, f"{name}.stl")
lref, aref = _normalize_and_measure(stl_in, out_stl)
print(f"NORM {name} Lref={lref:.3f} Aref={aref:.6f} -> {out_stl}", flush=True)