www.mooseframework.org
CoupledForce.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 "CoupledForce.h"
16 
17 template <>
20 {
22 
23  params.addClassDescription("Implements a source term proportional to the value of a coupled "
24  "variable. Weak form: $(\\psi_i, -\\sigma v)$.");
25  params.addRequiredCoupledVar("v", "The coupled variable which provides the force");
26  params.addParam<Real>(
27  "coef", 1.0, "Coefficent ($\\sigma$) multiplier for the coupled force term.");
28 
29  return params;
30 }
31 
33  : Kernel(parameters), _v_var(coupled("v")), _v(coupledValue("v")), _coef(getParam<Real>("coef"))
34 {
35 }
36 
37 Real
39 {
40  return -_coef * _v[_qp] * _test[_i][_qp];
41 }
42 
43 Real
45 {
46  return 0;
47 }
48 
49 Real
51 {
52  if (jvar == _v_var)
53  return -_coef * _phi[_j][_qp] * _test[_i][_qp];
54  return 0.0;
55 }
const VariableTestValue & _test
the current test function
Definition: KernelBase.h:152
virtual Real computeQpResidual() override
Compute this Kernel&#39;s contribution to the residual at the current quadrature point.
Definition: CoupledForce.C:38
CoupledForce(const InputParameters &parameters)
Definition: CoupledForce.C:32
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
const VariableValue & _v
Definition: CoupledForce.h:43
virtual Real computeQpJacobian() override
Compute this Kernel&#39;s contribution to the Jacobian at the current quadrature point.
Definition: CoupledForce.C:44
unsigned int _i
current index for the test function
Definition: KernelBase.h:146
virtual Real computeQpOffDiagJacobian(unsigned int jvar) override
This is the virtual that derived classes should override for computing an off-diagonal Jacobian compo...
Definition: CoupledForce.C:50
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
This method adds a coupled variable name pair.
const VariablePhiValue & _phi
the current shape functions
Definition: KernelBase.h:158
unsigned int _v_var
Definition: CoupledForce.h:42
unsigned int _j
current index for the shape function
Definition: KernelBase.h:149
InputParameters validParams< Kernel >()
Definition: Kernel.C:30
Definition: Kernel.h:25
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...
InputParameters validParams< CoupledForce >()
Definition: CoupledForce.C:19
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an option parameter and a documentation string to the InputParameters object...
unsigned int _qp
The current quadrature point index.
Definition: KernelBase.h:131