Dear Prof. Bangerth,
Thank you very much for your quick response.

>The way to do that would be like you do it now, but *after* you call
>triangulation.prepare_coarsening_and_refinement() because then also those
>cells that will be refined for mesh smoothing purposes will be correctly
flagged.

I thought the pre_refinement signal is called after
prepare_coarsening_and_refinement call in
execute_coarsening_and_refinement. That's why I tried:

template <int dim>
class saveRefinement
{
...
  std::vector<bool> cellRefined;
...
  void operator()()
  {
    triangulation.save_refine_flags(cellRefined);
  }
}
...
saveRefinement<3> SaveRefinement(triangulation);
triangulation.signals.pre_refinement.connect([&SaveRefinement] {
SaveRefinement(); })

/// refine the mesh
....
triangulation.load_coarsen_flags(SaveRefinement.cellRefined);
triangulation.execute_coarsening_and_refinement();

At this point, I am hitting Assert(v.size() == n_active_cells(),
ExcGridReadError())   in  load_coarsen_flags.

Which also makes sense to me now, because those flags saved from
save_refine_flags are now parent cells, and I have to mark their child
cells for coarsening.
I will greatly appreciate any hint on how that can be done.

I looked into the Step-26 example. There is another reason I wanted to
refine the mesh based on geometric criteria. In addition to the laser spot,
I would like to refine the mesh near the layer that is being printed at the
given time step. And coarsen the layers underneath it. I am trying to
simulation a layer upon layer printing process following a paper by Claire
Bruna-Rosso et al., who also used deal.ii. They used the FE_Nothing element
to exclude the layers that are yet to be printed from the solution.

Thank you,
Kaushik



On Mon, Nov 30, 2020 at 11:27 AM Wolfgang Bangerth <[email protected]>
wrote:

> On 11/30/20 8:33 AM, Kaushik Das wrote:
> >
> > I may be able to write some geometric criteria to figure out which cells
> need
> > coarsening. But I am hoping there is a faster method to do this because
> there
> > must be some way to know which cells got refined and by how much and
> just
> > coarsen them again.
>
> Not really. You'd have to save this information yourself somehow. The way
> to
> do that would be like you do it now, but *after* you call
> triangulation.prepare_coarsening_and_refinement() because then also those
> cells that will be refined for mesh smoothing purposes will be correctly
> flagged.
>
> But in the end, you should refine based on where the solution allows it,
> not
> because the laser spot has moved on. Do it automatically, in a way like we
> do
> in step-26, for example.
>
> Best
>   W.
>
> --
> ------------------------------------------------------------------------
> Wolfgang Bangerth          email:                 [email protected]
>                             www: http://www.math.colostate.edu/~bangerth/
>
> --
> 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 a topic in the
> Google Groups "deal.II User Group" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/dealii/6hhi5Xf0_mQ/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/dealii/b0e798b9-bf73-a3a3-d8d0-7f7d9783d274%40colostate.edu
> .
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/CAC-fs6sN12RxyRij2YVY_JgzLCyY6bwQ-qqzsNQEZkJKpWdHqw%40mail.gmail.com.

Reply via email to