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



