Skip to content

Develop #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jan 11, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
945 changes: 945 additions & 0 deletions BWB_CFD/BWB.py

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions BWB_CFD/base_data.txt
Original file line number Diff line number Diff line change
@@ -0,0 +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
59 changes: 42 additions & 17 deletions Regional_Jet_Optimization/Optimize.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,32 @@
import matplotlib.pyplot as plt
from SUAVE.Optimization import Nexus, carpet_plot
import SUAVE.Optimization.Package_Setups.scipy_setup as scipy_setup
import VyPy
import pyOpt
# ----------------------------------------------------------------------
# Run the whole thing
# ----------------------------------------------------------------------
def main():
problem = setup()

#output = problem.objective() #uncomment this line when using the default inputs

'''
#uncomment these lines when you want to start an optimization problem from a different initial guess
'''
inputs = [1.28, 1.38]
scaling = problem.optimization_problem.inputs[:,3] #have to rescale inputs to start problem from here
scaled_inputs = np.multiply(inputs,scaling)
problem.optimization_problem.inputs[:,1] = scaled_inputs
'''
#output = scipy_setup.SciPy_Solve(problem,solver='SLSQP')


#optimize
#output = scipy_setup.SciPy_Solve(problem,solver='SLSQP')
#print output


#variable_sweep(problem) #uncomment this to view some contours of the problem
print 'fuel burn=', problem.summary.base_mission_fuelburn
print 'fuel margin=', problem.all_constraints()

Plot_Mission.plot_mission(problem.results)
#Plot_Mission.plot_mission(problem)

return

Expand Down Expand Up @@ -101,10 +103,24 @@ def setup():
[ 'fuel_burn' , 'summary.base_mission_fuelburn' ],
[ 'design_range_fuel_margin' , 'summary.max_zero_fuel_margin' ],
]
'''
#TASOPT imports
from mission_B737_TASOPT import full_setup, mission_setup

configs, analyses = full_setup()
nexus.vehicle_configurations = configs
nexus.analyses = analyses
nexus.mission = analyses.mission
#nexus.mission = mission_setup(nexus.analyses)
'''


# -------------------------------------------------------------------
# Vehicles
# -------------------------------------------------------------------

#import Vehicle_TASOPT
#nexus.vehicle_configurations = Vehicle_TASOPT.setup()
nexus.vehicle_configurations = Vehicles.setup()


Expand All @@ -119,7 +135,7 @@ def setup():
# -------------------------------------------------------------------
nexus.missions = Missions.setup(nexus.analyses)


# -------------------------------------------------------------------
# Procedure
# -------------------------------------------------------------------
Expand All @@ -129,11 +145,11 @@ def setup():
# Summary
# -------------------------------------------------------------------
nexus.summary = Data()

nexus.total_number_of_iterations = 0
return nexus

def variable_sweep(problem):
number_of_points=5
number_of_points = 5
outputs=carpet_plot(problem, number_of_points, 0, 0) #run carpet plot, suppressing default plots
inputs =outputs.inputs
objective=outputs.objective
Expand All @@ -153,14 +169,23 @@ def variable_sweep(problem):
plt.xlabel('wing area (m^2)')
plt.ylabel('cruise_altitude (km)')

'''

