feat: named case-result load combinations with full GUI support
Snapshots the current development tree, headlined by proper load combinations (user request): a reusable LoadCombination entity of weighted completed static-case results (e.g. 1.2xDead + 1.6xLive). - core: LoadCombination/LoadCombinationItem entities, Project integration (lookup, unique ids, reference validation) - services: combinations.py (linear superposition + envelope), exported via services __init__ - commands: undoable Add/Delete/Update for combinations - GUI: Load Combinations manager dialog, Run-dialog evaluation, envelope display in Results panel, Combinations tab in Table dock - tests: unit coverage (validation, math, error paths) + integration superposition check vs a single factored run
This commit is contained in:
commit
f361fee969
560 changed files with 178701 additions and 0 deletions
72
tests/integration/test_rc_frame_pushover.py
Normal file
72
tests/integration/test_rc_frame_pushover.py
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
"""Integration test for RC Frame Pushover example (OpenSees Ex 3.2)."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
pytest.importorskip("openseespy")
|
||||
|
||||
from otko.services import load_project, save_project # noqa: E402
|
||||
from otko.services.opensees_runner import OpenSeesRunner # noqa: E402
|
||||
|
||||
pytestmark = pytest.mark.slow
|
||||
|
||||
|
||||
def test_rc_frame_pushover_reaches_target_with_fallback(tmp_path) -> None: # type: ignore[no-untyped-def]
|
||||
"""The 15-in pushover requires the ModifiedNewton convergence
|
||||
fallback to finish; without it the Newton solver stalls in the
|
||||
softening regime. This test asserts the full curve is produced
|
||||
AND shows expected nonlinear shape.
|
||||
"""
|
||||
from examples.rc_frame_pushover import (
|
||||
build_rc_frame_pushover,
|
||||
D_STEP,
|
||||
D_TARGET,
|
||||
)
|
||||
from otko.core import PushoverCase
|
||||
|
||||
proj = build_rc_frame_pushover()
|
||||
proj.validate_references()
|
||||
|
||||
path = tmp_path / "rc_push.osmodel"
|
||||
save_project(proj, path)
|
||||
reloaded = load_project(path)
|
||||
reloaded.validate_references()
|
||||
|
||||
# Pushover is one of several cases now (preload + pushover) — pick
|
||||
# by type instead of index.
|
||||
push_case = next(c for c in reloaded.analyses if isinstance(c, PushoverCase))
|
||||
result = OpenSeesRunner(reloaded).run(push_case)
|
||||
|
||||
expected_pts = int(D_TARGET / D_STEP) + 1 # 151 including step 0
|
||||
assert len(result.control_disp) == expected_pts, (
|
||||
f"Got {len(result.control_disp)} points, expected {expected_pts} — "
|
||||
"ModifiedNewton fallback probably didn't kick in."
|
||||
)
|
||||
# Reached the target displacement.
|
||||
assert result.control_disp[-1] == pytest.approx(D_TARGET, rel=1e-3)
|
||||
|
||||
# Curve shape: monotonic climb followed by near-plateau (yielding).
|
||||
# The elastic slope should exceed the post-yield slope by > 4x.
|
||||
early_slope = (result.base_shear[10] - result.base_shear[0]) / (
|
||||
result.control_disp[10] - result.control_disp[0]
|
||||
)
|
||||
late_slope = (result.base_shear[-1] - result.base_shear[-20]) / (
|
||||
result.control_disp[-1] - result.control_disp[-20]
|
||||
)
|
||||
assert early_slope > 4 * late_slope, (
|
||||
f"Early slope {early_slope:.2f} not >> late slope {late_slope:.2f} — "
|
||||
"no yielding visible in the curve."
|
||||
)
|
||||
|
||||
# Peak base shear in a reasonable band for this frame — 150-250 kip.
|
||||
peak = max(abs(result.base_shear))
|
||||
assert 100.0 < peak < 300.0, f"Peak base shear {peak:.1f} kip out of band"
|
||||
|
||||
# Gravity preload stayed applied — column axial force at the start
|
||||
# of the pushover (step 1) should be close to P = 180 kip.
|
||||
step1_col1 = result.element_forces[1][1]
|
||||
axial_step1 = abs(step1_col1[0])
|
||||
assert (
|
||||
100.0 < axial_step1 < 260.0
|
||||
), f"Col 1 axial at step 1 = {axial_step1:.1f} kip — gravity preload lost?"
|
||||
Loading…
Reference in a new issue