new states for steady state - #40
Conversation
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the 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. 📝 WalkthroughWalkthroughAdds 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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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 | 🔵 TrivialDocument the new
modeparameter in the docstring.The
modeparameter 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.
There was a problem hiding this comment.
Pull request overview
Implements additional steady-state touchdown “modes” and adds tests to validate selecting these modes during steady-state evaluation.
Changes:
- Added a
TouchdownModetype and updatedSlabTouchdownannotations to use it. - Extended
CriteriaEvaluator.evaluate_SteadyState()with amodeparameter and logic to drive the touchdown regime viacut_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.
More Steady States implemented
A: hanging
B: in contact
C: lying down
Summary by CodeRabbit
New Features
Bug Fixes
Tests
Chores