I am trying to implement example 26 using Newton's method and Sacado, in order to get a better feeling for the method. As mentioned before, I had problems with retaining the old solution when remeshing. Thus I rewrote my remeshing sequence as template <int dim> void HeatEquation<dim>::refine_mesh () { Vector<float> estimated_error_per_cell (triangulation.n_active_cells ());
KellyErrorEstimator<dim>::estimate (dof_handler, QGauss<dim-1>(fe.degree+1), typename FunctionMap<dim>::type (), present_solution, estimated_error_per_cell); GridRefinement::refine_and_coarsen_fixed_number (triangulation, estimated_error_per_cell, 0.6, 0.4); if (triangulation.n_levels() > max_grid_level) for (auto cell = triangulation.begin_active(max_grid_level); cell != triangulation.end(); ++cell) cell->clear_refine_flag (); for (auto cell = triangulation.begin_active(min_grid_level); cell != triangulation.end_active(min_grid_level); ++cell) cell->clear_coarsen_flag (); triangulation.prepare_coarsening_and_refinement (); SolutionTransfer<dim> solution_transfer(dof_handler); solution_transfer.prepare_for_coarsening_and_refinement( present_solution); triangulation.execute_coarsening_and_refinement(); dof_handler.distribute_dofs(fe); Vector<double> tmp(dof_handler.n_dofs()); solution_transfer.interpolate(present_solution, tmp); present_solution = tmp; solution_transfer.interpolate(old_solution, tmp); old_solution = tmp; set_boundary_values (); constraint_matrix.clear(); DoFTools::make_hanging_node_constraints(dof_handler, constraint_matrix); constraint_matrix.close(); constraint_matrix.distribute (present_solution); constraint_matrix.distribute(old_solution); setup_system (false); } and then I use the same grid both for the new and the old solution for the fe_values.grad_values(). Is that approach correct? I assume it still introduces some errors, but I am not sure if they are responsible for my (wrong) results: It appears as if the heat is never spreading out, but also the maximum temperature is way below the example results, even though I used exactly the same boundary/Input values. <https://lh3.googleusercontent.com/-859t-dJsZwc/WaUo7F_lmKI/AAAAAAAACSs/OsEfEFuTjGU8QGM8k4Z30QjVxfSc8IaFQCLcBGAs/s1600/heat_sacado.gif> -- 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. For more options, visit https://groups.google.com/d/optout.