Skip to content

new states for steady state - #40

Closed
pillowbeast wants to merge 5 commits into
mainfrom
SS-new-states
Closed

new states for steady state#40
pillowbeast wants to merge 5 commits into
mainfrom
SS-new-states

Conversation

@pillowbeast

@pillowbeast pillowbeast commented Feb 2, 2026

Copy link
Copy Markdown
Collaborator

More Steady States implemented
A: hanging
B: in contact
C: lying down

Summary by CodeRabbit

  • New Features

    • Steady-state evaluation now supports configurable touchdown modes: free-hanging, point contact, and in-contact (default).
  • Bug Fixes

    • Scenario updates always refresh touchdown state to ensure consistent evaluations after changes.
  • Tests

    • Added tests validating all touchdown mode configurations (duplicate test present).
  • Chores

    • Minor TODO comments added in layer-related code.

Copilot AI review requested due to automatic review settings February 2, 2026 16:42
@coderabbitai

coderabbitai Bot commented Feb 2, 2026

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@pillowbeast has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 11 minutes and 0 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📝 Walkthrough

Walkthrough

Adds a TouchdownMode type and a mode parameter to CriteriaEvaluator.evaluate_SteadyState, changes touchdown distance/segment initialization to branch by mode, makes slab-touchdown cache invalidation unconditional on scenario updates, and adds tests verifying mode propagation.

Changes

Cohort / File(s) Summary
Touchdown mode type
src/weac/core/slab_touchdown.py
Added TouchdownMode = Literal["A_free_hanging","B_point_contact","C_in_contact"] and updated SlabTouchdown.touchdown_mode annotation to use it.
Steady-state evaluation logic
src/weac/analysis/criteria_evaluator.py
Updated evaluate_SteadyState(...) signature to accept mode: TouchdownMode = "C_in_contact" and reworked touchdown distance initialization and segment construction to branch on the selected mode (C_in_contact, B_point_contact, A_free_hanging).
Scenario cache invalidation
src/weac/core/system_model.py
Changed update_scenario() to always call _invalidate_slab_touchdown(), removing the prior conditional guard.
Tests
tests/analysis/test_criteria_evaluator.py
Added tests exercising evaluate_SteadyState across the three modes and default behavior (note: duplicated test implementation appears twice).
Comments
src/weac/components/layer.py
Inserted three TODO comment lines; no behavioral changes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'new states for steady state' refers to the implementation of multiple steady states (A_free_hanging, B_point_contact, C_in_contact) with mode selection, which is the primary change in this changeset.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch SS-new-states

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.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/weac/analysis/criteria_evaluator.py (1)

684-707: 🧹 Nitpick | 🔵 Trivial

Document the new mode parameter in the docstring.

The mode parameter is not documented in the docstring. Add documentation explaining the three modes (A_free_hanging, B_point_contact, C_in_contact) and their effects on the steady state evaluation.

📝 Proposed documentation addition
     def evaluate_SteadyState(
         self,
         system: SystemModel,
         mode: TouchdownMode = "C_in_contact",
         vertical: bool = False,
         print_call_stats: bool = False,
     ) -> SteadyStateResult:
         """
         Evaluates the Touchdown Distance in the Steady State and the Steady State
         Energy Release Rate.

         Parameters:
         -----------
         system: SystemModel
             The system model.
+        mode: TouchdownMode, optional
+            The touchdown mode for steady state evaluation:
+            - "A_free_hanging": Slab is free hanging (not in contact with collapsed weak layer)
+            - "B_point_contact": End of slab is in contact with collapsed weak layer
+            - "C_in_contact": More of the slab is in contact with collapsed weak layer
+            Defaults to "C_in_contact".
         vertical: bool, optional
             Whether to evaluate the system in a vertical configuration.
             Defaults to False.
🤖 Fix all issues with AI agents
In `@src/weac/analysis/criteria_evaluator.py`:
- Around line 725-732: When computing cut_distance in criteria_evaluator.py
(within the match on mode where you set cut_distance for "C_in_contact",
"B_point_contact", and "A_free_hanging"), add validation to ensure the computed
value is strictly positive: after deriving cut_distance from
system_copy.slab_touchdown.l_BC or l_AB, check if cut_distance <= 0 and either
clamp it to a small positive minimum (e.g., 1e-6) or raise a clear ValueError
indicating the corresponding slab_touchdown length is too small; update any
calling code that expects a positive segment length accordingly and reference
the variables slab_touchdown.l_BC, slab_touchdown.l_AB, and the local
cut_distance when implementing the guard.

In `@src/weac/components/layer.py`:
- Around line 100-102: Update the vague TODO in src/weac/components/layer.py to
include concrete context: replace "tensile strength from Valle / Extrapolated
for higher densities (see Teams Chat)" with a short citation (author, year,
journal or DOI) for the "Valle" source, the actual extrapolation formula or a
succinct summary of the method and assumptions (e.g., functional form, density
range, units), and the author/date of the internal decision; if the formula or
data is too long, add a pointer to a tracked document or issue ID instead of
"Teams Chat" and mark any limits/uncertainties—this change should be made
adjacent to the existing TODO so the Layer-related logic in this module remains
self-contained and discoverable.

In `@tests/analysis/test_criteria_evaluator.py`:
- Around line 275-372: Replace the four near-duplicate tests with a single
parameterized test (e.g., test_evaluate_SteadyState_modes) that iterates test
cases for mode values and expected touchdown_mode, building the same
segments/SystemModel setup once per subtest and calling
evaluator.evaluate_SteadyState(system, mode=...) (omit the mode arg for the
default case); assert results.converged and that
results.system.slab_touchdown.touchdown_mode equals the expected value. Keep
references to the same constructors and symbols used now (Segment, SystemModel,
ModelInput, ScenarioConfig, Config, and evaluator.evaluate_SteadyState) and use
unittest.subTest or a small helper to preserve clear test output while removing
duplication.

Comment thread src/weac/analysis/criteria_evaluator.py
Comment thread src/weac/components/layer.py Outdated
Comment thread tests/analysis/test_criteria_evaluator.py Outdated

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

Implements additional steady-state touchdown “modes” and adds tests to validate selecting these modes during steady-state evaluation.

Changes:

  • Added a TouchdownMode type and updated SlabTouchdown annotations to use it.
  • Extended CriteriaEvaluator.evaluate_SteadyState() with a mode parameter and logic to drive the touchdown regime via cut_length.
  • Added unit tests for the new/explicit touchdown modes and the default mode behavior.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/analysis/test_criteria_evaluator.py Adds tests asserting that the steady-state evaluator selects the requested touchdown mode (and default).
src/weac/core/system_model.py Ensures slab_touchdown cache is invalidated on any scenario update (supports recomputation when steady-state changes scenario).
src/weac/core/slab_touchdown.py Introduces TouchdownMode alias and uses it in annotations/docs.
src/weac/components/layer.py Adds TODO comments about tensile strength extrapolation source.
src/weac/analysis/criteria_evaluator.py Adds mode parameter and mode-based cut-length selection for steady-state touchdown evaluation.

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

Comment thread src/weac/components/layer.py Outdated
Comment thread tests/analysis/test_criteria_evaluator.py Outdated
Comment thread src/weac/analysis/criteria_evaluator.py
Comment thread src/weac/analysis/criteria_evaluator.py
@pillowbeast pillowbeast closed this Feb 2, 2026
@pillowbeast
pillowbeast deleted the SS-new-states branch February 2, 2026 17:55
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