Skip to content

Commit b93c0e6

Browse files
committed
log a warning when an incoming dt gets restricted
1 parent dae153c commit b93c0e6

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

cpp/memilio/math/adapt_rk.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@ bool RKIntegratorCore::step(const DerivFunction& f, Eigen::Ref<const Eigen::Vect
7676
{
7777
assert(0 <= m_dt_min);
7878
assert(m_dt_min <= m_dt_max);
79+
80+
if (dt < m_dt_min || dt > m_dt_max) {
81+
mio::log_warning("IntegratorCore: Restricting given step size dt = {} to [{}, {}].", dt, m_dt_min, m_dt_max);
82+
}
83+
7984
dt = std::min(dt, m_dt_max);
8085

8186
double t_eval; // shifted time for evaluating yt

cpp/memilio/math/stepper_wrapper.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
#include "memilio/utils/compiler_diagnostics.h"
2424
#include "memilio/math/integrator.h"
25+
#include "memilio/utils/logging.h"
2526

2627
GCC_CLANG_DIAGNOSTIC(push)
2728
GCC_CLANG_DIAGNOSTIC(ignored "-Wshadow")
@@ -56,7 +57,6 @@ class ControlledStepperWrapper : public mio::IntegratorCore
5657
static_assert(!is_fsal_stepper,
5758
"FSAL steppers cannot be used until https://github.com/boostorg/odeint/issues/72 is resolved.");
5859

59-
6060
public:
6161
/**
6262
* @brief Set up the integrator
@@ -90,6 +90,11 @@ class ControlledStepperWrapper : public mio::IntegratorCore
9090
using boost::numeric::odeint::fail;
9191
assert(0 <= m_dt_min);
9292
assert(m_dt_min <= m_dt_max);
93+
94+
if (dt < m_dt_min || dt > m_dt_max) {
95+
mio::log_warning("IntegratorCore: Restricting given step size dt = {} to [{}, {}].", dt, m_dt_min,
96+
m_dt_max);
97+
}
9398
// set initial values for exit conditions
9499
auto step_result = fail;
95100
bool is_dt_valid = true;

0 commit comments

Comments
 (0)