def test_nodal_displacements_12(self): # same as _11, but the beams are rotated 60 degree clockwise # assertion #1: single Axial force on Node 2, the element is rotated, so are the loads. # but then at the end the resulting displacements are rotated back and we get the same results as in test _1 # structure #1: 3 elements in a row along the global X axis _ux = 0.5 # unit in x direction; instead of 1 as unit we have cos(60) to account for the rotation _uy = -math.sqrt( 3 ) / 2. # unit in x direction; instead of 1 as unit we have cos(60) to account for the rotation n1 = Node.Node(ID=1, coords=(0, 0)) n2 = Node.Node(ID=2, coords=(100 * _ux, 100 * _uy)) n3 = Node.Node(ID=3, coords=(200 * _ux, 200 * _uy)) n4 = Node.Node(ID=4, coords=(300 * _ux, 300 * _uy)) # definition of the beams is unchanged b1 = HB.HermitianBeam2D(E=210000., ID=1, I=833.33, A=100., i=n1, j=n2) b2 = HB.HermitianBeam2D(E=210000., ID=2, I=833.33, A=100., i=n2, j=n3) b3 = HB.HermitianBeam2D(E=210000., ID=3, I=833.33, A=100., i=n3, j=n4) structure = Structure.Structure(beams=[b1, b2, b3], supports={1: ['ux', 'uy', 'rotz']}) # two loads instead of one as these are in the global system structure.add_single_dynam_to_node(nodeID=4, dynam={'FX': _ux}, clear=True) structure.add_single_dynam_to_node(nodeID=4, dynam={'FY': _uy}) # since the elements were previously rotated by -60 degrees, now we rotate the results by 60 degrees back... T = HB.transfer_matrix(60, asdegree=True, blocks=len(structure.nodes)) structure.solver['linear static'].solve() disps = structure.results['linear static'].global_displacements( asvector=True) disps = T * disps _expected = np.matrix([ [0.0], [0.0], [0.0], [4.76190476e-06], # same as in _1 [0.00000000e+00], [0.00000000e+00], [9.52380952e-06], [0.00000000e+00], [0.00000000e+00], [1.42857143e-05], [0.00000000e+00], [0.00000000e+00] ]) self.assertTrue(np.allclose(disps, _expected, atol=ATOL))
def setUpClass(cls): _nodes = {1: Node.Node(ID=1, coords=(0, 0)), 2: Node.Node(ID=2, coords=(0, 2000)), 3: Node.Node(ID=3, coords=(2000, 4000)), 4: Node.Node(ID=4, coords=(5000, 4000)), 5: Node.Node(ID=5, coords=(5000, 3000)), 6: Node.Node(ID=6, coords=(5000, 2000)), 7: Node.Node(ID=7, coords=(5000, 1000)), 8: Node.Node(ID=8, coords=(5000, 0)), 9: Node.Node(ID=9, coords=(5000, -1000)), } mat = Material.Steel() s1 = sections.Rectangle(height=100, width=100) # section s2 = sections.Rectangle(height=200, width=200) # section _sections = [s1, s1, s2, s1, s1, s1, s1, s1] _beams = [HB.HermitianBeam2D(ID=x+1, E=mat.E, rho=mat.rho, I=_sections[x].I.x, A=_sections[x].A, i=_nodes[y], j=_nodes[y+1]) for x, y in zip(range(8), range(1, len(_nodes.keys())))] _supports = {1: ['ux', 'uy'], 9: ['ux', 'uy'], } cls.structure = Structure.Structure(beams=_beams, supports=_supports) # adding nodal loads cls.structure.clear_loads() cls.structure.add_nodal_load(nodeID=3, dynam={'FX': 1000, 'FY': 500}, clear=True) cls.structure.add_nodal_load(nodeID=5, dynam={'FX': -1500}) # internal loads b = cls.structure.beams[1] cls.structure.add_internal_loads(beam=b, loadtype='uniform perpendicular force', value=2.0)
def test_FY_load_rotated(self): # tests a clamped beam for vertical load at the tip import random P = random.randrange(1, 200) L = self.beam3.l EI = self.beam3.EI _t = HB.transfer_matrix(alpha=self.rotation_angle, asdegree=False, blocks=1, blocksize=2) _load = _t * np.matrix([[0, P]]).T self.beam_as_structure_2.add_single_dynam_to_node(nodeID=2, dynam={ 'FX': _load[0], 'FY': _load[1] }, clear=True) self.beam_as_structure_2.solver['linear static'].solve() disps = self.beam_as_structure_2.results[ 'linear static'].element_displacements( local=True, beam=self.beam_as_structure_2.beams[0], asvector=True) _expected = np.matrix([ [0.0], [0.0], [0.0], [0.0], [(P * L**3) / (3 * EI)], # vertical displacement at the end [(P * L**2) / (2 * EI)] ]) # rotation at the end self.assertTrue(np.allclose(disps, _expected, atol=ATOL))
def setUpClass(cls): cls.EE = 1. cls.nodeset_1 = { 1: Node.Node(ID=1, coords=(0, 0)), 2: Node.Node(ID=2, coords=(1, 0)), 3: Node.Node(ID=3, coords=(2, 0)) } cls.beam1 = HB.HermitianBeam2D(E=cls.EE, I=1., A=1., i=cls.nodeset_1[1], j=cls.nodeset_1[2]) cls.beam2 = HB.HermitianBeam2D(E=cls.EE, I=1., A=1., i=cls.nodeset_1[2], j=cls.nodeset_1[3]) cls.beam_as_structure = Structure.Structure( beams=[cls.beam1], supports={1: ['ux', 'uy', 'rotz']}) # the same beam but inclined by atan(0,5) ~= 26.56505 degrees degrees CCW. # all tests are performed for these as well, results should reflect only the rotation cls.rotation_angle = math.atan(0.5) cls._r = 1 / math.sqrt( 1.25 ) # the lenght of the elements is modified to keep the beam length cls.nodeset_2 = { 1: Node.Node(ID=1, coords=(0, 0)), 2: Node.Node(ID=2, coords=(1. * cls._r, 0.5 * cls._r)), 3: Node.Node(ID=3, coords=(2. * cls._r, 1. * cls._r)) } cls.beam3 = HB.HermitianBeam2D(E=cls.EE, I=1., A=1., i=cls.nodeset_2[1], j=cls.nodeset_2[2]) cls.beam4 = HB.HermitianBeam2D(E=cls.EE, I=1., A=1., i=cls.nodeset_2[2], j=cls.nodeset_2[3]) cls.beam_as_structure_2 = Structure.Structure( beams=[cls.beam3], supports={1: ['ux', 'uy', 'rotz']})
def setUpClass(cls): _nodes = [Node.Node(ID=x+1, coords=(500 * x, 0)) for x in range(7)] mat = Material.Steel() sect = sections.Rectangle(height=3, width=10) # section _beams = [HB.HermitianBeam2D(ID=x+1, E=mat.E, rho=mat.rho, I=sect.I.x, A=sect.A, i=_nodes[x], j=_nodes[x+1]) for x in range(6)] _supports = {7: ['ux', 'uy', 'rotz']} cls.structure = Structure.Structure(beams=_beams, supports=_supports) # adding nodal loads cls.structure.clear_loads() cls.structure.add_nodal_load(nodeID=1, dynam={'FY': -1000}, clear=True)
def setUpClass(cls): # structure #1: 3 elements in a row along the global X axis cls.n1 = Node.Node(ID=1, coords=(0, 0)) cls.n2 = Node.Node(ID=2, coords=(100, 0)) cls.n3 = Node.Node(ID=3, coords=(200, 0)) cls.n4 = Node.Node(ID=4, coords=(300, 0)) # section for the beams: 10 by 10 rectangle sect = sections.Rectangle(width=10, height=10) b1 = HB.HermitianBeam2D(E=210000., ID=1, crosssection=sect, i=cls.n1, j=cls.n2) b2 = HB.HermitianBeam2D(E=210000., ID=2, crosssection=sect, i=cls.n2, j=cls.n3) b3 = HB.HermitianBeam2D(E=210000., ID=3, crosssection=sect, i=cls.n3, j=cls.n4) cls.structure_1 = Structure.Structure( beams=[b1, b2, b3], supports={1: ['ux', 'uy', 'rotz']}) # the same structure, with the last node not inline. to test rotation. cls.n5 = Node.Node(ID=4, coords=(300, 100)) b4 = HB.HermitianBeam2D(E=210000., ID=3, I=833.33, A=100., i=cls.n3, j=cls.n5) cls.structure_2 = Structure.Structure( beams=[b1, b2, b4], supports={1: ['ux', 'uy', 'rotz']})
def setUpClass(cls): _nodes = [Node.Node(ID=x+1, coords=(500 * x, 0)) for x in range(7)] mat = Material.Steel() sect = sections.Rectangle(height=3, width=10) # section _beams = [HB.HermitianBeam2D(ID=x+1, E=mat.E, rho=mat.rho, I=sect.I.x, A=sect.A, i=_nodes[x], j=_nodes[x+1]) for x in range(6)] _supports = {7: ['ux', 'uy', 'rotz']} cls.structure = Structure.Structure(beams=_beams, supports=_supports) # adding nodal loads cls.structure.clear_loads() cls.structure.add_nodal_load(nodeID=1, dynam={'FY': -1000, 'FX': -1000}, clear=True) cls.structure.add_internal_loads(beam=cls.structure.beams[0], loadtype='uniform axial force', value=1) cls.structure.add_internal_loads(beam=cls.structure.beams[2], loadtype='concentrated axial force', value=-1000, position=0.4) cls.structure.add_internal_loads(beam=cls.structure.beams[4], loadtype='concentrated axial force', value=1000, position=0.99)
def test_element_stiffness_matrix_rotated(self): k_asinteger = np.matrix([[1, 0, 0, -1, 0, 0], [0, 12, 6, 0, -12, 6], [0, 6, 4, 0, -6, 2], [-1, 0, 0, 1, 0, 0], [0, -12, -6, 0, 12, -6], [0, 6, 2, 0, -6, 4]]) _tm = HB.transfer_matrix(alpha=self.rotation_angle, asdegree=False, blocks=2, blocksize=3) k_asinteger = _tm * k_asinteger * _tm.T self.assertTrue( np.allclose(k_asinteger, self.beam3.matrix_in_global(mtrx=self.beam3.Ke))) self.assertTrue( np.allclose(self.beam3.matrix_in_global(mtrx=self.beam3.Ke), self.beam4.matrix_in_global(mtrx=self.beam4.Ke)))
def setUpClass(cls): _nodes = [Node.Node(ID=x+1, coords=(500 * x, 0)) for x in range(7)] mat = Material.Steel() sect = sections.Rectangle(height=3, width=10) # section _beams = [HB.HermitianBeam2D(ID=x+1, E=mat.E, rho=mat.rho, I=sect.I.x, A=sect.A, i=_nodes[x], j=_nodes[x+1]) for x in range(6)] _supports = {1: ['uy'], 3: ['uy'], 5: ['uy'], 7: ['ux', 'uy', 'rotz'], } cls.structure = Structure.Structure(beams=_beams, supports=_supports) # adding nodal loads cls.structure.clear_loads() cls.structure.add_nodal_load(nodeID=1, dynam={'FX': -1000}, clear=True) cls.structure.add_nodal_load(nodeID=2, dynam={'FY': -1000}) cls.structure.add_nodal_load(nodeID=4, dynam={'MZ': 500000}) # internal loads b = cls.structure.beams[4] cls.structure.add_internal_loads(beam=b, loadtype='uniform perpendicular force', value=-10.0) b = cls.structure.beams[5] cls.structure.add_internal_loads(beam=b, loadtype='uniform perpendicular force', value=-20.0)