mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
renamed and split advance method.
This commit is contained in:
parent
0a03aea874
commit
bfbd488e3e
@ -83,24 +83,28 @@ namespace Opm
|
|||||||
/// \brief decrease current time step for factor of two
|
/// \brief decrease current time step for factor of two
|
||||||
void halfTimeStep() { dt_ *= 0.5; }
|
void halfTimeStep() { dt_ *= 0.5; }
|
||||||
|
|
||||||
/// \brief advance time by currentStepLength and set new step lenght
|
/// \brief advance time by currentStepLength
|
||||||
void advance( const double new_dt )
|
void advance()
|
||||||
{
|
{
|
||||||
++current_step_;
|
++current_step_;
|
||||||
current_time_ += dt_;
|
current_time_ += dt_;
|
||||||
// store used time step sizes
|
// store used time step sizes
|
||||||
steps_.push_back( dt_ );
|
steps_.push_back( dt_ );
|
||||||
|
}
|
||||||
|
|
||||||
|
/// \brief provide and estimate for new time step size
|
||||||
|
void provideTimeStepEstimate( const double dt_estimate )
|
||||||
|
{
|
||||||
// store some information about the time steps suggested
|
// store some information about the time steps suggested
|
||||||
suggestedMax_ = std::max( new_dt, suggestedMax_ );
|
suggestedMax_ = std::max( dt_estimate, suggestedMax_ );
|
||||||
suggestedAverage_ += new_dt;
|
suggestedAverage_ += dt_estimate;
|
||||||
|
|
||||||
double remaining = (total_time_ - current_time_);
|
double remaining = (total_time_ - current_time_);
|
||||||
|
|
||||||
if( remaining > 0 ) {
|
if( remaining > 0 ) {
|
||||||
|
|
||||||
// set new time step (depending on remaining time)
|
// set new time step (depending on remaining time)
|
||||||
if( 1.5 * new_dt > remaining ) {
|
if( 1.5 * dt_estimate > remaining ) {
|
||||||
dt_ = remaining;
|
dt_ = remaining;
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
@ -108,14 +112,14 @@ namespace Opm
|
|||||||
// check for half interval step to avoid very small step at the end
|
// check for half interval step to avoid very small step at the end
|
||||||
// remaining *= 0.5;
|
// remaining *= 0.5;
|
||||||
|
|
||||||
if( 2.25 * new_dt > remaining ) {
|
if( 2.25 * dt_estimate > remaining ) {
|
||||||
dt_ = 0.5 * remaining ;
|
dt_ = 0.5 * remaining ;
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// otherwise set new_dt as is
|
// otherwise set dt_estimate as is
|
||||||
dt_ = new_dt;
|
dt_ = dt_estimate;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \brief \copydoc SimulationTimer::currentStepNum
|
/// \brief \copydoc SimulationTimer::currentStepNum
|
||||||
|
Loading…
Reference in New Issue
Block a user