Hello all,
I am trying to run this simple scenario. Given an uniform starting mesh for my
time-dependent problem with say 3 levels, I want to adaptively refine the mesh
every 10 number of steps or so. I do my coarsening/refinement based on a
gradient criterion similar to that in step-12. However, I do not want to refine
further than 4 grid levels, and I also do not want to coarsen beyond level 3
(that is i don't want any coarse active cells on level 2 or lower). The code
that I came up looks as follows:
GridRefinement::refine_and_coarsen_fixed_number (triangulation,
gradient_indicator, 0.15, 0.50);
if (triangulation.n_levels() > 3)
{
for (typename Triangulation<dim>::active_cell_iterator
cell = triangulation.begin_active(triangulation.n_levels()-1);
cell != triangulation.end(); ++cell)
cell->clear_refine_flag ();
for (typename Triangulation<dim>::active_cell_iterator
cell = triangulation.begin_active(triangulation.n_levels()-2);
cell != triangulation.end(); ++cell)
cell->clear_coarsen_flag ();
}
else if (triangulation.n_levels() == 3)
{
//this runs the 1st time I adapt the mesh
for (typename Triangulation<dim>::active_cell_iterator
cell = triangulation.begin_active(triangulation.n_levels()-1);
cell != triangulation.end(); ++cell)
cell->clear_coarsen_flag ();
}
When I run this, the refinement behaves okay (does not go beyond level 4), but
there is no coarsening whatsoever (the cells that get refined to level 4 never
"go back" to level 3 even though refine_and_coarsen flags those cells for
coarsening). My guess is it's because of the cell->clear_coarsen_flag() that I
call for all cells on level 3, but how can I fix that? If I remove that then I
get coarsening up to level 1 in some mesh regions, which is far too coarse.
How could I fix this? I am not quite clear on how the refinement/coarsening
algorithms use those flags, i guess...
thanks!
-- Mihai
_______________________________________________
dealii mailing list http://poisson.dealii.org/mailman/listinfo/dealii