computational analysis of an naca 23012 airfoil

41
AER E 361 Computational Techniques for Aerospace Design Aerodynamic Characteristics of a NACA 23012 Airfoil ------------------------------------------- ----------------------------------- Computation and Analysis Group Members: Jonathan DeVries Ray Anaya Alex Bakken

Upload: jonathan-de-vries

Post on 21-Apr-2015

1.596 views

Category:

Documents


6 download

TRANSCRIPT

Page 1: Computational Analysis of an NACA 23012 Airfoil

AER E 361Computational Techniques for Aerospace Design

Aerodynamic Characteristics of a NACA 23012 Airfoil

------------------------------------------------------------------------------Computation and Analysis

Group Members:

Jonathan DeVries Ray Anaya Alex Bakken

Page 2: Computational Analysis of an NACA 23012 Airfoil

AbstractAerodynamic analysis is a subject rooted with a rich history of genius contributions

made by some of the greatest minds of the 20th century. For decades, these minds poured over wind tunnels, computers, and the classic pen and paper with the goal of discovering analysis techniques than those that were previously offered.

We explore three methods commonly used in aerodynamic analysis: thin airfoil theory, the discrete vortex panel method, and a full airfoil vortex panel method. This analysis is performed on an NACA 23012, in inviscid, incompressible, steady flow.

The bulk of this report covers the use of a vortex panel method which takes the airfoil’s entire contour into account; which, as expected, gave stunning accuracy. For instance: the NACA 23012 has a design lift coefficient of 0.3 (the first digit of an NACA 5-series multiplied by 0.15 gives the coefficient), while our numerical method provides a lift coefficient of 0.298 at zero angle of attack.

While there are no real implications of our results, the comparison of our computational results to theoretical and experimental values provides a good lesson on when and how the various techniques should be used. Thus, this project was an excellent learning tool for numerical methods in aerospace design.

2

Page 3: Computational Analysis of an NACA 23012 Airfoil

ContentsList of Symbols.............................................................................................................................................4

1. Introduction.............................................................................................................................................5

2. Theory.....................................................................................................................................................6

2.1 Kutta condition.................................................................................................................................6

2.2 Thin Airfoil Theory............................................................................................................................6

2.3 Thin Airfoil Theory for Cambered Airfoils..........................................................................................8

2.4 Discrete Vortex Panel Method.........................................................................................................10

2.5 Vortex Panel Method for Full Airfoil................................................................................................10

3. Analysis..................................................................................................................................................14

4. Results...................................................................................................................................................17

5. Conclusion.............................................................................................................................................18

References.................................................................................................................................................19

Appendix...................................................................................................................................................20

3

Page 4: Computational Analysis of an NACA 23012 Airfoil

List of Symbols

A❑ij Influence coefficient of bound vortex j on control point i (Dimensionless)

An Fourier coefficient

b i Influence coefficient of wake vortex (Dimensionless)

c Chord Length (dimensionless)c l Section lift coefficient

cm,≤¿¿ Moment coefficient about leading edge

cm, c/4 Moment coefficient about quarter-chord point

c p Pressure coefficient

i Control Point indexj Bound Vortex and vortex panel index

L ' Lift per unit spanmi Vortex strength (dimensionless)

M ¿' Moment about leading edge

N Number of Panels used to simulate the airfoilrij Distance vector from bound vortex j to control point i

TE Trailing Edgev ti Velocity tangential to panel

V ∞ Flow velocity at infinite distance from the airfoil (dimensionless)

xc Coordinate of collocation point

xcp Location of center of pressure

α Airfoil angle of attack

γ Constant vortexΓ CirculationΔ s j Panel j length

η Angle between influence radius vectorsθ Variable used for integral transformationsθi Instantaneous deflection of control surface

ξ Dummy variableρ Density (dimensionless)

4

Page 5: Computational Analysis of an NACA 23012 Airfoil

1. IntroductionIn this report, we discuss three different methods of airfoil analysis: Thin Airfoil Theory,

Discretized Vortex Panel method, and the normal 2-dimensional panel method. Thin airfoil theory is a great “fly by night” technique for estimating trends in aerodynamic characteristics, however, it make several assumptions which leave the result much to be desired when used for any practical application. The discretized vortex panel method is a more accurate method for analyzing an airfoil; however, it still lacks the accuracy necessary for rigorous design. While the first two methods may seem completely undesirable for any sort of practical use, they work great for very thin airfoils. The advantage of the normal vortex 2-dimensional method, however, is its ability to analyze an airfoil with noticeable thickness while taking into account the entire contour of the airfoil.

The goal of this analysis was to use computational methods to determine the aerodynamic characteristics of an NACA 23012 airfoil and to compare these values with theoretical and experimental results.

5

Page 6: Computational Analysis of an NACA 23012 Airfoil

2. Theory

2.1 Kutta conditionSimply stated, the Kutta condition describes nature’s tendency to adopt a certain value

