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 "MaterialDerivativeRankTwoTestKernel.h" 11 : 12 : registerMooseObject("MooseApp", MaterialDerivativeRankTwoTestKernel); 13 : 14 : InputParameters 15 14265 : MaterialDerivativeRankTwoTestKernel::validParams() 16 : { 17 14265 : InputParameters params = MaterialDerivativeTestKernelBase<RankTwoTensor>::validParams(); 18 14265 : params.addClassDescription( 19 : "Class used for testing derivatives of a rank two tensor material property."); 20 14265 : params.addRequiredParam<unsigned int>("i", "Tensor component"); 21 14265 : params.addRequiredParam<unsigned int>("j", "Tensor component"); 22 14265 : return params; 23 0 : } 24 : 25 0 : MaterialDerivativeRankTwoTestKernel::MaterialDerivativeRankTwoTestKernel( 26 0 : const InputParameters & parameters) 27 : : MaterialDerivativeTestKernelBase<RankTwoTensor>(parameters), 28 0 : _component_i(getParam<unsigned int>("i")), 29 0 : _component_j(getParam<unsigned int>("j")) 30 : { 31 0 : } 32 : 33 : Real 34 0 : MaterialDerivativeRankTwoTestKernel::computeQpResidual() 35 : { 36 0 : return _p[_qp](_component_i, _component_j) * _test[_i][_qp]; 37 : } 38 : 39 : Real 40 0 : MaterialDerivativeRankTwoTestKernel::computeQpJacobian() 41 : { 42 0 : return _p_diag_derivative[_qp](_component_i, _component_j) * _phi[_j][_qp] * _test[_i][_qp]; 43 : } 44 : 45 : Real 46 0 : MaterialDerivativeRankTwoTestKernel::computeQpOffDiagJacobian(unsigned int jvar) 47 : { 48 : // get the coupled variable number corresponding to jvar 49 0 : const unsigned int cvar = mapJvarToCvar(jvar); 50 0 : return (*_p_off_diag_derivatives[cvar])[_qp](_component_i, _component_j) * _phi[_j][_qp] * 51 0 : _test[_i][_qp]; 52 : }