# Added functionality for smoothing the sensitivity derivatives

requested to merge feature-adjoint-smoothed-sensitivity-map into develop

### Summary

Adjoint-based sensitivity maps can now be optionally smoothed using a Laplace-Beltrami operator.

When computing sensitivity maps on surface meshes generated from industrial geometries, the outcome might appear noisy, especially if a volume-to-surface approach is used for meshing, like the one utilised by snappyHexMesh. Even though the sensitivity map is technically correct, the noisy patterns that appear might make the extraction of useful information challenging. This new feature facilitates the interpretation of the sensitivity map in such cases.

### Details of new models

The sensitivity map can be smoothed using a Laplace-Beltrami operator of the form

\tilde{m} - \frac{\partial}{\partial x_j}\left[R^2\frac{\partial \tilde{m}}{\partial x_j}\right] = m

where \tilde{m} is the smoothed sensitivity map, m is the original sensitivity map and R a smoothing radius. The latter is computed as a multiple of the average 'length' of the boundary faces, if not provided by the user explicitly.

The above-mentioned equation is solved on the part of the surface mesh defined by the patches on which the sensitivity map is computed, using the finiteArea infrastructure of OpenFOAM.

If an faMesh is provided, it will be used; otherwise it will be created on the fly based on either an faMeshDefinition dictionary in system or one constructed internally based on the sensitivity patches.

From an optimisation point of view, this smoothing can alternatively be seen as computing the sensitivity derivatives \frac{\delta J}{\delta b_i} of the objective function J w.r.t. a different set of design variables b_i, i\in[1,N], defined as

x_i = x_i^{init} + \tilde{b_i} \\
\tilde{b_i} - \frac{\partial}{\partial x_j}\left[R^2\frac{\partial \tilde{b_i}}{\partial x_j}\right] = b_i

where x_i are the coordinates of the updated geometry and \tilde{b_i} a smooth displacement field. In other words, no loss of accuracy is incurred by the smoothing; instead, sensitivities are computed w.r.t. a different set of design variables.

### Examples

An example of a noisy sensitivity map and its smoothed variants using different R values is presented below, taken from the updated motorbike tutorial under

### Risks

No risks are foreseen. To enable the smoothing, the smoothSensitivities bool should be set to true, along with some optional entries.

   sensitivities
{
type                 surfacePoints;
patches              (motorBikeGroup);
includeSurfaceArea   false;
smoothSensitivities  true;
iters                2000;  // Optional, defaults to 500
}

Since the Laplace-Beltrami equation is solved using the finiteArea framework, faSchemes and faSolution should be present under system.

The smoothed sensitivity map is written in the smoothedSurfaceSens + adjointSolverName + sensitivityFormulation file, under the current time-step.

### References

The notion of sensitivity smoothing using a Laplace-Beltrami operator was used throught the seminal works of Antony Jameson. A reference can be found in

Vassberg J. C., Jameson A. (2006). Aerodynamic Shape Optimization Part I: Theoretical Background. VKI Lecture Series, Introduction to Optimization and Multidisciplinary Design, Brussels, Belgium, 8 March, 2006.

Edited by Vaggelis Papoutsis