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