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 "InterfaceKernelBase.h" 11 : 12 : // MOOSE includes 13 : #include "Assembly.h" 14 : #include "MooseVariableFE.h" 15 : #include "SystemBase.h" 16 : 17 : #include "libmesh/quadrature.h" 18 : 19 : InputParameters 20 44499 : InterfaceKernelBase::validParams() 21 : { 22 44499 : InputParameters params = NeighborResidualObject::validParams(); 23 44499 : params += BoundaryRestrictable::validParams(); 24 44499 : params += TwoMaterialPropertyInterface::validParams(); 25 : 26 133497 : params.addParam<bool>("use_displaced_mesh", 27 88998 : false, 28 : "Whether or not this object should use the " 29 : "displaced mesh for computation. Note that in " 30 : "the case this is true but no displacements " 31 : "are provided in the Mesh block the " 32 : "undisplaced mesh will still be used."); 33 133497 : params.addParamNamesToGroup("use_displaced_mesh", "Advanced"); 34 : 35 133497 : params.declareControllable("enable"); 36 177996 : params.addRequiredCoupledVar("neighbor_var", "The variable on the other side of the interface."); 37 88998 : params.registerBase("InterfaceKernel"); 38 88998 : params.registerSystemAttributeName("InterfaceKernel"); 39 177996 : params.addParam<std::vector<AuxVariableName>>( 40 : "save_in", 41 : {}, 42 : "The name of auxiliary variables to save this Kernel's residual contributions to. " 43 : " Everything about that variable must match everything about this variable (the " 44 : "type, what blocks it's on, etc.)"); 45 177996 : params.addParam<std::vector<AuxVariableName>>( 46 : "diag_save_in", 47 : {}, 48 : "The name of auxiliary variables to save this Kernel's diagonal Jacobian " 49 : "contributions to. Everything about that variable must match everything " 50 : "about this variable (the type, what blocks it's on, etc.)"); 51 : 52 88998 : MultiMooseEnum save_in_var_side("m s"); 53 177996 : params.addParam<MultiMooseEnum>( 54 : "save_in_var_side", 55 : save_in_var_side, 56 : "This parameter must exist if save_in variables are specified and must have the same length " 57 : "as save_in. This vector specifies whether the corresponding aux_var should save-in " 58 : "residual contributions from the primary ('p') or secondary side ('s')."); 59 177996 : params.addParam<MultiMooseEnum>( 60 : "diag_save_in_var_side", 61 : save_in_var_side, 62 : "This parameter must exist if diag_save_in variables are specified and must have the same " 63 : "length as diag_save_in. This vector specifies whether the corresponding aux_var should " 64 : "save-in jacobian contributions from the primary ('p') or secondary side ('s')."); 65 133497 : params.addParamNamesToGroup("diag_save_in save_in save_in_var_side diag_save_in_var_side", 66 : "Residual and Jacobian debug output"); 67 : 68 : // InterfaceKernels always need one layer of ghosting. 69 133497 : params.addRelationshipManager("ElementSideNeighborLayers", 70 : Moose::RelationshipManagerType::GEOMETRIC | 71 : Moose::RelationshipManagerType::ALGEBRAIC | 72 : Moose::RelationshipManagerType::COUPLING); 73 88998 : return params; 74 44499 : } 75 : 76 873 : InterfaceKernelBase::InterfaceKernelBase(const InputParameters & parameters) 77 : : NeighborResidualObject(parameters), 78 : BoundaryRestrictable(this, false), // false for _not_ nodal 79 : NeighborCoupleableMooseVariableDependencyIntermediateInterface(this, false, false), 80 : TwoMaterialPropertyInterface(this, Moose::EMPTY_BLOCK_IDS, boundaryIDs()), 81 : ElementIDInterface(this), 82 1746 : _current_elem(_assembly.elem()), 83 873 : _current_elem_volume(_assembly.elemVolume()), 84 873 : _neighbor_elem(_assembly.neighbor()), 85 873 : _neighbor_elem_volume(_assembly.neighborVolume()), 86 873 : _current_side(_assembly.side()), 87 873 : _current_side_elem(_assembly.sideElem()), 88 873 : _current_side_volume(_assembly.sideElemVolume()), 89 873 : _coord_sys(_assembly.coordSystem()), 90 873 : _q_point(_assembly.qPointsFace()), 91 873 : _qrule(_assembly.qRuleFace()), 92 873 : _JxW(_assembly.JxWFace()), 93 873 : _coord(_assembly.coordTransformation()), 94 873 : _save_in_var_side(parameters.get<MultiMooseEnum>("save_in_var_side")), 95 873 : _save_in_strings(parameters.get<std::vector<AuxVariableName>>("save_in")), 96 873 : _diag_save_in_var_side(parameters.get<MultiMooseEnum>("diag_save_in_var_side")), 97 2619 : _diag_save_in_strings(parameters.get<std::vector<AuxVariableName>>("diag_save_in")) 98 : { 99 873 : } 100 : 101 : const Real & 102 0 : InterfaceKernelBase::getNeighborElemVolume() 103 : { 104 0 : return _assembly.neighborVolume(); 105 : } 106 : 107 : void 108 29925 : InterfaceKernelBase::prepareShapes(const unsigned int var_num) 109 : { 110 29925 : _subproblem.prepareFaceShapes(var_num, _tid); 111 29925 : }