Skip to content
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

Totals dictionary with OpenMDAO >=3.31 has promoted names as keys #426

Merged
merged 4 commits into from
Apr 16, 2024
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
2 changes: 1 addition & 1 deletion openaerostruct/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "2.7.0"
__version__ = "2.7.1"
11 changes: 9 additions & 2 deletions openaerostruct/tests/test_multipoint_parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,10 +387,17 @@ def test_multipoint_MPI(self):
print("Analysis runtime: ", run_model_time, "[s]")
print("Derivatives runtime: ", derivs_time, "[s]")

# OpenMDAO versions before 3.31 use absolute names as dictionary keys, but versions after
# use user facing (promoted) names. Handle both cases here.
try:
deriv_fuel_sum_spar_thickness = totals[("fuel_sum.fuel_sum", "wing.spar_thickness_cp")]
except KeyError:
deriv_fuel_sum_spar_thickness = totals[("fuel_sum", "wing.spar_thickness_cp")]

assert_near_equal(MPI.COMM_WORLD.size, 2, 1e-8)
assert_near_equal(prob.get_val("fuel_sum.fuel_sum", units="kg"), 5649.1290836, 1e-5)
assert_near_equal(prob.get_val("fuel_sum", units="kg"), 5649.1290836, 1e-5)
assert_near_equal(
totals[("fuel_sum.fuel_sum", "wing.spar_thickness_cp")],
deriv_fuel_sum_spar_thickness,
np.array([[1712.12137573, 2237.99650867, 3036.45032547, 5065.16727605]]),
1e-5,
)
Expand Down
Loading