Examples
The examples/ directory contains complete cases. They read their mesh from the repository’s meshes/
directory, build the model as described in the user guide, and by default compare the
adjoint derivatives with finite differences (sim.check_totals). To optimize instead, uncomment the modOpt
block at the end of the script.
Run them from any directory, for example
$ OMP_NUM_THREADS=1 mpirun -n 4 python examples/airfoil_opt.py
airfoil_opt.py: 2D airfoil
Mesh |
|
Flow |
\(M_\infty = 0.8\), \(\alpha = 2^\circ\) |
Design variables |
vertical motion of 5 x 3 FFD control points (bounds \(\pm 0.01\)); \(\alpha \in [1.75^\circ, 2.25^\circ]\) |
Objective, constraint |
minimize drag \(D\) subject to lift \(L \ge 0.225\) |
Optional (commented out) |
camber and thickness variables; area and thickness constraints |
rans_airfoil_opt.py: turbulent 2D airfoil
Mesh |
|
Flow |
SA-neg RANS, \(M_\infty = 0.7\), \(\alpha = 2^\circ\), \(Re = 6\times10^6\) |
Design variables |
as |
Purpose |
|
airfoil_analysis.py: forward analysis through the windtunnel model
DG_windtunnel_model without an FFD block or mesh warper (Euler at \(M = 0.8\), or --model rans at \(M = 0.7\)):
one plain solve_forward, then a CSDL graph with the angle of attack as its only input and check_totals of
\(dD/d\alpha\) and \(dL/d\alpha\).
flow_analysis.py: steady and unsteady analysis
Euler, laminar or SA-neg RANS from any XDMF or gmsh mesh or structured CGNS grid (--mesh; see Meshes), steady (PTC) or unsteady (--unsteady, BDF2, optional
--dual-time), with the riemann (default) or riemann2 far field. Writes result.csv or history.csv, wall
\(C_p\)/\(c_f\) files, optional VTX fields, and a checkpoint for --restart. See --help.
wing_opt.py: 3D wing
Mesh |
|
Flow |
\(M_\infty = 0.8\), \(\alpha = 2^\circ\) |
Design variables |
|
Objective, constraint |
minimize drag \(D\) subject to lift \(L \ge 10\) |
Optional (commented out) |
raw control-point motions; planform-area, volume and thickness constraints |
Validation
Validation cases compare DRAGonFLy with experiments and other solvers, and test how the results depend on the grid. They need meshes that are not in the repository; each page says where to get them.
ONERA OAT15A airfoil (
examples/ONERA-OAT15A/): mesh-sensitivity study of the OAT15A supercritical airfoil with SA-neg RANS at \(M_\infty = 0.73\), \(Re = 3\times10^6\), on the structured DPW8 Cadence grids.