You are on page 1of 20

Vortex Panel Method on NACA 1412 Airfoil

Muhammad Arviano Yuono Jonwin Fidelis Fam Hafizh Renanto Akhmad


Aerospace Engineering Aerospace Engineering Aerospace Engineering
Institut Teknologi Bandung Institut Teknologi Bandung Institut Teknologi Bandung
Bandung, Indonesia Bandung, Indonesia Bandung, Indonesia
13621034@mahasiswa.itb.ac.id 13621051@mahasiswa.itb.ac.id 13621060@mahasiswa.itb.ac.id

Abstract—This report is the 2nd coding assignment of Thus, in a uniform flow condition 𝑉𝑉∞ at 0° angle of attack
Aerodynamics II Course (AE 3210) about Vortex Panel Method. using m vortex panels, the velocity potential at the i-th control
Under this report, a calculation of pressure distribution and lift point (𝑥𝑥𝑖𝑖 , 𝑦𝑦𝑖𝑖 ) is,
at 0° angle of attack and compare between vortex panel method
and experiment results using XFLR5. The airfoil that is 𝜙𝜙(𝑥𝑥𝑖𝑖 , 𝑦𝑦𝑖𝑖 ) = V∞ (𝑥𝑥𝑖𝑖 cos 𝛼𝛼 + 𝑦𝑦𝑖𝑖 sin 𝛼𝛼)
analyzed is a NACA 1412 airfoil. 𝑚𝑚
𝛾𝛾�𝑠𝑠𝑗𝑗 �
− �� arctan 𝛽𝛽 𝑑𝑑𝑠𝑠𝑗𝑗 (1)
Keywords—Aerodynamics II, Vortex Panel Method, NACA 2𝜋𝜋
𝑗𝑗=1
1421
where:
I. BASIC THEORY
𝑠𝑠𝑗𝑗
An airfoil is the section of a wing cut by a plane parallel 𝛾𝛾�𝑠𝑠𝑗𝑗 � = 𝛾𝛾𝑗𝑗 + �𝛾𝛾𝑗𝑗+1 − 𝛾𝛾𝑗𝑗 � � � (2)
𝑆𝑆𝑗𝑗
to the xz-plane [1]. Within the assumed inviscid flow, the lift
and moments on the airfoil are due from pressure distribution and
below the stall region. Under these conditions, a theoretical 𝑦𝑦𝑖𝑖 − 𝑦𝑦𝑗𝑗
estimation of airfoil lift and moments can be predicted. In 𝛽𝛽 = (3)
𝑥𝑥𝑖𝑖 − 𝑥𝑥𝑗𝑗
order to do so, further conceptual understanding regarding the
vortex sheets must be done. Following the notation established in in Fig. 1., we
represent the coordinates of an arbitrary point on the j-th panel
A. Vortex Panels Method
using (𝑥𝑥𝑗𝑗 , 𝑦𝑦𝑗𝑗 ). This panel has a length denoted by 𝑆𝑆𝑗𝑗 and is
Vortex Panel Method is one variation of the use of panel positioned a distance 𝑠𝑠𝑗𝑗 away from the leading edge
method which involves representation of the airfoil by a
(measured along the panel itself). The subsequent integration
closed polygon of vortex panels. This method only works for
process encompasses the entire panel, extending from the
calculating the lift generated by the airfoil and wing itself. The
starting point (𝑋𝑋𝑗𝑗 , 𝑌𝑌𝑗𝑗 ) to the ending point (𝑋𝑋𝑗𝑗+1 , 𝑌𝑌𝑗𝑗+1 ). It ss
calculation of fuselage and nacelle characteristics and their
interference flows dictates the need to use source, and possibly important to note that capital letters consistently represent the
doublet as well as vortex panels. coordinates of boundary points. The (m + 1) values designated
as 𝛾𝛾𝑗𝑗 at these boundary points remain unknown constants,
Within this framework, the vortex-panel method offers a requiring numerical determination.
unique characteristic: the circulation intensity across each
panel transitions linearly from one corner to the other, The boundary condition requires that the velocity in the
ensuring continuity at the connection points (as shown in Fig. direction of the unit outward normal vector 𝒏𝒏𝒊𝒊 be vanishing at
1). This formulation already incorporates the Kutta condition, the i-th control point, so that
maintaining numerical stability even with a moderate number 𝜕𝜕
of panels. However, employing an excessive number of 𝜙𝜙(𝑥𝑥𝑖𝑖 , 𝑦𝑦𝑖𝑖 ) = 0; 𝑖𝑖 = 1,2, … , 𝑚𝑚
𝜕𝜕𝑛𝑛𝑖𝑖
panels, particularly on airfoils with sharply pointed trailing
edges, can introduce numerical instability. Carrying out the involved differentiation and integration
for source panels. we obtain
𝑚𝑚

