# Interactive Airfoil Optimization Using Parsec Parametrization and Adjoint Method
## 4 Airfoil Optimization: Governing Equations and Implementation  
### Potential Flow and Panel Method  
For modeling the flow around an airfoil, the inviscid incompressible potential flow assumption was used. This assumption may be rather restrictive but allows the use of potential flow theory and the panel method described in [24]. The incompressibility condition may be weakened in this case by the fact that the optimization presented in Section 4 holds, as long as the Prandtl-Glauert compressibility correction rule is valid. According to [25], this can be stated for flows with \(Ma_{\infty}\leq 0.5\), although great caution should be taken when dealing with flows with \(Ma_{\infty}>0.4\) in this manner. To obtain the potential flow solution, the Hess-Smith panel method [20] was used. An explanation of the governing equations of potential flow theory, together with the theory and governing equations of the panel method, can be found in [20; 24]. After employing the equations from [20; 24], the lift coefficient (\(C_{y}\)) can be defined and rewritten in dimensionless variables (17); the definition of the dimensionless variables can be found in (18). \[C_{y}=-\oint_{l}\frac{1}{L}\Big{(}\gamma-\hat{u}^{2}-\hat{v}^{2}\Big{)}\cdot dx \tag{17}\]  
\[\hat{u}=\frac{u}{c_{\infty}},\qquad\hat{v}=\frac{v}{c_{\infty}},\qquad\hat{p}_ {\infty}=\frac{2\cdot p_{\infty}}{\rho\cdot c_{\infty}^{2}},\qquad\gamma=1+ \hat{p}_{\infty} \tag{18}\]  
For the easier derivation of the equations in the following sections, the chord length \(L\) can be factored out from the integral in (17) and transferred to the left side of the equation, yielding the relationship for the continuous cost function (19). \[I=L\cdot C_{y}=-\oint_{l}\Big{(}\gamma-\hat{u}^{2}-\hat{v}^{2}\Big{)}\cdot dx \tag{19}\]  
Now, it is possible to discretize the whole problem, including the governing harmonic equation for velocity potential, as presented in [24] and the cost function (19). The discrete version of the cost function is obtained simply by discretizing the integral in (19). To obtain the discretized flow equations, a Hess-Smith panel method [20] is used. The shape of the whole airfoil is discretized into many line segments (panels), leading to the panel method equations, as derived by [20]. The dependent variables \(\mathbf{w}\) in the optimization are the source on each panel and the circulation around the airfoil. The governing equations of the panel method are presented below, together with the discrete version of the cost function. The subscript i is the index of the panel. The panel numbering is shown in Figure 4.  
\[I=L\text{-}C_{y}=-\sum\limits_{i=1}^{N}\Big{(}\gamma-\hat{c}_{ti}^{2}\Big{)}\cdot \Delta x_{i} \tag{20}\]  
\[\Delta x_{i}=x_{i+1}-x_{i},\hskip 14.226378 ptx_{N+1}\equiv x_{1},\hskip 14.226378 pt \hat{c}_{ti}^{2}=\hat{u}_{i}^{2}+\hat{\varrho}_{i}^{2} \tag{21}\]  
\[\mathbf{A}\mathbf{w}=\mathbf{b},\hskip 14.226378 pt\mathbf{w}=[q_{1},\dots,q_{N},\Gamma]^{T} \tag{22}\]  
The exact definition of the elements of matrix \(\mathbf{A}\) and vector \(\mathbf{b}\) can be found in [20]. From that definition, it can be seen that the value \(c_{\infty}\) can be factored out of each term in the vector \(\mathbf{b}\), and the whole system of LAEs (22) can be divided by it, yielding Equation (23). \[\mathbf{A}\hat{\mathbf{w}}=\mathbf{\hat{b}},\hskip 14.226378 pt\hat{\mathbf{w}}=\frac{\mathbf{w}}{c_{ \infty}},\hskip 14.226378 pt\hat{\mathbf{b}}=\frac{\mathbf{b}}{c_{\infty}} \tag{23}\]  
The tangent velocity on each panel can be extracted directly using the panel method [20]. That relationship can then be divided by \(c_{\infty}\), yielding Equation (24), which can be substituted into the cost function (20). This last modification completes the arrangement of equations needed to derive the adjoint optimization. \[