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