24 double const solution_error,
int const ,
27 const bool is_previous_step_accepted = timestep_current.
isAccepted();
29 const double e_n = solution_error;
30 const double zero_threshold = std::numeric_limits<double>::epsilon();
36 double h_new = (e_n > zero_threshold)
37 ? timestep_current.
dt() *
_tol / e_n
38 : 0.5 * timestep_current.
dt();
41 limitStepSize(h_new, is_previous_step_accepted, timestep_current);
44 "This step is rejected due to the relative change from the"
45 " solution of the previous\n"
46 "\t time step to the current solution exceeds the given tolerance"
48 "\t This time step will be repeated with a new time step size of"
50 "\t or the simulation will be halted.",
53 return std::make_tuple(timestep_current.
isAccepted(), h_new);
67 const double h_n = timestep_current.
dt();
70 if (e_n > zero_threshold)
86 std::pow(
_tol / e_n,
_kI) * h_n;
91 h_new = std::pow(
_tol / e_n,
_kI) * h_n;
96 limitStepSize(h_new, is_previous_step_accepted, timestep_current);
101 return std::make_tuple(timestep_current.
isAccepted(), h_new);
106 const double h_new,
const bool previous_step_accepted,
109 const double h_n = timestep_current.
dt();
112 const double h_in_range = std::max(
_h_min, std::min(h_new,
_h_max));
117 if (!previous_step_accepted)
122 if (std::abs(limited_h - timestep_current.
dt()) <
123 std::numeric_limits<double>::min())
125 limited_h = std::max(
_h_min, 0.5 * limited_h);
134 if (limited_h > timestep_current.
dt())
136 limited_h = std::max(
_h_min, 0.5 * timestep_current.
dt());
147 auto fixed_output_time_it = std::find_if(
149 [×tep_current](
auto const fixed_output_time)
150 {
return timestep_current.
current() <
Time{fixed_output_time}; });
156 if (
Time{*fixed_output_time_it} <
157 timestep_current.
current() + limited_h)
160 if (std::abs(*fixed_output_time_it - timestep_current.
current()()) >
161 std::numeric_limits<double>::epsilon() *
164 return *fixed_output_time_it - timestep_current.
current()();