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
53
tests/integration/test_ex1a_canti2d_eq.py
Normal file
53
tests/integration/test_ex1a_canti2d_eq.py
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
"""Integration test for the 2D elastic cantilever earthquake example."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
|
||||
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_ex1a_canti2d_eq_runs_and_oscillates(tmp_path) -> None: # type: ignore[no-untyped-def]
|
||||
from examples.ex1a_canti2d_eq import (
|
||||
ANALYSIS_DT,
|
||||
COLUMN_HEIGHT,
|
||||
build_ex1a_canti2d_eq,
|
||||
)
|
||||
|
||||
proj = build_ex1a_canti2d_eq()
|
||||
proj.validate_references()
|
||||
|
||||
path = tmp_path / "ex1a.osmodel"
|
||||
save_project(proj, path)
|
||||
reloaded = load_project(path)
|
||||
reloaded.validate_references()
|
||||
|
||||
results_dir = Path(tempfile.mkdtemp(prefix="ex1a_eq_"))
|
||||
result = OpenSeesRunner(reloaded).run(reloaded.analyses[1], results_dir=results_dir)
|
||||
|
||||
t = result.time()
|
||||
top = result.node_disp_history(2)
|
||||
ux = top[:, 0]
|
||||
uy = top[:, 1]
|
||||
|
||||
assert len(t) == reloaded.analyses[1].n_steps
|
||||
assert result.dt == pytest.approx(ANALYSIS_DT)
|
||||
assert t[-1] == pytest.approx(ANALYSIS_DT * reloaded.analyses[1].n_steps, abs=ANALYSIS_DT)
|
||||
|
||||
# Dynamic response should oscillate in both directions under the base motion.
|
||||
assert ux.max() > 0.01
|
||||
assert ux.min() < -0.01
|
||||
|
||||
# The elastic column should stay in a physically reasonable range.
|
||||
assert max(abs(ux)) < 0.10 * COLUMN_HEIGHT
|
||||
|
||||
# Gravity remains locked but the input is horizontal, so Uy should stay small.
|
||||
assert max(abs(uy)) < 1.0
|
||||
Loading…
Reference in a new issue