diff --git a/include/aspect/simulator.h b/include/aspect/simulator.h index 38d8cfe4db8..07cd4a2c3c5 100644 --- a/include/aspect/simulator.h +++ b/include/aspect/simulator.h @@ -2003,6 +2003,7 @@ namespace aspect unsigned int timestep_number; unsigned int pre_refinement_step; unsigned int nonlinear_iteration; + unsigned int nonlinear_solver_failures; /** * @} */ diff --git a/source/simulator/core.cc b/source/simulator/core.cc index 97dc539ef1d..de1a03a59cf 100644 --- a/source/simulator/core.cc +++ b/source/simulator/core.cc @@ -196,6 +196,7 @@ namespace aspect old_time_step (numbers::signaling_nan()), timestep_number (numbers::invalid_unsigned_int), nonlinear_iteration (numbers::invalid_unsigned_int), + nonlinear_solver_failures (0), // We need to disable eliminate_refined_boundary_islands as this leads to // a deadlock for deal.II <= 9.2.0 as described in @@ -1981,6 +1982,7 @@ namespace aspect { pcout << "\nWARNING: The nonlinear solver in the current timestep failed to converge." << std::endl << "Acting according to the parameter 'Nonlinear solver failure strategy'..." << std::endl; + ++nonlinear_solver_failures; switch (parameters.nonlinear_solver_failure_strategy) { @@ -2208,6 +2210,9 @@ namespace aspect // throwing an exception. Therefore, we have to do this manually here: computing_timer.print_summary (); + if (nonlinear_solver_failures>0) + pcout << "\nWARNING: During this computation " << nonlinear_solver_failures << " nonlinear solver failures occurred!" << std::endl; + pcout << "-- Total wallclock time elapsed including restarts: " << round(wall_timer.wall_time()+total_walltime_until_last_snapshot) << 's' << std::endl;