obtain F_x, F_z and F_y

Commit
86a92de95e6894a2b6e23889214e943fdf211cdf
Author
Marius Peter <blendoit@gmail.com>
Author date
Committer
Marius Peter <blendoit@gmail.com>
Committer date
Changed files
creator.py
index c30480e2..9eda3c9f 100644..100644
@@ -81,9 +81,9 @@
81 81 print('Mass:', self.mass)
82 82 print('============================')
83 83 print('x_u the upper x-coordinates:\n', np.around(self.x_u, round))
84 Removed: print('z_u the upper y-coordinates:\n', np.around(self.z_u, round))
84 Added: print('z_u the upper z-coordinates:\n', np.around(self.z_u, round))
85 85 print('x_l the lower x-coordinates:\n', np.around(self.x_l, round))
86 Removed: print('z_l the lower y-coordinates:\n', np.around(self.z_l, round))
86 Added: print('z_l the lower z-coordinates:\n', np.around(self.z_l, round))
87 87 return None
88 88
89 89 def save_info(self, save_dir_path, number):
@@ -123,8 +123,8 @@
123 123 # NACA number
124 124 self.naca_num = int()
125 125 # Mean camber line
126 Removed: self.x_c = [] # Contains only integers from 0 to self.chord
127 Removed: self.y_c = [] # Contains floats
126 Added: self.x_c = []
127 Added: self.y_c = []
128 128
129 129 def add_naca(self, naca_num):
130 130 """
@@ -167,7 +167,7 @@
167 167 Returns thickness from 1 'x' along the airfoil chord.
168 168 """
169 169 y_t = 5 * t * self.chord * (
170 Removed: +0.2969 * sqrt(x / self.chord)
170 Added: + 0.2969 * sqrt(x / self.chord)
171 171 - 0.1260 * (x / self.chord)
172 172 - 0.3516 * (x / self.chord) ** 2
173 173 + 0.2843 * (x / self.chord) ** 3
@@ -212,6 +212,12 @@
212 212
213 213 def add_mass(self, mass):
214 214 self.mass = mass
215 Added:
216 Added: def print_info(self, round):
217 Added: super().print_info(round)
218 Added: print('x_c the camber x-coordinates:\n', np.around(self.x_u, round))
219 Added: print('z_c the camber z-coordinates:\n', np.around(self.x_u, round))
220 Added: return None
215 221
216 222
217 223 class Spar(Coordinates):
evaluator.py
index f4768e18..a734c784 100644..100644
@@ -15,7 +15,9 @@
15 15
16 16 from math import sin, cos, atan, sqrt
17 17
18 Added: # All of these functions take integer arguments and return lists.
18 19
20 Added:
19 21 def get_total_mass(*component):
20 22 total_mass = float()
21 23 for _ in component:
@@ -23,14 +25,37 @@
23 25 return total_mass
24 26
25 27
26 Removed: def lift_rectangular(lift, semi_span):
28 Added: def get_lift_rectangular(lift, semi_span):
27 29 L_prime = lift / (semi_span * 2)
28 30 return L_prime
29 31
30 32
31 Removed: def lift_elliptical(L_0, y, semi_span):
33 Added: def get_lift_elliptical(L_0, y, semi_span):
32 34 L_prime = L_0 * sqrt(1 - (y / semi_span) ** 2)
33 35 return L_prime
36 Added:
37 Added:
38 Added: def get_lift(rectangular, elliptical):
39 Added: F_z = (rectangular + elliptical) / 2
40 Added: return F_z
41 Added:
42 Added:
43 Added: def get_mass_distribution(airfoil, total_mass):
44 Added: F_z = [total_mass / airfoil.semi_span
45 Added: for x in range(0, airfoil.semi_span)]
46 Added: return F_z
47 Added:
48 Added:
49 Added: def get_drag(airfoil, drag):
50 Added: # Transform semi-span integer into list
51 Added: semi_span = [x for x in range(0, airfoil.semi_span)]
52 Added: cutoff = round(0.8 * airfoil.semi_span)
53 Added:
54 Added: F_x = [drag for x in semi_span[0:cutoff]]
55 Added: F_x.extend([1.25 * drag for x in semi_span[cutoff:]])
56 Added: # for x in semi_span[cutoff:]:
57 Added: # drag_distribution.append(1.25 * drag)
58 Added: return F_x
34 59
35 60
36 61 def get_centroid(airfoil):
main.py
index 0631bc9a..61e53635 100644..100644
@@ -76,21 +76,23 @@
76 76 af.stringer.add_mass(STRINGER_MASS)
77 77 # af.stringer.print_info(2)
78 78
79 Removed: print(evaluator.get_total_mass(af, af.spar, af.stringer))
79 Added: # print(evaluator.get_total_mass(af, af.spar, af.stringer))
80 Added: drag = evaluator.get_drag(af, 10)
81 Added: total_mass = evaluator.get_total_mass(af, af.spar, af.stringer)
82 Added: dist_mass = evaluator.get_mass_distribution(af, total_mass)
83 Added: print(total_mass)
84 Added: print(dist_mass)
80 85
81 86 # Plot components with matplotlib
82 87 creator.plot(af, af.spar, af.stringer)
83 88
84 89 # Save component info
85 Removed: af.save_info(SAVE_PATH, _)
86 Removed: af.spar.save_info(SAVE_PATH, _)
87 Removed: af.stringer.save_info(SAVE_PATH, _)
90 Added: # af.save_info(SAVE_PATH, _)
91 Added: # af.spar.save_info(SAVE_PATH, _)
92 Added: # af.stringer.save_info(SAVE_PATH, _)
88 93
89 94 # Evaluate previously created airfoil(s).
90 95 # total_mass = evaluator.get_total_mass(af, af.spar, af.stringer)
91 Removed:
92 Removed: # Iteratively evaluate airfoils by defining genetic generations.
93 Removed: # pass
94 96
95 97 # Print final execution time
96 98 print("--- %s seconds ---" % (time.time() - start_time))