MAIA bb96820c
Multiphysics at AIA
Loading...
Searching...
No Matches
fvstructuredbndrycnd.cpp
Go to the documentation of this file.
1// Copyright (C) 2024 The m-AIA AUTHORS
2//
3// This file is part of m-AIA (https://git.rwth-aachen.de/aia/m-AIA/m-AIA)
4//
5// SPDX-License-Identifier: LGPL-3.0-only
6
8
9using namespace std;
10
11template <MInt nDim>
13 : m_StructuredComm(solver->m_StructuredComm),
14 m_nCells(solver->m_nCells),
15 m_nPoints(solver->m_nPoints),
16 m_cells(solver->m_cells),
17 CV(solver->CV),
18 PV(solver->PV),
19 FQ(solver->FQ),
20 m_solverId(solver->m_solverId),
21 m_noGhostLayers(solver->m_noGhostLayers),
22 m_physicalBCMap(solver->m_windowInfo->physicalBCMap),
23 m_auxDataMap(solver->m_windowInfo->physicalAuxDataMap),
24 m_globalStructuredBndryMaps(solver->m_windowInfo->globalStructuredBndryCndMaps),
25 m_noSpongeDomainInfos(solver->m_noSpongeDomainInfos),
26 m_spongeBcWindowInfo(solver->m_spongeBcWindowInfo),
27 m_spongeLayerType(solver->m_spongeLayerType),
28 m_spongeLayerThickness(solver->m_spongeLayerThickness),
29 m_sigmaSponge(solver->m_sigmaSponge),
30 m_betaSponge(solver->m_betaSponge),
31 m_targetDensityFactor(solver->m_targetDensityFactor),
32 m_noCells(grid->m_noCells),
33 m_sutherlandPlusOne(solver->m_sutherlandPlusOne),
34 m_sutherlandConstant(solver->m_sutherlandConstant) {
35 TRACE();
37 m_solver = solver;
38 m_grid = grid;
40 // the surfaces for the channel flow calculation
43}
44
45
46template <MInt nDim>
48 // TODO_SS labels:FV,totest check if it is eventually necessary to first loop over the 6000er BCs
49 for(MInt bcId = 0; bcId < m_noBndryCndIds; bcId++) {
50 (this->*bndryCndHandler[bcId])(bcId);
51 }
52}
53
54template <MInt nDim>
56 TRACE();
57 // not implemented yet
58 // for( MInt bcId = 0; bcId < m_noBndryCndIds; bcId++ )
59 // (this->*nonReflectingBoundaryCondition[bcId]) (bcId);
60}
61
62
63template <MInt nDim>
65 TRACE();
66
67 m_noBndryCndIds = m_physicalBCMap.size();
68
69 bndryCndHandler = nullptr;
70 bndryCndHandler = new BndryCndHandler[m_physicalBCMap.size()];
71 initBndryCndHandler = new BndryCndHandler[m_physicalBCMap.size()];
72
73 // relation between surface index map and the bcId
74 mAlloc(m_channelSurfaceIndexMap, std::max((MInt)m_physicalBCMap.size(), 1), "m_channelSurfaceIndexMap", -1, AT_);
75 // plenumSurface relation between surface/map index and the bcId
76 mAlloc(m_plenumSurfaceIndexMap, std::max((MInt)m_physicalBCMap.size(), 1), "m_plenumSurfaceIndexMap", -1, AT_);
77 MInt counter = 0, counterPlenum = 0;
78 // assign the function pointers
79 for(MUint bcId = 0; bcId < m_physicalBCMap.size(); bcId++) {
80 switch(m_physicalBCMap[bcId]->BC) {
81 case 0: {
82 // euler wall
83 bndryCndHandler[bcId] = &StructuredBndryCnd::bc0; // empty boundary condition
84 initBndryCndHandler[bcId] = &StructuredBndryCnd::initBc0; // empty boundary condition
85 break;
86 }
87 case 1000:
88 case 1004: {
89 // adiabatic wall
90 if(m_solver->m_movingGrid) {
91 bndryCndHandler[bcId] = &StructuredBndryCnd::bc1004;
92 initBndryCndHandler[bcId] = &StructuredBndryCnd::initBc1004;
93 } else {
94 bndryCndHandler[bcId] = &StructuredBndryCnd::bc1000;
95 initBndryCndHandler[bcId] = &StructuredBndryCnd::initBc1000;
96 }
97 break;
98 }
99 case 1003:
100 case 1006: {
101 // isothermal wall
102 if(m_solver->m_movingGrid) {
103 bndryCndHandler[bcId] = &StructuredBndryCnd::bc1006;
104 initBndryCndHandler[bcId] = &StructuredBndryCnd::initBc1006;
105 } else {
106 bndryCndHandler[bcId] = &StructuredBndryCnd::bc1003;
107 initBndryCndHandler[bcId] = &StructuredBndryCnd::initBc1003;
108 }
109 break;
110 }
111 case 1001: {
112 // euler wall
113 bndryCndHandler[bcId] = &StructuredBndryCnd::bc1001;
114 initBndryCndHandler[bcId] = &StructuredBndryCnd::initBc1001;
115 break;
116 }
117 case 1007: {
118 // oscillating wall
119 bndryCndHandler[bcId] = &StructuredBndryCnd::bc1007;
120 initBndryCndHandler[bcId] = &StructuredBndryCnd::initBc1007;
121 break;
122 }
123 case 2001: {
124 bndryCndHandler[bcId] = &StructuredBndryCnd::bc2001;
125 initBndryCndHandler[bcId] = &StructuredBndryCnd::initBc2001;
126 break;
127 }
128 case 2002:
129 case 2010: {
130 bndryCndHandler[bcId] = &StructuredBndryCnd::bc2002;
131 initBndryCndHandler[bcId] = &StructuredBndryCnd::initBc2002;
132 break;
133 }
134 case 2003: {
135 bndryCndHandler[bcId] = &StructuredBndryCnd::bc2003;
136 initBndryCndHandler[bcId] = &StructuredBndryCnd::initBc2003;
137 break;
138 }
139 case 2004:
140 case 2024: {
141 bndryCndHandler[bcId] = &StructuredBndryCnd::bc2004;
142 initBndryCndHandler[bcId] = &StructuredBndryCnd::initBc2004;
143 break;
144 }
145 case 2005: {
146 bndryCndHandler[bcId] = &StructuredBndryCnd::bc2005;
147 initBndryCndHandler[bcId] = &StructuredBndryCnd::initBc2005;
148 break;
149 }
150 case 2006: {
151 bndryCndHandler[bcId] = &StructuredBndryCnd::bc2006;
152 initBndryCndHandler[bcId] = &StructuredBndryCnd::initBc2006;
153 break;
154 }
155 case 2007: {
156 bndryCndHandler[bcId] = &StructuredBndryCnd::bc2007;
157 initBndryCndHandler[bcId] = &StructuredBndryCnd::initBc2007;
158 break;
159 }
160 case 2009: {
161 bndryCndHandler[bcId] = &StructuredBndryCnd::bc2009;
162 initBndryCndHandler[bcId] = &StructuredBndryCnd::initBc2009;
163 break;
164 }
165 case 2012: { // characteristic inflow
166 bndryCndHandler[bcId] = &StructuredBndryCnd::bc2012;
167 initBndryCndHandler[bcId] = &StructuredBndryCnd::initBc2012;
168 break;
169 }
170 case 2013: { // characteristic outflow
171 bndryCndHandler[bcId] = &StructuredBndryCnd::bc2013;
172 initBndryCndHandler[bcId] = &StructuredBndryCnd::initBc2013;
173 break;
174 }
175 case 2014: { // characteristic outflow
176 bndryCndHandler[bcId] = &StructuredBndryCnd::bc2014;
177 initBndryCndHandler[bcId] = &StructuredBndryCnd::initBc2014;
178 break;
179 }
180 case 2020: {
181 bndryCndHandler[bcId] = &StructuredBndryCnd::bc2020;
182 initBndryCndHandler[bcId] = &StructuredBndryCnd::initBc2020;
183 break;
184 }
185 case 2021: {
186 bndryCndHandler[bcId] = &StructuredBndryCnd::bc2021;
187 initBndryCndHandler[bcId] = &StructuredBndryCnd::initBc2021;
188 break;
189 }
190 case 2097: {
191 bndryCndHandler[bcId] = &StructuredBndryCnd::bc2097;
192 initBndryCndHandler[bcId] = &StructuredBndryCnd::initBc2097;
193 m_plenumSurfaceIndexMap[bcId] = counterPlenum;
194 counterPlenum++;
195 break;
196 }
197 case 2099: {
198 bndryCndHandler[bcId] = &StructuredBndryCnd::bc2099;
199 initBndryCndHandler[bcId] = &StructuredBndryCnd::initBc2099;
200 break;
201 }
202 case 2221: { // junoh //zonal with STG
203 bndryCndHandler[bcId] = &StructuredBndryCnd::bc2221;
204 initBndryCndHandler[bcId] = &StructuredBndryCnd::initBc2221;
205 break;
206 }
207 case 2222: { // junoh //zonal without STG
208 bndryCndHandler[bcId] = &StructuredBndryCnd::bc2222;
209 initBndryCndHandler[bcId] = &StructuredBndryCnd::initBc2222;
210 break;
211 }
212 case 2199: {
213 bndryCndHandler[bcId] = &StructuredBndryCnd::bc2199;
214 initBndryCndHandler[bcId] = &StructuredBndryCnd::initBc2199;
215 break;
216 }
217 case 2401:
218 case 2402: {
219 bndryCndHandler[bcId] = &StructuredBndryCnd::bc2402;
220 initBndryCndHandler[bcId] = &StructuredBndryCnd::initBc2402;
221 m_channelSurfaceIndexMap[bcId] = counter;
222 counter++;
223 break;
224 }
225 case 2500: { // Rescaling
226 if(m_solver->m_rans) {
227 bndryCndHandler[bcId] = &StructuredBndryCnd::bc2510;
228 initBndryCndHandler[bcId] = &StructuredBndryCnd::initBc2510;
229 } else {
230 bndryCndHandler[bcId] = &StructuredBndryCnd::bc2500;
231 initBndryCndHandler[bcId] = &StructuredBndryCnd::initBc2500;
232 }
233 break;
234 }
235 case 2501: { // Rescaling
236 if(m_solver->m_rans) {
237 bndryCndHandler[bcId] = &StructuredBndryCnd::bc2511;
238 initBndryCndHandler[bcId] = &StructuredBndryCnd::initBc2501;
239 } else {
240 bndryCndHandler[bcId] = &StructuredBndryCnd::bc2501;
241 initBndryCndHandler[bcId] = &StructuredBndryCnd::initBc2501;
242 }
243 break;
244 }
245 case 2600: { // Prescribing profile
246 m_solver->m_bc2600 = true;
247 bndryCndHandler[bcId] = &StructuredBndryCnd::bc2600;
248 initBndryCndHandler[bcId] = &StructuredBndryCnd::initBc2600;
249 m_solver->m_bc2600 = true;
250 break;
251 }
252 case 2601: { // Prescribing profile
253 m_solver->m_bc2601 = true;
254 bndryCndHandler[bcId] = &StructuredBndryCnd::bc2601;
255 initBndryCndHandler[bcId] = &StructuredBndryCnd::initBc2601;
256 m_solver->m_bc2601 = true;
257 break;
258 }
259 case 2700: { // mode inflow
260 bndryCndHandler[bcId] = &StructuredBndryCnd::bc2700;
261 initBndryCndHandler[bcId] = &StructuredBndryCnd::initBc2700;
262 break;
263 }
264 case 2730: { // fsc outflow
265 bndryCndHandler[bcId] = &StructuredBndryCnd::bc2730;
266 initBndryCndHandler[bcId] = &StructuredBndryCnd::initBc2730;
267 break;
268 }
269 case 2888: { // fsc inflow
270 bndryCndHandler[bcId] = &StructuredBndryCnd::bc2888;
271 initBndryCndHandler[bcId] = &StructuredBndryCnd::initBc2888;
272 break;
273 }
274 case 2999: { // Blasius inflow
275 bndryCndHandler[bcId] = &StructuredBndryCnd::bc2999;
276 initBndryCndHandler[bcId] = &StructuredBndryCnd::initBc2999;
277 break;
278 }
279 case 2900: { // Jet Freund Inlet
280 bndryCndHandler[bcId] = &StructuredBndryCnd::bc2900;
281 initBndryCndHandler[bcId] = &StructuredBndryCnd::initBc2900;
282 break;
283 }
284 case 3000: {
285 bndryCndHandler[bcId] = &StructuredBndryCnd::bc3000;
286 initBndryCndHandler[bcId] = &StructuredBndryCnd::initBc3000;
287 break;
288 }
289 case 3001: {
290 bndryCndHandler[bcId] = &StructuredBndryCnd::bc3001;
291 initBndryCndHandler[bcId] = &StructuredBndryCnd::initBc3001;
292 break;
293 }
294 case 6000: {
295 bndryCndHandler[bcId] = &StructuredBndryCnd::bc6000;
296 initBndryCndHandler[bcId] = &StructuredBndryCnd::initBc6000;
297 break;
298 }
299 // case 6002: {
300 // // Fluid-porous interface
301 // bndryCndHandler[bcId] = &StructuredBndryCnd::bc6002;
302 // initBndryCndHandler[bcId] = &StructuredBndryCnd::initBc6002;
303 // break;
304 // }
305 case 7909: {
306 bndryCndHandler[bcId] = &StructuredBndryCnd::bc7909;
307 initBndryCndHandler[bcId] = &StructuredBndryCnd::initBc7909;
308 break;
309 }
310 // empty BC!!!!!!!!!!!!!!!!
311 case 4401:
312 case 4402:
313 case 4403:
314 case 4404:
315 case 4405:
316 case 4406: {
317 bndryCndHandler[bcId] = &StructuredBndryCnd::bc9999;
318 initBndryCndHandler[bcId] = &StructuredBndryCnd::initBc9999;
319 break;
320 }
321
322 default: {
323 cout << "boundary condtition is missing" << m_physicalBCMap[bcId]->BC << endl;
324 mTerm(1, AT_, "Boundary Condition is not implemented");
325 break;
326 }
327 }
328 }
329}
330
331template <MInt nDim>
333 // in correcting cell Information
334 for(MInt bcId = 0; bcId < m_noBndryCndIds; bcId++) {
335 (this->*initBndryCndHandler[bcId])(bcId);
336 }
337}
338
339template <MInt nDim>
341 delete[] bndryCndHandler;
342 delete[] initBndryCndHandler;
343}
344
345template <MInt nDim>
347
348// Explicit instantiations for 2D and 3D
349template class StructuredBndryCnd<2>;
350template class StructuredBndryCnd<3>;
void mAlloc(T *&a, const MLong N, const MString &objectName, MString function)
allocates memory for one-dimensional array 'a' of size N
Definition: alloc.h:173
Base class of the structured solver.
Base class of the structured boundary conditions.
virtual void bc2601(MInt)
virtual void bc0(MInt)
virtual void initBc2004(MInt)
virtual void initBc2888(MInt)
virtual void bc2501(MInt)
virtual void bc3000(MInt)
virtual void initBc2999(MInt)
virtual void initBc2002(MInt)
virtual void initBc3000(MInt)
virtual void bc3001(MInt)
virtual void initBc3001(MInt)
virtual void bc2600(MInt)
virtual void bc2222(MInt)
virtual void bc2020(MInt)
virtual void initBc2099(MInt)
virtual void initBc2700(MInt)
virtual void bc2900(MInt)
virtual void bc2014(MInt)
virtual void initBc2600(MInt)
virtual void initBc2402(MInt)
virtual void initBc2012(MInt)
virtual void bc2402(MInt)
virtual void initBc2097(MInt)
virtual void bc2511(MInt)
virtual void initBc2501(MInt)
virtual void bc1003(MInt)
virtual void bc2007(MInt)
virtual void initBc2199(MInt)
virtual void bc1007(MInt)
virtual void initBc2510(MInt)
virtual void bc2005(MInt)
virtual void initBc2014(MInt)
virtual void initBc9999(MInt)
virtual void initBc2601(MInt)
virtual void initBc2900(MInt)
StructuredGrid< nDim > * m_grid
virtual void bc2700(MInt)
virtual void bc2199(MInt)
virtual void initBc2730(MInt)
virtual void initBc2003(MInt)
virtual void initBc2007(MInt)
virtual void initBc2005(MInt)
virtual void bc2006(MInt)
virtual void initBc2001(MInt)
virtual void bc2003(MInt)
virtual void bc2001(MInt)
virtual void bc1001(MInt)
virtual void bc2004(MInt)
virtual void bc2097(MInt)
virtual void initBc2500(MInt)
virtual void initBc1001(MInt)
virtual void bc2730(MInt)
virtual void bc2888(MInt)
virtual void initBc1000(MInt)
virtual void bc6000(MInt)
virtual void initBc2009(MInt)
virtual void bc2013(MInt)
virtual void bc1004(MInt)
virtual void initBc1006(MInt)
virtual void initBc1007(MInt)
virtual void initBc2020(MInt)
virtual void bc2500(MInt)
virtual void bc2999(MInt)
virtual void initBc2222(MInt)
virtual void initBc1004(MInt)
StructuredBndryCnd(FvStructuredSolver< nDim > *solver, StructuredGrid< nDim > *grid)
virtual void initBc0(MInt)
virtual void bc2510(MInt)
virtual void bc2012(MInt)
virtual void initBc1003(MInt)
virtual void bc1006(MInt)
virtual void initBc2221(MInt)
virtual void initBc7909(MInt)
virtual void initBc2021(MInt)
virtual void bc2099(MInt)
virtual void initBc6000(MInt)
virtual void bc1000(MInt)
virtual void initBc2006(MInt)
virtual void bc2221(MInt)
virtual void bc7909(MInt)
virtual void bc2009(MInt)
virtual void bc2002(MInt)
virtual void bc2021(MInt)
virtual void initBc2013(MInt)
virtual void bc9999(MInt)
FvStructuredSolver< nDim > * m_solver
virtual void correctBndryCndIndices()
Structured grid class.
void mTerm(const MInt errorCode, const MString &location, const MString &message)
Definition: functions.cpp:29
int32_t MInt
Definition: maiatypes.h:62
uint32_t MUint
Definition: maiatypes.h:63