forked from leamichel97/prop-solid
-
Notifications
You must be signed in to change notification settings - Fork 1
/
run_screening.py
100 lines (84 loc) · 3.75 KB
/
run_screening.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# -*- coding: utf-8 -*-
"""
run_screening.py generated by WhatsOpt 1.7.1
"""
# DO NOT EDIT unless you know what you are doing
# analysis_id: 77
import sys
import numpy as np
import matplotlib.pyplot as plt
from packaging import version
from openmdao import __version__ as OPENMDAO_VERSION
from openmdao.api import Problem, SqliteRecorder, CaseReader
from openmdao_extensions.salib_doe_driver import SalibDOEDriver
from SALib.analyze import morris
from SALib.analyze import sobol
from SALib.plotting import morris as mp
from SALib.plotting.bar import plot as barplot
from lanceur_prop_solide import LanceurPropSolide
from optparse import OptionParser
parser = OptionParser()
parser.add_option("-b", "--batch",
action="store_true", dest="batch", default=False,
help="do not plot anything")
parser.add_option("-s", "--sobol",
action="store_true", dest="sobol", default=False,
help="do not plot anything")
parser.add_option("-p", "--parallel",
action="store_true", default=False,
help="run doe in parallel")
(options, args) = parser.parse_args()
pb = Problem(LanceurPropSolide())
sa_method_name='Morris'
sa_doe_options={'n_trajs': 10, 'n_levels': 4}
if options.sobol:
sa_method_name='Sobol'
sa_doe_options={'n_samples': 500, 'calc_second_order': False}
pb.driver = SalibDOEDriver(sa_method_name=sa_method_name, sa_doe_options=sa_doe_options)
pb.driver.options['run_parallel'] = options.parallel
case_recorder_filename = 'lanceur_prop_solide_screening.sqlite'
recorder = SqliteRecorder(case_recorder_filename)
pb.driver.add_recorder(recorder)
if version.parse(OPENMDAO_VERSION) > version.parse("2.8.0"):
pb.model.nonlinear_solver.options['err_on_non_converge'] = True
else:
pb.model.nonlinear_solver.options['err_on_maxiter'] = True
pb.model.add_design_var('Ae', lower=-sys.float_info.max, upper=sys.float_info.max)
pb.model.add_design_var('beta', lower=-sys.float_info.max, upper=sys.float_info.max)
pb.model.add_design_var('De', lower=-sys.float_info.max, upper=sys.float_info.max)
pb.model.add_design_var('Ds', lower=-sys.float_info.max, upper=sys.float_info.max)
pb.model.add_design_var('Dt', lower=-sys.float_info.max, upper=sys.float_info.max)
pb.model.add_design_var('L_vehicle', lower=-sys.float_info.max, upper=sys.float_info.max)
pb.model.add_design_var('M_case', lower=-sys.float_info.max, upper=sys.float_info.max)
pb.model.add_design_var('M_igniter', lower=-sys.float_info.max, upper=sys.float_info.max)
pb.model.add_design_var('M_nozzle', lower=-sys.float_info.max, upper=sys.float_info.max)
pb.model.add_design_var('Pa', lower=18367, upper=35605)
pb.model.add_design_var('R', lower=-sys.float_info.max, upper=sys.float_info.max)
pb.model.add_design_var('Ru', lower=-sys.float_info.max, upper=sys.float_info.max)
pb.model.add_design_var('SF', lower=-sys.float_info.max, upper=sys.float_info.max)
pb.model.add_design_var('theta_n', lower=-sys.float_info.max, upper=sys.float_info.max)
pb.model.add_objective('At')
pb.model.add_objective('C_F')
pb.model.add_objective('C_star')
pb.model.add_objective('epsilon')
pb.model.add_objective('F_T')
pb.model.add_objective('gamma_maj')
pb.model.add_objective('Isp')
pb.model.add_objective('L_case')
pb.model.add_objective('L_conv')
pb.model.add_objective('L_div')
pb.model.add_objective('L_fairing')
pb.model.add_objective('L_interstage')
pb.model.add_objective('L_SRM')
pb.model.add_objective('Mp')
pb.model.add_objective('M_avionics')
pb.model.add_objective('M_EPS')
pb.model.add_objective('M_fairing')
pb.model.add_objective('M_interstage')
pb.model.add_objective('M_pad')
pb.model.add_objective('M_PLA')
pb.model.add_objective('M_SRM')
pb.model.add_objective('prop_m')
pb.model.add_objective('Ve')
pb.setup()
pb.run_driver()