\documentclass[11pt]{article} % Document font size and equations flushed left

\usepackage[english]{babel} % Specify a different language here - english by default
\renewcommand{\familydefault}{\sfdefault}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{tikz}
\usepackage{amsmath}
\usepackage[a4paper, left=1.9cm,top=2.0cm,right=1.9cm,bottom=2.0cm]{geometry}
\usepackage{natbib}
\usepackage{hyperref}
\usepackage{silence}

\begin{document}
\renewcommand{\floatpagefraction}{.9}%
\section{Summary}
In this report, a variety of methods are used to evaluate the performance of an airfoil. 
Theoretical results are known for how this airfoil should perform, and they are used as a benchmark to determine the efficacy of a number of other methods. 
Finally, one of the assumptions of previous analysis, that the flow has no viscosity, is removed and the airfoil is further investigated.

\section{Generation of the airfoil}
\begin{figure}[!htp]
  \begin{center}
    \includegraphics[width=0.45\textwidth]{../comparison.png}
  \end{center}
  \caption{The Karman-Treffetz airfoil overlaid on the closest NACA airfoil}
  \label{fig:both}
\end{figure}
Through manually changing the parameters of a NACA 4-digit airfoil, the 3512 airfoil was found to be the closest. 
The fact that it is somewhat difficult to see it under the Karman-Treffetz airfoil shows how close a match this is.
The NACA airfoil was generated using the python libaray written by Dirk Gorissen in 2011, and the KT airfoil was generated using Neil Sandham's matlab file.

The camber line was also used as a point of comparison between the airfoils. 
This is shown in Figure \ref{fig:camber_comparison}. 

\begin{figure}[!htp]
  \begin{center}
    \includegraphics[width=0.45\textwidth]{../camber_comparison.png}
  \end{center}
  \caption{The camber line of each airfoil}
  \label{fig:camber_comparison}
\end{figure}

To generate this figure, each point on the upper surface of the airfoil was considered. 
The $x$ value for each point is known for the upper surface, but the lower surface doesn't necessarily have a point at the same coordinate. 
For this reason, the points at the upper surface considered were $x+\varepsilon_1$ and $x-\varepsilon_2$, where both values are positive. 
The $y$ values at these points are known, so linear interpolation was used to find the value of $y$ on the upper surface at $x$. 
This will lead to small numerical inaccuracies, however sufficiently high numbers of points were used, meaning that this is not an issue. 
Visually, both curves in Figure \ref{fig:camber_comparison} appear smooth, and that is all that is necessary for the camber lines.

\subsection{Variation}
For the k-t airfoil, $\beta$ and $\varepsilon$ were changed within $20\%$ of their given values. 
$20\%$ is an arbitrary value, $10\%$ was tried but the changes felt too minor to be commented on well. 

\begin{figure}[!htp]
  \begin{center}
    \includegraphics[width=0.45\textwidth]{../changes.png}
  \end{center}
  \caption{Altered airfoils}
  \label{fig:foils_multi}
\end{figure}

As is expected, the airfoil with maximum thickness clearly has the largest perimiter in Figure \ref{fig:foils_multi}, and the minimum thickness is the smallest. 
For the maximum thickness airfoil, it is only the "outer" profile up until $\frac{x}{c} \approx 0.5$. 
Because the camber is far back on these airfoils, the maximum camber airfoil has a higher upper surface towards the rear of the airfoil. 
Naturally, the overall thickness will still be higher, but it is interesting nontheless.

\begin{figure}[!htp]
  \begin{center}
    \includegraphics[width=0.45\textwidth]{../cambers.png}
  \end{center}
  \caption{Camber lines for altered airfoils}
  \label{fig:camber_multi}
\end{figure}

Figure \ref{fig:camber_multi} shows the camber lines of each airfoil. 
Changing thickness has no effect on camber, as is to be expected. 
The values for maximum camber are reported in Table \ref{tab:camber_multi}. 
The fact that the thicknessess are not identical for the values of camber could suggest that the number of points used to construct the airfoils is too low. 
However, these airfoils will not be analysed in other software, and the error is very small regardless. 
This knowledge will be used to inform the number of points used to generate the airfoil for Xfoil in \ref{sec:Xfoil}.

