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