of circulation such that the fluid flow leaves the trailing edge of the airfoil smoothly. One result of this is that, as shown in Figure 2.1, the velocities of flow leaving the upper and lower surfaces of the trailing edge must be both equal to zero for steady flow. However, adding a cusp to the airfoil provides such a small angle between the two surfaces at the leading edge that, due to the fact that both flows are orthogonal to each other, the velocities need not be equal to zero; yet they still must be equal to each other to satisfy this condition.

Because the velocities are equal at the trailing edge of any airfoil, the vorticity at the trailing edge will always be zero, or

γ (TE )≡0 (2.1)

2.2 Thin Airfoil TheoryThin airfoil theory is a basic tool for calculating fundamental aerodynamic characteristics

of thin, symmetrical airfoils. By placing a vortex sheet along the camber line, the airfoil can be simulated.

Following the derivation outlined in Anderson(4.7), one can arrive at the fundamental equation of thin airfoil theory

12π

∫0

cγ (ξ )x−ξ

dξ=V ∞(α− dzdx ) (2.2)

which states that the camber line is a streamline of the flow. Further, in order to satisfy the Kutta condition Eq.(2.2) needs to be satisfied for γ (c )=0. This can be verified by referring to Anderson(324). The solution to (2.2) is

γ (θ )=2αV ∞

(1+cos θ )sinθ

(2.3)

The fundamental equation of thin airfoil theory can be used to develop basic aerodynamic characteristics of a thin, symmetrical airfoil. Because the airfoil is thin, the term dz /dx=0. The total circulation around the airfoil is

Γ=∫0

c

γ (ξ )dξ (2.4)

6

Page 7: Computational Analysis of an NACA 23012 Airfoil

Using the following transformations,

ξ=c2

(1−cosθ ) (2.5)

dξ=c2sin θdθ (2.6)

And substituting the result into Eq.(2.3),

Γ=αcV ∞∫0

π

(1+cosθ )dθ=παV ∞ (2.7)

From the Kutta-Jukowski theorem[1],

L'=παc ρ∞V ∞2 (2.8)

and from fundamental aerodynamics knowledge,

c l=L'q∞ c

(2.9)

we arrive at

c l=2 πα (2.10)

which is an important result of thin airfoil theory. This relation shows that the theoretical lift coefficient of an airfoil varies linearly with angle of attack, which can be verified experimentally for any symmetric airfoil. Note that lift-coefficient computations must use units for angle of attack α in radians.

Thin airfoil theory may also be expanded to resolve theoretical values for the moment coefficient of a given airfoil. The equation for the theoretical leading edge moment is found to be

M ¿'=−ρ∞V ∞∫

0

c

ξγ (ξ )dξ (2.11)

Using Eqs(2.5,2.6) and performing the integration, (2.11) becomes

M ¿'=−q∞ c

2 πα2

(2.12)

From fundamental aerodynamics knowledge

7

Page 8: Computational Analysis of an NACA 23012 Airfoil

cm,≤¿=

M ¿'

q∞ c2=

−πα2

¿ (2.13)

and from Eq.(2.10)

πα=c l2

(2.14)

the moment coefficient about the leading edge is found to be

cm,≤¿=−c l4

¿ (2.15)

More importantly, the moment coefficient about the quarter-chord point can be found from Eq.(2.15). Since

cm, c/4=cm ,≤¿+c l4¿ (2.16)

and substituting (2.15) into (2.16)

cm, c/4=0 (2.17)

This result is important because it demonstrates that the theoretical center of pressure is at the quarter-chord point for symmetric airfoils.

A plot of the theoretical lift coefficient can be found in Figure(4.1).

2.3 Thin Airfoil Theory for Cambered AirfoilsThin airfoil theory can be further expanded for cambered airfoils. For a cambered

airfoil, dz/dx is no longer zero, and a finite result for the derivative needs to be obtained. Solving Eq.(2.2), we find that

γ (θ )=2V ∞(A0 1+cosθsin θ+∑n=1

Ansinnθ) (2.18)

Our goal is to use Eq.(2.18) to arrive at values for dz /dx , A0 and An. Substituting (2.18) into (2.2)

1π∫0

π A0 (1+cosθ )cos θ−cos θ0

dθ+ 1π∑n=1

∫0

π Ansinnθ sinθ

cosθ−cosθ0dθ=α−dz

dx (2.19)

and evaluating the integrals

∫0

πsinnθ sin θcosθ−cosθ0

dθ=−π cosnθ0 (2.20)

8

Page 9: Computational Analysis of an NACA 23012 Airfoil

and reducing (2.19) using the results obtained herein, a value for dz /dx is found:

dzdx

=(α−A0 )+∑n=1

An cosnθ0 (2.21)

A Fourier analysis, covered in Hildebrand(217), gives the final two values sought:

A0=α−1π∫0

πdzdxdθ0 (2.22)

and

An=2π∫0

πdzdxcos nθ0dθ0 (2.23)

To obtain aerodynamic coefficients, the circulation must be determined. Substituting (2.18) into (2.4) and using the transformations (2.5) and (2.6)

