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 "InterfaceUserObject.h" 11 : #include "SubProblem.h" 12 : #include "MooseTypes.h" 13 : #include "Assembly.h" 14 : 15 : #include "libmesh/remote_elem.h" 16 : 17 : InputParameters 18 144017 : InterfaceUserObject::validParams() 19 : { 20 144017 : InputParameters params = InterfaceUserObjectBase::validParams(); 21 144017 : params.addClassDescription("Basic UO class to perform computation across an interface"); 22 144017 : return params; 23 0 : } 24 : 25 707 : InterfaceUserObject::InterfaceUserObject(const InputParameters & parameters) 26 707 : : InterfaceUserObjectBase(parameters), _has_fv_vars(false), _fi(nullptr) 27 : { 28 : // Check for finite volume variables 29 : // const std::vector<MooseVariableFEBase *> & coupled_vars = getCoupledMooseVars(); 30 1851 : for (const auto & var : _coupled_moose_vars) 31 1144 : if (var->isFV()) 32 91 : _has_fv_vars = true; 33 707 : } 34 : 35 : void 36 1877 : InterfaceUserObject::execute() 37 : { 38 1877 : if (_has_fv_vars) 39 : { 40 : // Retrieve the face info from the mesh 41 176 : _fi = _mesh.faceInfo(_current_elem, _current_side); 42 176 : if (!_fi) 43 : { 44 : // Let's check the other side 45 0 : const Elem * const neighbor = _current_elem->neighbor_ptr(_current_side); 46 : mooseAssert(neighbor != remote_elem, 47 : "I'm pretty confident that if we got here then our neighbor should be " 48 : "local/ghosted/null"); 49 0 : if (neighbor) 50 : { 51 0 : const auto neigh_side = neighbor->which_neighbor_am_i(_current_elem); 52 0 : _fi = _mesh.faceInfo(neighbor, neigh_side); 53 : } 54 : 55 0 : if (!_fi) 56 : // We still don't have a face info. It must be owned by another process 57 0 : return; 58 : } 59 : 60 176 : auto pr = _face_infos_processed.insert(_fi); 61 176 : if (!pr.second) 62 : // Insertion didn't happen so we must have already processed this FaceInfo 63 0 : return; 64 : } 65 : } 66 : 67 : void 68 418 : InterfaceUserObject::initialize() 69 : { 70 418 : if (_has_fv_vars) 71 48 : _face_infos_processed.clear(); 72 418 : } 73 : 74 : const Real & 75 0 : InterfaceUserObject::getNeighborElemVolume() 76 : { 77 0 : return _current_neighbor_volume; 78 : }