.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/HyperElastic/HyperElastic2.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_HyperElastic_HyperElastic2.py: HyperElastic2 ============= A hyper elastic cube in compression. .. GENERATED FROM PYTHON SOURCE LINES 11-63 .. tab-set:: .. tab-item:: Static Scene .. image-sg:: /examples/HyperElastic/images/sphx_glr_HyperElastic2_001.png :alt: HyperElastic2 :srcset: /examples/HyperElastic/images/sphx_glr_HyperElastic2_001.png :class: sphx-glr-single-img .. tab-item:: Interactive Scene .. offlineviewer:: /home/docs/checkouts/readthedocs.org/user_builds/easyfea/checkouts/v1.5.4/docs/examples/HyperElastic/images/sphx_glr_HyperElastic2_001.vtksz .. tab-set:: .. tab-item:: Static Scene .. image-sg:: /examples/HyperElastic/images/sphx_glr_HyperElastic2_002.png :alt: HyperElastic2 :srcset: /examples/HyperElastic/images/sphx_glr_HyperElastic2_002.png :class: sphx-glr-single-img .. tab-item:: Interactive Scene .. offlineviewer:: /home/docs/checkouts/readthedocs.org/user_builds/easyfea/checkouts/v1.5.4/docs/examples/HyperElastic/images/sphx_glr_HyperElastic2_002.vtksz .. code-block:: Python :lineno-start: 12 from EasyFEA import Display, ElemType, Models, Simulations, PyVista from EasyFEA.Geoms import Domain if __name__ == "__main__": Display.Clear() # ---------------------------------------------- # Configuration # ---------------------------------------------- # geom L = 1 h = 1 # ---------------------------------------------- # Mesh # ---------------------------------------------- meshSize = h / 10 contour = Domain((0, 0), (L, h), h / 10) mesh = contour.Mesh_Extrude( [], [0, 0, h], [h / meshSize], ElemType.HEXA8, isOrganised=True ) nodesX0 = mesh.Nodes_Conditions(lambda x, y, z: x == 0) nodesXL = mesh.Nodes_Conditions(lambda x, y, z: x == L) # ---------------------------------------------- # Simulation # ---------------------------------------------- isot = Models.ElasIsot(3, E=1, v=0.3) lmbda = isot.get_lambda() mu = isot.get_mu() mat = Models.SaintVenantKirchhoff(3, lmbda, mu) simu = Simulations.HyperElasticSimu(mesh, mat) uc = -0.3 simu.add_dirichlet(nodesX0, [0, 0, 0], simu.Get_unknowns()) simu.add_dirichlet(nodesXL, [uc, 0, 0], simu.Get_unknowns()) simu.Solve() # ---------------------------------------------- # Results # ---------------------------------------------- PyVista.Plot_BoundaryConditions(simu).show() PyVista.Plot(simu, "ux", 1, plotMesh=True).show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.997 seconds) .. _sphx_glr_download_examples_HyperElastic_HyperElastic2.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: HyperElastic2.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: HyperElastic2.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: HyperElastic2.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_