Skip to content

Fix Newman-Raju G22 term in surface crack SIF for a > c - #4531

Open
dallonby wants to merge 1 commit into
ukaea:mainfrom
dallonby:fix/cs-fatigue-newman-raju-g22
Open

Fix Newman-Raju G22 term in surface crack SIF for a > c#4531
dallonby wants to merge 1 commit into
ukaea:mainfrom
dallonby:fix/cs-fatigue-newman-raju-g22

Conversation

@dallonby

Copy link
Copy Markdown
Contributor

Closes #4530

Overview

One-token fix in process/models/cs_fatigue.py: the a > c branch of surface_stress_intensity_factor computed G22 as 0.14e0 * c_a * 1.5e0 where the Newman-Raju equation (and the a <= c branch) requires 0.14e0 * c_a**1.5e0.

Changes

  • process/models/cs_fatigue.py: *** in the G22 term.
  • tests/unit/models/test_cs_fatigue.py: add two a > c parametrised cases (phi = pi/2 and phi = 0) to test_surface_stress_intensity_factor, with expected K values computed independently from the Newman-Raju equations (derivation in the test comment). The a > c branch previously had zero test coverage.

Notes for reviewers

  • No output changes: bending_stress is hardcoded to 0 inside the function, so H2 (which contains G22) never reaches the returned K today — the existing golden values are untouched and regression outputs are unaffected. The fix removes a landmine for whenever bending is parameterised.
  • If there is interest, a follow-up could lift bending_stress to a parameter (default 0) so H1/H2 become testable directly.
  • Unit suite passes locally (Python 3.12).

Found during an independent audit of v3.4.2.

🤖 Generated with Claude Code

The a > c branch of surface_stress_intensity_factor computed the G22
coefficient as 0.14*(c/a)*1.5 where the published Newman-Raju equation
(and the sibling a <= c branch) uses 0.14*(c/a)**1.5 — multiplication
in place of exponentiation.

Currently benign in outputs because bending_stress is hardcoded to zero
so H2 never enters the stress intensity factor, but wrong the moment
bending is enabled. Also adds the previously-missing test coverage of
the a > c branch, with expected K values computed independently from
the Newman-Raju equations (the existing tests only exercised a < c at
phi = pi/2).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@dallonby
dallonby requested a review from a team as a code owner August 15, 2026 13:42
@je-cook
je-cook requested a review from a team August 17, 2026 08:09
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 49.32%. Comparing base (c0ae5b2) to head (e7aa2d4).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4531   +/-   ##
=======================================
  Coverage   49.32%   49.32%           
=======================================
  Files         150      150           
  Lines       29802    29802           
=======================================
  Hits        14700    14700           
  Misses      15102    15102           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

Newman-Raju G22 term wrong in surface-crack SIF for a > c: multiplication instead of exponentiation

2 participants