Exemplo n.º 1
0
    def test_accounts_for_offset_centre_of_mass_in_applied_force(self):
        # check applied force due to gravity is correct
        b = RigidBody("body", mass=5.6, Xc=[1.2, 3.4, 5.4])
        s = System(gravity=9.81)  # need a System to define gravity
        s.add_leaf(b)
        s.setup()

        b.calc_mass()
        b.calc_external_loading()
        assert_array_equal(b.applied_forces, b.mass * 9.81 * array([0, 0, -1, -3.4, 1.2, 0]))
    def test_accounts_for_offset_centre_of_mass_in_applied_force(self):
        # check applied force due to gravity is correct
        b = RigidBody('body', mass=5.6, Xc=[1.2, 3.4, 5.4])
        s = System(gravity=9.81)  # need a System to define gravity
        s.add_leaf(b)
        s.setup()

        b.calc_mass()
        b.calc_external_loading()
        assert_array_equal(b.applied_forces,
                           b.mass * 9.81 * array([0, 0, -1, -3.4, 1.2, 0]))
    def test_interal_forces(self):
        # NB minus sign because convention for applied_stress is that
        # stiffness loads are positive.
        b = RigidBody('body', 1)

        # Constant loading
        b.nodal_load = np.array([2, 3.1, 2.1])
        b.calc_external_loading()
        assert_array_equal(b.applied_forces, [2, 3.1, 2.1, 0, 0, 0])
        assert_array_equal(b.applied_stress, [])

        # Loading function
        b.nodal_load = lambda element, t: np.ones(3)
        b.calc_external_loading()
        assert_array_equal(b.applied_forces, [1, 1, 1, 0, 0, 0])
        assert_array_equal(b.applied_stress, [])
Exemplo n.º 4
0
    def test_interal_forces(self):
        # NB minus sign because convention for applied_stress is that
        # stiffness loads are positive.
        b = RigidBody("body", 1)

        # Constant loading
        b.nodal_load = np.array([2, 3.1, 2.1])
        b.calc_external_loading()
        assert_array_equal(b.applied_forces, [2, 3.1, 2.1, 0, 0, 0])
        assert_array_equal(b.applied_stress, [])

        # Loading function
        b.nodal_load = lambda element, t: np.ones(3)
        b.calc_external_loading()
        assert_array_equal(b.applied_forces, [1, 1, 1, 0, 0, 0])
        assert_array_equal(b.applied_stress, [])