www.mooseframework.org
BoundingValueNodalDamper.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 
11 
13 
16 {
18  params.addClassDescription("Limits the value of a variable to be within user-specified bounds.");
19  params.addParam<Real>("max_value",
21  "The maximum permissible iterative value for the variable.");
22  params.addParam<Real>("min_value",
23  std::numeric_limits<Real>::lowest(),
24  "The minimum permissible iterative value for the variable.");
25  return params;
26 }
27 
29  : NodalDamper(parameters),
30  _max_value(parameters.get<Real>("max_value")),
31  _min_value(parameters.get<Real>("min_value"))
32 {
33  if (_min_value > _max_value)
34  mooseError("max_value must be greater than min_value");
35 }
36 
37 Real
39 {
40  // Note that _u_increment contains the negative of the increment
41  if (_u[_qp] < _min_value)
42  return 1.0 - (_u[_qp] - _min_value) / -_u_increment[_qp];
43  else if (_u[_qp] > _max_value)
44  return 1.0 - (_u[_qp] - _max_value) / -_u_increment[_qp];
45 
46  return 1.0;
47 }
registerMooseObject("MooseApp", BoundingValueNodalDamper)
T * get(const std::unique_ptr< T > &u)
The MooseUtils::get() specializations are used to support making forwards-compatible code changes fro...
Definition: MooseUtils.h:1147
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
const VariableValue & _u
Holds the current solution at the current node.
Definition: NodalDamper.h:71
auto max(const L &left, const R &right)
static InputParameters validParams()
const Real & _min_value
The minimum permissible value of the variable.
This class implements a damper that limits the value of a variable to be within user-specified bounds...
Base class for deriving nodal dampers.
Definition: NodalDamper.h:27
unsigned int _qp
Quadrature point index.
Definition: NodalDamper.h:66
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
BoundingValueNodalDamper(const InputParameters &parameters)
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type.
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...
virtual Real computeQpDamping() override
Compute the damping for the current node.
static InputParameters validParams()
Definition: NodalDamper.C:22
const VariableValue & _u_increment
The current Newton increment.
Definition: NodalDamper.h:69
const Real & _max_value
The maximum permissible value of the variable.