Example #1
0
    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)
Example #2
0
    def setUpClass(cls):
        """
        A beam with clamped end under self weight.
        Results are accepted if circular frequencies are within 1% of the analytical solution.
        http://iitg.vlab.co.in/?sub=62&brch=175&sim=1080&cnt=1
        """

        # steel = Material.Steel()
        # cls.rho = steel.rho
        # cls.E = steel.E

        _pieces = 30  # number of finite elements
        for i in range(2):
            if i == 0:
                cls._length = 450.  # mm
                cls.rho = 7.850e-9
                section_column = sections.Rectangle(height=3., width=20.)
                cls.E = 2.1e5
            else:
                cls._length = 0.45  # m
                cls.rho = 7850
                section_column = sections.Rectangle(height=0.003, width=0.02)
                cls.E = 2.1e11

            # nodes
            _nodes = []
            for i in range(_pieces + 1):
                _nodes.append(
                    Node.Node.from_dict(
                        adict={
                            'ID': i + 1,
                            'coords': (i * cls._length / _pieces, 0)
                        }))

            # beams
            cls.I = section_column.I.x
            cls.A = section_column.A
            _beams = []
            for i in range(_pieces):
                _beams.append(
                    HB.HermitianBeam2D.from_dict(
                        adict={
                            'ID': i,
                            'E': cls.E,
                            'I': section_column.I.x,
                            'A': section_column.A,
                            'rho': cls.rho,
                            'i': _nodes[i],
                            'j': _nodes[i + 1]
                        }))

            # supports
            BCs = {1: ['ux', 'uy', 'rotz']}  # supports as dict

            # this is the structure
            cls.structure = Structure.Structure(beams=_beams, supports=BCs)
Example #3
0
    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']})
Example #4
0
    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)
Example #5
0
    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']})
Example #6
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))
Example #7
0
    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 setUpClass(cls):

        # nodes
        _n1 = Node.Node(ID=1, coords=(0, 0))
        _n2 = Node.Node(ID=2, coords=(100, 0))

        # beams
        section_column = sections.Rectangle(height=3, width=10)  # section
        mat = Material.Steel()
        _b1 = HB.HermitianBeam2D.from_dict(adict={'ID': 1, 'E': mat.E, 'I': section_column.I.x, 'A': section_column.A, 'rho': mat.rho, 'i': _n1, 'j': _n2})
        _b1.number_internal_points = 4  # setting this to have much less values for comparison

        # supports
        BCs = {1: ['ux', 'uy', 'rotz'], NR_BEAMS+1: ['ux', 'uy', 'rotz']}  # supports as dict

        # this is the cantilever itself, composed of the beams, complete with supports
        cls.structure = Structure.Structure(beams=[_b1], supports=BCs)
Example #9
0
    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)
Example #10
0
        adict={
            'ID': i,
            'E': EE,
            'I': section_column.I['x'],
            'A': section_column.A,
            'rho': rho,
            'i': _nodes[i],
            'j': _nodes[i + 1]
        }) for i in range(NR_BEAMS)
]

# supports
BCs = {1: ['ux', 'uy', 'rotz']}  # supports as dict

# this is the cantilever itself, composed of the beams, complete with supports
structure = Structure.Structure(beams=_beams, supports=BCs)

# adding loads, masses
_last = max([x.ID for x in _nodes])
structure.add_nodal_mass(nodeID=_last, mass={'mx': 1. / 1000, 'my': 1. / 1000})
# # adding loads
# structure.add_single_dynam_to_node(nodeID=len(_nodes), dynam={'FX': F_HORIZONTAL, 'FY': F_VERTICAL}, clear=True)

# solving it
structure.solver['modal'].solve()

# posprocessing
structure.draw(analysistype='modal')

import numpy as np
alakok = 5