From 131a91538df19a6c65595e81bfcb7cd39053d9e7 Mon Sep 17 00:00:00 2001 From: Wenqing Wang <wenqing.wang@ufz.de> Date: Fri, 7 Jul 2017 17:12:07 +0200 Subject: [PATCH] [dt] Corrected the rejected times and formatted a warning message --- .../Algorithms/EvolutionaryPIDcontroller.cpp | 12 +++++++----- ProcessLib/UncoupledProcessesTimeLoop.cpp | 12 ++++++++++-- ProcessLib/UncoupledProcessesTimeLoop.h | 2 +- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/NumLib/TimeStepping/Algorithms/EvolutionaryPIDcontroller.cpp b/NumLib/TimeStepping/Algorithms/EvolutionaryPIDcontroller.cpp index 63ef7856207..71b17e23046 100644 --- a/NumLib/TimeStepping/Algorithms/EvolutionaryPIDcontroller.cpp +++ b/NumLib/TimeStepping/Algorithms/EvolutionaryPIDcontroller.cpp @@ -38,11 +38,13 @@ bool EvolutionaryPIDcontroller::next(const double solution_error) _ts_current = _ts_prev; _ts_current += h_new; - WARN("\tThis step is rejected due to the relative change from the\n" - "\tsolution of the previous time step to the current solution\n" - "\t exceeds the given tolerance of %g.\n" - "\tThis time step will be repeated with a new time step size of" - " %g or the simulation will be halted." , _tol, h_new); + WARN("This step is rejected due to the relative change from the" + " solution of the previous\n" + "\t time step to the current solution exceeds the given tolerance" + " of %g.\n" + "\t This time step will be repeated with a new time step size of" + " %g\n" + "\t or the simulation will be halted." , _tol, h_new); return false; } diff --git a/ProcessLib/UncoupledProcessesTimeLoop.cpp b/ProcessLib/UncoupledProcessesTimeLoop.cpp index 6ef15d67603..33f96af26a7 100644 --- a/ProcessLib/UncoupledProcessesTimeLoop.cpp +++ b/ProcessLib/UncoupledProcessesTimeLoop.cpp @@ -602,6 +602,15 @@ double UncoupledProcessesTimeLoop::computeTimeStepping( } } + if (all_process_steps_accepted) + { + _repeating_times_of_rejected_step = 0; + } + else + { + _repeating_times_of_rejected_step++; + } + bool is_initial_step = false; // Reset the time step with the minimum step size, dt // Update the solution of the previous time step in time_disc. @@ -626,7 +635,6 @@ double UncoupledProcessesTimeLoop::computeTimeStepping( if (all_process_steps_accepted) { time_disc->pushState(t, x, mat_strg); - _repeating_times_of_rejected_step = 0; } else { @@ -635,7 +643,7 @@ double UncoupledProcessesTimeLoop::computeTimeStepping( WARN( "Time step %d was rejected %d times " "and it will be repeated with a reduced step size.", - accepted_steps + 1, _repeating_times_of_rejected_step++); + accepted_steps + 1, _repeating_times_of_rejected_step); time_disc->popState(x); } } diff --git a/ProcessLib/UncoupledProcessesTimeLoop.h b/ProcessLib/UncoupledProcessesTimeLoop.h index fe62579f90c..e6a445ba2bc 100644 --- a/ProcessLib/UncoupledProcessesTimeLoop.h +++ b/ProcessLib/UncoupledProcessesTimeLoop.h @@ -67,7 +67,7 @@ private: std::vector<std::unique_ptr<SingleProcessData>> _per_process_data; bool _last_step_rejected = false; - bool _repeating_times_of_rejected_step = 0; + int _repeating_times_of_rejected_step = 0; const double _start_time; const double _end_time; -- GitLab