www.mooseframework.org
BoundingValueElementDamper.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 
16 
17 template <>
20 {
22  params.addParam<Real>("max_value",
23  std::numeric_limits<Real>::max(),
24  "The maximum permissible iterative value for the variable.");
25  params.addParam<Real>("min_value",
26  std::numeric_limits<Real>::lowest(),
27  "The minimum permissible iterative value for the variable.");
28  return params;
29 }
30 
32  : ElementDamper(parameters),
33  _max_value(parameters.get<Real>("max_value")),
34  _min_value(parameters.get<Real>("min_value"))
35 {
36  if (_min_value > _max_value)
37  mooseError("max_value must be greater than min_value");
38 }
39 
40 Real
42 {
43  // Note that _u_increment contains the negative of the increment
44  if (_u[_qp] < _min_value)
45  return 1.0 - (_u[_qp] - _min_value) / -_u_increment[_qp];
46  else if (_u[_qp] > _max_value)
47  return 1.0 - (_u[_qp] - _max_value) / -_u_increment[_qp];
48 
49  return 1.0;
50 }
const Real & _min_value
The minimum permissible value of the variable.
const VariableValue & _u
Holds the current solution at the current quadrature point.
Definition: ElementDamper.h:85
unsigned int _qp
Quadrature point index.
Definition: ElementDamper.h:74
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
VariableValue & _u_increment
The current Newton increment.
Definition: ElementDamper.h:83
const Real & _max_value
The maximum permissible value of the variable.
InputParameters validParams< BoundingValueElementDamper >()
Base class for deriving element dampers.
Definition: ElementDamper.h:37
InputParameters validParams< ElementDamper >()
Definition: ElementDamper.C:28
virtual Real computeQpDamping() override
Compute the damping for the current qp.
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 mooseError(Args &&...args) const
Definition: MooseObject.h:80
BoundingValueElementDamper(const InputParameters &parameters)