www.mooseframework.org
HHPFCRFF.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 
8 #include "HHPFCRFF.h"
9 
10 template <>
11 InputParameters
13 {
14  InputParameters params = validParams<KernelValue>();
15  params.addClassDescription("Reaction type kernel for the RFF phase fit crystal model");
16  params.addCoupledVar("coupled_var",
17  "The name of the coupled variable, if one is used in the kernel");
18  params.addRequiredParam<MaterialPropertyName>(
19  "prop_name", "Name of material property to be used in the kernel");
20  params.addRequiredParam<bool>(
21  "positive", "If the kernel is positive, this is true, if negative, it is false");
22  return params;
23 }
24 
25 HHPFCRFF::HHPFCRFF(const InputParameters & parameters)
26  : KernelValue(parameters),
27  _kernel_sign(getParam<bool>("positive") ? 1.0 : -1.0),
28  _prop(getMaterialProperty<Real>("prop_name")),
29  _has_coupled_var(isCoupled("coupled_var")),
30  _coupled_var(_has_coupled_var ? &coupledValue("coupled_var") : NULL),
31  _coupled_var_var(_has_coupled_var ? coupled("coupled_var") : 0)
32 {
33 }
34 
35 Real
37 {
38  // Assign value of the variable, whether coupled or not
39  Real var;
40  if (_has_coupled_var)
41  var = (*_coupled_var)[_qp];
42  else
43  var = _u[_qp];
44 
45  return _kernel_sign * _prop[_qp] * var;
46 }
47 
48 Real
50 {
51  if (_has_coupled_var)
52  return 0.0;
53 
54  return _kernel_sign * _prop[_qp] * _phi[_j][_qp];
55 }
56 
57 Real
59 {
60  if (_has_coupled_var && jvar == _coupled_var_var)
61  return _kernel_sign * _prop[_qp] * _phi[_j][_qp] * _test[_i][_qp];
62 
63  return 0.0;
64 }
const Real _kernel_sign
Definition: HHPFCRFF.h:32
HHPFCRFF(const InputParameters &parameters)
Definition: HHPFCRFF.C:25
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
Definition: HHPFCRFF.C:58
const bool _has_coupled_var
Definition: HHPFCRFF.h:36
virtual Real precomputeQpResidual()
Definition: HHPFCRFF.C:36
const unsigned int _coupled_var_var
Definition: HHPFCRFF.h:38
virtual Real precomputeQpJacobian()
Definition: HHPFCRFF.C:49
InputParameters validParams< HHPFCRFF >()
Definition: HHPFCRFF.C:12
const MaterialProperty< Real > & _prop
Definition: HHPFCRFF.h:34