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



