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

Fixed test for change of jacobian keys in OpenMDAO 3.31 #47

Merged
merged 2 commits into from
Mar 7, 2024
Merged
Changes from 1 commit
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
13 changes: 12 additions & 1 deletion CADRE/test/test_mdp.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@
import pickle
import unittest

from packaging.version import Version

import numpy as np

from openmdao import __version__ as om_version
from openmdao.api import Problem, PETScKrylov
from openmdao.utils.mpi import MPI

Expand Down Expand Up @@ -161,7 +164,15 @@ def test_CADRE_MDP(self):
bkey2 = '.'.join(parts)

actual = Ja[key1][key2]
computed = Jb[bkey1, bkey2]
if Version(om_version) <= Version("3.30"):
computed = Jb[bkey1, bkey2]
else:
# as of OpenMDAO 3.31.0, the keys in the jac are the 'user facing' names
# given to the design vars and responses, rather than the absolute names
# that were used previously
computed = Jb[prob.model._var_allprocs_abs2prom['output'][bkey1],
prob.model._var_allprocs_abs2prom['output'][bkey2]]

if isinstance(computed, np.ndarray):
rel = np.linalg.norm(actual - computed)/np.linalg.norm(actual)
else:
Expand Down
Loading