.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/Beam/Beam3.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_Beam_Beam3.py: Beam3 ===== A bi-fixed beam undergoing bending deformation. .. GENERATED FROM PYTHON SOURCE LINES 11-113 .. rst-class:: sphx-glr-horizontal * .. image-sg:: /examples/Beam/images/sphx_glr_Beam3_001.png :alt: SEG2: Ne = 10, Nn = 11 :srcset: /examples/Beam/images/sphx_glr_Beam3_001.png :class: sphx-glr-multi-img * .. image-sg:: /examples/Beam/images/sphx_glr_Beam3_002.png :alt: Section :srcset: /examples/Beam/images/sphx_glr_Beam3_002.png :class: sphx-glr-multi-img * .. image-sg:: /examples/Beam/images/sphx_glr_Beam3_003.png :alt: Boundary conditions :srcset: /examples/Beam/images/sphx_glr_Beam3_003.png :class: sphx-glr-multi-img * .. image-sg:: /examples/Beam/images/sphx_glr_Beam3_004.png :alt: $uy^{e}$ :srcset: /examples/Beam/images/sphx_glr_Beam3_004.png :class: sphx-glr-multi-img .. rst-class:: sphx-glr-script-out .. code-block:: none err uy : 0.00 % ==================== Mesh ==================== Element type: SEG2 Ne = 10, Nn = 11 ==================== Model ==================== solver : scipy ============= Boundary Conditions ============= Unspecified. =================== Results =================== Ux max = 0.00e+00 Ux min = 0.00e+00 Uy max = 0.00e+00 Uy min = -6.71e-03 =================== TicTac =================== Mesh : 80.150 ms Boundary Conditions : 65.804 µs Matrix : 27.260 ms Solver : 13.510 ms Display : 223.311 ms PostProcessing : 184.298 µs | .. code-block:: Python :lineno-start: 12 from EasyFEA import Display, Models, plt, np, Mesher, ElemType, Simulations from EasyFEA.Geoms import Line, Point, Points if __name__ == "__main__": Display.Clear() # ---------------------------------------------- # Configuration # ---------------------------------------------- # geom L = 120 h = 20 b = 13 e = 2 # model E = 210000 v = 0.3 # load load = 800 # ---------------------------------------------- # Section # ---------------------------------------------- def DoSym(p: Point, n: np.ndarray) -> Point: pc = p.copy() pc.Symmetry(n=n) return pc p1 = Point(-b / 2, -h / 2) p2 = Point(b / 2, -h / 2) p3 = Point(b / 2, -h / 2 + e) p4 = Point(e / 2, -h / 2 + e, r=e) p5 = DoSym(p4, (0, 1)) p6 = DoSym(p3, (0, 1)) p7 = DoSym(p2, (0, 1)) p8 = DoSym(p1, (0, 1)) p9 = DoSym(p6, (1, 0)) p10 = DoSym(p5, (1, 0)) p11 = DoSym(p4, (1, 0)) p12 = DoSym(p3, (1, 0)) contour = Points([p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12], e / 6) section = Mesher().Mesh_2D(contour) # ---------------------------------------------- # Mesh # ---------------------------------------------- elemType = ElemType.SEG2 beamDim = 2 # must be >= 2 p1 = Point() pL = Point(x=L / 2) p2 = Point(x=L) line = Line(p1, p2, L / 9) beam = Models.BeamElasIsot(beamDim, line, section, E, v) mesh = Mesher().Mesh_Beams([beam], additionalPoints=[pL], elemType=elemType) # ---------------------------------------------- # Simulation # ---------------------------------------------- # Initialize the beam structure with the defined beam segments beamStructure = Models.BeamStructure([beam]) # Create the beam simulation simu = Simulations.BeamSimu(mesh, beamStructure) dof_n = simu.Get_dof_n() # Apply boundary conditions simu.add_dirichlet(mesh.Nodes_Point(p1), [0] * dof_n, simu.Get_unknowns()) simu.add_dirichlet(mesh.Nodes_Point(p2), [0] * dof_n, simu.Get_unknowns()) simu.add_neumann(mesh.Nodes_Point(pL), [-load], ["y"]) # Solve the beam problem and get displacement results sol = simu.Solve() simu.Save_Iter() # ---------------------------------------------- # Results # ---------------------------------------------- u_an = load * L**3 / (192 * E * beam.Iz) uy_1d = np.abs(simu.Result("uy").min()) Display.MyPrint(f"err uy : {np.abs(u_an - uy_1d) / u_an * 100:.2f} %") Display.Plot_Mesh(simu, L / 20 / sol.min()) ax = Display.Plot_Mesh(section) ax.set_title("Section") Display.Plot_BoundaryConditions(simu) Display.Plot_Result(simu, "uy", L / 20 / sol.min()) print(simu) plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.295 seconds) .. _sphx_glr_download_examples_Beam_Beam3.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: Beam3.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: Beam3.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: Beam3.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_