Γ=cV ∞[A0∫0

π

(1+cosθ )dθ+∑n=1

An∫0

π

sinnθ sinθ dθ] (2.24)

Solving (2.24) gives

Γ=cV ∞(π A0+ π2 A1) (2.25)

and the lift per unit span is

L'=ρ∞V ∞2 c (π A0+ π2 A1) (2.26)

from which the lift coefficient becomes

c l=π (2 A0+A1 ) (2.27)

This result shows that the lift coefficient slope for any shape airfoil is 2π . Referring to Figure(4.9) in Anderson, the geometry shows explicitly

c l=2 π (α−α L=0 ) (2.28)

where the zero-lift angle of attack is found to be

α L=0=−1π∫0

πdzdx

(cosθ0−1 )d θ0 (2.29)

9

Page 10: Computational Analysis of an NACA 23012 Airfoil

By extension, the equation for the moment coefficient about the leading edge is

cm,≤¿=−[ cl4 + π4

( A1−A2 )]¿ (2.30)

Substituting (2.30) into (2.16) gives the moment coefficient about the quarter chord:

cm, c/4=π4

( A1−A2 ) (2.31)

The location of the center of pressure is known from fundamental aerodynamics knowledge:

xcp=−cm,≤¿c

c l¿

(2.32)

Substituting (2.30) into (2.32) gives the center of pressure as a function of the lift coefficient:

xcp=c4 [1+ πc l ( A1−A2 )] (2.33)

While the center of pressure locations and leading edge moments depend on the lift coefficient, and thus angle of attack, the quarter chord moment does not. Thus, this moment stays around a constant value for each airfoil.

This extension of thin airfoil theory is important because it can be used for any type of thin airfoil, even symmetric airfoils. Evaluating these equations for a symmetric airfoil would result in everything reducing to their symmetric thin airfoil theory counterparts.

2.4 Discrete Vortex Panel MethodThe vortex panel method has greater capabilities than thin airfoil theory, where

thickness is no longer a restriction. It is analogous to the source panel method, with which it shares many characteristics. The method is the same, with the exception of introducing a vortex. By adding the vortex, the airfoil now has a circulation(Γ ) , the quantity of which is the total imbalance of pressure distribution, which effectively causes lift. To start the Vortex panel method, a mean camber line can be used to approximate the aerodynamic characteristics, just like in thin airfoil theory. The mean camber line however is discretized into N number of panels, each a straight line. Source/sinks are placed, yielding best results with as few panels as possible at the ¼ chord point of each panel. The strengths of the singularities affect each panel at its control point, or the ¾ chord of each panel. However, assumptions for this simplified version must be made. No Kutta condition is involved since no circulation is introduced, which gives a system of N equations with N unknowns. Then, the use of the geometry and influence coefficients gains access to the singularity strengths. Since this is a simplified version of the

10

Page 11: Computational Analysis of an NACA 23012 Airfoil

normal panel method, we can think of the mean camber line as essentially the top half of an airfoil.

2.5 Vortex Panel Method for Full AirfoilThe discrete vortex panel method can be expanded to use not only the mean camber

line, but the shape of the airfoil itself. This is the pinnacle of this analysis: an accurate way of numerically determining aerodynamic characteristics of an airfoil.

To begin, the airfoil shape is divided into N number of straight panels. This can be accomplished in a number of ways, although this group chose to use a method discussed in the analysis section below.

These panels are then used to determine five necessary characteristics of each panel. First, a fictitious control point must be chosen for each panel, which is determined by

(xc , yc )=( x j+x j+12,y j+ y j+12 ). (2.34)

Second, the length of each panel needs to be determined:

∆ s=√ (x i+x i+1)2+( y i+ y i+1 )2 . (2.35)

Third, the angles between each panel and the horizontal need to be computed:

θi=tan−1( y i+1− y i

x i+1−x i ) (2.36)

Fourth, the influence radii between each panel:

ri , j=√(xci−x j )2+( yci− y j )

2 (2.37)

Finally, the angles between each influence radius:

ηi , j=tan−1[ ( yci− y j+1) (xci−x j )−( xci−x j+1 ) ( yci− y j )

( yci− y j+1 ) ( yci− y j )+(xci−x j+1 ) (xci−x j ) ] (2.38a)

when i≠ j and

ηi , j=π (2.38b)

when i= j .

11

Page 12: Computational Analysis of an NACA 23012 Airfoil

In order to satisfy the fact that there is no velocity within the airfoil body, a no-penetration condition must be applied. Applying this condition yields:

∑j=1

N

m j A i , j+γ A i , N+1=b i (2.39)

for i=1,2,3 ,…, N , and where

Ai , j=12πsin (θi−θ j ) ln( ri , j+1r i , j )+ 1

2 πηi , j cos (θi−θ j ) (2.40)

and

Ai , N+1=∑j=1