The percentage difference between the camber value and the maximum and minimum cambers is almost exactly $20\%$, as expected.

\begin{table}[!htp]
  \caption{Maximum cambers for airfoils}
  \label{tab:camber_multi}
  \begin{center}
    \begin{tabular}[c]{|c|c|c|c|}
      \hline
      maximum thickness & minimum thickness & maximum camber & minimum camber\\
      \hline
       $0.0324$ & $0.0325$ & $0.0259$ & $0.0398$\\
       \hline
    \end{tabular}
  \end{center}
\end{table}


\begin{figure}[!htp]
  \begin{center}
    \includegraphics[width=0.45\textwidth]{../thicknesses.png}
  \end{center}
  \caption{}\label{fig:thickness_multi}
\end{figure}

The thicknessess appear as expected.

\begin{table}[!htp]
  \caption{Maximum thickness for airfoils}
  \label{tab:thickness_multi}
  \begin{center}
    \begin{tabular}[c]{|c|c|c|c|}
      \hline
      maximum thickness & minimum thickness & maximum camber & minimum camber\\
      \hline
       $0.1082$ & $0.1426$ & $0.1255$ & $0.1258$\\
       \hline
    \end{tabular}
  \end{center}
\end{table}

\section{Doublet panel method}

To test that the doublet panel method is accurate, it will be demonstrated that it can bet incredibly close to the exact solution given by the transformed flow. 
Figure \ref{fig:ooac} shows that at high numbers of panels, the value is essentially the same.
\begin{figure}[!htp]
  \centering
  \includegraphics[width=0.45\textwidth]{../ooac.png}
  \caption{Doublet panel method with exact value plotted against number of panels}
  \label{fig:ooac}
\end{figure}

It is important to estimate the order of accuracy to know what step size is needed for a given accuracy.
To do this, the gradient of the sloped section of Figure \ref{fig:ac_ooac} is found.
Using MATLAB, this is found to be 2.5.

\begin{figure}[!htp]
  \centering
  \includegraphics[width=0.45\textwidth]{../ac_ooac.png}
  \caption{log-log plot of error and step size}
  \label{fig:ac_ooac}
\end{figure}

Figure \ref{fig:linspace} shows the error when using linear spacing instead of half cosine spacing.
It is unable to correctly measure the gradients, and the cyclic increase in error suggests that there are other issues in addition. 

\begin{figure}[!htp]
  \centering
  \includegraphics[width=0.45\textwidth]{../linspace.png}
  \caption{error using linear spacing}
  \label{fig:linspace}
\end{figure}

\section{Doublet panel method and Xfoil}
\subsection{Xfoil}
Figure \ref{fig:xfoil_cla} shows the lift curve slopes from Xfoil's inviscid analysis.
It appears that the lift curve slope is slightly lower for the kt airfoil. 
Upon finding the gradient of the data using numpy's \verb||numpy.gradient|, \(c_{l\alpha}\) for the kt airfoil is 6.76, whereas for the NACA airfoil, it is 6.78.
Thin airfoil theory dictates that these should both be equal to \(2*\pi \approx 6.28\).
This suggests that there is some error present.

\begin{figure}[!htp]
  \centering
  \includegraphics[width=0.45\textwidth]{../try 2/xfoil_cla.png}
  \caption{Lift curve slope from Xfoil}
  \label{fig:xfoil_cla}
\end{figure}

\subsection{Doublet panel method}
As is evident from Figure \ref{fig:dpan}, the lift curve slopes are almost identical. 
The relatively coarse control over camber from a NACA airfoil means that the camber for the NACA airfoil is slightly higher than that of the Karman-Treffetz airfoil.
Stalls cannot be modelled, so as expected, these are just straight lines.

\begin{figure}[!htp]
  \centering
  \includegraphics[width=0.45\textwidth]{../cla.png}
  \caption{Lift curve slope from the doublet panel method}
  \label{fig:dpan}
