Skip to content

AeroTransformer/DFlow-SUR Notes

Source Assets

  • SuperWing dataset: yunplus/SuperWing
  • AeroTransformer model repo: yunplus/AeroTransformer
  • checkpoint target: ATsurf_S

ATsurf_S/model_config declares model_name = WingPDETransformer with fun_dim=3, out_dim=3, n_hidden=16, n_layers=5, patch_size=[4,4], window_size=[8,8], and type_cond="inj".

DFlow Design Variables

The existing DFlow workflow trains a flow-matching velocity field on design vectors, integrates the learned ODE to sample a design, evaluates a surrogate inside H(x), and optimizes the initial noise so the final generated design matches a physics target.

main_dflow_aerotransformer.py trains the generative model on SuperWing configs.dat. The current file rows contain an integer shape index plus numeric columns. The default generated vector is the first 38 numeric columns after the index:

  • 7 global planform variables
  • 10 spanwise thickness/camber/twist variables
  • 21 baseline airfoil CST/thickness variables

The operating-condition columns are not generated; Mach and alpha are passed as command-line arguments.

Surrogate Input/Output

flowdesign.surrogate.aero_transformer_surrogate.AeroTransformerSurrogate accepts DFlow design variables shaped [B, design_dim] or [B, 1, design_dim]. It returns coefficients shaped [B, 3] in this order:

[CL, CD, CM]

The wrapper also exposes predict_fields(), which returns predicted surface fields shaped [B, 3, 128, 256], interpreted as:

[Cp, Cf_tau, Cf_z]

Local Pretrained AeroTransformer

AeroTransformerSurrogate uses the author's upstream flowvae.app.wing.models.AeroTransformer implementation when flowvae is installed, and strictly loads ATsurf_S/best_model_weights. No retraining is required for the AeroTransformer surrogate. The local flowdesign/surrogate/aerotransformer_model.py implementation is kept only as a fallback/debug path because the upstream implementation is the validated one.

Required author code dependency:

python -m pip install git+https://github.com/YangYunjia/floGen.git

The pretrained ATsurf_S artifacts are not committed to the repository. Download them on demand with --download-aerotransformer, or pass explicit local paths:

data/aerotransformer/ATsurf_S/model_config.json
data/aerotransformer/ATsurf_S/best_model_weights

The ATsurf_S checkpoint condition input is two-dimensional:

[AoA, Mach]

This is visible in the pretrained weights:

c_embedder_*.0.weight: (hidden_dim, 2)

FlowDesign now includes a differentiable SuperWing geometry builder:

flowdesign/geometry/superwing_builder.py

The runtime chain is:

38-D SuperWing config
-> origingeom [B,3,129,257] and geom0 [B,3,128,256]
-> ATsurf_S predicts [Cp, Cf_tau, Cf_z]
-> SuperWing/floGen-style surface integration
-> [CL, CD, CMz]

The builder avoids storing the full geom0.npy/origingeom.npy locally. One validation slice gave geom0 reconstruction RMSE about 7.4e-3. A downloaded data.npy surface-field sample integrated to [CL, CD, CM] = [0.1704, 0.01425, 0.2135] versus the index.npy reference-mesh values [0.1656, 0.01439, 0.2120]. With the upstream AeroTransformer implementation, the same sample's predicted field MSE was about 1.3e-5 when using condition order [AoA, Mach].

Run

Smoke test:

python main_dflow_aerotransformer.py \
  --download-configs \
  --download-aerotransformer \
  --num-samples 1 \
  --train-iters 10 \
  --optim-steps 2

Longer MVP run:

python main_dflow_aerotransformer.py \
  --download-configs \
  --download-aerotransformer \
  --num-samples 4 \
  --target-cl 0.6 \
  --cd-limit 0.08 \
  --output-dir results_dflow_aerotransformer