Automatic refinement with minimal level of refinement

16 views
Skip to first unread message

Lucas Campos

unread,
Feb 19, 2018, 7:35:59 AM2/19/18
to deal.II User Group
Dear all,

I am creating a mesh using GridGenerator::hyper_shell. In this mesh, I want to divide the mesh into 
two distinct subdomains, radially. In order to do that, I need to refine the mesh at least once. Each 
of these cells carries an internal state that depends on its kind.

The issue I have is that, while improbable, in theory it is possible for 
GridRefinement::refine_and_coarsen_fixed_number to merge these cells back, which 
would be a mistake. Is there a way either configure the triangulation to consider the once refined 
state the coarsest possible?

The other solution I see is to "manually" input the once-refined mesh and then use 
create_triangulation, but that sounds cumbersome and error-prone.

Bests,
Lucas Campos

luca.heltai

unread,
Feb 19, 2018, 7:37:38 AM2/19/18
to Deal.II Users
After you have created your coarse mesh, you could GridTools::flatten_triangulation it. This will create a brand new coarse triangulation, containing only all your active cells.

L.
> --
> The deal.II project is located at http://www.dealii.org/
> For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en
> ---
> You received this message because you are subscribed to the Google Groups "deal.II User Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to dealii+un...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Lucas Campos

unread,
Feb 19, 2018, 7:45:06 AM2/19/18
to deal.II User Group
Perfect! Thank you!

Wolfgang Bangerth

unread,
Feb 19, 2018, 8:51:51 AM2/19/18
to dea...@googlegroups.com
On 02/19/2018 05:37 AM, luca.heltai wrote:
> After you have created your coarse mesh, you could GridTools::flatten_triangulation it. This will create a brand new coarse triangulation, containing only all your active cells.

Alternatively, between the call to GridRefinement::refine_...() and
Triangulation::execute_coarsening_and_refinement(), you can go over all cells
and call
if (cell->level() == 1
&&
cell->coarsen_flag_set())
cell->clear_coarsen_flag()

This makes sure that once refined cells will never be coarsened again.

Best
W.

--
------------------------------------------------------------------------
Wolfgang Bangerth email: bang...@colostate.edu
www: http://www.math.colostate.edu/~bangerth/

Reply all
Reply to author
Forward
0 new messages