Note
Go to the end to download the full example code.
HyperElastic2#
A hyper elastic cube in compression.


At Newton iteration 1 norm is 3.873448821042e-01
At Newton iteration 2 norm is 9.538664605952e-03
At Newton iteration 3 norm is 8.884193859163e-04
At Newton iteration 4 norm is 5.678328312556e-05
At Newton iteration 5 norm is 4.665333617484e-07
12 from EasyFEA import Display, ElemType, Models, Simulations, PyVista
13 from EasyFEA.Geoms import Domain
14
15 if __name__ == "__main__":
16 Display.Clear()
17
18 # ----------------------------------------------
19 # Configuration
20 # ----------------------------------------------
21
22 # geom
23 L = 1
24 h = 1
25
26 # ----------------------------------------------
27 # Mesh
28 # ----------------------------------------------
29 meshSize = h / 10
30
31 contour = Domain((0, 0), (L, h), h / 10)
32
33 mesh = contour.Mesh_Extrude(
34 [], [0, 0, h], [h / meshSize], ElemType.HEXA8, isOrganised=True
35 )
36
37 nodesX0 = mesh.Nodes_Conditions(lambda x, y, z: x == 0)
38 nodesXL = mesh.Nodes_Conditions(lambda x, y, z: x == L)
39
40 # ----------------------------------------------
41 # Simulation
42 # ----------------------------------------------
43
44 isot = Models.ElasIsot(3, E=1, v=0.3)
45 lmbda = isot.get_lambda()
46 mu = isot.get_mu()
47 mat = Models.SaintVenantKirchhoff(3, lmbda, mu)
48
49 simu = Simulations.HyperElasticSimu(mesh, mat)
50
51 uc = -0.3
52 simu.add_dirichlet(nodesX0, [0, 0, 0], simu.Get_unknowns())
53 simu.add_dirichlet(nodesXL, [uc, 0, 0], simu.Get_unknowns())
54
55 simu.Solve()
56
57 # ----------------------------------------------
58 # Results
59 # ----------------------------------------------
60
61 PyVista.Plot_BoundaryConditions(simu).show()
62 PyVista.Plot(simu, "ux", 1, plotMesh=True).show()
Total running time of the script: (0 minutes 1.713 seconds)