Mesh11#

Meshing of a specimen for a spatially oriented tensile test.

Mesh11
Mesh11
12 import numpy as np
13
14 from EasyFEA import Display, ElemType, PyVista
15 from EasyFEA.Geoms import Point, Line, CircleArc, Contour, Domain
16
17 if __name__ == "__main__":
18     Display.Clear()
19
20     # ----------------------------------------------
21     # Configuration
22     # ----------------------------------------------
23
24     # geom
25     L = 1
26     H = 2
27     e = L * 0.5
28
29     # ----------------------------------------------
30     # Mesh
31     # ----------------------------------------------
32
33     p1 = Point(-L / 2)
34     p2 = Point(L / 2)
35     p3 = p2 + [0, H]
36     p4 = p1 + [0, H]
37
38     p5 = Point(e / 2, H / 2)
39     p6 = Point(-e / 2, H / 2)
40
41     l1 = Line(p1, p2)
42     l2 = CircleArc(p2, p3, P=p5)
43     l3 = Line(p3, p4)
44     l4 = CircleArc(p4, p1, P=p6)
45
46     contour = Contour([l1, l2, l3, l4])
47     contour2 = Domain(p1 - [0, H / 2], p2, isHollow=False)
48     contour3 = contour2.copy()
49     contour3.Translate(dy=H + H / 2)
50
51     surfaces = [contour2, contour3]
52
53     PyVista.Plot_Geoms([contour, *surfaces]).show()
54
55     mesh = contour.Mesh_Extrude(
56         [],
57         [0, 0, e],
58         [3],
59         isOrganised=True,
60         elemType=ElemType.HEXA8,
61         additionalSurfaces=surfaces,
62     )
63
64     # ----------------------------------------------
65     # Update coords
66     # ----------------------------------------------
67
68     oldArea = mesh.area
69     mesh.Rotate(-45, mesh.center)
70     assert np.abs(mesh.area - oldArea) / oldArea <= 1e-12
71     mesh.Rotate(45, mesh.center, (1, 0))
72     assert np.abs(mesh.area - oldArea) / oldArea <= 1e-12
73
74     PyVista.Plot_Mesh(mesh).show()

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

Gallery generated by Sphinx-Gallery