Limit the timestep growth for all timestepping algorithm

The time step restriction is moved to AdaptiveTimeStepping_impl.hpp to
make it apply to all time-stepping algorithms.
This commit is contained in:
Tor Harald Sandve 2015-09-03 12:02:36 +02:00
parent 4c0189f917
commit dbce88aa2c
4 changed files with 7 additions and 10 deletions

View File

@ -82,6 +82,7 @@ namespace Opm {
TimeStepControlType timeStepControl_; //!< time step control object
const double restart_factor_; //!< factor to multiply time step with when solver fails to converge
const double growth_factor_; //!< factor to multiply time step when solver recovered from failed convergence
const double max_growth_; //!< factor that limits the maximum growth of a time step
const double max_time_step_; //!< maximal allowed time step size
const int solver_restart_max_; //!< how many restart of solver are allowed
const bool solver_verbose_; //!< solver verbosity

View File

@ -39,6 +39,7 @@ namespace Opm {
: timeStepControl_()
, restart_factor_( param.getDefault("solver.restartfactor", double(0.1) ) )
, growth_factor_( param.getDefault("solver.growthfactor", double(1.25) ) )
, max_growth_( param.getDefault("timestep.control.maxgrowth", double(3.0) ) )
// default is 1 year, convert to seconds
, max_time_step_( unit::convert::from(param.getDefault("timestep.max_timestep_in_days", 365.0 ), unit::day) )
, solver_restart_max_( param.getDefault("solver.restart", int(10) ) )
@ -59,8 +60,7 @@ namespace Opm {
else if ( control == "pid+iteration" )
{
const int iterations = param.getDefault("timestep.control.targetiteration", defaultTargetIterations );
const double maxgrowth = param.getDefault("timestep.control.maxgrowth", double(3.0) );
timeStepControl_ = TimeStepControlType( new PIDAndIterationCountTimeStepControl( iterations, tol, maxgrowth, parallel_information ) );
timeStepControl_ = TimeStepControlType( new PIDAndIterationCountTimeStepControl( iterations, tol, parallel_information ) );
}
else if ( control == "iterationcount" )
{
@ -175,7 +175,10 @@ namespace Opm {
double dtEstimate =
timeStepControl_->computeTimeStepSize( dt, linearIterations, state );
// avoid time step size growth
// limit the growth of the timestep size by the growth factor
dtEstimate = std::min( dtEstimate, double(max_growth_ * dt) );
// further restrict time step size growth after convergence problems
if( restarts > 0 ) {
dtEstimate = std::min( growth_factor_ * dt, dtEstimate );
// solver converged, reset restarts counter

View File

@ -169,12 +169,10 @@ namespace Opm
PIDAndIterationCountTimeStepControl::
PIDAndIterationCountTimeStepControl( const int target_iterations,
const double tol,
const double maxgrowth,
const boost::any& pinfo,
const bool verbose)
: BaseType( tol, pinfo, verbose )
, target_iterations_( target_iterations )
, maxgrowth_( maxgrowth )
{}
double PIDAndIterationCountTimeStepControl::
@ -189,9 +187,6 @@ namespace Opm
dtEstimate *= double( target_iterations_ ) / double(iterations);
}
// limit the growth of the timestep size by the growth factor
dtEstimate = std::min( dtEstimate, double(maxgrowth_ * dt) );
return dtEstimate;
}

View File

@ -158,7 +158,6 @@ namespace Opm
/// \param verbose if true get some output (default = false)
PIDAndIterationCountTimeStepControl( const int target_iterations = 20,
const double tol = 1e-3,
const double maxgrowth = 3.0,
const boost::any& = boost::any(),
const bool verbose = false);
@ -167,7 +166,6 @@ namespace Opm
protected:
const int target_iterations_;
const double maxgrowth_;
};