def test_center_load():
    P = 100
    M_max = ((P * L) / 4)
    S_max = (P / 2)
    w_max = (((- P) * (L ** 3)) / ((48 * E) * I))
    tolerance = 1e-06
    s = Structure('test')
    s.add_beam(coord=[0, L], E=E, I=I)
    s.add_nodal_load(P, (L / 2), 'fz')
    s.add_nodal_support({'uz': 0, 'ur': 'NaN'}, 0)
    s.add_nodal_support({'uz': 0, 'ur': 'NaN'}, L)
    s.add_nodes(25)
    s.add_elements(s.nodes)
    s.solve(s.build_global_matrix(), s.build_load_vector(), s.get_boudary_conditions())
    assert (min(s.get_displacements()['vertical_displacements']) == pytest.approx(w_max, rel=tolerance))
    assert (max(s.get_bending_moments()['values']) == pytest.approx(M_max, rel=tolerance))
    assert (max(s.get_shear_forces()['values']) == pytest.approx(S_max, rel=tolerance))
def test_center_load():
    P = 100
    M_max = ((P * L) / 4)
    S_max = (P / 2)
    w_max = (((- P) * (L ** 3)) / ((48 * E) * I))
    tolerance = 1e-06
    s = Structure('test')
    s.add_beam(coord=[0, L], E=E, I=I)
    s.add_nodal_load(P, (L / 2), 'fz')
    s.add_nodal_support({'uz': 0, 'ur': 'NaN'}, 0)
    s.add_nodal_support({'uz': 0, 'ur': 'NaN'}, L)
    s.add_nodes(25)
    s.add_elements(s.nodes)
    s.solve(s.build_global_matrix(), s.build_load_vector(), s.get_boudary_conditions())
    assert (min(s.get_displacements()['vertical_displacements']) == pytest.approx(w_max, rel=tolerance))
    assert (max(s.get_bending_moments()['values']) == pytest.approx(M_max, rel=tolerance))
    assert (max(s.get_shear_forces()['values']) == pytest.approx(S_max, rel=tolerance))