OpenAeroStruct icon indicating copy to clipboard operation
OpenAeroStruct copied to clipboard

Fixed viscous drag, moment coeff, and sectional CL bugs

Open kanekosh opened this issue 2 years ago • 2 comments

Purpose

  • Fixed bugs in viscous drag, moment coefficient, and sectional CL computation
  • Renamed variables name: cos_sweep -> widths; widths -> lengths_spanwise.
  • Patch version increment

The variable widths was used for the length of the quarter chord line for each panel. This is identical to the spanwise width of panels when the sweep is 0, but the widths is stretched diagonally when the wing is swept. Besides, the cos_sweep variable was used for the spanwise width, which is confusing.

With this PR, the widths variable is now indeed the spanwise width of each panel (which isn't changed by sweep), and the quarter chord line length is now named lengths_spanwise.

Because of these confusing namings, we had bugs in viscous drag comp, moment coeff comp, and sectional CL comp. In these components, the computed panel area was larger than the actual area. This PR fixes the bug and closes #395 The wave drag component was correct, and only the variable names were changed there.

This bugfix changes the drag outputs of all analyses/optimizations with swept wing and all CM outputs. I updated the test reference values accordingly.

Expected time until merged

A few days

Type of change

  • [x] 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)
  • [x] Refactoring (no functional changes, no API changes)
  • [ ] Documentation update
  • [ ] Maintenance update
  • [ ] Other (please describe)

Testing

Checklist

  • [x] I have run flake8 and black to make sure the code adheres to PEP-8 and is consistently formatted
  • [x] 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

NOTE: I changed the reference values for swept wing cases and moment coefficients. All the other tests passed without updating the ref values.

kanekosh avatar Aug 11 '22 15:08 kanekosh

Codecov Report

Merging #397 (ee0b31c) into main (3ae9871) will decrease coverage by 0.01%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #397      +/-   ##
==========================================
- Coverage   96.63%   96.62%   -0.02%     
==========================================
  Files          93       93              
  Lines        6009     6009              
==========================================
- Hits         5807     5806       -1     
- Misses        202      203       +1     
Impacted Files Coverage Δ
openaerostruct/aerodynamics/functionals.py 100.00% <ø> (ø)
openaerostruct/__init__.py 100.00% <100.00%> (ø)
openaerostruct/aerodynamics/aero_groups.py 100.00% <100.00%> (ø)
openaerostruct/aerodynamics/geometry.py 100.00% <100.00%> (ø)
openaerostruct/aerodynamics/lift_coeff_2D.py 100.00% <100.00%> (ø)
openaerostruct/aerodynamics/viscous_drag.py 89.39% <100.00%> (ø)
openaerostruct/aerodynamics/wave_drag.py 98.85% <100.00%> (-1.15%) :arrow_down:
openaerostruct/integration/aerostruct_groups.py 97.48% <100.00%> (ø)

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

codecov[bot] avatar Aug 12 '22 18:08 codecov[bot]

Ready for review now

kanekosh avatar Aug 12 '22 18:08 kanekosh