diff --git a/framework/include/timesteppers/ConstantDT.h b/framework/include/timesteppers/ConstantDT.h index 2f9c08f8be72..0f0a41e4e0ea 100644 --- a/framework/include/timesteppers/ConstantDT.h +++ b/framework/include/timesteppers/ConstantDT.h @@ -30,7 +30,10 @@ class ConstantDT : public TimeStepper protected: virtual Real computeInitialDT(); virtual Real computeDT(); -}; +private: + const Real _constant_dt; + const Real _growth_factor; +}; #endif /* CONSTANTDT_H */ diff --git a/framework/src/timesteppers/ConstantDT.C b/framework/src/timesteppers/ConstantDT.C index a5f85c2f3786..c456df289aea 100644 --- a/framework/src/timesteppers/ConstantDT.C +++ b/framework/src/timesteppers/ConstantDT.C @@ -16,26 +16,38 @@ #include "FEProblem.h" #include "Transient.h" +namespace +{ +const std::string dt_name = "dt"; +const std::string growth_factor_name = "growth_factor"; +} + template<> InputParameters validParams() { InputParameters params = validParams(); - params.addRequiredParam("dt", "Size of the time step"); + params.addRequiredParam( dt_name, "Size of the time step" ); + params.addRangeCheckedParam( growth_factor_name, 2, growth_factor_name + ">=1", + "Maximum ratio of new to previous timestep sizes following a step that required the time" + " step to be cut due to a failed solve." ); return params; } ConstantDT::ConstantDT(const std::string & name, InputParameters parameters) : - TimeStepper(name, parameters) -{} + TimeStepper( name, parameters ), + _constant_dt( getParam( dt_name ) ), + _growth_factor( getParam( growth_factor_name ) ) +{ +} Real ConstantDT::computeInitialDT() { - return getParam("dt"); + return _constant_dt; } Real ConstantDT::computeDT() { - return getCurrentDT(); + return std::min( _constant_dt, _growth_factor * getCurrentDT() ); } diff --git a/test/tests/time_steppers/failure/gold/constant_failure_out.e b/test/tests/time_steppers/failure/gold/constant_failure_out.e index 8dd2571cda6d..e997d9536adc 100644 Binary files a/test/tests/time_steppers/failure/gold/constant_failure_out.e and b/test/tests/time_steppers/failure/gold/constant_failure_out.e differ