Skip to content

Commit 5c28f3e

Browse files
authored
Totals dictionary with OpenMDAO >=3.31 has promoted names as keys (#426)
* 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
1 parent e1cb181 commit 5c28f3e

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

openaerostruct/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "2.7.0"
1+
__version__ = "2.7.1"

openaerostruct/tests/test_multipoint_parallel.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,10 +387,17 @@ def test_multipoint_MPI(self):
387387
print("Analysis runtime: ", run_model_time, "[s]")
388388
print("Derivatives runtime: ", derivs_time, "[s]")
389389

390+
# OpenMDAO versions before 3.31 use absolute names as dictionary keys, but versions after
391+
# use user facing (promoted) names. Handle both cases here.
392+
try:
393+
deriv_fuel_sum_spar_thickness = totals[("fuel_sum.fuel_sum", "wing.spar_thickness_cp")]
394+
except KeyError:
395+
deriv_fuel_sum_spar_thickness = totals[("fuel_sum", "wing.spar_thickness_cp")]
396+
390397
assert_near_equal(MPI.COMM_WORLD.size, 2, 1e-8)
391-
assert_near_equal(prob.get_val("fuel_sum.fuel_sum", units="kg"), 5649.1290836, 1e-5)
398+
assert_near_equal(prob.get_val("fuel_sum", units="kg"), 5649.1290836, 1e-5)
392399
assert_near_equal(
393-
totals[("fuel_sum.fuel_sum", "wing.spar_thickness_cp")],
400+
deriv_fuel_sum_spar_thickness,
394401
np.array([[1712.12137573, 2237.99650867, 3036.45032547, 5065.16727605]]),
395402
1e-5,
396403
)

0 commit comments

Comments
 (0)