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