Example #1
0
    def testCantileverDeflection(self):
        # Test data from "Finite Element Structural Analysis", Yang, pg. 145
        E = 2.0
        I = 3.0
        L = 4.0
        p0 = 5.0

        nodes = 2

        Px = np.array([-p0, 0.0])
        Py = Pz = np.zeros(nodes)
        loads = pb.Loads(nodes, Px, Py, Pz)

        tip = pb.TipData()

        base = pb.BaseData(np.ones(6), 1.0)

        z = np.array([0.0, L])
        EIx = EIy = E*I*np.ones(nodes)
        EA = E*np.ones(nodes)
        GJ = rhoA = rhoJ = np.ones(nodes)
        sec = pb.SectionData(nodes, z, EA, EIx, EIy, GJ, rhoA, rhoJ)

        beam = pb.Beam(sec, loads, tip, base)

        (dx, dy, dz, dtheta_x, dtheta_y, dtheta_z) = beam.displacement()

        self.assertAlmostEqual(dx[0], 0.0, 8)
        self.assertAlmostEqual(dx[1], -p0 * L**3.0 / E / I * L / 30.0, 8)
        self.assertAlmostEqual(dtheta_y[0], 0.0, 8)
        self.assertAlmostEqual(dtheta_y[1],-p0 * L**3.0 / E / I * 1 / 24.0, 8)
Example #2
0
    def testOtherCalls(self):

        E = 2.0
        I = 3.0
        L = 4.0
        q0 = 5.0
        
        n = 3
        nodes = n+1
        
        tip = pb.TipData()

        base = pb.BaseData(np.ones(6), 1.0)
        
        z = L * np.arange(nodes)
        EIx = EIy = E*I*np.ones(nodes)
        EA = GJ = rhoJ = rhoA = np.ones(nodes)
        sec = pb.SectionData(nodes, z, EA, EIx, EIy, GJ, rhoA, rhoJ)

        Pz = q0*(1 - z/L)
        Py = Px = np.zeros(nodes)
        loads = pb.Loads(nodes, Px, Py, Pz)

        beam = pb.Beam(sec, loads, tip, base)

        badlist = [float('inf'), -float('inf'), float('nan'), 0.0, np.inf, -np.inf, np.nan]
        self.assertNotIn(beam.mass(), badlist)
        self.assertNotIn(beam.outOfPlaneMomentOfInertia(), badlist)

        npts = 10
        xv = yv = np.zeros(npts)
        zv = np.linspace(z[0], z[-1], npts)
        self.assertNotIn( beam.axialStrain(npts, xv, yv, zv).sum(), badlist)
Example #3
0
    def testTaperedDeflections(self):
        # Test data from "Finite Element Structural Analysis", Yang, pg. 180
        E = 2.0
        I = 3.0
        L = 4.0
        P = 5.0

        nodes = 3

        Px = Py = Pz = np.zeros(nodes)
        loads = pb.Loads(nodes, Px, Py, Pz)

        tip = pb.TipData(0.0, np.zeros(3), np.zeros(6), [-P, 0.0, 0.0], np.zeros(3))

        base = pb.BaseData(np.ones(6), 1.0)

        z = np.array([0.0, 0.5*L, L])
        EIx = EIy = E*I*np.array([9.0, 5.0, 1.0])
        EA = E*np.ones(nodes)
        GJ = rhoA = rhoJ = np.ones(nodes)
        sec = pb.SectionData(nodes, z, EA, EIx, EIy, GJ, rhoA, rhoJ)

        beam = pb.Beam(sec, loads, tip, base)

        (dx, dy, dz, dtheta_x, dtheta_y, dtheta_z) = beam.displacement()

        tol = 1e-8
        tol_pct_1 = 0.17;
        tol_pct_2 = 0.77;
        self.assertAlmostEqual(dx[0], 0.0, 8)
        self.assertAlmostEqual(dx[-1], -0.051166*P*L**3/E/I, delta=tol_pct_1)
        self.assertAlmostEqual(dtheta_y[0], 0.0, 8)
        self.assertAlmostEqual(dtheta_y[-1], -0.090668*P*L**2/E/I, delta=tol_pct_2)