N [ 12 π cos (θ i−θ j ) ln( ri , j+1ri , j )+ 12π

ηi , jcos (θi−θ j )] (2.41)

and

b i=V ∞ sin (θi−α ) (2.42)

The Kutta condition must also be satisfied. Applying this yields:

∑j=1

N

m j AN+1 , j+γ AN+1 , N+1=bN+1 (2.43)

where

AN+1 , j=∑k=1

N [ 12π ηk , jsin (θk−θ j )−12πcos (θk−θ j ) ln( rk , j+1rk , j )] (2.44)

and

AN+1 ,N+1=∑k=1

N

∑j=1

N [ 12π ηk , jcos (θk−θ j )+12πsin (θk−θ j ) ln (r k , j+1rk , j )] (2.45)

and

bN+1=−V ∞ cos (θ1−α )−V ∞ cos (θN−α ) (2.46)

The A terms form what is known as the aerodynamic influence coefficient matrix, or

12

Page 13: Computational Analysis of an NACA 23012 Airfoil

[ A i , j ⋯ An+1 , j

⋮ ⋱ ⋮A i ,n+1 ⋯ An+1 ,n+1

] (2.47)

This matrix is used to form a system of N+1 equations, in the form of

[ A i , j ⋯ An+1 , j

⋮ ⋱ ⋮A i ,n+1 ⋯ An+1 ,n+1

]×[ mi

⋮mn+1

]=[ b i⋮bn+1]where mi is the vortex strength, mN+1=γ is the vorticity, and b i ,…,bN+1 is the column vector formed by (2.42) and (2.46).

Using the solutions to this system of equations, pressure coefficients and lift coefficients can be obtained. The pressure coefficient is derived from Bernoulli’s Equation as

c p=1−( v tiV ∞)2

(2.48)

where

v ti=V ∞ cos (θi−α )+∑j=1

N m j

2π [ηi , j sin (θi−θ j )−cos (θi−θ j ) ln( ri , j+1r i , j )]+ γ2π

∑j=1

N [sin (θi−θ j ) ln( r i , j+1ri , j )+ηi , j cos (θi−θ j )](2.49)

The lift coefficient is then found using[5]

C l=2 γV ∞

∑j=1

N

∆s j (2.50)

This more accurate lift coefficient will in turn give more accurate values of moment coefficients and locations of center of pressure, using the equations developed in the thin airfoil theory discussion.

13

Page 14: Computational Analysis of an NACA 23012 Airfoil

3. AnalysisThe first step to the vortex panel airfoil analysis was to obtain coordinates for the

airfoil’s profile from the University of Illinois at Urbana Champaign’s airfoil database[3]. For an analysis using twelve panels, data points were removed from the coordinate profile until only every fifth point remained, which became the nodes of each panel. This method can be repeated for any number of panels, up to the maximum amount of data points in the coordinate file. A plot showing the airfoil contour, panels, and mean camber line is shown in Figure(3.1).

14

Page 15: Computational Analysis of an NACA 23012 Airfoil

Figure(3.1) Airfoil contour showing discretized panels

After the previous step was completed, a Fortran code was written for the actual analysis. It starts by taking the nodes as input and passing them through Eq.(2.34) to determine the collocation points on each panel. These node points are also used in Eq(2.36) to determine the angles between each panel. Note that this analysis was completed using a unit free-stream velocity.

The collocation points are then used to calculate influence radii between each panel and their corresponding angles. These quantities are used in Eqs.(2.37-2.46) to determine each element of the aerodynamic coefficient matrix, Eq(2.47). Figure(3.2) shows the resulting influence matrix.

Figure(3.2). AIC Matrix.

The vortex strengths m j and vorticity γ are found as solutions to (2.47) to form a system of N+1 equations, where m j is the unknown, and ¿m13 . This system is solved through Gaussian elimination with partial pivoting. These values are presented in Figure(3.3).

x coll. x node theta(i) m(i) gamma delta(s) cp vt

15

Page 16: Computational Analysis of an NACA 23012 Airfoil

0.966635 1.00003 -3.010591 1.1027468 0.1396484 0.0673673 0.100001 -0.948680.84197 0.93324 -3.0472641 0.9915361 0.1396484 0.1833551 0.010001 -0.99499

0.625935 0.7507 -3.0783181 0.9598768 0.1396484 0.2500304 -0.03007 -1.014920.37624 0.50117 -3.1377904 0.9893461 0.1396484 0.2498618 -0.0066 -1.00330.16163 0.25131 3.0472593 1.0603056 0.1396484 0.180161 0.09863 -0.94941

0.035975 0.07195 2.7965539 1.2512424 0.1396484 0.0764561 0.549998 -0.670820.031015 0 0.714649 0.2681776 0.1396484 0.0821238 -1.10001 1.449142

0.15667 0.06203 0.1164926 -0.8212711 0.1396484 0.1905716 -0.9495 1.3962460.37624 0.25131 -0.04799 -1.076278 0.1396484 0.250148 -0.55002 1.244999

