Contact1#

Performing a ‘Hertz contact problem’ with the assumption of frictionless contact The master mesh is considered non-deformable. WARNING: The assumption of small displacements is highly questionable for this simulation.

Contact1
Contact1
Eps max = 0.38 %
Eps max = 0.76 %
Eps max = 1.15 %
Eps max = 1.76 %
Eps max = 2.20 %
Eps max = 2.63 %
Eps max = 3.58 %
Eps max = 3.79 %
Eps max = 3.99 %
Eps max = 4.19 %
Eps max = 4.38 %
Eps max = 4.58 %
Eps max = 5.03 %
Eps max = 5.53 %
Eps max = 6.02 %
Eps max = 7.10 %
Eps max = 7.49 %
Eps max = 7.92 %
Eps max = 8.36 %
Eps max = 8.98 %
Eps max = 9.61 %
Eps max = 10.24 %
Eps max = 10.87 %
Eps max = 11.50 %
Eps max = 12.12 %
Eps max = 12.75 %
Eps max = 13.38 %
Eps max = 14.01 %
Eps max = 14.64 %
Eps max = 15.26 %


==================== Mesh ====================

Element type: QUAD4
Ne = 400, Nn = 441

==================== Model ====================

ElasIsot:
E = 2.10e+05, v = 0.3
planeStress = True
thickness = 3.33e+00

solver : pypardiso

============= Boundary Conditions =============

Unspecified.

=================== Results ===================


W def = 202448.77

Svm max = 72054.31

Evm max = 44.60 %

Ux max = 1.39e-01
Ux min = -1.56e-01

Uy max = 0.00e+00
Uy min = -9.83e-01

=================== TicTac ===================

Mesh : 600.763 ms
Boundary Conditions : 1.952 ms
Matrix : 4.039 s
Solver : 2.329 s
Display : 869.805 ms
PostProcessing : 365.494 ms
Resolution hyperelastic : 6.224 s
PyVista_Interface : 8.941 s

Generate movie 0/29
Generate movie 1/29 (3.45 %) 16.46 s
Generate movie 2/29 (6.90 %) 12.59 s
Generate movie 3/29 (10.34 %) 12.07 s
Generate movie 4/29 (13.79 %) 11.52 s
Generate movie 5/29 (17.24 %) 11.07 s
Generate movie 6/29 (20.69 %) 10.81 s
Generate movie 7/29 (24.14 %) 10.41 s
Generate movie 8/29 (27.59 %) 9.31 s
Generate movie 9/29 (31.03 %) 9.52 s
Generate movie 10/29 (34.48 %) 8.99 s
Generate movie 11/29 (37.93 %) 8.47 s
Generate movie 12/29 (41.38 %) 7.81 s
Generate movie 13/29 (44.83 %) 7.45 s
Generate movie 14/29 (48.28 %) 6.85 s
Generate movie 15/29 (51.72 %) 6.51 s
Generate movie 16/29 (55.17 %) 6.06 s
Generate movie 17/29 (58.62 %) 5.62 s
Generate movie 18/29 (62.07 %) 5.19 s
Generate movie 19/29 (65.52 %) 4.70 s
Generate movie 20/29 (68.97 %) 4.24 s
Generate movie 21/29 (72.41 %) 3.71 s
Generate movie 22/29 (75.86 %) 3.26 s
Generate movie 23/29 (79.31 %) 2.79 s
Generate movie 24/29 (82.76 %) 2.33 s
Generate movie 25/29 (86.21 %) 1.87 s
Generate movie 26/29 (89.66 %) 1.39 s
Generate movie 27/29 (93.10 %) 937.71 ms
Generate movie 28/29 (96.55 %) 460.00 ms
Generate movie 29/29 (100.00 %) 0.00 µs

 13 # TODO: Compare results with analytical values ?
 14
 15 from EasyFEA import Display, Folder, Models, plt, np, ElemType, Simulations, PyVista
 16 from EasyFEA.Geoms import Point, Domain, Points
 17
 18 if __name__ == "__main__":
 19     Display.Clear()
 20
 21     # ----------------------------------------------
 22     # Configuration
 23     # ----------------------------------------------
 24     dim = 2
 25
 26     # outputs
 27     folder = Folder.Join(Folder.RESULTS_DIR, "Contact", "Contact1")
 28     pltIter = False
 29     makeMovie = True
 30     result = "uy"
 31
 32     # geom
 33     R = 10
 34     height = R
 35     thickness = R / 3
 36
 37     # load
 38     N = 30
 39     inc = 1e-0 / N
 40     cx, cy = 0, -1
 41
 42     # ----------------------------------------------
 43     # Meshes
 44     # ----------------------------------------------
 45
 46     meshSize = R / 20
 47
 48     # slave mesh
 49     contour_slave = Domain(Point(-R / 2, 0), Point(R / 2, height), meshSize)
 50     if dim == 2:
 51         mesh_slave = contour_slave.Mesh_2D([], ElemType.QUAD4, isOrganised=True)
 52     else:
 53         mesh_slave = contour_slave.Mesh_Extrude(
 54             [], [0, 0, -thickness], [4], ElemType.HEXA8, isOrganised=True
 55         )
 56
 57     # nodes_slave = mesh_slave.Get_list_groupElem(dim-1)[0].nodes
 58     nodes_slave = mesh_slave.Nodes_Conditions(lambda x, y, z: y == height)
 59     nodes_y0 = mesh_slave.Nodes_Conditions(lambda x, y, z: y == 0)
 60
 61     # master mesh
 62     r = R / 2
 63     p0 = Point(-R / 2, height, r=r)
 64     p1 = Point(R / 2, height, r=r)
 65     p2 = Point(R / 2, height + R)
 66     p3 = Point(-R / 2, height + R)
 67     contour_master = Points([p0, p1, p2, p3])
 68
 69     yMax = height + np.abs(r)
 70     if dim == 2:
 71         master_mesh = contour_master.Mesh_2D([], ElemType.TRI3)
 72     else:
 73         master_mesh = contour_master.Mesh_Extrude(
 74             [], [0, 0, -thickness - 2], [4], ElemType.TETRA4
 75         )
 76         groupMaster = master_mesh.Get_list_groupElem(dim - 1)[0]
 77         if len(master_mesh.Get_list_groupElem(dim - 1)) > 1:
 78             Display.MyPrintError(
 79                 f"The {groupMaster.elemType.name} element group is used. In 3D, TETRA AND HEXA elements are recommended."
 80             )
 81     master_mesh.Translate(dz=-(master_mesh.center[2] - mesh_slave.center[2]))
 82
 83     # Display.Plot_Tags(mesh_master, alpha=0.1, showId=True)
 84
 85     # get master nodes
 86     # nodes_master = mesh_master.Get_list_groupElem(dim-1)[0].nodes
 87     if dim == 2:
 88         nodes_master = master_mesh.Nodes_Tags(["L0", "L1"])
 89     else:
 90         nodes_master = master_mesh.Nodes_Tags(["S1", "S2"])
 91
 92     # # plot meshes
 93     # ax = Display.Plot_Mesh(master_mesh, alpha=0)
 94     # Display.Plot_Mesh(mesh_slave, ax=ax, alpha=0)
 95     # # add nodes interface
 96     # ax.scatter(*mesh_slave.coord[nodes_slave, :dim].T, label="slave nodes")
 97     # ax.scatter(*master_mesh.coord[nodes_master, :dim].T, label="master nodes")
 98     # ax.legend()
 99     # ax.set_title("Contact nodes")
