Skip to content

Fix radian input in Polar.correction3D - #87

Merged
rthedin merged 4 commits into
OpenFAST:mainfrom
maoji-y:fix/polar-correction-radians
Nov 18, 2026
Merged

rthedin merged 4 commits into
OpenFAST:mainfrom
maoji-y:fix/polar-correction-radians

Conversation

@maoji-y

@maoji-y maoji-y commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

Fixes #22.

Polar.correction3D() raises UnboundLocalError for a polar stored in radians. Use radians for the calculation throughout, including the inferred lift slope and stall angle. Explicit fit limits and the returned angle array remain in degrees, as before.

The new regression test uses the existing FFA-W3-241 polar to compare lift and drag for equivalent degree and radian inputs. It covers default blending, Heaviside blending, and a user-supplied fit range. Thanks to the issue reporter for identifying the unit conversions.

Validation on Windows with Python 3.13: all 10 airfoil tests passed. The full suite had 91 passes and one failure in linearization/tests/test_modesID.py::Test::test_HD. The same failure occurred on unmodified main (90 passes). git diff --check passed.

AI disclosure: Codex assisted with implementation and tests.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues were identified for the degree/radian consistency fix.

No open issues 🎉

What changed in this PR

Fixes issue #22 by making Polar.correction3D() handle equivalent degree and radian inputs consistently, while preserving degree-based explicit fit limits and output angles.

Changes:

  • Uses radians consistently for internal calculations, including inferred lift slope and stall angle.
  • Validates that optional fit limits are supplied together and documents output angle units.
  • Adds regression coverage comparing lift and drag for degree and radian inputs across default blending, Heaviside blending, and explicit fit limits.
File Description
openfast_toolbox/​airfoils/​tests/​test_polar_manip.py Adds degree/radian equivalence regression tests.
openfast_toolbox/​airfoils/​Polar.py Corrects internal angle conversions, validates fit limits, and clarifies output units.

Review effort: Balanced

@ptrbortolotti

Copy link
Copy Markdown
Collaborator

@rthedin please feel free to merge this in

@rthedin

rthedin commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator

Thanks for finding and fixing this.

@rthedin
rthedin merged commit d986c9a into OpenFAST:main Nov 18, 2026
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.

Inconsistent output for correction3D() method when self._radians == True vs. False

4 participants