コード例 #1
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))
コード例 #2
0
    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))
コード例 #3
0
    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)))