Is there information about cell level during adaptation ?

5 months ago by
I want to adapt my mesh in a time dependent simulation. I dont want to refine an initial cell more than a certain number of times. So the initial cell would be at level zero, its children at level one, and so on. Is such level information available in the mesh and how to get it ?
Community: FEniCS Project

1 Answer

4 months ago by

I never found anything about cell levels. This would require some kind of mesh hierarchy concept which doesn't exist in fenics.

As a work-around for my project, I made an option restricting the minimum cell size. So I do roughly

def unmark_cells_exceeding_minimum_circumradius(mesh, refine, min_radius):

    for cell in fenics.cells(mesh):
        if not refine[cell]:
        if cell.circumradius() <= min_radius:
            refine[cell] = False
    return refine

refine = fenics.CellFunction("bool", mesh)


refine = mark_cells_to_refine(refine, solution)

refine = unmark_cells_exceeding_minimum_circumradius(mesh, refine, min_radius)

mesh = fenics.refine(mesh, refine)

Thank you. I am using similar approach and I refine a cell only if cell.h() > hmin. Is the circumradius a better check for this ?
written 4 months ago by Praveen C  
I would have used h instead of circumradius as well if I knew it existed :) I'm sure there are cases where one of the two might be preferred, but it doesn't matter so much for what I was doing.
written 4 months ago by Alexander G. Zimmerman  
Please login to add an answer/comment or follow this question.

Similar posts:
Search »