That worked! And it was fairly easy to implement. Thank you very much Magdalena.
However, it does not seem to apply the initial solution I specify to the recently activated elements ( solution = 50. ), it initializes them to solution = 0. This is how I am doing it: parallel::distributed::SolutionTransfer< dim, Vector<double>> solution_trans(dof_handler, true); Vector<double> previous_solution; previous_solution = solution; triangulation.prepare_coarsening_and_refinement(); solution_trans.prepare_for_coarsening_and_refinement(previous_solution); if (timestep_number == 25){ activate_FEs(); // using set_future_FE_index() } triangulation.execute_coarsening_and_refinement(); setup_system(); if (timestep_number == 25){ solution = 50.; } solution_trans.interpolate(solution); I guess I will have to set the initial solution in the activated elements myself with a function. Regards, El lunes, 22 de enero de 2024 a las 8:06:44 UTC, schreter....@gmail.com escribió: > Hi, > > we recently faced a similar problem and do not have a clean solution yet. > What you could try is to use a parallel::distributed::Triangulation and the > corresponding parallel::distributed::SolutionTransfer class (see > https://www.dealii.org/developer/doxygen/deal.II/classparallel_1_1distributed_1_1SolutionTransfer.html#aebd38d82f946a96118f73e4e26defd61). > > Compared to the serial SolutionTransfer, it offers an additional > constructor argument > `const bool average_values=false` which you can set to true. Then the > assert will hopefully not be triggered, because the conflicting values are > averaged. Of course you have to decide yourself if the obtained values are > still feasible for your computations. > > Best, > Magdalena > luis....@gmail.com schrieb am Sonntag, 21. Januar 2024 um 22:37:19 UTC+1: > >> I have even tried to do add an initial solution like in this test: >> https://github.com/dealii/dealii/blob/e741ba5c864b5b273dead339480d9145badcadf5/tests/hp/solution_transfer_16.cc#L4 >> >> triangulation.execute_coarsening_and_refinement(); >> if (timestep_number == 10){ >> activate_FEs(); >> } >> setup_system(); >> if (timestep_number == 10){ >> solution.reinit(dof_handler.n_dofs()); >> solution = 1.; >> } >> solution_trans.interpolate(previous_solution, solution); >> >> but still the same error >> El domingo, 21 de enero de 2024 a las 21:18:41 UTC, luis miguel reig >> buades escribió: >> >>> Thank you very much for the suggestion Marc, but no luck :( >>> >>> I activated domination like this: >>> fe_collection.push_back(FE_Nothing<dim>(1, true)); >>> >>> But got the same interpolation error: >>> >>> An error occurred in line <155> of file >>> </build/deal.ii-o0wOgt/deal.ii-9.5.1/source/dofs/dof_accessor_set.cc> in >>> function >>> void dealii::internal::set_dof_values(const >>> dealii::DoFCellAccessor<dim, spacedim, level_dof_access>&, const >>> dealii::Vector<number>&, OutputVector&, bool) [with int dim = 2; int >>> spacedim = 2; bool lda = false; OutputVector = dealii::Vector<double>; >>> number = double] >>> >>> The violated condition was: >>> local_values_old[i] == number() || get_abs(local_values_old[i] - >>> local_values[i]) <= get_abs(local_values_old[i] + local_values[i]) * >>> 100000. * std::numeric_limits<typename numbers::NumberTraits< >>> number>::real_type>::epsilon() >>> Additional information: >>> Called set_dof_values_by_interpolation(), but the element to be set, >>> value 0, does not match with the non-zero value 0.001508036671432333 >>> already set before. >>> >>> >>> >>> El domingo, 21 de enero de 2024 a las 20:24:30 UTC, mafe...@gmail.com >>> escribió: >>> >>>> Just a shot in the dark: Will it work if you set your FE_Nothing >>>> elements to be dominating? >>>> >>>> https://www.dealii.org/developer/doxygen/deal.II/classFE__Nothing.html#a69940158d653b46222943f09c6b25a4c >>>> >>>> Marc >>>> On Thursday, January 18, 2024 at 12:09:02 PM UTC-7 luis....@gmail.com >>>> wrote: >>>> >>>>> Hello Wolfgang, >>>>> >>>>> Yes, I am still getting the same error even using >>>>> cell->set_future_fe_index(0) before executing the refinement. >>>>> I have attached the error and all files needed to reproduce it, but >>>>> anything that concerns us is in main.cc. >>>>> >>>>> the code is a mix between step-26 and step-27 to add elements during >>>>> the computation. >>>>> >>>>> To do so, I set some elements with FE_Nothing and the beggining and >>>>> then, inside the method refine_mesh, I activate them at a given >>>>> time_step using set_future_fe_index as suggested by Bruno before >>>>> executing triangulation.execute_coarsening_and_refinement() >>>>> See: >>>>> if (timestep_number == 25) activate_FEs(); >>>>> triangulation.execute_coarsening_and_refinement(); >>>>> setup_system(); >>>>> solution_trans.interpolate(previous_solution, solution); >>>>> >>>>> when performing the interpolation with >>>>> solution_trans.interpolate(previous_solution, >>>>> solution); it gives me the error. >>>>> >>>>> Thank you for the time, >>>>> El jueves, 18 de enero de 2024 a las 18:15:08 UTC, Wolfgang Bangerth >>>>> escribió: >>>>> >>>>>> On 1/18/24 03:28, luis miguel reig buades wrote: >>>>>> > >>>>>> > However, it does not seem to solve the interpolation problem, I am >>>>>> assuming >>>>>> > the error happens because I did not assign an initial solution to >>>>>> the >>>>>> > activated elements. >>>>>> > Is there any way to assign the activated elements a solution as I >>>>>> am looping >>>>>> > through the cells and activating them? I have not been able to find >>>>>> this >>>>>> >>>>>> Are you saying that you continue to get the same error, even with the >>>>>> switched >>>>>> order of operations? Can you show us the code you use, and the error >>>>>> you get? >>>>>> >>>>>> Best >>>>>> W. >>>>>> >>>>>> -- >>>>>> ------------------------------------------------------------------------ >>>>>> >>>>>> Wolfgang Bangerth email: bang...@colostate.edu >>>>>> 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 the Google Groups "deal.II User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to dealii+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/0d4c1a42-050f-4614-af5a-c12b87cc9832n%40googlegroups.com.