Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a bug in mg ghost layer with periodicity and n_levels=1 #9781

Merged
merged 3 commits into from Mar 30, 2020

Conversation

kronbichler
Copy link
Member

This PR fixes a subtle bug in the setup of the level subdomain ids in the ghost layer of the multigrid levels: If we have a mesh with one single level (i.e., not refined, and a case where multigrid may not make much sense), we forgot to identify cells behind periodic boundaries as level ghost cells; this makes downstream multigrid data structures to break down.

The fix is to move the code that sets the periodic data structures before we call

copy_local_forest_to_triangulation();

Otherwise the code inside this call, namely the one that identifies the appropriate cells and vertices here:
std::vector<std::vector<bool>> marked_vertices(this->n_levels());
for (unsigned int lvl = 0; lvl < this->n_levels(); ++lvl)
marked_vertices[lvl] = mark_locally_active_vertices_on_level(lvl);
for (typename Triangulation<dim, spacedim>::cell_iterator cell =
this->begin(0);
cell != this->end(0);
++cell)
{
typename dealii::internal::p4est::types<dim>::quadrant
p4est_coarse_cell;
const unsigned int tree_index =
coarse_cell_to_p4est_tree_permutation[cell->index()];
typename dealii::internal::p4est::types<dim>::tree *tree =
init_tree(cell->index());
dealii::internal::p4est::init_coarse_quadrant<dim>(
p4est_coarse_cell);
determine_level_subdomain_id_recursively<dim, spacedim>(
*tree,
tree_index,
cell,
p4est_coarse_cell,
*parallel_forest,
this->my_subdomain,
marked_vertices);

does not include the periodic neighbors for a triangulation immediately after add_periodicity.

This was not a problem when we refined the mesh, as then the periodicity has already been set.

FYI @nfehn

@kronbichler kronbichler changed the title Bug mg ghost layer periodic Fix a bug in mg ghost layer with periodicity and n_levels=1 Mar 30, 2020
Copy link
Member

@tjhei tjhei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This look good to me. I hope the multigrid algorithm failed in an obvious way?

@kronbichler
Copy link
Member Author

Yes, deadlock for DG. For continuous elements we got an error in MGConstrainedDoFs that we were trying to get dofs on artificial cells.

@tjhei
Copy link
Member

tjhei commented Mar 30, 2020

Yes, deadlock for DG. For continuous elements we got an error in MGConstrainedDoFs that we were trying to get dofs on artificial cells.

I guess that is good enough. :-)

@drwells drwells merged commit 7bcd14e into dealii:master Mar 30, 2020
@kronbichler kronbichler deleted the bug_mg_ghost_layer_periodic branch October 1, 2020 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants