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

CST airfoil parameterization #141

Merged
merged 74 commits into from
Jul 15, 2022
Merged

CST airfoil parameterization #141

merged 74 commits into from
Jul 15, 2022

Conversation

eytanadler
Copy link
Contributor

Purpose

This PR adds a CST parameterization for airfoil optimization. It allows for design variables of the CST parameters, class shape, and chord length. All derivatives analytically defined.

Expected time until merged

2 furlongs

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

Tests for the new DVGeometryCST can be found in tests/reg_tests/test_DVGeometryCST.py.

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

… with DVCon...still needs testing and some other TODOs
… DVs to the airfoil fit in the pyOpt initialization and fix the bug when there are no DVGeoCST DVs (only alpha) in an opt problem
@eytanadler
Copy link
Contributor Author

Not sure what's going on with flake8, but it must be due to a new version since it's from code I didn't touch. What's the best approach to handle that?

@ewu63
Copy link
Collaborator

ewu63 commented Jul 13, 2022

Not sure what's going on with flake8, but it must be due to a new version since it's from code I didn't touch. What's the best approach to handle that?

Yeah this is from flake8-bugbear which just had a new version released. It gets a bit tricky pinning versions of all packages but I guess we could do it. Though for this kind of thing new versions bring better bug detection.

@eytanadler
Copy link
Contributor Author

eytanadler commented Jul 13, 2022

Not sure what's going on with flake8, but it must be due to a new version since it's from code I didn't touch. What's the best approach to handle that?

Yeah this is from flake8-bugbear which just had a new version released. It gets a bit tricky pinning versions of all packages but I guess we could do it. Though for this kind of thing new versions bring better bug detection.

Got it. I'm happy to fix it in this PR, I'm just not exactly sure what it needs. I tried adding a nonlocal, but that didn't do it.

@ewu63
Copy link
Collaborator

ewu63 commented Jul 15, 2022

Yeah at first glance I'm not really sure either. If we can't figure it out we can always tell flake8 to skip the warning.

@eytanadler eytanadler requested a review from anilyil July 15, 2022 14:22
Copy link
Contributor

@anilyil anilyil left a comment

Choose a reason for hiding this comment

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

Looking a lot better. few issues left

pygeo/parameterization/DVGeoCST.py Show resolved Hide resolved
pygeo/parameterization/DVGeoCST.py Outdated Show resolved Hide resolved
pygeo/parameterization/DVGeoCST.py Outdated Show resolved Hide resolved
pygeo/parameterization/DVGeoCST.py Show resolved Hide resolved
pygeo/parameterization/DVGeoCST.py Outdated Show resolved Hide resolved
pygeo/parameterization/DVGeoCST.py Show resolved Hide resolved
pygeo/parameterization/DVGeoCST.py Show resolved Hide resolved
pygeo/parameterization/DVGeoCST.py Show resolved Hide resolved
@anilyil
Copy link
Contributor

anilyil commented Jul 15, 2022

It looks like the flake check is complaining that the twist function defined in the dvgeomulti test can vary with different axes. Especially, the nrefaxis variable there might be getting updated, or there's a risk of it. we can just add it as an optional parameter to the function and set the value when we define the function. maybe that way it wont complain. sth like:

            # Set up a twist variable
            def twist(val, geo, nRefAxPts=nRefAxPts):
                for i in range(1, nRefAxPts):
                    geo.rot_z["box"].coef[i] = val[i - 1]

I don't know if this will fix it though.

@eytanadler
Copy link
Contributor Author

It looks like the flake check is complaining that the twist function defined in the dvgeomulti test can vary with different axes. Especially, the nrefaxis variable there might be getting updated, or there's a risk of it. we can just add it as an optional parameter to the function and set the value when we define the function. maybe that way it wont complain. sth like:

            # Set up a twist variable
            def twist(val, geo, nRefAxPts=nRefAxPts):
                for i in range(1, nRefAxPts):
                    geo.rot_z["box"].coef[i] = val[i - 1]

I don't know if this will fix it though.

Nice! Looks like this did the trick

@eytanadler eytanadler requested a review from anilyil July 15, 2022 19:41
Copy link
Contributor

@anilyil anilyil left a comment

Choose a reason for hiding this comment

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

Looks good. Thanks for working on the changes

@anilyil anilyil requested a review from hajdik July 15, 2022 21:58
@hajdik hajdik merged commit 511e70c into mdolab:main Jul 15, 2022
@eytanadler eytanadler deleted the cst branch July 26, 2022 12:16
@sseraj sseraj mentioned this pull request Jul 29, 2022
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.

7 participants