https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
28
30 : MooseVariableFVReal(params), _qp_calculations(false)
31{
32}
33
34void
36{
38 std::vector<FVFluxBC *> bcs;
39
40 const auto base_query = this->_subproblem.getMooseApp()
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
60void
66
67void
73
74void
80
81bool
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
91bool
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
109bool
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
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}
@ INSFVFullyDevelopedFlowBC
VarFaceNeighbors faceType(const std::pair< unsigned int, unsigned int > &var_sys) const
const std::set< BoundaryID > & boundaryIDs() const
A base class which serves as a tag for hydraulic separators.
virtual void initialSetup() override
virtual void timestepSetup() override
bool isExtrapolatedBoundaryFace(const FaceInfo &fi, const Elem *elem, const Moose::StateArg &time) const override
virtual void meshChanged() override
void cacheSeparatorBoundaries()
Caches the separator boundaries.
INSFVVariable(const InputParameters &params)
std::unordered_map< BoundaryID, const INSFVHydraulicSeparatorInterface * > _boundary_id_to_separator
A container for quick access of hydraulic separator BCs associated with this variable.
static InputParameters validParams()
bool isSeparatorBoundary(const FaceInfo &fi) const
bool isFullyDevelopedFlowFace(const FaceInfo &fi) const
Returns whether the passed-in FaceInfo corresponds to a fully-developed flow face.
TheWarehouse & theWarehouse()
MooseApp & getMooseApp() const
std::vector< BoundaryID > getBoundaryIDs(const Elem *const elem, const unsigned short int side) const
SubProblem & _subproblem
unsigned int number() const
virtual void meshChanged() override
static InputParameters validParams()
virtual bool isDirichletBoundaryFace(const FaceInfo &fi, const Elem *elem, const Moose::StateArg &state) const
virtual void timestepSetup() override
virtual void initialSetup() override
bool isInternalFace(const FaceInfo &) const
Query query()