20 const bool is_previous_step_accepted = timestep_current.
isAccepted();
22 const double e_n = solution_error;
23 const double zero_threshold = std::numeric_limits<double>::epsilon();
29 double h_new = (e_n > zero_threshold)
30 ? timestep_current.
dt() *
_tol / e_n
31 : 0.5 * timestep_current.
dt();
34 limitStepSize(h_new, is_previous_step_accepted, timestep_current);
37 "This step is rejected due to the relative change from the"
38 " solution of the previous\n"
39 "\t time step to the current solution exceeds the given tolerance"
41 "\t This time step will be repeated with a new time step size of"
43 "\t or the simulation will be halted.",
58 const double h_n = timestep_current.
dt();
61 if (e_n > zero_threshold)
77 std::pow(
_tol / e_n,
_kI) * h_n;
82 h_new = std::pow(
_tol / e_n,
_kI) * h_n;
86 h_new =
limitStepSize(h_new, is_previous_step_accepted, timestep_current);
95 const double h_new,
const bool previous_step_accepted,
98 const double h_n = timestep_current.
dt();
101 const double h_in_range = std::max(
_h_min, std::min(h_new,
_h_max));
106 if (!previous_step_accepted)
111 if (std::abs(limited_h - timestep_current.
dt()) <
112 std::numeric_limits<double>::min())
114 limited_h = std::max(
_h_min, 0.5 * limited_h);
123 if (limited_h > timestep_current.
dt())
125 limited_h = std::max(
_h_min, 0.5 * timestep_current.
dt());
136 auto fixed_output_time_it = std::find_if(
138 [×tep_current](
auto const fixed_output_time)
139 {
return timestep_current.
current() <
Time{fixed_output_time}; });
145 if (
Time{*fixed_output_time_it} <
146 timestep_current.
current() + limited_h)
149 if (std::abs(*fixed_output_time_it - timestep_current.
current()()) >
150 std::numeric_limits<double>::epsilon() *
153 return *fixed_output_time_it - timestep_current.
current()();