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

Add the possibility to change the position of the scaling for the chord design variable #410

Merged
merged 14 commits into from
Jun 26, 2023

Conversation

lucaeros
Copy link
Contributor

@lucaeros lucaeros commented May 9, 2023

Purpose

Scaling position at quarter chord :
Screenshot from 2023-05-09 11-40-05

Scaling position at trailing edge :
Screenshot from 2023-05-09 11-51-05

Expected time until merged

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

Checklist

  • I have run flake8 and black to make sure the Python code adheres to PEP-8 and is consistently formatted
  • I have formatted the Fortran code with fprettify or C/C++ code with clang-format as applicable
  • 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

@lucaeros lucaeros requested a review from a team as a code owner May 9, 2023 18:36
@codecov
Copy link

codecov bot commented May 9, 2023

Codecov Report

❗ No coverage uploaded for pull request base (main@2567ea9). Click here to learn what that means.
The diff coverage is 94.44%.

@@           Coverage Diff           @@
##             main     #410   +/-   ##
=======================================
  Coverage        ?   94.51%           
=======================================
  Files           ?      103           
  Lines           ?     6420           
  Branches        ?        0           
=======================================
  Hits            ?     6068           
  Misses          ?      352           
  Partials        ?        0           
Impacted Files Coverage Δ
openaerostruct/geometry/geometry_mesh.py 98.68% <85.71%> (ø)
openaerostruct/__init__.py 100.00% <100.00%> (ø)
...rostruct/geometry/geometry_mesh_transformations.py 99.66% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@kanekosh
Copy link
Contributor

Thanks Lucas! Could you add a quick documentation about this new feature in the geometry manipulation and surface dict entries pages?

Copy link
Collaborator

@eytanadler eytanadler 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 the contributions! In addition to the code comments I added, please also do the following:

  1. Add this new feature to the rectangular wing chord optimization example here.
  2. Add a "chord_scaling_pos" entry to the surface dictionary in this test to test that your change works.
  3. Add another test for ScaleX in this file that checks the partials and confirms that the chord values have changed as you expect.

openaerostruct/geometry/geometry_mesh_transformations.py Outdated Show resolved Hide resolved
@@ -79,10 +79,15 @@ def setup(self):
val = np.ones(ny)
if "chord_cp" in surface:
promotes = ["chord"]
if "chord_scaling_pos" in surface:
gamma = surface["chord_scaling_pos"]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Once you change the option name, also change this variable name. Also can't this if else block be moved outside of the if "chord_cp" in surface block so that you don't need to duplicate the gamma = 0.25 line? If you want to be even nicer, you could throw a warning if "chord_scaling_pos" is specified but there are no chord DVs.

openaerostruct/geometry/geometry_mesh_transformations.py Outdated Show resolved Hide resolved
@lucaeros lucaeros requested a review from eytanadler June 2, 2023 21:30
Copy link
Collaborator

@eytanadler eytanadler 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 the updates! Other than the two comments, please add documentation to geometry manipulation as Shugo mentioned about this new feature. It'd be nice to add two new pictures in the same format as the others to show what it does as there are for the existing design variables.

else:
if "chord_scaling_pos" in surface:
print("WARNING: chord_scaling_pos has been specified but no chord design variable available")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use the built in warnings package as we do here. It's nicer because it allows the user to turn off warnings if desired (among other things)

group = prob.model

val = self.rng.random(NY)
chord_scaling_pos = self.rng.random(1)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you pick a value here, maybe 0 or 1, that you can analytically check? Then add an assert after run model that checks that the chord has been modified as you expect

Choose a reason for hiding this comment

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

Is this still an open item?

@lucaeros
Copy link
Contributor Author

lucaeros commented Jun 7, 2023

Thanks for the updates! Other than the two comments, please add documentation to geometry manipulation as Shugo mentioned about this new feature. It'd be nice to add two new pictures in the same format as the others to show what it does as there are for the existing design variables.
I added the feature here :
https://mdolab-openaerostruct.readthedocs-hosted.com/en/latest/user_reference/mesh_surface_dict.html#mesh-dict

@lucaeros lucaeros requested a review from eytanadler June 7, 2023 02:21
@eytanadler
Copy link
Collaborator

eytanadler commented Jun 19, 2023

Last thing, this one is easy. Could you update the version in the openaerostruct/__init__.py file to 2.6.2? Then I think this is ready

@lucaeros
Copy link
Contributor Author

Last thing, this one is easy. Could you update the version in the openaerostruct/__init__.py file to 2.6.2? Then I think this is ready

done

eytanadler
eytanadler previously approved these changes Jun 21, 2023
Copy link

@bernardopacini bernardopacini left a comment

Choose a reason for hiding this comment

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

This looks good to me, but what about the open item @eytanadler mentioned above? I agree that fixing it to a value and checking the result is a good idea.

@lucaeros
Copy link
Contributor Author

This looks good to me, but what about the open item @eytanadler mentioned above? I agree that fixing it to a value and checking the result is a good idea.

A test has been added to check if the chord_scaling_pos is set to 1, the Trailing edge should not move when using chord DV.

@lucaeros
Copy link
Contributor Author

This looks good to me, but what about the open item @eytanadler mentioned above? I agree that fixing it to a value and checking the result is a good idea.

A test has been added to check if the chord_scaling_pos is set to 1, the Trailing edge should not move when using chord DV.

Otherwise, the derivatives are check for any number of chord_scaling_pos

bernardopacini
bernardopacini previously approved these changes Jun 26, 2023
Copy link

@bernardopacini bernardopacini 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 test, that looks good to me.

@eytanadler
Copy link
Collaborator

One more change, but I can make this one. The new test @lucaeros added should be in its own function, not within an existing test method.

@eytanadler eytanadler dismissed stale reviews from bernardopacini and themself via 7a6191c June 26, 2023 15:24
@eytanadler eytanadler merged commit af05b30 into mdolab:main Jun 26, 2023
9 checks passed
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.

None yet

4 participants