Skip to content

Fix Rotate partials when rotate_x is off - #471

Open
umutKaracelebi wants to merge 1 commit into
mdolab:mainfrom
umutKaracelebi:fix-rotate-partials-without-x-rotation
Open

umutKaracelebi wants to merge 1 commit into
mdolab:mainfrom
umutKaracelebi:fix-rotate-partials-without-x-rotation

Conversation

@umutKaracelebi

Copy link
Copy Markdown

Rotate.compute_partials only assigned the reference-axis dependence of the leading and trailing edge blocks of d(mesh)/d(in_mesh) inside the if rotate_x: branch, so with rotate_x=False those entries stayed zero while the finite-difference Jacobian is non-zero (up to 3.9e-2 in the test mesh). Any gradient-based optimization using this option got wrong mesh sensitivities.

The term does not depend on a rotation about x: the reference axis still moves the LE and TE points, so (I - R) * dq/d(mesh) belongs outside the branch. Only the dtheta_x contribution is now conditional. The del_n/nn2/nn3 indices are computed up front since they do not depend on rotate_x either.

Added test_rotate_without_x_rotation and its symmetry variant, which fail with a 1.0 relative error on mesh wrt in_mesh before the change. All existing rotate tests are unchanged.

python -m pytest tests -q --ignore-glob="*mphys*" -> 190 passed, 13 skipped (mphys tests skipped, mphys not installed).

Fixes #452

The reference axis dependence of the leading and trailing edge blocks of
d(mesh)/d(in_mesh) was only assigned inside the rotate_x branch, so with
rotate_x=False those entries stayed zero while the finite-difference
Jacobian is non-zero. Assign them regardless of rotate_x and add
regression tests for both symmetry settings.
@umutKaracelebi
umutKaracelebi requested a review from a team as a code owner November 19, 2026 23:58
@umutKaracelebi
umutKaracelebi requested review from sabakhshi and a balanced review from Copilot November 19, 2026 23:58

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

This branch has not been deployed

No deployments
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.

Partial derivatives bug in Rotate (twist) component when rotate_x = False

2 participants