Introduction
I want to do adaptive mesh refinement, and keep the meshes nested, which means that every node in the coarser mesh, should also be present in the finer mesh. I have a 2d domain with a circle inside a rectangle, created like this:
domain_width = 10
domain_height = 5
domain.addRectangle(
x=-domain_width / 2,
y=-domain_height,
z=0,
dx=domain_width,
dy=domain_height,
tag=1
)
tag = domain.addDisk(xc = 0,yc = -0.8,zc = 0, rx = 0.2, ry= 0.2)
Then at some point, i create a first mesh and i have a local refinement function which looks like:
circle_cells = cell_markers.indices[cell_markers.values == cicle_tag]
mesh.topology.create_connectivity(mesh.topology.dim,1)
edges = compute_incident_entities(mesh.topology,circle_cells,2,1)
mesh, parent_cell, parent_facet = refine(msh = mesh,edges = edges, option = RefinementOption.parent_cell_and_facet)
mesh.topology.create_connectivity(1, 2)
cell_markers = transfer_meshtag(cell_markers, mesh, parent_cell)
facet_markers = transfer_meshtag(facet_markers, mesh, parent_cell, parent_facet)
The original mesh and the refined mesh:
Problem
I now have the problem that the new points in the refined mesh, are placed at edges of the coarser mesh, therefore, if i refine, the circle will not look more like a circle. The “circle” will keep the same shape.
Desired solution
I want that in the refined mesh, the circle looks more like a circle then in the coarser mesh. So the new nodes should be (partially) placed on the originally defined circle.
Is it possible to achieve this in some way ? It is important that the meshes remain nested. I see functionality for specifying mesh sizes in different subdomains, with the gmsh.model.mesh.field functionality. I could use that mutiple times, then, the circle will look more like a circle in the finer meshes, but i lose the nested property, which is very important for our case.