Threshold operator creating random refinement spots
Hi All,
I am working with gmsh threshold function and I notice something strange with the threshold operator.
Originally, I have a very nice-looking uniform mesh:
Then, I tried to refine the mesh near the building surface with:
# Calculate Distance from building
gmsh.model.mesh.field.add("Distance", 6)
gmsh.model.mesh.field.setNumbers(6, "SurfacesList", building_surfs)
gmsh.model.mesh.field.setNumber(6, "NumPointsPerCurve", 1e2)
gmsh.model.mesh.field.add("Threshold", 7)
gmsh.model.mesh.field.setNumber(7, "InField", 6)
gmsh.model.mesh.field.setNumber(7, "SizeMin", lc_b)
gmsh.model.mesh.field.setNumber(7, "SizeMax", lc4)
gmsh.model.mesh.field.setNumber(7, "DistMin", 2*lc_b)
gmsh.model.mesh.field.setNumber(7, "DistMax", 2*lc_b + 1*lc4)
gmsh.model.mesh.field.setNumber(7, "Sigmoid", 1)
gmsh.model.mesh.field.setNumber(7, "StopAtDistMax", 1)
gmsh.model.mesh.field.add("Min", 10)
gmsh.model.mesh.field.setNumbers(10, "FieldsList", [1, 2, 3, 5, 7])
gmsh.model.mesh.field.setAsBackgroundMesh(10)
This successfully create finer cells near the building. But when I zoomed out, I noticed it also created many random patches with very fine mesh throughout the model. This was not expected as I set "StopAtDistMax" to 1 and the DistMax was set to be very small. Now the mesh looks quite weird and non-uniform. Is there any workaround to limit the effect of the Threshold operator?
Here is the script to reproduce the issue: 2021_corner_cut_simple.py
Thanks, Jack
Edited by Jack Wong