From 8de2bf8a0fdb623b4ffa9a47e97557f48a7fce66 Mon Sep 17 00:00:00 2001 From: Tim MacDonald Date: Fri, 18 Aug 2017 12:47:11 -0700 Subject: [PATCH 1/8] BWB tutorial checked --- BWB_CFD/BWB.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/BWB_CFD/BWB.py b/BWB_CFD/BWB.py index ca37dbb..a90e4e8 100644 --- a/BWB_CFD/BWB.py +++ b/BWB_CFD/BWB.py @@ -284,15 +284,15 @@ def vehicle_setup(): segment.thickness_to_chord = 0.10 wing.Segments.append(segment) - #segment = SUAVE.Components.Wings.Segment() - #segment.tag = 'section_7' - #segment.percent_span_location = 0.97 - #segment.twist = 0. * Units.deg - #segment.root_chord_percent = 0.086 - #segment.dihedral_outboard = 73. * Units.degrees - #segment.sweeps.quarter_chord = 55. * Units.degrees - #segment.thickness_to_chord = 0.10 - #wing.Segments.append(segment) + segment = SUAVE.Components.Wings.Segment() + segment.tag = 'section_7' + segment.percent_span_location = 0.97 + segment.twist = 0. * Units.deg + segment.root_chord_percent = 0.086 + segment.dihedral_outboard = 73. * Units.degrees + segment.sweeps.quarter_chord = 55. * Units.degrees + segment.thickness_to_chord = 0.10 + wing.Segments.append(segment) # add to vehicle vehicle.append_component(wing) From 504c75e2ef9b2c3327481c7bebcd2b818f1ed28c Mon Sep 17 00:00:00 2001 From: Tim MacDonald Date: Fri, 18 Aug 2017 12:47:41 -0700 Subject: [PATCH 2/8] BWB tutorial checked (2) --- BWB_CFD/base_data.txt | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/BWB_CFD/base_data.txt b/BWB_CFD/base_data.txt index 67fc169..4275347 100644 --- a/BWB_CFD/base_data.txt +++ b/BWB_CFD/base_data.txt @@ -1,13 +1,13 @@ # AoA Mach CL CD -0.00000000 0.30000000 0.00357426 0.00198925 -0.00000000 0.50000000 0.00385438 0.00262971 -0.00000000 0.70000000 0.00471753 0.00444076 -0.00000000 0.85000000 0.00856885 0.01859320 -0.05235988 0.30000000 0.20620500 0.00821743 -0.05235988 0.50000000 0.21761550 0.01013710 -0.05235988 0.70000000 0.24444750 0.01578280 -0.05235988 0.85000000 0.29654400 0.05575920 -0.10471976 0.30000000 0.40600150 0.02727500 -0.10471976 0.50000000 0.42532150 0.03379330 -0.10471976 0.70000000 0.46278650 0.05568500 -0.10471976 0.85000000 0.51038000 0.13394200 +0.00000000 0.30000000 0.00251194 0.00134887 +0.00000000 0.50000000 0.00299387 0.00171925 +0.00000000 0.70000000 0.00394769 0.00288317 +0.00000000 0.85000000 0.00833803 0.01229870 +0.05235988 0.30000000 0.20105900 0.00458350 +0.05235988 0.50000000 0.21206700 0.00563401 +0.05235988 0.70000000 0.23698500 0.00871928 +0.05235988 0.85000000 0.29803900 0.03032720 +0.10471976 0.30000000 0.39578600 0.01478110 +0.10471976 0.50000000 0.41323700 0.01838060 +0.10471976 0.70000000 0.45014500 0.02906480 +0.10471976 0.85000000 0.51830800 0.07062910 From 63c3afbe7f836559bcdaecfa7eb02b8a69a1d7f0 Mon Sep 17 00:00:00 2001 From: Emilio Botero Date: Thu, 7 Dec 2017 18:25:49 -0800 Subject: [PATCH 3/8] Fixing unit issues --- tut_solar_uav.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tut_solar_uav.py b/tut_solar_uav.py index 8a98c23..640f485 100644 --- a/tut_solar_uav.py +++ b/tut_solar_uav.py @@ -241,7 +241,7 @@ def vehicle_setup(): # Component 4 the Motor motor = SUAVE.Components.Energy.Converters.Motor() motor.resistance = 0.008 - motor.no_load_current = 4.5 * Units.Ampere + motor.no_load_current = 4.5 * Units.ampere motor.speed_constant = 120. * Units['rpm'] # RPM/volt converted to (rad/s)/volt motor.propeller_radius = prop.prop_attributes.tip_radius motor.propeller_Cp = prop.prop_attributes.Cp @@ -253,13 +253,13 @@ def vehicle_setup(): # Component 6 the Payload payload = SUAVE.Components.Energy.Peripherals.Payload() - payload.power_draw = 50. * Units.Watts + payload.power_draw = 50. * Units.watts payload.mass_properties.mass = 5.0 * Units.kg net.payload = payload # Component 7 the Avionics avionics = SUAVE.Components.Energy.Peripherals.Avionics() - avionics.power_draw = 50. * Units.Watts + avionics.power_draw = 50. * Units.watts net.avionics = avionics # Component 8 the Battery From 807d639c41f1a931d63efddf59fedcc6721ae2ba Mon Sep 17 00:00:00 2001 From: Tim MacDonald Date: Fri, 16 Mar 2018 17:47:38 -0700 Subject: [PATCH 4/8] full BWB test --- BWB_CFD/BWB.py | 403 +++++++++++++++++++++++------------------- BWB_CFD/base_data.txt | 24 +-- 2 files changed, 232 insertions(+), 195 deletions(-) diff --git a/BWB_CFD/BWB.py b/BWB_CFD/BWB.py index a90e4e8..499325c 100644 --- a/BWB_CFD/BWB.py +++ b/BWB_CFD/BWB.py @@ -1,7 +1,7 @@ # BWB.py # # Created: Jan 2017, E. Botero -# Modified: Aug 2017, E. Botero +# Modified: Mar 2018, T. MacDonald # ---------------------------------------------------------------------- # Imports @@ -107,13 +107,14 @@ def base_analysis(vehicle): aerodynamics = SUAVE.Analyses.Aerodynamics.SU2_Euler() aerodynamics.geometry = vehicle - #aerodynamics.process.compute.lift.inviscid.settings.parallel = True - #aerodynamics.process.compute.lift.inviscid.settings.processors = 12 - #aerodynamics.process.compute.lift.inviscid.training_file = 'base_data.txt' + #aerodynamics.process.compute.lift.inviscid.settings.parallel = True + #aerodynamics.process.compute.lift.inviscid.settings.processors = 12 + #aerodynamics.process.compute.lift.inviscid.training_file = 'base_data.txt' + aerodynamics.process.compute.lift.inviscid.settings.maximum_iterations = 1500 aerodynamics.settings.drag_coefficient_increment = 0.0000 - aerodynamics.process.compute.lift.inviscid.training.Mach = np.array([.3, .5, .7, .85]) - aerodynamics.process.compute.lift.inviscid.training.angle_of_attack = np.array([0.,3.,6.]) * Units.deg + aerodynamics.process.compute.lift.inviscid.training.Mach = np.array([.3, .5, .7, .85]) + aerodynamics.process.compute.lift.inviscid.training.angle_of_attack = np.array([0.,3.,6.]) * Units.deg wing_segments = vehicle.wings.main_wing.Segments wing_segments.section_1.vsp_mesh = Data() @@ -208,20 +209,27 @@ def vehicle_setup(): wing.thickness_to_chord = 0.15 wing.taper = 0.0138 wing.span_efficiency = 0.95 + wing.spans.projected = 289.0 * Units.feet + wing.chords.root = 145.0 * Units.feet wing.chords.tip = 3.5 * Units.feet wing.chords.mean_aerodynamic = 86. * Units.feet + wing.areas.reference = 15680. * Units.feet**2 wing.sweeps.quarter_chord = 33. * Units.degrees + wing.twists.root = 0.0 * Units.degrees wing.twists.tip = 0.0 * Units.degrees wing.dihedral = 2.5 * Units.degrees + wing.origin = [0.,0.,0] wing.aerodynamic_center = [0,0,0] + wing.vertical = False wing.symmetric = True wing.high_lift = True + wing.dynamic_pressure_ratio = 1.0 segment = SUAVE.Components.Wings.Segment() @@ -484,6 +492,7 @@ def vehicle_setup(): vehicle.append_component(turbofan) + # ------------------------------------------------------------------ # Vehicle Definition Complete # ------------------------------------------------------------------ @@ -509,8 +518,194 @@ def configs_setup(vehicle): write(vehicle,base_config.tag) + + # done! return configs +# ---------------------------------------------------------------------- +# Sizing for the Vehicle Configs +# ---------------------------------------------------------------------- + +# ---------------------------------------------------------------------- +# Plot Mission +# ---------------------------------------------------------------------- + +def plot_mission(results,line_style='bo-'): + + axis_font = {'fontname':'Arial', 'size':'14'} + + # ------------------------------------------------------------------ + # Aerodynamics + # ------------------------------------------------------------------ + + + fig = plt.figure("Aerodynamic Forces",figsize=(8,6)) + for segment in results.segments.values(): + + time = segment.conditions.frames.inertial.time[:,0] / Units.min + Lift = -segment.conditions.frames.wind.lift_force_vector[:,2] + Drag = -segment.conditions.frames.wind.drag_force_vector[:,0] / Units.lbf + Thrust = segment.conditions.frames.body.thrust_force_vector[:,0] / Units.lbf + eta = segment.conditions.propulsion.throttle[:,0] + mdot = segment.conditions.weights.vehicle_mass_rate[:,0] + thrust = segment.conditions.frames.body.thrust_force_vector[:,0] + sfc = 3600. * mdot / 0.1019715 / thrust + + + axes = fig.add_subplot(2,1,1) + axes.plot( time , Thrust , line_style ) + axes.set_ylabel('Thrust (lbf)',axis_font) + axes.grid(True) + + axes = fig.add_subplot(2,1,2) + axes.plot( time , eta , line_style ) + axes.set_xlabel('Time (min)',axis_font) + axes.set_ylabel('Throttle',axis_font) + axes.grid(True) + + + + # ------------------------------------------------------------------ + # Aerodynamics 2 + # ------------------------------------------------------------------ + fig = plt.figure("Aerodynamic Coefficients",figsize=(8,10)) + for segment in results.segments.values(): + + time = segment.conditions.frames.inertial.time[:,0] / Units.min + CLift = segment.conditions.aerodynamics.lift_coefficient[:,0] + CDrag = segment.conditions.aerodynamics.drag_coefficient[:,0] + Drag = -segment.conditions.frames.wind.drag_force_vector[:,0] + Thrust = segment.conditions.frames.body.thrust_force_vector[:,0] + aoa = segment.conditions.aerodynamics.angle_of_attack[:,0] / Units.deg + l_d = CLift/CDrag + + + axes = fig.add_subplot(3,1,1) + axes.plot( time , CLift , line_style ) + axes.set_ylabel('Lift Coefficient',axis_font) + axes.grid(True) + + axes = fig.add_subplot(3,1,2) + axes.plot( time , l_d , line_style ) + axes.set_ylabel('L/D',axis_font) + axes.grid(True) + + axes = fig.add_subplot(3,1,3) + axes.plot( time , aoa , 'ro-' ) + axes.set_xlabel('Time (min)',axis_font) + axes.set_ylabel('AOA (deg)',axis_font) + axes.grid(True) + + # ------------------------------------------------------------------ + # Aerodynamics 2 + # ------------------------------------------------------------------ + fig = plt.figure("Drag Components",figsize=(8,10)) + axes = plt.gca() + for i, segment in enumerate(results.segments.values()): + + time = segment.conditions.frames.inertial.time[:,0] / Units.min + drag_breakdown = segment.conditions.aerodynamics.drag_breakdown + cdp = drag_breakdown.parasite.total[:,0] + cdi = drag_breakdown.induced.total[:,0] + cdc = drag_breakdown.compressible.total[:,0] + cdm = drag_breakdown.miscellaneous.total[:,0] + cd = drag_breakdown.total[:,0] + + if line_style == 'bo-': + axes.plot( time , cdp , 'ko-', label='CD parasite' ) + axes.plot( time , cdi , 'bo-', label='CD induced' ) + axes.plot( time , cdc , 'go-', label='CD compressibility' ) + axes.plot( time , cdm , 'yo-', label='CD miscellaneous' ) + axes.plot( time , cd , 'ro-', label='CD total' ) + if i == 0: + axes.legend(loc='upper center') + else: + axes.plot( time , cdp , line_style ) + axes.plot( time , cdi , line_style ) + axes.plot( time , cdc , line_style ) + axes.plot( time , cdm , line_style ) + axes.plot( time , cd , line_style ) + + axes.set_xlabel('Time (min)') + axes.set_ylabel('CD') + axes.grid(True) + + # ------------------------------------------------------------------ + # Altitude, sfc, vehicle weight + # ------------------------------------------------------------------ + + fig = plt.figure("Altitude_sfc_weight",figsize=(8,10)) + for segment in results.segments.values(): + + time = segment.conditions.frames.inertial.time[:,0] / Units.min + CLift = segment.conditions.aerodynamics.lift_coefficient[:,0] + CDrag = segment.conditions.aerodynamics.drag_coefficient[:,0] + Drag = -segment.conditions.frames.wind.drag_force_vector[:,0] + Thrust = segment.conditions.frames.body.thrust_force_vector[:,0] + aoa = segment.conditions.aerodynamics.angle_of_attack[:,0] / Units.deg + l_d = CLift/CDrag + mass = segment.conditions.weights.total_mass[:,0] / Units.lb + altitude = segment.conditions.freestream.altitude[:,0] / Units.ft + mdot = segment.conditions.weights.vehicle_mass_rate[:,0] + thrust = segment.conditions.frames.body.thrust_force_vector[:,0] + sfc = 3600. * mdot / 0.1019715 / thrust + + axes = fig.add_subplot(3,1,1) + axes.plot( time , altitude , line_style ) + axes.set_ylabel('Altitude (ft)',axis_font) + axes.grid(True) + + axes = fig.add_subplot(3,1,3) + axes.plot( time , sfc , line_style ) + axes.set_xlabel('Time (min)',axis_font) + axes.set_ylabel('sfc (lb/lbf-hr)',axis_font) + axes.grid(True) + + axes = fig.add_subplot(3,1,2) + axes.plot( time , mass , 'ro-' ) + axes.set_ylabel('Weight (lb)',axis_font) + axes.grid(True) + + # ------------------------------------------------------------------ + # Aerodynamics 2 + # ------------------------------------------------------------------ + fig = plt.figure("Velocities",figsize=(8,10)) + for segment in results.segments.values(): + + time = segment.conditions.frames.inertial.time[:,0] / Units.min + Lift = -segment.conditions.frames.wind.lift_force_vector[:,2] + Drag = -segment.conditions.frames.wind.drag_force_vector[:,0] / Units.lbf + Thrust = segment.conditions.frames.body.thrust_force_vector[:,0] / Units.lbf + eta = segment.conditions.propulsion.throttle[:,0] + mdot = segment.conditions.weights.vehicle_mass_rate[:,0] + thrust = segment.conditions.frames.body.thrust_force_vector[:,0] + sfc = 3600. * mdot / 0.1019715 / thrust + velocity = segment.conditions.freestream.velocity[:,0] + pressure = segment.conditions.freestream.pressure[:,0] + density = segment.conditions.freestream.density[:,0] + EAS = velocity * np.sqrt(density/1.225) + mach = segment.conditions.freestream.mach_number[:,0] + + + axes = fig.add_subplot(3,1,1) + axes.plot( time , velocity / Units.kts, line_style ) + axes.set_ylabel('velocity (kts)',axis_font) + axes.grid(True) + + axes = fig.add_subplot(3,1,2) + axes.plot( time , EAS / Units.kts, line_style ) + axes.set_xlabel('Time (min)',axis_font) + axes.set_ylabel('Equivalent Airspeed',axis_font) + axes.grid(True) + + axes = fig.add_subplot(3,1,3) + axes.plot( time , mach , line_style ) + axes.set_xlabel('Time (min)',axis_font) + axes.set_ylabel('Mach',axis_font) + axes.grid(True) + + return + def simple_sizing(configs): base = configs.base @@ -519,6 +714,12 @@ def simple_sizing(configs): # zero fuel weight base.mass_properties.max_zero_fuel = 0.9 * base.mass_properties.max_takeoff + ## wing areas + #for wing in base.wings: + #wing.areas.wetted = 2.0 * wing.areas.reference + #wing.areas.exposed = 0.8 * wing.areas.wetted + #wing.areas.affected = 0.6 * wing.areas.wetted + # Areas wetted_areas = get_vsp_areas(base.tag) @@ -530,6 +731,7 @@ def simple_sizing(configs): # diff the new data base.store_diff() + # done! return # ---------------------------------------------------------------------- @@ -559,7 +761,7 @@ def mission_setup(analyses): base_segment = Segments.Segment() # ------------------------------------------------------------------ - # First Climb Segment + # First Climb Segment: constant Mach, constant segment angle # ------------------------------------------------------------------ segment = Segments.Climb.Constant_Speed_Constant_Rate(base_segment) @@ -580,7 +782,7 @@ def mission_setup(analyses): # ------------------------------------------------------------------ - # Second Climb Segment + # Second Climb Segment: constant Speed, constant segment angle # ------------------------------------------------------------------ segment = Segments.Climb.Constant_Speed_Constant_Rate(base_segment) @@ -614,7 +816,7 @@ def mission_setup(analyses): # ------------------------------------------------------------------ - # Cruise Segment + # Cruise Segment: constant speed, constant altitude # ------------------------------------------------------------------ segment = Segments.Cruise.Constant_Mach_Constant_Altitude(base_segment) @@ -630,7 +832,7 @@ def mission_setup(analyses): # ------------------------------------------------------------------ -# First Descent Segment +# First Descent Segment: consant speed, constant segment rate # ------------------------------------------------------------------ segment = Segments.Descent.Constant_Speed_Constant_Rate(base_segment) @@ -664,7 +866,7 @@ def mission_setup(analyses): # ------------------------------------------------------------------ - # Third Descent Segment + # Third Descent Segment: consant speed, constant segment rate # ------------------------------------------------------------------ segment = Segments.Descent.Constant_Speed_Constant_Rate(base_segment) @@ -681,7 +883,7 @@ def mission_setup(analyses): # ------------------------------------------------------------------ - # Fourth Descent Segment + # Fourth Descent Segment: consant speed, constant segment rate # ------------------------------------------------------------------ segment = Segments.Descent.Constant_Speed_Constant_Rate(base_segment) @@ -697,8 +899,10 @@ def mission_setup(analyses): # add to mission mission.append_segment(segment) + + # ------------------------------------------------------------------ - # Fifth Descent Segment + # Fifth Descent Segment: consant speed, constant segment rate # ------------------------------------------------------------------ segment = Segments.Descent.Constant_Speed_Constant_Rate(base_segment) @@ -710,6 +914,7 @@ def mission_setup(analyses): segment.air_speed = 145.0 * Units['m/s'] segment.descent_rate = 3.0 * Units['m/s'] + # append to mission mission.append_segment(segment) @@ -730,177 +935,9 @@ def missions_setup(base_mission): missions.base = base_mission - return missions - -# ---------------------------------------------------------------------- -# Plot Mission -# ---------------------------------------------------------------------- - -def plot_mission(results,line_style='bo-'): - - axis_font = {'fontname':'Arial', 'size':'14'} - - # ------------------------------------------------------------------ - # Aerodynamics - # ------------------------------------------------------------------ - - - fig = plt.figure("Aerodynamic Forces",figsize=(8,6)) - for segment in results.segments.values(): - - time = segment.conditions.frames.inertial.time[:,0] / Units.min - Thrust = segment.conditions.frames.body.thrust_force_vector[:,0] / Units.lbf - eta = segment.conditions.propulsion.throttle[:,0] - - axes = fig.add_subplot(2,1,1) - axes.plot( time , Thrust , line_style ) - axes.set_ylabel('Thrust (lbf)',axis_font) - axes.grid(True) - - axes = fig.add_subplot(2,1,2) - axes.plot( time , eta , line_style ) - axes.set_xlabel('Time (min)',axis_font) - axes.set_ylabel('Throttle',axis_font) - axes.grid(True) - - plt.savefig("B737_engine.pdf") - plt.savefig("B737_engine.png") - - # ------------------------------------------------------------------ - # Aerodynamics 2 - # ------------------------------------------------------------------ - fig = plt.figure("Aerodynamic Coefficients",figsize=(8,10)) - for segment in results.segments.values(): - - time = segment.conditions.frames.inertial.time[:,0] / Units.min - CLift = segment.conditions.aerodynamics.lift_coefficient[:,0] - CDrag = segment.conditions.aerodynamics.drag_coefficient[:,0] - aoa = segment.conditions.aerodynamics.angle_of_attack[:,0] / Units.deg - l_d = CLift/CDrag - - axes = fig.add_subplot(3,1,1) - axes.plot( time , CLift , line_style ) - axes.set_ylabel('Lift Coefficient',axis_font) - axes.grid(True) - - axes = fig.add_subplot(3,1,2) - axes.plot( time , l_d , line_style ) - axes.set_ylabel('L/D',axis_font) - axes.grid(True) - - axes = fig.add_subplot(3,1,3) - axes.plot( time , aoa , 'ro-' ) - axes.set_xlabel('Time (min)',axis_font) - axes.set_ylabel('AOA (deg)',axis_font) - axes.grid(True) - - plt.savefig("B737_aero.pdf") - plt.savefig("B737_aero.png") - - # ------------------------------------------------------------------ - # Aerodynamics 2 - # ------------------------------------------------------------------ - fig = plt.figure("Drag Components",figsize=(8,10)) - axes = plt.gca() - for i, segment in enumerate(results.segments.values()): - - time = segment.conditions.frames.inertial.time[:,0] / Units.min - drag_breakdown = segment.conditions.aerodynamics.drag_breakdown - cdp = drag_breakdown.parasite.total[:,0] - cdi = drag_breakdown.induced.total[:,0] - cdc = drag_breakdown.compressible.total[:,0] - cdm = drag_breakdown.miscellaneous.total[:,0] - cd = drag_breakdown.total[:,0] - - if line_style == 'bo-': - axes.plot( time , cdp , 'ko-', label='CD parasite' ) - axes.plot( time , cdi , 'bo-', label='CD induced' ) - axes.plot( time , cdc , 'go-', label='CD compressibility' ) - axes.plot( time , cdm , 'yo-', label='CD miscellaneous' ) - axes.plot( time , cd , 'ro-', label='CD total' ) - if i == 0: - axes.legend(loc='upper center') - else: - axes.plot( time , cdp , line_style ) - axes.plot( time , cdi , line_style ) - axes.plot( time , cdc , line_style ) - axes.plot( time , cdm , line_style ) - axes.plot( time , cd , line_style ) - - axes.set_xlabel('Time (min)') - axes.set_ylabel('CD') - axes.grid(True) - plt.savefig("B737_drag.pdf") - plt.savefig("B737_drag.png") - - # ------------------------------------------------------------------ - # Altitude, sfc, vehicle weight - # ------------------------------------------------------------------ - - fig = plt.figure("Altitude_sfc_weight",figsize=(8,10)) - for segment in results.segments.values(): - - time = segment.conditions.frames.inertial.time[:,0] / Units.min - aoa = segment.conditions.aerodynamics.angle_of_attack[:,0] / Units.deg - mass = segment.conditions.weights.total_mass[:,0] / Units.lb - altitude = segment.conditions.freestream.altitude[:,0] / Units.ft - mdot = segment.conditions.weights.vehicle_mass_rate[:,0] - thrust = segment.conditions.frames.body.thrust_force_vector[:,0] - sfc = (mdot / Units.lb) / (thrust /Units.lbf) * Units.hr - - axes = fig.add_subplot(3,1,1) - axes.plot( time , altitude , line_style ) - axes.set_ylabel('Altitude (ft)',axis_font) - axes.grid(True) - - axes = fig.add_subplot(3,1,3) - axes.plot( time , sfc , line_style ) - axes.set_xlabel('Time (min)',axis_font) - axes.set_ylabel('sfc (lb/lbf-hr)',axis_font) - axes.grid(True) - - axes = fig.add_subplot(3,1,2) - axes.plot( time , mass , 'ro-' ) - axes.set_ylabel('Weight (lb)',axis_font) - axes.grid(True) - - plt.savefig("B737_mission.pdf") - plt.savefig("B737_mission.png") - - # ------------------------------------------------------------------ - # Velocities - # ------------------------------------------------------------------ - fig = plt.figure("Velocities",figsize=(8,10)) - for segment in results.segments.values(): - - time = segment.conditions.frames.inertial.time[:,0] / Units.min - Lift = -segment.conditions.frames.wind.lift_force_vector[:,2] - Drag = -segment.conditions.frames.wind.drag_force_vector[:,0] / Units.lbf - Thrust = segment.conditions.frames.body.thrust_force_vector[:,0] / Units.lb - velocity = segment.conditions.freestream.velocity[:,0] - pressure = segment.conditions.freestream.pressure[:,0] - density = segment.conditions.freestream.density[:,0] - EAS = velocity * np.sqrt(density/1.225) - mach = segment.conditions.freestream.mach_number[:,0] - - axes = fig.add_subplot(3,1,1) - axes.plot( time , velocity / Units.kts, line_style ) - axes.set_ylabel('velocity (kts)',axis_font) - axes.grid(True) - axes = fig.add_subplot(3,1,2) - axes.plot( time , EAS / Units.kts, line_style ) - axes.set_xlabel('Time (min)',axis_font) - axes.set_ylabel('Equivalent Airspeed',axis_font) - axes.grid(True) - - axes = fig.add_subplot(3,1,3) - axes.plot( time , mach , line_style ) - axes.set_xlabel('Time (min)',axis_font) - axes.set_ylabel('Mach',axis_font) - axes.grid(True) - - return + # done! + return missions if __name__ == '__main__': main() diff --git a/BWB_CFD/base_data.txt b/BWB_CFD/base_data.txt index 4275347..deaeabc 100644 --- a/BWB_CFD/base_data.txt +++ b/BWB_CFD/base_data.txt @@ -1,13 +1,13 @@ # AoA Mach CL CD -0.00000000 0.30000000 0.00251194 0.00134887 -0.00000000 0.50000000 0.00299387 0.00171925 -0.00000000 0.70000000 0.00394769 0.00288317 -0.00000000 0.85000000 0.00833803 0.01229870 -0.05235988 0.30000000 0.20105900 0.00458350 -0.05235988 0.50000000 0.21206700 0.00563401 -0.05235988 0.70000000 0.23698500 0.00871928 -0.05235988 0.85000000 0.29803900 0.03032720 -0.10471976 0.30000000 0.39578600 0.01478110 -0.10471976 0.50000000 0.41323700 0.01838060 -0.10471976 0.70000000 0.45014500 0.02906480 -0.10471976 0.85000000 0.51830800 0.07062910 +0.00000000 0.30000000 0.00415459 0.00111181 +0.00000000 0.50000000 0.00413721 0.00147859 +0.00000000 0.70000000 0.00453948 0.00248097 +0.00000000 0.85000000 0.00746666 0.01186390 +0.05235988 0.30000000 0.20388958 0.00432118 +0.05235988 0.50000000 0.21483924 0.00532740 +0.05235988 0.70000000 0.24112666 0.00817240 +0.05235988 0.85000000 0.30532633 0.03115450 +0.10471976 0.30000000 0.40011425 0.01441278 +0.10471976 0.50000000 0.41798452 0.01788826 +0.10471976 0.70000000 0.45717927 0.02884358 +0.10471976 0.85000000 0.52613515 0.07289007 From ebbbd4c463e102839ce73a560c5fe44396355a3b Mon Sep 17 00:00:00 2001 From: Tim MacDonald Date: Fri, 16 Mar 2018 18:07:46 -0700 Subject: [PATCH 5/8] 10 iter opt --- BWB_CFD/BWB.py | 4 ++-- BWB_CFD/base_data_10.txt | 13 +++++++++++++ BWB_CFD/{base_data.txt => base_data_1500.txt} | 0 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 BWB_CFD/base_data_10.txt rename BWB_CFD/{base_data.txt => base_data_1500.txt} (100%) diff --git a/BWB_CFD/BWB.py b/BWB_CFD/BWB.py index 499325c..61b36e4 100644 --- a/BWB_CFD/BWB.py +++ b/BWB_CFD/BWB.py @@ -109,8 +109,8 @@ def base_analysis(vehicle): #aerodynamics.process.compute.lift.inviscid.settings.parallel = True #aerodynamics.process.compute.lift.inviscid.settings.processors = 12 - #aerodynamics.process.compute.lift.inviscid.training_file = 'base_data.txt' - aerodynamics.process.compute.lift.inviscid.settings.maximum_iterations = 1500 + #aerodynamics.process.compute.lift.inviscid.training_file = 'base_data_10.txt' + aerodynamics.process.compute.lift.inviscid.settings.maximum_iterations = 10 aerodynamics.settings.drag_coefficient_increment = 0.0000 aerodynamics.process.compute.lift.inviscid.training.Mach = np.array([.3, .5, .7, .85]) diff --git a/BWB_CFD/base_data_10.txt b/BWB_CFD/base_data_10.txt new file mode 100644 index 0000000..adc16be --- /dev/null +++ b/BWB_CFD/base_data_10.txt @@ -0,0 +1,13 @@ +# AoA Mach CL CD +0.00000000 0.30000000 0.00654461 0.02550989 +0.00000000 0.50000000 0.00923665 0.02123636 +0.00000000 0.70000000 0.01069879 0.03359684 +0.00000000 0.85000000 0.02060680 0.06217281 +0.05235988 0.30000000 0.18085600 0.03233339 +0.05235988 0.50000000 0.20017966 0.02800733 +0.05235988 0.70000000 0.22334574 0.04171732 +0.05235988 0.85000000 0.23168485 0.07241880 +0.10471976 0.30000000 0.35195404 0.05195109 +0.10471976 0.50000000 0.38857012 0.04874952 +0.10471976 0.70000000 0.43144782 0.06827731 +0.10471976 0.85000000 0.43611823 0.10205209 diff --git a/BWB_CFD/base_data.txt b/BWB_CFD/base_data_1500.txt similarity index 100% rename from BWB_CFD/base_data.txt rename to BWB_CFD/base_data_1500.txt From 660c4d3fa7fdb03053a6d32b16b6524db5cdbc1a Mon Sep 17 00:00:00 2001 From: Tim MacDonald Date: Fri, 16 Mar 2018 18:09:54 -0700 Subject: [PATCH 6/8] reset bwb parameters --- BWB_CFD/BWB.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BWB_CFD/BWB.py b/BWB_CFD/BWB.py index 61b36e4..cd9d7ee 100644 --- a/BWB_CFD/BWB.py +++ b/BWB_CFD/BWB.py @@ -109,8 +109,8 @@ def base_analysis(vehicle): #aerodynamics.process.compute.lift.inviscid.settings.parallel = True #aerodynamics.process.compute.lift.inviscid.settings.processors = 12 - #aerodynamics.process.compute.lift.inviscid.training_file = 'base_data_10.txt' - aerodynamics.process.compute.lift.inviscid.settings.maximum_iterations = 10 + #aerodynamics.process.compute.lift.inviscid.training_file = 'base_data_1500.txt' + aerodynamics.process.compute.lift.inviscid.settings.maximum_iterations = 1500 aerodynamics.settings.drag_coefficient_increment = 0.0000 aerodynamics.process.compute.lift.inviscid.training.Mach = np.array([.3, .5, .7, .85]) From 5fd84f9173c3581131f2aebb04834c2d0334d72c Mon Sep 17 00:00:00 2001 From: Tim MacDonald Date: Fri, 16 Mar 2018 18:15:27 -0700 Subject: [PATCH 7/8] cleaned bwb --- BWB_CFD/BWB.py | 34 +++++++++------------------------- 1 file changed, 9 insertions(+), 25 deletions(-) diff --git a/BWB_CFD/BWB.py b/BWB_CFD/BWB.py index cd9d7ee..ea08875 100644 --- a/BWB_CFD/BWB.py +++ b/BWB_CFD/BWB.py @@ -518,14 +518,8 @@ def configs_setup(vehicle): write(vehicle,base_config.tag) - - # done! return configs -# ---------------------------------------------------------------------- -# Sizing for the Vehicle Configs -# ---------------------------------------------------------------------- - # ---------------------------------------------------------------------- # Plot Mission # ---------------------------------------------------------------------- @@ -537,8 +531,6 @@ def plot_mission(results,line_style='bo-'): # ------------------------------------------------------------------ # Aerodynamics # ------------------------------------------------------------------ - - fig = plt.figure("Aerodynamic Forces",figsize=(8,6)) for segment in results.segments.values(): @@ -597,7 +589,7 @@ def plot_mission(results,line_style='bo-'): axes.grid(True) # ------------------------------------------------------------------ - # Aerodynamics 2 + # Aerodynamics 3 # ------------------------------------------------------------------ fig = plt.figure("Drag Components",figsize=(8,10)) axes = plt.gca() @@ -714,12 +706,6 @@ def simple_sizing(configs): # zero fuel weight base.mass_properties.max_zero_fuel = 0.9 * base.mass_properties.max_takeoff - ## wing areas - #for wing in base.wings: - #wing.areas.wetted = 2.0 * wing.areas.reference - #wing.areas.exposed = 0.8 * wing.areas.wetted - #wing.areas.affected = 0.6 * wing.areas.wetted - # Areas wetted_areas = get_vsp_areas(base.tag) @@ -731,7 +717,6 @@ def simple_sizing(configs): # diff the new data base.store_diff() - # done! return # ---------------------------------------------------------------------- @@ -761,7 +746,7 @@ def mission_setup(analyses): base_segment = Segments.Segment() # ------------------------------------------------------------------ - # First Climb Segment: constant Mach, constant segment angle + # First Climb Segment # ------------------------------------------------------------------ segment = Segments.Climb.Constant_Speed_Constant_Rate(base_segment) @@ -782,7 +767,7 @@ def mission_setup(analyses): # ------------------------------------------------------------------ - # Second Climb Segment: constant Speed, constant segment angle + # Second Climb Segment # ------------------------------------------------------------------ segment = Segments.Climb.Constant_Speed_Constant_Rate(base_segment) @@ -799,7 +784,7 @@ def mission_setup(analyses): # ------------------------------------------------------------------ - # Third Climb Segment: constant Mach, constant segment angle + # Third Climb Segment # ------------------------------------------------------------------ segment = Segments.Climb.Constant_Speed_Constant_Rate(base_segment) @@ -816,7 +801,7 @@ def mission_setup(analyses): # ------------------------------------------------------------------ - # Cruise Segment: constant speed, constant altitude + # Cruise Segment # ------------------------------------------------------------------ segment = Segments.Cruise.Constant_Mach_Constant_Altitude(base_segment) @@ -832,7 +817,7 @@ def mission_setup(analyses): # ------------------------------------------------------------------ -# First Descent Segment: consant speed, constant segment rate +# First Descent Segment # ------------------------------------------------------------------ segment = Segments.Descent.Constant_Speed_Constant_Rate(base_segment) @@ -849,7 +834,7 @@ def mission_setup(analyses): # ------------------------------------------------------------------ - # Second Descent Segment: consant speed, constant segment rate + # Second Descent Segment # ------------------------------------------------------------------ segment = Segments.Descent.Constant_Speed_Constant_Rate(base_segment) @@ -866,7 +851,7 @@ def mission_setup(analyses): # ------------------------------------------------------------------ - # Third Descent Segment: consant speed, constant segment rate + # Third Descent Segment # ------------------------------------------------------------------ segment = Segments.Descent.Constant_Speed_Constant_Rate(base_segment) @@ -883,7 +868,7 @@ def mission_setup(analyses): # ------------------------------------------------------------------ - # Fourth Descent Segment: consant speed, constant segment rate + # Fourth Descent Segment # ------------------------------------------------------------------ segment = Segments.Descent.Constant_Speed_Constant_Rate(base_segment) @@ -914,7 +899,6 @@ def mission_setup(analyses): segment.air_speed = 145.0 * Units['m/s'] segment.descent_rate = 3.0 * Units['m/s'] - # append to mission mission.append_segment(segment) From 240d8093a59696927058b9659011d6106fd52f53 Mon Sep 17 00:00:00 2001 From: Tim MacDonald Date: Fri, 16 Mar 2018 18:16:43 -0700 Subject: [PATCH 8/8] more bwb cleaning --- BWB_CFD/BWB.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/BWB_CFD/BWB.py b/BWB_CFD/BWB.py index ea08875..713493e 100644 --- a/BWB_CFD/BWB.py +++ b/BWB_CFD/BWB.py @@ -816,9 +816,9 @@ def mission_setup(analyses): mission.append_segment(segment) -# ------------------------------------------------------------------ -# First Descent Segment -# ------------------------------------------------------------------ + # ------------------------------------------------------------------ + # First Descent Segment + # ------------------------------------------------------------------ segment = Segments.Descent.Constant_Speed_Constant_Rate(base_segment) segment.tag = "descent_1" @@ -887,7 +887,7 @@ def mission_setup(analyses): # ------------------------------------------------------------------ - # Fifth Descent Segment: consant speed, constant segment rate + # Fifth Descent Segment # ------------------------------------------------------------------ segment = Segments.Descent.Constant_Speed_Constant_Rate(base_segment) @@ -919,8 +919,6 @@ def missions_setup(base_mission): missions.base = base_mission - - # done! return missions if __name__ == '__main__':