Skip to content

Minor/fixes - #52

Merged
pillowbeast merged 4 commits into
mainfrom
minor/fixes
May 21, 2026
Merged

Minor/fixes#52
pillowbeast merged 4 commits into
mainfrom
minor/fixes

Conversation

@pillowbeast

@pillowbeast pillowbeast commented May 21, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • Bug Fixes

    • Improved slab tensile criterion calculation with directional propagation logic for low-density level assessment.
  • Documentation

    • Clarified configuration parameter documentation regarding weak-snow handling and weak-layer behavior.
  • Tests

    • Added test coverage for energy release rate calculations.
    • Enhanced test suite to verify directional assessment logic in stability analysis.
    • Updated stress calculation test expectations.

Review Change Stack

pillowbeast and others added 4 commits April 27, 2026 20:46
- Bugfix tau sign
- Updated the slab tensile criterion calculation to conditionally exclude low-density layers based on downward failure growth.
- Improved docstrings for clarity on low-density threshold behavior.
- Added tests to verify the correct application of the updated tensile criterion logic.
- Adjusted comparison cases in tests for consistency with new logic.
- Bugfix tau sign
- Updated the slab tensile criterion calculation to conditionally exclude low-density layers based on downward failure growth.
- Improved docstrings for clarity on low-density threshold behavior.
- Added tests to verify the correct application of the updated tensile criterion logic.
- Adjusted comparison cases in tests for consistency with new logic.
Copilot AI review requested due to automatic review settings May 21, 2026 13:23
@coderabbitai

coderabbitai Bot commented May 21, 2026

Copy link
Copy Markdown
Contributor

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

This PR refines weak-layer and slab mechanics computations through sign corrections to shear-stress formulas, introduces directional low-density propagation logic into slab tensile criterion evaluation, updates supporting docstrings, adds an energy-release-rate integrand validation test, and reorganizes project priorities in the TODO list.

Changes

Weak-layer mechanics and slab tensile criterion refinements

Layer / File(s) Summary
Weak-layer shear stress formula correction
src/weac/core/field_quantities.py, tests/core/test_field_quantities.py
tau() computation adjusted to kt * h * (dw_dx/2 - u(h=H/2)/h) with sign convention update; gamma() docstring reformatted; test expectation updated to reflect new sign.
Slab tensile criterion directional propagation
src/weac/analysis/criteria_evaluator.py, src/weac/components/criteria_config.py
_calculate_maximal_stresses implements top-down failure-prone propagation: low-density levels contribute only if all higher levels are tensile-failure-prone; criterion averages over load-bearing levels, defaulting to 1.0 if none exist. Docstrings clarify conditional exclusion behavior.
Slab tensile criterion test coverage
tests/analysis/test_criteria_evaluator.py, tests/analysis/test_slab_tensile_comparisons.py
New test verifies directional low-density exclusion by mocking stress fields and asserting slab_tensile_criterion transitions from 1/2 to 1/4 across "top broken"/"top unbroken" scenarios. Comparison test cases reordered (case_2, case_9) and extended with case_10.
Energy release rate integrand validation
tests/analysis/test_analyzer.py
New test constructs SystemModel/Analyzer, defines constant solution, evaluates Mode I and Mode II integrands, and asserts all returned values are non-negative.
Documentation and project management
src/weac/analysis/criteria_evaluator.py, TODO.md
evaluate_SteadyState docstring documents three TouchdownMode options and interpretations. TODO.md elevates boundary-type and system-condition tasks to Major section, adds pipeline/attribute and uncertainty-propagation items, reduces Minor to single Pytest migration task.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • 2phi/weac#34: Both PRs modify src/weac/analysis/criteria_evaluator.py's maximal-stress/steady-state computation path (main PR introduces directional low-density propagation logic in _calculate_maximal_stresses, while retrieved PR restructures related result types).
  • 2phi/weac#48: Both PRs modify _calculate_maximal_stresses logic for slab_tensile_criterion computation by incorporating low-density handling with directional/threshold-based propagation rules.
  • 2phi/weac#38: Both PRs update slab_tensile_criterion computation in _calculate_maximal_stresses to include directional/height-level low-density logic.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Minor/fixes' is vague and generic, providing no meaningful information about the substantial changes in the pull request. Use a descriptive title that reflects the main changes, such as 'Refactor slab tensile criterion calculation with directional low-density propagation' or similar.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 92.86% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch minor/fixes

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@pillowbeast
pillowbeast merged commit 2e4b0f3 into main May 21, 2026
5 of 6 checks passed
@pillowbeast
pillowbeast deleted the minor/fixes branch May 21, 2026 13:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adjusts weak-layer shear stress sign/definition and refines how the slab tensile criterion treats low-density (“weak snow”) layers, with corresponding test updates and a few TODO additions.

Changes:

  • Update weak-layer shear stress (FieldQuantities.tau) formula/sign and align dependent unit tests.
  • Change the slab tensile criterion so low-density layers are excluded only after being “broken through” by downward failure growth; update config docs and add/adjust regression tests.
  • Add a small Analyzer regression test around non-negative ERR integrands.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
TODO.md Adds a few new major/minor TODO items.
tests/core/test_field_quantities.py Updates expected weak-layer shear stress sign in tests.
tests/analysis/test_slab_tensile_comparisons.py Adjusts comparison cases and adds an additional case to reflect new tensile-criterion behavior.
tests/analysis/test_criteria_evaluator.py Updates the low-density threshold test to reflect directional exclusion logic.
tests/analysis/test_analyzer.py Adds a regression test asserting non-negative ERR integrands for consistent stress/strain inputs.
src/weac/core/field_quantities.py Updates weak-layer shear stress (tau) and related docstrings.
src/weac/components/criteria_config.py Updates documentation for conditional low-density handling in the slab tensile criterion.
src/weac/analysis/criteria_evaluator.py Implements directional low-density exclusion in _calculate_maximal_stresses and expands evaluate_SteadyState docstring.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

u_surface = self.fq.u(self.Z, h0=H / 2)

expected = -self.fq.es.weak_layer.kt * (self.Z[3, :] * h / 2 - u_surface)
expected = self.fq.es.weak_layer.kt * (self.Z[3, :] * h / 2 - u_surface)
Comment on lines 50 to +54
Order of magnitude for stress envelope. Default is 1.0.
low_density_threshold_kg_m3 : float
Slab density threshold in kg/m^3 below which a layer is treated as weak snow
and counted as prone to tensile failure in the slab tensile criterion.
and excluded from the slab tensile criterion percentage when broken through
directional growth from above.
Comment thread TODO.md
## Major

- [ ] Layer & Slab using pipelines from Mary-Kate + Attributes (value, calculated [bool], pipeline, uncertainty)
- [ ] Uncertainties propagation
Comment thread TODO.md

## Minor

- [ ] Swap to Pytest from Unittest
Comment thread TODO.md

## Minor

- [ ] Swap to Pytest from Unittest
Comment on lines 109 to 113
def tau(self, Z: np.ndarray, unit: StressUnit = "MPa") -> float | np.ndarray:
"""Weak-layer shear stress `tau = -kt * (w' * h/2 - u(h=H/2))`"""
"""Weak-layer shear stress `tau = kt * h * (w' / 2 - u(h=H/2) / h)`"""
return (
-self._unit_factor(unit)
self._unit_factor(unit)
* self.es.weak_layer.kt
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.

2 participants