Hyperelas2#

A hyper elastic cube in compression.

Hyperelas2
Hyperelas2
===== hyperelastic problem at iteration 0 =====
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.665333617495e-07

12 import numpy as np
13
14 from EasyFEA import Display, ElemType, Models, Simulations, PyVista
15 from EasyFEA.Geoms import Domain
16
17 if __name__ == "__main__":
18     Display.Clear()
19
20     # ----------------------------------------------
21     # Configuration
22     # ----------------------------------------------
23     dim = 3
24
25     # geom
26     L = 1
27     h = 1
28
29     # ----------------------------------------------
30     # Mesh
31     # ----------------------------------------------
32     meshSize = h / 10
33
34     contour = Domain((0, 0), (L, h), h / 10)
35
36     if dim == 2:
37         mesh = contour.Mesh_2D([], ElemType.QUAD8, isOrganised=True)
38     else:
39         mesh = contour.Mesh_Extrude(
40             [], [0, 0, h], [h / meshSize], ElemType.HEXA8, isOrganised=True
41         )
42
43     nodesX0 = mesh.Nodes_Conditions(lambda x, y, z: x == 0)
44     nodesXL = mesh.Nodes_Conditions(lambda x, y, z: x == L)
45
46     # ----------------------------------------------
47     # Simulation
48     # ----------------------------------------------
49
50     isot = Models.Elastic.Isotropic(dim, E=1, v=0.3)
51     lmbda = isot.get_lambda()
52     mu = isot.get_mu()
53     mat = Models.HyperElastic.SaintVenantKirchhoff(dim, lmbda, mu, thickness=h)
54
55     simu = Simulations.HyperElastic(mesh, mat)
56
57     uc = -0.3
58     simu.add_dirichlet(nodesX0, [0] * dim, simu.Get_unknowns())
59     values = np.zeros_like(simu.Get_unknowns(), dtype=float)
60     values[0] = uc
61     simu.add_dirichlet(nodesXL, values, simu.Get_unknowns())
62
63     simu.Solve()
64
65     # ----------------------------------------------
66     # Results
67     # ----------------------------------------------
68
69     PyVista.Plot_BoundaryConditions(simu).show()
70     PyVista.Plot(simu, "ux", 1, plotMesh=True).show()

Total running time of the script: (0 minutes 2.582 seconds)

Gallery generated by Sphinx-Gallery