.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/HelloWorld.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_HelloWorld.py: .. _HelloWorld: HelloWorld ========== A cantilever beam undergoing bending deformation. .. GENERATED FROM PYTHON SOURCE LINES 14-57 .. rst-class:: sphx-glr-horizontal * .. image-sg:: /examples/images/sphx_glr_HelloWorld_001.png :alt: QUAD9: Ne = 81, Nn = 385 :srcset: /examples/images/sphx_glr_HelloWorld_001.png :class: sphx-glr-multi-img * .. image-sg:: /examples/images/sphx_glr_HelloWorld_002.png :alt: Boundary conditions :srcset: /examples/images/sphx_glr_HelloWorld_002.png :class: sphx-glr-multi-img * .. image-sg:: /examples/images/sphx_glr_HelloWorld_003.png :alt: $uy$ :srcset: /examples/images/sphx_glr_HelloWorld_003.png :class: sphx-glr-multi-img * .. image-sg:: /examples/images/sphx_glr_HelloWorld_004.png :alt: $\sigma_{vm}$ :srcset: /examples/images/sphx_glr_HelloWorld_004.png :class: sphx-glr-multi-img .. code-block:: Python :lineno-start: 15 import matplotlib.pyplot as plt from EasyFEA import Display, ElemType, Models, Simulations from EasyFEA.Geoms import Domain # ---------------------------------------------- # Mesh # ---------------------------------------------- L = 120 # mm h = 13 domain = Domain((0, 0), (L, h), h / 3) mesh = domain.Mesh_2D([], ElemType.QUAD9, isOrganised=True) # ---------------------------------------------- # Simulation # ---------------------------------------------- E = 210000 # MPa v = 0.3 F = -800 # N mat = Models.Elastic.Isotropic(2, E, v, planeStress=True, thickness=h) simu = Simulations.Elastic(mesh, mat) nodesX0 = mesh.Nodes_Conditions(lambda x, y, z: x == 0) nodesXL = mesh.Nodes_Conditions(lambda x, y, z: x == L) simu.add_dirichlet(nodesX0, [0, 0], ["x", "y"]) simu.add_surfLoad(nodesXL, [F / h / h], ["y"]) simu.Solve() # ---------------------------------------------- # Results # ---------------------------------------------- Display.Plot_Mesh(simu, deformFactor=10) Display.Plot_BoundaryConditions(simu) Display.Plot_Result(simu, "uy", plotMesh=True) 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.525 seconds) .. _sphx_glr_download_examples_HelloWorld.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: HelloWorld.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: HelloWorld.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: HelloWorld.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_