-
Notifications
You must be signed in to change notification settings - Fork 55
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
Code cleanup #100
Code cleanup #100
Conversation
Codecov Report
@@ Coverage Diff @@
## master #100 +/- ##
=======================================
Coverage 51.12% 51.12%
=======================================
Files 40 40
Lines 9608 9608
=======================================
Hits 4912 4912
Misses 4696 4696
Continue to review full report at Codecov.
|
@@ -69,7 +69,7 @@ def evalFunctionsSensFD(self, DVGeo, DVCon, fdstep=1e-2): | |||
funcsSens[outkey][inkey][:, array_ind] = deriv_temp | |||
xDV[inkey][array_ind] = baseVar[array_ind] | |||
DVGeo.setDesignVars(xDV) | |||
DVCon.evalFunctions(dict()) | |||
DVCon.evalFunctions({}) |
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've no idea why this line is needed..
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.
You mean {}
instead of dict()
? Or the fact that we are calling DVCon
?
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.
Oh now I see, it's a third call to DVCon
at the end, just before exiting the FD sensitivity method.. Maybe it's just to reset the internal values, same as done by DVGeo.setDesignVars()
above? I need to check the function
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.
@nwu63 I suspect that it is needed because every time we evaluate a constraint we update the coordinates of the pyGeo object. I think that if we directly use DVGeo.update()
the tests should work, up to you if you want to play with that.
I might be wrong bc I don't know what error you are getting.
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.
Yeah I've no idea, but without line 72 one of the tests fail, and if I also take out line 71 then a few more tests fail. I can see cases where 71 is needed (even though it's probably not the best practice), but not sure why 72 is needed at all.
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 can't tell what that line is doing either, the error I get from taking it out is in Test 8: Circularity constraint
and looks like it's not meeting the tolerance. Neil is this what you're seeing?
AssertionError:
Not equal to tolerance rtol=1e-07, atol=1e-07
Failed value for: circularity_base
Mismatched elements: 8 / 9 (88.9%)
Max absolute difference: 2.15268112e-05
Max relative difference: 2.15268112e-05
x: array([0.999989, 0.999978, 0.999987, 1. , 0.999995, 0.99998 ,
0.999981, 0.999994, 1. ])
y: array([1., 1., 1., 1., 1., 1., 1., 1., 1.])
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.
Yes exactly.
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.
Looks good, see my comments/questions
@@ -69,7 +69,7 @@ def evalFunctionsSensFD(self, DVGeo, DVCon, fdstep=1e-2): | |||
funcsSens[outkey][inkey][:, array_ind] = deriv_temp | |||
xDV[inkey][array_ind] = baseVar[array_ind] | |||
DVGeo.setDesignVars(xDV) | |||
DVCon.evalFunctions(dict()) | |||
DVCon.evalFunctions({}) |
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.
Oh now I see, it's a third call to DVCon
at the end, just before exiting the FD sensitivity method.. Maybe it's just to reset the internal values, same as done by DVGeo.setDesignVars()
above? I need to check the function
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.
After some offline discussion, I think this is ready to be merged.
That constraint test will really need some overhauling, but it is something that should be done at a later stage
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.
Updates all look good, agree with fixing the constraint test at a later date.
* added pygeo test * comments * Code cleanup (#100) * redoing last commits * adding .ref Co-authored-by: Neil Wu <602725+nwu63@users.noreply.github.com>
Purpose
This PR cleans up some of the code:
type()
etc.)Type of change
What types of change is it?
Select the appropriate type(s) that describe this PR
Testing
N/A
Checklist
Put an
x
in the boxes that apply.flake8
andblack
to make sure the code adheres to PEP-8 and is consistently formatted