�(𝐶𝐶𝑛𝑛1𝑖𝑖𝑖𝑖 𝛾𝛾𝑗𝑗′ + 𝐶𝐶𝑛𝑛2𝑖𝑖𝑖𝑖 𝛾𝛾𝑗𝑗+1



) = sin(𝜃𝜃𝑖𝑖 − 𝛼𝛼) ; 𝑖𝑖 = 1,2, … , 𝑚𝑚 (5)
𝑗𝑗=1

in which 𝛾𝛾 ′ = 𝛾𝛾/2𝜋𝜋𝑉𝑉∞ is a dimensionless circulation


density. 0; is the orientation angle of the ith panel measured
from the x axis to the panel surface, and the coefficients are
ex pressed by
𝐷𝐷𝐷𝐷
Fig. 1. Replacement of an airfoil by vortex panels of linearly varying 𝐶𝐶𝑛𝑛1𝑖𝑖𝑖𝑖 = + 𝐶𝐶𝐶𝐶 − 𝐶𝐶𝑛𝑛2𝑖𝑖𝑖𝑖 (6)
strength. 2
𝑄𝑄𝑄𝑄𝑄𝑄𝑆𝑆𝑗𝑗
The analysis assumes the object's surface is comprised of 𝐶𝐶𝑛𝑛2𝑖𝑖𝑖𝑖 = 𝐷𝐷 + − (𝐴𝐴𝐴𝐴 + 𝐷𝐷𝐷𝐷)𝐺𝐺𝐺𝐺𝑆𝑆𝑗𝑗 (7)
2
m flat panels, numbered in a clockwise direction beginning at
the trailing edge. The intersection points between adjacent
vortex panels define the "boundary points" on the airfoil's The constants shown in these and some later expressions
surface. To approximate the condition where the airfoil acts as are defined as
a streamline, the method enforces a zero normal velocity
component at designated "control points," which are 𝐴𝐴 = −�𝑥𝑥𝑖𝑖 − 𝑋𝑋𝑗𝑗 � cos 𝜃𝜃𝑗𝑗 − �𝑦𝑦𝑖𝑖 − 𝑌𝑌𝑗𝑗 � sin 𝜃𝜃𝑗𝑗 (8)
conveniently located at the midpoint of each panel. 2 2
𝐵𝐵 = �𝑥𝑥𝑖𝑖 − 𝑋𝑋𝑗𝑗 � + �𝑦𝑦𝑖𝑖 − 𝑌𝑌𝑗𝑗 � (9)
𝐶𝐶 = sin�𝜃𝜃𝑖𝑖 − 𝜃𝜃𝑗𝑗 � (10) pressure at each control point. Due to the absence of a normal
velocity component at these points, the local velocity solely
𝐷𝐷 = cos�𝜃𝜃𝑖𝑖 − 𝜃𝜃𝑗𝑗 � (11) possesses a tangential component along the panel surface.
Consequently, by denoting the unit tangential vector on the i-
𝐸𝐸 = −�𝑥𝑥𝑖𝑖 − 𝑋𝑋𝑗𝑗 � sin 𝜃𝜃𝑗𝑗 − �𝑦𝑦𝑖𝑖 − 𝑌𝑌𝑗𝑗 � cos 𝜃𝜃𝑗𝑗 (12) th panel as 𝑡𝑡𝑖𝑖 (refer to Fig. 1), we can compute the expression
𝑆𝑆𝑗𝑗2 + 2𝐴𝐴𝐴𝐴 for the local dimensionless velocity, often represented as
𝐹𝐹 = ln �1 + � (13) 𝜕𝜕𝜕𝜕
𝐵𝐵 � � 𝑉𝑉∞ .
𝜕𝜕𝑡𝑡𝑖𝑖
𝐸𝐸𝑆𝑆𝑗𝑗 𝑚𝑚
𝐺𝐺 = tan−1 (14)
𝐵𝐵𝐴𝐴𝑆𝑆𝑗𝑗 𝑉𝑉𝑖𝑖 = cos(𝜃𝜃 − 𝛼𝛼) + �(𝐶𝐶𝑡𝑡1𝑖𝑖𝑖𝑖 𝛾𝛾𝑗𝑗′ + 𝐶𝐶𝑡𝑡2𝑖𝑖𝑖𝑖 𝛾𝛾𝑗𝑗+1

) (26)
𝑗𝑗=1
𝑃𝑃 = �𝑥𝑥𝑖𝑖 − 𝑋𝑋𝑗𝑗 � sin�𝜃𝜃𝑖𝑖 − 2𝜃𝜃𝑗𝑗 � + �𝑦𝑦𝑖𝑖 − 𝑌𝑌𝑗𝑗 � cos�𝜃𝜃𝑖𝑖 − 2𝜃𝜃𝑗𝑗 � (15)
𝑖𝑖 = 1,2, … , 𝑚𝑚
𝑄𝑄 = �𝑥𝑥𝑖𝑖 − 𝑋𝑋𝑗𝑗 � cos�𝜃𝜃𝑖𝑖 − 2𝜃𝜃𝑗𝑗 � − �𝑦𝑦𝑖𝑖 − 𝑌𝑌𝑗𝑗 � sin�𝜃𝜃𝑖𝑖 − 2𝜃𝜃𝑗𝑗 � (16) In which
Note that these constants are functions of the coordinates 𝐶𝐶𝐶𝐶
𝐶𝐶𝑡𝑡1𝑖𝑖𝑖𝑖 = − 𝐷𝐷𝐷𝐷 − 𝐶𝐶𝑡𝑡2𝑖𝑖𝑖𝑖 (27)
of the i-th control points, those of the boundary points of the 2
j-th vortex panel, and the orientation angles of both i-th and j- 𝑃𝑃𝑃𝑃 (𝐴𝐴𝐴𝐴 − 𝐶𝐶𝐶𝐶)𝐺𝐺
th panels. They can be computed for all possible values of i 𝐶𝐶𝑡𝑡2𝑖𝑖𝑖𝑖 = 𝐷𝐷 +− (28)
and j once the panel geometry is specified. 2𝑆𝑆𝑗𝑗 𝑆𝑆𝑗𝑗
The expression in the parentheses on the left side of Eq. 𝜋𝜋
𝐶𝐶𝑡𝑡1𝑖𝑖𝑖𝑖 = 𝐶𝐶𝑡𝑡2𝑖𝑖𝑖𝑖 = (29)
(5.45) represents the normal velocity at the i-th control point 2
induced by the linear distribution of vortices on the j-th panel. Dissecting the expression within parentheses after the
The form of Equation (5) corresponding to constant-strength summation symbol unveils its physical significance: it
vortex panels is shown in Chow (1979, Section 2.8). For i = j, represents the tangential velocity induced at the i-th control
the coefficients have simplified values point by the vortex distribution on the j-th panel. For
𝐶𝐶𝑛𝑛1𝑖𝑖𝑖𝑖 = −1 and 𝐶𝐶𝑛𝑛2𝑖𝑖𝑖𝑖 = 1 programming convenience, Equation (26) can be recast as the
following
which describe the self-induced normal velocity at the i-th 𝑚𝑚+1
control point. To ensure a smooth flow at the trailing edge, the
𝑉𝑉𝑖𝑖 = cos(𝜃𝜃 − 𝛼𝛼) +; � 𝐴𝐴𝑡𝑡𝑖𝑖𝑖𝑖𝛾𝛾 ′ ; 𝑖𝑖 = 1,2, … , 𝑚𝑚 + 1 (30)
Kutta condition, which demands that the strength of the 𝑗𝑗
𝑗𝑗=1
vorticity at the trailing edge be zero) is applied that, in the
present notation, becomes where the tangential-velocity influence coefficients are
defined as follows:
𝛾𝛾1′ + ′
𝛾𝛾𝑚𝑚+1 =0 (17)
𝐴𝐴𝑡𝑡1𝑖𝑖𝑖𝑖 = 𝐶𝐶𝑡𝑡1𝑖𝑖𝑖𝑖 (31)
There are (m + 1) equations after combining Equation (5)
and Equation (17); they are sufficient to solve for the (m + I) 𝐴𝐴𝑡𝑡1𝑖𝑖𝑖𝑖 = 𝐶𝐶𝑡𝑡1𝑖𝑖𝑖𝑖 + 𝐶𝐶𝑡𝑡2𝑖𝑖𝑖𝑖−1 ; 𝑗𝑗 = 2,3, … , 𝑚𝑚 (32)
unknown 𝛾𝛾𝑗𝑗′ values. We may rewrite this system of
simultaneous equations in a more convenient form: 𝐴𝐴𝑡𝑡 𝑖𝑖𝑖𝑖+1 = 𝐶𝐶𝑡𝑡2𝑖𝑖𝑖𝑖 (33)
𝑛𝑛1 +1 The pressure coefficient at the i-th control point is,
� 𝐴𝐴𝑛𝑛𝑖𝑖𝑖𝑖𝛾𝛾 ′ = 𝑅𝑅𝑅𝑅𝑅𝑅; 𝑖𝑖 = 1,2, … , 𝑚𝑚 + 1 (18) according to the definition of Eq. (3.19),
𝑗𝑗
𝑗𝑗=1 𝐶𝐶𝑝𝑝𝑝𝑝 = 1 − 𝑉𝑉𝑖𝑖2 (34)
In which, for 𝑖𝑖 < 𝑚𝑚 + 1:
𝐴𝐴𝑛𝑛 1 = 𝐶𝐶𝑛𝑛1𝑖𝑖𝑖𝑖 (19)
𝐴𝐴𝑛𝑛 = 𝐶𝐶𝑛𝑛1𝑖𝑖𝑖𝑖 + 𝐶𝐶𝑛𝑛2𝑖𝑖𝑖𝑖−1 ; 𝑗𝑗 = 2,3, … , 𝑚𝑚 (20)
𝐴𝐴𝑛𝑛 𝑖𝑖𝑖𝑖+1 = 𝐶𝐶𝑛𝑛2𝑖𝑖𝑖𝑖 (21)
𝑅𝑅𝑅𝑅𝑆𝑆𝑗𝑗 = sin(𝜃𝜃𝑖𝑖 − 𝛼𝛼) (22)
And, for 𝑖𝑖 = 𝑚𝑚 + 1:
𝐴𝐴𝑛𝑛𝑖𝑖𝑖𝑖 = 𝐴𝐴𝑛𝑛 𝑗𝑗𝑗𝑗+1 = 1 (23)
𝐴𝐴𝑛𝑛𝑖𝑖𝑖𝑖 = 0; 𝑗𝑗 = 2,3, … , 𝑚𝑚 (24)
𝑅𝑅𝑅𝑅𝑆𝑆𝑖𝑖 = 0 (25)
Except for 𝑖𝑖 = 𝑚𝑚 + 1, 𝐴𝐴𝑛𝑛𝑖𝑖𝑖𝑖 may be called the normal-
velocity influence coefficients rep resenting the influences of
𝛾𝛾𝑗𝑗′ on the normal velocity at the i-th control point.
Fig. 2. Determination of panel boundary points on an airfoil. Hollow
Having solved for the previously unknown circulation circles represent control points at centers of vortex panels.
densities, we can now embark on calculating the velocity and
The following example demonstrates the application of the C. NACA 1412 Airfoil
previously described vortex-panel method. It aims to calculate NACA Four-digit Wing Section has a name nomenclature
the airflow around a NACA 2412 airfoil at an angle of attack of ABXX, which A defines the maximum camber in
of 8°. Fig. 2 presents a straightforward yet dependable method percentage of chord, B defines the location of the maximum
for selecting boundary points on the airfoil. This technique camber in tenths of chord, and XX defines the maximum
involves drawing a circle centered at the airfoil's mid-chord thickness of the airfoil in percentage of chord. In standard
that intersects both the leading and trailing edges. When NACA Four-digit Wing Sections, the thickness distribution
employing 12 panels, the circle's circumference is divided into was selected to correspond closely for these wing section
12 arcs of equal length. Projecting these points onto the airfoil under the Equation (35)
surface yields 12 boundary points. As depicted in Fig. 2, the
trailing edge is designated twice, serving as both the first and 𝑡𝑡
±𝑦𝑦𝑡𝑡 = (0.2969√𝑥𝑥 − 0.126𝑥𝑥 − 0.3516𝑥𝑥 2
thirteenth boundary points. Connecting these points forms a 0.2
closed polygon comprised of 12 panels. This approach +0.2843𝑥𝑥 3 − 0.1015𝑥𝑥 4 ) (35)
automatically generates shorter panels around the leading and
trailing edges, where significant curvature changes occur. The shape of the mean lines can be analyzed as two
parabolic arcs tangent, equations defining the man lines were
B. Pressure Coefficient Distribution taken to be as follows. Equation (36) defines the y coordinates
Fig. 3. showcases the pressure coefficient distribution forward of maximum ordinate, while (37) aft of maximum
obtained from the computer program's output for a 12-panel ordinate.
configuration. This figure also includes results for 𝑚𝑚
𝑦𝑦𝑐𝑐 = 2 (2𝑝𝑝𝑝𝑝 − 𝑥𝑥 2 ) (36)
calculations using 48 and 120 panels, respectively, generated 𝑝𝑝
by the same program for comparison. Interestingly, the 𝑚𝑚
pressure distribution using just 12 panels closely resembles 𝑦𝑦𝑐𝑐 = [(1 − 2𝑝𝑝) + 2𝑝𝑝𝑝𝑝 − 𝑥𝑥 2 ] (37)
(1 − 𝑝𝑝)2
the exact solution across most of the airfoil, except for the
region near the leading edge. The significant discrepancies in Although for cambered airfoils, NACA 4-digit series
this region arise because, with 12 panels, the control points thickness isn't applied directly along the chord. Instead,
positioned near the leading edge are relatively far from the thickness is added/subtracted perpendicular to the mean
actual airfoil contour (as illustrated in Fig. 3). camber line at each point, ensuring a smooth shape. This
alters the upper (𝑥𝑥𝑈𝑈 , 𝑦𝑦𝑈𝑈 ) and lower (𝑥𝑥𝐿𝐿 , 𝑦𝑦𝐿𝐿 ) surface
coordinates into
𝑥𝑥𝑈𝑈 = 𝑥𝑥 − 𝑦𝑦𝑡𝑡 sin 𝜃𝜃 , 𝑦𝑦𝑈𝑈 = 𝑦𝑦𝑐𝑐 + 𝑦𝑦𝑡𝑡 cos 𝜃𝜃 (39)
𝑥𝑥𝐿𝐿 = 𝑥𝑥 + 𝑦𝑦𝑡𝑡 sin 𝜃𝜃, 𝑦𝑦𝐿𝐿 = 𝑦𝑦𝑐𝑐 − 𝑦𝑦𝑡𝑡 cos 𝜃𝜃 (40)
where,
𝑑𝑑𝑦𝑦𝑐𝑐
𝜃𝜃 = arctan (41)
𝑑𝑑𝑑𝑑
And
2𝑚𝑚
⎧ (𝑝𝑝 − 𝑥𝑥), 0 ≤ 𝑥𝑥 ≤ 𝑝𝑝
𝑑𝑑𝑦𝑦𝑐𝑐 𝑝𝑝2
= (42)
𝑑𝑑𝑑𝑑 ⎨ 2𝑚𝑚 (𝑝𝑝 − 𝑥𝑥), 𝑝𝑝 < 𝑥𝑥 ≤ 1
⎩(1 − 𝑝𝑝)2

