Flux Kontext CFD Surrogate Model
Inspiration
CFD simulations are the backbone of aerospace and engineering design, but they are expensive: a single RANS simulation may take hours or days on an HPC cluster.
When running parameter sweeps (airfoil shapes, angle of attack, or Reynolds numbers), this computational bottleneck becomes critical.
At the same time, large vision–language models such as FLUX.1-Kontext-dev can learn structured transformations between images given natural language captions.
The inspiration was to ask:
[ \text{Can we treat CFD contour plots as structured images, and train a model to learn transformations between them?} ]
If successful, this could yield a fast surrogate model for flow field prediction — enabling design exploration at interactive speeds.
What it does
Flux Kontext CFD Surrogate Model:
- Learns CFD transformations: Predicts flow field images (pressure, velocity components, turbulence) for new conditions.
- Supports parameter changes: Geometry edits, AoA sweeps, and velocity scaling.
- Provides surrogate predictions: Instead of solving Navier–Stokes each time, the model generates approximate results instantly.
- Includes evaluation pipeline: Computes image similarity metrics (SSIM, PSNR, LPIPS) and visual difference heatmaps to check accuracy.
In essence, it transforms slow physics-based solvers into a fast AI surrogate, while keeping outputs physically meaningful.
How we built it
Dataset Preprocessing
- Source: AirfRANS dataset of airfoil CFD solutions.
- Preprocessing: Converted CFD outputs (pressure, (u_x, u_y, \nu_t)) into paired training images.
- Caption design encoded physics, e.g.:
fludyn edit: set AoA from 0.0 to 10.0 deg; keep airfoil=NACA0012, variable=pressure
- Source: AirfRANS dataset of airfoil CFD solutions.
Training
- Base model:
black-forest-labs/FLUX.1-Kontext-dev. - Method: LoRA adapters for parameter-efficient fine-tuning.
- Hardware:
- Lambda AI cluster (A100 GPUs).
- Lambda AI cluster (A100 GPUs).
- Base model:
Evaluation
- Quantitative metrics:
[ \text{MSE}, \quad \text{SSIM} > 0.8, \quad \text{PSNR} > 25 \; \text{dB}, \quad \text{LPIPS} < 0.2 ] - Qualitative metrics: side-by-side plots, difference heatmaps, error histograms.
- Quantitative metrics:
Challenges we ran into
- Data pairing: Matching airfoil, AoA, and velocity conditions consistently was nontrivial.
- Memory bottlenecks: The base model (~20GB) required GPUs with at least 24GB VRAM.
- Physics vs. image similarity: High SSIM could still correspond to non-physical flow features.
Accomplishments that we're proud of
- Built a novel surrogate modeling pipeline that merges CFD and generative AI.
- Designed physically-aware captions that encoded aerodynamic parameters in natural language.
- Developed a full evaluation framework with both numerical and perceptual metrics.
What we learned
- Generative models can act as CFD surrogates if framed carefully as structured image transformations.
- Physics encoding in captions is crucial: captions are not just text but a way to guide physics constraints.
- Metrics must be hybrid: pixel similarity alone is not enough — domain-specific validation is required.
- LoRA adapters are powerful: allowed training without retraining the full base model.
What's next for Flux Kontext CFD Surrogate Model
- Integration with solvers: Use surrogate outputs as warm starts for CFD codes, speeding up convergence.
- Integrating info other reduced order models: Reuse the reconstructed solution as basis for other reduced order models such as Reduced Basis or PDG methods
Log in or sign up for Devpost to join the conversation.