1 Introduction

Reducing aircraft’s specific fuel consumption (SFC) is of utmost importance in the 21st century, both for economical/operational and primarily for ecological compatibility reasons. One example is the goal for a reduction of 75% in \(\textrm{CO}_{2}\) per passenger kilometer emissions by 2050 when compared with the levels of 2000, which has been set by the Advisory Council for Aviation Research and Innovation in Europe (ACARE) [1], putting companies in a race for new technologies. Some methodologies for reducing the SFC are already in place, like the increased propulsion efficiency of high bypass ratio engines and the reduction in weight by using carbon fiber-reinforced materials and composites. Other options are still waiting to come out of the paper, like the open-rotor with contra-rotating propellers [2]. Natural laminar flow (NLF) design is one promising technology that may be implemented soon for larger aircraft extents to reduce the SFC.

The potential to reduce drag by achieving the laminar flow regime resides in the fact that the friction drag represents 40–60% of a high-subsonic airplane’s total drag [3], and this parcel is considerably affected by surface irregularities/quality [4, 5]. The use of such technology can reduce the total drag by 7–16% depending on the extent of the use, where the 16% mark requires a laminarization of 40% on the wings, vertical and horizontal stabilizers and nacelles [6, 7].

To maintain the NLF regime, many demands need to be fulfilled. From the geometrical consideration, we can mention the limited sweep angles for transition dominated by Tollmien–Schlichting (TS) waves and the requirement of favorable pressure gradient [6, 8,9,10,11,12], the limitation of airfoils’ nose-radius due to the attachment-line instability [13, 14], high-lift compatibility (Krüger flaps) for performance and/or insect shielding [5, 15,16,17]. The demands for surface quality, i.e., roughness, rivets excrescences, gaps, steps, and waviness [18,19,20,21,22], and finally, from the operational standpoint, the conditions for in-flight contamination, anti-ice maintainability, free stream turbulence levels, noise, and vibration [23,24,25,26,27,28].

During the 80 and 90s, many companies performed experimental (wind-tunnel and in-flight) tests to assess the performance gains of laminar flow designs, N-factor correlations, maintainability, and the requirements mentioned previously. As examples of these tests, we cite here the ELFIN I and II investigations and the LARA, ATTAS, HYDA, HYLTEC, and ALTTA flight test programs [11, 29,30,31,32,33,34]. All these tests showed that it is possible to obtain significant laminar flow over aerodynamic surfaces, even though some of them had used gloves to perform the investigations.

Although using modern technology, manufacturers can provide smooth surfaces suitable for maintaining NLF, excrescences are unavoidable during the assembly and construction of such geometries. These excrescences, such as waviness, gaps, and steps, can change the transition location (compared to a smooth surface), affecting the NLF design’s performance. Thus, manufacturers need to know the allowable size of surface irregularities that do not lead to a sudden transition to turbulence. There is substantial literature concerning criteria for the allowable size of surface irregularities regarding the transition; here, we cite the works of Fage [35] with empirical relations to find allowable sizes of bulges, hollows, and ridges on a flat plate, Carmichael [18] that using experimental data, proposed an empirical formula that gives the maximum height of waviness (for a specific Reynolds number, wavelength of surface waviness, and chord length) to maintain full-chord NLF in the presence of suction, Crouch [36] which proposed two correlations concerning the TS type of instabilities for forward and backward facing steps capable of informing the resulted \(\Delta {N}\) in the envelope curve, and Perraud [37] proposing criteria concerning cross-flow instabilities. Wie and Malik [38], based on their numerical calculations, presented an empirical equation which predict the change in N-factor due to geometrical parameters of waviness (number of waves, height, wavelength) and Reynolds number. The reader is referred to these works for more detailed information.

This work presents a physics-based numerical framework to find manufacturing tolerances for smooth waviness on NLF surfaces. To find these tolerances, the critical waviness profile which affects the transition should be found. Such a waviness profile can be found by solving an optimization problem using gradient-based methods. Here, we use the approach by Amoignon et al. [39] to find the gradients of energy of perturbations inside the boundary layer with respect to surface deformation using an adjoint-based method. The largest allowable surface deformation with minimum \(L2-\)norm, causing a specific increase in the amplification of disturbances, is found by solving an unconstrained optimization problem using the gradient ascent method and a constrained problem using the sequential least squares programming (SLSQP) algorithm.

The initial part of the paper describes the computation of the gradients (sensitivities) of perturbation energy with respect to surface deformation. The methodology to find the gradients are presented in Sect. 2, with the corresponding governing equations introduced in Sect. 2.2. Sensitivity analysis, including definitions of the objective function and design variables, and gradient calculation are described in Sect. 2.3. The airfoil and the setup used in this work are introduced in Sect. 2.4, and methods to compute the manufacturing tolerances are described in Sect. 2.5. The results are presented in Sect. 3 with the gradient validation in Sect. 3.1, and results concerning the manufacturing tolerances in Sects. 3.4 and 3.5. Finally, conclusions are presented in Sect. 4.

2 Methodology

2.1 Overview of sensitivity calculation

As mentioned in the introduction, the goal of this work is to find the gradient of the energy of perturbations to surface deformation. To reduce the computational cost, we follow Amoignon et al. [39] and consider the viscous boundary layer flow and the inviscid outer flow separately. A schematic of the steps toward finding the gradient is shown in Fig. 1. Below, an overview of these steps is given, and the details will be provided in the following sections.

The first step is to find the pressure distribution \((C_p)\) on the airfoil surface by solving Euler equations. For this, we have used the ADflow code [40], which is a 3D structured compressible Euler and RANS finite-volume solver. To increase the robustness of the solver, we have used the approximate Newton–Krylov solver implemented in ADflow [41]. The corresponding governing equations for this step are covered in Sect. 2.2.1.

After finding the pressure distribution, we used an in-house compressible boundary layer solver to solve the boundary layer equations (BLE) (using the \(C_p\) found in the previous step) and to find the mean flow quantities inside the boundary layer, which will be used in the next step. The corresponding BLE are given in Sect. 2.2.2.1.

The next step is to solve stability equations inside the boundary layer, for which we have used compressible parabolized stability equations (PSE) to account for compressibility, surface curvature, and non-parallel effects inside the boundary layer. To solve PSE, we have used the NOLOT code [42]. We also need to specify the perturbation mode following the methodology explained in Sect. 2.3. The corresponding governing equations are discussed in Sect. 2.2.2.2.

After solving all direct equations (Euler, BLE, and PSE), we will solve adjoint equations in the reverse order, i.e., firstly adjoint of PSE (APSE), then adjoint of the BLE (ABLE), and finally adjoint of Euler equation (AdEuler), to get the gradients. To solve APSE and ABLE, we have used in-house codes [43], and AdEuler is solved using the open-source code ADflow [40, 44]. The following sections give the governing equations and further details about each step.

Fig. 1
figure 1

Flowchart for calculating the gradient

2.2 Governing equations

2.2.1 Inviscid region: Euler equations

The inviscid flow around the airfoil is computed using the Euler equations which in the compact form can be written as

$$\begin{aligned}{} & {} \nabla \cdot (\rho {\textbf {U}})=0, \end{aligned}$$
(1)
$$\begin{aligned}{} & {} \nabla \cdot (\rho {\textbf {U}} {\textbf {U}}^T)+\nabla p =0, \end{aligned}$$
(2)

and

$$\begin{aligned} \nabla \cdot [{\textbf {U}}(E_{total}+p)] =0. \end{aligned}$$
(3)

In these equations, \(\rho \) is density, \({\textbf {U}}=[U,V,W]\) is the velocity vector in the inviscid region with UV and W being its Cartesian components, p is the pressure and \(E_{total}\) the total energy per unit volume, which is the sum of internal and kinetic energies of the flow. Under the assumption of an ideal and perfect gas, we can write

