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

Use backward difference for check options on structured mm with slinear. #2195

Merged
merged 5 commits into from
Aug 1, 2021

Conversation

Kenneth-T-Moore
Copy link
Member

Summary

Use backward difference for check options on structured mm when the method is slinear.

This is to avoid confusion when checking partials on this component. Since bracketing looks left and forward difference checks look right, check derivatives would report an erroneous derivative if you tried to interpolate on a grid point.

Related Issues

Backwards incompatibilities

None

New Dependencies

None

@coveralls
Copy link

coveralls commented Jul 30, 2021

Coverage Status

Coverage decreased (-0.3%) to 89.036% when pulling a5b8a3f on Kenneth-T-Moore:master into 2df8b7b on OpenMDAO:master.

@@ -176,6 +176,11 @@ def _setup_partials(self):
if self.options['method'].startswith('scipy'):
self.set_check_partial_options('*', method='fd')

# Our bracketing album picks the bin behind it if you are interpolating exactly on one of
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'bracketing album'?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

haha, should be algorithm

@@ -1126,10 +1126,36 @@ def test_analysis_error_warning_msg(self):
p.set_val('x', 0.75)

msg = "Analysis Error: 'interp' <class MetaModelStructuredComp> " \
"Line 205 of file {}".format(inspect.getsourcefile(om.MetaModelStructuredComp))
"Line 210 of file {}".format(inspect.getsourcefile(om.MetaModelStructuredComp))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be better to rewrite this check so it isn't so fragile. Adding a line to MetaModelStructuredComp.py shouldn't break this test.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fault is the exception message actually, but to make the test more robust, I've added the capability to the assert_warning to optionally check if the warning contains the msg rather than check equality.

@swryan swryan merged commit 4d5b5e9 into OpenMDAO:master Aug 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants