From 98c6f6b2a09b2b26e1f757e18fd89ac751300a3e Mon Sep 17 00:00:00 2001 From: Lei Qiao Date: Tue, 30 Jun 2015 22:44:38 -0500 Subject: [PATCH] update mpi/refine_and_coarsen_fixed_number_07 and it's output. 1. Increase number of cells by global refinement to weaken influence of float truncation error; 2. Because number of cells increased, construct refinement indicator as test _01 to avoid float overflow; 3. Update test drivers interface because it is too complicated to calculate global number of cells; 4. Update reference output. --- .../mpi/refine_and_coarsen_fixed_number_07.cc | 36 +++++++++---------- ...nd_coarsen_fixed_number_07.mpirun=1.output | 28 +++++++-------- ...d_coarsen_fixed_number_07.mpirun=10.output | 28 +++++++-------- ...nd_coarsen_fixed_number_07.mpirun=4.output | 28 +++++++-------- 4 files changed, 58 insertions(+), 62 deletions(-) diff --git a/tests/mpi/refine_and_coarsen_fixed_number_07.cc b/tests/mpi/refine_and_coarsen_fixed_number_07.cc index ac6f1cbeb4..9f953ae27b 100644 --- a/tests/mpi/refine_and_coarsen_fixed_number_07.cc +++ b/tests/mpi/refine_and_coarsen_fixed_number_07.cc @@ -15,7 +15,7 @@ -// derived from _02, but with maximal cell number limit +// derived from _01, but with maximal cell number limit #include "../tests.h" #include @@ -34,7 +34,7 @@ #include -void test(const unsigned int max_n_cell) +void test(const double max_n_cell_ratio) { unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD); @@ -45,7 +45,7 @@ void test(const unsigned int max_n_cell) sub[1] = 1; GridGenerator::subdivided_hyper_rectangle(static_cast&>(tr), sub, Point<2>(0,0), Point<2>(1,1)); - tr.refine_global (1); + tr.refine_global (3); Vector indicators (tr.dealii::Triangulation<2>::n_active_cells()); { @@ -56,10 +56,12 @@ void test(const unsigned int max_n_cell) if (cell->subdomain_id() == myid) { ++my_cell_index; - indicators(cell_index) = std::pow (10, (float)my_cell_index); + indicators(cell_index) = my_cell_index; } } + const unsigned int max_n_cell = max_n_cell_ratio * tr.n_global_active_cells(); + parallel::distributed::GridRefinement ::refine_and_coarsen_fixed_number (tr, indicators, 0.2, 0.2, max_n_cell); @@ -116,12 +118,8 @@ int main(int argc, char *argv[]) // test effective maximal cell number limit { - const unsigned int max_n_cell = static_cast - (1.1 - * 4 // corresponds to tr.refine_global (1) in 2d - * 5*Utilities::MPI::n_mpi_processes (MPI_COMM_WORLD) // corresponds to definition in function test - + 0.5 // avoid truncation - ); + const double max_n_cell_ratio = 1.1; + if (myid == 0) { std::ofstream logfile("output"); @@ -129,18 +127,17 @@ int main(int argc, char *argv[]) deallog.depth_console(0); deallog.threshold_double(1.e-10); - test(max_n_cell); + test(max_n_cell_ratio); } else - test(max_n_cell); + test(max_n_cell_ratio); } MPI_Barrier(MPI_COMM_WORLD); // cell number already exceeded maximal cell number limit { - const unsigned int max_n_cell = static_cast - (0.8 * 4 * 5*Utilities::MPI::n_mpi_processes (MPI_COMM_WORLD)); + const double max_n_cell_ratio = 0.8; if (myid == 0) { std::ofstream logfile("output", std::ofstream::app); @@ -148,18 +145,17 @@ int main(int argc, char *argv[]) deallog.depth_console(0); deallog.threshold_double(1.e-10); - test(max_n_cell); + test(max_n_cell_ratio); } else - test(max_n_cell); + test(max_n_cell_ratio); } MPI_Barrier(MPI_COMM_WORLD); // test non-effective maximal cell number limit { - const unsigned int max_n_cell = static_cast - (100.0 * 4 * 5*Utilities::MPI::n_mpi_processes (MPI_COMM_WORLD)); + const double max_n_cell_ratio = 100; if (myid == 0) { std::ofstream logfile("output", std::ofstream::app); @@ -167,10 +163,10 @@ int main(int argc, char *argv[]) deallog.depth_console(0); deallog.threshold_double(1.e-10); - test(max_n_cell); + test(max_n_cell_ratio); } else - test(max_n_cell); + test(max_n_cell_ratio); } return (0); diff --git a/tests/mpi/refine_and_coarsen_fixed_number_07.mpirun=1.output b/tests/mpi/refine_and_coarsen_fixed_number_07.mpirun=1.output index 6ff81d403f..527670b7f7 100644 --- a/tests/mpi/refine_and_coarsen_fixed_number_07.mpirun=1.output +++ b/tests/mpi/refine_and_coarsen_fixed_number_07.mpirun=1.output @@ -1,18 +1,18 @@ -DEAL:0::total active cells = 20 -DEAL:0::n_refined = 1 -DEAL:0::n_coarsened = 2 -DEAL:0::total active cells = 23 -DEAL:0::cell number upper limit = 22 +DEAL:0::total active cells = 320 +DEAL:0::n_refined = 14 +DEAL:0::n_coarsened = 15 +DEAL:0::total active cells = 353 +DEAL:0::cell number upper limit = 352 -DEAL:0::total active cells = 20 +DEAL:0::total active cells = 320 DEAL:0::n_refined = 0 -DEAL:0::n_coarsened = 6 -DEAL:0::total active cells = 17 -DEAL:0::cell number upper limit = 16 +DEAL:0::n_coarsened = 86 +DEAL:0::total active cells = 257 +DEAL:0::cell number upper limit = 256 -DEAL:0::total active cells = 20 -DEAL:0::n_refined = 4 -DEAL:0::n_coarsened = 4 -DEAL:0::total active cells = 29 -DEAL:0::cell number upper limit = 2000 +DEAL:0::total active cells = 320 +DEAL:0::n_refined = 64 +DEAL:0::n_coarsened = 64 +DEAL:0::total active cells = 464 +DEAL:0::cell number upper limit = 32000 diff --git a/tests/mpi/refine_and_coarsen_fixed_number_07.mpirun=10.output b/tests/mpi/refine_and_coarsen_fixed_number_07.mpirun=10.output index 8e60c16a21..2bb473b8b1 100644 --- a/tests/mpi/refine_and_coarsen_fixed_number_07.mpirun=10.output +++ b/tests/mpi/refine_and_coarsen_fixed_number_07.mpirun=10.output @@ -1,18 +1,18 @@ -DEAL:0::total active cells = 200 -DEAL:0::n_refined = 10 -DEAL:0::n_coarsened = 20 -DEAL:0::total active cells = 230 -DEAL:0::cell number upper limit = 220 +DEAL:0::total active cells = 3200 +DEAL:0::n_refined = 140 +DEAL:0::n_coarsened = 150 +DEAL:0::total active cells = 3557 +DEAL:0::cell number upper limit = 3520 -DEAL:0::total active cells = 200 +DEAL:0::total active cells = 3200 DEAL:0::n_refined = 0 -DEAL:0::n_coarsened = 50 -DEAL:0::total active cells = 170 -DEAL:0::cell number upper limit = 160 +DEAL:0::n_coarsened = 850 +DEAL:0::total active cells = 2570 +DEAL:0::cell number upper limit = 2560 -DEAL:0::total active cells = 200 -DEAL:0::n_refined = 40 -DEAL:0::n_coarsened = 40 -DEAL:0::total active cells = 317 -DEAL:0::cell number upper limit = 20000 +DEAL:0::total active cells = 3200 +DEAL:0::n_refined = 640 +DEAL:0::n_coarsened = 640 +DEAL:0::total active cells = 4748 +DEAL:0::cell number upper limit = 320000 diff --git a/tests/mpi/refine_and_coarsen_fixed_number_07.mpirun=4.output b/tests/mpi/refine_and_coarsen_fixed_number_07.mpirun=4.output index a611f23de4..7dc0b85c0e 100644 --- a/tests/mpi/refine_and_coarsen_fixed_number_07.mpirun=4.output +++ b/tests/mpi/refine_and_coarsen_fixed_number_07.mpirun=4.output @@ -1,18 +1,18 @@ -DEAL:0::total active cells = 80 -DEAL:0::n_refined = 4 -DEAL:0::n_coarsened = 8 -DEAL:0::total active cells = 92 -DEAL:0::cell number upper limit = 88 +DEAL:0::total active cells = 1280 +DEAL:0::n_refined = 56 +DEAL:0::n_coarsened = 60 +DEAL:0::total active cells = 1421 +DEAL:0::cell number upper limit = 1408 -DEAL:0::total active cells = 80 +DEAL:0::total active cells = 1280 DEAL:0::n_refined = 0 -DEAL:0::n_coarsened = 20 -DEAL:0::total active cells = 68 -DEAL:0::cell number upper limit = 64 +DEAL:0::n_coarsened = 340 +DEAL:0::total active cells = 1028 +DEAL:0::cell number upper limit = 1024 -DEAL:0::total active cells = 80 -DEAL:0::n_refined = 16 -DEAL:0::n_coarsened = 16 -DEAL:0::total active cells = 125 -DEAL:0::cell number upper limit = 8000 +DEAL:0::total active cells = 1280 +DEAL:0::n_refined = 256 +DEAL:0::n_coarsened = 256 +DEAL:0::total active cells = 1892 +DEAL:0::cell number upper limit = 128000 -- 2.39.5