Therefore, using (39) until (40), we can plot our NACA


1412 Airfoil in MATLAB as shown in Fig. 4.
Fig. 3. Calculated pressure distributions for three configurations of
vortex panels. II. AIRFOIL PANEL MODEL ALGORITHM
The Kutta-Joukowski theorem, introduced in Section 4.8, The algorithm for airfoil panel model is shown after
allows for the calculation of the total lift acting on the airfoil. references in the form of Appendix A.
This theorem states that the total circulation around the airfoil
is equivalent to the sum of contributions from all vortex
panels. Computing the lift using this method is
straightforward and is left as an exercise for the reader.

While the vortex-panel method outlined here appears


more intricate compared to exact methods like conformal
mapping for a single airfoil, its true strength lies in its ability
to analyze flows around multiple surfaces. These applications
encompass airfoils with flaps and slots, cascades representing
axial compressors or turbines, and many other scenarios Fig. 4. NACA 1412 Airfoil plot using MATLAB
where exact solutions are generally unavailable (refer to
Hess, 1971; Stevens et al., 1971). Subsequent chapters delve
into corrections necessary for compressibility effects and
viscous forces at high speeds or angles of attack.
III. RESULTS OF NUMERICAL THIN AIRFOIL THEORY
A. Coding Results
Using MATLAB to calculate the lift coefficient and
pressure distribution on 0° angle of attack can be seen in Fig.
5. We can see from Fig. 5 that because NACA 1412 is a
cambered airfoil, the pressure coefficient distribution of upper
and lower surface of the airfoil will not cancel out each other
at 0° angle of attack. Thus, as shown in Fig. 5. the coefficient
of lift will also not be zero at 0° angle of attack. Furthermore,
this condition is also shown to be true by using both numerical
methods (see Fig.7 and 8).
Fig. 8. Pressure coefficient distribution of NACA 1412 at 0° angle of
Furthermore, we can also observe how the effect on the attack using vortex panel method in XFLR5. The bright green line
numbers of panels that we use for vortex panel method will represent the viscous solution and the vague green line represent the
affect the pressure distribution solution as shown in Fig. 6. inviscid solution.

