Correct way to mesh OCC cylinder
Hi,
Apologies if this is a trivial question, but what is the correct way to mesh a cylinder constructed using OCC when using Algorithm = 8
(structured)?
Using setSize
seems to generate very thin vertical elements and MeshSizeFromCurvature
only helps when using large values (e.g. 50). I have also tried the method (getBoundary
) from t16.py.
Thanks, John
import gmsh
import sys
gmsh.initialize()
model = gmsh.model
occ = model.occ
radius = 0.2
occ.addCylinder(0,0,0, 0, 1, 0, radius)
vols = occ.getEntities(3)
cylinder = model.addPhysicalGroup(3, [vols[0][1]], tag = 1)
gmsh.model.occ.synchronize()
lc = 5e-03
# Taken from t16.py
model.mesh.setSize(gmsh.model.getBoundary(vols, False, False, True),lc)
# Gives same result
# model.mesh.setSize(occ.getEntities(0), lc)
gmsh.option.setNumber("Mesh.MshFileVersion", 2)
gmsh.option.setNumber("Mesh.Algorithm", 8)
# Set curvature only seems to help with using a large value
# gmsh.option.setNumber("Mesh.MeshSizeFromCurvature", 50)
gmsh.model.mesh.generate(3)
Edited by John BELL