www.mooseframework.org
PostprocessorDT.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 "PostprocessorDT.h"
11 
13 
16 {
18  params.addClassDescription("Computes timestep based on a Postprocessor value.");
19  params.addRequiredParam<PostprocessorName>("postprocessor",
20  "The name of the postprocessor that computes the dt");
21  params.addParam<Real>("dt", "Initial value of dt");
22  params.addParam<Real>("scale", 1, "Multiple scale and supplied postprocessor value.");
23  params.addParam<Real>("offset", 0, "Add an offset to the supplied postprocessor value.");
24  params.addDeprecatedParam<Real>("factor",
25  "Add an offset to the supplied postprocessor value",
26  "offset has replaced factor for that same purpose");
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  _offset(isParamValid("offset") ? getParam<Real>("offset") : 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 + _offset;
54 }
static InputParameters validParams()
Definition: TimeStepper.C:16
void addDeprecatedParam(const std::string &name, const T &value, const std::string &doc_string, const std::string &deprecation_message)
const Real & _scale
Multiplier applied to the postprocessor value.
Base class for time stepping.
Definition: TimeStepper.h:22
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
registerMooseObject("MooseApp", PostprocessorDT)
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.
const Real & _offset
Offset added to the postprocessor value.
Computes the value of dt based on a postprocessor value.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static InputParameters validParams()
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 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.