https://mooseframework.inl.gov
LogConstantDT.C
Go to the documentation of this file.
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 "LogConstantDT.h"
11 
13 
16 {
18  params.addClassDescription(
19  "TimeStepper which imposes a time step constant in the logarithmic space");
20  params.addRequiredRangeCheckedParam<Real>("log_dt", "log_dt > 0", "Time step in log10(time)");
22  "first_dt", "first_dt > 0", "Initial time step (in absolute time)");
23  params.addRangeCheckedParam<Real>(
24  "growth_factor",
25  2,
26  "growth_factor>=1",
27  "Maximum ratio of new to previous timestep sizes following a step that required the time"
28  " step to be cut due to a failed solve.");
29  return params;
30 }
31 
33  : TimeStepper(parameters),
34  _log_dt(getParam<Real>("log_dt")),
35  _first_dt(getParam<Real>("first_dt")),
36  _dt_factor(std::pow(10.0, _log_dt)),
37  _growth_factor(getParam<Real>("growth_factor"))
38 {
39 }
40 
41 Real
43 {
44  return _first_dt;
45 }
46 
47 Real
49 {
50  Real next = _time * _dt_factor;
51  return std::min(next - _time, _growth_factor * getCurrentDT());
52 }
static InputParameters validParams()
Definition: TimeStepper.C:16
Simple time-stepper which imposes a time step constant in the logarithmic space.
Definition: LogConstantDT.h:16
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
Computes time step size for the initial time step.
Definition: LogConstantDT.C:42
const Real _first_dt
first time step (in absolute time)
Definition: LogConstantDT.h:32
const Real _dt_factor
Definition: LogConstantDT.h:34
Base class for time stepping.
Definition: TimeStepper.h:22
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
const Real _growth_factor
Definition: LogConstantDT.h:36
T pow(const T &x)
registerMooseObject("MooseApp", LogConstantDT)
virtual Real computeDT() override
Computes time step size after the initial time step.
Definition: LogConstantDT.C:48
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
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:32
auto min(const L &left, const R &right)
Real getCurrentDT()
Get the current_dt.
Definition: TimeStepper.h:85
Real & _time
Values from executioner.
Definition: TimeStepper.h:125
static InputParameters validParams()
Definition: LogConstantDT.C:15