# Gradient-Based Aerodynamic Optimization of an Airfoil with Morphing Leading and Trailing Edges
## 3 Results and Discussion  
The optimization framework described in the preceding section was applied to RAE 2822 airfoil in transonic, viscous flow, aiming at minimizing the drag for cruising at a constant lift coefficient of 0.725. The free-stream Mach number was 0.729, and the Reynolds number was \(6.5\times 10^{6}\). For the constraints, the maximum allowable volume variation was adapted by introducing an inflatable term \(k_{A}\) to control the shape deformation space and prevent unrealistic morphing shapes in the meantime. The general optimization problem is presented as follows:  
\[\begin{array}{ll}\underset{\boldsymbol{\alpha}}{\text{min}}&C_{d}\\ \text{subject to}&\psi_{\mathrm{b}}\in[\psi_{\mathrm{front}},\psi_{\mathrm{ rear}}]\\ &|\Delta Area/Area_{0}|\leq k_{A}\\ &C_{l}\equiv 0.725\\ &|\Delta L_{\mathrm{LE}}|=0\\ &\left|\Delta L_{\mathrm{TE,UpperSkin}}\right|=0\\ &|\Delta L_{\mathrm{TE,LowerSkin}}|/c=0.02\end{array} \tag{23}\]  
where \(\psi_{\mathrm{b}}\in[\psi_{\mathrm{front}},\psi_{\mathrm{ rear}}]\) indicates the wing-box region, \(Area_{0}\) is the volume of baseline airfoil, and \(\Delta Area\) is the variation of volume after morphing. The last three constraints introduce the skin length control, where \(\Delta L_{\mathrm{LE}}=0\) and \(\Delta L_{\mathrm{TE,UpperSkin}}\) limit the skin length of the entire leading edge and the upper skin of the trailing edge, respectively. While the lower skin length of trailing edge is allowed to lengthen or shorten about 2% of the chord, this can be achieved by the presence of specific sliding systems, hyper-elastic material, or lattice structure.  
An O-type-mesh adapted from the SU2 test cases is used in this paper with a distance to the far-field of 100 chord lengths. The hybrid mesh for the current simulation is created with structural quadrilateral mesh near the airfoil, where 108 points are distributed along the upper surface and 85 points along the lower surface with a total number of 192, and an unstructured triangular grid in the other field with total 22,842 cells. The initial wall-normal grid points are located at \(1.0\times 10^{-5}\) for a chord length, the corresponding \(y^{+}\approx 1\) in wall units.  
The baseline airfoil was first simulated on the compressible RANS with the S-A turbulence model. The flow solver automatically used a simple trim algorithm by adjusting the angle of attack (AoA) to achieve the target lift coefficient. The drag coefficient of the baseline airfoil is 129.38 counts (1 count = \(1.0\times 10^{-4}\)), and the corresponding AoA is 2.286 degrees.  
The RAE 2822 airfoil was then identified and projected from coordinates to CST design space, by means of the CST coefficient identification method with Bernstein polynomial order of 10.  
The optimizations were performed using the gradient-based _fmincon_ from MATLAB by choosing the active-set algorithm, which uses a sequential quadratic programming (SQP)technology and solves a quadratic programming (QP) sub-problem at each major iteration. The optimizer updates the Hessian matrix at each iteration utilizing the Broyden-Fletcher-Goldfarb-Shanno (BFGS) formula and then carries out a line search. A maximum line search step length of 0.02 was employed to control the magnitude of the design variables and avoid non-physical deformation of the airfoil. The optimization was terminated when the stopping criteria (step or function changing is less than tolerance of \(1.0\times 10^{-6}\)) were satisfied, or the maximum iteration limit of 50 was reached.  
In the following subsections, the gradient verification is shown first. Subsequently, three optimization cases are shown: morphing only the leading edge, then the trailing edge, and finally, the leading and trailing edges.