Hexahedral mesh of cylinder

Hi, I want to create a hexahedral mesh model of a cylinder.

I tried the following code using OCC, but got a error “Meshing failed!” .
If quad_dominated=true is not written, a tetrahedral mesh is created.

cyl = Cylinder(Pnt(0,0,0), Z, r=1, h=0.2
geo = OCCGeometry(cyl)
mesh = Mesh(geo.GenerateMesh(maxh=0.1, quad_dominated=True))
mesh.Curve(3)
Draw (mesh)

Could someone please advice me, if there is any other way to do it?

Hi Naoto,
Netgen does not support hex-meshing of arbitrary domaines.
However, you can generate hex-dominated meshes for extruded domains, here is an example:

cyl = Cylinder ((0,0,0), Z, r=1, h=1, bottom="bot", top="top")
cyl.faces.Min(Z).Identify(cyl.faces.Max(Z), "bot-top", type=IdentificationType.CLOSESURFACES)
Draw(cyl);
ngmesh = OCCGeometry(cyl).GenerateMesh(maxh=0.3, quad_dominated=True)
ngmesh.ZRefine("bot-top", [0.25,0.5,0.75])
mesh = Mesh(ngmesh)
Draw(mesh);

best, Joachim

Thank you for also showing the code!
With your help I was able to create the model as I wished :slight_smile: