finalised branch :)

Commit
3074c4c8cbeac6a6e5a4d7fa4a8afe34ec39911d
Author
Marius Peter <blendoit@gmail.com>
Author date
Committer
Marius Peter <blendoit@gmail.com>
Committer date
Changed files
creator.py
index 210e5026..aa9fcbdd 100644..100644
@@ -358,7 +358,7 @@
358 358 y_chord = [0, 0]
359 359 plt.plot(x_chord, y_chord, linewidth='1')
360 360 # Plot quarter chord
361 Removed: plt.plot(airfoil.chord / 4, 0, '', color='g',
361 Added: plt.plot(airfoil.chord / 4, 0, '.', color='g',
362 362 markersize=24, label='Quarter-chord')
363 363 # Plot mean camber line
364 364 plt.plot(airfoil.x_c, airfoil.y_c, '-.', color='r', linewidth='2',
@@ -392,7 +392,9 @@
392 392 plt.xlabel('X axis')
393 393 plt.ylabel('Z axis')
394 394
395 Removed: # plot_bound = airfoil.x[-1]
395 Added: plot_bound = max(airfoil.x)
396 Added: plt.xlim(- 0.10 * plot_bound, 1.10 * plot_bound)
397 Added: plt.ylim(- (1.10 * plot_bound / 2), (1.10 * plot_bound / 2))
396 398 plt.gca().set_aspect('equal', adjustable='box')
397 399 plt.gca().legend()
398 400 plt.grid(axis='both', linestyle=':', linewidth=1)
evaluator.py
index 801c5aed..867ede93 100644..100644
@@ -137,19 +137,21 @@
137 137
138 138 def get_centroid(self):
139 139 '''Return the coordinates of the centroid.'''
140 Added:
140 141 stringer_area = self.stringer.area
141 142 caps_area = self.spar.cap_area
142 143
143 Removed: x_spars = self.spar.x + self.spar.x
144 Removed: x_stringers = self.stringer.x + self.stringer.x
145 Removed: z_stringers = self.stringer.z + self.stringer.z
146 Removed: denom = float(len(x_spars) * caps_area
147 Removed: + len(x_stringers) * stringer_area)
144 Added: spar_x = self.spar.x + self.spar.x
145 Added: stringers_x = self.stringer.x
146 Added: stringers_z = self.stringer.z
148 147
149 Removed: x_ctr = (sum([i * caps_area for i in self.spar.x])
150 Removed: + sum([i * stringer_area for i in x_stringers])) / denom
151 Removed: z_ctr = (sum([i * caps_area for i in self.spar.z])
152 Removed: + sum([i * stringer_area for i in z_stringers])) / denom
148 Added: denom = float(len(spar_x) * caps_area
149 Added: + len(stringers_x) * stringer_area)
150 Added:
151 Added: x_ctr = (sum([i * caps_area for i in spar_x[:][0]])
152 Added: + sum([i * stringer_area for i in stringers_x])) / denom
153 Added: z_ctr = (sum([i * caps_area for i in spar_x[:][0]])
154 Added: + sum([i * stringer_area for i in stringers_z])) / denom
153 155 return(x_ctr, z_ctr)
154 156
155 157 def get_inertia_terms(self):
@@ -159,10 +161,11 @@
159 161 caps_area = self.spar.cap_area
160 162
161 163 # Adds upper and lower components' coordinates to list
162 Removed: x_stringers = self.stringer.x + self.stringer.x
163 Removed: z_stringers = self.stringer.z + self.stringer.z
164 Removed: x_spars = self.spar.x + self.spar.x
165 Removed: z_spars = self.spar.z + self.spar.z
164 Added: x_stringers = self.stringer.x
165 Added: z_stringers = self.stringer.z
166 Added: x_spars = self.spar.x[:][0] + self.spar.x[:][1]
167 Added: z_spars = self.spar.z[:][0] + self.spar.z[:][1]
168 Added: print(x_spars)
166 169 stringer_count = range(len(x_stringers))
167 170 spar_count = range(len(self.spar.x))
168 171
@@ -209,31 +212,32 @@
209 212 y_chord = [0, 0]
210 213 plt.plot(x_chord, y_chord, linewidth='1')
211 214 # Plot quarter chord
212 Removed: q = evaluator.chord / 4
213 Removed: plt.plot(q, 0, '.', color='g', markersize=24, label='Quarter-chord')
214 Removed: # Plot upper surface
215 Removed: plt.plot(evaluator.x, evaluator.z,
216 Removed: '', color='b', linewidth='1')
217 Removed: # Plot lower surface
218 Removed: plt.plot(evaluator.x, evaluator.z,
219 Removed: '', color='b', linewidth='1')
215 Added: plt.plot(evaluator.chord / 4, 0, '.', color='g',
216 Added: markersize=24, label='Quarter-chord')
217 Added: # Plot airfoil surfaces
218 Added: plt.fill(evaluator.x, evaluator.z, color='b', linewidth='1', fill=False)
220 219
221 220 # Plot spars
222 Removed: for _ in range(0, len(evaluator.spar.x)):
223 Removed: x = (evaluator.spar.x[_], evaluator.spar.x[_])
224 Removed: y = (evaluator.spar.z[_], evaluator.spar.z[_])
225 Removed: plt.plot(x, y, '.-', color='b')
226 Removed:
221 Added: try:
222 Added: for _ in range(len(evaluator.spar.x)):
223 Added: x = (evaluator.spar.x[_])
224 Added: y = (evaluator.spar.z[_])
225 Added: plt.plot(x, y, '-', color='b')
226 Added: except AttributeError:
227 Added: print('No spars to plot.')
227 228 # Plot upper stringers
228 Removed: for _ in range(0, len(evaluator.stringer.x)):
229 Removed: x = evaluator.stringer.x[_]
230 Removed: y = evaluator.stringer.z[_]
231 Removed: plt.plot(x, y, '.', color='y', markersize=12)
232 Removed: # Plot lower stringers
233 Removed: for _ in range(0, len(evaluator.stringer.x)):
234 Removed: x = evaluator.stringer.x[_]
235 Removed: y = evaluator.stringer.z[_]
236 Removed: plt.plot(x, y, '.', color='y', markersize=12)
229 Added: try:
230 Added: for _ in range(0, len(evaluator.stringer.x)):
231 Added: x = evaluator.stringer.x[_]
232 Added: y = evaluator.stringer.z[_]
233 Added: plt.plot(x, y, '.', color='y', markersize=12)
234 Added: except AttributeError:
235 Added: print('No stringers to plot.')
236 Added: # # Plot lower stringers
237 Added: # for _ in range(0, len(evaluator.stringer.x)):
238 Added: # x = evaluator.stringer.x[_]
239 Added: # y = evaluator.stringer.z[_]
240 Added: # plt.plot(x, y, '.', color='y', markersize=12)
237 241
238 242 # Plot centroid
239 243 x = evaluator.centroid[0]
@@ -244,7 +248,7 @@
244 248 plt.xlabel('X axis')
245 249 plt.ylabel('Z axis')
246 250
247 Removed: plot_bound = evaluator.x[-1]
251 Added: plot_bound = max(evaluator.x)
248 252 plt.xlim(- 0.10 * plot_bound, 1.10 * plot_bound)
249 253 plt.ylim(- (1.10 * plot_bound / 2), (1.10 * plot_bound / 2))
250 254 plt.gca().set_aspect('equal', adjustable='box')
main.py
index 2f1ba1f4..b62b24f8 100644..100644
@@ -25,7 +25,7 @@
25 25 # Airfoil dimensions
26 26 NACA_NUM = 2412
27 27 CHORD_LENGTH = 100
28 Removed: SEMI_SPAN = 20
28 Added: SEMI_SPAN = 140
29 29
30 30 # Airfoil thickness
31 31 T_UPPER = 0.1
@@ -41,8 +41,8 @@
41 41 STRINGER_AREA = 0.1 # sqin
42 42
43 43 # Amount of stringers
44 Removed: TOP_STRINGERS = 4
45 Removed: BOTTOM_STRINGERS = 7
44 Added: TOP_STRINGERS = 5
45 Added: BOTTOM_STRINGERS = 4
46 46 NOSE_TOP_STRINGERS = 3
47 47 NOSE_BOTTOM_STRINGERS = 6
48 48
@@ -71,7 +71,7 @@
71 71 af.add_naca(NACA_NUM)
72 72 af.add_mass(AIRFOIL_MASS)
73 73 # af.info_print(2)
74 Removed: af.info_save(SAVE_PATH, _)
74 Added: # af.info_save(SAVE_PATH, _)
75 75
76 76 # Create spar instance
77 77 af.spar = creator.Spar()
@@ -82,7 +82,7 @@
82 82 af.spar.add_spar_caps(SPAR_CAP_AREA)
83 83 af.spar.add_mass(SPAR_MASS)
84 84 # af.spar.info_print(2)
85 Removed: af.spar.info_save(SAVE_PATH, _)
85 Added: # af.spar.info_save(SAVE_PATH, _)
86 86
87 87 # Create stringer instance
88 88 af.stringer = creator.Stringer()
@@ -95,17 +95,17 @@
95 95 af.stringer.add_area(STRINGER_AREA)
96 96 af.stringer.add_mass(STRINGER_MASS)
97 97 # af.stringer.info_print(2)
98 Removed: af.stringer.info_save(SAVE_PATH, _)
98 Added: # af.stringer.info_save(SAVE_PATH, _)
99 99
100 100 # Plot components with matplotlib
101 Removed: creator.plot_geom(af)
101 Added: # creator.plot_geom(af)
102 102
103 103 # Evaluator object contains airfoil analysis results.
104 Removed: # eval = evaluator.Evaluator(af)
104 Added: eval = evaluator.Evaluator(af)
105 105 # The analysis is performed in the evaluator.py module.
106 Removed: # eval.analysis()
106 Added: eval.analysis()
107 107 # eval.info_print(2)
108 Removed: # eval.info_save(SAVE_PATH, _)
108 Added: eval.info_save(SAVE_PATH, _)
109 109 # evaluator.plot_geom(eval)
110 110 # evaluator.plot_lift(eval)
111 111