wing_1 = np.array([ 0.95, 0.9500000149011611, 0.95, 0.95, 0.9500000149011611, 0.95, 0.95, 0.9500000149011611, 0.95, 1.0830895945429801, 1.0830896094441413, 1.0830895945429801, 1.0830895945429801, 1.0830896094441413, 1.0830895945429801, 1.0830895945429801, 1.0830896094441413, 1.0830895945429801, 1.021757391325076, 1.0217574062262371, 1.021757391325076, 1.021757391325076, 1.0217574062262371, 1.021757391325076, 1.021757391325076, 1.0217574062262371, 1.021757391325076, 0.923430766276824, 0.9234307811779852, 0.923430766276824, 0.923430766276824, 0.9234307811779852, 0.923430766276824, 0.923430766276824, 0.9234307811779852, 0.923430766276824, 0.9458241453484385, 0.9458241602495997, 0.9458241453484385, 0.9458241453484385, 0.9458241602495997, 0.9458241453484385, 0.9458241453484385, 0.9458241602495997, 0.9458241453484385, 0.943053052966747, 0.9430530678679082, 0.943053052966747, 0.943053052966747, 0.9430530678679082, 0.943053052966747, 0.943053052966747, 0.9430530678679082, 0.943053052966747, 0.90000000000000002, 0.90000000000000002, 0.90000000000000002, 0.90000000000000002, 0.90000000000000002, 1.0, 1.0, 1.0, 1.0, 1.0, 1.1000000000000001, 1.1000000000000001, 1.1000000000000001, 1.1000000000000001, 1.1000000000000001, 1.2, 1.2, 1.2, 1.2, 1.2, 1.3, 1.3, 1.3, 1.3, 1.3, 0.94305305 ])*100.
alt_1 = [11. , 11. , 11.00000015, 11. , 11. , 11.00000015, 11. , 11. , 11.00000015, 9. , 9. , 9.00000015, 9. , 9. , 9.00000015, 9. , 9. , 9.00000015, 9. , 9. , 9.00000015, 9. , 9. , 9.00000015, 9. , 9. , 9.00000015, 9. , 9. , 9.00000015, 9. , 9. , 9.00000015, 9. , 9. , 9.00000015, 9. , 9. , 9.00000015, 9. , 9. , 9.00000015, 9. , 9. , 9.00000015, 9. , 9. , 9.00000015, 9. , 9. , 9.00000015, 9. , 9. , 9.00000015, 9. , 10.25 , 11.5 , 12.75 , 14. , 9. , 10.25 , 11.5 , 12.75 , 14. , 9. , 10.25 , 11.5 , 12.75 , 14. , 9. , 10.25 , 11.5 , 12.75 , 14. , 9. , 10.25 , 11.5 , 12.75 , 14. , 9. ]

wing_2 = np.array([1.28, 1.2800000149011612, 1.28, 1.28, 1.2800000149011612, 1.28, 1.28, 1.2800000149011612, 1.28, 1.3, 1.3000000149011612, 1.3, 1.3, 1.3000000149011612, 1.3, 1.3, 1.3000000149011612, 1.3, 1.2512983213829585, 1.2512983362841197, 1.2512983213829585, 1.2512983213829585, 1.2512983362841197, 1.2512983213829585, 1.2512983213829585, 1.2512983362841197, 1.2512983213829585, 1.2027018036450188, 1.20270181854618, 1.2027018036450188, 1.2027018036450188, 1.20270181854618, 1.2027018036450188, 1.2027018036450188, 1.20270181854618, 1.2027018036450188, 0.9696195074510734, 0.9696195223522346, 0.9696195074510734, 0.9696195074510734, 0.9696195223522346, 0.9696195074510734, 0.9696195074510734, 0.9696195223522346, 0.9696195074510734, 0.9356100057984995, 0.9356100206996607, 0.9356100057984995, 0.9356100057984995, 0.9356100206996607, 0.9356100057984995, 0.9356100057984995, 0.9356100206996607, 0.9356100057984995, 0.9442290521247874, 0.9442290670259486, 0.9442290521247874, 0.9442290521247874, 0.9442290670259486, 0.9442290521247874, 0.9442290521247874, 0.9442290670259486, 0.9442290521247874, 0.90000000000000002, 0.90000000000000002, 0.90000000000000002, 0.90000000000000002, 0.90000000000000002, 1.0, 1.0, 1.0, 1.0, 1.0, 1.1000000000000001, 1.1000000000000001, 0.94422905 ])* 100.

alt_2 = [ 13.8 , 13.8 , 13.80000015 , 13.8 , 13.8 , 13.80000015 , 13.8 , 13.8, 13.80000015 , 10.86578142 , 10.86578142, 10.86578157 , 10.86578142 , 10.86578142 , 10.86578157 , 10.86578142, 10.86578142 , 10.86578157 , 9. , 9. , 9.00000015 , 9., 9., 9.00000015 , 9. , 9. , 9.00000015 , 9.26299784 , 9.26299784 , 9.26299799 , 9.26299784 , 9.26299784 , 9.26299799 , 9.26299784 , 9.26299784 , 9.26299799 , 9.21358943 , 9.21358943 , 9.21358957 , 9.21358943 , 9.21358943 , 9.21358957 , 9.21358943 , 9.21358943 , 9.21358957 , 9. , 9., 9.00000015 , 9., 9. , 9.00000015 , 9., 9. , 9.00000015 , 9. , 9., 9.00000015 , 9. , 9. , 9.00000015 , 9. , 9., 9.00000015 , 9. , 10.25 , 11.5 , 12.75, 14., 9.,10.25 , 11.5 , 12.75 , 14. , 9. , 10.25 , 9. ]



