Skip to content

Commit

Permalink
Remove deprecated function from plot_wing (#409)
Browse files Browse the repository at this point in the history
* Fix deprecated CaseReader call

* Fixed deprecated call in plot_wingbox
  • Loading branch information
eytanadler committed May 15, 2023
1 parent dcdb76b commit f2c0526
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 234 deletions.
2 changes: 1 addition & 1 deletion openaerostruct/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "2.6.0"
__version__ = "2.6.1"
231 changes: 6 additions & 225 deletions openaerostruct/examples/run_aerostruct_uCRM_multipoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,231 +34,12 @@
# We use the coordinates available from airfoiltools.com. Using such a large number of coordinates is not necessary.
# The first and last x-coordinates of the upper and lower surfaces must be the same

upper_x = np.array(
[
0.1,
0.11,
0.12,
0.13,
0.14,
0.15,
0.16,
0.17,
0.18,
0.19,
0.2,
0.21,
0.22,
0.23,
0.24,
0.25,
0.26,
0.27,
0.28,
0.29,
0.3,
0.31,
0.32,
0.33,
0.34,
0.35,
0.36,
0.37,
0.38,
0.39,
0.4,
0.41,
0.42,
0.43,
0.44,
0.45,
0.46,
0.47,
0.48,
0.49,
0.5,
0.51,
0.52,
0.53,
0.54,
0.55,
0.56,
0.57,
0.58,
0.59,
0.6,
],
dtype="complex128",
)
lower_x = np.array(
[
0.1,
0.11,
0.12,
0.13,
0.14,
0.15,
0.16,
0.17,
0.18,
0.19,
0.2,
0.21,
0.22,
0.23,
0.24,
0.25,
0.26,
0.27,
0.28,
0.29,
0.3,
0.31,
0.32,
0.33,
0.34,
0.35,
0.36,
0.37,
0.38,
0.39,
0.4,
0.41,
0.42,
0.43,
0.44,
0.45,
0.46,
0.47,
0.48,
0.49,
0.5,
0.51,
0.52,
0.53,
0.54,
0.55,
0.56,
0.57,
0.58,
0.59,
0.6,
],
dtype="complex128",
)
upper_y = np.array(
[
0.0447,
0.046,
0.0472,
0.0484,
0.0495,
0.0505,
0.0514,
0.0523,
0.0531,
0.0538,
0.0545,
0.0551,
0.0557,
0.0563,
0.0568,
0.0573,
0.0577,
0.0581,
0.0585,
0.0588,
0.0591,
0.0593,
0.0595,
0.0597,
0.0599,
0.06,
0.0601,
0.0602,
0.0602,
0.0602,
0.0602,
0.0602,
0.0601,
0.06,
0.0599,
0.0598,
0.0596,
0.0594,
0.0592,
0.0589,
0.0586,
0.0583,
0.058,
0.0576,
0.0572,
0.0568,
0.0563,
0.0558,
0.0553,
0.0547,
0.0541,
],
dtype="complex128",
)
lower_y = np.array(
[
-0.0447,
-0.046,
-0.0473,
-0.0485,
-0.0496,
-0.0506,
-0.0515,
-0.0524,
-0.0532,
-0.054,
-0.0547,
-0.0554,
-0.056,
-0.0565,
-0.057,
-0.0575,
-0.0579,
-0.0583,
-0.0586,
-0.0589,
-0.0592,
-0.0594,
-0.0595,
-0.0596,
-0.0597,
-0.0598,
-0.0598,
-0.0598,
-0.0598,
-0.0597,
-0.0596,
-0.0594,
-0.0592,
-0.0589,
-0.0586,
-0.0582,
-0.0578,
-0.0573,
-0.0567,
-0.0561,
-0.0554,
-0.0546,
-0.0538,
-0.0529,
-0.0519,
-0.0509,
-0.0497,
-0.0485,
-0.0472,
-0.0458,
-0.0444,
],
dtype="complex128",
)

# fmt: off
upper_x = np.array([0.1, 0.11, 0.12, 0.13, 0.14, 0.15, 0.16, 0.17, 0.18, 0.19, 0.2, 0.21, 0.22, 0.23, 0.24, 0.25, 0.26, 0.27, 0.28, 0.29, 0.3, 0.31, 0.32, 0.33, 0.34, 0.35, 0.36, 0.37, 0.38, 0.39, 0.4, 0.41, 0.42, 0.43, 0.44, 0.45, 0.46, 0.47, 0.48, 0.49, 0.5, 0.51, 0.52, 0.53, 0.54, 0.55, 0.56, 0.57, 0.58, 0.59, 0.6], dtype="complex128")
lower_x = np.array([0.1, 0.11, 0.12, 0.13, 0.14, 0.15, 0.16, 0.17, 0.18, 0.19, 0.2, 0.21, 0.22, 0.23, 0.24, 0.25, 0.26, 0.27, 0.28, 0.29, 0.3, 0.31, 0.32, 0.33, 0.34, 0.35, 0.36, 0.37, 0.38, 0.39, 0.4, 0.41, 0.42, 0.43, 0.44, 0.45, 0.46, 0.47, 0.48, 0.49, 0.5, 0.51, 0.52, 0.53, 0.54, 0.55, 0.56, 0.57, 0.58, 0.59, 0.6], dtype="complex128")
upper_y = np.array([0.0447, 0.046, 0.0472, 0.0484, 0.0495, 0.0505, 0.0514, 0.0523, 0.0531, 0.0538, 0.0545, 0.0551, 0.0557, 0.0563, 0.0568, 0.0573, 0.0577, 0.0581, 0.0585, 0.0588, 0.0591, 0.0593, 0.0595, 0.0597, 0.0599, 0.06, 0.0601, 0.0602, 0.0602, 0.0602, 0.0602, 0.0602, 0.0601, 0.06, 0.0599, 0.0598, 0.0596, 0.0594, 0.0592, 0.0589, 0.0586, 0.0583, 0.058, 0.0576, 0.0572, 0.0568, 0.0563, 0.0558, 0.0553, 0.0547, 0.0541], dtype="complex128")
lower_y = np.array([-0.0447, -0.046, -0.0473, -0.0485, -0.0496, -0.0506, -0.0515, -0.0524, -0.0532, -0.054, -0.0547, -0.0554, -0.056, -0.0565, -0.057, -0.0575, -0.0579, -0.0583, -0.0586, -0.0589, -0.0592, -0.0594, -0.0595, -0.0596, -0.0597, -0.0598, -0.0598, -0.0598, -0.0598, -0.0597, -0.0596, -0.0594, -0.0592, -0.0589, -0.0586, -0.0582, -0.0578, -0.0573, -0.0567, -0.0561, -0.0554, -0.0546, -0.0538, -0.0529, -0.0519, -0.0509, -0.0497, -0.0485, -0.0472, -0.0458, -0.0444], dtype="complex128")
# fmt: on

# Create a dictionary to store options about the surface
mesh_dict = {
Expand Down
11 changes: 6 additions & 5 deletions openaerostruct/utils/plot_wing.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,10 @@ def load_db(self):
names = []

# Aero or aerostructural
for key in cr.system_options.keys():
sys_options = cr.list_model_options(out_stream=None)
for key in sys_options.keys():
try:
surfaces = cr.system_options[key]["component_options"]["surfaces"]
surfaces = sys_options[key]["surfaces"]
for surface in surfaces:
names.append(surface["name"])
break
Expand All @@ -93,9 +94,9 @@ def load_db(self):

# Structural-only
if not names:
for key in cr.system_options.keys():
for key in sys_options.keys():
try:
surface = cr.system_options[key]["component_options"]["surface"]
surface = sys_options[key]["surface"]
names = [surface["name"]]
except KeyError:
pass
Expand Down Expand Up @@ -239,7 +240,7 @@ def load_db(self):

if self.show_tube:
for name in names:
surface = cr.system_options[name]["component_options"]["surface"]
surface = sys_options[name]["surface"]
self.yield_stress_dict[name + "_yield_stress"] = surface["yield"]
self.fem_origin_dict[name + "_fem_origin"] = surface["fem_origin"]

Expand Down
7 changes: 4 additions & 3 deletions openaerostruct/utils/plot_wingbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,10 @@ def load_db(self):
last_case = next(reversed(cr.get_cases("driver")))

names = []
for key in cr.system_options.keys():
sys_options = cr.list_model_options(out_stream=None)
for key in sys_options.keys():
try:
surfaces = cr.system_options[key]["component_options"]["surfaces"]
surfaces = sys_options[key]["surfaces"]
for surface in surfaces:
names.append(surface["name"])
break
Expand Down Expand Up @@ -268,7 +269,7 @@ def load_db(self):

if self.show_tube:
for name in names:
surface = cr.system_options[name]["component_options"]["surface"]
surface = sys_options[name]["surface"]
self.yield_stress_dict[name + "_yield_stress"] = surface["yield"]

# self.fem_origin_dict[name + '_fem_origin'] = surface['fem_origin']
Expand Down

0 comments on commit f2c0526

Please sign in to comment.