### MeshHierarchy coarsening over mutliple levels?

341
views
1
12 months ago by
Hello,

by applying the coarsening functionality of the MeshHierarchy class, the finest level gets coarsened by one level.
However, I was wondering if it is somehow possible to coarsen the resulting mesh once more.

I tried to set the parent for the finest level manually to say the coarsest level but failed.

mh = MeshHierarchy(mesh)
cell_markers_coarsen = CellFunction("bool", mh.finest())
...
mh = mh.coarsen(cell_markers_coarsen)

mh.finest().set_parent(mh[0])

cell_markers_coarsen = CellFunction("bool", mh.finest())
...
mh = mh.coarsen(cell_markers_coarsen)​

Any ideas?
Community: FEniCS Project

4
12 months ago by
The MeshHierarchy coarsening is very simplistic. It requires that you start from a coarse mesh, and refine down to the finest level that you need. Then you can go back up one level. In practice, you might as well just keep copies of all the Meshes, and if you need to "coarsen", just go back to an earlier one.
I'm a bit confused with "coarsen" and "unrefine".
If I understand it correctly, unrefine goes back completely one level, whereas coarsen goes back one level and then re-refines the level, but without refining the parents of the cells marked for coarsening. (At least I got the impression from the source code that this is what happens).

The problem then is, if cells stay the same over two levels, there is no chance to coarsen them!

If this is the case then in order to be able to coarsen cells back to the 0-th level, I probably need to take the initial mesh and refine a few times manually? This seems very unefficient....
written 12 months ago by Lukas O.
0
12 months ago by
I'm a bit confused with "coarsen" and "unrefine".
If I understand it correctly, unrefine goes back completely one level, whereas coarsen goes back one level and then re-refines the level, but without refining the parents of the cells marked for coarsening. (At least I got the impression from the source code that this is what happens).

The problem then is, if cells stay the same over two levels, there is no chance to coarsen them!

If this is the case then in order to be able to coarsen cells back to the 0-th level, I probably need to take the initial mesh and refine a few times manually? This seems very unefficient....