Example #4
0
    def testShearBendingSimple(self):
        # Test data from "Mechanical of Materials", Gere, 6th ed., pg. 273
        # cantilevered beam with linear distributed load

        L = 10.0
        q0 = 3.0

        n = 1
        nodes = n+1

        tip = pb.TipData()

        base = pb.BaseData(np.ones(6), 1.0)
        
        z = np.arange(nodes, dtype=np.float64) * (L / n)
        EIx = EIy = EA = GJ = rhoJ = rhoA = np.ones(nodes)
        sec = pb.SectionData(nodes, z, EA, EIx, EIy, GJ, rhoA, rhoJ)

        Px = q0*(1 - z/L)
        Py = Pz = np.zeros(nodes)
        loads = pb.Loads(nodes, Px, Py, Pz)

        beam = pb.Beam(sec, loads, tip, base)

        (Vx, Vy, Fz, Mx, My, Tz) = beam.shearAndBending()

        tol_pct = 1e-8
        Vx_expect = np.polyval([q0*L/2.0, -q0*L, q0*L/2.0], [0.0, 1.0])
        My_expect = np.polyval([-q0*L*L/6.0, 3.0*q0*L*L/6.0, -3.0*q0*L*L/6.0, q0*L*L/6.0], [0.0, 1.0])
        npt.assert_almost_equal(Vx, Vx_expect)
        npt.assert_almost_equal(My, My_expect)
Example #5
0
    def testBucklingEuler(self):
        # unit test data from Euler's buckling formula for a clamped/free beam

        E = 2.0
        I = 3.0
        L = 4.0

        n = 3
        nodes = n+1
        
        Px = Py = Pz = np.zeros(nodes)
        loads = pb.Loads(nodes, Px, Py, Pz)

        tip = pb.TipData()

        base = pb.BaseData(np.ones(6), 1.0)
        
        z = L * np.arange(nodes)
        EIx = EIy = E*I*np.ones(nodes)
        EA = GJ = rhoJ = rhoA = np.ones(nodes)
        sec = pb.SectionData(nodes, z, EA, EIx, EIy, GJ, rhoA, rhoJ)

        beam = pb.Beam(sec, loads, tip, base)

        (Pcr_x, Pcr_y) = beam.criticalBucklingLoads()

        Ltotal = n*L
        tol_pct = 0.011
        expect = E * I * (0.5*np.pi/Ltotal)**2.0
        self.assertAlmostEqual(Pcr_x, expect, 2)
        self.assertAlmostEqual(Pcr_y, expect, 2)
Example #6
0
    def testFreqFree_FreeBeam_n3(self):
        # Test data from "Consistent Mass Matrix for Distributed Mass Systmes", John Archer,
        # Journal of the Structural Division Proceedings of the American Society of Civil Engineers,
        # pg. 168
        E = 2.0
        I = 3.0
        L = 4.0
        A = 5.0
        rho = 6.0

        n = 3
        nodes = n+1
        
        Px = Py = Pz = np.zeros(nodes)
        loads = pb.Loads(nodes, Px, Py, Pz)

        tip = pb.TipData()

        base = pb.BaseData()
        
        z = L * np.arange(nodes)
        EIx = EIy = E*I*np.ones(nodes)
        EA = GJ = rhoJ = np.ones(nodes)
        rhoA = rho*A*np.ones(nodes)
        sec = pb.SectionData(nodes, z, EA, EIx, EIy, GJ, rhoA, rhoJ)

        beam = pb.Beam(sec, loads, tip, base)

        nFreq = 100
        freq = beam.naturalFrequencies(nFreq)
        
        m = rho * A
        alpha = m * (n*L)**4.0 / (840.0 * E * I)

        tol_pct = 6e-6 * 100
        expect = np.sqrt(0.59919 / alpha) / (2*np.pi)
        self.assertAlmostEqual(freq[1], expect, delta=tol_pct)
        self.assertAlmostEqual(freq[2], expect, delta=tol_pct)
        expect = np.sqrt(4.5750 / alpha) / (2*np.pi)
        self.assertAlmostEqual(freq[5], expect, delta=tol_pct)
        self.assertAlmostEqual(freq[6], expect, delta=tol_pct)
        expect = np.sqrt(22.010 / alpha) / (2*np.pi)
        self.assertAlmostEqual(freq[8], expect, delta=tol_pct)
        self.assertAlmostEqual(freq[9], expect, delta=tol_pct)
        expect = np.sqrt(70.920 / alpha) / (2*np.pi)
        self.assertAlmostEqual(freq[11], expect, delta=tol_pct)
        self.assertAlmostEqual(freq[12], expect, delta=tol_pct)
        expect = np.sqrt(265.91 / alpha) / (2*np.pi)
        self.assertAlmostEqual(freq[14], expect, delta=tol_pct)
        self.assertAlmostEqual(freq[15], expect, delta=tol_pct)
        expect = np.sqrt(402.40 / alpha) / (2*np.pi)
        self.assertAlmostEqual(freq[16], expect, delta=tol_pct)
        self.assertAlmostEqual(freq[17], expect, delta=tol_pct)
