https://mooseframework.inl.gov
Loading...
Searching...
No Matches
InterfaceUserObject.C
Go to the documentation of this file.
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
19{
21 params.addClassDescription("Basic UO class to perform computation across an interface");
22 return params;
23}
24
26 : InterfaceUserObjectBase(parameters), _has_fv_vars(false), _fi(nullptr)
27{
28 // Check for finite volume variables
29 // const std::vector<MooseVariableFEBase *> & coupled_vars = getCoupledMooseVars();
30 for (const auto & var : _coupled_moose_vars)
31 if (var->isFV())
32 _has_fv_vars = true;
33}
34
35void
37{
38 if (_has_fv_vars)
39 {
40 // Retrieve the face info from the mesh
42 if (!_fi)
43 {
44 // Let's check the other side
45 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 if (neighbor)
50 {
51 const auto neigh_side = neighbor->which_neighbor_am_i(_current_elem);
52 _fi = _mesh.faceInfo(neighbor, neigh_side);
53 }
54
55 if (!_fi)
56 // We still don't have a face info. It must be owned by another process
57 return;
58 }
59
60 auto pr = _face_infos_processed.insert(_fi);
61 if (!pr.second)
62 // Insertion didn't happen so we must have already processed this FaceInfo
63 return;
64 }
65}
66
67void
73
74const Real &
std::vector< MooseVariableFieldBase * > _coupled_moose_vars
Vector of all coupled variables.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump.
Base class for implementing interface user objects.
const unsigned int & _current_side
current side of the current element
const Real & _current_neighbor_volume
current neighbor volume
static InputParameters validParams()
const Elem *const & _current_elem
current element
std::unordered_set< const FaceInfo * > _face_infos_processed
A set of all the face infos that have been already looked at.
const FaceInfo * _fi
A pointer to a face info, useful when working with FV.
const Real & getNeighborElemVolume()
The volume (or length) of the current neighbor.
bool _has_fv_vars
Whether finite volume variables are involved in the user object.
static InputParameters validParams()
virtual void initialize() override
Called before execute() is ever called so that data can be cleared.
InterfaceUserObject(const InputParameters &parameters)
virtual void execute() override
Execute method.
const std::vector< const FaceInfo * > & faceInfo() const
Accessor for local FaceInfo objects.
Definition MooseMesh.h:2349