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 : 108.415 ms
Boundary Conditions : 31.948 µs
Matrix : 474.501 ms
Solver : 625.634 ms
PostProcessing : 6.346 ms
12 import matplotlib.pyplot as plt
13 import numpy as np
14
15 from EasyFEA import Display, Models, ElemType, Simulations
16 from EasyFEA.Geoms import Point, Points
17
18 if __name__ == "__main__":
19 Display.Clear()
20
21 # ----------------------------------------------
22 # Configuration
23 # ----------------------------------------------
24
25 # geom
26 dim = 3
27 L = 120 # mm
28 h = L * 0.3
29
30 # model
31 E = 210000 # MPa (Young's modulus)
32 v = 0.3 # Poisson's ratio
33 coef = 1
34
35 # load
36 load = 800
37
38 # ----------------------------------------------
39 # Mesh
40 # ----------------------------------------------
41
42 # Define points and crack geometry for the mesh
43 pt1 = Point(isOpen=True, r=-10)
44 pt2 = Point(x=L)
45 pt3 = Point(x=L, y=h)
46 pt4 = Point(x=h, y=h, r=10)
47 pt5 = Point(x=h, y=L)
48 pt6 = Point(y=L)
49 pt7 = Point(x=h, y=h)
50
51 contour = Points([pt1, pt2, pt3, pt4, pt5, pt6], h / 3)
52
53 if dim == 2:
54 mesh = contour.Mesh_2D([], ElemType.TRI3)
55 elif dim == 3:
56 mesh = contour.Mesh_Extrude([], [0, 0, -h], [4], elemType=ElemType.TETRA10)
57
58 nodes_x0 = mesh.Nodes_Conditions(lambda x, y, z: x == 0)
59 nodes_xL = mesh.Nodes_Conditions(lambda x, y, z: x == L)
60
61 # ----------------------------------------------
62 # Simulation
63 # ----------------------------------------------
64
65 material = Models.Elastic.Isotropic(dim, E, v, planeStress=True, thickness=h)
66 simu = Simulations.Elastic(mesh, material)
67
68 simu.add_dirichlet(nodes_x0, [0] * dim, simu.Get_unknowns())
69 simu.add_surfLoad(nodes_xL, [-800 / (h * h)], ["y"])
70
71 sol = simu.Solve()
72 simu.Save_Iter()
73
74 # ----------------------------------------------
75 # Results
76 # ----------------------------------------------
77 print(simu)
78
79 Display.Plot_Mesh(simu, h / 2 / np.abs(sol).max())
80 Display.Plot_BoundaryConditions(simu)
81 Display.Plot_Result(simu, "Svm", nodeValues=True, coef=1 / coef, ncolors=20)
82
83 plt.show()
Total running time of the script: (0 minutes 1.710 seconds)


