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

Precise thickness and volume constraints for non-trapezoidal wings #127

Merged
merged 5 commits into from
Mar 24, 2022

Conversation

sseraj
Copy link
Collaborator

@sseraj sseraj commented Mar 23, 2022

Purpose

For non-trapezoidal wings, we use leList and teList with length greater than 2 to define the locations between the root and tip. However, the points currently used in the thickness and volume constraints do not exactly match these intermediate locations. This is documented behavior in DVCon.

As an alternative, I added the option to pass a list for nSpan instead of an integer. Doing so will interpolate within each segment defined by leList and teList and match the intermediate locations. The behavior is unchanged if an integer is passed. I included an example of a cranked arrow wing below.

Thickness constraints with nSpan=10:
thickness_before

Thickness constraints with nSpan=[5, 5]:
thickness_after

The constraints now match the wing break location and follow the chordwise direction.

Expected time until merged

One 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

I added tests for thickness and volume constraints with a list for nSpan.

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

@sseraj sseraj requested a review from a team as a code owner March 23, 2022 17:31
@sseraj sseraj requested review from marcomangano and anilyil March 23, 2022 17:31
@codecov
Copy link

codecov bot commented Mar 23, 2022

Codecov Report

Merging #127 (2d6d671) into main (2fb4fcf) will increase coverage by 0.04%.
The diff coverage is 90.32%.

@@            Coverage Diff             @@
##             main     #127      +/-   ##
==========================================
+ Coverage   62.56%   62.60%   +0.04%     
==========================================
  Files          43       43              
  Lines       11186    11207      +21     
==========================================
+ Hits         6998     7016      +18     
- Misses       4188     4191       +3     
Impacted Files Coverage Δ
pygeo/constraints/DVCon.py 70.83% <90.32%> (+0.47%) ⬆️

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

marcomangano
marcomangano previously approved these changes Mar 23, 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.

Looks good! I just have one comment on the inputs, but it's not related to the specific additions of this PR

pygeo/constraints/DVCon.py Show resolved Hide resolved
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.

The changes look good. I only have one minor comment on the coding style regarding the different uses of the nSpan variable. I left it to one of the routines you added but obviously applies to both. Let me know what you think and we can either slightly modify it or I can just approve it if you don't want to make that change.

)

# nSpan needs to be the total number of sections for the remainder of the function
nSpan = sum(nSpan)
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure if I like this change to what nSpan is mid-way through the routine. Initially its the list of spanwise section counts, but then it is switched to the total count. I guess it would be a bit better if we used a different variable for the total (or the span list)? I am not sure how useful my comment is but thought this type of using the same variable name for two things might be confusing?

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 agree that the current approach is not very clean. I can propose two alternatives that would keep nSpan as an integer:

  1. Add a separate kwarg that is a list defining the fraction of nSpan that gets allocated to each segment, e.g. [0.5, 0.5].
  2. Don't add any additional arguments. For a given uniform distribution in parametric space, 'snap' the closest point to the intermediate location and resample the curves. This would change the default behavior.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Turns out Anil was referring to the variable names in the function, not the API. I will update the variable names to be clearer.

@anilyil anilyil requested a review from marcomangano March 24, 2022 21:14
@marcomangano marcomangano merged commit 5057ede into main Mar 24, 2022
@marcomangano marcomangano deleted the wing-break branch March 24, 2022 21:45
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