www.mooseframework.org
GradientComponent.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
7 #include "GradientComponent.h"
8 
9 template <>
10 InputParameters
12 {
13  InputParameters params = validParams<Kernel>();
14  params.addClassDescription(
15  "Set the kernel variable to a specified component of the gradient of a coupled variable.");
16  params.addRequiredCoupledVar("v", "Coupled variable to match gradient component of");
17  params.addRequiredParam<unsigned int>("component",
18  "Component of the gradient of the coupled variable v");
19  return params;
20 }
21 
22 GradientComponent::GradientComponent(const InputParameters & parameters)
23  : Kernel(parameters),
24  _v_var(coupled("v")),
25  _grad_v(coupledGradient("v")),
26  _component(getParam<unsigned int>("component"))
27 {
28  if (_component >= LIBMESH_DIM)
29  mooseError("Component too large for LIBMESH_DIM");
30 }
31 
32 Real
34 {
35  return (_u[_qp] - _grad_v[_qp](_component)) * _test[_i][_qp];
36 }
37 
38 Real
40 {
41  return _phi[_j][_qp] * _test[_i][_qp];
42 }
43 
44 Real
46 {
47  if (jvar == _v_var)
48  return -_grad_phi[_j][_qp](_component) * _test[_i][_qp];
49  return 0.0;
50 }
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
GradientComponent(const InputParameters &parameters)
const VariableGradient & _grad_v
Gradient of the coupled variable.
virtual Real computeQpJacobian()
const unsigned int _component
Component of the gradient vector to match.
virtual Real computeQpResidual()
const unsigned int _v_var
Identity of the coupled variable.
InputParameters validParams< GradientComponent >()