Mesh5_3D#

Mesh of a 3D cracked part.

Mesh5 3D
Mesh5 3D
Mesh5 3D
/home/docs/checkouts/readthedocs.org/user_builds/easyfea/envs/v1.5.5/lib/python3.11/site-packages/EasyFEA/utilities/PyVista.py:637: PyVistaDeprecationWarning:
../../../../envs/v1.5.5/lib/python3.11/site-packages/EasyFEA/utilities/PyVista.py:637: 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.5/lib/python3.11/site-packages/EasyFEA/utilities/PyVista.py:639: PyVistaDeprecationWarning:
../../../../envs/v1.5.5/lib/python3.11/site-packages/EasyFEA/utilities/PyVista.py:639: 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.5/lib/python3.11/site-packages/EasyFEA/utilities/PyVista.py:641: PyVistaDeprecationWarning:
../../../../envs/v1.5.5/lib/python3.11/site-packages/EasyFEA/utilities/PyVista.py:641: 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.5/lib/python3.11/site-packages/EasyFEA/utilities/PyVista.py:635: PyVistaDeprecationWarning:
../../../../envs/v1.5.5/lib/python3.11/site-packages/EasyFEA/utilities/PyVista.py:635: 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)

12 from EasyFEA import Display, ElemType, Models, Simulations, PyVista
13 from EasyFEA.Geoms import Point, Line, Points, Domain, Contour
14
15 if __name__ == "__main__":
16     Display.Clear()
17
18     L = 1
19     openCrack = True
20
21     contour = Domain(Point(), Point(L, L))
22
23     # ----------------------------------------------
24     # CRACK
25     # ----------------------------------------------
26
27     line1 = Line(Point(L / 4, L / 2), Point(3 * L / 4, L / 2), isOpen=openCrack)
28     line2 = Line(line1.pt2, line1.pt2 + [0, 0.25, L])
29     line3 = Line(line2.pt2, line1.pt1 + [0, 0.25, L], isOpen=openCrack)
30     line4 = Line(line3.pt2, line1.pt1)
31     crack1 = Points(
32         [
33             Point(L / 2, L / 5, L),
34             Point(2 * L / 3, L / 5, L),
35             Point(L, L / 2, L, isOpen=True),
36         ],
37         isOpen=True,
38     )
39
40     cracks = [Contour([line1, line2, line3, line4], isOpen=openCrack), crack1]
41
42     PyVista.Plot_Geoms([contour, *cracks]).show()
43
44     # WARNING:
45     # only works with TETRA4 and TETRA10
46     # only works with nLayers = []
47     mesh = contour.Mesh_Extrude([], [0, 0, L], [], ElemType.TETRA4, cracks)
48
49     PyVista.Plot_Tags(mesh).show()
50
51     # ----------------------------------------------
52     # SIMU
53     # ----------------------------------------------
54
55     material = Models.ElasIsot(3)
56     simu = Simulations.ElasticSimu(mesh, material)
57
58     simu.add_dirichlet(
59         mesh.Nodes_Conditions(lambda x, y, z: y == 0), [0] * 3, simu.Get_unknowns()
60     )
61     simu.add_dirichlet(mesh.Nodes_Conditions(lambda x, y, z: y == L), [L * 0.05], ["y"])
62     simu.Solve()
63     PyVista.Plot(simu, "uy", 1, plotMesh=True).show()
64
65     Display.plt.show()

Total running time of the script: (0 minutes 2.875 seconds)

Gallery generated by Sphinx-Gallery