\end{figure}

In Figure \ref{fig:pressures}, the pressure distribution over the airfoils is shown.
The fact that on the suction surface, the NACA airfoil consistently has a lower coefficient of pressure is what leads to the higher lift curve slope.
Because the peak is so sharp on the naca airfoil, it is possible that the high gradients on the leading edge have not been captured. 
This reinforces the need for half-cosine spacing, as does the fact that midway through the chord, the gradients of pressure are very low.

\begin{figure}[!htp]
  \centering
  \includegraphics[width=0.45\textwidth]{../pressures.png}
  \caption{\(c_p\) plotted along \(\frac{x}{c}\) for upper and lower surfaces of both airfoils}
  \label{fig:pressures}

\end{figure}
\section{Comparison with existing software}
\label{sec:airfoil}
To validate the results above, Xfoil was also used to find various parameters of the airfoils' performance. 
Generating the NACA 3512 was done by using \verb|NACA 3512| built into Xfoil.
The \verb|load| command was used to import the kt airfoil, and then \verb|ppar| was used to smooth out the panneling. 
If this was not done, the \(c_p\) against \(\frac{x}{c}\) graph was not smooth, as is shown in Figure \ref{fig:spiky}.
After repanneling, the graph is a lot more realistic. 
This is shown in Figure \ref{fig:smooth}

\begin{figure}[!htp]
  \centering
  \begin{subfigure}[b]{0.45\textwidth}
    \includegraphics[width=\textwidth]{../spiky.png}
    \caption{k-t airfoil before repanelling}
    \label{fig:spiky}
  \end{subfigure}
  \hfill
  \begin{subfigure}[b]{0.45\textwidth}
    \includegraphics[width=\textwidth]{../smooth.png}
    \caption{after repanelling}
    \label{fig:smooth}
  \end{subfigure}
\end{figure}

\section{Viscous effects}

Both airfoils were simulated at \(Re = 1\times 10^5, 5\times10^6\). 
The characteristic length in this case is the chord length. 


\subsection{NACA airfoil, 20 degree angle of attack}
As the lower Reynolds number flow will likely have a laminar boundary layer, it will separate more quickly. 
This will result in a large wake and a very high momentum thickness.
As is clear in Figure \ref{fig:bls_naca}, this is the case, as the coefficient of drag is approximately 4 times larger for the low Reynolds number airfoil.
Separation occurs at around \(\frac{x}{c} = 0.1\), as is visible from the boundary layer profiles. 
Unsurprisingly, this results in a massively reduced coefficient of lift.
This is also evident by comparing the pressure distributions.

