Note
Go to the end to download the full example code.
Mesh5_2D#
Mesh of a 2D cracked part.



12 from EasyFEA import Display, ElemType, Models, Simulations, PyVista
13 from EasyFEA.Geoms import Point, Line, Points, Domain
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 crack1 = Line(Point(L / 4, L / 2), Point(3 * L / 4, L / 2), isOpen=openCrack)
28 crack2 = Line(
29 Point(0, L / 3, isOpen=openCrack), Point(L / 2, L / 3), isOpen=openCrack
30 )
31 crack3 = Line(
32 Point(0, 2 * L / 3, isOpen=openCrack), Point(L / 2, 2 * L / 3), isOpen=openCrack
33 )
34 crack4 = Line(Point(0, 4 * L / 5), Point(L, 4 * L / 5), isOpen=False)
35 crack5 = Points(
36 [Point(L / 2, L / 5), Point(2 * L / 3, L / 5), Point(L, L / 10, isOpen=True)],
37 isOpen=True,
38 )
39
40 cracks = [crack1, crack2, crack3, crack4, crack5]
41
42 PyVista.Plot_Geoms([contour, *cracks]).show()
43
44 mesh = contour.Mesh_2D([], ElemType.TRI6, cracks)
45
46 PyVista.Plot_Tags(mesh).show()
47
48 # ----------------------------------------------
49 # SIMU
50 # ----------------------------------------------
51
52 material = Models.Elastic.Isotropic(2)
53 simu = Simulations.Elastic(mesh, material)
54
55 simu.add_dirichlet(
56 mesh.Nodes_Conditions(lambda x, y, z: y == 0), [0] * 2, simu.Get_unknowns()
57 )
58 simu.add_dirichlet(mesh.Nodes_Conditions(lambda x, y, z: y == L), [L * 0.05], ["y"])
59 simu.Solve()
60 PyVista.Plot(simu, "uy", 1, plotMesh=True).show()
Total running time of the script: (0 minutes 2.718 seconds)