100
101     # ----------------------------------------------
102     # Simulation
103     # ----------------------------------------------
104     material = Models.ElasIsot(
105         dim, E=210000, v=0.3, planeStress=True, thickness=thickness
106     )
107     simu = Simulations.ElasticSimu(mesh_slave, material)
108
109     list_master_mesh = [master_mesh]
110
111     if pltIter:
112         ax = Display.Plot_Result(simu, result, deformFactor=1)
113
114     for i in range(N):
115         master_mesh = master_mesh.copy()
116         master_mesh.Translate(cx * inc, cy * inc)
117
118         list_master_mesh.append(master_mesh)
119
120         convergence = False
121
122         coordo_old = simu.Results_displacement_matrix() + simu.mesh.coord
123
124         while not convergence:
125             # apply new boundary conditions
126             simu.Bc_Init()
127             simu.add_dirichlet(nodes_y0, [0] * dim, simu.Get_unknowns())
128
129             nodes, newU = simu.Get_contact(master_mesh, nodes_slave, nodes_master)
130
131             if nodes.size > 0:
132                 simu.add_dirichlet(nodes, [newU[:, 0], newU[:, 1]], ["x", "y"])
133
134             simu.Solve()
135
136             # check if there is no new nodes in the master mesh
137             oldSize = nodes.size
138             nodes, __ = simu.Get_contact(master_mesh, nodes_slave, nodes_master)
139             convergence = oldSize == nodes.size
140
141         simu.Save_Iter()
142
143         print(f"Eps max = {simu.Result('Strain').max() * 100:3.2f} %")
144
145         if pltIter:
146             Display.Plot_Result(simu, result, plotMesh=True, deformFactor=1, ax=ax)
147             Display.Plot_Mesh(master_mesh, alpha=0, ax=ax)
148             ax.set_title(result)
149             if dim == 3:
150                 Display._Axis_equal_3D(
151                     ax, np.concatenate((master_mesh.coord, mesh_slave.coord), 0)
152                 )
153
154             # # Plot arrows
155             # if nodes.size >0:
156             #     # get the nodes coordinates on the interface
157             #     coordinates = groupMaster.Get_GaussCoordinates_e_p('mass').reshape(-1,3)
158             #     ax.scatter(*coordinates[:,:dim].T)
159
160             #     coordo_new = simu.Results_displacement_matrix() + simu.mesh.coordo
161             #     ax.scatter(*coordo_old[nodes,:dim].T)
162             #     incU = coordo_new - coordo_oldq
163             #     [ax.arrow(*coordo_old[node, :dim], *incU[node,:dim],length_includes_head=True) for node in nodes]
164
165             plt.pause(1e-12)
166
167     print(simu)
168
169     # ----------------------------------------------
170     # Results
171     # ----------------------------------------------
172     if makeMovie:
173
174         def DoAnim(plotter, n):
175             simu.Set_Iter(n)
176             PyVista.Plot(
177                 simu,
178                 "Svm",
179                 1,
180                 style="surface",
181                 color="k",
182                 plotter=plotter,
183                 nColors=10,
184                 show_grid=True,
185             )
186             PyVista.Plot(list_master_mesh[n], plotter=plotter, plotMesh=True, alpha=0.2)
187
188         PyVista.Movie_func(DoAnim, N, folder=folder, filename=f"{result}.gif")
189
190     if not pltIter:
191         plotter = PyVista.Plot(simu, result, plotMesh=True, deformFactor=1)
192         PyVista.Plot_Mesh(master_mesh, alpha=0.4, plotter=plotter)
193         plotter.show()
194
195     Display.plt.show()

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

Gallery generated by Sphinx-Gallery