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



13 from EasyFEA import Display, ElemType, Models, Simulations, PyVista
14 from EasyFEA.Geoms import Point, Line, Points, Domain
15
16 if __name__ == "__main__":
17 Display.Clear()
18
19 L = 1
20 openCrack = True
21
22 contour = Domain(Point(), Point(L, L))
23
24 # ----------------------------------------------
25 # CRACK
26 # ----------------------------------------------
27
28 crack1 = Line(Point(L / 4, L / 2), Point(3 * L / 4, L / 2), isOpen=openCrack)
29 crack2 = Line(
30 Point(0, L / 3, isOpen=openCrack), Point(L / 2, L / 3), isOpen=openCrack
31 )
32 crack3 = Line(
33 Point(0, 2 * L / 3, isOpen=openCrack), Point(L / 2, 2 * L / 3), isOpen=openCrack
34 )
35 crack4 = Line(Point(0, 4 * L / 5), Point(L, 4 * L / 5), isOpen=False)
36 crack5 = Points(
37 [Point(L / 2, L / 5), Point(2 * L / 3, L / 5), Point(L, L / 10, isOpen=True)],
38 isOpen=True,
39 )
40
41 cracks = [crack1, crack2, crack3, crack4, crack5]
42
43 PyVista.Plot_Geoms([contour, *cracks]).show()
44
45 mesh = contour.Mesh_2D([], ElemType.TRI6, cracks)
46
47 PyVista.Plot_Tags(mesh).show()
48
49 # ----------------------------------------------
50 # SIMU
51 # ----------------------------------------------
52
53 material = Models.Elastic.Isotropic(2)
54 simu = Simulations.Elastic(mesh, material)
55
56 simu.add_dirichlet(
57 mesh.Nodes_Conditions(lambda x, y, z: y == 0), [0] * 2, simu.Get_unknowns()
58 )
59 simu.add_dirichlet(mesh.Nodes_Conditions(lambda x, y, z: y == L), [L * 0.05], ["y"])
60 simu.Solve()
61 PyVista.Plot(simu, "uy", 1, plotMesh=True).show()
Total running time of the script: (0 minutes 1.296 seconds)