0.625935 0.50117 -0.1071899 -1.1661928 0.1396484 0.2509704 -0.30002 1.1401840.84197 0.7507 -0.1380448 -1.2429978 0.1396484 0.1842932 0.000107 0.999946

0.966635 0.93324 -0.1742877 -1.4052664 0.1396484 0.0678175 0.081664 0.958298Figure(3.3) Tabulated output data for angle of attack of 4 degrees

The resulting values for vortex strength and vorticity are used in Eqs.(2.50,2.59) to find a computational lift coefficient and tangential velocities of each panel. The tangential velocities are further used to find center of pressure distribution around the airfoil, using Eq(2.48). The pressure distribution is shown in Figure(4.2), for an angle of attack of four degrees.

The vortex panel analysis was compared to theoretical, experimental, and previous computational coefficients for this airfoil.

The lift coefficient, computed here as 0.568 at four degrees angle of attack, does not differ much from other methods. The theoretical value gives 0.438, the experimental value[4] gives 0.5, and the previous computational method provides 0.53. More important, however, is the comparison of lift coefficients at zero angle of attack. As shown in section two of this report, the theoretical lift coefficient from thin airfoil theory gives an angle of attack of zero. The experimental value is nearly 0.1, and the previous computed value is 0.15. For the full vortex panel method, the lift coefficient is computed as 0.298, which is negligibly smaller than the design lift coefficient of 0.3. Thus, the vortex panel method for full airfoils is found to be an extremely accurate approximation, even when using only twelve panels for analysis.

The moment coefficient about the quarter chord point did not need values obtained from the vortex panel method. Thus, there are only two values of concern: those obtained from both types of thin airfoil theory. The value from symmetrical thin airfoil theory always returns a value of zero. However, a cambered airfoil produces additional lift that is independent of the angle of attack; it acts through a point on the airfoil which depends on the airfoil’s shape. This value is calculated as -0.01283, and is not dependent on angle of attack.

The pressure coefficient distribution, as computed by the full vortex panel method, was compared to the theoretical value as being nearly spot-on with theoretical values. An analysis using more than twelve panels would increase the accuracy of these data, however.

16

Page 17: Computational Analysis of an NACA 23012 Airfoil

4. Results

This section provides figures and tables of data that were achieved using methods described in this report.

17

Page 18: Computational Analysis of an NACA 23012 Airfoil

Figure(4.1). Comparison of lift coefficients obtained using various methods.

Figure(4.2). Pressure distribution of NACA 23012 at 4 degrees angle of attack.

18

Page 19: Computational Analysis of an NACA 23012 Airfoil

Figure(4.3). Center of pressure location as function of angle of attack.

19

Page 20: Computational Analysis of an NACA 23012 Airfoil

5. Conclusion There are many ways to analyze the aerodynamic characteristics of an airfoil. The

method which is chosen, though, depends on how much accuracy the analyst wants to achieve. Some applications may only need the amount of accuracy achieved by thin airfoil theory alone, however, thick and complex airfoils such as the 23012 benefit greatly from using the full vortex panel method. Many times in engineering analysis level of accuracy during analysis has a strong correlation with cost of design. Therefore, it is beneficial if the engineer is able to differentiate between these numerical methods, and apply each one to situations where they are most appropriate.

That said, this analysis provided a great perspective on what is produced with increasing accuracy. The vortex panel method produced values that coincide with what is to be expected for this airfoil. The lift coefficient at zero angle of attack is almost exactly at the design lift coefficient value.

20

Page 21: Computational Analysis of an NACA 23012 Airfoil

References

[1] Anderson, John D. Fundamentals of Aerodynamics. 5th ed. New York: McGraw-Hill, 2007. Print.

[2] Hildebrand, F.B.: Advanced Calculus for Applications, 2d ed., Prentice-Hall Inc., Englewood Cliffs, N.J., 1976.

[3] "NACA23012.dat." UIUC Airfoil Coordinates Database. UIUC Applied Aerodynamics Group, 2011. Web. 26 March 2012. <http://www.ae.illinois.edu/m-selig/ads/coord_database.html>.

[4] "NACA 23012 12%." Airfoil Investigation Database. UIUC Airfoil Coordinates Database, 25 Feb. 2012. Web. 31 Mar. 2012. <http://www.worldofkrauss.com/foils/1702>.

[5] “Panel Method.” Methods and Tools for Aerospace Design. Ambar K. Mitra, Iowa State university Dept. of Aerospace Engineering, 2010. Web. 31 Mar 2012. <http://www.public.iastate.edu/~akmitra/aero361/design_web/index.html>.

[6] Rajagopalan, Ganesh. AerE 361 Lecture. Pearson 1115, Ames, IA. Spring 2012. Lecture.

21

Page 22: Computational Analysis of an NACA 23012 Airfoil

