csdl_dafoam
csdl_dafoam connects DAFoam (OpenFOAM with a discrete adjoint) to
CSDL so that CFD-based aerodynamic shape optimization can be
written as an ordinary CSDL model: geometry parameterization with
lsdo_geo, mesh deformation with
IDWarp-JAX, DAFoam flow solves and adjoint gradients, and an optimizer
from modOpt (OpenSQP by default).
A NACA 0012 optimized for minimum drag at CL = 0.5 (Euler-mode case, 4,032 cells), 100 iterations of OpenSQP with DAFoam adjoint gradients: the pressure field, surface pressure coefficient and airfoil shape of every iteration, with the drag, lift, optimality and feasibility histories. The strong shock at 30% chord is gone and CD falls from 117 to 75 counts (-36%). See Examples.
How the pieces fit

What is here:
an installable Python package (
pip install); DAFoam itself is compiled from source, with a verified, reproducible procedure for an Apple-silicon Mac (through a Linux VM) and for Linux (Installation)two ready-to-run examples on a bundled NACA 0012 case: an analysis, and an optimization in “Euler mode” (coarse mesh, very high Reynolds number) or RANS (Examples)
a built-in visualization tool for flow solutions, including a movie of an optimization (Visualization)
a test suite that runs in about a minute and a half (25 s for the quick subset) without DAFoam, by checking the CSDL/DAFoam wiring against linear fake solvers with exactly known derivatives, plus real-solver tests (Development)
Important
Verified on a real DAFoam 5.1.1 / OpenFOAM v2506 built from source on ARM64 Linux only. The conda packages are experimental and have not been built; x86-64 has not been tried; the 3D visualization functions are untested on a real 3D case. Verification status lists exactly what has and has not been verified.