Mesh5_3D#

Mesh of a 3D cracked part.

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

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

Gallery generated by Sphinx-Gallery