We struggle to find out how to use
GridRefinement::refine_and_coarsen_optimize (
documentation)
appropriately. We couldn't find an application in one of the deal.ii
tutorials, so we felt free to contact this mailing list.
So far, we have assumed it's supposed to be used as a follow-up to
another refinement strategy, e.g.
GridRefinement::refine_and_coarsen_fixed_number to optimize the new
refinement.
However, this approach resulted in an error when it tried to refine a
cell previously flagged for coarsening:
An error occurred in line <3085> of file
</home/zam/boltersd/jufire_April/bundled/dealii/include/deal.II/grid/tria_accessor.templates.h>
in function
void dealii::CellAccessor<dim,
spacedim>::set_refine_flag(dealii::RefinementCase<dim>) const [with int
dim = 2; int spacedim = 2]
The violated condition was:
!coarsen_flag_set()
Additional information:
(none)
Looking at its source code, the function does not set coarsen flags at
all despite being named refine_and_coarsen_optimize, so we initially
thought it mighty only be applicable as an iterative procedure to find a
suitable mesh like in tutorial step-6. However, if we understood
correctly, Thomas Richter implemented this algorithm for his PhD thesis
on time-dependent problems, which, in our opinion, would also require
mesh coarsening during simulations.
We'd be hugely grateful if someone with more experience could tell us
how to use refine_and_coarsen_optimize correctly.