From 2fd8e6bcfae0e3418daf7e0c48cf10d42e5548a1 Mon Sep 17 00:00:00 2001 From: Marius Peter Date: Fri, 21 Jun 2019 22:19:42 -0700 Subject: various inconsistency fix --- creator.py | 4 ++-- evaluator.py | 10 ++++------ main.py | 24 ++++++++++++------------ 3 files changed, 18 insertions(+), 20 deletions(-) diff --git a/creator.py b/creator.py index 366909b..1e375a6 100644 --- a/creator.py +++ b/creator.py @@ -91,13 +91,13 @@ class Coordinates: print('z_l the lower z-coordinates:\n', np.around(self.z_l, round)) return None - def info_save(self, save_dir_path, number): + def info_save(self, save_path, number): ''' Save all the object's coordinates (must be full path). ''' file_name = '{}_{}.txt'.format(str(self).lower(), number) - full_path = os.path.join(save_dir_path, file_name) + full_path = os.path.join(save_path, file_name) try: with open(full_path, 'w') as sys.stdout: self.info_print(6) diff --git a/evaluator.py b/evaluator.py index f6d0afc..b0d90fd 100644 --- a/evaluator.py +++ b/evaluator.py @@ -60,7 +60,7 @@ class Airfoil: This function's output is piped to the 'save_data' function below. ''' - name = ' CREATOR DATA ' + name = ' EVALUATOR DATA ' num_of_dashes = len(name) print(num_of_dashes * '-') @@ -142,13 +142,13 @@ class Airfoil: (len(x_stringers) * area) return(x_centroid, z_centroid) - def get_I_x(): + def get_I_x(self): pass - def get_I_z(): + def get_I_z(self): pass - def get_I_xz(): + def get_I_xz(self): pass def analysis(self): @@ -216,6 +216,4 @@ class Airfoil: plt.gca().set_aspect('equal', adjustable='box') plt.grid(axis='both', linestyle=':', linewidth=1) plt.show() - # plt.pause(1) - # plt.close() return None diff --git a/main.py b/main.py index e771092..a112542 100644 --- a/main.py +++ b/main.py @@ -23,8 +23,8 @@ start_time = time.time() # Airfoil dimensions NACA_NUM = 2412 -CHORD_LENGTH = 20 -SEMI_SPAN = 20 +CHORD_LENGTH = 40 +SEMI_SPAN = 50 # Component masses AIRFOIL_MASS = 10 # lbs @@ -33,7 +33,7 @@ STRINGER_MASS = 5 # lbs # Area STRINGER_AREA = 0.1 # sqin -TOP_STRINGERS = 4 +TOP_STRINGERS = 8 BOTTOM_STRINGERS = 6 NOSE_TOP_STRINGERS = 4 NOSE_BOTTOM_STRINGERS = 7 @@ -62,8 +62,8 @@ def main(): # Define NACA airfoil coordinates and mass af.add_naca(NACA_NUM) af.add_mass(AIRFOIL_MASS) - # af.info_print(2) - # af.info_save(SAVE_PATH, _) + af.info_print(2) + af.info_save(SAVE_PATH, _) # Create spar instance af.spar = creator.Spar() @@ -71,8 +71,8 @@ def main(): af.spar.add_coord(af.coord, 0.15) af.spar.add_coord(af.coord, 0.55) af.spar.add_mass(SPAR_MASS) - # af.spar.info_print(2) - # af.spar.info_save(SAVE_PATH, _) + af.spar.info_print(2) + af.spar.info_save(SAVE_PATH, _) # Create stringer instance af.stringer = creator.Stringer() @@ -84,19 +84,19 @@ def main(): BOTTOM_STRINGERS) af.stringer.add_area(STRINGER_AREA) af.stringer.add_mass(STRINGER_MASS) - # af.stringer.info_print(2) - # af.stringer.info_save(SAVE_PATH, _) + af.stringer.info_print(2) + af.stringer.info_save(SAVE_PATH, _) # Plot components with matplotlib - # af.plot() + af.plot() # evaluator.Evaluator instance contains airfoil analysis results. eval = evaluator.Airfoil(af) # The analysis is performed in the evaluator.py module. eval.analysis() eval.info_print(2) - # eval.info_save(SAVE_PATH, _) - # eval.plot() + eval.info_save(SAVE_PATH, _) + eval.plot() # Print final execution time print("--- %s seconds ---" % (time.time() - start_time)) -- cgit v1.2.3