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

Check_totals overhaul 1. #1729

Merged
merged 3 commits into from Oct 9, 2020
Merged

Check_totals overhaul 1. #1729

merged 3 commits into from Oct 9, 2020

Conversation

Kenneth-T-Moore
Copy link
Member

Summary

  1. Fixed bug where linear constraints where omitted from check_totals.
  2. In the check_totals full output:
    a. mark the derivative of a linear constraint with "(Linear constraint)".
    b. change "Jfwd" to "Jan" (analytic).
    c. change "forward" to "analytic".
    d. correct printed formula for relative difference to include the denominator "Jan" or "Jfd".
  3. 2.b, 2.c, and 2.d apply to check_partials as well, where applicable. Forward (fwd) and Reverse (rev) are now only mentioned in check_partials for of:wrt pairs that declare matrix-free partials.

Related Issues

Backwards incompatibilities

None

New Dependencies

None

@project-bot project-bot bot added this to In progress in OpenMDAO Dev [Read only] Oct 7, 2020
@@ -1470,6 +1471,21 @@ def check_totals(self, of=None, wrt=None, out_stream=_DEFAULT_OUT_STREAM, compac

# TODO: Once we're tracking iteration counts, run the model if it has not been run before.

if wrt is None:
wrt = list(self.driver._designvars)
if wrt is None:
Copy link
Member

Choose a reason for hiding this comment

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

Did you mean to put if not wrt: here instead? 'wrt' can never be None here. Same goes for if of is None: check below.

Copy link
Member Author

Choose a reason for hiding this comment

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

oops, I missed these here. Fixed

of.extend(self.driver._cons)
lcons = [n for n, meta in self.driver._cons.items()
if ('linear' in meta and meta['linear'])]
if of is None:
Copy link
Member

Choose a reason for hiding this comment

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

Very minor, but I would put the if check before the lcons = ... line above.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

if driver_wrt:
prom_wrt = driver_wrt
else:
raise RuntimeError("Driver is not providing any design variables "
Copy link
Member

Choose a reason for hiding this comment

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

I'm not following why you removed the empty dv and empty response checks here and replaced them with checks in two different places (in compute_totals and check_totals).

Copy link
Member Author

Choose a reason for hiding this comment

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

This is what we talked about. Now, the of and wrt are always passed in to this init. No reason to check them here anymore, since it should never happen.

Copy link
Member

Choose a reason for hiding this comment

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

It would happen if you weren't doing the upper level checks, wouldn't it?

Copy link
Member

Choose a reason for hiding this comment

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

I guess the checks were checking for of/wrt == None, so you're right, that wouldn't happen.

OpenMDAO Dev [Read only] automation moved this from In progress to Reviewer approved Oct 7, 2020
@swryan swryan merged commit 15c942e into OpenMDAO:master Oct 9, 2020
OpenMDAO Dev [Read only] automation moved this from Reviewer approved to Done Oct 9, 2020
@Kenneth-T-Moore Kenneth-T-Moore mentioned this pull request Jan 8, 2021
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

cleanup the output on check totals check_totals should show linear constraints
3 participants