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