From 744aff86682162b02bd15d2a8cd9aa6c664d5457 Mon Sep 17 00:00:00 2001 From: Timo Heister Date: Wed, 6 Oct 2021 11:04:46 -0400 Subject: [PATCH] fix bug --- tests/mappings/mapping_q_eulerian_14.cc | 18 +++++++++- ...ulerian_14.with_p4est=true.mpirun=1.output | 17 +++------ ...ulerian_14.with_p4est=true.mpirun=3.output | 35 ++++++++++++------- ...ulerian_14.with_p4est=true.mpirun=4.output | 35 +++++++++++++++++++ 4 files changed, 80 insertions(+), 25 deletions(-) diff --git a/tests/mappings/mapping_q_eulerian_14.cc b/tests/mappings/mapping_q_eulerian_14.cc index be74c4291b..7bfe86acf7 100644 --- a/tests/mappings/mapping_q_eulerian_14.cc +++ b/tests/mappings/mapping_q_eulerian_14.cc @@ -15,7 +15,9 @@ // test matrix-free Laplace and Mass operators with MappingQEulerian -// on a refined mesh that triggered the following bug with 4 MPI ranks: +// on a refined mesh that triggered the bug below with 4 MPI +// ranks. This is due to a smaller set of ghost indices used by +// interpolate_to_mg. // clang-format off /* @@ -246,6 +248,20 @@ test(const unsigned int n_ref = 0) const unsigned int min_level = 0; MGLevelObject> displacement_level(min_level, max_level); + + // Important! This preallocation of the displacement vectors fixes + // the bug observed. + for (unsigned int level = min_level; level <= max_level; ++level) + { + IndexSet relevant_mg_dofs; + DoFTools::extract_locally_relevant_level_dofs(dof_handler_euler, + level, + relevant_mg_dofs); + displacement_level[level].reinit(dof_handler_euler.locally_owned_mg_dofs( + level), + relevant_mg_dofs, + mpi_communicator); + } mg_transfer_euler.interpolate_to_mg(dof_handler_euler, displacement_level, displacement); diff --git a/tests/mappings/mapping_q_eulerian_14.with_p4est=true.mpirun=1.output b/tests/mappings/mapping_q_eulerian_14.with_p4est=true.mpirun=1.output index 1177cf30be..891e162750 100644 --- a/tests/mappings/mapping_q_eulerian_14.with_p4est=true.mpirun=1.output +++ b/tests/mappings/mapping_q_eulerian_14.with_p4est=true.mpirun=1.output @@ -1,15 +1,8 @@ -DEAL:2d::refine... -DEAL:2d::refine... -DEAL:2d::refine... -DEAL:2d::Checksum: 4107161474 +DEAL:0::refine... +DEAL:0::refine... +DEAL:0::refine... +DEAL:0::Checksum: 4107161474 n_active_cells: 520 n_levels: 3 -DEAL:2d::Mass operator: -DEAL:2d::l2_norm: 0.00000 -DEAL:2d::l1_norm: 0.00000 -DEAL:2d::linfty_norm: 0.00000 -DEAL:2d::Laplace operator: -DEAL:2d::l2_norm: 0.00000 -DEAL:2d::l1_norm: 0.00000 -DEAL:2d::linfty_norm: 0.00000 +DEAL:0::Ok diff --git a/tests/mappings/mapping_q_eulerian_14.with_p4est=true.mpirun=3.output b/tests/mappings/mapping_q_eulerian_14.with_p4est=true.mpirun=3.output index 15fea44d2a..cdc5e13fd8 100644 --- a/tests/mappings/mapping_q_eulerian_14.with_p4est=true.mpirun=3.output +++ b/tests/mappings/mapping_q_eulerian_14.with_p4est=true.mpirun=3.output @@ -1,15 +1,26 @@ -DEAL:2d::refine... -DEAL:2d::refine... -DEAL:2d::refine... -DEAL:2d::Checksum: 4107161474 +DEAL:0::refine... +DEAL:0::refine... +DEAL:0::refine... +DEAL:0::Checksum: 4107161474 n_active_cells: 307 n_levels: 3 -DEAL:2d::Mass operator: -DEAL:2d::l2_norm: 0.00000 -DEAL:2d::l1_norm: 0.00000 -DEAL:2d::linfty_norm: 0.00000 -DEAL:2d::Laplace operator: -DEAL:2d::l2_norm: 0.00000 -DEAL:2d::l1_norm: 0.00000 -DEAL:2d::linfty_norm: 0.00000 +DEAL:0::Ok + +DEAL:1::refine... +DEAL:1::refine... +DEAL:1::refine... +DEAL:1::Checksum: 0 +n_active_cells: 373 +n_levels: 3 +DEAL:1::Ok + + +DEAL:2::refine... +DEAL:2::refine... +DEAL:2::refine... +DEAL:2::Checksum: 0 +n_active_cells: 310 +n_levels: 3 +DEAL:2::Ok + diff --git a/tests/mappings/mapping_q_eulerian_14.with_p4est=true.mpirun=4.output b/tests/mappings/mapping_q_eulerian_14.with_p4est=true.mpirun=4.output index e69de29bb2..a64acfa2dc 100644 --- a/tests/mappings/mapping_q_eulerian_14.with_p4est=true.mpirun=4.output +++ b/tests/mappings/mapping_q_eulerian_14.with_p4est=true.mpirun=4.output @@ -0,0 +1,35 @@ + +DEAL:0::refine... +DEAL:0::refine... +DEAL:0::refine... +DEAL:0::Checksum: 4107161474 +n_active_cells: 259 +n_levels: 3 +DEAL:0::Ok + +DEAL:1::refine... +DEAL:1::refine... +DEAL:1::refine... +DEAL:1::Checksum: 0 +n_active_cells: 301 +n_levels: 3 +DEAL:1::Ok + + +DEAL:2::refine... +DEAL:2::refine... +DEAL:2::refine... +DEAL:2::Checksum: 0 +n_active_cells: 271 +n_levels: 3 +DEAL:2::Ok + + +DEAL:3::refine... +DEAL:3::refine... +DEAL:3::refine... +DEAL:3::Checksum: 0 +n_active_cells: 259 +n_levels: 3 +DEAL:3::Ok + -- 2.39.5