Commit 4e808c02 authored by Santiago Ospina's avatar Santiago Ospina

Enforce simulations to implement suggestTimestep()

Signed-off-by: default avatarSantiago Ospina <saospina@hugo.iwr.uni-heidelberg.de>
parent c2c49692
......@@ -130,7 +130,7 @@ public:
*
* @param[in] suggestion for the internal time step of the model.
*/
virtual void suggestTimestep(double dt) {};
virtual void suggestTimestep(double dt) = 0;
/**
* @brief Operations before step of the simulation.
......
......@@ -312,6 +312,14 @@ public:
*/
double currentTime() final {return controller->getTime();};
/**
* @brief Suggest a time step to the model.
*
* @param[in] suggestion for the internal time step of the model.
*/
void suggestTimestep(double dt) final
{/*TODO: ensures that controller will not provide a dt higher than suggested dt*/};
protected:
/*------------------------------------------------------------------------*//**
......
......@@ -295,53 +295,7 @@ public:
return acc;
}
/// Run the simulation
/** \return Error quantity
*/
// double run_test()
// {
// double acc{0.0}; // accumulated deviation
// double acc_square{0.0}; // accumulated squared deviation
// while (this->controller->doStep())
// {
// const auto time = this->controller->getTime();
// const auto dt = this->controller->getDT();
// // compute current water content
// const auto wc_old = water_content(*this->uold);
// // compute expected integrated flux (water content change)
// const auto flux_int = water_flux(*this->uold, time) * dt;
// // compute time step
// if (!this->compute_time_step())
// {
// continue;
// }
// if (this->adaptivity->adapt_grid(
// *this->grid, this->gv, *this->gfs, *this->param, *this->fboundary,
// time, *this->uold, *this->unew))
// {
// // reset operators if grid changes
// this->operator_setup();
// }
// // compute new water content
// const auto wc_new = water_content(*this->unew);
// const auto deviation = (wc_new - wc_old) - flux_int;
// acc += deviation;
// acc_square += deviation * deviation;
// std::cout << "wc_old: " << wc_old << std::endl;
// std::cout << "wc_new: " << wc_new << std::endl;
// std::cout << "integrated flux: " << flux_int << std::endl;
// std::cout << "deviation: " << deviation << std::endl;
// }
// std::cout << "total deviation: " << acc << std::endl;
// std::cout << "total normalized deviation: " << std::sqrt(acc_square) << std::endl;
// return acc;
// }
private:
double acc; // accumulated deviation
double acc_square; // accumulated squared deviation
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment