Note
Go to the end to download the full example code.
Elas2#
Bending bracket component.
==================== Mesh ====================
Element type: TETRA10
Ne = 2088, Nn = 3537
==================== Model ====================
Isotropic:
E = 2.10e+05, v = 0.3
solver : scipy
============= Boundary Conditions =============
Unspecified.
=================== Results ===================
W def = 4.04
Svm max = 10.53
Evm max = 0.01 %
Ux max = 2.12e-03
Ux min = -2.88e-03
Uy max = 5.15e-05
Uy min = -1.01e-02
Uz max = 2.47e-04
Uz min = -2.41e-04
=================== TicTac ===================
Mesh : 59.523 ms
Boundary Conditions : 14.067 µs
Matrix : 172.982 ms
Solver : 331.324 ms
PostProcessing : 2.038 ms
13 import matplotlib.pyplot as plt
14 import numpy as np
15
16 from EasyFEA import Display, Models, ElemType, Simulations
17 from EasyFEA.Geoms import Point, Points
18
19 if __name__ == "__main__":
20 Display.Clear()
21
22 # ----------------------------------------------
23 # Configuration
24 # ----------------------------------------------
25
26 # geom
27 dim = 3
28 L = 120 # mm
29 h = L * 0.3
30
31 # model
32 E = 210000 # MPa (Young's modulus)
33 v = 0.3 # Poisson's ratio
34 coef = 1
35
36 # load
37 load = 800
38
39 # ----------------------------------------------
40 # Mesh
41 # ----------------------------------------------
42
43 # Define points and crack geometry for the mesh
44 pt1 = Point(isOpen=True, r=-10)
45 pt2 = Point(x=L)
46 pt3 = Point(x=L, y=h)
47 pt4 = Point(x=h, y=h, r=10)
48 pt5 = Point(x=h, y=L)
49 pt6 = Point(y=L)
50 pt7 = Point(x=h, y=h)
51
52 contour = Points([pt1, pt2, pt3, pt4, pt5, pt6], h / 3)
53
54 if dim == 2:
55 mesh = contour.Mesh_2D([], ElemType.TRI3)
56 elif dim == 3:
57 mesh = contour.Mesh_Extrude([], [0, 0, -h], [4], elemType=ElemType.TETRA10)
58
59 nodes_x0 = mesh.Nodes_Conditions(lambda x, y, z: x == 0)
60 nodes_xL = mesh.Nodes_Conditions(lambda x, y, z: x == L)
61
62 # ----------------------------------------------
63 # Simulation
64 # ----------------------------------------------
65
66 material = Models.Elastic.Isotropic(dim, E, v, planeStress=True, thickness=h)
67 simu = Simulations.Elastic(mesh, material)
68
69 simu.add_dirichlet(nodes_x0, [0] * dim, simu.Get_unknowns())
70 simu.add_surfLoad(nodes_xL, [-800 / (h * h)], ["y"])
71
72 sol = simu.Solve()
73 simu.Save_Iter()
74
75 # ----------------------------------------------
76 # Results
77 # ----------------------------------------------
78 print(simu)
79
80 Display.Plot_Mesh(simu, h / 2 / np.abs(sol).max())
81 Display.Plot_BoundaryConditions(simu)
82 Display.Plot_Result(simu, "Svm", nodeValues=True, coef=1 / coef, ncolors=20)
83
84 plt.show()
Total running time of the script: (0 minutes 0.859 seconds)


