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 "ADCZMInterfaceKernelBase.h" 11 : #include "CZMInterfaceKernelBase.h" 12 : 13 : InputParameters 14 126 : ADCZMInterfaceKernelBase::validParams() 15 : { 16 126 : InputParameters params = CZMInterfaceKernelBase::validParams(); 17 126 : return params; 18 : } 19 : 20 42 : ADCZMInterfaceKernelBase::ADCZMInterfaceKernelBase(const InputParameters & parameters) 21 : : ADInterfaceKernel(parameters), 22 126 : _base_name(isParamValid("base_name") && !getParam<std::string>("base_name").empty() 23 42 : ? getParam<std::string>("base_name") + "_" 24 : : ""), 25 84 : _component(getParam<unsigned int>("component")), 26 42 : _ndisp(coupledComponents("displacements")), 27 42 : _traction_global(getADMaterialPropertyByName<RealVectorValue>( 28 126 : _base_name + getParam<std::string>("traction_global_name"))) 29 : { 30 : // Enforce consistency 31 42 : if (_ndisp != _mesh.dimension()) 32 0 : paramError("displacements", "Number of displacements must match problem dimension."); 33 : 34 42 : if (_ndisp > 3 || _ndisp < 1) 35 0 : mooseError("the CZM material requires 1, 2 or 3 displacement variables"); 36 42 : } 37 : 38 : ADReal 39 995328 : ADCZMInterfaceKernelBase::computeQpResidual(Moose::DGResidualType type) 40 : { 41 995328 : ADReal r = _traction_global[_qp](_component); 42 : 43 995328 : switch (type) 44 : { 45 : // [test_secondary-test_primary]*T where T represents the traction. 46 497664 : case Moose::Element: 47 497664 : r *= -_test[_i][_qp]; 48 497664 : break; 49 497664 : case Moose::Neighbor: 50 497664 : r *= _test_neighbor[_i][_qp]; 51 : break; 52 : } 53 : 54 995328 : return r; 55 : }