Skip to main content
All CollectionsSimulation Setup
Adjoint Sensitivity Analysis
Adjoint Sensitivity Analysis

Compute the sensitivity of an output with respect to changes in the geometry.

Updated this week

The Adjoint Method

The adjoint method is an efficient numerical tool to compute the gradient (or sensitivity) of a function in optimization problems. In other words, it's used to determine how the output of a simulation is affected by small changes to its input parameters.

In general, an adjoint solver solves a linearized version of the primal governing equations (for example, the Navier-Stokes equations), the so-called adjoint equations.

For steady-state problems, this linearization is performed around the converged solution of the primal solver, since the function (an output of interest such as drag or lift) is evaluated for that solution.

The output provides the boundary conditions for the adjoint solver, and thus each output requires one adjoint solution at approximately the same computational cost of the primal problem.

The solution of the adjoint equations, formally called adjoint variables, can then be used to compute the sensitivity of the output to any input of the solver.

The Luminary adjoint solver uses the adjoint variables to compute the geometric sensitivities. That is, the expected change in the output from deforming the computational mesh in the outward surface-normal direction.

Note: A positive sensitivity means that the output should increase if the surface is pushed outwards, into the volume mesh.

Physics Compatibility

The Adjoint simulation capability is only available for steady-state simulations, including multi-volume domains and moving reference frame (MRF) simulations. It is not available in conjunction with mesh adaptation.

Running an Adjoint Simulation

Because the adjoint solver uses the final solution of the primal problem, start by following the steps to reuse the settings of the desired primal simulation. Then, do the following:

  1. Click on General in the control panel, then from the Simulation Type dropdown select Adjoint.

  2. Select the desired output from the Adjoint Output dropdown, which is populated from compatible outputs defined in the Outputs panel.

  3. (Optional) You can fine-tune the surfaces where geometric sensitivities are computed by selecting Sensitivity Surfaces. If left empty, the solver will consider all surfaces with a wall boundary condition for fluid-flow physics, and all surfaces for heat-transfer physics.

  4. Adjust the stopping conditions for the adjoint solver:

    1. Lower the maximum iterations to a value between 10 and 20 (adjoint iterations have many more sub steps than a primal iteration, the adjoint solver will not perform more than 20 iterations).

    2. Adjust the threshold for the residual stopping condition to 1e-5.

    3. Remove output-based stopping conditions or increase their Start at Iteration value to "maximum iterations - 1". This is required because outputs remain constant in the adjoint solver.

  5. Run the simulation.

Troubleshooting and Best Practices for Adjoint Simulations

The derivation of the adjoint equations assumes the existence of a steady-state solution to the primal problem.

The adjoint solver can have convergence difficulties (stall or diverge) if the convergence of the primal solver shows evidence of transient behavior. For example, the relative residuals stay high and the output values oscillate.

For external aerodynamics problems, we recommend converging the primal problem to relative residuals of 1e-5 for all flow variables when initializing from far-field values.

For internal flows, it is more difficult to provide a target residual. However, "good convergence" can be judged by the stability of the output values and by the rate of change of the residuals. Residuals that decrease nearly monotonically typically mean good convergence.

Note: We recommend reviewing the convergence of the primal simulation before running the adjoint.

If you experience difficulties with the adjoint solver and suspect the convergence of the primal simulation please see our guidelines to improve convergence of the primal solver.

Advanced Adjoint Solver Settings

If the primal convergence cannot be improved, the advanced settings can be used to increase the effectiveness of the adjoint solver or to introduce approximations in the adjoint equations that make them easier to solve. You can find these settings by selecting a physics node.

Note: These settings do not impact the primal solution in any way, and thus are not visible while setting up primal simulations.

  • Restart Period increases solver robustness at the expense of higher computational cost per iteration. If the convergence of the adjoint solver is very good (for example it converges in just 4 iterations) it may be possible to reduce this parameter to reduce the total cost per sensitivity analysis.

  • Frozen Turbulence/Transition introduces the approximation that the turbulence/transition variables do not depend on the flow variables. The impact of this approximation on the accuracy of the sensitivities depends on the nature of the output. Outputs that depend mostly on pressure forces (for example lift) are less affected than outputs that depend on viscous effects (drag, heat flux, etc.). For simulations that use transition modeling, freezing turbulence also implies freezing transition. Finally, freezing turbulence is more effective for the SST turbulence model than the Spalart-Allmaras model, since the former has stronger non-linear terms in its equations.

  • Second-Order Damping Factor, increasing this value artificially reduces the importance of the second-order terms of the primal solver. Values of this parameter below 0.05 have a moderate impact on accuracy. This parameter is most effective for simulations of constant-density fluids.

Did this answer your question?