Python API, graded structured meshes
Hello, I am trying to generate a simple rectangular structured mesh which is graded along two axes using the python API. However, when I run the script below, the mesh lines are curved rather than straight as I would like. I have tried looking through the included tutorials (ex. t6.py) but I have not found any significant difference between my code and the given examples. I have tried using both the OpenCASCADE and built-in CAD kernels and have gotten the same result. I have not been able to find any solutions online or within the known issues.
I am using: Gmsh 4.6.0, Python 3.6.10, Windows 10 Version 2004 (OS Build 19041.329)
Thanks, CR
import gmsh
gmsh.initialize()
gmsh.option.setNumber("General.Terminal", 1)
lc = 1
numCellsY = 8
numCellsX = 8
gradingY = 1.2
gradingX = 1.2
gmsh.model.occ.addPoint(0, 0, 0, lc, 1)
gmsh.model.occ.addPoint(0, 1, 0, lc, 2)
gmsh.model.occ.addPoint(1, 1, 0, lc, 3)
gmsh.model.occ.addPoint(1, 0, 0, lc, 4)
gmsh.model.occ.addLine(1, 2, 1)
gmsh.model.occ.addLine(2, 3, 2)
gmsh.model.occ.addLine(3, 4, 3)
gmsh.model.occ.addLine(4, 1, 4)
gmsh.model.occ.addCurveLoop([1, 2, 3, 4], 5)
gmsh.model.occ.addPlaneSurface([5], 1)
gmsh.model.occ.synchronize()
gmsh.model.mesh.setTransfiniteCurve(1, numCellsY, meshType="Progression", coef=gradingY)
gmsh.model.mesh.setTransfiniteCurve(3, numCellsY, meshType="Progression", coef=1/gradingY)
gmsh.model.mesh.setTransfiniteCurve(2, numCellsX, meshType="Progression", coef=gradingX)
gmsh.model.mesh.setTransfiniteCurve(4, numCellsX, meshType="Progression", coef=-gradingX)
gmsh.model.mesh.setTransfiniteSurface(1, cornerTags=[1, 2, 3, 4])
gmsh.model.mesh.generate(2)
gmsh.model.mesh.recombine()
gmsh.fltk.run()
gmsh.finalize()
Edited by Campbell Rea