Hi:
I am new to Deal.ii and reading through the examples to learn more. But I have a question, that I did not find a suitable answer in the example problems.
I am trying to solve a transient heat conduction problem over a domain due to laser heating in an additive manufacturing process. At each time step, I want to refine the mesh at the laser spot and then coarsen the end of the time step and then in the next time step laser spot moves and I can again refine the mesh where the laser is then. I know the position of the laser at all times.
Something like this:
Triangulation<3> triangulation;
GridGenerator::subdivided_hyper_rectangle(triangulation, repetitions, left, right, true);
// Refine the mesh based on some geometric criteria, like material interfaces, near edges, etc.
Loop over time step starts
// Refine at the laser spot
// do calculations.
// coarsen to get back to the state where the mesh was at the beginning of the time step.
Loop ends
I tried two different ways.
1. At the end of the time step, call set_coarsen_flag on those cells that were marked with set_refine_flag at the beginning of the step. But, cells that were refined due to smoothing are left refined which is not desirable.
2. Add a pre_refinement signal and then save the save_refine_flags during refinement and then load_coarsen_flags that vector<bool> from the save_refine_flags call. But here I am getting assert failure on mismatched size of that vector and the active number of cells whining calling execute_coarsening_and_refinement to do the coarsening.
I also thought of using the persistenttrainregulation class, but I am not sure if that covers my use-case.
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.
Thank you very much.
-Kaushik