quarter-chord densification

Commit
d80486b906e68380afdcf3a3693eaa3e81b38a9c
Author
Marius Peter <blendoit@gmail.com>
Author date
Committer
Marius Peter <blendoit@gmail.com>
Committer date
Changed files
creator.py
index 6cc22681..5c01d9c9 100644..100644
@@ -183,30 +183,29 @@
183 183 theta = atan(dy_c)
184 184 return theta
185 185
186 Removed: def get_upper_coordinates(x):
186 Added: def get_upper_coord(x):
187 187 x_u = x - get_thickness(x) * sin(get_theta(x))
188 188 z_u = get_camber(x) + get_thickness(x) * cos(get_theta(x))
189 189 return (x_u, z_u)
190 190
191 Removed: def get_lower_coordinates(x):
191 Added: def get_lower_coord(x):
192 192 x_l = x + get_thickness(x) * sin(get_theta(x))
193 193 z_l = get_camber(x) - get_thickness(x) * cos(get_theta(x))
194 194 return (x_l, z_l)
195 195
196 Removed: # Generate our airfoil geometry from previous sub-functions.
197 Removed: # Geometry is densest at leading edge: airfoil slope is highest here.
198 Removed: x_chord_10_percent = round(self.chord / 10)
199 Removed: # Densify x-coordinates 10 times for first 10% of the chord length
200 Removed: x_chord = [x / 10 for x in range(x_chord_10_percent * 10)]
201 Removed: x_chord.extend([x for x in range(x_chord_10_percent, self.chord + 1)])
196 Added: # Densify x-coordinates 10 times for first 1/4 chord length
197 Added: x_chord_25_percent = round(self.chord / 4)
198 Added: x_chord = [x / 10 for x in range(x_chord_25_percent * 10)]
199 Added: x_chord.extend([x for x in range(x_chord_25_percent, self.chord + 1)])
202 200
201 Added: # Generate our airfoil geometry from previous sub-functions.
203 202 for x in x_chord:
204 203 self.x_c.append(x)
205 204 self.y_c.append(get_camber(x))
206 Removed: self.x_u.append(get_upper_coordinates(x)[0])
207 Removed: self.z_u.append(get_upper_coordinates(x)[1])
208 Removed: self.x_l.append(get_lower_coordinates(x)[0])
209 Removed: self.z_l.append(get_lower_coordinates(x)[1])
205 Added: self.x_u.append(get_upper_coord(x)[0])
206 Added: self.z_u.append(get_upper_coord(x)[1])
207 Added: self.x_l.append(get_lower_coord(x)[0])
208 Added: self.z_l.append(get_lower_coord(x)[1])
210 209
211 210 super().pack_info()
212 211 return None
@@ -274,6 +273,8 @@
274 273 (upper nose, lower nose, upper surface, lower surface).
275 274
276 275 Parameters:
276 Added: airfoil_coord: packed airfoil coordinates
277 Added: spar_coord: packed spar coordinates
277 278 stringer_u_1: upper nose number of stringers
278 279 stringer_u_2: upper surface number of stringers
279 280 stringer_l_1: lower nose number of stringers
@@ -291,13 +292,10 @@
291 292 airfoil_z_l = airfoil_coord[3]
292 293 # Spar coordinates
293 294 # unpacked from 'coordinates' (list of lists in 'Coordinates').
294 Removed: try:
295 Removed: spar_x_u = spar_coord[0]
296 Removed: spar_z_u = spar_coord[1]
297 Removed: spar_x_l = spar_coord[2]
298 Removed: spar_z_l = spar_coord[3]
299 Removed: except:
300 Removed: print('Unable to initialize stringers. Were spars created?')
295 Added: spar_x_u = spar_coord[0]
296 Added: spar_z_u = spar_coord[1]
297 Added: spar_x_l = spar_coord[2]
298 Added: spar_z_l = spar_coord[3]
301 299
302 300 # Find distance between leading edge and first upper stringer
303 301 interval = spar_x_u[0] / (stringer_u_1 + 1)
@@ -361,17 +359,18 @@
361 359 x_chord = [0, airfoil.chord]
362 360 y_chord = [0, 0]
363 361 plt.plot(x_chord, y_chord, linewidth='1')
362 Added: # Plot quarter chord
363 Added: plt.plot(airfoil.chord / 4, 0, '.', color='g')
364 364 # Plot mean camber line
365 Removed: plt.plot(airfoil.x_c,
366 Removed: airfoil.y_c,
367 Removed: '-.',
368 Removed: color='r',
369 Removed: linewidth='2')
370 Removed: # label='mean camber line')
365 Added: plt.plot(airfoil.x_c, airfoil.y_c,
366 Added: '-.', color='r', linewidth='2',
367 Added: label='mean camber line')
371 368 # Plot upper surface
372 Removed: plt.plot(airfoil.x_u, airfoil.z_u, '', color='b', linewidth='1')
369 Added: plt.plot(airfoil.x_u, airfoil.z_u,
370 Added: '', color='b', linewidth='1')
373 371 # Plot lower surface
374 Removed: plt.plot(airfoil.x_l, airfoil.z_l, '', color='b', linewidth='1')
372 Added: plt.plot(airfoil.x_l, airfoil.z_l,
373 Added: '', color='b', linewidth='1')
375 374
376 375 # Plot spars
377 376 for _ in range(0, len(spar.x_u)):
@@ -395,6 +394,10 @@
395 394 plt.gca().set_aspect('equal', adjustable='box')
396 395 plt.xlabel('X axis')
397 396 plt.ylabel('Z axis')
397 Added:
398 Added: plot_bound = airfoil.x_u[-1]
399 Added: plt.xlim(- 5, plot_bound + 5)
400 Added: plt.ylim(- plot_bound / 2, plot_bound / 2)
398 401 plt.grid(axis='both', linestyle=':', linewidth=1)
399 402 plt.show()
400 403 return None
main.py
index fe5bb10b..ad24bb2a 100644..100644
@@ -22,12 +22,12 @@
22 22 start_time = time.time()
23 23
24 24 # Airfoil dimensions
25 Removed: NACA_NUM = 4412
26 Removed: CHORD_LENGTH = 100
25 Added: NACA_NUM = 2412
26 Added: CHORD_LENGTH = 40
27 27 SEMI_SPAN = 200
28 28
29 29 # Component masses
30 Removed: AIRFOIL_MASS = 100 # lbs
30 Added: AIRFOIL_MASS = 10 # lbs
31 31 SPAR_MASS = 10 # lbs
32 32 STRINGER_MASS = 5 # lbs
33 33