Fig. 7. Pressure coefficient distribution of NACA 1412 at 0° angle of


attack using vortex panel method in JavaFoil

IV. COMPARISON OF VORTEX PANEL METHOD AND


Fig. 5. Pressure coefficient distribution of NACA 1412 at 0° angle of EXPERIMENTAL RESULTS
attack using vortex panel method in MATLAB
A. Lift at 0°Angle of Attack
B. XFLR5 and JavaFoil Results The lift comparison results between the lift calculated
Using XFLR5 for NACA 1412 airfoil at 0° angle of using the vortex panel method and numerical method (XFLR5
attack with 199 panels gives us the result as shown in Fig. 7. and JavaFoil) can be seen in the Table I.
Furthermore, using JavaFoil for the same airfoil with 201 TABLE I. COEFFICIENT OF LIFT RESULT TABLE
panels gives us the result as shown in Fig. 8. Although it is
worth noting that when using XFLR5, the lift coefficient that Numerical
Vortex Panel
we obtained came from a viscous solver mode. Thus, we need XFLR5 JavaFoil
to manually calculate the lift coefficient for inviscid flow 0.12786 0.12784 0.12900
from the inviscid pressure coefficient data.
TABLE II. COEFFICIENT OF LIFT ERROR TABLE

Error (%)
XFLR5 JavaFoil
0.29730 1.19155

