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


/home/docs/checkouts/readthedocs.org/user_builds/easyfea/envs/v1.6.3/lib/python3.11/site-packages/EasyFEA/utilities/PyVista.py:952: PyVistaDeprecationWarning:
../../../../envs/v1.6.3/lib/python3.11/site-packages/EasyFEA/utilities/PyVista.py:952: Arguments 'pointa', 'pointb', 'center' must be passed as keyword arguments to function 'CircularArc'.
From version 0.50, passing these as positional arguments will result in a TypeError.
return pv.CircularArc(
/home/docs/checkouts/readthedocs.org/user_builds/easyfea/envs/v1.6.3/lib/python3.11/site-packages/EasyFEA/utilities/PyVista.py:975: PyVistaDeprecationWarning:
../../../../envs/v1.6.3/lib/python3.11/site-packages/EasyFEA/utilities/PyVista.py:975: Arguments 'pointa', 'pointb', 'center' must be passed as keyword arguments to function 'CircularArc'.
From version 0.50, passing these as positional arguments will result in a TypeError.
arc1 = pv.CircularArc(geom.pt1.coord, geom.pt3.coord, geom.center.coord)
/home/docs/checkouts/readthedocs.org/user_builds/easyfea/envs/v1.6.3/lib/python3.11/site-packages/EasyFEA/utilities/PyVista.py:976: PyVistaDeprecationWarning:
../../../../envs/v1.6.3/lib/python3.11/site-packages/EasyFEA/utilities/PyVista.py:976: Arguments 'pointa', 'pointb', 'center' must be passed as keyword arguments to function 'CircularArc'.
From version 0.50, passing these as positional arguments will result in a TypeError.
arc2 = pv.CircularArc(
12 from EasyFEA import Display, ElemType, np, PyVista
13 from EasyFEA.Geoms import Point, Points, Circle, Line
14
15 if __name__ == "__main__":
16 Display.Clear()
17
18 width = 1
19 height = 2
20 radius = 1
21
22 meshSize = width / 5
23
24 pt1 = Point(radius, 0, r=width / 3)
25 pt2 = Point(radius + width, 0, r=width / 3)
26 pt3 = Point(radius + width, height, r=-width / 3)
27 pt4 = Point(radius, height, r=-width / 3)
28
29 contour = Points([pt1, pt2, pt3, pt4], meshSize)
30
31 circle1 = Circle(Point(width / 2 + radius, height * 1 / 4), width / 3, width / 10)
32 circle2 = Circle(Point(width / 2 + radius, height * 3 / 4), width / 3, width / 10)
33 circle3 = Circle(
34 Point(width / 2 + radius, height / 2), width / 3, width / 10, False
35 )
36 inclusions = [circle1, circle2, circle3]
37
38 axis = Line(Point(), Point(radius / 3, height))
39 axis.name = "rot axis"
40
41 plotter = PyVista.Plot_Geoms([contour, *inclusions, axis]).show()
42
43 angle = 360 * 4 / 6
44
45 perimeter = angle * np.pi / 180 * radius
46
47 layers = [perimeter // meshSize]
48
49 mesh = contour.Mesh_Revolve(inclusions, axis, angle, layers, ElemType.PRISM6)
50 PyVista.Plot_Mesh(mesh).show()
Total running time of the script: (0 minutes 0.957 seconds)