Example #7
0
    def testShearBendingSimplePt(self):
        # Test data from "Mechanical of Materials", Gere, 6th ed., pg. 288
        # cantilevered beam with two point loads

        L = 10.0
        P1 = 2.0
        P2 = 3.0

        n = 3
        nodes = n+1

        tip = pb.TipData()

        base = pb.BaseData(np.ones(6), 1.0)
        
        z = np.arange(nodes, dtype=np.float64) * (L / n)
        EIx = EIy = EA = GJ = rhoJ = rhoA = np.ones(nodes)
        sec = pb.SectionData(nodes, z, EA, EIx, EIy, GJ, rhoA, rhoJ)

        Px = Py = Pz = Fy_pt = Fz_pt = Mx_pt = My_pt = Mz_pt = np.zeros(nodes)
        Fx_pt = np.zeros(nodes)
        Fx_pt[1] = -P2
        Fx_pt[3] = -P1
        loads = pb.Loads(nodes, Px, Py, Pz, Fx_pt, Fy_pt, Fz_pt, Mx_pt, My_pt, Mz_pt)

        beam = pb.Beam(sec, loads, tip, base)

        (Vx, Vy, Fz, Mx, My, Tz) = beam.shearAndBending()

        tol_pct = 1e-8;
        Vx_expect = np.polyval([0.0, 0.0, -P1-P2], [0.0])
        self.assertAlmostEqual(Vx[0], Vx_expect, 8)

        Vx_expect = np.polyval([0.0, 0.0, -P1], [0.0])
        self.assertAlmostEqual(Vx[1], Vx_expect, 8)
        self.assertAlmostEqual(Vx[2], Vx_expect, 8)

        b = L/3.0
        a = 2.0/3.0*L
        My_expect = np.polyval([0.0, 0.0, -P1*a + P1*L + P2*b, -P1*L - P2*b], [0.0])
        self.assertAlmostEqual(My[0], My_expect, 8)

        My_expect = np.polyval([0.0, 0.0, -0.5*P1*a + P1*a, -P1*a], [0.0])
        self.assertAlmostEqual(My[1], My_expect, 8)

        My_expect = np.polyval([0.0, 0.0, 0.5*P1*a, -0.5*P1*a], [0.0])
        self.assertAlmostEqual(My[2], My_expect, 8)
Example #8
0
               3.002e+07, 2.53e+07, 2.128e+07, 1.433e+07, 9.588e+06, 6.455e+06,
               4.335e+06, 3.017e+06])
rhoA = np.array([1086, 1102, 1121, 1126, 1132, 1137, 1086, 878.6, 891.2, 896.1,
                 730.2, 608.9, 559.4, 337.1, 332.3, 333.3, 331.2, 324.2, 320.7,
                 315, 308, 271.6, 261.2, 244.8, 237, 218.2, 206.2, 194.8, 157,
                 151, 144.5, 133.1, 122.1, 100.6, 82.32, 67.6, 46.81, 31.18])
rhoJ = np.array([2778, 2905, 3048, 3092, 3139, 3184, 3075, 2415, 2532, 2566,
                 2119, 1595, 1255, 576.9, 558, 554.2, 534, 488.8, 467.5, 436.7,
                 404.6, 331.1, 295.2, 243.2, 222.8, 180.2, 155.6, 135.1, 92.91,
                 85.2, 76.85, 63.57, 52.86, 35.45, 23.82, 16.32, 8.66, 6.038])


# number of sections
nsec = len(r)

p_section = _pBEAM.SectionData(nsec, r, EA, EI11, EI22, GJ, rhoA, rhoJ)
# 2 ---------


# 3 ---------
# distributed loads

P1 = np.array([106.8, 487.3, 604.7, 715.4, 826.2, 923.1, 1007, 1299, 1326,
               1343, 1440, 1337, 1108, -1252, -2185, -2017, -1736, -1727,
               -1718, -1698, -1665, -1419, -1131, -1051, -937, -673.4,
               -643.8, -617, -553.7, -524.2, -504.1, -484.4, -462.8,
               -417, -374.3, -336.6, -295.3, -0.01844])
P2 = np.array([452.4, 2064, 2561, 3030, 3499, 3909, 4263, 5499, 5612,
               5686, 6098, 5291, 4690, 1.938e+04, 2.563e+04, 2.492e+04,
               2.387e+04, 2.346e+04, 2.308e+04, 2.202e+04, 2.097e+04,
               2.021e+04, 1.959e+04, 1.865e+04, 1.844e+04, 1.796e+04,