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 144113 : InterfaceUserObject::validParams() 19 : { 20 144113 : InputParameters params = InterfaceUserObjectBase::validParams(); 21 144113 : params.addClassDescription("Basic UO class to perform computation across an interface"); 22 144113 : return params; 23 0 : } 24 : 25 755 : InterfaceUserObject::InterfaceUserObject(const InputParameters & parameters) 26 755 : : InterfaceUserObjectBase(parameters), _has_fv_vars(false), _fi(nullptr) 27 : { 28 : // Check for finite volume variables 29 : // const std::vector<MooseVariableFEBase *> & coupled_vars = getCoupledMooseVars(); 30 1982 : for (const auto & var : _coupled_moose_vars) 31 1227 : if (var->isFV()) 32 98 : _has_fv_vars = true; 33 755 : } 34 : 35 : void 36 2112 : InterfaceUserObject::execute() 37 : { 38 2112 : if (_has_fv_vars) 39 : { 40 : // Retrieve the face info from the mesh 41 198 : _fi = _mesh.faceInfo(_current_elem, _current_side); 42 198 : 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 198 : auto pr = _face_infos_processed.insert(_fi); 61 198 : 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 453 : InterfaceUserObject::initialize() 69 : { 70 453 : if (_has_fv_vars) 71 52 : _face_infos_processed.clear(); 72 453 : } 73 : 74 : const Real & 75 0 : InterfaceUserObject::getNeighborElemVolume() 76 : { 77 0 : return _current_neighbor_volume; 78 : }