Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow time step to increase after shrinking. #3765

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion framework/include/timesteppers/ConstantDT.h
Expand Up @@ -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 */
22 changes: 17 additions & 5 deletions framework/src/timesteppers/ConstantDT.C
Expand Up @@ -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<ConstantDT>()
{
InputParameters params = validParams<TimeStepper>();
params.addRequiredParam<Real>("dt", "Size of the time step");
params.addRequiredParam<Real>( dt_name, "Size of the time step" );
params.addRangeCheckedParam<Real>( 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<Real>( dt_name ) ),
_growth_factor( getParam<Real>( growth_factor_name ) )
{
}

Real
ConstantDT::computeInitialDT()
{
return getParam<Real>("dt");
return _constant_dt;
}

Real
ConstantDT::computeDT()
{
return getCurrentDT();
return std::min( _constant_dt, _growth_factor * getCurrentDT() );
}
Binary file modified test/tests/time_steppers/failure/gold/constant_failure_out.e
Binary file not shown.