mirror of
https://github.com/OPM/opm-simulators.git
synced 2026-09-05 04:40:19 -05:00
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:
@@ -82,6 +82,7 @@ namespace Opm {
|
|||||||
TimeStepControlType timeStepControl_; //!< time step control object
|
TimeStepControlType timeStepControl_; //!< time step control object
|
||||||
const double restart_factor_; //!< factor to multiply time step with when solver fails to converge
|
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 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 double max_time_step_; //!< maximal allowed time step size
|
||||||
const int solver_restart_max_; //!< how many restart of solver are allowed
|
const int solver_restart_max_; //!< how many restart of solver are allowed
|
||||||
const bool solver_verbose_; //!< solver verbosity
|
const bool solver_verbose_; //!< solver verbosity
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ namespace Opm {
|
|||||||
: timeStepControl_()
|
: timeStepControl_()
|
||||||
, restart_factor_( param.getDefault("solver.restartfactor", double(0.1) ) )
|
, restart_factor_( param.getDefault("solver.restartfactor", double(0.1) ) )
|
||||||
, growth_factor_( param.getDefault("solver.growthfactor", double(1.25) ) )
|
, 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
|
// default is 1 year, convert to seconds
|
||||||
, max_time_step_( unit::convert::from(param.getDefault("timestep.max_timestep_in_days", 365.0 ), unit::day) )
|
, 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) ) )
|
, solver_restart_max_( param.getDefault("solver.restart", int(10) ) )
|
||||||
@@ -59,8 +60,7 @@ namespace Opm {
|
|||||||
else if ( control == "pid+iteration" )
|
else if ( control == "pid+iteration" )
|
||||||
{
|
{
|
||||||
const int iterations = param.getDefault("timestep.control.targetiteration", defaultTargetIterations );
|
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, parallel_information ) );
|
||||||
timeStepControl_ = TimeStepControlType( new PIDAndIterationCountTimeStepControl( iterations, tol, maxgrowth, parallel_information ) );
|
|
||||||
}
|
}
|
||||||
else if ( control == "iterationcount" )
|
else if ( control == "iterationcount" )
|
||||||
{
|
{
|
||||||
@@ -175,7 +175,10 @@ namespace Opm {
|
|||||||
double dtEstimate =
|
double dtEstimate =
|
||||||
timeStepControl_->computeTimeStepSize( dt, linearIterations, state );
|
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 ) {
|
if( restarts > 0 ) {
|
||||||
dtEstimate = std::min( growth_factor_ * dt, dtEstimate );
|
dtEstimate = std::min( growth_factor_ * dt, dtEstimate );
|
||||||
// solver converged, reset restarts counter
|
// solver converged, reset restarts counter
|
||||||
|
|||||||
@@ -169,12 +169,10 @@ namespace Opm
|
|||||||
PIDAndIterationCountTimeStepControl::
|
PIDAndIterationCountTimeStepControl::
|
||||||
PIDAndIterationCountTimeStepControl( const int target_iterations,
|
PIDAndIterationCountTimeStepControl( const int target_iterations,
|
||||||
const double tol,
|
const double tol,
|
||||||
const double maxgrowth,
|
|
||||||
const boost::any& pinfo,
|
const boost::any& pinfo,
|
||||||
const bool verbose)
|
const bool verbose)
|
||||||
: BaseType( tol, pinfo, verbose )
|
: BaseType( tol, pinfo, verbose )
|
||||||
, target_iterations_( target_iterations )
|
, target_iterations_( target_iterations )
|
||||||
, maxgrowth_( maxgrowth )
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
double PIDAndIterationCountTimeStepControl::
|
double PIDAndIterationCountTimeStepControl::
|
||||||
@@ -189,9 +187,6 @@ namespace Opm
|
|||||||
dtEstimate *= double( target_iterations_ ) / double(iterations);
|
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;
|
return dtEstimate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -158,7 +158,6 @@ namespace Opm
|
|||||||
/// \param verbose if true get some output (default = false)
|
/// \param verbose if true get some output (default = false)
|
||||||
PIDAndIterationCountTimeStepControl( const int target_iterations = 20,
|
PIDAndIterationCountTimeStepControl( const int target_iterations = 20,
|
||||||
const double tol = 1e-3,
|
const double tol = 1e-3,
|
||||||
const double maxgrowth = 3.0,
|
|
||||||
const boost::any& = boost::any(),
|
const boost::any& = boost::any(),
|
||||||
const bool verbose = false);
|
const bool verbose = false);
|
||||||
|
|
||||||
@@ -167,7 +166,6 @@ namespace Opm
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
const int target_iterations_;
|
const int target_iterations_;
|
||||||
const double maxgrowth_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user