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