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
Check_totals overhaul 1. #1729
Conversation
openmdao/core/problem.py
Outdated
@@ -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: |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
openmdao/core/problem.py
Outdated
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: |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 " |
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
Summary
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".
Related Issues
Backwards incompatibilities
None
New Dependencies
None