https://mooseframework.inl.gov
INSFVBCInterface.h
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 #pragma once
11 
12 #include "MooseTypes.h"
13 #include "INSFVAttributes.h"
14 #include "SubProblem.h"
15 #include "MooseMesh.h"
16 #include "TheWarehouse.h"
17 #include "MooseApp.h"
18 #include "INSFVNoSlipWallBC.h"
19 #include "INSFVSlipWallBC.h"
20 #include "INSFVFreeSurfaceBC.h"
21 #include "INSFVSymmetryBC.h"
23 #include <set>
24 
31 {
32 protected:
36  template <typename T>
37  void initialSetup(T & insfv_fk);
38 
40  std::set<BoundaryID> _no_slip_wall_boundaries;
41 
43  std::set<BoundaryID> _slip_wall_boundaries;
44 
46  std::set<BoundaryID> _free_surface_boundaries;
47 
49  std::set<BoundaryID> _flow_boundaries;
50 
52  std::set<BoundaryID> _fully_developed_flow_boundaries;
53 
55  std::set<BoundaryID> _symmetry_boundaries;
56 
58  std::set<BoundaryID> _all_boundaries;
59 
60 private:
64  template <typename T>
65  void setupFlowBoundaries(T & insfv_fk, BoundaryID bnd_id);
66 
70  template <typename T, typename T2>
71  void setupBoundaries(T2 & insfv_fk,
72  const BoundaryID bnd_id,
73  INSFVBCs bc_type,
74  std::set<BoundaryID> & bnd_ids);
75 };
76 
77 template <typename T>
78 void
80 {
81  const auto & mesh = insfv_fk.subProblem().mesh();
82 
83  std::set<BoundaryID> all_connected_boundaries;
84  const auto & blk_ids = insfv_fk.blockRestricted() ? insfv_fk.blockIDs() : mesh.meshSubdomains();
85  for (const auto blk_id : blk_ids)
86  {
87  const auto & connected_boundaries = mesh.getSubdomainInterfaceBoundaryIds(blk_id);
88  for (const auto bnd_id : connected_boundaries)
89  all_connected_boundaries.insert(bnd_id);
90  }
91 
92  for (const auto bnd_id : all_connected_boundaries)
93  {
94  setupFlowBoundaries(insfv_fk, bnd_id);
95  setupBoundaries<INSFVNoSlipWallBC>(
97  setupBoundaries<INSFVSlipWallBC>(
99  setupBoundaries<INSFVFreeSurfaceBC>(
101  setupBoundaries<INSFVSymmetryBC>(
103  }
104 }
105 
106 template <typename T>
107 void
109 {
110  std::vector<INSFVFlowBC *> flow_bcs;
111 
112  insfv_fk.subProblem()
113  .getMooseApp()
114  .theWarehouse()
115  .query()
116  .template condition<AttribBoundaries>(bnd_id)
117  .template condition<AttribINSFVBCs>(INSFVBCs::INSFVFlowBC)
118  .queryInto(flow_bcs);
119 
120  if (!flow_bcs.empty())
121  {
122  if (dynamic_cast<INSFVFullyDevelopedFlowBC *>(flow_bcs.front()))
123  {
124  _fully_developed_flow_boundaries.insert(bnd_id);
125 
126 #ifndef NDEBUG
127  for (auto * flow_bc : flow_bcs)
128  mooseAssert(dynamic_cast<INSFVFullyDevelopedFlowBC *>(flow_bc),
129  "If one BC is a fully developed flow BC, then all other flow BCs on that "
130  "boundary must also be fully developed flow BCs. This flow BC is not: " +
131  dynamic_cast<MooseObject *>(flow_bc)->name());
132  }
133  else
134  for (auto * flow_bc : flow_bcs)
135  mooseAssert(!dynamic_cast<INSFVFullyDevelopedFlowBC *>(flow_bc),
136  "If one BC is not a fully developed flow BC, then all other flow BCs on that "
137  "boundary must also not be fully developed flow BCs. This flow BC is not: " +
138  dynamic_cast<MooseObject *>(flow_bc)->name());
139 #else
140  }
141 #endif
142 
143  _flow_boundaries.insert(bnd_id);
144  _all_boundaries.insert(bnd_id);
145  }
146 }
147 
148 template <typename T, typename T2>
149 void
151  const BoundaryID bnd_id,
152  const INSFVBCs bc_type,
153  std::set<BoundaryID> & bnd_ids)
154 {
155  std::vector<T *> bcs;
156 
157  insfv_fk.subProblem()
158  .getMooseApp()
159  .theWarehouse()
160  .query()
161  .template condition<AttribBoundaries>(bnd_id)
162  .template condition<AttribINSFVBCs>(bc_type)
163  .queryInto(bcs);
164 
165  if (!bcs.empty())
166  {
167  bnd_ids.insert(bnd_id);
168  _all_boundaries.insert(bnd_id);
169  }
170 }
std::set< BoundaryID > _slip_wall_boundaries
Boundary IDs with slip walls.
std::set< BoundaryID > _all_boundaries
All the BoundaryIDs covered by our different types of INSFVBCs.
void initialSetup(T &insfv_fk)
setup all the boundary condition member information
MeshBase & mesh
void setupFlowBoundaries(T &insfv_fk, BoundaryID bnd_id)
Query for INSFVBCs::INSFVFlowBC on bc_id and add if query successful.
std::set< BoundaryID > _symmetry_boundaries
Symmetry Boundary IDs.
std::set< BoundaryID > _no_slip_wall_boundaries
Boundary IDs with no slip walls.
boundary_id_type BoundaryID
const std::string name
Definition: Setup.h:20
std::set< BoundaryID > _flow_boundaries
Flow Boundary IDs.
INSFVBCs
void setupBoundaries(T2 &insfv_fk, const BoundaryID bnd_id, INSFVBCs bc_type, std::set< BoundaryID > &bnd_ids)
Query for INSFVBCs on bc_id and add if query successful.
std::set< BoundaryID > _free_surface_boundaries
Boundary IDs for free surfaces.
std::set< BoundaryID > _fully_developed_flow_boundaries
Fully Developed Flow Boundary IDs. This is a subset of _flow_boundaries.
This interface gives the inheriting class information about all the different boundary conditions tha...