.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/LinearizedElasticity/Elas1.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_LinearizedElasticity_Elas1.py: Elas1 ===== A cantilever beam undergoing bending deformation. .. GENERATED FROM PYTHON SOURCE LINES 11-92 .. rst-class:: sphx-glr-horizontal * .. image-sg:: /examples/LinearizedElasticity/images/sphx_glr_Elas1_001.png :alt: QUAD9: Ne = 81, Nn = 385 :srcset: /examples/LinearizedElasticity/images/sphx_glr_Elas1_001.png :class: sphx-glr-multi-img * .. image-sg:: /examples/LinearizedElasticity/images/sphx_glr_Elas1_002.png :alt: Boundary conditions :srcset: /examples/LinearizedElasticity/images/sphx_glr_Elas1_002.png :class: sphx-glr-multi-img * .. image-sg:: /examples/LinearizedElasticity/images/sphx_glr_Elas1_003.png :alt: $uy$ :srcset: /examples/LinearizedElasticity/images/sphx_glr_Elas1_003.png :class: sphx-glr-multi-img * .. image-sg:: /examples/LinearizedElasticity/images/sphx_glr_Elas1_004.png :alt: $\sigma_{vm}$ :srcset: /examples/LinearizedElasticity/images/sphx_glr_Elas1_004.png :class: sphx-glr-multi-img .. rst-class:: sphx-glr-script-out .. code-block:: none ==================== Mesh ==================== Element type: QUAD9 Ne = 81, Nn = 385 ==================== Model ==================== ElasIsot: E = 2.10e+05, v = 0.3 planeStress = True thickness = 1.30e+01 solver : pypardiso ============= Boundary Conditions ============= Unspecified. =================== Results =================== W def = 371.24 Svm max = 165.59 Evm max = 0.09 % Ux max = 7.49e-02 Ux min = -7.49e-02 Uy max = 0.00e+00 Uy min = -9.28e-01 =================== TicTac =================== Mesh : 260.262 ms Boundary Conditions : 776.768 µs Matrix : 2.017 s Solver : 5.083 s Display : 376.061 ms PostProcessing : 237.486 ms Resolution hyperelastic : 6.573 s PyVista_Interface : 17.072 s =================== Result =================== err W : 0.24 % err uy : 0.68 % | .. code-block:: Python :lineno-start: 12 from EasyFEA import Display, Models, plt, np, ElemType, Simulations from EasyFEA.Geoms import Domain if __name__ == "__main__": Display.Clear() # ---------------------------------------------- # Configuration # ---------------------------------------------- # geom dim = 2 L = 120 # mm h = 13 I = h**4 / 12 # mm4 # model E = 210000 # MPa (Young's modulus) v = 0.3 # Poisson's ratio coef = 1 # load load = 800 # N # expected results W_an = 2 * load**2 * L / E / h**2 * (L**2 / h**2 + (1 + v) * 3 / 5) # mJ uy_an = load * L**3 / (3 * E * I) # ---------------------------------------------- # Mesh # ---------------------------------------------- N = 3 meshSize = h / N domain = Domain((0, 0), (L, h), meshSize) if dim == 2: mesh = domain.Mesh_2D([], ElemType.QUAD9, isOrganised=True) else: mesh = domain.Mesh_Extrude( [], [0, 0, -h], [N], ElemType.HEXA27, isOrganised=True ) nodes_x0 = mesh.Nodes_Conditions(lambda x, y, z: x == 0) nodes_xL = mesh.Nodes_Conditions(lambda x, y, z: x == L) # ---------------------------------------------- # Simulation # ---------------------------------------------- material = Models.ElasIsot(dim, E, v, planeStress=True, thickness=h) simu = Simulations.ElasticSimu(mesh, material) simu.add_dirichlet(nodes_x0, [0] * dim, simu.Get_unknowns()) simu.add_surfLoad(nodes_xL, [-load / h**2], ["y"]) sol = simu.Solve() simu.Save_Iter() uy_num = -simu.Result("uy").min() W_num = simu._Calc_Psi_Elas() # ---------------------------------------------- # Results # ---------------------------------------------- print(simu) Display.Section("Result") print(f"err W : {np.abs(W_an - W_num) / W_an * 100:.2f} %") print(f"err uy : {np.abs(uy_an - uy_num) / uy_an * 100:.2f} %") Display.Plot_Mesh(simu, h / 2 / np.abs(sol).max()) Display.Plot_BoundaryConditions(simu) Display.Plot_Result(simu, "uy", nodeValues=True, coef=1 / coef, ncolors=20) Display.Plot_Result(simu, "Svm", plotMesh=True, ncolors=11) plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.261 seconds) .. _sphx_glr_download_examples_LinearizedElasticity_Elas1.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: Elas1.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: Elas1.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: Elas1.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_