-
Notifications
You must be signed in to change notification settings - Fork 119
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
Conversation
Codecov Report
@@ Coverage Diff @@
## main #410 +/- ##
=======================================
Coverage ? 94.51%
=======================================
Files ? 103
Lines ? 6420
Branches ? 0
=======================================
Hits ? 6068
Misses ? 352
Partials ? 0
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Thanks Lucas! Could you add a quick documentation about this new feature in the geometry manipulation and surface dict entries pages? |
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.
Thanks for the contributions! In addition to the code comments I added, please also do the following:
- Add this new feature to the rectangular wing chord optimization example here.
- Add a
"chord_scaling_pos"
entry to the surface dictionary in this test to test that your change works. - Add another test for
ScaleX
in this file that checks the partials and confirms that the chord values have changed as you expect.
@@ -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"] |
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 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.
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.
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") |
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.
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) |
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.
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
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.
Is this still an open item?
|
Last thing, this one is easy. Could you update the version in the |
done |
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 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 |
Otherwise, the derivatives are check for any number of |
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.
Thanks for adding the test, that looks good to me.
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. |
Purpose
Scaling position at quarter chord :
Scaling position at trailing edge :
Expected time until merged
Type of change
Testing
Checklist
flake8
andblack
to make sure the Python code adheres to PEP-8 and is consistently formattedfprettify
or C/C++ code withclang-format
as applicable