Hello Phillip,
So SolutionTransfer can't handle coarsening a group of cells with
different FE index?
SolutionTransfer can do this. What I meant was, that you must not change
the FE index during the application of SolutionTransfer.
I do the h-p changes in two different sections, first the
h-refinement/coarsening using SolutionTransfer and then the p-changes
using my own functions ( so the active FE index and n_dofs and
solution
vector changes). The code continues onto the next timestep and
repeats the h- and then p-refinement steps.
This should be OK in general.
GridRefinement::refine_and_coarsen_fixed_number(triangulation,
abs_cell_entropy_flux_density, cell_fraction, cell_fraction,
max_active_cells);
...
Modify refine/coarsen flags to enforce min/max refinement
...
std::vector< Vector<double> > solution_holder(alphadim);
std::vector< Vector<double> > interpolated_holder(alphadim);
std::vector< Vector<double> > entropy_holder(3);
std::vector< Vector<double> > entropy_interpolated_holder(3);
entropy_holder[0] = cell_entropy_density;
entropy_holder[1] = old_cell_entropy_density;
entropy_holder[2] = was_refined;
for(unsigned int k=0; k<alphadim;++k){
solution_holder[k] = solution[k];
}
SolutionTransfer<dim, Vector<double>, hp::DoFHandler<dim> >
soltrans(dof_handler);
SolutionTransfer<dim, Vector<double>, DoFHandler<dim> >
entropytrans(entropy_dof_handler);
triangulation.prepare_coarsening_and_refinement();
soltrans.prepare_for_coarsening_and_refinement(solution_holder);
entropytrans.prepare_for_coarsening_and_refinement(entropy_holder);
triangulation.execute_coarsening_and_refinement();
dof_handler.distribute_dofs(fe_collection);
entropy_dof_handler.distribute_dofs(entropy_fe);
for(unsigned int k=0; k<alphadim;++k){
interpolated_holder[k].reinit(dof_handler.n_dofs());
}
entropy_interpolated_holder[0].reinit(entropy_dof_handler.n_dofs());
entropy_interpolated_holder[1].reinit(entropy_dof_handler.n_dofs());
entropy_interpolated_holder[2].reinit(entropy_dof_handler.n_dofs());
soltrans.interpolate(solution_holder, interpolated_holder);
entropytrans.interpolate(entropy_holder,entropy_interpolated_holder);
for(unsigned int k=0; k<alphadim;++k){
solution[k] = interpolated_holder[k];
}
cell_entropy_density = entropy_interpolated_holder[0];
old_cell_entropy_density = entropy_interpolated_holder[1];
was_refined = entropy_interpolated_holder[2];
...
Perform p-changes
...
Unfortunately, I cannot find an error in this piece of code right now.
Could you simplify the code as much as possible and send it to me
directly? Then I can check in more detail, which vector has the wrong size.
Best Regards,
Markus
_______________________________________________
dealii mailing list http://poisson.dealii.org/mailman/listinfo/dealii