Example #1
0
class ModalRepesentationWithNoModes_Tests:
    def setup(self):
        # Define a mode shape with deflection x^2 in the y direction
        self.x = x = arange(0, 10.1, 1)
        self.L = self.x[-1]
        zero = 0 * x
        shapes = c_[zero, x**2, zero].reshape((len(x), 3, 1))
        rotations = c_[zero, 2 * x, zero].reshape((len(x), 3, 1))
        self.modes = ModalRepresentation(x,
                                         freqs=[1],
                                         shapes=shapes,
                                         rotations=rotations)

    def _uniform_force(self, direction, magnitude):
        P = zeros((len(self.x), 3))
        P[:, direction] = magnitude
        return P

    def test_distributed_loading_for_uniform_axial_loading(self):
        P = self._uniform_force(0, 3.4)
        Qr, Qw, Qe = self.modes.distributed_loading(P, [0])
        assert_aae(Qr, [3.4 * 10, 0, 0])
        assert_aae(Qw, [0, 0, 0])  # axial so no moment
        assert_aae(Qe, [0])  # axial so no strain force

    def test_distributed_loading_uniform_loading_aligned_with_mode(self):
        P = self._uniform_force(1, 3.4)
        Qr, Qw, Qe = self.modes.distributed_loading(P, [0])
        assert_aae(Qr, [0, 3.4 * 10, 0])
        assert_aae(Qw, [0, 0, 3.4 * self.L**2 / 2])
        # Generalised force should be integral of applied
        # force and deflection. Integral of x^2 if L^3 / 3
        assert_aae(Qe, [3.4 * trapz(self.x**2, self.x)])

    def test_distributed_loading_uniform_loading_not_aligned_with_mode(self):
        P = self._uniform_force(2, 3.4)
        Qr, Qw, Qe = self.modes.distributed_loading(P, [0])
        assert_aae(Qr, [0, 0, 3.4 * 10])
        assert_aae(Qw, [0, -3.4 * self.L**2 / 2, 0])
        assert_aae(Qe, [0])
Example #2
0
class ModalRepesentationWithNoModes_Tests:
    def setup(self):
        # Define a mode shape with deflection x^2 in the y direction
        self.x = x = arange(0, 10.1, 1)
        self.L = self.x[-1]
        zero = 0*x
        shapes    = c_[zero, x**2, zero].reshape((len(x), 3, 1))
        rotations = c_[zero, 2*x,  zero].reshape((len(x), 3, 1))
        self.modes = ModalRepresentation(x, freqs=[1], shapes=shapes,
                                         rotations=rotations)

    def _uniform_force(self, direction, magnitude):
        P = zeros((len(self.x), 3))
        P[:, direction] = magnitude
        return P

    def test_distributed_loading_for_uniform_axial_loading(self):
        P = self._uniform_force(0, 3.4)
        Qr, Qw, Qe = self.modes.distributed_loading(P, [0])
        assert_aae(Qr, [3.4 * 10, 0, 0])
        assert_aae(Qw, [0, 0, 0])         # axial so no moment
        assert_aae(Qe, [0])               # axial so no strain force

    def test_distributed_loading_uniform_loading_aligned_with_mode(self):
        P = self._uniform_force(1, 3.4)
        Qr, Qw, Qe = self.modes.distributed_loading(P, [0])
        assert_aae(Qr, [0, 3.4 * 10, 0])
        assert_aae(Qw, [0, 0, 3.4 * self.L**2 / 2])
        # Generalised force should be integral of applied
        # force and deflection. Integral of x^2 if L^3 / 3
        assert_aae(Qe, [3.4 * trapz(self.x**2, self.x)])

    def test_distributed_loading_uniform_loading_not_aligned_with_mode(self):
        P = self._uniform_force(2, 3.4)
        Qr, Qw, Qe = self.modes.distributed_loading(P, [0])
        assert_aae(Qr, [0, 0, 3.4 * 10])
        assert_aae(Qw, [0, -3.4 * self.L**2 / 2, 0])
        assert_aae(Qe, [0])
Example #3
0
class ModalRepesentationWithNoModes_Tests:
    def setup(self):
        self.x = arange(0, 10.1, 1)
        self.L = self.x[-1]
        self.modes = ModalRepresentation(self.x)

    def _uniform_force(self, direction, magnitude):
        P = zeros((len(self.x), 3))
        P[:, direction] = magnitude
        return P

    def test_distributed_loading_for_uniform_axial_loading(self):
        P = self._uniform_force(0, 3.4)
        Qr, Qw, Qe = self.modes.distributed_loading(P, [])
        assert_aae(Qr, [3.4 * self.L, 0, 0])
        assert_aae(Qw, [0, 0, 0])         # axial so no moment
        assert_equal(Qe.shape, (0,))

    def test_distributed_loading_for_uniform_perpendicular_loading(self):
        P = self._uniform_force(1, 3.4)
        Qr, Qw, Qe = self.modes.distributed_loading(P, [])
        assert_aae(Qr, [0, 3.4 * self.L, 0])
        assert_aae(Qw, [0, 0, 3.4 * self.L**2 / 2])
        assert_equal(Qe.shape, (0,))
Example #4
0
class ModalRepesentationWithNoModes_Tests:
    def setup(self):
        self.x = arange(0, 10.1, 1)
        self.L = self.x[-1]
        self.modes = ModalRepresentation(self.x)

    def _uniform_force(self, direction, magnitude):
        P = zeros((len(self.x), 3))
        P[:, direction] = magnitude
        return P

    def test_distributed_loading_for_uniform_axial_loading(self):
        P = self._uniform_force(0, 3.4)
        Qr, Qw, Qe = self.modes.distributed_loading(P, [])
        assert_aae(Qr, [3.4 * self.L, 0, 0])
        assert_aae(Qw, [0, 0, 0])  # axial so no moment
        assert_equal(Qe.shape, (0, ))

    def test_distributed_loading_for_uniform_perpendicular_loading(self):
        P = self._uniform_force(1, 3.4)
        Qr, Qw, Qe = self.modes.distributed_loading(P, [])
        assert_aae(Qr, [0, 3.4 * self.L, 0])
        assert_aae(Qw, [0, 0, 3.4 * self.L**2 / 2])
        assert_equal(Qe.shape, (0, ))