https://mooseframework.inl.gov
INSFVVariable.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 "INSFVVariable.h"
11 #include "InputParameters.h"
12 #include "MooseError.h"
14 #include "Attributes.h"
15 #include "SubProblem.h"
16 #include "MooseApp.h"
17 #include "TheWarehouse.h"
18 #include "INSFVAttributes.h"
19 #include "SystemBase.h"
21 #include "FVFluxBC.h"
22 
25 {
27 }
28 
30  : MooseVariableFVReal(params), _qp_calculations(false)
31 {
32 }
33 
34 void
36 {
38  std::vector<FVFluxBC *> bcs;
39 
40  const auto base_query = this->_subproblem.getMooseApp()
41  .theWarehouse()
42  .query()
43  .template condition<AttribSystem>("FVFluxBC")
44  .template condition<AttribThread>(_tid);
45 
46  for (const auto bnd_id : this->_mesh.getBoundaryIDs())
47  {
48  auto base_query_copy = base_query;
49  base_query_copy.template condition<AttribBoundaries>(std::set<BoundaryID>({bnd_id}))
50  .queryInto(bcs);
51  for (const auto bc : bcs)
52  {
53  const auto separator = dynamic_cast<const INSFVHydraulicSeparatorInterface *>(bc);
54  if (separator)
55  _boundary_id_to_separator.emplace(bnd_id, separator);
56  }
57  }
58 }
59 
60 void
62 {
65 }
66 
67 void
69 {
72 }
73 
74 void
76 {
79 }
80 
81 bool
83 {
84  for (const auto bid : fi.boundaryIDs())
85  if (_boundary_id_to_separator.count(bid))
86  return true;
87 
88  return false;
89 }
90 
91 bool
93  const Elem * const elem,
94  const Moose::StateArg & time) const
95 {
96  if (isDirichletBoundaryFace(fi, elem, time))
97  return false;
98  if (!isInternalFace(fi))
99  // We are neither a Dirichlet nor an internal face
100  return true;
101 
102  // If we got here, then we're definitely on an internal face
103  if (isSeparatorBoundary(fi))
104  return true;
105 
106  return false;
107 }
108 
109 bool
111 {
112  const auto & face_type = fi.faceType(std::make_pair(this->number(), this->sys().number()));
113 
114  mooseAssert(face_type != FaceInfo::VarFaceNeighbors::NEITHER,
115  "I'm concerned that if you're calling this method with a FaceInfo that doesn't have "
116  "this variable defined on either side, that you are doing something dangerous.");
117 
118  // If we're defined on both sides of the face, then we're not a boundary face
119  if (face_type == FaceInfo::VarFaceNeighbors::BOTH)
120  return false;
121 
122  std::vector<INSFVFullyDevelopedFlowBC *> bcs;
123 
124  this->_subproblem.getMooseApp()
125  .theWarehouse()
126  .query()
127  .template condition<AttribINSFVBCs>(INSFVBCs::INSFVFullyDevelopedFlowBC)
128  .template condition<AttribBoundaries>(fi.boundaryIDs())
129  .queryInto(bcs);
130 
131  return !bcs.empty();
132 }
const std::set< BoundaryID > & boundaryIDs() const
unsigned int number() const
virtual void meshChanged() override
virtual void initialSetup() override
MooseApp & getMooseApp() const
bool isExtrapolatedBoundaryFace(const FaceInfo &fi, const Elem *elem, const Moose::StateArg &time) const override
Definition: INSFVVariable.C:92
bool isSeparatorBoundary(const FaceInfo &fi) const
Definition: INSFVVariable.C:82
virtual bool isDirichletBoundaryFace(const FaceInfo &fi, const Elem *elem, const Moose::StateArg &state) const
bool isInternalFace(const FaceInfo &) const
virtual void initialSetup() override
Definition: INSFVVariable.C:75
std::unordered_map< BoundaryID, const INSFVHydraulicSeparatorInterface * > _boundary_id_to_separator
A container for quick access of hydraulic separator BCs associated with this variable.
Definition: INSFVVariable.h:56
SubProblem & _subproblem
INSFVVariable(const InputParameters &params)
Definition: INSFVVariable.C:29
virtual void meshChanged() override
Definition: INSFVVariable.C:68
virtual void timestepSetup() override
static InputParameters validParams()
Definition: INSFVVariable.C:24
void cacheSeparatorBoundaries()
Caches the separator boundaries.
Definition: INSFVVariable.C:35
Query query()
A base class which serves as a tag for hydraulic separators.
virtual void timestepSetup() override
Definition: INSFVVariable.C:61
static InputParameters validParams()
TheWarehouse & theWarehouse()
std::vector< BoundaryID > getBoundaryIDs(const Elem *const elem, const unsigned short int side) const
bool isFullyDevelopedFlowFace(const FaceInfo &fi) const
Returns whether the passed-in FaceInfo corresponds to a fully-developed flow face.
VarFaceNeighbors faceType(const std::pair< unsigned int, unsigned int > &var_sys) const