You are on page 1of 30

# 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

Abstract
Aerodynamic 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 airfoils 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.

Contents
List 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 ............................................................................................................................................... 19 References .................................................................................................................................................. 20 Appendix ..................................................................................................................................................... 21

List of Symbols
Influence coefficient of bound vortex j on control point i (Dimensionless) Fourier coefficient Influence coefficient of wake vortex (Dimensionless) Chord Length (dimensionless) Section lift coefficient Moment coefficient about leading edge Moment coefficient about quarter-chord point Pressure coefficient Control Point index Bound Vortex and vortex panel index Lift per unit span Vortex strength (dimensionless) Moment about leading edge Number of Panels used to simulate the airfoil Distance vector from bound vortex j to control point i Trailing Edge Velocity tangential to panel Flow velocity at infinite distance from the airfoil (dimensionless) Coordinate of collocation point Location of center of pressure Airfoil angle of attack Constant vortex Circulation Panel j length Angle between influence radius vectors Variable used for integral transformations Instantaneous deflection of control surface Dummy variable Density (dimensionless)

1. Introduction
In 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.

2. Theory
2.1 Kutta condition
Simply stated, the Kutta condition describes natures 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 ( ) (2.1)

## 2.2 Thin Airfoil Theory

Thin 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
( )

(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 ( ) . This can be verified by referring to Anderson(324). The solution to (2.2) is ( )
( )

(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 The total circulation around the airfoil is (2.4) Using the following transformations, ( )

(2.5) (2.6)

And substituting the result into Eq.(2.3), ( From the Kutta-Jukowski theorem[1], (2.8) and from fundamental aerodynamics knowledge, (2.9) we arrive at (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 ( ) (2.11) ) (2.7)

Using Eqs(2.5,2.6) and performing the integration, (2.11) becomes (2.12) From fundamental aerodynamics knowledge (2.13) and from Eq.(2.10) (2.14)

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

(2.16)

## and substituting (2.15) into (2.16)

(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 Airfoils

Thin 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 ( ) ( and ) (2.18) . Substituting (2.18) into

## Our goal is to use Eq.(2.18) to arrive at values for (2.2)

( )

(2.19)

and evaluating the integrals and reducing (2.19) using the results obtained herein, a value for ( ) is found: (2.21) (2.20)

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

(2.22)

(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) [ Solving (2.24) gives ( and the lift per unit span is ( from which the lift coefficient becomes ( ) . Referring to (2.27) ) (2.26) ) (2.25) ( ) ] (2.24)

This result shows that the lift coefficient slope for any shape airfoil is Figure(4.9) in Anderson, the geometry shows explicitly ( where the zero-lift angle of attack is found to be ( ) )

(2.28)

(2.29)

By extension, the equation for the moment coefficient about the leading edge is * ( )+ (2.30)

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

(2.31)

The location of the center of pressure is known from fundamental aerodynamics knowledge: (2.32) Substituting (2.30) into (2.32) gives the center of pressure as a function of the lift coefficient: * (
9

)+

(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 Method

The 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 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 Airfoil

The 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 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 ( ) ( ). (2.34)

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

10

) .

(2.35)

Third, the angles between each panel and the horizontal need to be computed: ( Fourth, the influence radii between each panel: ( ) ( ) (2.37) ) (2.36)

Finally, the angles between each influence radius: [( when and (2.38b) when 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: for , and where ( and and ( ) (2.42) [ ( ) ( ) ( )] (2.41) ) ( ) ( ) (2.40) (2.39)
( )( )( ) ( ) ( )( )( ) )

(2.38a)

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

(2.43)

and and

)]

(2.44)

)]

(2.45)

( The

(2.46)

(2.47)

## is the column vector

Using the solutions to this system of equations, pressure coefficients and lift coefficients can be obtained. The pressure coefficient is derived from Bernoullis Equation as ( ) where ( ) * ( ) ( ) ( )+ (2.48)

)+ (2.49)

## The lift coefficient is then found using[5]

12

(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

3. Analysis
The first step to the vortex panel airfoil analysis was to obtain coordinates for the airfoils profile from the University of Illinois at Urbana Champaigns 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).

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.

14

Figure(3.2). AIC Matrix. The vortex strengths and vorticity are found as solutions to (2.47) to form a system of equations, where is the unknown, and . This system is solved through Gaussian elimination with partial pivoting. These values are presented in Figure(3.3).
x coll. 0.966635 0.84197 0.625935 0.37624 0.16163 0.035975 0.031015 0.15667 0.37624 0.625935 0.84197 0.966635 x node 1.00003 0.93324 0.7507 0.50117 0.25131 0.07195 0 0.06203 0.25131 0.50117 0.7507 0.93324 theta(i) -3.010591 -3.0472641 -3.0783181 -3.1377904 3.0472593 2.7965539 0.714649 0.1164926 -0.04799 -0.1071899 -0.1380448 -0.1742877 m(i) 1.1027468 0.9915361 0.9598768 0.9893461 1.0603056 1.2512424 0.2681776 -0.8212711 -1.076278 -1.1661928 -1.2429978 -1.4052664 gamma 0.1396484 0.1396484 0.1396484 0.1396484 0.1396484 0.1396484 0.1396484 0.1396484 0.1396484 0.1396484 0.1396484 0.1396484 delta(s) 0.0673673 0.1833551 0.2500304 0.2498618 0.180161 0.0764561 0.0821238 0.1905716 0.250148 0.2509704 0.1842932 0.0678175 cp 0.100001 0.010001 -0.03007 -0.0066 0.09863 0.549998 -1.10001 -0.9495 -0.55002 -0.30002 0.000107 0.081664 vt -0.94868 -0.99499 -1.01492 -1.0033 -0.94941 -0.67082 1.449142 1.396246 1.244999 1.140184 0.999946 0.958298

Figure(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

15

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 airfoils 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

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

17

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

18

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.

19

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.

20

Appendix
PROGRAM vortexpanel USE panels USE coeff USE partialpiv USE write USE aerodynamics IMPLICIT NONE REAL, DIMENSION(20) :: x, y, xc4, yc4, theta, b, m, dels REAL, DIMENSION(20,20) :: r, eta, a, ln, vt, cp INTEGER, DIMENSION(20) :: INDX REAL, ALLOCATABLE :: ans(:) INTEGER :: n, i REAL :: alpha, vinf, delsum, cl WRITE(*,*) "what is the number of panels?" READ(*,*) n ALLOCATE (ANS(20)) WRITE(*,*) "what is alpha in radians?" read(*,*) alpha CALL 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)*delsum CALL aero(vt,cp,n,ans,theta,ln,eta,vinf,alpha,delsum) CALL output(n,x,xc4,theta,dels,ans,cp,vt) END PROGRAM vortexpanel

21

## MODULE panels CONTAINS

SUBROUTINE mcl() IMPLICIT NONE REAL :: pi, deltatheta REAL :: xmcl, ymcl, x, y INTEGER :: n, i, error, j pi = 3.141593 deltatheta = 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, dels REAL,DIMENSION(20,20), INTENT(OUT) :: r, eta, ln INTEGER :: j, error, i, jp1, ip1 INTEGER, INTENT(IN) :: n REAL :: pi REAL, 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) IF (j == 13) EXIT END DO