$$\begin{aligned} E_{total}= \frac{p}{\gamma -1} + \frac{1}{2} \rho {\textbf {U}}^2, \end{aligned}$$
(4)

where \(\gamma \) is the specific heat ratio of the gas.

2.2.2 Viscous region

The total flow inside the boundary layer can be decomposed into the mean and disturbance flow quantities as

$$\begin{aligned} {\textbf {q}}_{total}(x_1,x_2,x_3,t)=\bar{{\textbf {q}}}(x_1,x_3)+\tilde{{\textbf {q}}}(x_1,x_2,x_3,t). \end{aligned}$$
(5)

In this equation, \(\bar{{\textbf {q}}}\) and \(\tilde{{\textbf {q}}}\) are mean flow and disturbance quantities, and \(x_1, x_2,\) and \(x_3\) are streamwise, spanwise, and wall-normal directions in an orthogonal curvilinear coordinate system, respectively (shown in Fig. 3). In an orthogonal curvilinear coordinate system, under an infinite swept wing, a length element (ds) is defined by \(ds^2 = (dx_1)^2+(dx_2)^2+(dx_3)^2\).

2.2.2.1 Boundary layer equations The quasi-3D non-dimensional compressible boundary layer equations on a swept wing with an infinite span \(({\partial }/{\partial x_2}=0)\), in an orthogonal curvilinear coordinate system, are given by Eqs. (6)–(9). Except for the pressure, the flow and material quantities are made non-dimensional based on chord length, c, and free-stream quantities. Pressure is made non-dimensional with twice the dynamic pressure of the free stream.

$$\begin{aligned}&\displaystyle \frac{\partial (\bar{\rho }\bar{u})}{\partial {x_1}}+\frac{\partial (\bar{\rho }\bar{w})}{\partial {x_3}}=0 \end{aligned}$$
(6)
$$\begin{aligned}&\displaystyle \bar{\rho } \bar{u}\frac{\partial \bar{u}}{\partial {x_1}}+\bar{\rho }\bar{w}\frac{\partial \bar{u}}{\partial {x_3}}=-\frac{d\bar{p}_e}{dx_1}+\frac{1}{Re}\frac{\partial }{\partial x_3}\left( \bar{\mu }\frac{\partial \bar{u}}{\partial x_3}\right) \end{aligned}$$
(7)
$$\begin{aligned}&\displaystyle \bar{\rho } \bar{u}\frac{\partial \bar{v}}{\partial {x_1}}+\bar{\rho }\bar{w}\frac{\partial \bar{v}}{\partial {x_3}}=\frac{1}{Re}\frac{\partial }{\partial x_3}\left( \bar{\mu }\frac{\partial \bar{v}}{\partial x_3}\right) \end{aligned}$$
(8)
$$\begin{aligned} \bar{c}_p\bar{\rho } \bar{u}\frac{\partial \bar{T}}{\partial {x_1}}+\bar{c}_p\bar{\rho }\bar{w}\frac{\partial \bar{T}}{\partial {x_3}}= & {} \frac{1}{RePr}\frac{\partial }{\partial x_3}\left( \bar{\kappa }\frac{\partial \bar{T}}{\partial x_3}\right) \nonumber \\{} & {} +\,(\gamma -1)M^2 \left\{ \bar{u}\frac{d \bar{p}_e}{dx_1} + \frac{\bar{\mu }}{Re}\left[ \left( \frac{\partial {\bar{u}}}{\partial x_3}\right) ^2+\left( \frac{\partial {\bar{v}}}{\partial x_3}\right) ^2\right] \right\} \end{aligned}$$
(9)

In these equations, [uvw] are streamwise, spanwise, and wall-normal velocities, respectively, T is temperature, and \(\rho \) is density. Reynolds number, Mach number, and Prandtl number are defined as \(Re={c u_\infty }/{\nu _\infty }\), \(M={u_\infty }/{\sqrt{\mathcal {R} \gamma T_\infty }}\), and \(Pr={\bar{c}_p \bar{\mu }}/{\bar{\kappa }}\), respectively, where c is chord length, \(u_\infty \), \(\nu _\infty \), and \(T_\infty \) are free-stream velocity, kinematic viscosity, and temperature, respectively. \(\mathcal {R}\) is specific gas constant, \(\bar{c}_p\) specific heat at constant pressure, \(\gamma \) specific heat ratio, \(\bar{\mu }\) dynamic viscosity, and \(\bar{\kappa }\) is heat conductivity. Also, \(p_e\) is the pressure at boundary layer edge, which under the boundary layer assumptions \((p=p_e(x_1))\), is related to \(\rho \) and T through the equation of state as

$$\begin{aligned} \gamma M^2 \bar{p}_e = \bar{\rho }\bar{T}. \end{aligned}$$
(10)

The streamwise pressure gradient can also be written as

$$\begin{aligned} \frac{d \bar{p}_e}{dx_1}=-\bar{\rho }_e \bar{u}_e \frac{d \bar{u}_e }{dx_1}, \end{aligned}$$
(11)

where \({\rho }_e\) and \({u}_e\) are density and streamwise velocity measured at the edge of boundary layer, respectively.

2.2.2.2 Disturbance equations We decomposed the disturbances into time- and spanwise periodic waves as

$$\begin{aligned} \tilde{{\textbf {q}}}(x_1,x_2,x_3,t)=\hat{{\textbf {q}}}(x_1,x_3)\Theta (x_1,x_2,t), \end{aligned}$$
(12)

where the wave function, \(\Theta \), is defined as

