# -*- coding: utf-8 -*- """`Result.shear_jump` returns the exact one-sided shear limits at x -- grid-independent and right even when x sits just before a support or point load (the old code reported the neighbouring grid node's post-jump value).""" import os import pytest from beamcalc import model, solve, statics HERE = os.path.dirname(__file__) JOB = os.path.join(HERE, '..', 'fixtures', 'rba5_16x22.json') EXTRA = [1.90, 1.92, 2.0, 2.04, 212.92, 213.0, 213.08] @pytest.fixture(scope='module') def job(): return model.load_job(JOB) @pytest.fixture(scope='module') def analysis(job): return solve.analyse(job, extra_stations_in=EXTRA) def _row(analysis, x_in): return next(r for r in analysis.strength if abs(r.x_in - x_in) < 1e-6) def test_strength_rows_see_the_overhang_side_before_a_support(analysis): # 1.92" is 0.08" before the left support centreline at 2.0": both # limits there are the small overhang shear, not the 44 kip span side. assert _row(analysis, 1.92).vu < 2.0 assert _row(analysis, 2.04).vu > 40.0 # right support at 213.0": 212.92" is span-side, 213.08" is overhang. assert _row(analysis, 212.92).vu > 18.0 assert _row(analysis, 213.08).vu < 1.0 def test_diagram_shear_jump_at_support(): a = solve.analyse(model.load_job(JOB), extra_stations_in=EXTRA) # The governing combo puts 44.1 kip on the span side of the left support. d = a.diagrams['1.2D + 1.6L + 0.5R [pattern 3]'] left, right = d.shear_jump(2.0) assert abs(left) < 2.0 assert abs(right) > 40.0 def test_diagram_shear_jump_is_continuous_off_loads(analysis): d = analysis.diagrams['1.4D'] left, right = d.shear_jump(100.0) # no load or support sits at 100.0 assert left == pytest.approx(right, abs=1e-9) assert left == pytest.approx(d.shear_at(100.0), abs=1e-6) def test_right_limit_at_a_node_is_the_stored_value(analysis): d = analysis.diagrams['1.2D + 1.6L + 0.5R [pattern 3]'] for x, v in zip(d.xs, d.shear): assert d.shear_jump(x)[1] == pytest.approx(v, abs=1e-9)