Note
Go to the end to download the full example code.
Elas7#
Control lever for a molding machine used to blow plastic bottles.
References#
This example comes from:
A French research article: MMC et RDM comparées sur un cas de dimensionnement de levier
The book: Mécanique des systèmes et des milieux déformables (3rd edition)


==================== Mesh ====================
Element type: PRISM6
Ne = 27150, Nn = 17454
==================== Model ====================
ElasIsot:
E = 2.10e+05, v = 0.25
solver : pypardiso
============= Boundary Conditions =============
Unspecified.
=================== Results ===================
W def = 633.45
Svm max = 51.45
Evm max = 0.03 %
Ux max = 2.10e-02
Ux min = -2.08e-02
Uy max = 2.07e-03
Uy min = -1.16e-01
Uz max = 4.66e-04
Uz min = -4.66e-04
=================== TicTac ===================
Mesh : 1.118 s
Boundary Conditions : 955.343 µs
Matrix : 4.755 s
Solver : 8.239 s
Display : 657.346 ms
PostProcessing : 286.703 ms
Resolution hyperelastic : 6.573 s
PyVista_Interface : 17.123 s
Save_simu 0/4
Save_simu 1/4 (25.00 %) 488.11 ms
Save_simu 2/4 (50.00 %) 325.40 ms
Save_simu 3/4 (75.00 %) 162.94 ms
Save_simu 4/4 (100.00 %) 0.00 µs
20 from EasyFEA import (
21 Display,
22 Folder,
23 Models,
24 np,
25 ElemType,
26 Simulations,
27 PyVista,
28 Paraview,
29 )
30 from EasyFEA.Geoms import Points, Point, Circle
31
32 if __name__ == "__main__":
33 Display.Clear()
34
35 # ----------------------------------------------
36 # Configuration
37 # ----------------------------------------------
38
39 # outputs
40 folder = Folder.Join(Folder.RESULTS_DIR, "Elastic", "Elas7", mkdir=True)
41 makeMovie = False
42 makeParaview = True
43
44 # geom
45 dim = 3
46 thickness = 25
47
48 # sinusoidal load
49 F = 13000 # N
50 area = np.pi * 25 / 2 * thickness
51 coefs = np.linspace(0, 1, 5)
52 loads = F * np.sin(np.pi / 2 * coefs)
53
54 # ----------------------------------------------
55 # Mesh
56 # ----------------------------------------------
57 meshSize = 42 / 10
58
59 # get the contour
60 pt1 = Point(0, 80)
61 pt2 = Point(-245, 21)
62 pt3 = Point(-245, -21)
63 pt4 = Point(0, -80)
64 pt5 = Point(114, -80)
65 pt6 = Point(114 + 13, -80 + 13)
66 pt7 = Point(114 + 13, -67 / 2)
67 pt8 = Point(114 + 13 + 25, -67 / 2)
68 pt9 = Point(114 + 13 + 25, -34 / 2)
69 pt10 = Point(114 + 13, -34 / 2, r=10)
70 pt11 = Point(114 + 13, 34 / 2, r=10)
71 pt12 = Point(114 + 13 + 25, 34 / 2)
72 pt13 = Point(114 + 13 + 25, 67 / 2)
73 pt14 = Point(114 + 13, 67 / 2)
74 pt15 = Point(114 + 13, 80 - 13)
75 pt16 = Point(114, 80)
76
77 # fmt: off
78 contour = Points([
79 pt1, pt2, pt3, pt4, pt5, pt6, pt7, pt8, pt9, pt10,
80 pt11, pt12, pt13, pt14, pt15, pt16,
81 ],
82 meshSize,
83 )
84 # fmt: on
85
86 # get circles
87 circle1 = Circle(Point(-220), 25, meshSize, isHollow=True)
88 circle2 = Circle(Point(), 25, meshSize, isHollow=True)
89 circle3 = Circle(Point(114 + 13 - 25, 80 - 25), 25, meshSize, isHollow=True)
90 circle4 = Circle(Point(114 + 13 - 25, -80 + 25), 25, meshSize, isHollow=True)
91 circle5 = Circle(Point(67), 84, meshSize, isHollow=True)
92
93 inclusions = [circle1, circle2, circle3, circle4, circle5]
94
95 # get the mesh
96 if dim == 2:
97 mesh = contour.Mesh_2D(inclusions, ElemType.TRI3)
98 else:
99 mesh = contour.Mesh_Extrude(inclusions, [0, 0, thickness], [5], ElemType.PRISM6)
100
101 # get loading nodes
102 nodesLoad = mesh.Nodes_Cylinder(circle1)
103 nodesLoad = nodesLoad[mesh.coord[nodesLoad, 1] <= 0]
104
105 # get fixed nodes
106 nodesCircle2 = mesh.Nodes_Cylinder(circle2)
107 nodesCircle3 = mesh.Nodes_Cylinder(circle3)
108 nodesCircle4 = mesh.Nodes_Cylinder(circle4)
109 fixedNodes = np.concat((nodesCircle2, nodesCircle3, nodesCircle4))
110
111 # PyVista.Plot_Mesh(mesh).show()
112
113 # ----------------------------------------------
114 # Simulation
115 # ----------------------------------------------
116
117 material = Models.ElasIsot(
118 dim, E=210000, v=0.25, planeStress=True, thickness=thickness
119 )
120
121 simu = Simulations.ElasticSimu(mesh, material)
122
123 fixed = [0] * dim
124 unknowns = simu.Get_unknowns()
125
126 # loop over the load
127 for load in loads:
128 # Apply boundary conditions
129 simu.Bc_Init()
130 simu.add_dirichlet(fixedNodes, fixed, unknowns)
131 simu.add_surfLoad(nodesLoad, [-load / area], ["y"])
132
133 # Solve the simulation
134 simu.Solve()
135
136 # Save the iteration results
137 simu.Save_Iter()
138
139 # ----------------------------------------------
140 # Results
141 # ----------------------------------------------
142
143 print(simu)
144
145 PyVista.Plot_BoundaryConditions(simu).show()
146
147 PyVista.Plot(simu, "Svm", deformFactor=200, plotMesh=True, nodeValues=False).show()
148
149 if makeMovie:
150 PyVista.Movie_simu(
151 simu,
152 "Svm",
153 folder,
154 "Svm.gif",
155 deformFactor=200,
156 nodeValues=False,
157 plotMesh=True,
158 )
159
160 if makeParaview:
161 Paraview.Save_simu(
162 simu, folder, elementFields=["Svm", "Stress", "Strain", "Wdef_e"]
163 )
Total running time of the script: (0 minutes 6.371 seconds)