# Gradient-Based Aerodynamic Optimization of an Airfoil with Morphing Leading and Trailing Edges
## 2 Methodologies
### Gradient Evaluation  
The gradient with respect to the morphing airfoil design variables is obtained through sensitivities vector right multiplying by the geometric sensitivities. The geometric sensitivities matrix establishes the link between the morphing airfoil design variables and the movement of mesh nodes on the surface to be designed. For the morphing leading edge, the design variables are leading edge vertical position \(z_{\text{LE}}\), leading edge radius \(R_{\text{LE}}\), and \(2\times ml\) extra CST weighting coefficients \(\{A_{i}\}_{i=1,\ \cdots,ml}\) on each surface. For the morphing trailing airfoil, the design variables are trailing edge vertical position \(z_{\text{TE}}\), boat tail angle \(\beta\), and extra subset of CST weighting coefficients \(\{A_{i}\}_{i=n-1,\ \cdots,n-mt}\) with a total number of \(2\times mt\). In general, the design variables can be written in a general and compact form \(\mathbf{\alpha}=(\alpha_{1},\ \cdots\ \alpha_{m})^{\intercal}\).  
Assume applying an infinitesimal perturbation of a design variable \(\Delta\alpha_{j}\); the gradient of the function of interest \(f\) can be established by evaluating the surface integral on the surface \(\mathcal{S}\) being designed [36]:  
\[\frac{\text{d}f}{\text{d}\alpha_{j}}\approx-\sum_{i\in\mathcal{W}}\left\{ \frac{\partial f}{\partial\mathcal{S}}\right\}_{i}s_{i}\frac{\mathbf{n}_{i}^{ \intercal}\mathbf{u}_{ij}}{\Delta\alpha_{j}} \tag{21}\]  
where \(\mathcal{W}\) is the index set of mesh nodes on the surface \(\mathcal{S}\) to be designed, \(\left\{\frac{\partial f}{\partial\mathcal{S}}\right\}_{i}\) is the surface sensitivity at the mesh node with index \(i\in\mathcal{W}\), \(s_{i}\) is the area (length for 2D flow) of the control volume that surrounds node \(i\), \(\mathbf{n}_{i}\) is unit normal vector, and \(\mathbf{u}_{ij}\) is the displacement of node \(i\) after introducing the infinitesimal perturbation of design variable \(\Delta\alpha_{j}\). In this paper, the products of surface sensitivities and \(s\) are called sensitivities. Note that for the continuous adjoint solver, the normal direction points to inside the airfoil; hence, a positive surface sensitivity indicates that an inward perturbation of the surface leads to an increment of the objective function. However, the definition of sign convention in geometric sensitivity is the opposite to that of surface sensitivity. Hence, a minus sign is required in Equation (21).  
Moreover, the displacement \(\mathbf{u}_{ij}\) is obtained through finite-difference by employing small perturbations for the design variable \(\Delta\alpha_{j}\). The computational cost of generating the geometric sensitivities is negligible compared with the flow solver.  
Consequently, the gradient evaluation in this optimization framework yields  
\[\underbrace{\left\{\begin{array}{l}\frac{\mathrm{d}f}{\mathrm{d}\alpha_{j}}\\ \frac{\mathrm{d}f}{\mathrm{d}\alpha_{2}}\\ \vdots\\ \frac{\mathrm{d}f}{\mathrm{d}\alpha_{m}}\\ \end{array}\right\}_{\mathrm{Gradients}}=-\underbrace{\left[\begin{array}{ ccc}\frac{n_{1}^{\mathrm{T}}u_{11}}{\Delta\alpha_{1}}&\frac{n_{1}^{\mathrm{T}}u_{21}}{ \Delta\alpha_{1}}&\dots&\frac{n_{1}^{\mathrm{T}}u_{N1}}{\Delta\alpha_{1}}\\ \frac{n_{1}^{\mathrm{T}}u_{12}}{\Delta\alpha_{2}}&\frac{n_{1}^{\mathrm{T}}u_{ 22}}{\Delta\alpha_{2}}&\dots&\frac{n_{1}^{\mathrm{T}}u_{N2}}{\Delta\alpha_{2}}\\ \vdots&\vdots&\ddots&\vdots\\ \frac{n_{1}^{\mathrm{T}}u_{11}}{\Delta\alpha_{m}}&\frac{n_{1}^{\mathrm{T}}u_{ 22}}{\Delta\alpha_{m}}&\dots&\frac{n_{1}^{\mathrm{T}}u_{N1}}{\Delta\alpha_{m}} \\ \end{array}\right]}_{\mathrm{G Geometric\ Sensitivities}}\left\{\begin{array}{l}\frac{ \partial f}{\partial\mathcal{S}_{1}}s_{1}\\ \frac{\partial f}{\partial\mathcal{S}_{2}}s_{2}\\ \vdots\\ \frac{\partial f}{\partial\mathcal{S}_{N}}s_{N}\\ \end{array}\right\}_{\mathrm{Sensitivities}} \tag{22}\]