https://mooseframework.inl.gov
Loading...
Searching...
No Matches
NodalDamper.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
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 "NodalDamper.h"
11
12// MOOSE includes
13#include "Assembly.h"
14#include "FEProblem.h"
15#include "MooseVariableFE.h"
16#include "SubProblem.h"
17#include "SystemBase.h"
18
19#include "libmesh/quadrature.h"
20
23{
26 params.addRequiredParam<NonlinearVariableName>(
27 "variable", "The name of the variable that this damper operates on");
28 return params;
29}
30
32 : Damper(parameters),
33 MaterialPropertyInterface(this, Moose::EMPTY_BLOCK_IDS, Moose::EMPTY_BOUNDARY_IDS),
34 _tid(parameters.get<THREAD_ID>("_tid")),
35 _assembly(_subproblem.assembly(_tid, _sys.number())),
36 _coord_sys(_assembly.coordSystem()),
37 _var(_sys.getFieldVariable<Real>(_tid, parameters.get<NonlinearVariableName>("variable"))),
38 _current_node(_var.node()),
39 _qp(0),
40 _u_increment(_var.increment()),
41 _u(_var.dofValues())
42{
43 mooseAssert(_var.count() == 1,
44 "NodalDamper only supports scalar variables. Variable '" + _var.name() +
45 "' has multiple components.");
46}
47
48Real
53
54bool
55NodalDamper::variableDefinedOnNode(const Node * node) const
56{
57 const unsigned int sys_num = _var.sys().number();
58 const unsigned int var_num = _var.number();
59
60 const unsigned int n_comp = node->n_comp(sys_num, var_num);
61
62 return n_comp;
63}
unsigned int THREAD_ID
Definition MooseTypes.h:237
Base class for deriving dampers.
Definition Damper.h:28
static InputParameters validParams()
Definition Damper.C:16
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
void addRequiredParam(const std::string &name, const std::string &doc_string)
This method adds a parameter and documentation string to the InputParameters object that will be extr...
An interface for accessing Materials.
static InputParameters validParams()
const std::string & name() const
Get the name of the class.
Definition MooseBase.h:103
SystemBase & sys()
Get the system this variable is part of.
unsigned int number() const
Get variable number coming from libMesh.
unsigned int count() const
Get the number of components Note: For standard and vector variables, the number is one.
MooseVariable & _var
Non-linear variable this damper works on.
Definition NodalDamper.h:65
static InputParameters validParams()
Definition NodalDamper.C:22
NodalDamper(const InputParameters &parameters)
Definition NodalDamper.C:31
bool variableDefinedOnNode(const Node *node) const
Check whether this damper's variable has DOFs on the given node.
Definition NodalDamper.C:55
Real computeDamping()
Computes this Damper's damping for one node.
Definition NodalDamper.C:49
virtual Real computeQpDamping()=0
This MUST be overridden by a child damper.
unsigned int number() const
Gets the number of this system.
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...