.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/Meshes/Mesh5_3D.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_Meshes_Mesh5_3D.py: Mesh5_3D ======== Mesh of a 3D cracked part. .. GENERATED FROM PYTHON SOURCE LINES 11-66 .. tab-set:: .. tab-item:: Static Scene .. image-sg:: /examples/Meshes/images/sphx_glr_Mesh5_3D_001.png :alt: Mesh5 3D :srcset: /examples/Meshes/images/sphx_glr_Mesh5_3D_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/Meshes/images/sphx_glr_Mesh5_3D_001.vtksz .. tab-set:: .. tab-item:: Static Scene .. image-sg:: /examples/Meshes/images/sphx_glr_Mesh5_3D_002.png :alt: Mesh5 3D :srcset: /examples/Meshes/images/sphx_glr_Mesh5_3D_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/Meshes/images/sphx_glr_Mesh5_3D_002.vtksz .. tab-set:: .. tab-item:: Static Scene .. image-sg:: /examples/Meshes/images/sphx_glr_Mesh5_3D_003.png :alt: Mesh5 3D :srcset: /examples/Meshes/images/sphx_glr_Mesh5_3D_003.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/Meshes/images/sphx_glr_Mesh5_3D_003.vtksz .. rst-class:: sphx-glr-script-out .. code-block:: none /home/docs/checkouts/readthedocs.org/user_builds/easyfea/envs/v1.5.4/lib/python3.11/site-packages/EasyFEA/utilities/PyVista.py:630: PyVistaDeprecationWarning: ../../../../envs/v1.5.4/lib/python3.11/site-packages/EasyFEA/utilities/PyVista.py:630: Argument 'color' must be passed as a keyword argument to function 'BasePlotter.add_mesh'. From version 0.50, passing this as a positional argument will result in a TypeError. plotter.add_mesh(grid, "k", line_width=2) /home/docs/checkouts/readthedocs.org/user_builds/easyfea/envs/v1.5.4/lib/python3.11/site-packages/EasyFEA/utilities/PyVista.py:632: PyVistaDeprecationWarning: ../../../../envs/v1.5.4/lib/python3.11/site-packages/EasyFEA/utilities/PyVista.py:632: Argument 'color' must be passed as a keyword argument to function 'BasePlotter.add_mesh'. From version 0.50, passing this as a positional argument will result in a TypeError. plotter.add_mesh(grid, "c", opacity=0.5) /home/docs/checkouts/readthedocs.org/user_builds/easyfea/envs/v1.5.4/lib/python3.11/site-packages/EasyFEA/utilities/PyVista.py:634: PyVistaDeprecationWarning: ../../../../envs/v1.5.4/lib/python3.11/site-packages/EasyFEA/utilities/PyVista.py:634: Argument 'color' must be passed as a keyword argument to function 'BasePlotter.add_mesh'. From version 0.50, passing this as a positional argument will result in a TypeError. plotter.add_mesh(grid, "c", opacity=0.5) /home/docs/checkouts/readthedocs.org/user_builds/easyfea/envs/v1.5.4/lib/python3.11/site-packages/EasyFEA/utilities/PyVista.py:628: PyVistaDeprecationWarning: ../../../../envs/v1.5.4/lib/python3.11/site-packages/EasyFEA/utilities/PyVista.py:628: Argument 'color' must be passed as a keyword argument to function 'BasePlotter.add_mesh'. From version 0.50, passing this as a positional argument will result in a TypeError. plotter.add_mesh(grid, "k", render_points_as_spheres=True) | .. code-block:: Python :lineno-start: 12 from EasyFEA import Display, ElemType, Models, Simulations, PyVista from EasyFEA.Geoms import Point, Line, Points, Domain, Contour if __name__ == "__main__": Display.Clear() L = 1 openCrack = True contour = Domain(Point(), Point(L, L)) # ---------------------------------------------- # CRACK # ---------------------------------------------- line1 = Line(Point(L / 4, L / 2), Point(3 * L / 4, L / 2), isOpen=openCrack) line2 = Line(line1.pt2, line1.pt2 + [0, 0.25, L]) line3 = Line(line2.pt2, line1.pt1 + [0, 0.25, L], isOpen=openCrack) line4 = Line(line3.pt2, line1.pt1) crack1 = Points( [ Point(L / 2, L / 5, L), Point(2 * L / 3, L / 5, L), Point(L, L / 2, L, isOpen=True), ], isOpen=True, ) cracks = [Contour([line1, line2, line3, line4], isOpen=openCrack), crack1] PyVista.Plot_Geoms([contour, *cracks]).show() # WARNING: # only works with TETRA4 and TETRA10 # only works with nLayers = [] mesh = contour.Mesh_Extrude([], [0, 0, L], [], ElemType.TETRA4, cracks) PyVista.Plot_Tags(mesh).show() # ---------------------------------------------- # SIMU # ---------------------------------------------- material = Models.ElasIsot(3) simu = Simulations.ElasticSimu(mesh, material) simu.add_dirichlet( mesh.Nodes_Conditions(lambda x, y, z: y == 0), [0] * 3, simu.Get_unknowns() ) simu.add_dirichlet(mesh.Nodes_Conditions(lambda x, y, z: y == L), [L * 0.05], ["y"]) simu.Solve() PyVista.Plot(simu, "uy", 1, plotMesh=True).show() Display.plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 2.367 seconds) .. _sphx_glr_download_examples_Meshes_Mesh5_3D.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: Mesh5_3D.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: Mesh5_3D.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: Mesh5_3D.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_