I would like to refine the mesh specifically near the four corners of a 2D square. The mesh density should gradually increase from the center towards the corners using a predefined function. My goal is to define the mesh size based on the position of each mesh point. Does the mesh.SetRefinementFlag
function achieve this? Thanks a lot.
1 Like
This should be doable by using coarse meshing parameters and setting the h on a relatively fine grid in the localh tree:
mp = meshsize.very_coarse
for xi in np.linspace(0,1,100):
for yi in np.linspace(0,1,100):
mp.RestrictH(xi,yi,0,meshsize_func(xi,yi))
mesh = geo.GenerateMesh(mp)
You can flag also occ-vertices (or edges or faces) for local refinement, see this
example.
The transition from fine to coarse is controlled by the meshing-parameter grading
Thank you so much. It works well.
Thank you so much. It also works.