-
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
Make ref axis optional when adding a child FFD #150
Conversation
Codecov Report
@@ Coverage Diff @@
## main #150 +/- ##
===========================================
- Coverage 63.72% 53.27% -10.46%
===========================================
Files 47 47
Lines 11676 11689 +13
===========================================
- Hits 7441 6227 -1214
- Misses 4235 5462 +1227
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
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 looks alright, the current scripts should not even be affected except for the "anticipated" _finalize()
call I mention below.
I would still like to have the original developers feedback on this though
pygeo/parameterization/DVGeo.py
Outdated
@@ -1685,6 +1686,15 @@ def update(self, ptSetName, childDelta=True, config=None): | |||
# We've postponed things as long as we can...do the finalization. | |||
self._finalize() | |||
|
|||
for iChild in range(len(self.children)): | |||
if len(self.children[iChild].axis) > 0: | |||
self.children[iChild]._finalize() |
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.
As you mentioned, the _finalize
here is needed to get the refAxis.coef
(coefficient of refAxis nodes) that are then embedded in the parent control volume below.
I am wondering then:
- if it still makes sense to have another
child._finalize()
here - what caused the mismatch in the previous tests - was it due to the fact that the control points themselves were not embedded or something? I am honestly a bit confused by how pyGeo currently works, maybe there are some other intermediate steps we are missing if the axis is not added rightaway
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.
- The finalize method exists right away if it has already been called. This it is safe to repeatedly call finalize during each call of the update method.
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 don't think I know which tests you are referring to.
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 was referring to the test failures after the first commit, but the build log is lost now.
Agreed on the multiple finalizing calls.
moved ref axis addition after the FFD coef are set to their original values to ensure ref axis is embedded in the undeformed volume.
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.
Good fix, can merge after the code is updated with main and the style errors are fixed
# Make sure coefficients are complex | ||
self._complexifyCoef() | ||
|
||
# Set all coef Values back to initial values | ||
if not self.isChild: | ||
self.FFD.coef = self.origFFDCoef.copy() | ||
self._setInitialValues() | ||
|
||
for iChild in range(len(self.children)): |
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.
Good catch here, did not realize that the children were trying to initialize themselves again. Out of curiosity, did you have issues because of this or you just re-checked the code?
An optional thought; recently I realized that |
I agree with this point, though I think we should leave it for a separate PR and discuss it in the MPHYS meeting. Does that seem reasonable? It ultimately still needs the child FFD to be added to the parent to be able to add the axis as you are suggesting, so it would rely on Josh's fix here. |
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.
Once the formatting issues are fixed, looks good to me!
Agree! we can talk about it later. |
@joanibal: @bernardopacini and I just discussed about this PR and figured that this is probably not the best approach to address the MPhys issues. The fix in #144 already makes sense and covers MPhys problems. |
added error message for adding ref axis to grand children after the child is added to the parent
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.
With the added error message, this looks good to me.
Purpose
This PR addresses some challenges @bernardopacini was having when using child FFDs with MPhys.
Expected time until merged
3 days (@bernardopacini is waiting on this)
Type of change
Testing
I ran the tandem wing optimization tutorial problem, which has 2 child FFDs. I added a ref axis before adding one the parent and the other after. The results of the optimization are exactly the same.
Checklist
flake8
andblack
to make sure the code adheres to PEP-8 and is consistently formatted