22

delsum = 0 dels(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) + delsum END 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 DO END DO DO i = 1, n WRITE(18,'(12(f10.7,1X))') (ln(i,j),j=1,n) END DO END SUBROUTINE panelstuff END MODULE panels

23

MODULE coeff CONTAINS SUBROUTINE AIC(ln,eta,theta,n,a,b,alpha,vinf) IMPLICIT NONE REAL, DIMENSION(20,20), INTENT(IN) :: eta, ln REAL, DIMENSION(20), INTENT(IN) :: theta REAL, DIMENSION(20,20), INTENT(OUT) :: a REAL, DIMENSION(20,20) :: sumavortextan, lnterm, r REAL, DIMENSION(20), INTENT(OUT) :: b REAL, DIMENSION(20,20) :: avortexnor, avortextan, asourcenor, asourcetan INTEGER :: i, j, k, np1, jp1, ip1 INTEGER, INTENT(IN) :: n REAL :: pi REAL, INTENT(OUT) :: Vinf REAL, INTENT(IN) :: alpha OPEN(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 DO END DO b(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 DO END DO a(0,np1) = 0 DO 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 DO END DO a(np1,0) = 0 DO j = 1, n DO k = 1, n

24

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 DO END DO avortextan(i,np1) = 0 DO 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 DO END DO a(np1,np1) = 0 DO 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 AIC END MODULE coeff

25

MODULE partialpiv CONTAINS SUBROUTINE gaussianelim(n, aa, bb, xx) IMPLICIT NONE INTEGER, INTENT(IN) :: n REAL, INTENT(IN) :: aa(:,:), bb(:) REAL, ALLOCATABLE, INTENT(OUT) :: xx(:) INTEGER :: i, j, k, m, prow REAL(KIND=8) :: btemp, factor, pivot, det, detmin, sum REAL(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 DO END DO !~~Determine if solution exists~~! det = 1.d0 detmin = a(1,1) DO i=1, n det = det*a(i,i) IF (DABS(a(i,i)) < DABS(detmin)) detmin = a(i,i) END DO detmin = DABS(detmin)*1.d-6 IF (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 !~~Backward Substitution~~! IF (DABS(det) >= detmin) THEN

26

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 DO END IF xx = SNGL(x) RETURN END SUBROUTINE gaussianelim END MODULE partialpiv

MODULE aerodynamics

27

CONTAINS SUBROUTINE aero(vt,cp,n,ans,theta,ln,eta,vinf,alpha,delsum) IMPLICIT NONE REAL, DIMENSION(20), INTENT(IN) :: ans, theta!, vt, cp, vsum1, vsum2, vsumfactor,vsumfactor2 REAL, DIMENSION(20,20), INTENT(IN) :: eta, ln !REAL, DIMENSION(20,20), INTENT(OUT) :: vt, cp REAL, DIMENSION(20) :: vsum1, vsum2, vsumfactor, vsumfactor2 REAL, DIMENSION(20), INTENT(OUT) :: vt, cp !REAL, DIMENSION(20,20) :: vsum1, vsum2, vsumfactor, vsumfactor2 REAL, INTENT(IN) :: vinf, alpha, delsum REAL :: pi, cl, cmle, xcp, cl_theor, cmle_theor, cmc4_theor, xcp_theor, alphaL0_theor, A0, A1, A2 INTEGER, INTENT(IN) :: n INTEGER :: dummy, i, j pi = 4.*ATAN(1.) WRITE(*,*) delsum, ans(13) cl = ((2*ans(13))/vinf)*delsum dummy = 1 DO i = 1, n+1 WRITE(*,*) ans(i) END DO vt(i) = 0 DO 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 DO END 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 hand A0 = .041155768 A1 = .0954840633 A2 = .0791502466 cl_theor = pi*(2.*A0+A1) cmle_theor = -.25*(cl_theor + pi*(A1-A2)) cmc4_theor = .25*pi*(A2-A1) xcp_theor = .25*(1. + pi/cl_theor*(A1-A2))

28

alphaL0_theor = alpha - (A0+.5*A2) OPEN (unit=20, file='theoretical.dat') WRITE (20,*) cl_theor WRITE (20,*) cmle_theor WRITE (20,*) cmc4_theor WRITE (20,*) xcp_theor WRITE (20,*) alphaL0_theor

## WRITE(*,*) "Cl=",cl,"CmLE=",cmle,"xcp=",xcp END SUBROUTINE aero END MODULE aerodynamics

29

MODULE write CONTAINS SUBROUTINE output(n,x,xc4,theta,dels,ans,cp,vt) IMPLICIT NONE REAL, DIMENSION(20), INTENT(IN) :: x, xc4, theta, ans, dels REAL, DIMENSION(20,20), INTENT(IN) :: cp, vt INTEGER, INTENT(IN) :: n INTEGER :: i, j, dummy OPEN(UNIT = 12, FILE = 'tabulation.dat') dummy = 1 DO 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 output END MODULE write

30