www.mooseframework.org
Damper.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 "Damper.h"
11 #include "SystemBase.h"
12 #include "SubProblem.h"
13 #include "Conversion.h"
14 
15 template <>
18 {
20  params.declareControllable("enable"); // allows Control to enable/disable this type of object
21  params.registerBase("Damper");
22  params.addParam<Real>("min_damping",
23  0.0,
24  "Minimum value of computed damping. Damping lower than "
25  "this will result in an exception being thrown and "
26  "cutting the time step");
27  return params;
28 }
29 
30 Damper::Damper(const InputParameters & parameters)
31  : MooseObject(parameters),
32  SetupInterface(this),
33  Restartable(this, "Dampers"),
34  MeshChangedInterface(parameters),
35  _subproblem(*getCheckedPointerParam<SubProblem *>("_subproblem")),
36  _sys(*getCheckedPointerParam<SystemBase *>("_sys")),
37  _min_damping(getParam<Real>("min_damping"))
38 {
39 }
40 
41 void
42 Damper::checkMinDamping(const Real cur_damping) const
43 {
44  if (cur_damping < _min_damping)
45  throw MooseException("From damper: '" + name() + "' damping below min_damping: " +
46  Moose::stringify(cur_damping) + " Cutting timestep.");
47 }
A class for creating restricted objects.
Definition: Restartable.h:29
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
Base class for a system (of equations)
Definition: SystemBase.h:92
Damper(const InputParameters &parameters)
Definition: Damper.C:30
void registerBase(const std::string &value)
This method must be called from every base "Moose System" to create linkage with the Action System...
Interface for notifications that the mesh has changed.
void checkMinDamping(const Real cur_damping) const
Check whether damping is below the user-specified minimum value, and throw an exception if it is...
Definition: Damper.C:42
Every object that can be built by the factory should be derived from this class.
Definition: MooseObject.h:42
const Real & _min_damping
Minimum allowable value of damping.
Definition: Damper.h:49
InputParameters validParams< Damper >()
Definition: Damper.C:17
std::string stringify(const T &t)
conversion to string
Definition: Conversion.h:60
InputParameters validParams< MooseObject >()
Definition: MooseObject.C:25
Provides a way for users to bail out of the current solve.
Generic class for solving transient nonlinear problems.
Definition: SubProblem.h:59
const std::string & name() const
Get the name of the object.
Definition: MooseObject.h:59
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...
void declareControllable(const std::string &name, std::set< ExecFlagType > execute_flags={})
Declare the given parameters as controllable.