exs_beam1¶
- Purpose:
Analysis of a simply supported beam.
- Description:
Consider a beam with the length \(9.0\) m. The beam is simply supported and loaded by a point load \(P=10000\) N applied at a point \(3.0\) m from the left support. The corresponding computational model has six degrees of freedom and consists of two beam elements with four degrees of freedom. The beam has Young’s modulus \(E=210\) GPa and moment of inertia \(I=2510 \times 10^{-8}\) m⁴.
- Example:
The computation is initialized by importing CALFEM and NumPy. The element topology matrix contains only the degrees of freedom for each element:
import numpy as np import matplotlib.pyplot as plt import calfem.core as cfc import calfem.utils as cfu import calfem.vis_mpl as cfv edof = np.array([ [1, 2, 3, 4], [3, 4, 5, 6] ])The global stiffness matrix
Kand load vectorfare initialized. The point load P = 10000 N is applied at DOF 3:K = np.array(np.zeros((6, 6))) f = np.array(np.zeros((6, 1))) f[2] = -10e3The material and geometric properties are defined, along with element coordinates and stiffness matrices:
E = 210e9 I = 2510e-8 ep = np.array([E, I]) ex1 = np.array([0, 3]) ex2 = np.array([3, 9]) eq1 = np.array([0]) eq2 = np.array([0]) Ke1 = cfc.beam1e(ex1, ep) Ke2 = cfc.beam1e(ex2, ep) cfu.disp_h2("Ke1") cfu.disp_array(Ke1, tablefmt='plain') cfu.disp_h2("Ke2") cfu.disp_array(Ke2, tablefmt='plain')## Ke1 2.3427e+06 3.5140e+06 -2.3427e+06 3.5140e+06 3.5140e+06 7.0280e+06 -3.5140e+06 3.5140e+06 -2.3427e+06 -3.5140e+06 2.3427e+06 -3.5140e+06 3.5140e+06 3.5140e+06 -3.5140e+06 7.0280e+06 ## Ke2 2.9283e+05 8.7850e+05 -2.9283e+05 8.7850e+05 8.7850e+05 3.5140e+06 -8.7850e+05 1.7570e+06 -2.9283e+05 -8.7850e+05 2.9283e+05 -8.7850e+05 8.7850e+05 1.7570e+06 -8.7850e+05 3.5140e+06Based on the topology information, the global stiffness matrix can be generated by assembling the element stiffness matrices.
cfc.assem(edof[0, :], K, Ke1) cfc.assem(edof[1, :], K, Ke2)The system of equations is solved by defining boundary conditions and using
solveq():bc_dofs = np.array([1, 5]) bc_vals = np.array([0.0, 0.0]) a, r = cfc.solveq(K, f, bc_dofs, bc_vals) cfu.disp_array(a, ["a"]) cfu.disp_array(r, ["r"])+-------------+ | a | |-------------| | 0.0000e+00 | | -9.4859e-03 | | -2.2766e-02 | | -3.7943e-03 | | 0.0000e+00 | | 7.5887e-03 | +-------------+ +-------------+ | r | |-------------| | 6.6667e+03 | | -1.8190e-11 | | 7.2760e-12 | | -1.0914e-11 | | 3.3333e+03 | | -7.2760e-12 | +-------------+The section forces and element displacements are calculated from global displacements:
ed = cfc.extract_ed(edof, a) es1, ed1, ec1 = cfc.beam1s(ex1, ep, ed[0, :], eq1, nep=4) es2, ed2, ec2 = cfc.beam1s(ex2, ep, ed[1, :], eq2, nep=7) cfu.disp_h2("es1") cfu.disp_array(es1, ["V1", "M1"]) cfu.disp_h2("ed1") cfu.disp_array(ed1, ["v1"]) cfu.disp_h2("ec1") cfu.disp_array(ec1, ["x1"]) cfu.disp_h2("es2") cfu.disp_array(es2, ["V2", "M2"]) cfu.disp_h2("ed2") cfu.disp_array(ed2, ["v2"]) cfu.disp_h2("ec2") cfu.disp_array(ec2, ["x2"])## es1 +-------------+------------+ | V1 | M1 | |-------------+------------| | -6.6667e+03 | 1.8287e-11 | | -6.6667e+03 | 6.6667e+03 | | -6.6667e+03 | 1.3333e+04 | | -6.6667e+03 | 2.0000e+04 | +-------------+------------+ ## ed1 +-------------+ | v1 | |-------------| | 0.0000e+00 | | -9.2751e-03 | | -1.7285e-02 | | -2.2766e-02 | +-------------+ ## ec1 +------------+ | x1 | |------------| | 0.0000e+00 | | 1.0000e+00 | | 2.0000e+00 | | 3.0000e+00 | +------------+ ## es2 +------------+------------+ | V2 | M2 | |------------+------------| | 3.3333e+03 | 2.0000e+04 | | 3.3333e+03 | 1.6667e+04 | | 3.3333e+03 | 1.3333e+04 | | 3.3333e+03 | 1.0000e+04 | | 3.3333e+03 | 6.6667e+03 | | 3.3333e+03 | 3.3333e+03 | | 3.3333e+03 | 0.0000e+00 | +------------+------------+ ## ed2 +-------------+ | v2 | |-------------| | -2.2766e-02 | | -2.4769e-02 | | -2.3609e-02 | | -1.9920e-02 | | -1.4334e-02 | | -7.4833e-03 | | -3.4694e-18 | +-------------+ ## ec2 +------------+ | x2 | |------------| | 0.0000e+00 | | 1.0000e+00 | | 2.0000e+00 | | 3.0000e+00 | | 4.0000e+00 | | 5.0000e+00 | | 6.0000e+00 | +------------+Results:
The solution shows the expected behavior for a simply supported beam with a point load:
Maximum deflection: 22.8 mm at the loading point (DOF 3)
Support reactions: 6667 N at left support, 3333 N at right support
Maximum shear force: 6667 N (in element 1)
Maximum moment: 20000 Nm (at the loading point)
Visualization of the results using matplotlib:
cfv.figure(1) plt.plot([0, 9], [0, 0], color=(0.8, 0.8, 0.8)) plt.plot( np.concatenate(([0], ec1[:, 0], 3 + ec2[:, 0], [9]), 0), np.concatenate(([0], ed1[:, 0], ed2[:, 0], [0]), 0), color=(0.0, 0.0, 0.0), ) cfv.title("displacements") # ----- Draw shear force diagram---------------------------------- cfv.figure(2) plt.plot([0, 9], [0, 0], color=(0.8, 0.8, 0.8)) plt.plot( np.concatenate(([0], ec1[:, 0], 3 + ec2[:, 0], [9]), 0), -np.concatenate(([0], es1[:, 0], es2[:, 0], [0]), 0) / 1000, color=(0.0, 0.0, 0.0), ) cfv.title("shear force") # ----- Draw moment diagram---------------------------------- cfv.figure(3) plt.plot([0, 9], [0, 0], color=(0.8, 0.8, 0.8)) plt.plot( np.concatenate(([0], ec1[:, 0], 3 + ec2[:, 0], [9]), 0), -np.concatenate(([0], es1[:, 1], es2[:, 1], [0]), 0) / 1000, color=(0.0, 0.0, 0.0), ) cfv.title("bending moment") cfv.show_and_wait()