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

fixed span derivative issues #143

Merged
merged 7 commits into from
Jun 20, 2022
Merged

fixed span derivative issues #143

merged 7 commits into from
Jun 20, 2022

Conversation

joanibal
Copy link
Collaborator

@joanibal joanibal commented Jun 9, 2022

Purpose

This PR addresses this issues and issues like it.

Simple design variable functions like this were producing the wrong derivative values because the coefficients used the second time (in the CS used to compute the Jacobain) had already been scaled once.

def span(val, geo):
    C = geo.extractCoef("wing")
    for i in range(1, nRefAxPts):
        C[i, 2] *= val
    geo.restoreCoef(C, "wing")

The fix was simply to reset the FFD coefficient values before the CS loop used to calculate the Jacobian.

Expected time until merged

1 week

Type of change

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (non-backwards-compatible fix or feature)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no API changes)
  • Documentation update
  • Maintenance update
  • Other (please describe)

Testing

See the new test

Checklist

  • I have run flake8 and black to make sure the code adheres to PEP-8 and is consistently formatted
  • I have run unit and regression tests which pass locally with my changes
  • I have added new tests that prove my fix is effective or that my feature works
  • I have added necessary documentation

@joanibal joanibal requested a review from a team as a code owner June 9, 2022 22:14
@joanibal joanibal requested review from hajdik and ArshSaja June 9, 2022 22:14
@joanibal joanibal changed the title fixed span issue fixed span derivative issues Jun 9, 2022
@codecov
Copy link

codecov bot commented Jun 9, 2022

Codecov Report

Merging #143 (aaddcb3) into main (53494a8) will decrease coverage by 10.85%.
The diff coverage is 100.00%.

@@             Coverage Diff             @@
##             main     #143       +/-   ##
===========================================
- Coverage   62.77%   51.91%   -10.86%     
===========================================
  Files          46       46               
  Lines       11263    11266        +3     
===========================================
- Hits         7070     5849     -1221     
- Misses       4193     5417     +1224     
Impacted Files Coverage Δ
pygeo/parameterization/DVGeo.py 63.96% <100.00%> (-0.45%) ⬇️
pygeo/parameterization/DVGeoMulti.py 0.40% <0.00%> (-89.42%) ⬇️
pygeo/constraints/areaConstraint.py 50.50% <0.00%> (-25.42%) ⬇️
pygeo/constraints/DVCon.py 68.04% <0.00%> (-3.69%) ⬇️
pygeo/pyBlock.py 45.37% <0.00%> (-1.65%) ⬇️
pygeo/topology.py 54.92% <0.00%> (-0.23%) ⬇️
pygeo/__init__.py 100.00% <0.00%> (+10.52%) ⬆️
pygeo/parameterization/__init__.py 100.00% <0.00%> (+14.28%) ⬆️

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

refFFDCoef = copy.copy(self.origFFDCoef.astype("D"))
refCoef = copy.copy(self.coef0.astype("D"))
else:
refFFDCoef = copy.copy(self.FFD.coef)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why does the reset happen only if the FFD is not a child?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If the FFD is child then it's nodes will be moved by the parent

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Without this the test_block test were failing

Copy link
Contributor

Choose a reason for hiding this comment

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

does that work even if I define the span variable directly on the child?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm not sure.
Probably not

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I have added a test using a span variable on a child FFD.
It looks like it worked

@joanibal
Copy link
Collaborator Author

@hajdik This is ready for review again

marcomangano
marcomangano previously approved these changes Jun 16, 2022
Copy link
Contributor

@marcomangano marcomangano left a comment

Choose a reason for hiding this comment

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

Thanks for adding the extra test!

hajdik
hajdik previously approved these changes Jun 18, 2022
@joanibal joanibal dismissed stale reviews from hajdik and marcomangano via 3df32b7 June 20, 2022 15:09
@joanibal joanibal requested review from hajdik and marcomangano June 20, 2022 15:17
@joanibal joanibal requested a review from hajdik June 20, 2022 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants