Click here to load reader
Upload
christopher-iliffe-sprague
View
68
Download
3
Embed Size (px)
Citation preview
Christopher Iliffe Sprague
Aerodynamics
Lifting Line Theory Wing Design (Python 2.7)
Purpose
This program uses lifting line theory to estimate the lift, induced drag, root bending moment, and span efficiency factor of a
wing with specified characteristics in specified cruising conditions. This program also outputs spanwise plots of the wing's
geometric angle of attack distribution and lift distribution.
How it Works
This program uses a Fourier sin series evaluated at 11 evenly spaced spanwise locations on the wing to approximate the wing's
circulation distribution which then, by the Kutta Joukowski theorem, is used to estimate the wing's lift distribution. The
spanwise sectional geometric angle of attack varies sinusoidally along the span according to 𝛼 = 𝛼0sin(𝜃) where 𝜃 represents
the spanwise location and varies from 0 to 𝜋, 0 indicates the wing's left tip, 𝜋
2 indicates the wing's root, 𝜋 indicates the wing's
right tip; 𝛼0 represents the geometric angle of attack at the wing’s root.
Parameters
Chord (𝑐), Span (𝑏), Zero-Lift Angle of Attack (𝛼𝐿=0), Free Stream Density (𝜌∞), Free Stream Velocity (𝑣∞)
Christopher Iliffe Sprague
Aerodynamics
Example
Christopher Iliffe Sprague
Aerodynamics
Python 2.7 Code
1 # -*- coding: utf-8 -*-
2 #Christopher Iliffe Sprague
3 #661249889
4 #Aerodynamics
5 #Wing Project
6 import math
7 from sympy import *
8 import numpy
9 from scipy import integrate
10 #Basis
11 nlist=[1,2,3,4,5,6,7,8,9,10,11]
12 A1=symbols('A1')
13 A2=symbols('A2')
14 A3=symbols('A3')
15 A4=symbols('A4')
16 A5=symbols('A5')
17 A6=symbols('A6')
18 A7=symbols('A7')
19 A8=symbols('A8')
20 A9=symbols('A9')
21 A10=symbols('A10')
22 A11=symbols('A11')
23 Alist=[A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11]
Christopher Iliffe Sprague
Aerodynamics
24 #Functions
25 def Theta(n):
26 return (n*math.pi)/12.
27 def SpanwiseLocationCartesian(b,n):
28 y=(-b/2.)*math.cos(Theta(n))
29 return round(y,10)
30 #To reduce the root bending moment the geometric angle of attack distribution is modeled such that the geometric angle of
attack is maximum at the wing root. Sinusoidal geometric twist.
31 def GeometricAngleAttack(n,JigTwist,TipAngleAttack):
32 return JigTwist*math.sin(Theta(n))+TipAngleAttack
33 def GeometricAngleAttackPlotTheta(b,JigTwist,TipAngleAttack):
34 theta=symbols('theta')
35 return plot(JigTwist*sin(theta)+TipAngleAttack,(theta,0,math.pi))
36 def GeometricAngleAttackPlotCartesian(b,JigTwist,TipAngleAttack):
37 y=symbols('y')
38 theta=acos((-2.*y)/b)
39 print 'Generating Spanwise Geometric Angle of Attack Distribution Plot...'
40 #print 'Please exit plot to continue.'
41 return plot(JigTwist*sin(theta)+TipAngleAttack,(y,-b/2.,b/2.),title='Spanwise Geometric Angle of Attack
Distribution',xlabel='Spanwise Location [m]
',ylabel='Geometric Angle of Attack [rad]
')
42 def GeometricAngleAttackRootTheta(b,JigTwist,TipAngleAttack):
43 theta=symbols('theta')
44 return (JigTwist*sin(theta)+TipAngleAttack).subs(theta,math.pi/2.)
45 def EffectiveAngleAttack(b,n):
46 return al0 +
((2.*b)/(math.pi*c))*(A1*round(math.sin(1*Theta(n)),10)+A2*round(math.sin(2*Theta(n)),10)+A3*round(math.sin(3*Th
eta(n)),10)+A4*round(math.sin(4*Theta(n)),10)+A5*round(math.sin(5*Theta(n)),10)+A6*round(math.sin(6*Theta(n)),10)
+A7*round(math.sin(7*Theta(n)),10)+A8*round(math.sin(8*Theta(n)),10)+A9*round(math.sin(9*Theta(n)),10)+A10*rou
nd(math.sin(10*Theta(n)),10)+A11*round(math.sin(11*Theta(n)),10))
Christopher Iliffe Sprague
Aerodynamics
47 def InducedAngleAttack(n):
48 return
1*A1*round((math.sin(1*Theta(n))/math.sin(Theta(n))),10)+2*A2*round((math.sin(2*Theta(n))/math.sin(Theta(n))),10)+
3*A3*round((math.sin(3*Theta(n))/math.sin(Theta(n))),10)+4*A4*round((math.sin(4*Theta(n))/math.sin(Theta(n))),10)+
5*A5*round((math.sin(5*Theta(n))/math.sin(Theta(n))),10)+6*A6*round((math.sin(6*Theta(n))/math.sin(Theta(n))),10)+
7*A7*round((math.sin(7*Theta(n))/math.sin(Theta(n))),10)+8*A8*round((math.sin(8*Theta(n))/math.sin(Theta(n))),10)+
9*A9*round((math.sin(9*Theta(n))/math.sin(Theta(n))),10)+10*A10*round((math.sin(10*Theta(n))/math.sin(Theta(n))),1
0)+11*A11*round((math.sin(11*Theta(n))/math.sin(Theta(n))),10)
49 def FundamentalEquation(b,n,JigTwist,TipAngleAttack):
50 return Eq(EffectiveAngleAttack(b,n)+InducedAngleAttack(n),GeometricAngleAttack(n,JigTwist,TipAngleAttack))
51 def Coefficients(b,JigTwist,TipAngleAttack):
52 EqList=[]
53 for n in nlist:
54 EqList.append(FundamentalEquation(b,n,JigTwist,TipAngleAttack))
55 return solve(EqList,Alist) #Returns a dictionary of, ie. {A1: 0.0198}. Call coefficients value by
Coefficients(b,JigTwist,TipAngleAttack)[A1]
56 def Lift(b,JigTwist,TipAngleAttack):
57 A=Coefficients(b,JigTwist,TipAngleAttack)
58 integrand = lambda theta:
(A[A1]*math.sin(1*theta)+A[A2]*math.sin(2*theta)+A[A3]*math.sin(3*theta)+A[A4]*math.sin(4*theta)+A[A5]*math.si
n(5*theta)+A[A6]*math.sin(6*theta)+A[A7]*math.sin(7*theta)+A[A8]*math.sin(8*theta)+A[A9]*math.sin(9*theta)+A[A
10]*math.sin(10*theta)+A[A11]*math.sin(11*theta))*math.sin(theta)
59 return rho*(b**2)*(V**2)*integrate.quad(integrand,0.,math.pi)[0]
60 def SectionalLiftEqTheta(b,JigTwist,TipAngleAttack):
61 theta=symbols('theta')
62 A=Coefficients(b,JigTwist,TipAngleAttack)
63 return
rho*2.*b*(V**2)*(A[A1]*sin(1*theta)+A[A2]*sin(2*theta)+A[A3]*sin(3*theta)+A[A4]*sin(4*theta)+A[A5]*sin(5*theta)
+A[A6]*sin(6*theta)+A[A7]*sin(7*theta)+A[A8]*sin(8*theta)+A[A9]*sin(9*theta)+A[A10]*sin(10*theta)+A[A11]*sin(1
1*theta))
64 def SectionalLiftPlotTheta(b,JigTwist,TipAngleAttack):
Christopher Iliffe Sprague
Aerodynamics
65 theta=symbols('theta')
66 return plot(SectionalLiftEqTheta(b,JigTwist,TipAngleAttack),(theta,0,math.pi))
67 def SectionalLiftEqCartesian(b,JigTwist,TipAngleAttack):
68 y=symbols('y')
69 theta=acos((-2.*y)/b)
70 A=Coefficients(b,JigTwist,TipAngleAttack)
71 return
rho*2.*b*(V**2)*(A[A1]*sin(1*theta)+A[A2]*sin(2*theta)+A[A3]*sin(3*theta)+A[A4]*sin(4*theta)+A[A5]*sin(5*theta)
+A[A6]*sin(6*theta)+A[A7]*sin(7*theta)+A[A8]*sin(8*theta)+A[A9]*sin(9*theta)+A[A10]*sin(10*theta)+A[A11]*sin(1
1*theta))
72 def SectionalLiftPlotCartesian(b,JigTwist,TipAngleAttack):
73 y=symbols('y')
74 print 'Generating Spanwise Sectional Lift Distribution Plot...'
75 #print 'Please exit plot to continue.'
76 return plot(SectionalLiftEqCartesian(b,JigTwist,TipAngleAttack),(y,-b/2.,b/2.),title='Spanwise Sectional Lift
Distribution',xlabel='Spanwise Location [m]
',ylabel='Sectional Lift [N] ')
77 def RootMoment(b,JigTwist,TipAngleAttack):
78 A=Coefficients(b,JigTwist,TipAngleAttack)
79 integrand = lambda y: (rho*2.*b*(V**2)*(A[A1]*sin(1*acos((-2.*y)/b))+A[A2]*sin(2*acos((-
2.*y)/b))+A[A3]*sin(3*acos((-2.*y)/b))+A[A4]*sin(4*acos((-2.*y)/b))+A[A5]*sin(5*acos((-
2.*y)/b))+A[A6]*sin(6*acos((-2.*y)/b))+A[A7]*sin(7*acos((-2.*y)/b))+A[A8]*sin(8*acos((-
2.*y)/b))+A[A9]*sin(9*acos((-2.*y)/b))+A[A10]*sin(10*acos((-2.*y)/b))+A[A11]*sin(11*acos((-2.*y)/b))))*y
80 return integrate.quad(integrand,0,b/2)[0]
81 def SpanEfficiencyFactor(b,JigTwist,TipAngleAttack):
82 A=Coefficients(b,JigTwist,TipAngleAttack)
83 return (1 + 2.*(A[A2]/A[A1])**2 + 3.*(A[A3]/A[A1])**2 + 4.*(A[A4]/A[A1])**2 + 5.*(A[A5]/A[A1])**2 +
6.*(A[A6]/A[A1])**2 + 7.*(A[A7]/A[A1])**2 + 8.*(A[A8]/A[A1])**2 + 9.*(A[A9]/A[A1])**2 +
10.*(A[A10]/A[A1])**2 + 11.*(A[A11]/A[A1])**2)**(-1)
84 def InducedDrag(b,JigTwist,TipAngleAttack):
Christopher Iliffe Sprague
Aerodynamics
85 return
(2*Lift(b,JigTwist,TipAngleAttack)**2)/(math.pi*rho*(V**2)*(b**2)*SpanEfficiencyFactor(b,JigTwist,TipAngleAttack))
86 def Characteristics(b,JigTwist,TipAngleAttack):
87 print "Lift: ", round(Lift(b,JigTwist,TipAngleAttack),4), "Newtons [N]"
88 print "Induced Drag: ", round(InducedDrag(b,JigTwist,TipAngleAttack),4), "Newtons [N]"
89 print "Root Bending Moment: ", round(RootMoment(b,JigTwist,TipAngleAttack),4), "Newtons [N]"
90 print "Span Efficiency Factor: ", round(SpanEfficiencyFactor(b,JigTwist,TipAngleAttack),4)
91 #Interactivity
92 r='y'
93 print "*"*23, "Lifting Line Theory: Wing Design","*"*23
94 print "*"*22,"Author: Christopher Iliffe Sprague","*"*22
95 print
96 print '*Purpose*'
97 print "This program uses lifting line theory to estimate the lift, induced drag, root bending moment, and span efficiency
factor of a wing with specified characteristics in specified cruising conditions. This program also outputs spanwise plots of
the wing's geometric angle of attack distribution and lift distribution."
98 print
99 print '*How It Works*'
100 print "This program uses a Fourier sin series evaluated at 11 evenly spaced spanwise locations on the wing to approximate
the wing's circulation distribution which then, by the Kutta Joukowski theorem, is used to estimate the wing's lift
distribution. The spanwise sectional geometric angle of attack varies sinusoidally along the span according to
a=RootAngle*Sin(Theta), where Theta represents the spanwise location and varries from 0 to Pi, 0 indicates the wing's left
tip, Pi/2 indicates the wing's root, Pi indicates the wing's right tip."
101 print
102 print '*Parameters*'
103 print "*Wing Characteristic Parameters: Chord, Span, Zero-Lift Angle of Attack."
104 print "*Cruising Condition Parameters: Free Stream Density, Free Stream Velocity."
105 n=11.
106 print
Christopher Iliffe Sprague
Aerodynamics
107 print '*Example*'
108 print 'Free Stream Density = 1.225 kg/m^3, Free Stream Velocity = 30 m/s, Chord = 0.75 m, Symmetry = n, Zero-Lift
Angle of Attack = -0.08 rad, Span = 13.5 m, Root Geometric Angle of Attack = 0.085 rad.'
109 print
110 while r=='y':
111 print "*Operating Conditions*"
112 rho=float(raw_input("Free stream density at cruise in kilograms per cubic meter [kg/m^3]?: "))
113 V=float(raw_input("Free stream crusing velocity in meters per second [m/s]?: "))
114 print
115 print "*Airfoil Characteristics*"
116 c=float(raw_input("Chord length of the wing's cross section in meters [m]?: "))
117 CS=raw_input("Wing's cross section symetric?(y for yes, n for no): ")
118 if CS == "y":
119 al0=0.
120 if CS == "n":
121 al0=float(raw_input("Zero-lift angle of attack for the wing's cross section in radians [rad]?: "))
122 b=float(raw_input("Wing's span in meters [m]?: "))
123 JigTwist=float(raw_input("Geometric angle of attack at the wing's root in radians [rad]?: "))
124 print
125 raw_input('Press enter to calculate results... (This may take up to a minute)')
126 print
127 print '*Results*'
128 Characteristics(b,JigTwist,0)
129 print
130 GeometricAngleAttackPlotCartesian(b,JigTwist,0)
131 print
132 SectionalLiftPlotCartesian(b,JigTwist,0)
133 print
134 raw_input('Press enter to startover...')
135 print