*ARCHIVED* development moved to aircraft-studio.
docstrings
Changed files
creator.py
@@ -35,8 +35,7 @@
35
35
36
36
37
37
class Airfoil:
38
Removed:
"""
39
Removed:
This class represents a single NACA airfoil.
38
Added:
"""This class represents a single NACA airfoil.
40
39
41
40
Please note: the coordinates are saved as two lists
42
41
for the x- and z-coordinates. The coordinates start at
@@ -65,7 +64,6 @@
65
64
@classmethod
66
65
def from_dimensions(cls, chord, semi_span):
67
66
"""Create airfoil from its chord and semi-span."""
68
Removed:
69
67
if chord > 20:
70
68
cls.chord = chord
71
69
else:
@@ -78,8 +76,8 @@
78
76
return type(self).__name__
79
77
80
78
def add_naca(self, naca_num):
81
Removed:
"""
82
Removed:
This function generates geometry for a NACA number passed as argument.
79
Added:
"""Generate surface geometry for a NACA airfoil.
80
Added:
83
81
The nested functions perform the required steps to generate geometry,
84
82
and can be called to solve the geometry y-coordinate for any 'x' input.
85
83
Equation coefficients were retrieved from Wikipedia.org.
@@ -113,7 +111,7 @@
113
111
return (z_c * self.chord)
114
112
115
113
def get_thickness(x):
116
Removed:
"""Returns thickness from 1 'x' along the airfoil chord."""
114
Added:
"""Return thickness from 1 'x' along the airfoil chord."""
117
115
x = 0 if x < 0 else x
118
116
z_t = 5 * t * self.chord * (
119
117
+ 0.2969 * (x / self.chord) ** 0.5
@@ -169,9 +167,7 @@
169
167
self.mass = mass
170
168
171
169
def info_print(self, round):
172
Removed:
# TODO: implement this info getting method!
173
170
"""Print all the component's coordinates to the terminal."""
174
Removed:
175
171
name = ' CREATOR DATA FOR {} '.format(str(self).upper())
176
172
num_of_dashes = len(name)
177
173
print(num_of_dashes * '-')
@@ -186,10 +182,7 @@
186
182
return None
187
183
188
184
def info_save(self, save_path, number):
189
Removed:
"""
190
Removed:
Save all the object's coordinates (must be full path).
191
Removed:
"""
192
Removed:
185
Added:
"""Save all the object's coordinates (must be full path)."""
193
186
file_name = '{}_{}.txt'.format(str(self).lower(), number)
194
187
full_path = os.path.join(save_path, file_name)
195
188
try:
@@ -217,8 +210,7 @@
217
210
self.z_end = []
218
211
219
212
def add_coord(self, airfoil, x_loc_percent):
220
Removed:
"""
221
Removed:
Add a single spar at the % chord location given to function.
213
Added:
"""Add a single spar at the % chord location given to function.
222
214
223
215
Parameters:
224
216
airfoil: gives the spar access to airfoil's coordinates.
@@ -278,8 +270,7 @@
278
270
def add_coord(self, airfoil,
279
271
stringer_u_1, stringer_u_2,
280
272
stringer_l_1, stringer_l_2):
281
Removed:
"""
282
Removed:
Add equally distributed stringers to four airfoil locations
273
Added:
"""Add equally distributed stringers to four airfoil locations
283
274
(upper nose, lower nose, upper surface, lower surface).
284
275
285
276
Parameters:
@@ -362,9 +353,7 @@
362
353
363
354
def plot_geom(airfoil, view: False):
364
355
"""This function plots the airfoil's + sub-components' geometry."""
365
Removed:
366
356
fig, ax = plt.subplots()
367
Removed:
# ax.axis('off')
368
357
369
358
# Plot chord
370
359
x = [0, airfoil.chord]
evaluator.py
@@ -73,7 +73,6 @@
73
73
74
74
def info_save(self, save_path, number):
75
75
"""Save all the object's coordinates (must be full path)."""
76
Removed:
77
76
file_name = 'airfoil_{}_eval.txt'.format(number)
78
77
full_path = os.path.join(save_path, file_name)
79
78
try:
@@ -199,7 +198,6 @@
199
198
200
199
def analysis(self, V_x, V_z):
201
200
"""Perform all analysis calculations and store in class instance."""
202
Removed:
203
201
self.drag = self.get_drag(10)
204
202
self.lift_rectangular = self.get_lift_rectangular(13.7)
205
203
self.lift_elliptical = self.get_lift_elliptical(15)
example_airfoil.py
@@ -1,18 +1,5 @@
1
Removed:
# This file is part of Marius Peter's airfoil analysis package (this program).
2
Removed:
#
3
Removed:
# This program is free software: you can redistribute it and/or modify
4
Removed:
# it under the terms of the GNU General Public License as published by
5
Removed:
# the Free Software Foundation, either version 3 of the License, or
6
Removed:
# (at your option) any later version.
7
Removed:
#
8
Removed:
# This program is distributed in the hope that it will be useful,
9
Removed:
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
Removed:
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
Removed:
# GNU General Public License for more details.
12
Removed:
#
13
Removed:
# You should have received a copy of the GNU General Public License
14
Removed:
# along with this program. If not, see <https://www.gnu.org/licenses/>.
15
Removed:
"""
1
Added:
"""This example illustrates the usage of creator, evaluator and generator.
2
Added:
16
3
Create an airfoil;
17
4
Evaluate an airfoil;
18
5
Generate a population of airfoils & optimize.
@@ -21,7 +8,6 @@
21
8
import creator # Create geometry
22
9
import evaluator # Evaluate geometry
23
10
import generator # Iteratevely evaluate instances of geometry and optimize
24
Removed:
import numpy as np
25
11
26
12
import time
27
13
start_time = time.time()
generator.py
@@ -22,7 +22,6 @@
22
22
23
23
def default_airfoil():
24
24
"""Generate the default airfoil."""
25
Removed:
26
25
airfoil = creator.Airfoil.from_dimensions(100, 200)
27
26
airfoil.add_naca(2412)
28
27
airfoil.add_mass(10)