AppendixPROGRAM vortexpanelUSE panelsUSE coeffUSE partialpivUSE writeUSE aerodynamicsIMPLICIT NONEREAL, DIMENSION(20) :: x, y, xc4, yc4, theta, b, m, delsREAL, DIMENSION(20,20) :: r, eta, a, ln, vt, cpINTEGER, DIMENSION(20) :: INDXREAL, ALLOCATABLE :: ans(:)INTEGER :: n, iREAL :: alpha, vinf, delsum, clWRITE(*,*) "what is the number of panels?"READ(*,*) nALLOCATE (ANS(20))WRITE(*,*) "what is alpha in radians?"read(*,*) alphaCALL panelstuff(x,y,xc4,yc4,r,eta,theta,n,ln,dels,delsum)CALL AIC(ln,eta,theta,n,a,b,alpha,vinf)CALL gaussianelim(n+1,a,b,ans)!cl = ((4*ans(13))/vinf)*delsumCALL aero(vt,cp,n,ans,theta,ln,eta,vinf,alpha,delsum)CALL output(n,x,xc4,theta,dels,ans,cp,vt)END PROGRAM vortexpanel

22

Page 23: Computational Analysis of an NACA 23012 Airfoil

MODULE panelsCONTAINS

SUBROUTINE mcl()IMPLICIT NONE

REAL :: pi, deltathetaREAL :: xmcl, ymcl, x, yINTEGER :: n, i, error, j

pi = 3.141593deltatheta = 30 * pi / 180

OPEN(unit = 12, file = "naca23012.dat")OPEN(unit = 14, file = "nacatest2.dat")

n = 10000

DO i = 1, 61 READ(12,*) x, y IF (x <= 1 .AND. x > 0.2025) THEN ymcl = 0.02208*(1-x) ELSE IF (x <= 0.2025 .AND. x >= 0) THEN ymcl = 2.6595*(x**3-0.6075*x**2+0.1147*x) END IF IF (x == 0) EXIT WRITE(14,*) x, ymcl deltatheta = deltatheta + (30*pi/180)END DO

END SUBROUTINE mcl

SUBROUTINE panelstuff(x,y,xc4,yc4,r,eta,theta,n,ln,dels,delsum)IMPLICIT NONE

REAL,DIMENSION(20), INTENT(OUT) :: x, y, xc4, yc4,theta, delsREAL,DIMENSION(20,20), INTENT(OUT) :: r, eta, lnINTEGER :: j, error, i, jp1, ip1INTEGER, INTENT(IN) :: nREAL :: piREAL, INTENT(OUT) :: delsum

pi = 4.*ATAN(1.)

OPEN(unit = 12, file = 'panels2.dat')OPEN(unit = 13, file = 'collocations.dat')OPEN(unit = 14, file = 'r.dat')OPEN(unit = 15, file = 'eta.dat')OPEN(unit = 16, file = 'theta.dat')OPEN(UNIT = 17, FILE = 'lnn.dat')OPEN(UNIT = 18, FILE = 'lnmat.dat')OPEN(UNIT = 19, FILE = 'xyc4.dat')DO j = 1, n+1 READ(12,*,iostat=error) x(j),y(j)

23

Page 24: Computational Analysis of an NACA 23012 Airfoil

IF (j == 13) EXITEND DOdelsum = 0dels(1) = SQRT((x(1)-x(2))**2+(y(1)-y(2))**2)DO i = 1, n ip1 = i+1 IF (i==n) THEN ip1 = 1 END IF IF (i >= 2) THEN dels(i) = SQRT((x(i)-x(ip1))**2+(y(i)-y(ip1))**2) END IF delsum = dels(i) + delsumEND DO

DO j = 1,n jp1 = j+1! xc4(j) = 3*(x(jp1)-x(j))/4 + x(j)! yc4(j) = 3*(y(jp1)-y(j))/4 + y(j) xc4(j) = (x(j)+x(jp1))/2 yc4(j) = (y(j)+y(jp1))/2 WRITE(19,*) xc4(j), yc4(j)END DO xc4(12) = xc4(1)DO j = 1,n WRITE(13,*) xc4(j), yc4(j)END DO

DO i = 1,n ip1 = i+1 IF (i == n) THEN ip1 = 1 END IF WRITE(17,*) "i=",i theta(i) = ATAN2(y(ip1)-y(i),x(ip1)-x(i)) WRITE(14,*) "i= ",i WRITE(15,*) "i= ",i WRITE(16,*) "i= ",i WRITE(16,*) theta(i) DO j = 1,n jp1 = j+1 r(i,j) = SQRT((xc4(i)-x(j))**2+(yc4(i)-y(j))**2) r(i,jp1) = SQRT((xc4(i)-x(jp1))**2+(yc4(i)-y(jp1))**2) eta(i,j) = ATAN2((yc4(i)-y(jp1))*(xc4(i)-x(j))-(xc4(i)-x(jp1))*(yc4(i)-y(j)),(yc4(i)-y(jp1))*(yc4(i)-y(j))+(xc4(i)-x(jp1))*(xc4(i)-x(j))) IF (i == j) THEN eta(i,j) = pi END IF ln(i,j) = LOG(r(i,jp1)/r(i,j)) WRITE(17,*) ln(i,j) WRITE(15,*) eta(i,j) WRITE(14,*) r(i,j), r(i,jp1) END DOEND DODO i = 1, n WRITE(18,'(12(f10.7,1X))') (ln(i,j),j=1,n)END DO