\begin{figure}[!htp]
  \centering
  \begin{subfigure}[b]{0.45\textwidth}
    \includegraphics[width=\textwidth]{../naca_bl_low.png}
    \caption{\(Re = 1\times 10^5\)}
    \label{fig:bl_low_naca}
  \end{subfigure}
  \hfill
  \begin{subfigure}[b]{0.45\textwidth}
    \includegraphics[width=\textwidth]{../naca_bl_high.png}
    \caption{\(Re = 5\times 10^6\)}
    \label{fig:bl_high_naca}
  \end{subfigure}
  \caption{Outputs of Xfoil's BL}
  \label{fig:bls_naca}
\end{figure}

In Figure \ref{fig:theta_naca}, \(theta\) is given by the straight line, and \(\delta^*\) is the dashed line.
As expected from Figure \ref{fig:bl_low_naca}, the boundary layer separates at around \(\frac{x}{x} = 0.1\).
This is evidenced by the sudden increase in \(\delta^*\) around this point in the low Reynolds number case.

The boundary layer remains attached much longer in the higher Reynolds number case.
Additionally, the scale on the lower Reynolds number goes much higher, showing the higher thickness and therefore drag that is present.

\begin{figure}[!htp]
  \centering
  \begin{subfigure}[b]{0.45\textwidth}
    \includegraphics[width=\textwidth]{../naca_t_low.png}
    \caption{\(Re = 1\times 10^5\)}
    \label{fig:theta_low_naca}
  \end{subfigure}
  \hfill
  \begin{subfigure}[b]{0.45\textwidth}
    \includegraphics[width=\textwidth]{../naca_t_high.png}
    \caption{\(Re = 5\times 10^6\)}
    \label{fig:theta_high_naca}
  \end{subfigure}
  \caption{Plots of \(\theta\) and \(\delta^*\) against \(x\)}
  \label{fig:theta_naca}
\end{figure}

Because the boundary layer has separated and flow is flowing from trailing edge to leading edge, Figure \ref{fig:cf_low_naca} should show a negative coefficient of friction over much of the airfoil.
However, this is not the case and \(c_f\) for the upper surface remains at zero after separation.

On the lower surface, which does not detach, the low Reynolds number case clearly has a significantly higher coefficient of friction. 

\begin{figure}[!htp]
  \centering
  \begin{subfigure}[b]{0.45\textwidth}
    \includegraphics[width=\textwidth]{../naca_cf_low.png}
    \caption{\(Re = 1\times 10^5\)}
    \label{fig:cf_low_naca}
  \end{subfigure}
  \hfill
  \begin{subfigure}[b]{0.45\textwidth}
    \includegraphics[width=\textwidth]{../naca_cf_high.png}
    \caption{\(Re = 5\times 10^6\)}
    \label{fig:cf_high_naca}
  \end{subfigure}
  \caption{Plots of \(c_f\) against \(x\)}
  \label{fig:cfs_naca}
\end{figure}

Figure \ref{fig:hs_naca} shows that on the lower surface, \(H\approx 2.25\). 
This is consistent with the theory for a laminar boundary layer over a flat plate with a favourable pressure gradient, as shown by Pohlhausen's solution.
This suggests that both of these boundary layers remain laminar due to the pressure they experience, and this is confirmed by the values of \(x_{tr}/c = 1\) seen in both graphs.

\begin{figure}[!htp]
  \centering
  \begin{subfigure}[b]{0.45\textwidth}
    \includegraphics[width=\textwidth]{../naca_h_low.png}
    \caption{\(Re = 1\times 10^5\)}
    \label{fig:cf_low_naca}
  \end{subfigure}
  \hfill
  \begin{subfigure}[b]{0.45\textwidth}
    \includegraphics[width=\textwidth]{../naca_h_high.png}
    \caption{\(Re = 5\times 10^6\)}
    \label{fig:cf_high_naca}
  \end{subfigure}
  \caption{Plots of \(H\) against \(x\). Solid line shows \(H\)}
  \label{fig:hs_naca}
\end{figure}

\subsection{k-t airfoil, 20 degree angle of attack}
As above, it is clear that the lower Reynolds number separates earlier in Figure \ref{fig:bl_kt}.
Again, this is because the lower Reynolds number leads to a laminar boundary layer, which will separate more quickly.
The lift and drag coefficients clearly show this, as the turbulent case once again has better performance

\begin{figure}[!htp]
  \centering
  \begin{subfigure}[b]{0.45\textwidth}
    \includegraphics[width=\textwidth]{../kt_bl_low.png}
    \caption{\(Re = 1\times 10^5\)}
    \label{fig:bl_low_kt}
  \end{subfigure}
  \hfill
  \begin{subfigure}[b]{0.45\textwidth}
    \includegraphics[width=\textwidth]{../kt_bl_high.png}
    \caption{\(Re = 5\times 10^6\)}
    \label{fig:bl_high_kt}
  \end{subfigure}
  \caption{Output of Xfoil's bl for the k-t airfoil}
  \label{fig:bl_kt}
\end{figure}

As expected, the other graphs are much the same and have been omitted for brevity.

\subsection{kt airfoil, 6 degrees}
This angle of attack was chosen to be a reasonable angle before stall, but with enough of a pressure gradient to provide interesting effects.

In Figure \ref{fig:bl_high_kt_6}, it is clear that there is a separation bubble between about halfway and two-thirds the chord length. 
This will of course lead to a bump in the displacement thickness, and a section with a negative coefficient of friction.
There is a higher coefficient of drag on the airfoil at \(Re = 1\times 10^5\). 
Observing the line around the airfoil, the displacement thickness, it is clearly thicker for the low Reynolds number. 
This will of course cause the larger amount of drag.

\begin{figure}[!htp]
  \centering
  \begin{subfigure}[b]{0.45\textwidth}
    \includegraphics[width=\textwidth]{../kt_6_bl_low.png}
    \caption{\(Re = 1\times 10^5\)}
    \label{fig:bl_low_kt_6}
  \end{subfigure}
  \hfill
  \begin{subfigure}[b]{0.45\textwidth}
    \includegraphics[width=\textwidth]{../kt_6_bl_high.png}
    \caption{\(Re = 5\times 10^6\)}
    \label{fig:bl_high_kt_6}
  \end{subfigure}
  \caption{Output of Xfoil's bl for the k-t airfoil at \(\alpha = 6\)}
  \label{fig:bl_kt_6}
\end{figure}

The location of transition is unclear for \(Re=1\times 10^5\), as the associated drop in pressure coefficient on the \(x\) against \(c_p\) graph is in the region where the boundary layer profiles show recirculation. 
It will be evident on the other graphs, and the exact value will also be given.
There appears to be a minor change around \(\frac{x}{c} = 0.1\) on the high Reynolds number case, which indicates the transition. 
This will be a location with a fast-changing pressure gradient, as it is so close to the stagnation point, so this makes sense.
The boundary layer profiles are as expected. 
Interestingly, the boundary layers on the pressure surfaces are very different, even though they would be expected to have very similar laminar profiles, as a result of their favourable pressure gradient.

Figure \ref{fig:h_kt_6} shows the shape factor, from which the type of boundary layer can be deduced. 
The separation bubble, where the displacement thickness will grow significantly, is immediately obvious in Figure \ref{fig:h_kt_6}.
When the boundary layer reattaches, there is clearly a change from a laminar shape factor, with or without a pressure gradient, to one more indicative of a turbulent boundary layer. 
This is also reflected by the point of transition listed in the top right corner of \(0.62\), near the peak of the separation bubble.

In the high Reynolds number case, the \(H\) value of almost 3 is typical of a laminar boundary layer in an adverse pressure gradient. 
The sharp drop to around 1.5 occurs almost exactly where Xfoil reports the transition location.
The fact that the drop is so steep suggests that the transitional area is very short.

As the shape factors for the lower surfaces are now almost identical, it suggests that Figure \ref{fig:hs} may be incorrect. 
Their value of around 2.5 is typical of zero pressure gradient, but the increase to over 3 suggests that the curvature of the lower surface is adequate to lead to an adverse pressure gradient.
\begin{figure}[!htp]
  \centering
  \begin{subfigure}[b]{0.45\textwidth}
    \includegraphics[width=\textwidth]{../kt_6_h_low.png}
    \caption{\(Re = 1\times 10^5\)}
    \label{fig:h_low_kt_6}
  \end{subfigure}
  \hfill
  \begin{subfigure}[b]{0.45\textwidth}
    \includegraphics[width=\textwidth]{../kt_6_h_high.png}
    \caption{\(Re = 5\times 10^6\)}
    \label{fig:h_high_kt_6}
  \end{subfigure}
  \caption{Plots of \(H\) against \(x\) at \(\alpha=6\). Solid line shows \(H\)}
  \label{fig:h_kt_6}
\end{figure}

Once again, the high reynolds number shows a low coefficient of friction, which is hard to believe.
As shown above, the lower surface boundary layers are almost identical, however the coefficient of friction for the high Reynolds number is almost 10 times smaller that of the low Reynolds number.
Before \(\frac{x}{c} = 0.1\) in Figure \ref{fig:cf_high_kt_6}, \(c_f \approx 0.001\). However for the same point in Figure \ref{fig:cf_high_kt_6}, \(c_f \approx 0.01\). 
Blasius' solution to a boundary layer gives the equation below.
\[c_f = \frac{0.664}{\sqrt{Re_x}}\]
The Reynolds number entered into Xfoil is the Reynolds number based on the chord length. 
This means that to find the friction coefficient at a point \(\frac{x}{c}\), the equation below should be used.
\[c_f = \frac{0.664}{\sqrt{\frac{x}{c}Re_x}}\]
While this equation is for no pressure gradient, it can be used to inform the expected order of magnitude. 
It should only be used for laminar boundary layers. 

For the case with a low Reynolds number, the predicted coefficient of friction is \(0.0064\).
At a high Reynolds number, the predicted coefficient of friction is \(0.00094\).
For a higher Reynolds number, the value from Xfoil is accurate. 
It is unclear why the value at lower Reynolds numbers is so inaccurate.

Regardless, the separation bubble is present exactly where it is expected from the other measures. 

\begin{figure}[!htp]
  \centering
  \begin{subfigure}[b]{0.45\textwidth}
    \includegraphics[width=\textwidth]{../kt_6_cf_low.png}
    \caption{\(Re = 1\times 10^5\)}
    \label{fig:cf_low_kt_6}
  \end{subfigure}
  \hfill
  \begin{subfigure}[b]{0.45\textwidth}
    \includegraphics[width=\textwidth]{../kt_6_cf_high.png}
    \caption{\(Re = 5\times 10^6\)}
    \label{fig:cf_high_kt_6}
  \end{subfigure}
  \caption{Plots of \(c_f\) against \(x\) at \(\alpha=6\)}
  \label{fig:h_kt_6}

\end{figure}

\subsection{Overall performance}
This section looks at the general performance of the airfoils. 

The in Figure \ref{fig:cla_low} kt airfoil clearly fluctuates in a way that thin airfoil theory would not predict. 
It is assumed that the panelling is still imperfect, and these small perturbations will be ignored.
In both figures, the performance of the different airfoils is very similar, with similar stall points and zero-degree lift. 
Interestingly, the stall performance is different, with Figure \ref{fig:cla_high} showing a lower ultimate \(c_l\) for the kt airfoil, where Figure \ref{fig:cla_low} shows that the kt airfoil has better performance at high angles of attack. 
Additionally, \ref{fig:cla_low} validates the choice of 6 degrees angle of attack above. This is out of the linear region of the lift-curve slope, and the effect of the separation bubble is clear on both airfoils. 

Further study could be useful at around \(15^\circ\) at high Reynolds numbers.

\begin{figure}[!htp]
  \centering
  \begin{subfigure}[b]{0.45\textwidth}
    \includegraphics[width=\textwidth]{../try 2/cla_low.png}
    \caption{\(Re = 1\times 10^5\)}
    \label{fig:cla_low}
  \end{subfigure}
  \hfill
  \begin{subfigure}[b]{0.45\textwidth}
    \includegraphics[width=\textwidth]{../try 2/cla_high.png}
    \caption{\(Re = 5\times 10^6\)}
    \label{fig:cla_high}
  \end{subfigure}
  \caption{Lift curve slopes for each combination of airfoil and flow}
  \label{fig:h_kt_6}

\end{figure}

Usually, a quadratic function can be fit to small angles of attack. 
At low Reynolds numbers, this is clearly less possible. 
However, this seems to hold to a reasonable degree for the higher Reynolds number case.

\begin{figure}[!htp]
  \centering
  \begin{subfigure}[b]{0.45\textwidth}
    \includegraphics[width=\textwidth]{../try 2/polar_low.png}
    \caption{\(Re = 1\times 10^5\)}
    \label{fig:polar_low}
  \end{subfigure}
  \hfill
  \begin{subfigure}[b]{0.45\textwidth}
    \includegraphics[width=\textwidth]{../try 2/polar_high.png}
    \caption{\(Re = 5\times 10^6\)}
    \label{fig:polar_high}
  \end{subfigure}
  \caption{Drag polars for each combination of airfoil and flow}
  \label{fig:h_kt_6}

\end{figure}

\end{document}
