www.mooseframework.org
LogConstantDT.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* DO NOT MODIFY THIS HEADER */
3 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
4 /* */
5 /* (c) 2010 Battelle Energy Alliance, LLC */
6 /* ALL RIGHTS RESERVED */
7 /* */
8 /* Prepared by Battelle Energy Alliance, LLC */
9 /* Under Contract No. DE-AC07-05ID14517 */
10 /* With the U. S. Department of Energy */
11 /* */
12 /* See COPYRIGHT for full restrictions */
13 /****************************************************************/
14 
15 #include "LogConstantDT.h"
16 
17 template <>
20 {
22  params.addClassDescription(
23  "TimeStepper which imposes a time step constant in the logarithmic space");
24  params.addRequiredRangeCheckedParam<Real>("log_dt", "log_dt > 0", "Time step in log10(time)");
25  params.addRequiredRangeCheckedParam<Real>(
26  "first_dt", "first_dt > 0", "Initial time step (in absolute time)");
27  params.addRangeCheckedParam<Real>(
28  "growth_factor",
29  2,
30  "growth_factor>=1",
31  "Maximum ratio of new to previous timestep sizes following a step that required the time"
32  " step to be cut due to a failed solve.");
33  return params;
34 }
35 
37  : TimeStepper(parameters),
38  _log_dt(getParam<Real>("log_dt")),
39  _first_dt(getParam<Real>("first_dt")),
40  _dt_factor(std::pow(10.0, _log_dt)),
41  _growth_factor(getParam<Real>("growth_factor"))
42 {
43 }
44 
45 Real
47 {
48  return _first_dt;
49 }
50 
51 Real
53 {
54  Real next = _time * _dt_factor;
55  return std::min(next - _time, _growth_factor * getCurrentDT());
56 }
void addRequiredRangeCheckedParam(const std::string &name, const std::string &parsed_function, const std::string &doc_string)
These methods add an range checked parameters.
virtual Real computeInitialDT() override
Called to compute _current_dt for the first timestep.
Definition: LogConstantDT.C:46
const Real _first_dt
first time step (in absolute time)
Definition: LogConstantDT.h:41
const Real _dt_factor
Definition: LogConstantDT.h:43
Base class for time stepping.
Definition: TimeStepper.h:31
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
const Real _growth_factor
Definition: LogConstantDT.h:45
virtual Real computeDT() override
Called to compute _current_dt for a normal step.
Definition: LogConstantDT.C:52
InputParameters validParams< TimeStepper >()
Definition: TimeStepper.C:22
InputParameters validParams< LogConstantDT >()
Definition: LogConstantDT.C:19
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)
LogConstantDT(const InputParameters &parameters)
Definition: LogConstantDT.C:36
Real getCurrentDT()
Get the current_dt.
Definition: TimeStepper.h:89
Real & _time
Values from executioner.
Definition: TimeStepper.h:129