Skip to content

ENH: update of the adjoint library and introduction of topology optimisation

Vaggelis Papoutsis requested to merge feature-topology-optimization into develop


Overhaul and generalization of the adjoint library and introduction of topology optimisation capabilities.


Shape optimisation

  • An overhaul of the adjoint library to ease extension to flow physics other than incompressible flows (see 9a89fcc0 for details)
  • Corrections/improvements to shape optimisation, like (see 9a89fcc0 for details)
  1. Improved consistency between the E-SI and FI formulations for computing sensitivity derivatives for shape optimisation. An example of the code behavior before and after the changes is given below, obtained from the tutorial under $FOAM_TUTORIALS/incompressible/adjointOptimisationFoam/shapeOptimisation/naca0012/laminar/moment/primalAdjoint
NACA0012 C_M sensitivities, v2306 NACA0012 C_M sensitivities, v2312
NACA0012_CM_SDs_v2306 NACA0012_CM_SDs_v2312
  1. Consistent point/face sensitivity maps
Drivaer drag sensitivity map computed on boundary faces, v2306 Drivaer drag sensitivity map computed on boundary faces, v2312
old_top new_top
old_bottom new_bottom

By comparing the drag sensitivity maps computed with v2306 and v2312, it can be observed that: a) the new point-to-face interpolation produces smoother results, even for the raw (i.e. non-smoothed) sensitivities and b) artifacts close to the symmetry plane of the car have disappeared.

  1. A new adjoint solver (null) and objective function (geometric) type, for defining geometric constraints without unnecessarily allocating new adjoint fields
  2. Three new update methods (ISQP, nullSpace, MMA) for tackling optimisation problems with inequality constraints
  3. Introduction of bounds for the design variables; for volumetric B-Splines this can help better preserve the quality of the mesh throughout the optimisation
  4. Introduction of convergence criteria for the optimisation loop.

Features 3 to 6 are showcased in the new tutorial $FOAM_TUTORIALS/incompressible/adjointOptimisationFoam/shapeOptimisation/naca0012/laminar/multipleConstraints

Topology optimisation

New topology optimisation capabilities, using either a porosity-based or a level-set approach. Both include the capability of exporting the designed geometry as an STL, for production and/or re-evaluation with a body-fitted grid.

The porosity-based approach relies on a field of design variables (artificial porosities, \alpha) that block the counter-productive parts of the computational domain by solidifying them. To increase the smoothness of the obtained solutions, a regularisation equation is solved computing the intermediate field \widetilde{\alpha}, followed by a sharpening/projection step to compute the almost binary field \beta. The latter is then used to introduce sources terms to the flow equations that drive the flow solution to zero in the solidified areas (i.e., areas with \beta \approx 1). The steps of the above-mentioned process are showcased below

\alpha \widetilde{\alpha} \beta
alpha alphaTilda beta

The following table shows the results of topology optimisation for three different variants of the same case, namely the minimization of total pressure losses (J_{pt}) (left), minimization of J_{pt} with a constraint on equally distributing the volume flow rate between the bottom and right outlets (J_{m}) (center) and maximization of the flow uniformity (J_{un}), under the J_{pt} \lt J_{pt}^{target} constraint (right).

The cases can be found under $FOAM_TUTORIALS/incompressible/adjointOptimisationFoam/topologyOptimisation/monoFluidAero/turbulent/1_Inlet_2_Outlet/porosityBased/BP

min. losses min. losses
flow-rate constr.
max. uniformity,
losses constr.
lossesBeta lossesMassBeta uniBeta
lossesU lossesMassU uniU

The next table showcases the outcome of topology optimisation for a 3D manifold, with similar objective and constraint functions. The first row depicts the progression of the boundary between the fluid and solid parts of the computational domain during the optimisation cycles and the last row illustrates the STL files of the three optimised geometries. The process of generating the latter is automatic and executed at the end of each optimisation cycle. These STL files can then be used for performing body-fitted simulations with proper boundary condition or subsequent shape optimisations or even for manufacturing.

The cases can be found under $FOAM_TUTORIALS/incompressible/adjointOptimisationFoam/topologyOptimisation/monoFluidAero/laminar/3DBox

min. losses min. losses
flow-rate constr.
max. uniformity,
losses constr., flow-rate constr.
3DBox-losses 3DBox-losses-mass 3DBox-losses-mass-uniformity
losses losses-mass uni-losses-mass

More tutorials can be found under $FOAM_TUTORIALS/incompressible/adjointOptimisationFoam/topologyOptimisation


The entries of optimisationDict.optimisation have slightly changed, arguably towards something more intuitive. The changes can be observed by comparing, for instance, the optimisationDict of $FOAM_TUTORIALS/incompressible/adjointOptimisationFoam/shapeOptimisation/motorbike with its previous variant

Successfully compiles with

  • Gcc9.3 int32 DP
  • clang 15 int32 DP
  • clang 15 int32 SPDP
Edited by Vaggelis Papoutsis

Merge request reports