https://mooseframework.inl.gov
Loading...
Searching...
No Matches
CoupledForceNodalKernel.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
11
13
16{
18 params.addClassDescription("Adds a force proportional to the value of the coupled variable");
19 params.addRequiredCoupledVar("v", "The coupled variable which provides the force");
20 params.addParam<Real>(
21 "coef", 1.0, "Coefficent ($\\sigma$) multiplier for the coupled force term.");
22
23 return params;
24}
25
27 : NodalKernel(parameters),
28 _v_var(coupled("v")),
29 _v(coupledValue("v")),
30 _coef(getParam<Real>("coef"))
31{
32 if (_var.number() == _v_var)
34 "Coupled variable 'v' needs to be different from 'variable' with CoupledForceNodalKernel, "
35 "consider using Reaction or somethig similar");
36}
37
38Real
43
44Real
49
50Real
52{
53 if (jvar == _v_var)
54 return -_coef;
55 return 0.0;
56}
registerMooseObject("MooseApp", CoupledForceNodalKernel)
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Definition MooseError.h:311
Adds a force proportional to the value of the coupled variable.
const unsigned int _v_var
The number of the coupled variable.
const Real _coef
A multiplicative factor for computing the coupled force.
static InputParameters validParams()
CoupledForceNodalKernel(const InputParameters &parameters)
const VariableValue & _v
The value of the coupled variable.
virtual Real computeQpJacobian() override
The user can override this function to compute the "on-diagonal" Jacobian contribution.
virtual Real computeQpResidual() override
The user can override this function to compute the residual at a node.
virtual Real computeQpOffDiagJacobian(unsigned int jvar) override
This is the virtual that derived classes should override for computing an off-diagonal jacobian compo...
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
This method adds a coupled variable name pair.
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an optional parameter and a documentation string to the InputParameters object.
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump.
unsigned int number() const
Get variable number coming from libMesh.
unsigned int _qp
Quadrature point index.
Base class for creating nodal kernels with hand-coded Jacobians.
Definition NodalKernel.h:19
static InputParameters validParams()
Class constructor.
Definition NodalKernel.C:18
MooseVariable & _var
variable this works on
Definition NodalKernel.h:79