remove sqrt operator from creator

Commit
7d0859d55a984a0c42111a620b3bb1ed7982c38e
Author
Marius Peter <blendoit@gmail.com>
Author date
Committer
Marius Peter <blendoit@gmail.com>
Committer date
Changed files
creator.py
index 22449bd1..15425bc1 100644..100644
@@ -29,7 +29,7 @@
29 29 import sys
30 30 import os.path
31 31 import numpy as np
32 Removed: from math import sin, cos, atan, sqrt
32 Added: from math import sin, cos, atan
33 33 import bisect as bi
34 34 import matplotlib.pyplot as plt
35 35
@@ -64,6 +64,8 @@
64 64
65 65 @classmethod
66 66 def from_dimensions(cls, chord, semi_span):
67 Added: """Create airfoil from its chord and semi-span."""
68 Added:
67 69 if chord > 20:
68 70 cls.chord = chord
69 71 else:
@@ -114,8 +116,8 @@
114 116 """Returns thickness from 1 'x' along the airfoil chord."""
115 117 x = 0 if x < 0 else x
116 118 z_t = 5 * t * self.chord * (
117 Removed: + 0.2969 * sqrt(x / self.chord)
118 Removed: - 0.1260 * (x / self.chord)
119 Added: + 0.2969 * (x / self.chord) ** 0.5
120 Added: - 0.1260 * (x / self.chord) ** 1
119 121 - 0.3516 * (x / self.chord) ** 2
120 122 + 0.2843 * (x / self.chord) ** 3
121 123 - 0.1015 * (x / self.chord) ** 4)
example_airfoil.py
index 966dcc82..10551160 100644..100644
@@ -12,8 +12,12 @@
12 12 #
13 13 # You should have received a copy of the GNU General Public License
14 14 # along with this program. If not, see <https://www.gnu.org/licenses/>.
15 Added: """
16 Added: Create an airfoil;
17 Added: Evaluate an airfoil;
18 Added: Generate a population of airfoils & optimize.
19 Added: """
15 20
16 Removed:
17 21 import creator # Create geometry
18 22 import evaluator # Evaluate geometry
19 23 import generator # Iteratevely evaluate instances of geometry and optimize
@@ -50,69 +54,56 @@
50 54 POP_SIZE = 1
51 55 SAVE_PATH = 'C:/Users/blend/github/UCLA_MAE_154B/save'
52 56
57 Added: # Create airfoil instance
58 Added: af = creator.Airfoil.from_dimensions(CHORD_LENGTH, SEMI_SPAN)
59 Added: af.add_naca(NACA_NUM)
60 Added: af.add_mass(AIRFOIL_MASS)
61 Added: # af.info_print(2)
62 Added: af.info_save(SAVE_PATH, 'foo_name')
53 63
54 Removed: def main():
55 Removed: """
56 Removed: Create an airfoil;
57 Removed: Evaluate an airfoil;
58 Removed: Generate a population of airfoils & optimize.
59 Removed: """
64 Added: # Create spar instance
65 Added: af.spar = creator.Spar()
66 Added: # Define the spar coordinates and mass, stored in single spar object
67 Added: af.spar.add_coord(af, 0.23)
68 Added: af.spar.add_coord(af, 0.57)
69 Added: # Automatically adds spar caps for each spar defined previously
70 Added: af.spar.add_spar_caps(SPAR_CAP_AREA)
71 Added: af.spar.add_mass(SPAR_MASS)
72 Added: af.spar.add_webs(SPAR_THICKNESS)
73 Added: # af.spar.info_print(2)
74 Added: af.spar.info_save(SAVE_PATH, 'foo_name')
60 75
61 Removed: # Create airfoil instance
62 Removed: af = creator.Airfoil.from_dimensions(CHORD_LENGTH, SEMI_SPAN)
63 Removed: # Define NACA airfoil coordinates and mass
64 Removed: af.add_naca(NACA_NUM)
65 Removed: af.add_mass(AIRFOIL_MASS)
66 Removed: # af.info_print(2)
67 Removed: af.info_save(SAVE_PATH, 'foo_name')
76 Added: # Create stringer instance
77 Added: af.stringer = creator.Stringer()
78 Added: # Compute the stringer coordinates from their quantity in each zone
79 Added: af.stringer.add_coord(af,
80 Added: NOSE_TOP_STRINGERS,
81 Added: TOP_STRINGERS,
82 Added: NOSE_BOTTOM_STRINGERS,
83 Added: BOTTOM_STRINGERS)
84 Added: af.stringer.add_area(STRINGER_AREA)
85 Added: af.stringer.add_mass(STRINGER_MASS)
86 Added: af.stringer.add_webs(SKIN_THICKNESS)
87 Added: # af.stringer.info_print(2)
88 Added: af.stringer.info_save(SAVE_PATH, 'foo_name')
68 89
69 Removed: # Create spar instance
70 Removed: af.spar = creator.Spar()
71 Removed: # Define the spar coordinates and mass, stored in single spar object
72 Removed: af.spar.add_coord(af, 0.23)
73 Removed: af.spar.add_coord(af, 0.57)
74 Removed: # Automatically adds spar caps for each spar defined previously
75 Removed: af.spar.add_spar_caps(SPAR_CAP_AREA)
76 Removed: af.spar.add_mass(SPAR_MASS)
77 Removed: af.spar.add_webs(SPAR_THICKNESS)
78 Removed: # af.spar.info_print(2)
79 Removed: af.spar.info_save(SAVE_PATH, 'foo_name')
90 Added: # Plot components with matplotlib
91 Added: creator.plot_geom(af, True)
80 92
81 Removed: # Create stringer instance
82 Removed: af.stringer = creator.Stringer()
83 Removed: # Compute the stringer coordinates from their quantity in each zone
84 Removed: af.stringer.add_coord(af,
85 Removed: NOSE_TOP_STRINGERS,
86 Removed: TOP_STRINGERS,
87 Removed: NOSE_BOTTOM_STRINGERS,
88 Removed: BOTTOM_STRINGERS)
89 Removed: af.stringer.add_area(STRINGER_AREA)
90 Removed: af.stringer.add_mass(STRINGER_MASS)
91 Removed: af.stringer.add_webs(SKIN_THICKNESS)
92 Removed: # af.stringer.info_print(2)
93 Removed: af.stringer.info_save(SAVE_PATH, 'foo_name')
93 Added: # Evaluator object contains airfoil analysis results.
94 Added: eval = evaluator.Evaluator(af)
95 Added: # The analysis is performed in the evaluator.py module.
96 Added: eval.analysis(1, 1)
97 Added: # eval.info_print(2)
98 Added: eval.info_save(SAVE_PATH, 'foo_name')
99 Added: # evaluator.plot_geom(eval)
100 Added: # evaluator.plot_lift(eval)
94 101
95 Removed: # Plot components with matplotlib
96 Removed: creator.plot_geom(af, True)
102 Added: pop = generator.Population(10)
97 103
98 Removed: # Evaluator object contains airfoil analysis results.
99 Removed: eval = evaluator.Evaluator(af)
100 Removed: # The analysis is performed in the evaluator.py module.
101 Removed: eval.analysis(1, 1)
102 Removed: # eval.info_print(2)
103 Removed: eval.info_save(SAVE_PATH, 'foo_name')
104 Removed: # evaluator.plot_geom(eval)
105 Removed: # evaluator.plot_lift(eval)
104 Added: # print(help(creator))
105 Added: # print(help(evaluator))
106 Added: # print(help(generator))
106 107
107 Removed: pop = generator.Population(10)
108 Removed:
109 Removed: # print(help(creator))
110 Removed: # print(help(evaluator))
111 Removed: # print(help(generator))
112 Removed:
113 Removed: # Print final execution time
114 Removed: print("--- %s seconds ---" % (time.time() - start_time))
115 Removed:
116 Removed:
117 Removed: if __name__ == '__main__':
118 Removed: main()
108 Added: # Print final execution time
109 Added: print("--- %s seconds ---" % (time.time() - start_time))
gui.py
index 483cc0cb..cd036b1d 100644..100644
@@ -23,8 +23,6 @@
23 23 FigureCanvasTkAgg, NavigationToolbar2Tk)
24 24
25 25
26 Removed: # def main():
27 Removed:
28 26 def new_field(parent, name):
29 27 """Add a new user input field."""
30 28
@@ -85,7 +83,3 @@
85 83 # plot.get_tk_widget().pack()
86 84
87 85 root.mainloop()
88 Removed:
89 Removed:
90 Removed: # if __name__ == '__main__':
91 Removed: # main()