From b18926dd0c245a66e1ae57dc454b17935c921323 Mon Sep 17 00:00:00 2001 From: Martin Kronbichler Date: Thu, 9 May 2024 21:31:03 +0200 Subject: [PATCH] Add a few more tests for the tutorials --- tests/examples/step-37.diff | 33 +++++++++++++++++++++++ tests/examples/step-37.output | 20 ++++++++++++++ tests/examples/step-48.diff | 51 +++++++++++++++++++++++++++++++++++ tests/examples/step-48.output | 12 +++++++++ tests/examples/step-59.diff | 30 +++++++++++++++++++++ tests/examples/step-59.output | 17 ++++++++++++ tests/examples/step-65.diff | 16 +++++++++++ tests/examples/step-65.output | 17 ++++++++++++ 8 files changed, 196 insertions(+) create mode 100644 tests/examples/step-37.diff create mode 100644 tests/examples/step-37.output create mode 100644 tests/examples/step-48.diff create mode 100644 tests/examples/step-48.output create mode 100644 tests/examples/step-59.diff create mode 100644 tests/examples/step-59.output create mode 100644 tests/examples/step-65.diff create mode 100644 tests/examples/step-65.output diff --git a/tests/examples/step-37.diff b/tests/examples/step-37.diff new file mode 100644 index 0000000000..8450386e70 --- /dev/null +++ b/tests/examples/step-37.diff @@ -0,0 +1,33 @@ +1003,1005c1003,1006 +< smoother_data[0].smoothing_range = 1e-3; +< smoother_data[0].degree = numbers::invalid_unsigned_int; +< smoother_data[0].eig_cg_n_iterations = mg_matrices[0].m(); +--- +> smoother_data[0].smoothing_range = 20; +> smoother_data[0].degree = 5; +> smoother_data[0].max_eigenvalue = 2; +> smoother_data[0].eig_cg_n_iterations = 0; +1006a1008,1009 +> smoother_data[level].eigenvalue_algorithm = +> internal::EigenvalueAlgorithm::power_iteration; +1082d1084 +< pcout << "Total setup time (wall) " << setup_time << "s\n"; +1092,1093c1094 +< << (solver_control.last_step() < 10 ? " " : " ") << "(CPU/wall) " +< << time.cpu_time() << "s/" << time.wall_time() << "s\n"; +--- +> << std::endl; +1151,1161c1152 +< { +< const unsigned int n_vect_doubles = VectorizedArray::size(); +< const unsigned int n_vect_bits = 8 * sizeof(double) * n_vect_doubles; +< +< pcout << "Vectorization over " << n_vect_doubles +< << " doubles = " << n_vect_bits << " bits (" +< << Utilities::System::get_current_vectorization_level() << ')' +< << std::endl; +< } +< +< for (unsigned int cycle = 0; cycle < 9 - dim; ++cycle) +--- +> for (unsigned int cycle = 0; cycle < 5; ++cycle) diff --git a/tests/examples/step-37.output b/tests/examples/step-37.output new file mode 100644 index 0000000000..cda4bbc678 --- /dev/null +++ b/tests/examples/step-37.output @@ -0,0 +1,20 @@ +Cycle 0 +Number of degrees of freedom: 125 +Time solve (5 iterations) + +Cycle 1 +Number of degrees of freedom: 729 +Time solve (6 iterations) + +Cycle 2 +Number of degrees of freedom: 4913 +Time solve (6 iterations) + +Cycle 3 +Number of degrees of freedom: 35937 +Time solve (6 iterations) + +Cycle 4 +Number of degrees of freedom: 274625 +Time solve (6 iterations) + diff --git a/tests/examples/step-48.diff b/tests/examples/step-48.diff new file mode 100644 index 0000000000..1a8c424fe5 --- /dev/null +++ b/tests/examples/step-48.diff @@ -0,0 +1,51 @@ +59c59 +< // it is passed as a template argument to the implementation of the +--- +> // it is passed as a template argument to the implementation of the +352c352 +< , n_global_refinements(10 - 2 * dim) +--- +> , n_global_refinements(9 - 2 * dim) +355c355 +< , final_time(10.) +--- +> , final_time(-5.) +522,534d521 +< { +< pcout << "Number of MPI ranks: " +< << Utilities::MPI::n_mpi_processes(MPI_COMM_WORLD) << std::endl; +< pcout << "Number of threads on each rank: " +< << MultithreadInfo::n_threads() << std::endl; +< const unsigned int n_vect_doubles = VectorizedArray::size(); +< const unsigned int n_vect_bits = 8 * sizeof(double) * n_vect_doubles; +< pcout << "Vectorization over " << n_vect_doubles +< << " doubles = " << n_vect_bits << " bits (" +< << Utilities::System::get_current_vectorization_level() << ')' +< << std::endl +< << std::endl; +< } +596,597d582 +< double wtime = 0; +< double output_time = 0; +605d589 +< wtime += timer.wall_time(); +607d590 +< timer.restart(); +610,611d592 +< +< output_time += timer.wall_time(); +613d593 +< timer.restart(); +615d594 +< output_time += timer.wall_time(); +619,624d597 +< +< pcout << " Average wallclock time per time step: " +< << wtime / timestep_number << 's' << std::endl; +< +< pcout << " Spent " << output_time << "s on output and " << wtime +< << "s on computations." << std::endl; +645c618 +< argc, argv, numbers::invalid_unsigned_int); +--- +> argc, argv, 2); diff --git a/tests/examples/step-48.output b/tests/examples/step-48.output new file mode 100644 index 0000000000..04030ca2bf --- /dev/null +++ b/tests/examples/step-48.output @@ -0,0 +1,12 @@ + Number of global active cells: 3892 + Number of degrees of freedom: 63529 + Time step size: 0.00586166, finest cell: 0.234375 + + Time: -10, solution norm: 9.5599 + Time: -8.83, solution norm: 23.497 + Time: -7.66, solution norm: 29.495 + Time: -6.48, solution norm: 27.202 + Time: -5.31, solution norm: 18.398 + Time: -5, solution norm: 15.171 + + Performed 853 time steps. diff --git a/tests/examples/step-59.diff b/tests/examples/step-59.diff new file mode 100644 index 0000000000..f0be20efc9 --- /dev/null +++ b/tests/examples/step-59.diff @@ -0,0 +1,30 @@ +74c74 +< const unsigned int degree_finite_element = 8; +--- +> const unsigned int degree_finite_element = 5; +1232c1232 +< smoother_data[level].eig_cg_n_iterations = 10; +--- +> smoother_data[level].eig_cg_n_iterations = 15; +1236,1237c1236,1238 +< smoother_data[0].smoothing_range = 2e-2; +< smoother_data[0].degree = numbers::invalid_unsigned_int; +--- +> smoother_data[0].smoothing_range = 100; +> smoother_data[0].degree = 15; +> smoother_data[0].max_eigenvalue = 4; +1239a1241,1242 +> smoother_data[level].eigenvalue_algorithm = +> internal::EigenvalueAlgorithm::power_iteration; +1266d1268 +< pcout << "Total setup time " << setup_time << " s\n"; +1272,1273c1274,1275 +< pcout << "Time solve (" << solver_control.last_step() << " iterations) " +< << time.wall_time() << " s" << std::endl; +--- +> pcout << "Time solve (" << solver_control.last_step() << " iterations) " +> << std::endl; +1320c1322 +< for (unsigned int cycle = 0; cycle < 9 - dim; ++cycle) +--- +> for (unsigned int cycle = 0; cycle < 3; ++cycle) diff --git a/tests/examples/step-59.output b/tests/examples/step-59.output new file mode 100644 index 0000000000..8f92565919 --- /dev/null +++ b/tests/examples/step-59.output @@ -0,0 +1,17 @@ +Running with 1 MPI process, element FE_DGQHermite<3>(5) + +Cycle 0 +Number of degrees of freedom: 1728 +Time solve (13 iterations) +Verification via L2 error: 0.667141 + +Cycle 1 +Number of degrees of freedom: 13824 +Time solve (14 iterations) +Verification via L2 error: 0.0232412 + +Cycle 2 +Number of degrees of freedom: 110592 +Time solve (14 iterations) +Verification via L2 error: 0.00034861 + diff --git a/tests/examples/step-65.diff b/tests/examples/step-65.diff new file mode 100644 index 0000000000..f6c959d5d9 --- /dev/null +++ b/tests/examples/step-65.diff @@ -0,0 +1,16 @@ +23a24 +> #include +268c269 +< triangulation.refine_global(9 - 2 * dim); +--- +> triangulation.refine_global(2); +619d619 +< timer.print_summary(); +644,645d643 +< std::cout << " Memory consumption cache: " +< << 1e-6 * mapping.memory_consumption() << " MB" << std::endl; +651,652d648 +< +< timer.print_summary(); +660a657 +> dealii::MultithreadInfo::set_thread_limit(2); diff --git a/tests/examples/step-65.output b/tests/examples/step-65.output new file mode 100644 index 0000000000..6cf62063d8 --- /dev/null +++ b/tests/examples/step-65.output @@ -0,0 +1,17 @@ + +====== Running with the basic MappingQ class ====== + + Number of active cells: 832 + Number of degrees of freedom: 22981 + Number of solver iterations: 138 + L2 error vs exact solution: 1.39878e-06 + H1 error vs exact solution: 5.16394e-05 + Max cell-wise error estimate: 0.0217657 +====== Running with the optimized MappingQCache class ====== + + Number of active cells: 832 + Number of degrees of freedom: 22981 + Number of solver iterations: 138 + L2 error vs exact solution: 1.39878e-06 + H1 error vs exact solution: 5.16394e-05 + Max cell-wise error estimate: 0.0217657 -- 2.39.5