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