www.mooseframework.org
StickyBC.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 
15 #include "StickyBC.h"
16 #include "MooseVariable.h"
17 
18 template <>
19 InputParameters
21 {
22  InputParameters p = validParams<NodalBC>();
23  p.addParam<Real>(
24  "min_value",
25  std::numeric_limits<Real>::lowest(),
26  "If the old variable value <= min_value, the variable is fixed at its old value");
27  p.addParam<Real>(
28  "max_value",
29  std::numeric_limits<Real>::max(),
30  "If the old variable value >= max_value, the variable is fixed at its old value");
31  p.addClassDescription(
32  "Imposes the boundary condition $u = u_{old}$ if $u_{old}$ exceeds the bounds provided");
33  return p;
34 }
35 
36 StickyBC::StickyBC(const InputParameters & parameters)
37  : NodalBC(parameters),
38  _u_old(_var.nodalSlnOld()),
39  _min_value(getParam<Real>("min_value")),
40  _max_value(getParam<Real>("max_value"))
41 {
42  if (_min_value > _max_value)
43  mooseError("StickyBC: min_value must not be greater than max_value");
44 }
45 
46 bool
48 {
49  const unsigned qp = 0; // this is a NodalBC: all qp = 0
50  return (_u_old[qp] <= _min_value || _u_old[qp] >= _max_value);
51 }
52 
53 Real
55 {
56  return _u[_qp] - _u_old[_qp];
57 }
virtual Real computeQpResidual() override
Definition: StickyBC.C:54
StickyBC(const InputParameters &parameters)
Definition: StickyBC.C:36
InputParameters validParams< StickyBC >()
Definition: StickyBC.C:20
const VariableValue & _u_old
Definition: StickyBC.h:40
virtual bool shouldApply() override
Definition: StickyBC.C:47
const Real _min_value
The minimum bound.
Definition: StickyBC.h:42
const Real _max_value
The maximum bound.
Definition: StickyBC.h:44