www.mooseframework.org
LogConstantDT.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 "LogConstantDT.h"
11 
13 
14 template <>
17 {
19  params.addClassDescription(
20  "TimeStepper which imposes a time step constant in the logarithmic space");
21  params.addRequiredRangeCheckedParam<Real>("log_dt", "log_dt > 0", "Time step in log10(time)");
22  params.addRequiredRangeCheckedParam<Real>(
23  "first_dt", "first_dt > 0", "Initial time step (in absolute time)");
24  params.addRangeCheckedParam<Real>(
25  "growth_factor",
26  2,
27  "growth_factor>=1",
28  "Maximum ratio of new to previous timestep sizes following a step that required the time"
29  " step to be cut due to a failed solve.");
30  return params;
31 }
32 
34  : TimeStepper(parameters),
35  _log_dt(getParam<Real>("log_dt")),
36  _first_dt(getParam<Real>("first_dt")),
37  _dt_factor(std::pow(10.0, _log_dt)),
38  _growth_factor(getParam<Real>("growth_factor"))
39 {
40 }
41 
42 Real
44 {
45  return _first_dt;
46 }
47 
48 Real
50 {
51  Real next = _time * _dt_factor;
52  return std::min(next - _time, _growth_factor * getCurrentDT());
53 }
Simple time-stepper which imposes a time step constant in the logarithmic space.
Definition: LogConstantDT.h:21
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:43
const Real _first_dt
first time step (in absolute time)
Definition: LogConstantDT.h:35
const Real _dt_factor
Definition: LogConstantDT.h:37
Base class for time stepping.
Definition: TimeStepper.h:26
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
const Real _growth_factor
Definition: LogConstantDT.h:39
Real pow(Real x, int e)
Definition: MathUtils.C:211
registerMooseObject("MooseApp", LogConstantDT)
virtual Real computeDT() override
Called to compute _current_dt for a normal step.
Definition: LogConstantDT.C:49
InputParameters validParams< TimeStepper >()
Definition: TimeStepper.C:17
InputParameters validParams< LogConstantDT >()
Definition: LogConstantDT.C:16
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:33
Real getCurrentDT()
Get the current_dt.
Definition: TimeStepper.h:84
Real & _time
Values from executioner.
Definition: TimeStepper.h:124