# Gradient-Based Aerodynamic Optimization of an Airfoil with Morphing Leading and Trailing Edges
## 2 Methodologies
### Mesh Deformation
The radial basis fitting exists if the weights \(\mathbf{\gamma}=(\gamma_{1},\cdots,\gamma_{N})^{\intercal}\) and the coefficients of the polynomials correction \(\mathbf{\beta}=(\beta_{1},\ \beta_{2})^{\intercal}\) can be evaluated such that the desired values \(g_{i}\) are obtained at source points:  
\[s(\mathbf{x}_{t_{i}}^{u})=g_{i}\quad i=1,\cdots,N \tag{14}\]  
and \(\mathbf{\gamma}\) also have to satisfy the orthogonality conditions as:  
\[\sum_{i=1}^{N}\gamma_{i}=\sum_{i=1}^{N}\gamma_{i}\mathbf{x}_{t_{i}}^{u}=\sum_{i=1} ^{N}\gamma_{i}\mathbf{z}_{t_{i}}^{u}=0 \tag{15}\]  
After collecting the desired values in vector \(\mathbf{g}=(g_{1},\cdots,g_{N})^{\intercal}\), the above radial basis fitting problem can be formulated in a linear system:  
\[\left[ \begin{array}{cc}\mathbf{M}&\mathbf{P}^{\intercal}\\ \mathbf{P}&\mathbf{0}\end{array} \right]\left\{ \begin{array}{cc}\mathbf{\gamma} \\ \mathbf{\beta}\end{array} \right\}=\left\{ \begin{array}{cc}\mathbf{g}\\ \mathbf{0}\end{array} \right\} \tag{16}\]  
where \(\mathbf{M}\) is the interpolation matrix defined as  
\[M_{ij}=\phi\Big{(}\left\|\mathbf{x}_{t_{i}}^{u}-\mathbf{x}_{t_{j}}^{u}\right\|\Big{)},\ \ 1\leq i,\ j\leq N\]  
and \(\mathbf{P}\) is a constraint matrix that consists of the first-order polynomial terms at the positions of source points. \[\mathbf{P}=\left[ \begin{array}{cccc}1&1&\cdots&1\\ \mathbf{x}_{t_{1}}^{u}&\mathbf{x}_{t_{2}}^{u}&\cdots&\mathbf{x}_{t_{N}}^{u}\end{array} \right] \tag{17}\]  
The coefficient vector \(\mathbf{\gamma}\) and \(\mathbf{\beta}\) can be solved as follows:  
\[\left\{ \begin{array}{c}\mathbf{\gamma}\\ \mathbf{\beta}\end{array} \right\}=\left[ \begin{array}{cc}\mathbf{M}^{-1}-\mathbf{ M}^{-1}\mathbf{P}^{\intercal}\mathbf{M}_{\mathbf{P}}\mathbf{P}\mathbf{M}^{-1}\\ \mathbf{M}_{\mathbf{P}}\mathbf{P}\mathbf{M}^{-1}\end{array} \right]\mathbf{g} \tag{18}\]  
where \(\mathbf{M}_{\mathbf{P}}=\left(\mathbf{P}\mathbf{M}^{-1}\mathbf{P}^{\intercal }\right)^{-1}\). Now the scalar value at arbitrary points \(\mathbf{x}\) can be evaluated by right-multiplying coefficient vector \(\mathbf{\gamma}\) and \(\mathbf{\beta}\) by an interpolation recover matrix \(\mathbf{A}_{r}\), which takes the form  
\[\mathbf{A}_{r}=\left\{ \begin{array}{cc}\phi\Big{(}\left\|\mathbf{x}-\mathbf{x}_{t_{ 1}}^{u}\right\|\Big{)}&\phi\Big{(}\left\|\mathbf{x}-\mathbf{x}_{t_{2}}^{u}\right\| \Big{)}&\cdots&\phi\Big{(}\left\|\mathbf{x}_{t_{N}}^{u}\right\|\Big{)}&1&\mathbf{x}^{ \intercal}\end{array} \right\} \tag{19}\]  
In a compact form, it yields  
\[s(\mathbf{x})=\mathbf{H}\mathbf{g}\]  
where \(\mathbf{H}=\mathbf{A}_{r}\Bigg{\{} \begin{array}{c}\mathbf{\gamma}\\ \mathbf{\beta}\end{array} \Bigg{\}}\). In this paper, the Wendland C4 function is selected as the kernel of RBF [29]:  
\[\phi(r)=\left\{ \begin{array}{cc}\big{(}35r^{2}+18r+3\big{)}(1-r)^{2}&0<r<r_{ \max}\\ 0&r_{\max}<r\end{array} \right. \tag{20}\]  
where \(r_{\max}\) is chosen based on the maximum distance \(d_{\max}\) between two adjacent mesh nodes such that \(r_{\max}=2d_{\max}\). The displacement field \(\mathbf{w}\) can be interpolated through vector \(v\) by right-multiplying matrix \(\mathbf{H}\). Subsequently, the coordinates \(\mathbf{x}_{k}^{m}\) on the deformed surface mesh can be resolved by \(\mathbf{x}_{k}^{m}=\mathbf{w}+\mathbf{x}_{k}^{u}\). In the second stage, the volume mesh is morphed using the equation of linear elasticity [30]. The new coordinates of the surface nodes are imported as an external file. The linear elasticity mesh deformation shows the efficiency and robustness, and can keep the topology of the volume mesh. When a large mesh deformation is required, the input displacements are divided into several sub-load steps, and the linear elastic problem is solved subsequently. In order to preserve the high resolution of the boundary layer of the volume mesh while propagating the mesh deformation, [PERSON]'s modulus of each mesh cell is set as inversely proportional to the cell volume. In other words, the smaller the cell volume, the larger the modulus, and vise versa.