Furthermore, we can see from Table II that the error


between the vortex panel method and numerical method
(XFLR5 and JavaFoil) is relatively small. The error occurs
due to the difference in solving method used by XFLR5 and
JavaFoil compared to the method that we use, which is
Vortex Panel Method. The solving method used by XFLR5
software is Vortex Lattice Method (VLM) by default. In the
other hand, JavaFoil uses potential flow analysis with a
higher-order panel approach and boundary layer analysis
Fig. 6. Variations of pressure coefficient distribution of NACA 1412 using integral technique. With that being said, from Table II
at 0° angle of attack by numbers of panel we can see that the error is relatively small to the point that
all three solving methods can be justified when it comes to
lift analysis of an arbitrary cambered airfoil with inviscid
flow.
B. Pressure Coefficient Distribution on The Airfoil
From Fig. 9, we can see the pressure coefficient
distribution comparison between the vortex panel method and
the inviscid pressure coefficient distribution obtained from
XFLR5. We can see by plotting both results in the same plot
that the pressure coefficient distribution of both are identical.
Meaning that the vortex panel method is accurate for the case
of inviscid arbitrary cambered airfoil lift calculation.

Fig. 9. Pressure coefficient distribution of NACA 1412 at 0° angle of


attack comparison between Vortex Panel Method and XFLR5 solution

