From: Wolfgang Bangerth Date: Tue, 3 Jun 2025 21:27:04 +0000 (-0600) Subject: Adjust example diff. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=55da7c1cb1a0fbc7b735de3bf7353299b9862996;p=dealii.git Adjust example diff. --- diff --git a/tests/examples/step-56.diff b/tests/examples/step-56.diff index a06a872dc6..6a592486b3 100644 --- a/tests/examples/step-56.diff +++ b/tests/examples/step-56.diff @@ -1,80 +1,199 @@ -67c67 -< ---- -> #include "../example_test.h" -833c833,834 -< ---- -> (void)n_iterations_A; -> (void)n_iterations_S; -869c870,874 -< solver.solve(system_matrix, solution, system_rhs, preconditioner); ---- -> // solver.solve(system_matrix, solution, system_rhs, preconditioner); -> check_solver_within_range(std::cout, -> solver.solve(system_matrix, solution, system_rhs, preconditioner), -> solver_control.last_step(), -> 13, 17); -931c936,940 -< solver.solve(system_matrix, solution, system_rhs, preconditioner); ---- -> //solver.solve(system_matrix, solution, system_rhs, preconditioner); -> check_solver_within_range(std::cout, -> solver.solve(system_matrix, solution, system_rhs, preconditioner), -> solver_control.last_step(), -> 13, 17); -939,947c948,956 -< std::cout -< << std::endl -< << "\tNumber of FGMRES iterations: " << solver_control.last_step() -< << std::endl -< << "\tTotal number of iterations used for approximation of A inverse: " -< << n_iterations_A << std::endl -< << "\tTotal number of iterations used for approximation of S inverse: " -< << n_iterations_S << std::endl -< << std::endl; ---- -> // std::cout -> // << std::endl -> // << "\tNumber of FGMRES iterations: " << solver_control.last_step() -> // << std::endl -> // << "\tTotal number of iterations used for approximation of A inverse: " -> // << n_iterations_A << std::endl -> // << "\tTotal number of iterations used for approximation of S inverse: " -> // << n_iterations_S << std::endl -> // << std::endl; -966,967c975,976 -< std::cout << " Note: The mean value was adjusted by " << -mean_pressure -< << std::endl; ---- -> // std::cout << " Note: The mean value was adjusted by " << -mean_pressure -> // << std::endl; -1060c1069 -< triangulation.refine_global(6 - dim); ---- -> triangulation.refine_global(2); -1100c1109 -< std::cout << " VM Peak: " << mem.VmPeak << std::endl; ---- -> // std::cout << " VM Peak: " << mem.VmPeak << std::endl; -1102c1111 -< computing_timer.print_summary(); ---- -> // computing_timer.print_summary(); -1116c1125 -< const int dim = 3; ---- -> const int dim = 2; -1118,1120c1127,1134 -< StokesProblem flow_problem(degree, SolverType::FGMRES_GMG); -< -< flow_problem.run(); ---- -> { -> StokesProblem flow_problem(degree, SolverType::FGMRES_GMG); -> flow_problem.run(); -> } -> { -> StokesProblem flow_problem(degree, SolverType::FGMRES_ILU); -> flow_problem.run(); -> } +*** step-56.cc 2025-06-03 15:25:51.972483511 -0600 +--- step-56.patched 2025-06-03 15:25:42.779468142 -0600 +*************** +*** 64,70 **** + #include + #include + #include +! + #include + #include + +--- 64,70 ---- + #include + #include + #include +! #include "../example_test.h" + #include + #include + +*************** +*** 830,836 **** + 1e-10 * system_rhs.l2_norm()); + unsigned int n_iterations_A; + unsigned int n_iterations_S; +! + // This is used to pass whether or not we want to solve for A inside + // the preconditioner. One could change this to false to see if + // there is still convergence and if so does the program then run +--- 830,837 ---- + 1e-10 * system_rhs.l2_norm()); + unsigned int n_iterations_A; + unsigned int n_iterations_S; +! (void)n_iterations_A; +! (void)n_iterations_S; + // This is used to pass whether or not we want to solve for A inside + // the preconditioner. One could change this to false to see if + // there is still convergence and if so does the program then run +*************** +*** 866,872 **** + { + TimerOutput::Scope solve_fmgres(computing_timer, "Solve - FGMRES"); + +! solver.solve(system_matrix, solution, system_rhs, preconditioner); + n_iterations_A = preconditioner.n_iterations_A; + n_iterations_S = preconditioner.n_iterations_S; + } +--- 867,877 ---- + { + TimerOutput::Scope solve_fmgres(computing_timer, "Solve - FGMRES"); + +! // solver.solve(system_matrix, solution, system_rhs, preconditioner); +! check_solver_within_range(std::cout, +! solver.solve(system_matrix, solution, system_rhs, preconditioner), +! solver_control.last_step(), +! 13, 17); + n_iterations_A = preconditioner.n_iterations_A; + n_iterations_S = preconditioner.n_iterations_S; + } +*************** +*** 928,934 **** + + { + TimerOutput::Scope solve_fmgres(computing_timer, "Solve - FGMRES"); +! solver.solve(system_matrix, solution, system_rhs, preconditioner); + n_iterations_A = preconditioner.n_iterations_A; + n_iterations_S = preconditioner.n_iterations_S; + } +--- 933,943 ---- + + { + TimerOutput::Scope solve_fmgres(computing_timer, "Solve - FGMRES"); +! //solver.solve(system_matrix, solution, system_rhs, preconditioner); +! check_solver_within_range(std::cout, +! solver.solve(system_matrix, solution, system_rhs, preconditioner), +! solver_control.last_step(), +! 13, 17); + n_iterations_A = preconditioner.n_iterations_A; + n_iterations_S = preconditioner.n_iterations_S; + } +*************** +*** 936,950 **** + + constraints.distribute(solution); + +! std::cout +! << std::endl +! << "\tNumber of FGMRES iterations: " << solver_control.last_step() +! << std::endl +! << "\tTotal number of iterations used for approximation of A inverse: " +! << n_iterations_A << std::endl +! << "\tTotal number of iterations used for approximation of S inverse: " +! << n_iterations_S << std::endl +! << std::endl; + } + + +--- 945,959 ---- + + constraints.distribute(solution); + +! // std::cout +! // << std::endl +! // << "\tNumber of FGMRES iterations: " << solver_control.last_step() +! // << std::endl +! // << "\tTotal number of iterations used for approximation of A inverse: " +! // << n_iterations_A << std::endl +! // << "\tTotal number of iterations used for approximation of S inverse: " +! // << n_iterations_S << std::endl +! // << std::endl; + } + + +*************** +*** 963,970 **** + const double mean_pressure = VectorTools::compute_mean_value( + dof_handler, QGauss(pressure_degree + 2), solution, dim); + solution.block(1).add(-mean_pressure); +! std::cout << " Note: The mean value was adjusted by " << -mean_pressure +! << std::endl; + + const ComponentSelectFunction pressure_mask(dim, dim + 1); + const ComponentSelectFunction velocity_mask(std::make_pair(0, dim), +--- 972,979 ---- + const double mean_pressure = VectorTools::compute_mean_value( + dof_handler, QGauss(pressure_degree + 2), solution, dim); + solution.block(1).add(-mean_pressure); +! // std::cout << " Note: The mean value was adjusted by " << -mean_pressure +! // << std::endl; + + const ComponentSelectFunction pressure_mask(dim, dim + 1); + const ComponentSelectFunction velocity_mask(std::make_pair(0, dim), +*************** +*** 1057,1063 **** + void StokesProblem::run() + { + GridGenerator::hyper_cube(triangulation); +! triangulation.refine_global(6 - dim); + + if (solver_type == SolverType::FGMRES_ILU) + std::cout << "Now running with ILU" << std::endl; +--- 1066,1072 ---- + void StokesProblem::run() + { + GridGenerator::hyper_cube(triangulation); +! triangulation.refine_global(2); + + if (solver_type == SolverType::FGMRES_ILU) + std::cout << "Now running with ILU" << std::endl; +*************** +*** 1097,1105 **** + + Utilities::System::MemoryStats mem; + Utilities::System::get_memory_stats(mem); +! std::cout << " VM Peak: " << mem.VmPeak << std::endl; + +! computing_timer.print_summary(); + computing_timer.reset(); + } + } +--- 1106,1114 ---- + + Utilities::System::MemoryStats mem; + Utilities::System::get_memory_stats(mem); +! // std::cout << " VM Peak: " << mem.VmPeak << std::endl; + +! // computing_timer.print_summary(); + computing_timer.reset(); + } + } +*************** +*** 1113,1123 **** + using namespace Step56; + + const int degree = 1; +! const int dim = 3; + // options for SolverType: UMFPACK FGMRES_ILU FGMRES_GMG +! StokesProblem flow_problem(degree, SolverType::FGMRES_GMG); +! +! flow_problem.run(); + } + catch (std::exception &exc) + { +--- 1122,1137 ---- + using namespace Step56; + + const int degree = 1; +! const int dim = 2; + // options for SolverType: UMFPACK FGMRES_ILU FGMRES_GMG +! { +! StokesProblem flow_problem(degree, SolverType::FGMRES_GMG); +! flow_problem.run(); +! } +! { +! StokesProblem flow_problem(degree, SolverType::FGMRES_ILU); +! flow_problem.run(); +! } + } + catch (std::exception &exc) + {