24

Page 25: Computational Analysis of an NACA 23012 Airfoil

END SUBROUTINE panelstuffEND MODULE panelsMODULE coeffCONTAINSSUBROUTINE AIC(ln,eta,theta,n,a,b,alpha,vinf)IMPLICIT NONEREAL, DIMENSION(20,20), INTENT(IN) :: eta, lnREAL, DIMENSION(20), INTENT(IN) :: thetaREAL, DIMENSION(20,20), INTENT(OUT) :: aREAL, DIMENSION(20,20) :: sumavortextan, lnterm, rREAL, DIMENSION(20), INTENT(OUT) :: bREAL, DIMENSION(20,20) :: avortexnor, avortextan, asourcenor, asourcetanINTEGER :: i, j, k, np1, jp1, ip1INTEGER, INTENT(IN) :: nREAL :: piREAL, INTENT(OUT) :: VinfREAL, INTENT(IN) :: alphaOPEN(UNIT = 12, FILE = 'atest.dat')OPEN(UNIT = 13, FILE = 'ln.dat')OPEN(UNIT = 14, FILE = 'atest2.dat')OPEN(UNIT = 15, FILE = 'bvector.dat')OPEN(UNIT = 18, FILE = 'eta2.dat')pi = 4.*ATAN(1.)Vinf = 1

np1 = n+1

DO i=1, n ip1 = i+1 b(i) = Vinf*sin(theta(i)-alpha) DO j=1, n jp1 = j+1 a(i,j) = (sin(theta(i)-theta(j))*ln(i,j))/(2*pi)+(eta(i,j)*cos(theta(i)-theta(j)))/(2*pi) END DOEND DOb(13) = -vinf*cos(theta(1)-alpha)-vinf*cos(theta(12)-alpha)DO i = 1, n WRITE(13,'(12(f10.7,1X))') (ln(i,j),j=1,n)END DO

DO i = 1, n DO j = 1, n WRITE(12,*) a(i,j) END DOEND DO

a(0,np1) = 0DO i = 1, n DO j = 1, n avortexnor(i,np1) = (cos(theta(i)-theta(j))*ln(i,j))/(2*pi)-(eta(i,j)*sin(theta(i)-theta(j))/(2*pi)) a(i,np1) = a(i,np1) + avortexnor(i,np1) END DOEND DO

a(np1,0) = 0DO j = 1, n

25

Page 26: Computational Analysis of an NACA 23012 Airfoil

DO k = 1, n asourcetan(np1,j) = (eta(k,j)*sin(theta(k)-theta(j)))/(2*pi)-(cos(theta(k)-theta(j))*ln(k,j))/(2*pi) a(np1,j) = a(np1,j)+asourcetan(np1,j) END DOEND DOavortextan(i,np1) = 0DO i = 1, n DO j = 1, n sumavortextan(i,np1) = (eta(i,j)*cos(theta(i)-theta(j)))/(2*pi)+(sin(theta(i)-theta(j))*ln(i,j))/(2*pi) avortextan(i,np1) = avortextan(i,np1) + sumavortextan(i,np1) END DOEND DOa(np1,np1) = 0DO i = 1, n a(np1,np1) = a(np1,np1) + avortextan(i,np1)END DO

DO i = 1, np1 WRITE(14,'(13(f10.7,1X))') (a(i,j),j=1,np1) WRITE(15,*) b(i)END DO

END SUBROUTINE AICEND MODULE coeff

26

Page 27: Computational Analysis of an NACA 23012 Airfoil

MODULE partialpivCONTAINS

SUBROUTINE gaussianelim(n, aa, bb, xx)IMPLICIT NONEINTEGER, INTENT(IN) :: nREAL, INTENT(IN) :: aa(:,:), bb(:)REAL, ALLOCATABLE, INTENT(OUT) :: xx(:)INTEGER :: i, j, k, m, prowREAL(KIND=8) :: btemp, factor, pivot, det, detmin, sumREAL(KIND=8), ALLOCATABLE :: a(:,:), b(:), x(:), atemp(:)

ALLOCATE (a(n,n), b(n), x(n), xx(n), atemp(n))a = DBLE(aa)b = DBLE(bb)

DO k=1, n-1 !~~Partial Pivoting~~! pivot = DABS(a(k,k)) prow = k DO m=k+1, n IF (DABS(a(m,k)) > pivot) THEN pivot = DABS(a(m,k)) prow = m END IF END DO atemp(:) = a(k,:) a(k,:) = a(prow,:) a(prow,:) = atemp(:) btemp = b(k) b(k) = b(prow) b(prow) = btemp !~~Gaussian Elimination~~! DO i=k+1, n factor = a(i,k)/a(k,k) DO j=k, n a(i,j) = a(i,j) - factor*a(k,j) END DO b(i) = b(i) - factor*b(k) END DOEND DO

