Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/OpenMDAO/OpenMDAO into co…
Browse files Browse the repository at this point in the history
…nnections_in_configure
  • Loading branch information
robfalck committed Jul 19, 2019
2 parents 4a3f9db + 429c5bb commit 62cdd33
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion openmdao/core/problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -1284,7 +1284,7 @@ def check_partials(self, out_stream=_DEFAULT_OUT_STREAM, includes=None, excludes
fd_options['form'] = form
fd_options['step_calc'] = step_calc

if step:
if step and requested_method == method:
fd_options['step'] = step
else:
fd_options['step'] = defaults['step']
Expand Down
24 changes: 24 additions & 0 deletions openmdao/core/tests/test_check_derivs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1814,6 +1814,30 @@ def test_directional(self):

data = prob.check_partials()

def test_set_method_and_step_bug(self):
# If a model-builder set his a component to fd, and the global method is cs with a specified
# step size, that size is probably unusable, and can lead to false error in the check.

prob = om.Problem()

prob.model.add_subsystem('p1', om.IndepVarComp('x', 3.0))
prob.model.add_subsystem('p2', om.IndepVarComp('y', 5.0))
comp = prob.model.add_subsystem('comp', Paraboloid())

prob.model.connect('p1.x', 'comp.x')
prob.model.connect('p2.y', 'comp.y')

prob.set_solver_print(level=0)

comp.set_check_partial_options(wrt='*', method='fd')

prob.setup(force_alloc_complex=True)
prob.run_model()

J = prob.check_partials(compact_print=True, method='cs', step=1e-40, out_stream=None)

assert_check_partials(J, atol=1e-5, rtol=1e-5)


class TestProblemCheckTotals(unittest.TestCase):

Expand Down

0 comments on commit 62cdd33

Please sign in to comment.