Skip to content

Commit

Permalink
Totals dictionary with OpenMDAO >=3.31 has promoted names as keys (#426)
Browse files Browse the repository at this point in the history
* Totals dictionary with OpenMDAO >=3.31 has promoted names as keys

* Set version of codecov CLI to maybe help with GHA 404 errors

* Didn't work

* Bump patch
  • Loading branch information
eytanadler committed Apr 16, 2024
1 parent e1cb181 commit 5c28f3e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
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

0 comments on commit 5c28f3e

Please sign in to comment.