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

Fixing symmetry for right wings #381

Merged
merged 7 commits into from
Apr 6, 2022
Merged

Conversation

timryanb
Copy link
Contributor

Purpose

This PR addresses #244. Symmetric wings can now be used with the aerodynamics solver if they lie in the right side of the symmetry plane. Prior to this, OAS only gave correct results for left wings.

Expected time until merged

a 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

This fix can be tested by taking a standard left wing model and flipping the y nodes a shown below:

# Flip left wing to lie on right of symmetry plane
mesh[:, :ny, :] = inputs[mesh_name]
mesh[:, ny+1:, :] = inputs[mesh_name][:, ::-1, :]
mesh[:, ny+1:, 1] *= -1.

The new flipped surface can be passed to the aerodynamic component and should give a consistent solution to a left wing or full wing model.

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

@timryanb timryanb requested a review from a team as a code owner March 14, 2022 22:05
@codecov
Copy link

codecov bot commented Mar 14, 2022

Codecov Report

Merging #381 (b680a19) into main (4110247) will increase coverage by 0.01%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main     #381      +/-   ##
==========================================
+ Coverage   96.61%   96.63%   +0.01%     
==========================================
  Files          93       93              
  Lines        5912     5937      +25     
==========================================
+ Hits         5712     5737      +25     
  Misses        200      200              
Impacted Files Coverage Δ
aerodynamics/eval_mtx.py 100.00% <0.00%> (ø)
aerodynamics/vortex_mesh.py 99.28% <0.00%> (+0.09%) ⬆️

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

@ewu63 ewu63 requested review from kanekosh and removed request for ewu63 March 15, 2022 00:19
Copy link
Contributor

@kanekosh kanekosh left a comment

Choose a reason for hiding this comment

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

Thank you @timryanb! I added a few comments on the new regression tests.


prob.run_model()

assert_near_equal(prob["aero_point_0.wing_perf.CD"][0], 0.03487336411850356, 1e-6)
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of the hardcoded values, would you be able to do the following?

  1. Run the original left-wing case (duplicate of test_simple_rect_aero.py)
  2. Run the right-wing case
  3. Assert_near_equal between the left-wing results and right-wing results

I saw that the hardcoded values here are identical to test_simple_rect_aero.py, so my suggestion is equivalent to the current assert_equal. But I think it'd be safer to compare the left-wing and right-wing directly, in case we need to change the reference values in the future.
This will double the test time, but it should be fine for this small mesh case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should be addressed now


prob.run_driver()
# docs checkpoint 1
assert_near_equal(prob["aero_point_0.wing_perf.CD"][0], 0.033389699871650073, 1e-6)
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as I commented in test_simple_rect_right_aero.py: instead of the hardcoded values, would you be able to do the following?

  1. Run the original left-wing case (duplicate of test_aero_ground_effect.py)
  2. Run the right-wing case
  3. Assert_near_equal between the left-wing results and right-wing results

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should be addressed now

@timryanb timryanb requested a review from kanekosh April 4, 2022 19:27
kanekosh
kanekosh previously approved these changes Apr 4, 2022
Copy link
Contributor

@kanekosh kanekosh left a comment

Choose a reason for hiding this comment

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

Thank you @timryanb! I'll merge this PR after fixing black in a separate PR - they recently broke a thrid-party dependency and we need to version up black to fix that.

@ewu63 ewu63 requested a review from kanekosh April 6, 2022 16:12
@ewu63
Copy link
Collaborator

ewu63 commented Apr 6, 2022

Maybe we also want to bump the version and make a new release?

@kanekosh kanekosh merged commit d794fb8 into mdolab:main Apr 6, 2022
@timryanb timryanb deleted the fixing-right-wings branch April 7, 2022 17:20
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

3 participants