$$\begin{aligned} \Theta (x_1,x_2,t) = \exp {\left( i \left\{ \int _{x_s}^{x_1} \alpha (x')dx'+\beta x_2 - \omega t \right\} \right) }. \end{aligned}$$
(13)

In Eq. (13), \(\alpha \) is the complex-valued streamwise wavenumber, \(\beta \) is the real-valued spanwise wavenumber, and \(\omega \) is the real-valued disturbance angular frequency. Disturbances start to grow from the streamwise location \(x_s\) (shown in Fig. 3). Assuming boundary layer approximations, there is a scale separation between the weak variation in \(x_1\) and strong variation in \(x_3\) directions, as well as between wall-normal and streamwise mean velocity components. By applying these assumptions and introducing the ansatz (12) into the governing equations, a set of nearly parabolic equations, called parabolized stability equations (PSE) [45], will be obtained, which can be written, in symbolic notation, as

$$\begin{aligned} \mathcal {A}\hat{{\textbf {q}}}+ \mathcal {B}\frac{\partial \hat{{\textbf {q}}}}{\partial x_3} + \mathcal {C}\frac{\partial ^2 \hat{{\textbf {q}}}}{(\partial x_3)^2}+\mathcal {D} \frac{1}{h_1} \frac{\partial \hat{{\textbf {q}}}}{\partial x_1}={\textbf {0}}, \end{aligned}$$
(14)

where \(\hat{q} \in [\hat{\rho },\hat{u},\hat{v},\hat{w},\hat{T}]^T\), \((h_1)^2 = (\frac{\partial X}{\partial x_1})^2 + (\frac{\partial Y}{\partial x_1})^2 + (\frac{\partial Z}{\partial x_1})^2\), and XY,  and Z are the Cartesian coordinates. The matrices \(\mathcal {A}, \mathcal {B}, \mathcal {C}\) and \(\mathcal {D}\) are large \(5 \times 5\) matrices which can be found in Ref. [43]. In PSE formulation, both the amplitude \(\hat{{\textbf {q}}}\) and wave function depend on \(x_1\). To remove this ambiguity, and also, to guarantee that variations of \(\hat{{\textbf {q}}}\) in \(x_1\)-direction remain small allowing to neglect the higher-order streamwise derivatives, a so-called auxiliary condition [46, 47] is used as

$$\begin{aligned} \int _{0}^{+\infty } \hat{{\textbf {q}}}^H \frac{\partial \hat{{\textbf {q}}}}{\partial x_1}dx_3 = 0. \end{aligned}$$
(15)

Here, superscript H denotes complex conjugate transpose. Equation (14) is integrated downstream with an initial condition at \(x_1=x_s\) given by local stability theory, and at each streamwise location \(x_1\), the value of \(\alpha \) is iterated until the auxiliary condition is satisfied. After finding all the disturbance quantities \(\hat{{\textbf {q}}}\) and streamwise wavenumber \(\alpha \) at all \(x_1\) stations, the perturbation kinetic energy \(\hat{E}\) and spatial growth rate \(\sigma \) can be found as

$$\begin{aligned} \hat{E}=\int _{0}^{+\infty } \bar{\rho }( |\hat{u}|^2 + |\hat{v}|^2 +|\hat{w}|^2) dx_3, \end{aligned}$$
(16)

and

$$\begin{aligned} \sigma =-\alpha _i+\frac{\partial }{\partial x_1}\left( \ln (\sqrt{\hat{E}})\right) , \end{aligned}$$
(17)

where \(\alpha _i\) is the imaginary part of \(\alpha \). Finally, with the growth rate, the N-factor, which is a measure of integrated growth of perturbations, can be calculated as

$$\begin{aligned} N=\int _{x_{n1}}^{x} \sigma dx_1, \end{aligned}$$
(18)

where \(x_{n1}\) is the lower branch of the neutral curve, where disturbance amplification starts \((\sigma = 0)\). The N-factor (or growth rate) can then be used in the \(e^N\) method [48] to predict the transition location. The combination of Euler, boundary layer, and PSE codes allows a stability analysis of the boundary layers over a given wing section. In what follows we present the procedure to obtain the sensitivity of disturbance energy with respect to surface waviness.

2.3 Sensitivity analysis

This work aims to use gradient-based optimization to find the surface waviness profile with a minimum \(L2-\)norm that causes a specific increase in the amplification of perturbations. Therefore, the objective function J should be a measure of the growth of perturbations in the domain. Here, the kinetic energy of a specific disturbance \(E_1\), integrated over a selected region, has been chosen for this measure as the objective function [39]. This can be formulated as

$$\begin{aligned} J(\tilde{{\textbf {q}}},{\textbf {X}})=E_1(\tilde{{\textbf {q}}},{\textbf {X}})= \frac{1}{2}\int _{x_s}^{x_f}\int _{z_0}^{z_1}\int _{0}^{+\infty }( |\tilde{u}|^2 + |\tilde{v}|^2 +|\tilde{w}|^2)dx_3dx_2dx_1, \end{aligned}$$
(19)

where \({\textbf {X}}\) is the vector of nodal coordinates, and \([x_s,x_f]\) is the region where the perturbation exists. The amplitudes of disturbances, which are used to calculate the objective function, are the solutions of the PSE [Eq. (14)] for a specific mode, which is determined by \(\alpha (x_s)\), \(\beta \), and \(\omega \). Here, by computing the envelopes of N-factor curves, we have found the most amplified mode among a wide range of modes with different \(\omega \) and \(\beta \), and we have used the disturbance amplitudes of that mode to compute the objective function.

To optimize the objective function (J) with respect to design variables, which here are taken as all surface grid points and are denoted by \({\textbf {z}}\), using gradient-based method, we need to calculate the sensitivity (gradient) of the objective function with respect to the same design variables, which is denoted by \(\nabla _z J\). As mentioned in the introduction, we have used the adjoint method to calculate the gradients efficiently. For adjoints of BLE and PSE, we have used a continuous approach similar to Amoignon et al. [39] and Pralits et al. [43], where the adjoint equations and their derivations can also be found. For adjoint of Euler equations, we have used the discrete adjoint implementation in the ADflow [44].

2.4 Flow case

The NLF(2)-0415 airfoil [49] designed for commuter aircraft applications was chosen for the analysis in this work (Fig. 2). The airfoil is designed for natural laminar flow, and it is thus interesting to evaluate how surface waviness may degrade the boundary layer stability characteristics. Here, the flight conditions are: \(M_{\infty } = 0.5\), \(Re = 6 \times 10^{6}\), and \(AoA = 1.25^{\circ }\). Also, thermodynamic properties of the air were calculated for an altitude of 9600m.

Fig. 2
figure 2

NLF(2)-0415 airfoil

The computational domain for solving Euler equations, as well as the angle of attack (AoA), and the beginning (\(x_s\)) and end (\(x_f\)) of the region on airfoil used for stability analysis and optimization are shown in Fig. 3. A farfield boundary condition is set around the domain and a no-penetration boundary condition is used on the airfoil. Since ADflow is a 3D CFD solver, we have extruded the domain in the spanwise direction with 1 volume cell, and at the two sides of the domain, a symmetry boundary condition is used. A C-type structured grid with 1198 grid points (598 volume cells) on the airfoil surface and 69,201 total volume cells has been generated using the Construct2D mesh generator code [50]. In Fig. 3, the generated mesh around the airfoil is shown. It should be noted that for the purpose of validation of adjoint implementation, as will be discussed in Sect. 3.1.1, a mesh with 792 grid points (395 volume cells) on the airfoil has been used to reduce the computational cost of validation process; however, the finer grid (with 1198 grid points on the surface) has been used for all other simulations carried out in this work.

Fig. 3
figure 3

Computational domain (a), generated mesh (b). The region between \(x_s\) and \(x_f\) is used for stability analysis and optimization

2.5 Algorithms for finding the manufacturing tolerances

To find the manufacturing tolerances, we need to find the largest allowable waviness profile with minimum \(L2-\)norm of surface deformations that might cause early transition due to the existence of waviness on the airfoil. Such a waviness profile means that no other surface deformation with the same \(L2-\)norm will cause surface-induced transition at a particular position of the chord, and manufacturing tolerances can be computed once we have found this waviness profile. Here, this profile is found by solving an optimization problem (unconstrained or constrained) using gradient-based methods, where in this work, the adjoint method is used to find the gradients as explained earlier.

Two optimization problems are solved to determine the allowable wavy profiles: an unconstrained optimization problem using gradient ascent (GA) method, and a constrained optimization problem using the sequential least squares programming (SLSQP). The reasons for these choices are the capability of finding the optimum solution, i.e., the largest allowable deformation profiles by the SLSQP approach, and the time-saveFootnote 1 benefit of the GA approach at the cost of not obtaining the optimum solution, but something that is close to it. In the following, these two optimization problems and the algorithms to solve them will be explained.

2.5.1 Gradient ascent

The idea behind the approach is shown in Fig. 4. First, using the stability tools, i.e., NOLOT code, we find the growth history of the most unstable mode over the airfoil, described by the N-factor curve, which is used in our algorithm as a monitoring quantity. Then, an allowable increase in the maximum value of N-factor, denoted by \(\Delta {N}\), is chosen based on the critical value of N used in the design of the NLF airfoil. After choosing \(\Delta {N}\), by taking small steps in the direction of the gradient of E, we will find the waviness profile that increases the maximum value of N-factor by \(\Delta N\) units. Note that there is no objective function to be minimized in this case.

Fig. 4
figure 4

Algorithm to find the waviness profile for a target \(\Delta N\) using gradient ascent method

As mentioned earlier, the sensitivity of kinetic energy with respect to surface grid points (\(\nabla _z E({\textbf {z}})\)) for the baseline airfoil is found using the steps shown in Fig. 1. The waviness profile is found using the gradient ascent method, which can be written as

$$\begin{aligned} {\textbf {z}}_{n+1} = {\textbf {z}}_{n}+\gamma \frac{\nabla _z E({\textbf {z}}_n)}{max|\nabla _z E({\textbf {z}}_n)|}, \end{aligned}$$
(20)

where \({\textbf {z}}_{n}\) is the vector of airfoil’s surface nodal vertical coordinates at iteration n, and \(\gamma \) is a sufficiently small step size. It should be noted that at each iteration, the step that we take in the direction of the gradient is \(\frac{\gamma }{max|\nabla _z E({\textbf {z}}_n)|}\). This results in an optimal deformation in a local sense, as the gradient shows the direction of maximal increase of E for each iteration; however, as will be shown later, such local optima does not lead to an optimal deformation in a global sense after several iterations.

The input for the algorithm, which is also the convergence criteria, is the expected value for \(\Delta {N}\). As it will be explained in the next section, we project the gradient onto a specified waviness profile and take a sufficiently small step in the gradient direction and find the new waviness profile. Then, the algorithm updates the geometry and the grid using the IDWarp package [51] to solve all the direct and adjoint equations for the newly updated airfoil and finds the new gradient. Subsequent iterations are performed until the convergence criteria \(\Delta {N}\) is achieved.

Another important point is that since at iteration \(n+1\), the shape of the airfoil has been changed, the most amplified disturbance mode inside the boundary layer may change. So, as an option, it is possible in the algorithm to find the most unstable mode for the corresponding airfoil at each iteration and solve all equations based on the newly updated mode.

2.5.2 Gradient projection

The wavelengths of possible waviness on airfoils are usually dictated by manufacturing process and their inner structure, especially for composite panels, and by induced deformations due to the application of thousands of rivets on the surface panels. Thus, it is more practical if we limit the possible wavelengths of the waviness on the airfoil. This can be done by projecting the gradient onto a specific basis. Considering that at each iteration, we have projected the gradient onto a basis of k sine Fourier modes as

$$\begin{aligned} (\nabla _z E)_{pr} = \sum _{n=1}^{k} \left[ b_n sin \left( \frac{n \pi (\varvec{x_1}-x_s)}{x_f-x_s} \right) \right] , \end{aligned}$$
(21)

where the coefficient of each Fourier mode, \(b_n\), is calculated as

$$\begin{aligned} b_n = \frac{2}{x_f-x_s}\int _{x_s}^{x_f} \nabla _z E (x) sin \left( \frac{n \pi (\varvec{x_1}-x_s)}{x_f-x_s} \right) dx, \end{aligned}$$
(22)

where \(\varvec{x_1}\) is the vector of surface nodal coordinates along the chord. We have chosen the Fourier sine basis instead of the complete Fourier series because it enforces that the displacements at the extremes of the function are always zero, i.e., there will be no forward- or backward-facing steps on the airfoil. For the NLF(2)-0415 used in this work, \(x_{s}=8\%\) and \(x_{f}=70\% \) of the chord. After projecting the gradient, we use (\(\nabla _z E)_{pr}\) in the algorithm.

2.5.3 SLSQP

As mentioned before, using the gradient ascent method, there is no guarantee that the profile we obtain by marching in the gradient direction is the profile with minimum \(L2-\)norm leading to the specified \(\Delta {N}\). To solve this issue, a constrained optimization problem can be solved to ensure the profile with minimum \(L2-\)norm that will increase the maximum value of N-factor by \(\Delta N\) units is obtained. For this, we parameterize the surface using k sine Fourier bases, which also determines the minimum wavelength of waviness on the surface as

$$\begin{aligned} {\textbf {z}} = {\textbf {z}}_0 + \sum _{n=1}^{k} \left[ b_n sin \left( \frac{n \pi (\varvec{x_1}-x_s)}{x_f-x_s} \right) \right] . \end{aligned}$$
(23)

Then, the Fourier coefficients, \(b_n\), are considered as design variables and they are found as the solution to the following optimization problem:

$$\begin{aligned} \min _{\Delta z \in \mathbb {R}}&\qquad J = {\Delta z_1}^2+{\Delta z_2}^2+ \cdots + {\Delta z_{np}}^2 \nonumber \\ \text {w.r.t.}&\qquad b_1, b_2, \ldots , b_k \nonumber \\ \text {s.t.}~~&\qquad E = E_{target} = E_R E_0. \nonumber \\ \end{aligned}$$
(24)

Here, J is the objective function that represents the \(L2-\)norm of the deformations, \(\Delta z_i=z_i - z_{0,i}\) is the vertical surface deviation of the ith node on the surface, np is the number of surface grid nodes to be modified, E is the kinetic energy of disturbances in the boundary layer, \(E_{target}\) is the target kinetic energy of disturbance in the boundary layer which corresponds to a specific \(\Delta N\), \(E_0\) is the kinetic energy of disturbances in the boundary layer for the clean baseline airfoil, and \(E_R=\frac{E_{target}}{E_0}\). This optimization problem is solved using the sequential least squares programming (SLSQP) algorithm from the SciPy [52] library. The SLSQP algorithm is based on Kraft’s work [53] and determines a local search direction by solving the second-order local approximation of the cost function that satisfies the constraints [54]. To solve (24) using SLSQP, the gradients of the objective function and constraint with respect to design variables, i.e., \(\frac{\textrm{d}J}{\textrm{d}b_k}\) and \(\frac{\textrm{d}E}{\textrm{d}b_k}\), are needed. \(\frac{dJ}{db_k}\) can be found analytically, using the chain rule, from the definition of the objective function in (24) and parameterization of the surface (23) as

$$\begin{aligned} \frac{\textrm{d}J}{\textrm{d}b_k}=\frac{\textrm{d}J}{\textrm{d}z} \frac{\textrm{d}z}{\textrm{d}b_k}. \end{aligned}$$
(25)

Also, \(\frac{\textrm{d}E}{\textrm{d}b_k}\) can be calculated, using the chain rule, from gradients of the kinetic energy of perturbation with respect to surface deformation \(\frac{\textrm{d}E}{\textrm{d}z}\), which is obtained from the adjoint method, and \(\frac{\textrm{d}z}{\textrm{d}b_k}\) as

$$\begin{aligned} \frac{\textrm{d}E}{\textrm{d}b_k}=\frac{\textrm{d}E}{\textrm{d}z} \frac{\textrm{d}z}{\textrm{d}b_k}. \end{aligned}$$
(26)

Once \(\frac{\textrm{d}J}{\textrm{d}b_k}\) and \(\frac{\textrm{d}E}{\textrm{d}b_k}\) are calculated, they are passed to the optimizer and the optimal values for design variables, \(b_k\), are found and then the waviness profile is reconstructed using Eq. (23). Here, it should be noted that one of the major differences of this approach compared to gradient ascent is that in the gradient ascent approach, the input and stopping criteria of the algorithm is the target \(\Delta N\). Although the algorithm marches in the direction of the gradient of the kinetic energy of perturbations, at each iteration, the value of \(\Delta N\) is monitored until we reach the desired value. In the SLSQP approach, on the other hand, we cannot use target \(\Delta N\) as the constraint (since we calculate the gradient of kinetic energy, not N-factor with respect to surface deformation), and also we need to pass the gradient of constraint with respect to the design variables to the optimizer. Thus, we need to correlate the target \(\Delta N\) with its corresponding kinetic energy of the domain (\(E_{target}\)). This can be done using trial and error by choosing a specific \(E_{target}\) and checking the resulting \(\Delta N\), or can be approximated from the results of gradient ascent method.

3 Results

3.1 Computing sensitivity

For validation purposes, we have chosen an unstable mode with \(\beta =0\), \(\alpha _{x_s}=600\) \([m^{-1}]\), and frequency (f) equal to 5850Hz. For such conditions, the pressure distribution on the NLF(2)-0415 airfoil together with its N-factor envelope (on the upper surface) are shown in Fig. 5 and the sensitivity (gradient) of the objective function (calculated with adjoint method) is shown in Fig. 6.

Fig. 5
figure 5

Pressure coefficient (\(C_{p}\)) and N-factor envelope curve for the upper surface of the airfoil. \(M_{\infty }=0.5\), \(AoA=1.25^{\circ }\) and \(Re = 6 \times 10^6\)

Fig. 6
figure 6

Sensitivity of objective function (calculated with adjoint method) w.r.t surface deformation for the upper surface of the airfoil as a function of chord length. \(M_\infty =0.5\), \(Re=6 \times 10^6\), and \(AoA=1.25^ \circ \) with \(f=5850\)Hz, \(\beta =0\), and \(\alpha _{x_s}=600\) \([m^{-1}]\)

3.1.1 Gradient validation

To validate the implementation of the adjoint method, we have compared gradients obtained from the adjoint method with gradients calculated using a central finite difference scheme as given by

$$\begin{aligned} \frac{\partial J}{\partial g_{k}} \approx \frac{J({\textbf {q}}({\textbf {z}}+\Delta {{\textbf {z}}}), {\textbf {z}}+ \Delta {{\textbf {z}}}) - J({\textbf {q}}({\textbf {z}}-\Delta {{\textbf {z}}}), {\textbf {z}}- \Delta {{\textbf {z}}})}{2\Delta {g_k}}. \end{aligned}$$
(27)

In Eq. (27), J is the objective function, \({\textbf {q}}\) is the state vector (velocity components, pressure, and energy), \({\textbf {z}}\) is the surface nodal coordinate vector of the clean airfoil, \(g_k\) is the \(k^{th}\) design variable, and \(\Delta {{\textbf {z}}}\) is the vector of surface deformation (as a result of \(\Delta g_k\)). To calculate the gradients using the finite difference method (FD), in Eq. (27), we must specify \(g_k\) and the corresponding \(\Delta {{\textbf {z}}}\). As mentioned earlier, the design variables in the adjoint method are all surface grid points. Thus, to compare the gradients from two different methods, choosing the same design variable for FD seems to be a good choice, i.e., disturbing one point of the surface mesh grid at a time \((g_k = z_k\) and \(\Delta {{\textbf {z}}} = \Delta {g_k} \hat{e}_z)\). However, this often leads to inaccurate and noisy gradients due to the sharp edges created in the mesh, particularly when solving the flow field with the Euler equations or any potential method. This happens because the absence of the boundary layer does not smooth the changes in pressure distribution, which can lead to such oscillations. The option used here is to parameterize the surface using the so-called Hicks–Henne Bump Functions (HHBFs) and find the gradients with respect to a specific control parameter. HHBFs are smooth bump functions introduced by Hicks and Henne [55] and are used in aerodynamic shape optimization applications to smoothly modify the shape of the airfoils. They have the analytical definition given by

$$\begin{aligned} f_{i}({\textbf {x}},a,h,t) = a_i\left[ sin \left( \pi {\textbf {x}}^{\frac{log (0.5)}{log (h_i)}} \right) \right] ^{t_i}=a_if_{0,i}({\textbf {x}},h,t), \end{aligned}$$
(28)

where x is the vector of x-coordinates of grid points on the airfoil, and for the ith bump, \(a_i\) is the maximum height of the bump, \(h_i\) is the x location (based on the chord) where the height of the bump is maximum, and \(t_i\) controls the width of the bump. For each set of parameters a, h, and t, the value of HHBF is calculated for all points in \({\textbf {x}}\). The parameterized geometry using HHBFs can be written as

$$\begin{aligned} z = z_{0} + \sum _{i=1}^{N} a_if_{0,i}({\textbf {x}},h,t), \end{aligned}$$
(29)

where z is the parameterized and \(z_{0}\) the baseline airfoil geometry, and N the number of HHBFs used to modify the geometry. In Fig. 7, several HHBFs for different values of parameter t (in each panel) and for different values of parameter h (each color) are shown.

Fig. 7
figure 7

Hicks–Henne bump functions for different width (t) and location for maximum amplitude (h) parameters, all with \(a=1\) (colour figure online)

To validate gradients, in Eq. (27), we have chosen the maximum height of the bump, a, as the design variable, and we deform the airfoil with HHBF, i.e., \(g_k = a_k\) and \( \Delta {\textbf {z}}=\Delta a_k f_{0,k}({\textbf {x}},h,t)\hat{e}_z\).

It should be mentioned that we need to change the position of the bump (using the parameter h), along the surface, and for each position of the bump, the geometry and grid should be updated. To update the geometry and the mesh, we have used the IDWarp package [51], which uses an inverse distance method to modify the location of mesh volume nodes given a perturbation of the surface nodes. Also, as expected for FD methods, we need to be sure that the step size we are using (here \(\Delta a\)) is not too small or too large to have a balance between truncation and cancellation errors. Thus, we need to do all calculations for different step size values to be sure that the results are independent of step size. Here, we have calculated the gradients using FD for x/c going from 0.15 to 0.60, which consists of 77 grid points, with \(t_i =500\). Also, we repeated FD simulations for four different step sizes (\(\Delta a\)) in the range of \(10^{-7}\) to \(10^{-4}\), and the FD convergence was achieved for \(\Delta a= 10^{-5}\). Thus, in total for the central FD method, \(77 \times 2 \times 4= 616\) simulations were conducted.

The next step is to calculate the sensitivity of the objective function with respect to the same design variable as we used in FD, i.e., HHBF height (a). This can be done by putting HHBF centered at all surface grid points and then applying Eq. (30).

$$\begin{aligned} \left( \frac{\partial J}{\partial a_i}\right) _{Adjoint} = \int \nabla _{z}J f_{0,i}({\textbf {x}},h,t) dx. \end{aligned}$$
(30)

In this equation, \(f_{0,i}({\textbf {x}},h,t)\) is HHBF with maximum value located at \(i^{th}\) grid in x. Equation (30) shows how a directional derivative is obtained by an inner product between the gradient and the surface deformation induced by the HHBF. The comparison of \(\nabla _a {E} = \frac{\partial J}{\partial a}\) obtained from the adjoint method and central finite difference is shown in Fig. 8. From the figure, it is evident that there is a good match between the two methods validating the implementation of the adjoint method.

Fig. 8
figure 8

Comparison of gradient obtained using the adjoint method and finite difference (\(\Delta a = 10^{-5}\)) for upper surface of NLF(2)-0415 airfoil along the chord. \(M_ \infty =0.5\), \(Re=6 \times 10^6\), and \(AoA=1.25^ \circ \) with \(f=5850\) Hz, \(\beta =0\), \(\alpha _{x_s}=600\) \([m^{-1}]\)

3.1.2 Limitations of adjoint-based approximations

Using the adjoint method, we are able to get the gradient of an objective function with respect to design variables. Thus, if we want to use the gradient, we are limited to a first-order analysis. As an example, if we want to approximate the change in kinetic energy of perturbations \((\Delta E)\) in a domain as a result of a smooth surface deformation on an airfoil, we can write the Taylor expansion of the objective function, here E, around the baseline airfoil, as

$$\begin{aligned} \Delta E = E({\textbf {z}}_0+\Delta {\textbf {z}}) - E({\textbf {z}}_0) \approx \frac{\partial E}{\partial {\textbf {z}}}\Delta {\textbf {z}} + \frac{1}{2}(\Delta {\textbf {z}})^T \frac{\partial ^2 E}{\partial {\textbf {z}}^2} (\Delta {\textbf {z}}). \end{aligned}$$
(31)

In this equation, \(\Delta E\) is the change in kinetic energy of the boundary layer, \({\textbf {z}}_0\) the clean airfoil surface nodal coordinates vector, and \(\Delta {\textbf {z}}\) the vector of surface deformation. From the adjoint method, we obtain the first-order term in the Taylor series of Eq. (31). To shed more light on this, Fig. 9 shows the final energy \(E({\textbf {z}}_0+\Delta {\textbf {z}})\) (on the left y-axis), and change in kinetic energy of the domain (on right y-axis), for two different HHBFs, centered at 33.3% of the chord with a width equal to 13.86% (narrow bump) and 32.01% (wide bump) of the chord. For each case, we have increased the height of the bump up to 26% of displacement thickness of the baseline airfoil, \(\delta ^*\), which is measured at 33.3% of the chord where the bump has a maximum height. For each case, we have calculated the exact final energy and \(\Delta E\) by solving Euler, BLE, and PSE based on the new deformed geometry, and also we have approximated them using the first-order approximation based on Eq. (31) and the gradient of baseline airfoil obtained from the adjoint method. The results are shown in Fig. 9. For clarity, Fig. 10 shows the shape and the corresponding displacement thickness and N-factor for the narrow and wide bumps with \(\Delta z_{max} / \delta ^* = 0.26\).

Fig. 9
figure 9

Comparison of final energy and \(\Delta E\) approximated using the adjoint method and exact values (calculated using NOLOT) between narrow bump (left panel) and wide bump (right panel). The centers of both bumps are located at \(x/c=0.333\) with corresponding \(\delta ^*= 0.39486 (\textrm{mm})\). The width of narrow and wide bumps are 13.86% and 32.01% of the chord, respectively. \(M_ \infty = 0.5, \textrm{Re} = 6 \times 10^6\)

Fig. 10
figure 10

N-factor for wide and narrow bumps with \(\Delta z_{max} / \delta ^* = 0.26\) (upper panel). Corresponding displacement thickness and shape of the bumps (lower panel). \(M_ \infty = 0.5, Re = 6 \times 10^6\)

From Fig. 9, it is evident that for both bumps, as the height of the bump is increased, the deviation between the exact and approximated solution increases. This is due to the fact that the linear approximation is accurate only when the deformation is sufficiently small. Another important point of this figure is that for the narrow bump, the deviation from the exact solution starts to increase for smaller bump heights than that of the wide bump \((\frac{\Delta z_{max}}{\delta *} \approx 5\%\) for narrow bump vs. \(\frac{\Delta z_{max}}{\delta *} \approx 10\%\) for wide bump). This is because, for the same bump height, the narrow bump is sharper; thus, the change in meanflow and pressure is more abrupt in the boundary layer and nonlinearity is stronger. This can be seen clearly from Fig. 10 where the variations in displacement thickness and N-factor for the narrow bump is much more abrupt than the wide bump for \(\Delta z_{max}/ \delta ^* = 0.26\). As a result, the linear approximation is only valid for smaller bump heights. For larger deformations, second-order derivatives \(\frac{\partial ^2 E}{\partial z^2}\) could be used to increase accuracy.

The Hessian matrix (H) is a square matrix containing second-order partial derivatives of the objective function (J) with respect to the design variables \((z_i)\) defined as follows:

$$\begin{aligned} H_J = \begin{bmatrix} \frac{\partial ^2 J}{\partial {z_1}^2} &{} \frac{\partial ^2 J}{\partial z_1 \partial z_2} &{} \cdots &{} \frac{\partial ^2 J}{\partial z_1 \partial z_n}\\ \frac{\partial ^2 J}{\partial z_2 \partial z_1} &{} \frac{\partial ^2 J}{\partial {z_2}^2} &{} \cdots &{} \frac{\partial ^2 J}{\partial z_2 \partial x_n}\\ \vdots &{} \vdots &{} \ddots &{} \vdots \\ \frac{\partial ^2 J}{\partial z_n \partial z_1} &{} \frac{\partial ^2 J}{\partial z_n \partial z_2} &{} \cdots &{} \frac{\partial ^2 J}{\partial {z_n}^2} \end{bmatrix}, \end{aligned}$$
(32)

where n is the number of design variables. In general, finding the full Hessian matrix using FD method is very expensive. Here, to see the effect of second-order derivatives on the approximation of energy for large deformations, instead of finding the full hessian matrix, we have calculated the second-order derivatives of objective function (E) with respect to HHBF height parameter (a) for one bump using the following central difference equation:

$$\begin{aligned} \frac{\partial ^2 E}{\partial a^2} = \frac{\partial }{\partial a}\left( \frac{\partial E}{\partial a}\right) = \frac{\frac{\partial E}{\partial a}({\textbf {z}}+\Delta a f_{0}({\textbf {x}},h,t)\hat{e}_z)-\frac{\partial E}{\partial a}({\textbf {z}}-\Delta a f_{0}({\textbf {x}},h,t)\hat{e}_z)}{2 \Delta a}. \end{aligned}$$
(33)

Then, for deformed geometries, we need to find the gradients with respect to HHBF height parameter, i.e., \(\frac{\partial E}{\partial a}({\textbf {z}} \pm \Delta a f_{0}({\textbf {x}},h,t)\hat{e}_z)\), from the gradients obtained using adjoint method, which can be done using Eq. (30) as explained in Sect. 3.1.1. Finally, the second-order derivatives can be calculated using Eq. (33).

Fig. 11
figure 11

Effect of second-order derivatives on the approximation of final energy and \(\Delta E\). The center of the bump is located at \(x/c=0.333\) with corresponding \(\delta ^*= 0.39486 (\textrm{mm})\). The width of the bump is 13.86% of the chord. To find second-order derivative approximation using Eq. (33), \(\Delta a = 10^{-6}\) is used

We have found the second-order derivatives for the narrow bump in Fig. 9, and the results are shown in Fig. 11. From Fig. 11, it is clear that adding the second order derivatives to Eq. (31) has significantly increased the accuracy of approximation for large deformations. However, due to the high cost of calculating Hessian, in the rest of this work, to solve the optimization problem, we applied gradient ascent and SLSQP methods employing first-order gradients at the cost of more iterations.

3.2 Choice of step size \(\gamma \) for the GA approach

One important step to find the wavy deformation profiles with gradient ascent approach is choosing the step size \(\gamma \). If \(\gamma \) is too small, the convergence will be slow; on the other hand, if it is too large, it is possible that higher-order terms in the Taylor series expansion of E become relevant, and one does not follow the steepest ascent direction. To choose the proper step size, we have compared the final waviness profile for \(\textrm{Re}=15 \times 10^6\), \(M_{\infty }=0.5\) and \(k=16\) using different step sizes, i.e., \(\gamma = [1; 4; 16; 64; 128] \times 10^{-6} m\). Here, it is important to mention that since we are working in the compressible regime, the most unstable disturbance mode inside the boundary layer is a 3D mode, i.e., \(\beta \ne 0\). Therefore, we have used an in-house code to compute the spanwise wavenumber (\(\beta \)) and initial streamwise wavenumber (\(\alpha _{x_s}\)) of the most unstable mode to be used for PSE calculations. For the mentioned conditions, this constitutes \(f=8346\) Hz, \(\beta =288.34\) \(m^{-1}\) and \(\alpha _{x_s}=889.99\) \(m^{-1}\). Figure 12 shows the corresponding final waviness profiles using the five different values for \(\gamma \), all reaching \(\Delta {N}=2\) but with different \(L2-\)norms. Figure 12 indicates that \(\gamma = 4 \times 10^{-6} (m)\) is a good value to guarantee the convergence to the same solution, thus is used in all calculations in the GA approach.

Fig. 12
figure 12

Largest allowable deformation profile using different \(\gamma \) for \(\Delta {N}=2\) at \(Re=15\times 10^6\) using 16 Fourier modes on the NLF(2)-0415 airfoil (left panel) and corresponding convergence of the \(L2-\)norm for final wavy profiles (right panel). The colors of the circles in the right panel match the colors of each curve in the left panel

3.3 Results for largest allowable deformation profiles

Figure 13 shows the final largest allowable deformation profiles for \(k=10\) and \(k=16\) obtained with SLSQP and the near optimum solution obtained with GA, both for \(\Delta {N} \approx 2\), using the NLF(2)-0415 airfoil for \(Re = 15 \times 10^{6}\) at \(AoA = 1.25^{\circ }\) and \(M_{\infty } = 0.5\). The \(L2-\)norm of the wavy profiles shown in Fig. 13 are 4.46% (\(k=10\)) and 2.58% (\(k=16\)) higher for the GA than for the SLSQP method, exemplifying that the GA approach is not ideal for when the largest allowable wavy deformation with minimum \(L2-\)norm is desired. The analysis of both profiles permits us to understand that the lower \(L2-\)norm was achieved with the SLSQP wavy shape due to large bumps presented in the upstream position of the chord, where the boundary layer is thinner, with a more significant effect in disturbing the flow in this region. The large bumps at the beginning of the chord also create a high slope just after it, which results in a large adverse pressure gradient. This allows solutions with lower amplitude bumps in the rest of the airfoil’s downstream positions, bringing the \(L2-\)norm value down and showing how the SLSQP method is more robust in the optimization process.

Fig. 13
figure 13

Largest allowable deformation profiles to reach \(\Delta {N} \approx 2.0\) for \(k = 10\) and \(k = 16\) for \(\textrm{Re} = 15 \times 10^{6}\) using SLSQP and GA

The physical explanation of the wavy shapes obtained in Fig. 13 are explained by Fig. 14, in which it is possible to understand that the gradient of kinetic energy in the boundary layer is dictated by the way pressure is distributed on the airfoil.

Fig. 14
figure 14

Effect of pressure distribution on the gradient for \(Re = 15 \times 10^{6}\) and \(\Delta {N}=2\) and \(k = 16\)

In Fig. 14, which shows \(\nabla _z E\), \(d(-C_{p})/dx\), and \(d^{2}(-C_{p})/dx_2\) on the upper skin of the wavy airfoil for \(Re = 15 \times 10^{6}\), \(\Delta {N}=2\) and \(k = 16\), we observe that the sensitivity tends to be positive in regions where \(d(-C_{p})/dx\) decreases (moving toward the adverse type), while \(d^{2}(-C_{p})/dx_2\) is negative. This is clear in the region for \(x/c<0.185\), delimited by the first vertical blue line. As the level of pressure gradient starts to move toward the favorable type, i.e., \(d(-C_{p})/dx\) stars to increase (\(d^{2}(-C_{p})/dx_2\) is positive), the sensitivity tends to become negative, which is the trend observed right after \(x/c>0.185\), and is repeated along all the airfoil’s surface. The vertical blue lines in Fig. 14, together with the plot of the second derivative, help to identify the mentioned trend and regions where the switch happens.

In Fig. 15, the envelopes of N-factor curves for the upper skin of baseline airfoil and final wavy airfoil for \(Re = 15 \times 10^{6}\), \(k=16\), and \(\Delta N=2\) are shown by blue and red dashed lines, respectively, for computations carried with a constant frequency and \(\beta \). It has been noticed that updating the mode often during the iteration process is unnecessary and time-consuming. To show that the N-factor envelope for the final wavy airfoil (red dotted line) in Fig. 15 was obtained after updating the modes at each iteration, and there is a match between the growth of the initial most unstable mode (black line) used along the iteration process with the final updated one. It is evident from the figure that the maximum value of N-factor is increased by 2 units compared to the initial airfoil.

Fig. 15
figure 15

Growth for the most unstable mode and envelope curves for baseline and wavy airfoils (\(\textrm{Re} = 15 \times 10^{6}\) and \(\Delta {N}=2\) and \(k = 16\))

3.4 Calculating manufacturing tolerances

The waviness profile shown in Fig. 13 for the SLSQP approach is the largest allowable deformation profile with minimum \(L2-\)norm that will increase the kinetic energy of the boundary layer by predefined initial values of 19 (\(k=10\) and \(\Delta {N}=1.93\)) and 19.47 (\(k=16\) and \(\Delta {N}=2.0\)), and it means that any other waviness profile with the same \(L2-\)norm will cause a lower kinetic energy variation (and \(\Delta N\)) in the boundary layer. Thus, we have defined the tolerance \(h_{\textrm{tol}}\) as the \(L2-\)norm of surface deviations of the allowable deformation profile (for a specific flight condition and k) with respect to the clean airfoil. This can be written as

$$\begin{aligned} h_{\textrm{tol}} = \sqrt{\frac{1}{(x_{f} - x_s)}\int ^{x_{s}}_{x_{f}} (\Delta {z}_i)^2 dx}, \end{aligned}$$
(34)

where \(\Delta {z}_i\) is surface nodal vertical deformation, calculated using SLSQP or GA approaches, for \(x \in [x_s,x_f]\).

In Figs. 16, 17 and 18, the calculated tolerances, \(h_{\textrm{tol}}\), obtained with both SLSQP and GA approaches are shown as a function \(\Delta N \in [0,2] \). The results were obtained for \(Re=[9,12,15] \times 10^6\) and \(k=[10,12,14,16]\). The choice of Reynolds numbers was made based on the mean aerodynamic chords of some straight-wing aircraft (P180, HA-420, EMB-500, ATR-72, DCH-8) flying at maximum operational speeds (\(V_{MO}\)) at ISA conditions. For the mentioned Reynolds numbers, the values for f, \(\beta \), and \(\alpha _{x_s}\) for the most unstable modes are informed in Table 1.

These figures show that the tolerance increases by increasing the target \(\Delta N\). On the other hand, for a specific target \(\Delta N\) and \(\textrm{Re}\), by decreasing the wavelength of waviness on the airfoil, i.e., by increasing k, the tolerance decreases significantly due to the higher levels of the adverse-favorable pressure gradient that smaller wavelengths introduce on the surface. As for the Reynolds number effect, since the boundary layer gets thinner with the increase in \(\textrm{Re}\), smaller oscillations in pressure coefficient (\(C_p\)), i.e., surface deviations, start to have more effect on the growth of disturbances, and larger \(\textrm{Re}\) numbers result in smaller tolerance levels.

Fig. 16
figure 16

Evolution of \(h_{\textrm{tol}}\) for \(\textrm{Re} = 9 \times 10^{6}\) and different \(\Delta {N}\) and k

Fig. 17
figure 17

Evolution of \(h_{\textrm{tol}}\) for \(\textrm{Re} = 12 \times 10^{6}\) and different \(\Delta {N}\) and k

Fig. 18
figure 18

Evolution of \(h_{\textrm{tol}}\) for \(\textrm{Re} = 15 \times 10^{6}\) and different \(\Delta {N}\) and k

It is also evident from Figs. 16, 17 and 18 that the difference in the tolerances obtained with both methods reduces as the Reynolds number is increased, especially for large wavelengths (small values of k). A significant discrepancy in the tolerances for the methods, i.e., around \(15\%\), is observed only for moderate Reynolds numbers at large values of \(\Delta {N}\) for \(k=10\). For the most part of Figs. 16, 17 and 18, the tolerances calculated with both methods differ by less than 10%. When we take into consideration that a full curve using gradient ascent method can be obtained in less than 5 h using only four processors, which takes 50 to 60 iterations with \(\gamma =4\times 10^{-6}\) [m] to reach \(\Delta {N}=2\), and that each point of the same curve, i.e., \(h_{\textrm{tol}}\) corresponding to each \(\Delta N\) for a specific \(\textrm{Re}\) and k, using SLSQP can take up to 12 h (depending on the values of \(E_{R}\)) using the same number of processors, the gradient ascent approach can become an option to estimate the manufacturing tolerances, especially if the goal is to map multiple wing sections at different flight conditions using limited computation resources and at a small time frame.

Table 1 Frequencies, spanwise and initial streamwise wave numbers for the most unstable mode for each Reynolds number

To assure that the tolerances informed with the SLSQP methodology are the ones with minimum \(L2-\)norm and to test by how much we would be making mistakes when the GA tolerances are applied, using a combination of different wavy profiles, we have created and tested 2210 feasible random wavy shapes. Each profile is scaled once to have an \(L2-\)norm equal to the tolerance obtained using the gradient ascent (GA) method, and once to the tolerance obtained using the SLSQP method (for \(\textrm{Re}=15 \times 10^6\), \(k=16\), \(\Delta {N}=2\)), and for each case, we have calculated the maximum increase in N-factor. All the wavy shapes created had a random number of Fourier modes, limited to 16, and random amplitudes. The \(\Delta N\) distribution for the profiles with the tolerance calculated using gradient ascent is shown in the left panel, and using SLSQP is shown in the right panel of Fig. 19. It is clear that no case reached \(\Delta N=2\) when the tolerance from the SLSQP approach is used, consistent with the properties of the largest allowable deformation (minimum \(L2-\)norm). On the other hand, 11 profiles (0.5 %) with the tolerance found using gradient ascent went beyond \(\Delta N=2\), which shows that the waviness profile found using gradient ascent is not the profile with minimum \(L2-\)norm to reach a specific \(\Delta N\). However, the probability of having these violating cases is not substantial. Nevertheless, choosing between gradient ascent (much faster) and SLSQP (minimum \(L2-\)norm) to calculate the tolerances depend on the accuracy which is needed for a certain application.

Fig. 19
figure 19

Distribution of \(\Delta {N}\) for random waviness profiles (number of Fourier modes limited to 16) with the tolerance obtained using gradient ascent (left) and SLSQP (right) for \(\Delta {N} = 2\), \(Re = 15 \times 10^{6}\), and \(k=16\)

3.5 Effect of angle of attack and mach number

The effect of different angles of attack on the manufacturing tolerances for \(Re=15 \times 10^6\), \(k=10\), \(\Delta N=2\) (calculated using GA) is shown in Fig. 20. The lift coefficient (\(C_l\)) and the values for f, \(\beta \), and \(\alpha _{x_s}\) of the most unstable mode used for each case are informed in Table 2. It is clear that by increasing the angle of attack the tolerance to reach \(\Delta N=2\) decreases. The reason for this relies on the difference in pressure distribution on airfoil for \(AoA=[0.7^\circ ;1.5^\circ ]\) shown in Fig. 20. As the angle of attack increases, the adverse pressure gradient, especially close to leading edge, becomes stronger, which destabilize the TS waves and results in a faster growth in their amplitude. Thus, the tolerances for \(\Delta N=2\) decreases.

Fig. 20
figure 20

Effect of angle of attack (AoA) on manufacturing tolerances (left panel). Pressure distribution on both suction and pressure sides (right panel). \(M_{\infty }=0.5\), \(\hbox {Re}=15 \times 10^6\), \(k=10\), \(\Delta N=2\)

Table 2 Lift coefficient (\(C_l\)), and stability analysis parameters for the most unstable mode for different angle of attacks

The change in Mach number also affects directly the pressure distribution on the entire airfoil, i.e., increasing this parameter will increase all existing pressure gradients roughly by a constant, which can be accessed by subsonic compressibility relations such as the Karman–Tsien [56]. Therefore, increasing this parameter will increase the level of adverse pressure gradients caused by the wavy bumps, reaching the target \(\Delta {N}\) much faster, which translates into small tolerances. Table 3 shows the effect of compressibility in the computed tolerances (with GA) using the same airfoil at \(AoA=1.25^{\circ }\) and \(Re=15\times 10^{6}\) for four different Mach numbers. It has to be mentioned that although compressibility has a strong stabilizing effect on the TS waves until \(M_{\infty } \approx 2\) [57], the manufacturing tolerances are computed based on the variation of the N-factor, i.e., the initial maximum N-factor for \(M_{\infty }=0.5\) will be larger than for \(M_{\infty }=0.6\); however, to reach a \(\Delta {N}=2\), the tolerances for the higher Mach number will be smaller.

Table 3 Tolerances for \(Re=15 \times 10^6\), \(k=10\) and \(AoA = 1.25^{\circ }\) at different \(M_{\infty }\)

4 Conclusion

An adjoint-based methodology was proposed and tested for computing the surface waviness tolerances in manufacturing NLF surfaces. The main goal is to find the manufacturing tolerances based on the largest allowable waviness profile with minimum \(L2-\)norm of surface deformations that might cause early transition due to the existence of waviness on the airfoil. In the required cycle of computations, the inviscid baseflow was obtained by solving the Euler equations and the viscous meanflow by solving the boundary layer equations (BLE) for compressible flows. The instability of the boundary layer was analyzed using the parabolized stability equations (PSE), and the gradient of the objective function with respect to surface deformations was obtained using the adjoint method by solving the adjoints of the Euler, BLE, and PSE. It was shown that the accuracy of approximation using the adjoint method depends on the amplitudes of surface waviness, and the accuracy decreases when the height of waviness increases. It was also shown that the accuracy of approximations for large deformations increases significantly when second-order gradients are used.

The methodology for computing the surface waviness tolerance consists in an iterative gradient-based amplification of the kinetic energy of the boundary layer to find the minimum \(L2-\)norm of the surface deviations, i.e., a wavy profile that causes a specified energy amplification (\(E_R\)) or a \(\Delta {N}\) in the N-factor envelope. For this task, the NLF(2)-0415 airfoil designed for the commuter aircraft segment was used to test and validate the approach mostly for \(M_{\infty }=0.5\), \(AoA = 1.25^{\circ }\) and Reynolds numbers between \(9 \times 10^6\) and \(15 \times 10^6\) based on common mean aerodynamic chords of straight-wing aircraft for less than 90 passengers.

The results obtained using the two approaches, i.e., gradient ascent (GA) and SLSQP, show how tolerances scale with different Reynolds numbers, where the thickness of the boundary layer plays a significant role in the final tolerances together with the effect of different wavelengths of surface oscillations responsible for the level of adverse-favorable pressure gradients. It also has been shown that the SLSQP is the method capable of finding the largest allowable deformation profile, with minimum \(L2-\)norm of surface deformation, at the cost of additional computational time compared to the GA approach, which informs tolerances within an error of less than \(10\%\) but in a shorter time frame. It also has been shown that increasing the angle of attack and Mach number, for a specific \(\Delta N\), will result in lower tolerances due to the increase in the adverse pressure gradient imposed on the airfoil.

The methodology proposed here expresses the efforts made to obtain manufacturing tolerances for NLF surfaces for aerodynamic applications, with waviness profiles aligned in the chordwise direction, where the advantage of the proposed methodology is the extra information that is given at the beginning of the process, i.e., the final \(\Delta {N}\) that the manufactured geometry will result. This helps engineers dictate manufacturing tolerances with more confidence about their effects.

To extend the presented methodology to find the tolerances for a 3D wing and allowing deformations to be in both spanwise and chordwise directions, a general approach could be to implement a similar methodology with full 3D boundary layer and plane marching PSE-3D equations and also their adjoints. However, solving the 3D boundary layer and stability equations would be a much more complicated task. A simple approach, when waviness is assumed to be only in the chordwise direction, to address the full three-dimensionality of base flow is to handle it in the same manner as when natural laminar flow wings are designed and analyzed. In this case the flow at different wing sections along the span are considered separately and a local infinite swept wing approximation is applied. This can be done with the present methodology as the BLE and PSE used in this work are based on infinite swept approximation and can handle both TS and cross-flow type of perturbations. The sensitivity of cross-flow perturbation using adjoint methods has already been studied, e.g., by Pralits and Hanifi [58], using a similar approach. In this case, a manufacturing tolerance at each span section will be found.