From 576c9232ec279b6f9e50f7c4d56c9836208d1c07 Mon Sep 17 00:00:00 2001 From: Marius Peter Date: Mon, 24 Jun 2019 19:10:41 -0700 Subject: variable name consistency & docstrings --- creator.py | 9 ++++----- evaluator.py | 16 ++++++++-------- main.py | 8 ++++---- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/creator.py b/creator.py index 3d13c8f..40a25bc 100644 --- a/creator.py +++ b/creator.py @@ -168,13 +168,13 @@ class Airfoil(Coordinates): '''Returns thickness from 1 'x' along the airfoil chord.''' x = 0 if x < 0 else x - y_t = 5 * t * self.chord * ( + z_t = 5 * t * self.chord * ( + 0.2969 * sqrt(x / self.chord) - 0.1260 * (x / self.chord) - 0.3516 * (x / self.chord) ** 2 + 0.2843 * (x / self.chord) ** 3 - 0.1015 * (x / self.chord) ** 4) - return y_t + return z_t def get_theta(x): dz_c = float() @@ -238,9 +238,8 @@ class Spar(Coordinates): Add a single spar at the % chord location given to function. Parameters: - coordinates: provided by Airfoil.coordinates[x, z, x, z]. - material: spar's material. Assumes homogeneous material. - spar_x: spar's location as a % of total chord length. + airfoil: gives the spar access to airfoil's coordinates. + x_loc_percent: spar's location as a % of total chord length. Return: None diff --git a/evaluator.py b/evaluator.py index 04746e7..8e82312 100644 --- a/evaluator.py +++ b/evaluator.py @@ -143,21 +143,21 @@ class Evaluator: '''Return the coordinates of the centroid.''' stringer_area = self.stringer.area - caps_area = self.spar.cap_area + cap_area = self.spar.cap_area caps_x = [value for spar in self.spar.x for value in spar] caps_z = [value for spar in self.spar.z for value in spar] stringers_x = self.stringer.x stringers_z = self.stringer.z - denominator = float(len(caps_x) * caps_area + denominator = float(len(caps_x) * cap_area + len(stringers_x) * stringer_area) - centroid_x = float(sum([x * caps_area for x in caps_x]) + centroid_x = float(sum([x * cap_area for x in caps_x]) + sum([x * stringer_area for x in stringers_x])) centroid_x = centroid_x / denominator - centroid_z = float(sum([z * caps_area for z in caps_z]) + centroid_z = float(sum([z * cap_area for z in caps_z]) + sum([z * stringer_area for z in stringers_z])) centroid_z = centroid_z / denominator return(centroid_x, centroid_z) @@ -166,7 +166,7 @@ class Evaluator: '''Obtain all inertia terms.''' stringer_area = self.stringer.area - caps_area = self.spar.cap_area + cap_area = self.spar.cap_area # Adds upper and lower components' coordinates to list x_stringers = self.stringer.x @@ -177,17 +177,17 @@ class Evaluator: spar_count = range(len(self.spar.x)) # I_x is the sum of the contributions of the spar caps and stringers - I_x = (sum([caps_area * (z_spars[i] - self.centroid[1]) ** 2 + I_x = (sum([cap_area * (z_spars[i] - self.centroid[1]) ** 2 for i in spar_count]) + sum([stringer_area * (z_stringers[i] - self.centroid[1]) ** 2 for i in stringer_count])) - I_z = (sum([caps_area * (x_spars[i] - self.centroid[0]) ** 2 + I_z = (sum([cap_area * (x_spars[i] - self.centroid[0]) ** 2 for i in spar_count]) + sum([stringer_area * (x_stringers[i] - self.centroid[0]) ** 2 for i in stringer_count])) - I_xz = (sum([caps_area * (x_spars[i] - self.centroid[0]) + I_xz = (sum([cap_area * (x_spars[i] - self.centroid[0]) * (z_spars[i] - self.centroid[1]) for i in spar_count]) + sum([stringer_area * (x_stringers[i] - self.centroid[0]) diff --git a/main.py b/main.py index 170901e..0a5dc7f 100644 --- a/main.py +++ b/main.py @@ -25,7 +25,7 @@ start_time = time.time() # Airfoil dimensions NACA_NUM = 2412 CHORD_LENGTH = 68 # inches -SEMI_SPAN = 100 # inches +SEMI_SPAN = 150 # inches # Airfoil thickness T_UPPER = 0.1 @@ -44,7 +44,7 @@ STRINGER_AREA = 0.1 # sqin TOP_STRINGERS = 6 BOTTOM_STRINGERS = 4 NOSE_TOP_STRINGERS = 3 -NOSE_BOTTOM_STRINGERS = 6 +NOSE_BOTTOM_STRINGERS = 5 # population information & save path POP_SIZE = 1 @@ -98,7 +98,7 @@ def main(): af.stringer.info_save(SAVE_PATH, _) # Plot components with matplotlib - creator.plot_geom(af) + # creator.plot_geom(af) # Evaluator object contains airfoil analysis results. eval = evaluator.Evaluator(af) @@ -106,7 +106,7 @@ def main(): eval.analysis() # eval.info_print(2) eval.info_save(SAVE_PATH, _) - # evaluator.plot_geom(eval) + evaluator.plot_geom(eval) # evaluator.plot_lift(eval) # Print final execution time -- cgit v1.2.3