Line data Source code
1 : //* This file is part of the MOOSE framework 2 : //* https://mooseframework.inl.gov 3 : //* 4 : //* All rights reserved, see COPYRIGHT for full restrictions 5 : //* https://github.com/idaholab/moose/blob/master/COPYRIGHT 6 : //* 7 : //* Licensed under LGPL 2.1, please see LICENSE for details 8 : //* https://www.gnu.org/licenses/lgpl-2.1.html 9 : 10 : #include "ConstantDT.h" 11 : 12 : registerMooseObject("MooseApp", ConstantDT); 13 : 14 : InputParameters 15 69317 : ConstantDT::validParams() 16 : { 17 69317 : InputParameters params = TimeStepper::validParams(); 18 69317 : params.addRequiredParam<Real>("dt", "Size of the time step"); 19 : 20 : // The addRangeCheckedParam and addClassDescription are used in MOOSE documentation, if you 21 : // change the order or insert something you will mess it up. 22 69317 : params.addRangeCheckedParam<Real>( 23 : "growth_factor", 24 : 2, 25 : "growth_factor>=1", 26 : "Maximum ratio of new to previous timestep sizes following a step that required the time" 27 : " step to be cut due to a failed solve."); 28 69317 : params.addClassDescription("Timestepper that takes a constant time step size"); 29 : 30 69317 : return params; 31 0 : } 32 : 33 27526 : ConstantDT::ConstantDT(const InputParameters & parameters) 34 : : TimeStepper(parameters), 35 27526 : _constant_dt(getParam<Real>("dt")), 36 55052 : _growth_factor(getParam<Real>("growth_factor")) 37 : { 38 27526 : } 39 : 40 : Real 41 49071 : ConstantDT::computeInitialDT() 42 : { 43 49071 : return _constant_dt; 44 : } 45 : 46 : Real 47 155299 : ConstantDT::computeDT() 48 : { 49 155299 : return std::min(_constant_dt, _growth_factor * getCurrentDT()); 50 : }