V. CODE LISTING
The code listing is shown after references in the form of
Appendix B. This report uses MATLAB as the application for
the coding, and all computing languages uses the MATLAB
standard.
REFERENCES
[1] A. I. H. A. and V. D. A. E., Theory of Wing Sections: Including a
Summary of Airfoil Data. New York: Dover, 2015.
[2] A. M. Kuethe and C. C. Yen, Foundations of Aerodynamics Bases of
Aerodynamic Design. Chichester Wiley, 1998
[3] J. D. Anderson and C.P Cadou, Fundamentals of Aerodynamics, 7th
ed., New York: McGraw Hill, pp. 156-165.

APPENDIX
See next page.
Appendix A
Algorithm of The Panel Model for Airfoil
Algorithm of The ‘programAirfoil’ Function: The Vortex Panel Method
Algorithm of The ‘ClfromCp’ Function: Calculating Lift Coefficient from Pressure Disteibution
Appendix B

%% clear, clc

% Initialize NACA 4-digit series


nacaSeries = "1412";

% Initialize number of half-vortex-panels


Np = 200;

% Initialize angle of attack


AoA = deg2rad(0); %input

% Generate the airfoil


[airfoil, ~, ~, ~] = generateNACA4(nacaSeries, Np, 1, 1);

A. Obtain Control Points, Gamma, Dimensionless Velocity, and Pressure


Coefficient

[X, Y, ~, ~, Gamma, V, CP] = programAirfoil(Np, airfoil, AoA);

Gamma =

0.1666

-0.0933

-0.1105

-0.1174

B. Calculation of Lift Coefficient

Cl = ClFromCp(X, CP);
C. Figure Visualizaton: Cp and Airfoil

[minA, maxA]= bounds(CP);

[minB, maxB]= bounds(airfoil(2, :));

n = abs(minA)+abs(maxA);

if 0.9*abs(minA)/n < abs(minB)


n = n*0.9*abs(minB)*n/abs(minA);
elseif 0.9*abs(maxA)/n < abs(maxB)
n = n*0.9*abs(maxB)*n/abs(maxA);
end

figure(1)
hold on

yyaxis left
plot(X,CP);

set(gca,YMinorTick = 'on')

xlabel('x/c');
ylabel('Coefficient of Pressure');

set(gca,'YDir','reverse')

yyaxis right
fill(airfoil(1,:),airfoil(2,:),[0.9290 0.6940 0.1250]);
alpha(0.5)

ylabel('Thickness (x/c)');

xlim([0 1])
ylim([-maxA/n -minA/n])

