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


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