!~~Determine if solution exists~~!det = 1.d0detmin = a(1,1)DO i=1, n det = det*a(i,i) IF (DABS(a(i,i)) < DABS(detmin)) detmin = a(i,i)END DOdetmin = DABS(detmin)*1.d-6IF (DABS(det) < detmin) THEN WRITE (*,*) "The determinant of the reduced matrix is 0" WRITE (*,*) "The system of equations has no real solution." x(:) = 0.END IF

27

Page 28: Computational Analysis of an NACA 23012 Airfoil

!~~Backward Substitution~~!IF (DABS(det) >= detmin) THEN x(n) = b(n)/a(n,n) DO i=n-1, 1, -1 sum = 0.d0 DO j=i+1, n, 1 sum = sum + (a(i,j)*x(j)) END DO x(i) = (b(i) - sum)/a(i,i) END DOEND IF

xx = SNGL(x)

RETURNEND SUBROUTINE gaussianelim

END MODULE partialpiv

28

Page 29: Computational Analysis of an NACA 23012 Airfoil

MODULE aerodynamicsCONTAINS

SUBROUTINE aero(vt,cp,n,ans,theta,ln,eta,vinf,alpha,delsum)IMPLICIT NONEREAL, DIMENSION(20), INTENT(IN) :: ans, theta!, vt, cp, vsum1, vsum2, vsumfactor,vsumfactor2REAL, DIMENSION(20,20), INTENT(IN) :: eta, ln!REAL, DIMENSION(20,20), INTENT(OUT) :: vt, cpREAL, DIMENSION(20) :: vsum1, vsum2, vsumfactor, vsumfactor2REAL, DIMENSION(20), INTENT(OUT) :: vt, cp!REAL, DIMENSION(20,20) :: vsum1, vsum2, vsumfactor, vsumfactor2REAL, INTENT(IN) :: vinf, alpha, delsumREAL :: pi, cl, cmle, xcp, cl_theor, cmle_theor, cmc4_theor, xcp_theor, alphaL0_theor, A0, A1, A2INTEGER, INTENT(IN) :: nINTEGER :: dummy, i, j

pi = 4.*ATAN(1.)WRITE(*,*) delsum, ans(13)cl = ((2*ans(13))/vinf)*delsumdummy = 1

DO i = 1, n+1 WRITE(*,*) ans(i)END DO

vt(i) = 0DO i = 1, n DO j = 1, n vsumfactor(i) = vinf*cos(theta(i)-alpha)+(ans(i)/(2*pi))*(eta(i,j)*sin(theta(i)-theta(j))-cos(theta(i)-theta(j))*ln(i,j))+(ans(13)/(2*pi))*(sin(theta(i)-theta(j))*ln(i,j)+eta(i,j)*cos(theta(i)-theta(j))) vt(i) = vt(i)+vsumfactor(i)

END DOEND DO

DO i = 1, n WRITE(*,*) vt(i)END DO

DO i = 1, n cp(i) = 1.-(vt(i)/vinf)**2! WRITE(*,*) cp(i,dummy)END DO

cmle = -cl/4.xcp = -cmle/cl

!Coefficients calculated by handA0 = .041155768A1 = .0954840633A2 = .0791502466cl_theor = pi*(2.*A0+A1)cmle_theor = -.25*(cl_theor + pi*(A1-A2))cmc4_theor = .25*pi*(A2-A1)

29

Page 30: Computational Analysis of an NACA 23012 Airfoil

xcp_theor = .25*(1. + pi/cl_theor*(A1-A2))alphaL0_theor = alpha - (A0+.5*A2)OPEN (unit=20, file='theoretical.dat')WRITE (20,*) cl_theorWRITE (20,*) cmle_theorWRITE (20,*) cmc4_theorWRITE (20,*) xcp_theorWRITE (20,*) alphaL0_theor

WRITE(*,*) "Cl=",cl,"CmLE=",cmle,"xcp=",xcp

END SUBROUTINE aeroEND MODULE aerodynamics

30

Page 31: Computational Analysis of an NACA 23012 Airfoil

MODULE writeCONTAINS

SUBROUTINE output(n,x,xc4,theta,dels,ans,cp,vt)IMPLICIT NONEREAL, DIMENSION(20), INTENT(IN) :: x, xc4, theta, ans, delsREAL, DIMENSION(20,20), INTENT(IN) :: cp, vtINTEGER, INTENT(IN) :: nINTEGER :: i, j, dummyOPEN(UNIT = 12, FILE = 'tabulation.dat')dummy = 1DO i = 1, n WRITE(12,'(8(f13.7,1X))') xc4(i), x(i), theta(i), ans(i), ans(13), dels(i), cp(i,dummy), vt(i,dummy)END DO

END SUBROUTINE outputEND MODULE write

31