Skip to content

Fix warping constant (Cw) always returning 0 in cutwp.prop2 - #328

Open
NR-racond wants to merge 1 commit into
brookshsmith:masterfrom
NR-racond:fix/cutwp-warping-constant
Open

NR-racond wants to merge 1 commit into
brookshsmith:masterfrom
NR-racond:fix/cutwp-warping-constant

Conversation

@NR-racond

Copy link
Copy Markdown

Fixes #310
Fixes #313
Completes #128 (the remaining unit-warping part; the Ixy part was fixed in #299)

Problem

The unit-warping loop in pycufsm.pre.cutwp.prop2 read end_node from
ends[i, 0] instead of ends[i, 1], and searched/filled w_vals (already
complete from the shear-centre loop) instead of wo_vals. As a result wn
and Cw were always zero for every open section.

Fix

Follow the original MATLAB cutwp_prop2: use wo_vals throughout the second
loop and take end_node from ends[i, 1]. The shear centre, computed in the
first loop, is unchanged.

Tests

New tests in tests/test_cutwp.py (context_warping_constant):

  • plain channel against the closed form t b^3 h^2 (3b + 2h) / (12 (6b + h))
  • zed (non-zero Ixy) against t b^3 h^2 (b + 2h) / (12 (2b + h))
  • the normalised unit warping integrates to zero over the section
  • Cw does not depend on the element discretisation or element order

The three value checks fail on master and pass with this change.
The 8 x 2.5 x 0.075 in channel from #313 now gives Cw = 6.385870 in^6, as expected there.

Checks (pinned dev/test dependencies, numpy 2.2.6)

  • pylint ./pycufsm: 10.00/10
  • black --check .: passed
  • mypy: no issues
  • pytest --pspec tests/: 51 passed

The unit-warping loop read end_node from ends[i, 0] instead of ends[i, 1]
and searched/filled w_vals (already complete from the shear-centre loop)
instead of wo_vals, so wn and Cw were always zero for open sections.
Follow the original MATLAB cutwp_prop2 for this loop.

Add closed-form tests for a plain channel and a zed, plus checks that the
normalised unit warping integrates to zero and that Cw does not depend on
the element discretisation or order.

Fixes brookshsmith#310, fixes brookshsmith#313, completes brookshsmith#128.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J5kXckCFcbYjcpMjwYqbsU
@NR-racond

Copy link
Copy Markdown
Author

The failing check is test_e2e.py::…rack_post_Mz::it_results_in_correct_signature_curve, which is unrelated to this change: strip does not use Cw or wn, so the signature curve cannot be affected by this fix. All other 50 tests pass, including the new Cw tests, and pylint/black/mypy pass.

The same step already fails on #327 (a CI-only dependabot bump with no Python changes), while earlier runs passed. The differences are at long half-wavelengths (~1e-4), so this looks like a numerical sensitivity introduced by the runner image change (ubuntu-latest → Ubuntu 26, per the job notices) rather than a regression. Happy to help look into that test separately if useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant