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)
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)
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)
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)
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)
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)
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)
Pz = -rho * g * (pi * d * t) # self-weight loads = _pBEAM.Loads(nodes, Px, Py, Pz) # 5 --------- # 6 --------- # RNA contribution m = 300000.0 # mass cm = np.array([-5.0, 0.0, 0.0]) # center of mass relative to tip I = np.array([2960437.0, 3253223.0, 3264220.0, 0.0, -18400.0, 0.0]) # moments of inertia F = np.array([750000.0, 0.0, -m * g]) # force M = np.array([0.0, 0.0, 0.0]) # moment tip = _pBEAM.TipData(m, cm, I, F, M) # 6 --------- # 7 --------- # rigid base inf = float('inf') k = np.array([inf] * 6) base = _pBEAM.BaseData(k, inf) # 7 --------- # 8 --------- # create tower object tower = _pBEAM.Beam(nodes, z, d, t, loads, material, tip, base)
13.34]) P3 = np.array([-1.065e+04, -1.081e+04, -1.098e+04, -1.104e+04, -1.109e+04, -1.114e+04, -1.064e+04, -8611, -8734, -8782, -7156, -5967, -5482, -3303, -3256, -3267, -3246, -3177, -3143, -3087, -3019, -2662, -2560, -2399, -2323, -2138, -2021, -1909, -1539, -1480, -1416, -1305, -1197, -985.7, -806.8, -662.5, -458.7, -305.5]) p_loads = _pBEAM.Loads(nsec, P1, P2, P3) # only distributed loads # 3 --------- # 4 --------- # tip/base data p_tip = _pBEAM.TipData() # no tip mass k = np.array([float('inf'), float('inf'), float('inf'), float('inf'), float('inf'), float('inf')]) p_base = _pBEAM.BaseData(k, float('inf')) # rigid base # create blade object blade = _pBEAM.Beam(p_section, p_loads, p_tip, p_base) # 4 --------- # 5 --------- # compute mass and natural frequncies print 'mass =', blade.mass() print 'natural freq =', blade.naturalFrequencies(5) # 5 --------- # 6 ---------