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 
15 
18 {
20  params.addParam<Real>("max_value",
21  std::numeric_limits<Real>::max(),
22  "The maximum permissible iterative value for the variable.");
23  params.addParam<Real>("min_value",
24  std::numeric_limits<Real>::lowest(),
25  "The minimum permissible iterative value for the variable.");
26  return params;
27 }
28 
30  : NodalDamper(parameters),
31  _max_value(parameters.get<Real>("max_value")),
32  _min_value(parameters.get<Real>("min_value"))
33 {
34  if (_min_value > _max_value)
35  mooseError("max_value must be greater than min_value");
36 }
37 
38 Real
40 {
41  // Note that _u_increment contains the negative of the increment
42  if (_u[_qp] < _min_value)
43  return 1.0 - (_u[_qp] - _min_value) / -_u_increment[_qp];
44  else if (_u[_qp] > _max_value)
45  return 1.0 - (_u[_qp] - _max_value) / -_u_increment[_qp];
46 
47  return 1.0;
48 }
NodalDamper::_u
const VariableValue & _u
Holds the current solution at the current node.
Definition: NodalDamper.h:76
defineLegacyParams
defineLegacyParams(BoundingValueNodalDamper)
MooseObject::mooseError
void mooseError(Args &&... args) const
Definition: MooseObject.h:141
BoundingValueNodalDamper
This class implements a damper that limits the value of a variable to be within user-specified bounds...
Definition: BoundingValueNodalDamper.h:25
BoundingValueNodalDamper::computeQpDamping
virtual Real computeQpDamping() override
Compute the damping for the current node.
Definition: BoundingValueNodalDamper.C:39
InputParameters::addParam
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.
Definition: InputParameters.h:1198
NodalDamper
Base class for deriving nodal dampers.
Definition: NodalDamper.h:32
BoundingValueNodalDamper.h
InputParameters
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
Definition: InputParameters.h:53
NodalDamper::_qp
unsigned int _qp
Quadrature point index.
Definition: NodalDamper.h:71
BoundingValueNodalDamper::validParams
static InputParameters validParams()
Definition: BoundingValueNodalDamper.C:17
NodalDamper::validParams
static InputParameters validParams()
Definition: NodalDamper.C:24
BoundingValueNodalDamper::_max_value
const Real & _max_value
The maximum permissible value of the variable.
Definition: BoundingValueNodalDamper.h:34
registerMooseObject
registerMooseObject("MooseApp", BoundingValueNodalDamper)
BoundingValueNodalDamper::_min_value
const Real & _min_value
The minimum permissible value of the variable.
Definition: BoundingValueNodalDamper.h:36
NodalDamper::_u_increment
const VariableValue & _u_increment
The current Newton increment.
Definition: NodalDamper.h:74
BoundingValueNodalDamper::BoundingValueNodalDamper
BoundingValueNodalDamper(const InputParameters &parameters)
Definition: BoundingValueNodalDamper.C:29