www.mooseframework.org
PostprocessorDT.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 "PostprocessorDT.h"
16 
17 template <>
20 {
22  params.addRequiredParam<PostprocessorName>("postprocessor",
23  "The name of the postprocessor that computes the dt");
24  params.addParam<Real>("dt", "Initial value of dt");
25  params.addParam<Real>("scale", 1, "Multiple scale and supplied postprocessor value.");
26  params.addParam<Real>("factor", 0, "Add a factor to the supplied postprocessor value.");
27  return params;
28 }
29 
31  : TimeStepper(parameters),
33  _pps_value(getPostprocessorValue("postprocessor")),
34  _has_initial_dt(isParamValid("dt")),
35  _initial_dt(_has_initial_dt ? getParam<Real>("dt") : 0.),
36  _scale(getParam<Real>("scale")),
37  _factor(getParam<Real>("factor"))
38 {
39 }
40 
41 Real
43 {
44  if (_has_initial_dt)
45  return _initial_dt;
46  else
47  return computeDT();
48 }
49 
50 Real
52 {
53  return _scale * _pps_value + _factor;
54 }
const Real & _factor
Factor added to the postprocessor value.
const Real & _scale
Multiplier applied to the postprocessor value.
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 PostprocessorValue & _pps_value
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 computeInitialDT() override
Called to compute _current_dt for the first timestep.
InputParameters validParams< PostprocessorDT >()
InputParameters validParams< TimeStepper >()
Definition: TimeStepper.C:22
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an option parameter and a documentation string to the InputParameters object...
PostprocessorDT(const InputParameters &parameters)
Interface class for classes which interact with Postprocessors.
virtual Real computeDT() override
Called to compute _current_dt for a normal step.