text = sprintf('Pressure Distribution of NACA-%s Airfoil \n %d° Angle of


Attack ; Cl = %4f',nacaSeries, rad2deg(AoA), Cl);
title(text);
grid on;
grid minor;
D. Figure Visualization: Airfoil Only

figure(2)

hold on

xlabel('x/c');
ylabel('Thickness (x/c');

axis equal

xlim([0 1])
ylim([-0.2 0.2])

plot(airfoil(1, :), airfoil(2, :))

text = sprintf("NACA-%s Airfoil", nacaSeries);


title(text);

grid on
E. Analysis: Effect of Number of Panels
Get numbers of half-vortex-panels

Np1 = 6;

Np2 = 24;

% Get the airfoil


[airfoil1, ~, ~, ~] = generateNACA4(nacaSeries, Np1, 1, 1);
[airfoil2, ~, ~, ~] = generateNACA4(nacaSeries, Np2, 1, 1);

% Get the vortex panel method parameters


[X1, Y1, ~, ~, Gamma1, V1, CP1] = programAirfoil(Np1, airfoil1, AoA);
[X2, Y2, ~, ~, Gamma2, V2, CP2] = programAirfoil(Np2, airfoil2, AoA);

Gamma =

0.0106

-0.1439

-0.1591

F. Figure Visualization: Plot of Result of Different Panels

[minA, maxA]= bounds(CP);

[minB, maxB]= bounds(airfoil(2, :));


n = abs(minA)+abs(maxA);

if 0.9*abs(minA)/n < abs(minB)


n = n*0.9*abs(minB)*n/abs(minA);
elseif 0.9*abs(maxA)/n < abs(maxB)
n = n*0.9*abs(maxB)*n/abs(maxA);
end

figure(3)
hold on

yyaxis left
plot(X, CP);
scatter(X1, CP1, 36, 'o');
scatter(X2, CP2, 36, 'filled', 'o');

set(gca,YMinorTick = 'on')

xlabel('x/c');
ylabel('Coefficient of Pressure');

set(gca,'YDir','reverse')

yyaxis right
fill(airfoil(1,:), airfoil(2,:), [0.9290 0.6940 0.1250]);
alpha(0.5)

ylabel('Thickness (x/c)');

xlim([0 1])
ylim([-maxA/n -minA/n])

text = sprintf('Pressure Distribution of NACA-%s Airfoil \n %d° Angle of


Attack ; Cl = %4f',nacaSeries, rad2deg(AoA), Cl);
title(text);
grid on;
grid minor;

legend([sprintf("%g panels", Np), sprintf("%g panels", Np1), sprintf("%g


panels", Np2)])
G. Figure Visualization: Comparing with XFLR

dataXFLR = readmatrix("Alpha0Re3.150Naca1412.csv");

XXFLR = dataXFLR(:, 1)';


CPiXFLR = dataXFLR(:, 2)';

[minA, maxA]= bounds(CP);


[minB, maxB]= bounds(CPiXFLR);

n = abs(minA)+abs(maxA);
if 0.9*abs(minA)/n < abs(minB)
n = n*0.9*abs(minB)*n/abs(minA);
elseif 0.9*abs(maxA)/n < abs(maxB)
n = n*0.9*abs(maxB)*n/abs(maxA);
end

figure(4)
hold on

% yyaxis left
plot(X,CP);
plot(XXFLR, CPiXFLR)

set(gca,YMinorTick = 'on')

xlabel('x/c');
ylabel('Coefficient of Pressure');

set(gca,'YDir','reverse')

% yyaxis right
% fill(airfoil(1,:),airfoil(2,:),[0.9290 0.6940 0.1250]);
% alpha(0.5)

% ylabel('Thickness (x/c)');

xlim([0 1])
ylim([-maxA/n -minA/n])

text = sprintf('Comparison of Cp Distribution of NACA-%s, AoA = %g°\nXFLR5


(Inviscid) and Vortex Panel Method',nacaSeries, rad2deg(AoA));
title(text);
grid on;
grid minor;

legend(["Vortex Panel Method, 400 panels", "XFLR5 (Inviscid Model), 200


points"])
H. Function

function Cl = ClFromCp(X, Cp)


% Return lift coefficient from known pressure coefficient distribution
% Input:s
% X: chordwise location of the pressure coefficient
% Cp: values of pressure coefficient
% Output:
% Cl: lift coefficient

M = length(X);

Cpl = Cp(1:(M/2));
Cpl = flip(Cpl);
Cpu = Cp(((M/2)+1):end);

dCp = Cpl - Cpu;


dX = X(((M/2)+1):end);

Cl = trapz(dX,dCp);
end

function [X, Y, theta, S, Gamma, V, CP] = programAirfoil(Np, airfoil, AoA)


% This program computes velocity and pressure coefficient around an
% airfoil, whose contour is approximated by M vortex panels of linearly
% varying strength
% Input:
% Np: number of half-vortex panels
% airfoil: the boundary points coordinates of the airfoil
% AoA: angle of attack (in rad)
% Output:
% x, y: control point of each panel in the airfoil
% theta: orientation angle of each panel in the airfoil
% s: legnth of each panel in the airfoil
% gamma: vortex strength of each panel in the airfoil
% v: tangential velocity ratio at each panel in the airfoil
% cp: pressure coefficient at each panel in the airfoil

M = Np * 2;

% Airfoil Acquizition
XB = airfoil(1, :);
YB = airfoil(2, :);

% Initializing Arrays and Matrices


X = zeros(1, M);
Y = zeros(1, M);
S = zeros(1, M);
theta = zeros(1, M);
V = zeros(1, M);
CP = zeros(1, M);
RHS = zeros(1, M);
CN1 = zeros(M, M);
CN2 = zeros(M, M);
CT1 = zeros(M, M);
CT2 = zeros(M, M);
AN = zeros(M+1, M+1);
AT = zeros(M, M+1);

% Calculation of Control Points and Other Panel Parameters


for i = 1:M
X(i) = 0.5*(XB(i) + XB(i + 1));
Y(i) = 0.5*(YB(i) + YB(i + 1));

S(i) = sqrt((XB(i + 1) - XB(i))^2 + (YB(i + 1) - YB(i))^2);

theta(i) = atan2((YB(i + 1) - YB(i)), (XB(i + 1) - XB(i)));

RHS(i) = sin(theta(i) - AoA);


end

% Calculation of Coefficients
for i = 1:M
for j = 1:M
if (i == j)
CN1(i, j) = -1.0;
CN2(i, j) = 1.0;
CT1(i, j) = 0.5*pi;
CT2(i, j) = 0.5*pi;
else
A = -(X(i) - XB(j)) * cos(theta(j)) - (Y(i) - YB(j)) *
sin(theta(j));
B = (X(i) - XB(j))^2 + (Y(i) - YB(j))^2;
C = sin(theta(i) - theta(j));
D = cos(theta(i) - theta(j));
E = (X(i) - XB(j)) * sin(theta(j)) - (Y(i) - YB(j)) *
cos(theta(j));
F = log(1.0 + S(j) * (S(j) + 2 .* A) / B);
G = atan2(E * S(j), B + A * S(j));
P = (X(i) - XB(j)) * sin( theta(i) - 2 * theta(j) ) ...
+ (Y(i) - YB(j)) * cos( theta(i) - 2 * theta(j) );
Q = (X(i) - XB(j)) * cos( theta(i) - 2 * theta(j) ) ...
- (Y(i) - YB(j)) * sin( theta(i) - 2 * theta(j) );
CN2(i, j) = D + 0.5 * Q * F / S(j) - (A * C + D * E) * G /
S(j);
CN1(i, j) = 0.5 * D * F + C * G - CN2(i, j);
CT2(i, j) = C + 0.5 * P * F / S(j) + (A * D - C * E) * G /
S(j);
CT1(i, j) = 0.5 * C * F - D * G - CT2(i, j);
end
end
end

% Computation of Influence Coefficient


for i = 1:M
AN(i, 1) = CN1(i, 1);
AN(i, M + 1) = CN2(i, M);
AT(i, 1) = CT1(i, 1);
AT(i, M + 1) = CT2(i, M);

for j = 2:M
AN(i, j) = CN1(i, j) + CN2(i, j-1);
AT(i, j) = CT1(i, j) + CT2(i, j-1);
end
end

AN(M + 1, 1) = 1.0;
AN(M + 1, M + 1) = 1.0;

for j = 2:M
AN(M + 1, j) = 0.0;
end

RHS(M + 1) = 0.0;

% Solve for Gamma and Dimensionless Velocity and Pressure Coefficient


Gamma = AN\RHS'

for i = 1:M
V(i) = cos(theta(i) - AoA);
for j = 1:M + 1
V(i) = V(i) + AT(i, j) * Gamma(j);
CP(i) = 1.0 - V(i)^2;
end
end

Gamma = Gamma';
end
function [airfoil, camberline, upperline, lowerline] = generateNACA4(series,
num, spacing, closed_te)
% Generate Coordinate for NACA 4-digit and modified 4-digit airfoil
% Input:
% series: name of the series
% num: number of data points
% spacing: turn on for half-cosine spacing, otherwise unfirom spacing
% closed_te: turn on for closed trailing edge
% Output:
% AF: coordinates of the airfoils

series = char(series);
len = length(series);

if (spacing)
beta = linspace(0, pi, num+1);
x = (1 - cos(beta)) / 2;
else
x = linspace(0, 1, num+1);
end

if (len == 4)
% Normal NACA 4-digit series
m = str2double(series(1))/100;
p = str2double(series(2))/10;
t = str2double(series(3:4))/100;

yc = zeros(1, length(x));
dycdx = zeros(1, length(x));
yt = zeros(1, length(x));

xU = zeros(1, length(x));
yU = zeros(1, length(x));
xL = zeros(1, length(x));
yL = zeros(1, length(x));
for i=1:length(x)
if (x(i) < p)
yc(i) = m/p^2 * (2*p*x(i) - x(i)^2);
dycdx(i) = 2*m/p^2 * (p - x(i));
else
yc(i) = m/(1-p)^2 * ((1-2*p)+2*p*x(i)-x(i)^2);
dycdx(i) = 2*m/(1-p)^2 * (p - x(i));
end

if (closed_te)
yt(i) = t/0.2 * (0.2969*sqrt(x(i)) - 0.1260*x(i) -
0.3516*x(i)^2 + 0.2843*x(i)^3 - 0.1036*x(i)^4);
else
yt(i) = t/0.2 * (0.2969*sqrt(x(i)) - 0.1260*x(i) -
0.3516*x(i)^2 + 0.2843*x(i)^3 - 0.1015*x(i)^4);
end

theta = atan(dycdx(i));

xU(i) = x(i) - yt(i)*sin(theta);


xL(i) = x(i) + yt(i)*sin(theta);
yU(i) = yc(i) + yt(i)*cos(theta);
yL(i) = yc(i) - yt(i)*cos(theta);
end

airfoil = [flip(xL) xU(2:end); flip(yL) yU(2:end)];


camberline = [x; yc];
upperline = [xU; yU];
lowerline = [xL; yL];
else
print("This Program is incompatible outside of standard NACA 4-digit
airfoil.")
end
end

You might also like