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