.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/Beam/Beam6.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_Beam6.py: Beam6 ===== A cantilever beam undergoing bending deformation in dynamic. .. GENERATED FROM PYTHON SOURCE LINES 12-134 .. image-sg:: /examples/Beam/images/sphx_glr_Beam6_001.gif :alt: Beam6 :srcset: /examples/Beam/images/sphx_glr_Beam6_001.gif :class: sphx-glr-single-img .. rst-class:: sphx-glr-horizontal * .. image-sg:: /examples/Beam/images/sphx_glr_Beam6_002.png :alt: Boundary conditions :srcset: /examples/Beam/images/sphx_glr_Beam6_002.png :class: sphx-glr-multi-img * .. image-sg:: /examples/Beam/images/sphx_glr_Beam6_003.png :alt: $uy^{e}$ :srcset: /examples/Beam/images/sphx_glr_Beam6_003.png :class: sphx-glr-multi-img * .. image-sg:: /examples/Beam/images/sphx_glr_Beam6_004.png :alt: Section :srcset: /examples/Beam/images/sphx_glr_Beam6_004.png :class: sphx-glr-multi-img * .. image-sg:: /examples/Beam/images/sphx_glr_Beam6_005.png :alt: SEG3: Ne = 10, Nn = 21 :srcset: /examples/Beam/images/sphx_glr_Beam6_005.png :class: sphx-glr-multi-img .. rst-class:: sphx-glr-script-out .. code-block:: none Generate movie 01/20 (5.00 %) 4.20 s Generate movie 02/20 (10.00 %) 1.75 s Generate movie 03/20 (15.00 %) 1.62 s Generate movie 04/20 (20.00 %) 1.52 s Generate movie 05/20 (25.00 %) 1.42 s Generate movie 06/20 (30.00 %) 1.34 s Generate movie 07/20 (35.00 %) 1.26 s Generate movie 08/20 (40.00 %) 1.15 s Generate movie 09/20 (45.00 %) 1.06 s Generate movie 10/20 (50.00 %) 974.00 ms Generate movie 11/20 (55.00 %) 906.86 ms Generate movie 12/20 (60.00 %) 755.25 ms Generate movie 13/20 (65.00 %) 661.54 ms Generate movie 14/20 (70.00 %) 567.97 ms Generate movie 15/20 (75.00 %) 473.29 ms Generate movie 16/20 (80.00 %) 392.36 ms Generate movie 17/20 (85.00 %) 284.47 ms Generate movie 18/20 (90.00 %) 187.54 ms Generate movie 19/20 (95.00 %) 94.34 ms Generate movie 20/20 (100.00 %) 0.00 µs ==================== Mesh ==================== Element type: SEG3 Ne = 10, Nn = 21 ==================== Model ==================== solver:scipy ============= Boundary Conditions ============= Unspecified. =================== Results =================== Ux max = 0.00e+00 Ux min = 0.00e+00 Uy max = 0.00e+00 Uy min = -7.69e-01 =================== TicTac =================== Mesh: 19.125 ms Boundary Conditions: 21.696 µs Matrix: 11.829 ms Solver: 103.381 ms Display: 15.572 ms PyVista_Interface: 3.235 s | .. code-block:: Python :lineno-start: 13 import matplotlib.pyplot as plt from EasyFEA import ( Folder, Display, Models, Mesher, ElemType, Simulations, Paraview, PyVista, ) from EasyFEA.Geoms import Domain, Line if __name__ == "__main__": Display.Clear() # ---------------------------------------------- # Configuration # ---------------------------------------------- # outputs folder = Folder.Results_Dir() makeParaview = False makeMovie = True result = "uy" # geom L = 120 nL = 10 h = 13 b = 13 e = 3 # model E = 210000 uy = 0.3 # load load = 800 # time Tmax = 2.0 N = 50 dt = Tmax / N # ---------------------------------------------- # Mesh # ---------------------------------------------- elemType = ElemType.SEG3 beamDim = 2 # must be >= 2 # Create a section object for the beam mesh domain1 = Domain((0, 0), (b, h), h / 10) domain2 = Domain((e, e), (b - e, h - e), h / 10) section = domain1.Mesh_2D([domain2]) p1 = (0, 0) p2 = (L, 0) line = Line(p1, p2, L / nL) beam = Models.Beam.Isotropic(beamDim, line, section, E, uy) mesh = Mesher().Mesh_Beams([beam], elemType=elemType) # ---------------------------------------------- # Simulation # ---------------------------------------------- # Initialize the beam structure with the defined beam segments beamStructure = Models.Beam.BeamStructure([beam]) # Create the beam simulation simu = Simulations.Beam(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_neumann(mesh.Nodes_Point(p2), [-load], ["y"]) # Solve the beam problem and get displacement results sol = simu.Solve() simu.Save_Iter() simu.Solver_Set_Hyperbolic_Algorithm(dt) simu.Bc_Init() simu.add_dirichlet(mesh.Nodes_Point(p1), [0] * dof_n, simu.Get_unknowns()) for _ in range(N): simu.Solve() simu.Save_Iter() # ---------------------------------------------- # Results # ---------------------------------------------- Display.Plot_BoundaryConditions(simu) if makeParaview: Paraview.Save_simu(simu, folder) deform = 10 if makeMovie: PyVista.Movie_simu( simu, f"{result}", folder, f"{result}.gif", N=20, deformFactor=deform, plotMesh=True, ) print(simu) Display.Plot_Result(simu, result, deformFactor=deform) ax = Display.Plot_Mesh(section) ax.set_title("Section") Display.Plot_Mesh(simu, deformFactor=deform) plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 3.793 seconds) .. _sphx_glr_download_examples_Beam_Beam6.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: Beam6.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: Beam6.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: Beam6.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_