#now plot optimization path (note that these data points were post-processed into a plottable format)
wing_1 = [95 , 95.00000149 , 95 , 95 , 95.00000149 , 95 , 95 , 95.00000149 , 95 , 106.674165 , 106.6741665 , 106.674165 , 106.674165 , 106.6741665 , 106.674165 , 106.674165 , 106.6741665 , 106.674165 , 105.6274294 , 105.6274309 , 105.6274294 , 105.6274294 , 105.6274309 , 105.6274294 , 105.6274294 , 105.6274309 , 105.6274294 , 106.9084316 , 106.9084331 , 106.9084316 , 106.9084316 , 106.9084331 , 106.9084316 , 106.9084316 , 106.9084331 , 106.9084316 , 110.520489 , 110.5204905 , 110.520489 , 110.520489 , 110.5204905 , 110.520489 , 110.520489 , 110.5204905 , 110.520489 , 113.2166831 , 113.2166845 , 113.2166831 , 113.2166831 , 113.2166845 , 113.2166831 , 113.2166831 , 113.2166845 , 113.2166831 , 114.1649262 , 114.1649277 , 114.1649262 , 114.1649262 , 114.1649277 , 114.1649262 , 114.1649262 , 114.1649277 , 114.1649262 , 114.2149828]
alt_1 = [11.0 , 11.0 , 11.000000149011612, 11.0 , 11.0 , 11.000000149011612, 11.0 , 11.0 , 11.000000149011612, 9.540665954351425 , 9.540665954351425 , 9.540666103363037 , 9.540665954351425 , 9.540665954351425 , 9.540666103363037 , 9.540665954351425 , 9.540665954351425 , 9.540666103363037 , 10.023015652305284, 10.023015652305284, 10.023015801316896, 10.023015652305284, 10.023015652305284, 10.023015801316896, 10.023015652305284, 10.023015652305284, 10.023015801316896, 10.190994033521863, 10.190994033521863, 10.190994182533474, 10.190994033521863, 10.190994033521863, 10.190994182533474, 10.190994033521863, 10.190994033521863, 10.190994182533474, 10.440582829327589, 10.440582829327589, 10.4405829783392 , 10.440582829327589, 10.440582829327589, 10.4405829783392 , 10.440582829327589, 10.440582829327589, 10.4405829783392 , 10.536514606250261, 10.536514606250261, 10.536514755261873, 10.536514606250261, 10.536514606250261, 10.536514755261873, 10.536514606250261, 10.536514606250261, 10.536514755261873, 10.535957839878783, 10.535957839878783, 10.535957988890395, 10.535957839878783, 10.535957839878783, 10.535957988890395, 10.535957839878783, 10.535957839878783, 10.535957988890395, 10.52829047]
wing_2 = [128 , 128.0000015, 128 , 128 , 128.0000015, 128 , 128 , 128.0000015, 128 , 130 , 130.0000015, 130 , 130 , 130.0000015, 130 , 130 , 130.0000015, 130 , 122.9564124, 122.9564139, 122.9564124, 122.9564124, 122.9564139, 122.9564124, 122.9564124, 122.9564139, 122.9564124, 116.5744347, 116.5744362, 116.5744347, 116.5744347, 116.5744362, 116.5744347, 116.5744347, 116.5744362, 116.5744347, 116.3530891, 116.3530906, 116.3530891, 116.3530891, 116.3530906, 116.3530891, 116.3530891, 116.3530906, 116.3530891]
alt_2 = [13.8, 13.799999999999999, 13.80000014901161, 13.799999999999999, 13.799999999999999, 13.80000014901161, 13.799999999999999, 13.799999999999999, 13.80000014901161, 11.302562430674953, 11.302562430674953, 11.302562579686565, 11.302562430674953, 11.302562430674953, 11.302562579686565, 11.302562430674953, 11.302562430674953, 11.302562579686565, 11.158808932491421, 11.158808932491421, 11.158809081503033, 11.158808932491421, 11.158808932491421, 11.158809081503033, 11.158808932491421, 11.158808932491421, 11.158809081503033, 11.412913394878741, 11.412913394878741, 11.412913543890353, 11.412913394878741, 11.412913394878741, 11.412913543890353, 11.412913394878741, 11.412913394878741, 11.412913543890353, 11.402627869388722, 11.402627869388722, 11.402628018400334, 11.402627869388722, 11.402627869388722, 11.402628018400334, 11.402627869388722, 11.402627869388722, 11.402628018400334]
#wing_1 = [95 , 95.00000149 , 95 , 95 , 95.00000149 , 95 , 95 , 95.00000149 , 95 , 106.674165 , 106.6741665 , 106.674165 , 106.674165 , 106.6741665 , 106.674165 , 106.674165 , 106.6741665 , 106.674165 , 105.6274294 , 105.6274309 , 105.6274294 , 105.6274294 , 105.6274309 , 105.6274294 , 105.6274294 , 105.6274309 , 105.6274294 , 106.9084316 , 106.9084331 , 106.9084316 , 106.9084316 , 106.9084331 , 106.9084316 , 106.9084316 , 106.9084331 , 106.9084316 , 110.520489 , 110.5204905 , 110.520489 , 110.520489 , 110.5204905 , 110.520489 , 110.520489 , 110.5204905 , 110.520489 , 113.2166831 , 113.2166845 , 113.2166831 , 113.2166831 , 113.2166845 , 113.2166831 , 113.2166831 , 113.2166845 , 113.2166831 , 114.1649262 , 114.1649277 , 114.1649262 , 114.1649262 , 114.1649277 , 114.1649262 , 114.1649262 , 114.1649277 , 114.1649262 , 114.2149828]
#alt_1 = [11.0 , 11.0 , 11.000000149011612, 11.0 , 11.0 , 11.000000149011612, 11.0 , 11.0 , 11.000000149011612, 9.540665954351425 , 9.540665954351425 , 9.540666103363037 , 9.540665954351425 , 9.540665954351425 , 9.540666103363037 , 9.540665954351425 , 9.540665954351425 , 9.540666103363037 , 10.023015652305284, 10.023015652305284, 10.023015801316896, 10.023015652305284, 10.023015652305284, 10.023015801316896, 10.023015652305284, 10.023015652305284, 10.023015801316896, 10.190994033521863, 10.190994033521863, 10.190994182533474, 10.190994033521863, 10.190994033521863, 10.190994182533474, 10.190994033521863, 10.190994033521863, 10.190994182533474, 10.440582829327589, 10.440582829327589, 10.4405829783392 , 10.440582829327589, 10.440582829327589, 10.4405829783392 , 10.440582829327589, 10.440582829327589, 10.4405829783392 , 10.536514606250261, 10.536514606250261, 10.536514755261873, 10.536514606250261, 10.536514606250261, 10.536514755261873, 10.536514606250261, 10.536514606250261, 10.536514755261873, 10.535957839878783, 10.535957839878783, 10.535957988890395, 10.535957839878783, 10.535957839878783, 10.535957988890395, 10.535957839878783, 10.535957839878783, 10.535957988890395, 10.52829047]
#wing_2 = [128 , 128.0000015, 128 , 128 , 128.0000015, 128 , 128 , 128.0000015, 128 , 130 , 130.0000015, 130 , 130 , 130.0000015, 130 , 130 , 130.0000015, 130 , 122.9564124, 122.9564139, 122.9564124, 122.9564124, 122.9564139, 122.9564124, 122.9564124, 122.9564139, 122.9564124, 116.5744347, 116.5744362, 116.5744347, 116.5744347, 116.5744362, 116.5744347, 116.5744347, 116.5744362, 116.5744347, 116.3530891, 116.3530906, 116.3530891, 116.3530891, 116.3530906, 116.3530891, 116.3530891, 116.3530906, 116.3530891]
#alt_2 = [13.8, 13.799999999999999, 13.80000014901161, 13.799999999999999, 13.799999999999999, 13.80000014901161, 13.799999999999999, 13.799999999999999, 13.80000014901161, 11.302562430674953, 11.302562430674953, 11.302562579686565, 11.302562430674953, 11.302562430674953, 11.302562579686565, 11.302562430674953, 11.302562430674953, 11.302562579686565, 11.158808932491421, 11.158808932491421, 11.158809081503033, 11.158808932491421, 11.158808932491421, 11.158809081503033, 11.158808932491421, 11.158808932491421, 11.158809081503033, 11.412913394878741, 11.412913394878741, 11.412913543890353, 11.412913394878741, 11.412913394878741, 11.412913543890353, 11.412913394878741, 11.412913394878741, 11.412913543890353, 11.402627869388722, 11.402627869388722, 11.402628018400334, 11.402627869388722, 11.402627869388722, 11.402628018400334, 11.402627869388722, 11.402627869388722, 11.402628018400334]


'''
opt_1 = plt.plot(wing_1, alt_1, label='optimization path 1')
init_1 = plt.plot(wing_1[0], alt_1[0], 'ko')
final_1 = plt.plot(wing_1[-1], alt_1[-1], 'kx')
Expand All @@ -170,13 +195,13 @@ def variable_sweep(problem):
final_2 = plt.plot(wing_2[-1], alt_2[-1], 'kx', label= 'final points')
'''
plt.legend(loc='upper left')
plt.show()
plt.show(block=True)



return


if __name__ == '__main__':
main()

Expand Down
Loading