Revolve VS Twist
Hi all,
I want to create a rotating geometry, where I first define a face and use the revolve or twist function to create the rotating volume. When I use the twist function, it works as I want (see the example below). Since I have only rotation and no translation, I can use the revolve function too, with the same arguments as for the twist function, but leave the translation (dx, dy, dz) out. In my understanding, revolve shall do the same as twist with no translation, but unfortunately the revolve function gives me an error during the meshing. Also for the meshing with OCC the revolve gives an error. Since OCC does not provide twist, only revolve can be used.
Do you have any ideas what may be wrong in the code? Below you can see my example. Thanks in advance for your help!
Best, Mario
import gmsh
import math
import sys
gmsh.initialize()
gmsh.model.add("rotate")
do_with_occ = False
angle_of_rotation = math.pi / 2
if do_with_occ:
geo = gmsh.model.occ
c1 = geo.addCircle(0,0,0, 0.25)
cl1 = geo.addCurveLoop([c1])
ps1 = geo.addPlaneSurface([cl1])
ps1revolved = geo.revolve([(2, ps1)], 0, 0, 1 , 0, 0, 1, angle_of_rotation, [], [], False)
else:
geo = gmsh.model.geo
lc = 0.05
p1 = geo.addPoint(0, 0, 0, lc)
p2 = geo.addPoint(0.25, 0, 0, lc)
p3 = geo.addPoint(0, 0.25, 0, lc
p4 = geo.addPoint(-0.25, 0, 0, lc)
p5 = geo.addPoint(0, -0.25, 0, lc)
l1 = geo.addCircleArc(p2, p1, p3)
l2 = geo.addCircleArc(p3, p1, p4)
l3 = geo.addCircleArc(p4, p1, p5)
l4 = geo.addCircleArc(p5, p1, p2)
cl1 = geo.addCurveLoop([l1, l2, l3, l4])
ps1 = geo.addPlaneSurface([cl1])
# twist function works as desired
#ps1twisted = geo.twist([(2, ps1)], 0, 0, 0, 0, 0, 1, 0, 0, 1, angle_of_rotation, [], [], False)
# revolve function gives an error
ps1revolved = geo.revolve([(2,ps1)], 0, 0, 1, 0, 0, 1, angle_of_rotation)
geo.synchronize()
gmsh.model.mesh.generate(3)
gmsh.option.setNumber("Mesh.MshFileVersion", 2)
gmsh.write("rotate.msh")
# Launch the GUI to see the results:
if '-nopopup' not in sys.argv:
gmsh.fltk.run()
gmsh.finalize()