www.mooseframework.org
ConstantDT.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 template <>
17 {
19  params.addRequiredParam<Real>("dt", "Size of the time step");
20  params.addRangeCheckedParam<Real>(
21  "growth_factor",
22  2,
23  "growth_factor>=1",
24  "Maximum ratio of new to previous timestep sizes following a step that required the time"
25  " step to be cut due to a failed solve.");
26  params.addClassDescription("Timestepper that takes a constant time step size");
27  return params;
28 }
29 
31  : TimeStepper(parameters),
32  _constant_dt(getParam<Real>("dt")),
33  _growth_factor(getParam<Real>("growth_factor"))
34 {
35 }
36 
37 Real
39 {
40  return _constant_dt;
41 }
42 
43 Real
45 {
46  return std::min(_constant_dt, _growth_factor * getCurrentDT());
47 }
const Real _constant_dt
Definition: ConstantDT.h:29
const Real _growth_factor
Definition: ConstantDT.h:30
Base class for time stepping.
Definition: TimeStepper.h:26
ConstantDT(const InputParameters &parameters)
Definition: ConstantDT.C:30
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
void addRequiredParam(const std::string &name, const std::string &doc_string)
This method adds a parameter and documentation string to the InputParameters object that will be extr...
virtual Real computeDT() override
Called to compute _current_dt for a normal step.
Definition: ConstantDT.C:44
virtual Real computeInitialDT() override
Called to compute _current_dt for the first timestep.
Definition: ConstantDT.C:38
registerMooseObject("MooseApp", ConstantDT)
InputParameters validParams< ConstantDT >()
Definition: ConstantDT.C:16
InputParameters validParams< TimeStepper >()
Definition: TimeStepper.C:17
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump...
void addRangeCheckedParam(const std::string &name, const T &value, const std::string &parsed_function, const std::string &doc_string)
Real getCurrentDT()
Get the current_dt.
Definition: TimeStepper.h:84