Enable single-phase runs.

This commit is contained in:
Halvor M. Nilsen
2019-10-09 15:24:23 +02:00
committed by Atgeirr Flø Rasmussen
parent e4e8425bad
commit d873ae165d
12 changed files with 264 additions and 171 deletions

View File

@@ -60,6 +60,7 @@ AdaptiveSimulatorTimer& AdaptiveSimulatorTimer::operator++ ()
{
++current_step_;
current_time_ += dt_;
assert(dt_ > 0);
// store used time step sizes
steps_.push_back( dt_ );
return *this;
@@ -71,7 +72,7 @@ AdaptiveSimulatorTimer& AdaptiveSimulatorTimer::operator++ ()
double remaining = (total_time_ - current_time_);
// apply max time step if it was set
dt_ = std::min( dt_estimate, max_time_step_ );
assert(dt_ > 0);
if( remaining > 0 ) {
// set new time step (depending on remaining time)
@@ -81,6 +82,7 @@ AdaptiveSimulatorTimer& AdaptiveSimulatorTimer::operator++ ()
if( dt_ > max_time_step_ ) {
dt_ = 0.5 * remaining;
}
assert(dt_ > 0);
return;
}
@@ -89,6 +91,7 @@ AdaptiveSimulatorTimer& AdaptiveSimulatorTimer::operator++ ()
if( 1.5 * dt_ > remaining ) {
dt_ = 0.5 * remaining;
assert(dt_ > 0);
return;
}
}
@@ -102,6 +105,7 @@ AdaptiveSimulatorTimer& AdaptiveSimulatorTimer::operator++ ()
double AdaptiveSimulatorTimer::currentStepLength () const
{
assert(dt_ > 0);
return dt_;
}