Note
Go to the end to download the full example code.
HelloWorld#
A cantilever beam undergoing bending deformation.
12 from EasyFEA import Display, ElemType, Models, Simulations
13 from EasyFEA.Geoms import Domain
14
15 # ----------------------------------------------
16 # Mesh
17 # ----------------------------------------------
18 L = 120 # mm
19 h = 13
20
21 domain = Domain((0, 0), (L, h), h / 3)
22 mesh = domain.Mesh_2D([], ElemType.QUAD9, isOrganised=True)
23
24 # ----------------------------------------------
25 # Simulation
26 # ----------------------------------------------
27 E = 210000 # MPa
28 v = 0.3
29 F = -800 # N
30
31 mat = Models.ElasIsot(2, E, v, planeStress=True, thickness=h)
32
33 simu = Simulations.ElasticSimu(mesh, mat)
34
35 nodesX0 = mesh.Nodes_Conditions(lambda x, y, z: x == 0)
36 nodesXL = mesh.Nodes_Conditions(lambda x, y, z: x == L)
37
38 simu.add_dirichlet(nodesX0, [0, 0], ["x", "y"])
39 simu.add_surfLoad(nodesXL, [F / h / h], ["y"])
40
41 simu.Solve()
42
43 # ----------------------------------------------
44 # Results
45 # ----------------------------------------------
46 Display.Plot_Mesh(simu, deformFactor=10)
47 Display.Plot_BoundaryConditions(simu)
48 Display.Plot_Result(simu, "uy", plotMesh=True)
49 Display.Plot_Result(simu, "Svm", plotMesh=True, ncolors=11)
50
51 Display.plt.show()
Total running time of the script: (0 minutes 0.417 seconds)



