Note
Go to the end to download the full example code.
Mesh7#
Meshing a 3D part in revolution.


13 import numpy as np
14
15 from EasyFEA import Display, ElemType, PyVista
16 from EasyFEA.Geoms import Point, Points, Circle, Line
17
18 if __name__ == "__main__":
19 Display.Clear()
20
21 width = 1
22 height = 2
23 radius = 1
24
25 meshSize = width / 5
26
27 pt1 = Point(radius, 0, r=width / 3)
28 pt2 = Point(radius + width, 0, r=width / 3)
29 pt3 = Point(radius + width, height, r=-width / 3)
30 pt4 = Point(radius, height, r=-width / 3)
31
32 contour = Points([pt1, pt2, pt3, pt4], meshSize)
33
34 circle1 = Circle(Point(width / 2 + radius, height * 1 / 4), width / 3, width / 10)
35 circle2 = Circle(Point(width / 2 + radius, height * 3 / 4), width / 3, width / 10)
36 circle3 = Circle(
37 Point(width / 2 + radius, height / 2), width / 3, width / 10, False
38 )
39 inclusions = [circle1, circle2, circle3]
40
41 axis = Line(Point(), Point(radius / 3, height))
42 axis.name = "rot axis"
43
44 plotter = PyVista.Plot_Geoms([contour, *inclusions, axis]).show()
45
46 angle = 360 * 4 / 6
47
48 perimeter = angle * np.pi / 180 * radius
49
50 layers = [perimeter // meshSize]
51
52 mesh = contour.Mesh_Revolve(inclusions, axis, angle, layers, ElemType.PRISM6)
53 PyVista.Plot_Mesh(mesh).show()
Total running time of the script: (0 minutes 0.746 seconds)