Fix product of inertia (Ixy) weighting in cutwp.prop2 (part of #128)#299
Open
gaoflow wants to merge 1 commit into
Open
Fix product of inertia (Ixy) weighting in cutwp.prop2 (part of #128)#299gaoflow wants to merge 1 commit into
gaoflow wants to merge 1 commit into
Conversation
The element's own contribution to the product of inertia, x_diff*y_diff/12, was left outside the '* lengths * thicknesses' factor due to a misplaced parenthesis, so only the parallel-axis term was weighted by the element area. This gave an incorrect Ixy (and hence principal angle / I11 / I22) for sections with inclined elements; axis-aligned elements were unaffected because their x_diff*y_diff term is zero. Move the closing parenthesis so the whole bracket is weighted by lengths * thicknesses, matching how Ixx and Iyy are formed. Verified against an independent thin-walled formula and direct numerical integration; the fixed Ixy matches both. Part of brookshsmith#128.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
In
cutwp.prop2, the product of inertiaIxyis computed with a misplaced closing parenthesis:Compare with how
IxxandIyyare formed just above:For
Ixx/Iyythe* lengths * thicknessesfactor multiplies the whole bracket (the element's own second momentd²/12plus the parallel-axis term). ForIxythe parenthesis closes too late, so* lengths * thicknessesonly multiplies the parallel-axis term and the element's own contributionx_diffs * y_diffs / 12is left unweighted by the element area.The result is an incorrect
Ixy(and therefore an incorrect principal anglephiand principal momentsI11/I22) for any section containing inclined elements. Sections whose elements are all axis-aligned are unaffected, because thenx_diffs * y_diffsis zero for every element — which is likely why this went unnoticed.This is one of the two issues reported in #128.
Fix
Move the closing parenthesis so the full bracket is weighted by
lengths * thicknesses, consistent withIxx/Iyy:Verification
For a small section with an inclined element (so the
x_diffs * y_diffs / 12term is non-zero):The fixed value matches both an independent thin-walled product-of-inertia formula and direct numerical integration of
(x - xc)(y - yc)along the elements (agreement to ~1e-9). The rotation invariantIxx + Iyy == I11 + I22continues to hold, and a section symmetric about an axis still yieldsIxy == 0.Added
tests/test_cutwp.pywith these checks; the inclined-element test fails onmasterand passes with this change. The rest of the suite is unchanged (the one pre-existingit_results_in_correct_signature_curvefailure fails identically before and after this change).Note
#128 mentions two problems in
prop2. This PR addresses the product-of-inertia one, which is self-contained and straightforward to verify. The other appears to be in the shear-center/unit-warping loop (the warping constant path) and needs separate, carefully validated treatment, so I've kept it out of this change rather than ship a partial fix there.