MAIA bb96820c
Multiphysics at AIA
Loading...
Searching...
No Matches
fvcartesiansolverxd.h
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
7#ifndef FVSOLVERXD_H
8#define FVSOLVERXD_H
9
10#include <algorithm>
11#include <memory>
12#include "COMM/mpiexchange.h"
13#include "COMM/mpioverride.h"
14#include "GRID/cartesiangrid.h"
15#include "IO/iovtk.h"
16#include "IO/parallelio.h"
17#include "POST/samplingdata.h"
18#include "UTIL/maiafftw.h"
19#include "UTIL/tensor.h"
20#include "cartesiansolver.h"
27#include "fvcartesiansyseqnns.h"
31
32#include "UTIL/oneDFlame.h"
33
34template <MInt nDim>
35class FvSurface;
36
37template <MInt nDim>
39
40template <MInt nDim, class SysEqn>
42
43template <MInt nDim, class SysEqn>
44class FvBndryCndXD;
45
46template <class T>
47class List;
48
49template <MInt nDim, class SysEqn>
50class LsFvMb;
51
52template <MInt nDim, class SysEqn>
53class LsFvCombustion;
54
55template <MInt nDim, class SysEqn>
56class CouplingLsFv;
57
58template <MInt nDim, class SysEqn>
59class FvZonal;
60
61template <MInt nDim, class SysEqn>
62class FvZonalRTV;
63
64template <MInt nDim, class SysEqn>
65class FvZonalSTG;
66
67template <MInt nDim, class SysEqnOld, class SysEqnNew>
69
70template <MInt nDim, class SysEqn>
71class CouplingFvMb;
72
73template <MInt nDim, class SysEqn>
74class CouplingFv;
75
76template <MInt nDim, MInt nDist, class SysEqnLb, class SysEqnFv>
78
79template <MInt nDim, class SysEqn>
81
82template <MInt nDim, class ppType>
83class PostProcessing;
84
85template <MInt nDim, class SysEqn>
87
88template <MInt nDim, class SysEqn>
89class VtkIo;
90
91//---------------------------------------------------------------------------
92
93// Sanity-checking macros
94#if !defined(NDEBUG) || defined(MAIA_ASSERT_ACCESSORS)
95#define ENSURE_VALID_CELL_ID_CONTAINER(id) \
96 do { \
97 if(id < 0 || id >= maxNoGridCells()) { \
98 TERMM(1, "Invalid cell id " + std::to_string((id)) + "\n\n AT: " + AT_); \
99 } \
100 } while(false)
101#else
102#define ENSURE_VALID_CELL_ID_CONTAINER(id) \
103 do { \
104 } while(false)
105#endif
106
107
108namespace maia {
109namespace fv {
110
111// Create struct for easy timer identification
112struct Timers_ {
113 // Enum to store timer "names"
114 enum {
118
124
131
137
142
148
153
156
163
171
174
180
181 /* Accumulated, */
182 /* IO, */
183 /* MPI, */
184
185 // Special enum value used to initialize timer array
186 _count
187 };
188};
189
190} // namespace fv
191} // namespace maia
192
193template <class T>
194class Collector;
195
196template <MInt nDim_, class SysEqn>
197class FvCartesianSolverXD : public maia::CartesianSolver<nDim_, FvCartesianSolverXD<nDim_, SysEqn>> {
198 public:
199 static constexpr MInt nDim = nDim_;
200 static constexpr const MInt m_noDirs = 2 * nDim;
201 static constexpr const MInt m_noEdges = nDim == 3 ? 12 : 4;
202 static constexpr const MInt m_noCorners = nDim == 3 ? 8 : 4;
203 static constexpr MFloat m_volumeThreshold = nDim == 3 ? 1e-16 : 1e-14; // why two different values?
204
208
209 SysEqn m_sysEqn;
210
211 private:
212 template <class SolverType>
214
215 template <MInt nDim, SolverType SolverTypeR, SolverType SolverTypeL>
216 friend class MSTG;
217 template <MInt nDim, class SysEqn_>
218 friend class FvBndryCndXD;
219 template <MInt nDim, class SysEqn_>
221 template <MInt nDim, class SysEqn_>
222 friend class LsFvMb;
223 template <MInt nDim, class SysEqn_>
224 friend class CouplingLsFv;
225 template <MInt nDim, class SysEqn_>
226 friend class CouplingFvMb;
227 template <MInt nDim, class SysEqn_>
228 friend class LsFvCombustion;
229 template <MInt nDim, MInt nDist, class SysEqnLb_, class SysEqnFv_>
230 friend class CouplerLbFv;
231
232 template <MInt nDim, MInt nDist, class SysEqnLb_, class SysEqnFv_>
234 template <MInt nDim, class SysEqn_>
235 friend class CouplerFvParticle;
236 template <MInt nDim, class ppType>
237 friend class PostProcessing;
238 template <MInt nDim, class SysEqn_>
239 friend class PostProcessingFv;
240 friend class maia::CartesianSolver<nDim, FvCartesianSolverXD<nDim, SysEqn>>;
241 friend class LsFvCombustion<nDim, SysEqn>;
242 friend class CouplingLsFv<nDim, SysEqn>;
244
245 protected:
247
248 public:
249 // Type for cell properties
254 using Grid = typename CartesianSolver::Grid;
255 using GridProxy = typename CartesianSolver::GridProxy;
256
257 // used CartesianSolver
258 using CartesianSolver::c_noCells;
259 using CartesianSolver::disableDlbTimers;
260 using CartesianSolver::domainId;
261 using CartesianSolver::domainOffset;
262 using CartesianSolver::exchangeData;
263 using CartesianSolver::extractPointIdsFromGrid;
264 using CartesianSolver::getIdentifier;
265 using CartesianSolver::grid;
266 using CartesianSolver::haloCellId;
267 using CartesianSolver::isActive;
268 using CartesianSolver::m_bandWidth;
269 using CartesianSolver::m_freeIndices;
270 using CartesianSolver::m_innerBandWidth;
271 using CartesianSolver::m_Ma;
272 using CartesianSolver::m_outerBandWidth;
273 using CartesianSolver::m_Re;
274 using CartesianSolver::m_recalcIds;
275 using CartesianSolver::m_residualInterval;
276 using CartesianSolver::m_restart;
277 using CartesianSolver::m_restartFile;
278 using CartesianSolver::m_restartInterval;
279 using CartesianSolver::m_restartOffset;
280 using CartesianSolver::m_restartTimeStep;
281 using CartesianSolver::m_revDir;
282 using CartesianSolver::m_sensorParticle;
283 using CartesianSolver::m_solutionInterval;
284 using CartesianSolver::m_solutionOffset;
285 using CartesianSolver::m_solutionOutput;
286 using CartesianSolver::m_solutionTimeSteps;
287 using CartesianSolver::m_solverId;
288 using CartesianSolver::m_useNonSpecifiedRestartFile;
289 using CartesianSolver::maxLevel;
290 using CartesianSolver::maxNoGridCells;
291 using CartesianSolver::maxRefinementLevel;
292 using CartesianSolver::maxUniformRefinementLevel;
293 using CartesianSolver::minLevel;
294 using CartesianSolver::mpiComm;
295 using CartesianSolver::neighborDomain;
296 using CartesianSolver::noDomains;
297 using CartesianSolver::noHaloCells;
298 using CartesianSolver::noNeighborDomains;
299 using CartesianSolver::noWindowCells;
300 using CartesianSolver::outputDir;
301 using CartesianSolver::readSolverSamplingVarNames;
302 using CartesianSolver::restartDir;
303 using CartesianSolver::returnIdleRecord;
304 using CartesianSolver::returnLoadRecord;
305 using CartesianSolver::solverId;
306 using CartesianSolver::solverMethod;
307 using CartesianSolver::startLoadTimer;
308 using CartesianSolver::stopLoadTimer;
309 using CartesianSolver::updateDomainInfo;
310 using CartesianSolver::windowCellId;
311
312 // pointer to the boundary condition
314
315
318 const MPI_Comm comm);
319
321 delete[] m_variablesName;
322 delete[] m_vorticityName;
323
324 delete m_fvBndryCnd;
325
327
328 RECORD_TIMER_STOP(m_timers[Timers::SolverType]);
329 }
330
331 SysEqn sysEqn() const { return m_sysEqn; };
332 SysEqn& sysEqn() { return m_sysEqn; };
333
334 public:
336 MInt a_noCells() const {
337#ifndef NDEBUG
338 MInt noCells_solver = m_cells.size();
339 MInt noCells_grid = grid().tree().size() + m_totalnosplitchilds + m_totalnoghostcells;
340 ASSERT(noCells_solver == noCells_grid,
341 "Warning, noCells differ: grid " << noCells_grid << ", solver " << noCells_solver << "no-split-childs "
343 << "no-boundary-ghost-cells: " << m_totalnoghostcells << std::endl);
344 // ASSERT(c_noCells() == grid().m_noRegularCells, "ERROR in Cell-count");
345#endif
346 return m_cells.size();
347 }
348
349 MInt noInternalCells() const override { return grid().noInternalCells(); }
350
352 MBool a_isGapCell(const MInt cellId) const { return m_cells.hasProperty(cellId, SolverCell::IsGapCell); }
354 maia::fv::cell::BitsetType::reference a_isGapCell(const MInt cellId) {
355 return m_cells.hasProperty(cellId, SolverCell::IsGapCell);
356 }
358 maia::fv::cell::BitsetType::reference a_wasGapCell(const MInt cellId) {
359 return m_cells.hasProperty(cellId, SolverCell::WasGapCell);
360 }
362 MBool a_isHalo(const MInt cellId) const { return m_cells.hasProperty(cellId, SolverCell::IsHalo); }
364 maia::fv::cell::BitsetType::reference a_isHalo(const MInt cellId) {
365 return m_cells.hasProperty(cellId, SolverCell::IsHalo);
366 }
368 MBool a_isWindow(const MInt cellId) const { return m_cells.hasProperty(cellId, SolverCell::IsWindow); }
370 maia::fv::cell::BitsetType::reference a_isWindow(const MInt cellId) {
371 return m_cells.hasProperty(cellId, SolverCell::IsWindow);
372 }
374 MBool a_isPeriodic(const MInt cellId) const { return m_cells.hasProperty(cellId, SolverCell::IsPeriodic); }
376 maia::fv::cell::BitsetType::reference a_isPeriodic(const MInt cellId) {
377 return m_cells.hasProperty(cellId, SolverCell::IsPeriodic);
378 }
379
381 MBool a_isBndryCell(const MInt cellId) const override { return (a_bndryId(cellId) >= 0); }
382
384 MBool a_isInterface(const MInt cellId) const { return m_cells.hasProperty(cellId, SolverCell::IsInterface); }
385
387 maia::fv::cell::BitsetType::reference a_isInterface(const MInt cellId) {
388 return m_cells.hasProperty(cellId, SolverCell::IsInterface);
389 }
390
392 MBool a_isBndryGhostCell(const MInt cellId) const { return m_cells.hasProperty(cellId, SolverCell::IsGhost); }
393
395 maia::fv::cell::BitsetType::reference a_isBndryGhostCell(const MInt cellId) {
396 return m_cells.hasProperty(cellId, SolverCell::IsGhost);
397 }
398
400 MBool a_isWMImgCell(const MInt cellId) const { return m_cells.hasProperty(cellId, SolverCell::IsWMImgCell); }
402 maia::fv::cell::BitsetType::reference a_isWMImgCell(const MInt cellId) {
403 return m_cells.hasProperty(cellId, SolverCell::IsWMImgCell);
404 }
405
407 MBool a_isSandpaperTripCell(const MInt cellId) const {
408 return m_cells.hasProperty(cellId, SolverCell::IsSandpaperTripCell);
409 }
411 maia::fv::cell::BitsetType::reference a_isSandpaperTripCell(const MInt cellId) {
412 return m_cells.hasProperty(cellId, SolverCell::IsSandpaperTripCell);
413 }
414
416 maia::fv::cell::BitsetType& a_properties(const MInt cellId) { return m_cells.properties(cellId); }
417
419 MFloat& a_spongeFactor(const MInt cellId) { return m_cells.spongeFactor(cellId); }
420
422 MFloat a_spongeFactor(const MInt cellId) const { return m_cells.spongeFactor(cellId); }
423
425 MFloat& a_coordinate(const MInt cellId, const MInt dir) { return m_cells.coordinate(cellId, dir); }
426
428 MFloat a_coordinate(const MInt cellId, const MInt dir) const { return m_cells.coordinate(cellId, dir); }
429
431 MInt& a_level(const MInt cellId) { return m_cells.level(cellId); }
432
434 MInt a_level(const MInt cellId) const { return m_cells.level(cellId); }
435
437 MFloat& a_cellVolume(const MInt cellId) { return m_cells.cellVolume(cellId); }
438
440 MFloat a_cellVolume(const MInt cellId) const { return m_cells.cellVolume(cellId); }
441
443 MFloat& a_FcellVolume(const MInt cellId) override { return m_cells.FcellVolume(cellId); }
444
446 MFloat a_FcellVolume(const MInt cellId) const { return m_cells.FcellVolume(cellId); }
447
450 MInt a_cutCellLevel(const MInt cellId) const {
451 if(!m_bndryLevelJumps) {
452 return maxRefinementLevel();
453 } else {
454 return a_level(cellId);
455 }
456 }
457
458 MBool a_isInactive(const MInt cellId) const { return a_hasProperty(cellId, SolverCell::IsInactive); }
459 MBool a_isActive(const MInt cellId) const { return a_hasProperty(cellId, SolverCell::IsActive); }
460 MBool a_isSplitCell(const MInt cellId) const { return a_hasProperty(cellId, SolverCell::IsSplitCell); }
461
462 MInt a_noSplitCells() const { return m_splitCells.size(); }
463 MInt a_noSplitChilds(const MInt sc) const { return m_splitChilds[sc].size(); }
464 MInt a_splitChildId(const MInt sc, const MInt ssc) { return m_splitChilds[sc][ssc]; }
465 MInt a_splitCellId(const MInt sc) const { return m_splitCells[sc]; }
466
467 //------------Grid-properties:
468
470 // (splitchilds and boundary-ghostcells are no longer added to the grid-tree!)
471#ifndef NDEBUG
472 void assertValidGridCellId(const MInt cellId) const {
473 if(a_isBndryGhostCell(cellId)
474 || cellId < 0
475 // || m_cells.hasProperty(cellId, SolverCell::IsSplitCell)
476 || m_cells.hasProperty(cellId, SolverCell::IsSplitClone)
477 || m_cells.hasProperty(cellId, SolverCell::IsSplitChild)) {
478 TERMM(-1, "ERROR: Invalid cell " + std::to_string(cellId) + "/" + std::to_string(grid().tree().size())
479 + " isSplitClone:"
480 + std::to_string(m_cells.hasProperty(cellId, SolverCell::IsSplitClone))
481 // + " isSplitCell:" + std::to_string(m_cells.hasProperty(cellId,
482 // SolverCell::IsSplitCell))
483 + " IsSplitChild:" + std::to_string(m_cells.hasProperty(cellId, SolverCell::IsSplitChild))
484 + " isBndryGhost:" + std::to_string(a_isBndryGhostCell(cellId)));
485 }
486 }
487#else
488 void assertValidGridCellId(const MInt NotUsed(cellId)) const {}
489#endif
490
491
493 // an invalid neighbor can occour if the m_deleteNeighbour-flag is activated and if the
494 // cell, and neighbor has been added to m_nbBackupCellIds-list in the deleteNeighbourLinks().
495 // NOTE: If this error-occours, the checkNeighborActive() needs to be added to that code-line!
496 void assertDeleteNeighbor(const MInt cellId, const MInt dir) const {
497#ifndef NDEBUG
498 if(m_deleteNeighbour && a_hasProperty(cellId, SolverCell::IsBndryActive) && grid().tree().hasNeighbor(cellId, dir)
499 && a_hasProperty(grid().tree().neighbor(cellId, dir), SolverCell::IsInactive)) {
500 ASSERT(false, "ERROR: calling inactive-neighbor!");
501 }
502#else
503 std::ignore = cellId;
504 std::ignore = dir;
505#endif
506 }
507
509 MBool checkNeighborActive(const MInt cellId, const MInt dir) const {
510 if(m_deleteNeighbour && a_hasProperty(cellId, SolverCell::IsBndryActive) && grid().tree().hasNeighbor(cellId, dir)
511 && a_hasProperty(grid().tree().neighbor(cellId, dir), SolverCell::IsInactive)) {
512 return false;
513 }
514
515 assertDeleteNeighbor(cellId, dir);
516 return true;
517 }
518
520 MFloat c_coordinate(const MInt cellId, const MInt dir) const {
521 assertValidGridCellId(cellId);
522 return grid().tree().coordinate(cellId, dir);
523 }
524
525 MBool c_isLeafCell(const MInt cellId) const { return grid().tree().isLeafCell(cellId); }
526
528 MInt c_level(const MInt cellId) const {
529 assertValidGridCellId(cellId);
530 /* if ( a_isBndryGhostCell(cellId) || a_hasProperty( cellId, SolverCell::IsSplitChild ) ) {
531 const MInt aCellId = getAssociatedInternalCell(cellId);
532 assertValidGridCellId(aCellId);
533 return grid().tree().level(aCellId);
534 }
535 */
536 return grid().tree().level(cellId);
537 }
538
540 MInt c_noChildren(const MInt cellId) const {
541 assertValidGridCellId(cellId);
542 return grid().tree().noChildren(cellId);
543 }
544
546 MLong c_parentId(const MInt cellId) const {
547 assertValidGridCellId(cellId);
548 return grid().tree().parent(cellId);
549 }
550
552 MLong c_globalId(const MInt cellId) const {
553 assertValidGridCellId(cellId);
554 return grid().tree().globalId(cellId);
555 }
556
558 MFloat c_weight(const MInt cellId) const {
559 assertValidGridCellId(cellId);
560 return grid().tree().weight(cellId);
561 }
562
564 MLong c_childId(const MInt cellId, const MInt pos) const {
565 assertValidGridCellId(cellId);
566 return grid().tree().child(cellId, pos);
567 }
568
570 MLong c_neighborId(const MInt cellId, const MInt dir, const MBool assertNeighborState = true) const {
571 assertValidGridCellId(cellId);
572 if(assertNeighborState) assertDeleteNeighbor(cellId, dir);
573 return grid().tree().neighbor(cellId, dir);
574 }
575
577 MFloat c_cellLengthAtCell(const MInt cellId) const {
578 ASSERT(a_level(cellId) > 0, "Level-error");
579 return grid().cellLengthAtLevel(a_level(cellId));
580 }
582 MFloat c_cellLengthAtLevel(const MInt level) const { return grid().cellLengthAtLevel(level); }
583
585 MFloat c_cellVolumeAtLevel(const MInt level) const { return grid().cellVolumeAtLevel(level); }
586
588 MBool a_hasProperty(const MInt cellId, const Cell p) const {
589 assertValidGridCellId(cellId);
590 return grid().tree().hasProperty(cellId, p);
591 }
592
593
595 MBool c_isToDelete(const MInt cellId) const {
596 assertValidGridCellId(cellId);
597 return grid().tree().hasProperty(cellId, Cell::IsToDelete);
598 }
599
601 MInt a_hasNeighbor(const MInt cellId, const MInt dir, const MBool assertNeighborState = true) const {
602 assertValidGridCellId(cellId);
603 if(assertNeighborState) assertDeleteNeighbor(cellId, dir);
604 return grid().tree().hasNeighbor(cellId, dir);
605 }
606
607 //-------------End-grid-properties
608
610 MFloat& a_variable(const MInt cellId, const MInt varId) { return m_cells.variable(cellId, varId); }
611
613 MFloat a_variable(const MInt cellId, const MInt varId) const { return m_cells.variable(cellId, varId); }
614
616 MFloat& a_pvariable(const MInt cellId, const MInt varId) { return m_cells.pvariable(cellId, varId); }
617
619 MFloat a_pvariable(const MInt cellId, const MInt varId) const { return m_cells.pvariable(cellId, varId); }
620
622 MFloat& a_avariable(const MInt cellId, const MInt varId) { return m_cells.avariable(cellId, varId); }
623
625 MFloat a_avariable(const MInt cellId, const MInt varId) const { return m_cells.avariable(cellId, varId); }
626
628 maia::fv::cell::BitsetType::reference a_hasProperty(const MInt cellId, const SolverCell p) {
629 return m_cells.hasProperty(cellId, p);
630 }
631
633 MBool a_hasProperty(const MInt cellId, const SolverCell p) const { return m_cells.hasProperty(cellId, p); }
634
636 void a_resetPropertiesSolver(const MInt cellId) { m_cells.resetProperties(cellId); }
637
639 void a_copyPropertiesSolver(const MInt fromCellId, const MInt toCellId) {
640 m_cells.properties(toCellId) = m_cells.properties(fromCellId);
641 }
642
644 MInt& a_reconstructionNeighborId(const MInt cellId, const MInt nghbrNo) {
645 return m_cells.rcnstrctnNghbrId(cellId, nghbrNo);
646 }
647
649 MInt a_reconstructionNeighborId(const MInt cellId, const MInt nghbrNo) const {
650 return m_cells.rcnstrctnNghbrId(cellId, nghbrNo);
651 }
652
654 MInt& a_reconstructionData(const MInt cellId) { return m_cells.reconstructionData(cellId); }
655
657 MInt a_reconstructionNeighborId(const MInt cellId) const { return m_cells.reconstructionData(cellId); }
658
660 MInt& a_spongeBndryId(const MInt cellId, const MInt dir) { return m_cells.spongeBndryId(cellId, dir); }
661
663 MInt a_spongeBndryId(const MInt cellId, const MInt dir) const { return m_cells.spongeBndryId(cellId, dir); }
664
666 MFloat& a_spongeFactorStart(const MInt cellId) { return m_cells.spongeFactorStart(cellId); }
667
669 MFloat a_spongeFactorStart(const MInt cellId) const { return m_cells.spongeFactorStart(cellId); }
670
672 MInt& a_bndryId(const MInt cellId) { return m_cells.bndryCellId(cellId); }
673
675 MInt a_bndryId(const MInt cellId) const { return m_cells.bndryCellId(cellId); }
676
678 MInt& a_noReconstructionNeighbors(const MInt cellId) { return m_cells.noRcnstrctnNghbrIds(cellId); }
679
681 MInt a_noReconstructionNeighbors(const MInt cellId) const { return m_cells.noRcnstrctnNghbrIds(cellId); }
682
684 MFloat& a_tau(const MInt cellId, const MInt varId) { return m_cells.tau(cellId, varId); }
685
687 MFloat a_tau(const MInt cellId, const MInt varId) const { return m_cells.tau(cellId, varId); }
688
690 MFloat& a_restrictedRHS(const MInt cellId, const MInt varId) { return m_cells.restrictedRHS(cellId, varId); }
691
693 MFloat a_restrictedRHS(const MInt cellId, const MInt varId) const { return m_cells.restrictedRHS(cellId, varId); }
694
696 MFloat& a_restrictedVar(const MInt cellId, const MInt varId) { return m_cells.restrictedVar(cellId, varId); }
697
699 MFloat a_restrictedVar(const MInt cellId, const MInt varId) const { return m_cells.restrictedVar(cellId, varId); }
700
702 MFloat& a_reactionRate(const MInt cellId, const MInt reactionId) { return m_cells.reactionRate(cellId, reactionId); }
703
705 MFloat a_reactionRate(const MInt cellId, const MInt reactionId) const {
706 return m_cells.reactionRate(cellId, reactionId);
707 }
708
710 MFloat& a_reactionRateBackup(const MInt cellId, const MInt reactionId) {
711 return m_cells.reactionRateBackup(cellId, reactionId);
712 }
713
715 MFloat a_reactionRateBackup(const MInt cellId, const MInt reactionId) const {
716 return m_cells.reactionRateBackup(cellId, reactionId);
717 }
718
720 MFloat& a_psi(const MInt cellId) { return m_cells.psi(cellId); }
721
723 MFloat a_psi(const MInt cellId) const { return m_cells.psi(cellId); }
724
725 // detailed chemistry accessors
726 MFloat& a_speciesReactionRate(const MInt cellId, const MInt speciesIndex) {
727 return m_cells.speciesReactionRate(cellId, speciesIndex);
728 }
729
730 MFloat a_speciesReactionRate(const MInt cellId, const MInt speciesIndex) const {
731 return m_cells.speciesReactionRate(cellId, speciesIndex);
732 }
733
735 MFloat& a_implicitCoefficient(const MInt cellId, const MInt coefId) {
736 return m_cells.implicitCoefficient(cellId, coefId);
737 }
738
740 MFloat a_implicitCoefficient(const MInt cellId, const MInt coefId) const {
741 return m_cells.implicitCoefficient(cellId, coefId);
742 }
743
744 //----------------------------------
745
747 MFloat& a_dt1Variable(const MInt cellId, const MInt varId) { return m_cells.dt1Variable(cellId, varId); }
748
750 MFloat a_dt1Variable(const MInt cellId, const MInt varId) const { return m_cells.dt1Variable(cellId, varId); }
751
753 MFloat& a_dt2Variable(const MInt cellId, const MInt varId) { return m_cells.dt2Variable(cellId, varId); }
754
756 MFloat a_dt2Variable(const MInt cellId, const MInt varId) const { return m_cells.dt2Variable(cellId, varId); }
757
759 MFloat& a_oldVariable(const MInt cellId, const MInt varId) { return m_cells.oldVariable(cellId, varId); }
760
762 MFloat a_oldVariable(const MInt cellId, const MInt varId) const { return m_cells.oldVariable(cellId, varId); }
763
765 MFloat& a_slope(const MInt cellId, MInt const varId, const MInt dir) override {
766 return m_cells.slope(cellId, varId, dir);
767 }
768
770 MFloat a_slope(const MInt cellId, MInt const varId, const MInt dir) const {
771 return m_cells.slope(cellId, varId, dir);
772 }
773
775 MFloat& a_storedSlope(const MInt cellId, MInt const varId, const MInt dir) {
776 return m_cells.storedSlope(cellId, varId, dir);
777 }
778
780 MFloat a_storedSlope(const MInt cellId, MInt const varId, const MInt dir) const {
781 return m_cells.storedSlope(cellId, varId, dir);
782 }
783
785 MFloat& a_rightHandSide(const MInt cellId, MInt const varId) { return m_cells.rightHandSide(cellId, varId); }
786
788 MFloat a_rightHandSide(const MInt cellId, MInt const varId) const { return m_cells.rightHandSide(cellId, varId); }
789
790 //----------------------------------
791
794
796 MInt& a_surfaceBndryCndId(const MInt srfcId) { return m_surfaces.bndryCndId(srfcId); }
798 MInt a_surfaceBndryCndId(const MInt srfcId) const { return m_surfaces.bndryCndId(srfcId); }
799
801 MInt& a_surfaceOrientation(const MInt srfcId) { return m_surfaces.orientation(srfcId); }
803 MInt a_surfaceOrientation(const MInt srfcId) const { return m_surfaces.orientation(srfcId); }
804
806 MFloat& a_surfaceArea(const MInt srfcId) { return m_surfaces.area(srfcId); }
808 MFloat a_surfaceArea(const MInt srfcId) const { return m_surfaces.area(srfcId); }
809
811 MFloat& a_surfaceFactor(const MInt srfcId, const MInt varId) { return m_surfaces.factor(srfcId, varId); }
813 MFloat a_surfaceFactor(const MInt srfcId, const MInt varId) const { return m_surfaces.factor(srfcId, varId); }
814
816 MFloat& a_surfaceCoordinate(const MInt srfcId, const MInt dir) { return m_surfaces.coordinate(srfcId, dir); }
818 MFloat a_surfaceCoordinate(const MInt srfcId, const MInt dir) const { return m_surfaces.coordinate(srfcId, dir); }
819
821 MFloat& a_surfaceDeltaX(const MInt srfcId, const MInt varId) { return m_surfaces.deltaX(srfcId, varId); }
823 MFloat a_surfaceDeltaX(const MInt srfcId, const MInt varId) const { return m_surfaces.deltaX(srfcId, varId); }
824
826 MInt& a_surfaceNghbrCellId(const MInt srfcId, const MInt dir) { return m_surfaces.nghbrCellId(srfcId, dir); }
828 MInt a_surfaceNghbrCellId(const MInt srfcId, const MInt dir) const { return m_surfaces.nghbrCellId(srfcId, dir); }
829
831 MFloat& a_surfaceVariable(const MInt srfcId, const MInt dir, const MInt varId) {
832 return m_surfaces.variable(srfcId, dir, varId);
833 }
835 MFloat a_surfaceVariable(const MInt srfcId, const MInt dir, const MInt varId) const {
836 return m_surfaces.variable(srfcId, dir, varId);
837 }
838
842 MFloat a_surfaceUpwindCoefficient(const MInt srfcId) const { return m_surfaces.upwindCoefficient(srfcId); }
843
845 MFloat& a_surfaceCoefficient(const MInt srfcId, const MInt dimCoefficient) {
846 return m_surfaces.surfaceCoefficient(srfcId, dimCoefficient);
847 }
849 MFloat a_surfaceCoefficient(const MInt srfcId, const MInt dimCoefficient) const {
850 return m_surfaces.surfaceCoefficient(srfcId, dimCoefficient);
851 }
852
854 MFloat& a_surfaceFlux(const MInt srfcId, const MInt fVarId) { return m_surfaces.flux(srfcId, fVarId); }
856 MFloat a_surfaceflux(const MInt srfcId, const MInt fVarId) const { return m_surfaces.flux(srfcId, fVarId); }
857
858 //----------------------------------
859
861 MFloat& a_Ma() { return m_Ma; }
862
864 const MFloat& a_Ma() const { return m_Ma; }
865
867 MFloat& a_cfl() { return m_cfl; }
868
869 // \brief Returns the cfl number of the solver
870 const MFloat& a_cfl() const { return m_cfl; }
871
874
876 const MInt& a_restartInterval() const { return m_restartInterval; }
877
879 MInt& a_bndryCndId(MInt bndryId) { return m_bndryCells->a[bndryId].m_srfcs[0]->m_bndryCndId; }
880
882 const MInt& a_bndryCndId(MInt bndryId) const { return m_bndryCells->a[bndryId].m_srfcs[0]->m_bndryCndId; }
883
885 MFloat& a_bndryNormal(MInt bndryId, MInt dir) { return m_bndryCells->a[bndryId].m_srfcs[0]->m_normalVector[dir]; }
886
888 const MFloat& a_bndryNormal(MInt bndryId, MInt dir) const {
889 return m_bndryCells->a[bndryId].m_srfcs[0]->m_normalVector[dir];
890 }
891
894 return m_bndryCells->a[bndryId].m_srfcs[0]->m_cutCoordinates[i][j];
895 }
896
898 const MFloat& a_bndryCutCoord(MInt bndryId, MInt i, MInt j) const {
899 return m_bndryCells->a[bndryId].m_srfcs[0]->m_cutCoordinates[i][j];
900 }
901
902 // \brief Return bndry ghost-cell id
903 const MInt& a_bndryGhostCellId(const MInt bndryId, const MInt srfc) const {
904 return m_bndryCells->a[bndryId].m_srfcVariables[srfc]->m_ghostCellId;
905 }
906
908 MInt& a_identNghbrId(MInt nghbrId) { return m_identNghbrIds[nghbrId]; }
909
911 const MInt& a_identNghbrId(MInt nghbrId) const { return m_identNghbrIds[nghbrId]; }
912
914 MInt& a_storeNghbrId(MInt nghbrId) { return m_storeNghbrIds[nghbrId]; }
915
917 const MInt& a_storeNghbrId(MInt nghbrId) const { return m_storeNghbrIds[nghbrId]; }
918
920 MFloat& a_VVInfinity(MInt dir) { return m_VVInfinity[dir]; }
921
923 const MFloat& a_VVInfinity(MInt dir) const { return m_VVInfinity[dir]; }
924
927
929 const MFloat& a_rhoInfinity() const { return m_rhoInfinity; }
930
933
935 const MFloat& a_PInfinity() const { return m_PInfinity; }
936
939
941 const MFloat& a_TInfinity() const { return m_TInfinity; }
942
945
947 const MFloat& a_timeRef() const { return m_timeRef; }
948
950 MInt& a_noPart(MInt cellId) { return m_noParts[cellId]; }
951
954
956 const MFloat& a_physicalTime() const { return m_physicalTime; }
957
959 MFloat& a_time() { return m_time; }
960
962 const MFloat& a_time() const { return m_time; }
963
965 const MInt& a_noPart(MInt cellId) const { return m_noParts[cellId]; }
966
968 MFloat& a_externalSource(MInt cellId, MInt var) { return m_externalSource[cellId][var]; }
969
971 const MFloat& a_externalSource(MInt cellId, MInt var) const { return m_externalSource[cellId][var]; }
972
974 MInt& a_maxLevelWindowCells(MInt domain, MInt id) { return m_maxLevelWindowCells[domain][id]; }
975
977 const MInt& a_maxLevelWindowCells(MInt domain, MInt id) const { return m_maxLevelWindowCells[domain][id]; }
978
980 MInt& a_maxLevelHaloCells(MInt domain, MInt id) { return m_maxLevelHaloCells[domain][id]; }
981
983 const MInt& a_maxLevelHaloCells(MInt domain, MInt id) const { return m_maxLevelHaloCells[domain][id]; }
984
986 MFloat& a_localTimeStep(const MInt cellId) {
987 return m_cells.localTimeStep(cellId);
988 }
989
991 MFloat a_localTimeStep(const MInt cellId) const {
992 return m_cells.localTimeStep(cellId);
993 }
994
995 MFloat a_dynViscosity(const MFloat T) const { return SUTHERLANDLAW(T); }
996
997
999 MFloat& a_levelSetFunction(const MInt cellId, const MInt set) { return m_levelSetValues[set][cellId]; }
1000
1002 MFloat a_levelSetFunction(const MInt cellId, const MInt set) const { return m_levelSetValues[set][cellId]; }
1003
1005 MFloat& a_levelSetValuesMb(const MInt cellId, const MInt set) { return m_levelSetValuesMb[IDX_LSSETMB(cellId, set)]; }
1006
1008 MFloat a_levelSetValuesMb(const MInt cellId, const MInt set) const {
1009 return m_levelSetValuesMb[IDX_LSSETMB(cellId, set)];
1010 }
1011
1012 MFloat a_alphaGas(const MInt cellId) const { return a_pvariable(cellId, PV->Y[0]); }
1013
1014 MFloat& a_alphaGas(const MInt cellId) { return a_pvariable(cellId, PV->Y[0]); }
1015
1016 MFloat a_uOtherPhase(const MInt cellId, const MInt dir) const { return m_EEGas.uOtherPhase[cellId][dir]; }
1017
1018 MFloat& a_uOtherPhase(const MInt cellId, const MInt dir) { return m_EEGas.uOtherPhase[cellId][dir]; }
1019
1020 MFloat a_uOtherPhaseOld(const MInt cellId, const MInt dir) const { return m_EEGas.uOtherPhaseOld[cellId][dir]; }
1021
1022 MFloat& a_uOtherPhaseOld(const MInt cellId, const MInt dir) { return m_EEGas.uOtherPhaseOld[cellId][dir]; }
1023
1024 MFloat a_gradUOtherPhase(const MInt cellId, const MInt uDir, const MInt gradDir) const {
1025 return m_EEGas.gradUOtherPhase[cellId][uDir + nDim * gradDir];
1026 }
1027
1028 MFloat& a_gradUOtherPhase(const MInt cellId, const MInt uDir, const MInt gradDir) {
1029 return m_EEGas.gradUOtherPhase[cellId][uDir + nDim * gradDir];
1030 }
1031
1032 MFloat a_vortOtherPhase(const MInt cellId, const MInt dir) const { return m_EEGas.vortOtherPhase[cellId][dir]; }
1033
1034 MFloat& a_vortOtherPhase(const MInt cellId, const MInt dir) { return m_EEGas.vortOtherPhase[cellId][dir]; }
1035
1036 MFloat a_nuTOtherPhase(const MInt cellId) const { return m_EEGas.nuTOtherPhase[cellId]; }
1037
1038 MFloat& a_nuTOtherPhase(const MInt cellId) { return m_EEGas.nuTOtherPhase[cellId]; }
1039
1040 MFloat a_nuEffOtherPhase(const MInt cellId) const { return m_EEGas.nuEffOtherPhase[cellId]; }
1041
1042 MFloat& a_nuEffOtherPhase(const MInt cellId) { return m_EEGas.nuEffOtherPhase[cellId]; }
1043
1045 MInt& a_associatedBodyIds(const MInt cellId, const MInt set) { return m_associatedBodyIds[IDX_LSSETMB(cellId, set)]; }
1046
1048 MInt a_associatedBodyIds(const MInt cellId, const MInt set) const {
1049 return m_associatedBodyIds[IDX_LSSETMB(cellId, set)];
1050 }
1051
1053 MFloat& a_curvatureG(const MInt cellId, const MInt set) { return m_curvatureG[set][cellId]; }
1054
1056 MFloat a_curvatureG(const MInt cellId, const MInt set) const { return m_curvatureG[set][cellId]; }
1057
1059 MFloat& a_flameSpeed(const MInt cellId, const MInt set) { return m_flameSpeedG[set][cellId]; }
1060
1062 MFloat a_flameSpeed(const MInt cellId, const MInt set) const { return m_flameSpeedG[set][cellId]; }
1063
1065 MInt& a_noSets() { return m_noSets; }
1066
1068 MInt a_noSets() const { return m_noSets; }
1069
1072
1075
1076
1078 // If cellId is a ghost cell, the function checks whether the boundary cell is a split child;
1079 // If it is a split child, the function returns the split cell, otherwise it returns the associated internal
1080 // cell
1081 const MInt& getAssociatedInternalCell(const MInt& cellId) const {
1082#ifndef NDEBUG
1083 std::ostringstream output;
1084 output << "cellId " << cellId << " Halo " << a_isHalo(cellId) << " IsPeriodic " << a_isPeriodic(cellId)
1085 << " bndryGhostCell " << a_isBndryGhostCell(cellId) << " splitChild "
1086 << a_hasProperty(cellId, SolverCell::IsSplitChild) << " splitCell "
1087 << a_hasProperty(cellId, SolverCell::IsSplitCell) << std::endl;
1088 if(a_isBndryGhostCell(cellId)) {
1089 ASSERT(cellId - m_bndryGhostCellsOffset < (signed)m_associatedInternalCells.size()
1090 && cellId - m_bndryGhostCellsOffset >= 0,
1091 "size exceeds container, cellId: " << cellId << "m_bndryGhostCellsOffset: " << m_bndryGhostCellsOffset
1092 << " m_associatedInterNallCells.size(): "
1093 << m_associatedInternalCells.size() << output.str());
1096 output.str());
1097 } else {
1098 ASSERT(m_splitChildToSplitCell.count(cellId) == 1, "mapped value not found for" << output.str());
1099 ASSERT(m_splitChildToSplitCell.find(cellId)->second < a_noCells(),
1100 "mapped value exceeds grid().tree().size() for cellId "
1101 << cellId << " " << m_splitChildToSplitCell.find(cellId)->second << " " << a_noCells() << " "
1102 << output.str());
1103 ASSERT(m_splitChildToSplitCell.find(cellId)->second > -1, "mapped value is negative for " << output.str());
1104 }
1105#endif
1106 return (
1107 !a_isBndryGhostCell(cellId)
1108 ? m_splitChildToSplitCell.find(cellId)->second
1109 : (a_hasProperty(m_associatedInternalCells[cellId - m_bndryGhostCellsOffset], SolverCell::IsSplitChild)
1112 }
1113
1114 virtual void reIntAfterRestart(MBool);
1115 virtual void resetRHS();
1116 virtual void resetRHSCutOffCells();
1117 virtual void initSolutionStep(MInt);
1119 virtual void Ausm();
1120 virtual void Muscl(MInt = -1);
1121 virtual void viscousFlux();
1122 virtual void copyVarsToSmallCells();
1123 virtual void computePV();
1124 virtual void computePrimitiveVariables();
1126 virtual void copyRHSIntoGhostCells();
1127 virtual void LSReconstructCellCenter_Boundary();
1128 virtual void LSReconstructCellCenter();
1129 virtual void applyBoundaryCondition();
1130 virtual void cutOffBoundaryCondition();
1131 virtual void computeConservativeVariables();
1132 virtual void initNearBoundaryExchange(const MInt mode = 0, const MInt offset = 0);
1136 void setActiveFlag(MIntScratchSpace&, const MInt mode, const MInt offset);
1138
1140
1142
1143 // Detailed chemistry functions and variables
1144 template <class _ = void, std::enable_if_t<isDetChem<SysEqn>, _*> = nullptr>
1146 template <class _ = void, std::enable_if_t<isDetChem<SysEqn>, _*> = nullptr>
1148 template <class _ = void, std::enable_if_t<isDetChem<SysEqn>, _*> = nullptr>
1150 template <class _ = void, std::enable_if_t<isDetChem<SysEqn>, _*> = nullptr>
1152 template <class _ = void, std::enable_if_t<isDetChem<SysEqn>, _*> = nullptr>
1153 void setMeanMolarWeight_CV(MInt cellId);
1154 template <class _ = void, std::enable_if_t<isDetChem<SysEqn>, _*> = nullptr>
1155 void setMeanMolarWeight_PV(MInt cellId);
1156 template <class _ = void, std::enable_if_t<isDetChem<SysEqn>, _*> = nullptr>
1157 void computeGamma();
1158 template <class _ = void, std::enable_if_t<isDetChem<SysEqn>, _*> = nullptr>
1160 template <class _ = void, std::enable_if_t<isDetChem<SysEqn>, _*> = nullptr>
1162 template <class _ = void, std::enable_if_t<isDetChem<SysEqn>, _*> = nullptr>
1163 void initCanteraObjects();
1164 template <class _ = void, std::enable_if_t<isDetChem<SysEqn>, _*> = nullptr>
1166
1169 void initHeatReleaseDamp();
1171
1172#if defined(WITH_CANTERA)
1173 std::shared_ptr<Cantera::Solution> m_canteraSolution;
1174 std::shared_ptr<Cantera::ThermoPhase> m_canteraThermo;
1175 std::shared_ptr<Cantera::Kinetics> m_canteraKinetics;
1176 std::shared_ptr<Cantera::Transport> m_canteraTransport;
1177#endif
1178
1179 std::unique_ptr<OneDFlame> m_oneDimFlame;
1180
1181 std::vector<MString> m_speciesName;
1182 std::map<std::string, MInt> speciesMap;
1187
1189
1192 static constexpr MInt s_maxNoSamplingVariables = 3;
1194 std::array<MFloat**, s_maxNoSamplingVariables> m_samplingVariables{nullptr};
1196 std::array<MInt, 2 * s_maxNoSamplingVariables> m_samplingVariablesStatus{};
1197
1199
1200 //------------------------------
1201 void computeVolumeForces();
1202 void computeRotForces();
1203
1210
1211 MFloat computeRecConstSVD(const MInt cellId, const MInt offset, MFloatScratchSpace& tmpA, MFloatScratchSpace& tmpC,
1212 MFloatScratchSpace& weights, const MInt recDim, const MInt, const MInt,
1213 const std::array<MBool, nDim> dirs = {}, const MBool relocateCenter = false);
1214 void extendStencil(const MInt);
1217 virtual void initializeRungeKutta();
1218 virtual void initializeMaxLevelExchange();
1221 void finalizeMpiExchange();
1222 void setUpwindCoefficient();
1223 void cellSurfaceMapping();
1224 template <class _ = void, std::enable_if_t<isDetChem<SysEqn>, _*> = nullptr>
1226 void setNghbrInterface();
1227
1228 void calcLESAverage();
1229 void saveLESAverage();
1230 void loadLESAverage();
1231 void finalizeLESAverage();
1232 // this factor is an empirical factor, should be changed based on setup and operating condition
1233 MFloat getAveragingFactor() { return F1B8 * m_Ma * sqrt(m_TInfinity) * timeStep(); };
1234 void saveSpongeData();
1235 void loadSpongeData();
1236 void initSTGSpongeExchange();
1241
1242 virtual void initSTGSponge();
1243 virtual void resetZonalLESAverage();
1244 virtual void determineLESAverageCells();
1245 virtual void resetZonalSolverData();
1248 virtual void nonReflectingBCCutOff();
1249 virtual void dqdtau();
1250 virtual bool rungeKuttaStep();
1251
1252 virtual void applyExternalSource();
1253 virtual void applyExternalOldSource(){};
1254 virtual void advanceExternalSource(){};
1256 void resetExternalSources();
1257
1259
1260 // void computeMeanOutletPressure();
1261 void deleteSrfcs();
1262 virtual void resetRHSNonInternalCells();
1263 virtual void correctMasterCells();
1264 // MBool triangleInterpolation(MFloat**, MFloat*);
1265 // MBool tetraederInterpolation(MFloat**, MFloat*);
1266 // void bilinearInterpolationConstants(MFloat**, MFloat*);
1267 // void bilinearInterpolationConstants2(MFloat*, MFloat*, MFloat*, MFloat*);
1268 // void trilinearInterpolationConstants(MFloat**, MFloat*);
1269 // void trilinearInterpolationConstants2(MFloat*, MFloat*, MFloat*, MFloat*);
1270 void writeCellData(MInt);
1271 virtual void convertPrimitiveRestartVariables();
1273 void initializeFvCartesianSolver(const MBool* propertiesGroups);
1274 void copyGridProperties();
1285
1286 // virtual // parallel
1287 // void exchangeTimeStep() = 0;
1288 // virtual void setPreviousTimeStep() = 0;
1289 // virtual void setLocalTimeStep() = 0;
1290 virtual void exchange();
1291
1292 template <typename T>
1293 void exchangeDataFV(T* data, const MInt blockSize = 1, MBool cartesian = true,
1294 const std::vector<MInt>& rotIndex = std::vector<MInt>());
1295 template <MBool exchangeAll_ = true>
1296 void exchangeFloatDataAzimuthal(MFloat* data, MInt noVars, const std::vector<MInt>& rotIndices);
1297 template <typename T>
1298 void exchangeDataAzimuthal(T* data, const MInt dataBlockSize = 1);
1300 virtual void exchangePeriodic();
1301 void exchangePipe();
1302 void startMpiExchange();
1303 void prepareMpiExchange();
1304 void finishMpiExchange();
1305 void cancelMpiRequests() override;
1306 template <MBool exchangeAll_>
1307 void gather();
1308 void receive(const MBool exchangeAll = false);
1309 void send(const MBool exchangeAll = false);
1310 template <MBool exchangeAll_>
1311 void scatter();
1312 void exchangeAll();
1313 virtual void computeReconstructionConstants();
1314 virtual void findNghbrIds();
1316 void rhs();
1317 void rhsBnd();
1318 void initSolver() override;
1319 void finalizeInitSolver() override;
1320 void preSolutionStep(MInt) override{};
1321 MBool solutionStep() override;
1322 MBool postSolutionStep() override { return true; };
1323 MBool solverStep();
1324 void postTimeStep() override;
1325 void scalarLimiter();
1326 void cleanUp() override {
1327 // Finalize communication
1329 };
1330
1331 void lhsBndFinish();
1332 void lhsBnd();
1333
1334 virtual void smallCellCorrection(const MInt timerId = -1);
1335 virtual void smallCellRHSCorrection(const MInt timerId = -1);
1336 virtual void updateSplitParentVariables(){/*only do something if we are using MB*/};
1337 virtual void checkDiv(){};
1338 virtual void updateMaterialNo(){};
1339
1340 template <class _ = void, std::enable_if_t<isEEGas<SysEqn>, _*> = nullptr>
1342 void revertTimestep();
1343 template <class _ = void, std::enable_if_t<isEEGas<SysEqn>, _*> = nullptr>
1344 void rhsEEGas();
1345 virtual void resetImplicitCoefficients();
1346
1348
1350
1351 private:
1354
1358
1361
1362 public:
1368 // MInt m_noNbBackup = 0;
1369 // List< MInt >* m_nbBackupCellIds;
1370 // List< MInt >* m_nbBackupDirs;
1371 // List< MInt >* m_nbBackupNghbrIds;
1372
1376
1378
1380
1383
1385
1386 public:
1397
1399 const Geom& geometry() const { return *m_geometry; }
1400
1401
1403 MPI_Comm globalMpiComm() const { return grid().raw().mpiComm(); }
1404
1405 // Creates a 2D slice from a 3D grid.
1406 void createGridSlice(const MString& direction, const MFloat intercept, const MString& fileName,
1407 MInt* const sliceCellIds) {
1408 grid().raw().createGridSlice(direction, intercept, fileName, -1, nullptr, sliceCellIds, nullptr, nullptr);
1409 }
1410
1411 protected:
1413 Geom& geometry() { return *m_geometry; }
1414
1415 // Collector for FV surfaces
1417 // Access surface collector
1419
1422
1438
1439 // cell and surface lists
1454 MInt m_slopeMemory; // slope offsets
1455 MInt m_surfaceVarMemory; // surface offsets
1456 std::set<MInt> m_splitSurfaces;
1457 std::vector<MInt> m_splitCells;
1458 std::vector<std::vector<MInt>> m_splitChilds;
1459 std::set<MInt> m_cutOffInterface;
1460
1461 // reconstruction arrays
1462 MFloat** m_A = nullptr;
1463 MFloat** m_ATA = nullptr;
1464 MFloat** m_ATAi = nullptr;
1467 std::vector<MFloat> m_reconstructionConstants;
1468 std::vector<MInt> m_reconstructionCellIds;
1469 std::vector<MInt> m_reconstructionNghbrIds;
1471 // Azimuthal
1472 std::vector<std::vector<MInt>> m_azimuthalMaxLevelHaloCells;
1473 std::vector<std::vector<MInt>> m_azimuthalMaxLevelWindowCells;
1474 std::vector<std::vector<MInt>> m_azimuthalRemappedHaloCells;
1475 std::vector<std::vector<MInt>> m_azimuthalRemappedWindowCells;
1483 std::vector<MFloat> m_azimuthalRecConsts;
1485 std::vector<MInt> m_azimuthalBndrySide;
1486 std::vector<MFloat> m_azimuthalCutRecCoord;
1487 std::vector<std::vector<MInt>> m_azimuthalMaxLevelWindowMap;
1488 std::vector<MInt> m_azimuthalHaloActive;
1490 8; // Estimated to be enough. If 8 is exceeded mTerm is called in localToGlobalIds()
1492 std::vector<MInt> m_rotIndVarsPV;
1493 std::vector<MInt> m_rotIndVarsCV;
1494
1495 // variables
1499 MFloat** m_rhs0 = nullptr;
1503 // limiter
1504 MFloat* m_limPhi = nullptr;
1505 std::vector<MFloat> m_dampFactor;
1506
1523
1524 // Jet model
1525 MBool m_jet = false;
1534 MFloat* m_jetConst = nullptr;
1549
1550 // Jet from a (chevron) nozzle
1554 MFloat m_normJetTemperature = -1.0; // Normalized jet temperature at nozzle exit
1555 MFloat m_maNozzleExit = -1.0; // Acoustic Mach number at nozzle exit: Ma_acoustic = u_jet/c_inf
1556 // Nozzle exit conditions
1557 MFloat m_nozzleExitMaJet = -1.0; // Local Mach number at nozzle exit: Ma_jet = u_jet/c_jet
1559 // MFloat m_nozzleExitP = -1.0; // assumed to be the same as the ambient pressure
1562 // Nozzle inlet conditions
1568
1569 // level set / progress variable model
1574
1609
1610 // dimensions of domain and sponge zones
1614
1616 MBool m_levelSetMb = false; // Moving boundary extension
1617 MBool m_LsRotate = false; // Rotating levelset
1620 // MBool m_isDetChem = false;
1624
1625 std::vector<MFloat>* m_levelSetValues = nullptr;
1630 std::vector<MFloat>* m_curvatureG = nullptr;
1631 std::vector<MFloat>* m_flameSpeedG = nullptr;
1634
1635 // restart/output related properties
1675 std::set<MInt> m_vtuGeometryOutput;
1698
1701
1710 MInt m_noRKSteps; // number of Runge-Kutta steps
1711 MInt m_noSamples; // number of samples used for averaging
1722 // MFloat m_weightTauC;
1723 // MFloat m_weightTauE;
1725 MFloat* m_angle = nullptr;
1726 MFloat* m_RKalpha = nullptr; // Runge-Kutta coefficients friend class FvCartesianSolver2D;
1727 // friend class FvCartesianSolver3D;
1728 // friend class FvMbSolver2D;
1729 // friend class FvMbSolver3D;
1730 // friend class LsCartesianSolver<nDim>;
1731
1733 struct {
1735 MFloat** uOtherPhase = nullptr;
1750 std::vector<MInt> gasSourceCells;
1752 std::vector<MFloat> gasSourceBox;
1762 std::vector<MFloat> gravity;
1763 std::vector<MFloat> gravityRefCoords;
1764 std::vector<MFloat> depthCorrectionCoefficients;
1767
1768 struct {
1776
1783
1786
1787 // Zonal
1797
1800 std::vector<MFloat>* m_RANSValues = nullptr;
1801 std::vector<MFloat>* m_LESValues = nullptr;
1802
1803 // LES average for zonal coupling
1804 std::vector<MFloat>* m_LESVarAverage = nullptr;
1805 std::vector<MFloat>* m_LESVarAverageBal = nullptr;
1806 std::vector<MInt> m_LESAverageCells;
1808 std::vector<MFloat> m_averagePos;
1809 std::vector<MInt> m_averageDir;
1810 std::vector<MBool> m_averageReconstructNut;
1811
1812 // LES average
1816
1817 // Nut reconstruct
1818 // MInt m_noReconstructNutVars;
1820
1821 // STG
1830
1831 // STG sponge
1836 // MBool m_preliminarySTGSponge = false;
1843 std::vector<MFloat>* m_STGSpongeFactor = nullptr;
1845 MFloat* m_uvErr = nullptr;
1846 MFloat* m_uvRans = nullptr;
1847 MFloat* m_uvInt = nullptr;
1852
1856 std::vector<MInt>* m_spongeAverageCellId = nullptr;
1857 std::vector<MInt> m_spongeCells;
1858 std::vector<MFloat> m_spongeLocations;
1860 // std::vector<MFloat> m_globalSpongeLocations;
1861 std::vector<std::pair<MFloat, MFloat>> m_globalSpongeLocations;
1862
1863 // RANS
1867
1868 //================================== WMLES ======================================
1869
1870
1871 std::vector<FvWMSurface<nDim>> m_wmSurfaces;
1872
1882
1884
1885 MPI_Comm m_comm_wm;
1886
1895 MPI_Request* m_mpi_wmRequest = nullptr;
1896 MPI_Request* m_mpi_wmSendReq = nullptr;
1897 MPI_Request* m_mpi_wmRecvReq = nullptr;
1898
1899 std::vector<std::vector<MInt>> m_wmImgCellIds;
1900 std::vector<std::vector<MInt>> m_wmImgWMSrfcIds;
1901 std::vector<std::vector<MFloat>> m_wmImgCoords;
1902
1903 std::vector<MInt> m_wmSurfaceProbeIds;
1904 std::vector<MInt> m_wmSurfaceProbeSrfcs;
1905
1906 //============================ Wall normal Output =======================
1914
1915 std::vector<MFloat> m_normalSamplingCoords;
1916 std::vector<MInt> m_normalSamplingSide;
1917
1919 std::vector<MFloat> m_wallNormalPointCoords; // computeWallNormalPointCoords
1920 std::vector<MFloat> m_wallNormalVectors;
1921
1922 std::vector<MFloat> m_wallSetupOrigin;
1923 std::vector<MInt> m_wallSetupOriginSide;
1924
1925 std::vector<MInt> m_wallNormalPointDomains; // findWallNormalCellIds
1926 std::vector<MInt> m_wallNormalPointCellIDs; // findWallNormalCellIds
1927 std::vector<std::vector<MInt>> m_neighborPointIds;
1928 std::vector<MFloatTensor> m_interpolationMatrices;
1929 std::vector<MInt> m_interpolationPosition;
1931 void findWallNormalCellIds();
1932 MFloat interpolateWallNormalPointVars(MInt var, MFloat coords[], MInt localId, std::vector<MInt> neighborList);
1933 std::vector<MInt> findWallNormalNeighbors(MInt pointId);
1935
1936
1937 // Spanwise Averaged Surface Probes
1943 std::vector<std::vector<MInt>> m_saSrfcProbeIds;
1944 std::vector<std::vector<MInt>> m_saSrfcProbeSrfcs;
1945
1948
1949 void initSpanAvgSrfcProbes();
1951
1954 void initWMSurfaceProbes();
1955 void writeWMSurfaceProbes();
1956 void writeWMTimersASCII();
1957 void initWMExchange();
1958 void exchangeWMVars();
1959 void gatherWMVars();
1960 void receiveWMVars();
1961 void sendWMVars();
1962 void scatterWMVars();
1964 void restartWMSurfaces();
1965
1969
1970 void initChannelForce();
1971 void applyChannelForce();
1972
1973 protected:
1988 MFloat** m_kronecker = nullptr;
2011 // new sponge parameters dependent on the chosen sponge boundary ids
2033
2036
2037 // post-processing
2041 MFloat** m_vorticity = nullptr;
2043
2044 // test case specific settings
2047
2050 MInt* m_noParts = nullptr;
2052 std::map<MInt, std::vector<MFloat>> m_vapourData;
2053
2062
2063
2065
2066 // relevant for POST-Processing
2073 std::set<MInt> m_activeMeanVars{};
2074
2075 public:
2076 using PrimitiveVariables = typename SysEqn::PrimitiveVariables;
2077
2078 typename SysEqn::PrimitiveVariables* PV{};
2079 typename SysEqn::ConservativeVariables* CV{};
2080 typename SysEqn::FluxVariables* FV{}; // these are the variables for which the fluxes are calculated
2081 // usually the same as conservative variables
2082 typename SysEqn::AdditionalVariables* AV{}; // these are additional variables that are saved in the cell collector
2083 // They might be used in SysEqn functions etc.
2084 typename SysEqn::SurfaceCoefficients* SC{}; // these are additional surface coefficients that are saved in the surface
2085 // collector. They might be used in SysEqn functions etc.
2086 static constexpr MBool hasAV = SysEqn::hasAV;
2087 static constexpr MBool hasSC = SysEqn::hasSC;
2088
2090 MInt noVariables() const override { return PV->noVariables; };
2091
2093
2095 constexpr MBool isMultilevel() const { return m_multilevel; }
2096
2099
2101
2103 void setMultilevelPrimary(const MBool state = true) { m_isMultilevelPrimary = state; }
2104 void setMultilevelSecondary(const MBool state = true) { m_isLowestSecondary = state; }
2105 constexpr MBool isZonal() const { return m_zonal; }
2107 void getSampleVariables(MInt cellId, const MFloat*& vars);
2108 void getSampleVariables(MInt const cellId, std::vector<MFloat>& vars);
2109 void getSampleVariableNames(std::vector<MString>& varNames) override;
2110 virtual void getSampleVarsDerivatives(const MInt cellId, const MFloat*& vars);
2111 MBool getSampleVarsDerivatives(const MInt cellId, std::vector<MFloat>& vars);
2112 void calculateHeatRelease();
2113 void getHeatRelease(MFloat*& heatRelease);
2114 virtual void getVorticity(MFloat* const vorticity);
2115 virtual void getVorticityT(MFloat* const vorticity);
2116 void oldPressure(MFloat* const p);
2117 virtual MFloat& vorticityAtCell(const MInt cellId, const MInt dir);
2118 virtual MFloat getBoundaryHeatFlux(const MInt cellId) const;
2119 MFloat time() const override;
2120 virtual void getDimensionalizationParams(std::vector<std::pair<MFloat, MString>>& dimParams) const;
2121
2123 MInt getCellIdByIndex(const MInt index) { return index; }
2124
2126 MInt getIdAtPoint(const MFloat* point, MBool NotUsed(globalUnique = false)) {
2127 return grid().findContainingLeafCell(point);
2128 }
2129
2131 virtual void getSolverSamplingProperties(std::vector<MInt>& samplingVars, std::vector<MInt>& noSamplingVars,
2132 std::vector<std::vector<MString>>& samplingVarNames,
2133 const MString featureName = "") override;
2134
2136 virtual void initSolverSamplingVariables(const std::vector<MInt>& varIds,
2137 const std::vector<MInt>& noSamplingVars) override;
2138
2140 virtual void calcSamplingVariables(const std::vector<MInt>& varIds, const MBool exchange) override;
2141
2142 virtual void initInterpolationForCell(const MInt cellId);
2143 virtual void calcSamplingVarAtPoint(const MFloat* point, const MInt id, const MInt sampleVarId, MFloat* state,
2144 const MBool interpolate = false) override;
2145
2147 MInt getCurrentTimeStep() const override { return globalTimeStep; }
2148
2151 MBool hasRestartTimeStep() const override { return true; }
2152
2154 MInt determineRestartTimeStep() const override;
2155
2157 virtual void initMatDat(){};
2158 virtual void writeVtkXmlFiles(const MString, const MString, MBool, MBool){};
2159
2162
2165
2166 protected:
2167
2168 virtual void viscousFlux_Gequ_Pv();
2169 virtual void viscousFlux_Gequ_Pv_Plenum();
2170 virtual void updateJet();
2171 virtual void writeListOfActiveFlowCells();
2172
2173 MFloat reduceData(const MInt cellId, MFloat* data, const MInt dataBlockSize = 1, const MBool average = true);
2174
2175 void sensorEntropyGrad(std::vector<std::vector<MFloat>>& sensors, std::vector<std::bitset<64>>& sensorCellFlag,
2176 std::vector<MFloat>& sensorWeight, MInt sensorOffset, MInt sen) override;
2177 void sensorEntropyQuot(std::vector<std::vector<MFloat>>& sensors, std::vector<std::bitset<64>>& sensorCellFlag,
2178 std::vector<MFloat>& sensorWeight, MInt sensorOffset, MInt sen) override;
2179 void sensorVorticity(std::vector<std::vector<MFloat>>& sensors, std::vector<std::bitset<64>>& sensorCellFlag,
2180 std::vector<MFloat>& sensorWeight, MInt sensorOffset, MInt sen) override;
2181 void sensorDerivative(std::vector<std::vector<MFloat>>& sensors, std::vector<std::bitset<64>>& sensorCellFlag,
2182 std::vector<MFloat>& sensorWeight, MInt sensorOffset, MInt sen) override;
2183 void sensorSpecies(std::vector<std::vector<MFloat>>& sensors, std::vector<std::bitset<64>>& sensorCellFlag,
2184 std::vector<MFloat>& sensorWeight, MInt sensorOffset, MInt sen) override;
2185 void sensorParticle(std::vector<std::vector<MFloat>>& sensors, std::vector<std::bitset<64>>& sensorCellFlag,
2186 std::vector<MFloat>& sensorWeight, MInt sensorOffset, MInt sen) override;
2187 virtual void setCellProperties();
2188 void initSpongeLayer();
2191
2193
2194 virtual MBool gridPointIsInside(MInt, MInt);
2195
2196 // parallel IO library functions NETCDF
2197 void saveGridFlowVarsPar(const MChar* fileName, MInt noTotalCells, MLong noInternalCells,
2198 MFloatScratchSpace& variables, std::vector<MString>& dbVariablesName, MInt,
2199 MIntScratchSpace& idVariables, std::vector<MString>& idVariablesName, MInt,
2200 MFloatScratchSpace& dbParameters, std::vector<MString>& dbParametersName,
2201 MIntScratchSpace& idParameters, std::vector<MString>& idParametersName,
2202 const MInt* recalcIds);
2203
2204 void computeVorticity3D(MFloat* const vorticity);
2205 void computeVorticity2D(MFloat* const vorticity);
2206 void computeVorticity3DT(MFloat* const vorticity);
2207 void computeQCriterion(MFloatScratchSpace& qCriterion);
2208 void loadRestartTime(const MChar* fileName, MInt& globalTimeStepInput, MFloat& timeInput, MFloat& physicalTimeInput);
2209 virtual void loadOldVariables(const MString& fileName);
2210 virtual void loadGridFlowVarsPar(const MChar* fileName);
2211 virtual void loadRestartMaterial(){};
2212 virtual void initCellMaterialNo(){};
2213
2214 virtual inline MFloat entropy(MInt cellId) {
2215 return sysEqn().entropy(a_pvariable(cellId, PV->P), a_pvariable(cellId, PV->RHO));
2216 }
2217
2218 // parallelization
2225 // private:
2226 MPI_Request* m_mpi_request = nullptr;
2227 MPI_Request* m_mpi_sendRequest = nullptr;
2228 MPI_Request* m_mpi_receiveRequest = nullptr;
2229 // Identify if there are open MPI recv/send requests
2233
2234 // jet
2235
2237
2238
2239 public:
2240 // Combustion:
2245
2246 // moving boundary
2264
2265 // gap-Handling
2267 public:
2268 static constexpr MInt maxNoOverlappingBodies = 2;
2274
2275 FvGapCell(MInt cId, MInt rId, MInt sId, MInt body1, MInt body2) : cellId(cId), region(rId), status(sId) {
2276 std::fill_n(bodyIds, maxNoOverlappingBodies, -1);
2277 bodyIds[0] = body1;
2278 bodyIds[1] = body2;
2279 std::fill_n(surfaceVelocity, 3, 0);
2280 };
2281 ~FvGapCell() = default;
2282 };
2286 std::vector<MInt> m_gapCellId;
2287 std::vector<FvGapCell> m_gapCells;
2288
2289 // periodc bc
2299
2305
2307
2312
2313 protected:
2315 std::vector<MInt> m_associatedInternalCells;
2316 std::map<MInt, MInt> m_splitChildToSplitCell;
2366 // end levelset
2367
2368 public:
2369 MInt noSolverTimers(const MBool allTimings) override {
2370#ifdef MAIA_TIMER_FUNCTION
2371 // 11 additional times are created, but only 6 are written
2372 const MInt additionalTimer = m_levelSetMb ? 6 : 0;
2373 if(allTimings) {
2374 return 2 + 17 + additionalTimer;
2375 } else {
2376 return 6;
2377 }
2378#else
2379 return 2;
2380#endif
2381 }
2382 void getSolverTimings(std::vector<std::pair<MString, MFloat>>& solverTimings, const MBool allTimings) override;
2383 void limitWeights(MFloat*) override;
2385 MInt noCellDataDlb() const override { return 1; };
2386 MInt cellDataTypeDlb(const MInt dataId) const override {
2387 if(dataId != 0) {
2388 TERMM(1, "solverCelldataType: invalid data id");
2389 }
2390 return MFLOAT;
2391 };
2392 MInt cellDataSizeDlb(const MInt dataId, const MInt gridCellId) override;
2393
2395 void getCellDataDlb(const MInt dataId, const MInt oldNoCells, const MInt* const bufferIdToCellId,
2396 MFloat* const data) override;
2398 void setCellDataDlb(const MInt dataId, const MFloat* const data) override;
2399
2401 void getGlobalSolverVars(std::vector<MFloat>& globalFloatVars, std::vector<MInt>& globalIdVars) override;
2402 void setGlobalSolverVars(std::vector<MFloat>& globalFloatVars, std::vector<MInt>& globalIdVars) override;
2403
2404 MBool hasSplitBalancing() const override { return true; }
2405
2406 virtual MBool adaptationTrigger() { return false; }
2407
2409 if(grid().hasInactiveRanks()) {
2410 this->startLoadTimer(AT_);
2411 MPI_Allreduce(MPI_IN_PLACE, &m_forceAdaptation, 1, MPI_C_BOOL, MPI_LOR, grid().raw().mpiComm(), AT_,
2412 "MPI_IN_PLACE", "m_forceAdaptation");
2413 this->stopLoadTimer(AT_);
2414 }
2415 return m_forceAdaptation;
2416 }
2417
2418 protected:
2419 // Dynamic load balancing
2429
2436
2437 void initializeTimers();
2438
2439 // Timers
2440 // Timer group which holds all solver-wide timers
2442 // Stores all solver-wide timers
2443 std::array<MInt, Timers::_count> m_timers{};
2444
2478
2485
2494 MPI_Request m_timeStepReq;
2503 MFloat timeStep(MBool canSolver = false) noexcept {
2504 if(!m_timeStepAvailable) {
2505#ifdef MAIA_FV_LOG_ACCESS_TO_UNAVAILABLE_TIME_STEP
2506 if(!canSolver) {
2507 MInt flag;
2508 MPI_Test(&m_timeStepReq, &flag, MPI_STATUS_IGNORE, AT_);
2509 if(!flag) {
2510 mTerm(1, AT_,
2511 "The time-step was required before it was available;"
2512 "use timeStep(true) if you want the timeStep call to solver communication");
2513 }
2514 }
2515#endif
2516 MPI_Wait(&m_timeStepReq, MPI_STATUS_IGNORE, AT_);
2517 m_timeStepAvailable = true;
2518 m_log << "Computed global time step (method: " << m_timeStepMethod << " ): " << m_timeStep
2519 << " - physical: " << m_timeStep * m_timeRef << std::endl;
2520 }
2521 return m_timeStep;
2522 }
2531
2532 // This is the time step written down to restart files. This is the same as
2533 // the normal time step unless you are using the level-set solver. In this case:
2534 // - if you are running a 2D simulation with timeStepMethod 17511 this _might_
2535 // do something meaningful (it just writes a different time step than the one
2536 // used).
2537 // - otherwise this writes -1 so don't use the time-step from the restart file
2538 // when restarting
2540
2542
2543 void computeSourceTerms();
2544
2545 public:
2547 void forceTimeStep(const MFloat dt) { m_timeStep = dt; }
2548
2550
2551 void preTimeStep() override { m_timeStepUpdated = false; }
2552
2553 protected:
2554 struct MV {
2555 // Mean Lamb vector
2556 static constexpr const MInt LAMB0 = 0;
2557
2558 // Mean vorticity
2559 static constexpr const MInt VORT0 = 1;
2560
2561 // du/dx, du/dy, dw/dz for the divergence
2562 static constexpr const MInt DU = 2;
2563
2564 // Mean gradient of rho
2565 static constexpr const MInt DRHO = 3;
2566
2567 // Mean gradient of p
2568 static constexpr const MInt DP = 4;
2569
2570 // Mean gradient of rho*div(u)
2571 static constexpr const MInt RHODIVU = 5;
2572
2573 // Mean gradient of u*grad(rho)
2574 static constexpr const MInt UGRADRHO = 6;
2575
2576 // Mean of (gradient of p divided by rho)
2577 static constexpr const MInt GRADPRHO = 7;
2578
2579 // Mean gradients of velocity components (contains MV::DU)
2580 static constexpr const MInt GRADU = 8;
2581
2582 // Sum of products of velocity and velocity gradients:
2583 // u * grad(u) + v * grad(v) + w * grad(w)
2584 static constexpr const MInt UGRADU = 9;
2585 };
2586
2587 // Data members used to replace local static variables
2588 private:
2592
2593 protected:
2594 // Data members used to replace local static variables for src/fvsolverxd.h
2595 // logCell
2597 // smallCellCorrection
2601 // computeSurfaceValuesLimitedSlopesMan
2604
2605 // Data members used to replace local static variables for src/fvmbcartesiansolverxd.h
2606 // getDistanceSplitSphere
2609 // constructGFieldPredictor
2612 // advanceSolution
2617 // updateBodyProperties
2621 // redistributeMass
2623 // applyBoundaryCondition
2634 // updateSpongeLayer
2637 // logData
2639 // logData initial condition 45299
2647 // logData initial condition 45301
2657 // saveSolverSolution
2659 // computeFlowStatistics
2660 static constexpr MInt s_computeFlowStatistics_noSamples = 1; // with temporal averaging
2662 static constexpr MInt s_computeFlowStatistics_noDat = 76; // mutiples of 4!
2673 static constexpr MInt s_computeFlowStatistics_noSamples2 = 1; // with temporal averaging
2683 static constexpr MInt s_computeFlowStatistics_noSamples3 = 1; // with temporal averaging
2694 // near-particle statistics
2696 static constexpr MInt s_computeFlowStatistics_noSamples4 = 1; // with temporal averaging
2702 // writeVtkXmlFiles
2705 // logCellxd
2707
2708
2709 public:
2710 friend class LsFvCombustion<nDim_, SysEqn>;
2711 friend class CouplerFvMultilevel<nDim_, SysEqn>;
2712 friend class LsFvMb<nDim_, SysEqn>;
2713 // has to be explicit since only RANS solver is template parameter
2714 friend class FvZonal<nDim_, FvSysEqnRANS<nDim, RANSModelConstants<RANS_SA_DV>>>;
2715 friend class FvZonal<nDim_, FvSysEqnRANS<nDim, RANSModelConstants<RANS_FS>>>;
2717 friend class FvZonalRTV<nDim_, FvSysEqnRANS<nDim, RANSModelConstants<RANS_FS>>>;
2719 friend class FvZonalSTG<nDim_, FvSysEqnRANS<nDim, RANSModelConstants<RANS_FS>>>;
2723 friend class VtkIo<nDim_, SysEqn>;
2724
2726
2727 void exchangeGapInfo();
2728 void resetCutOffCells();
2729 void resetSponge();
2730 void exchangeProperties();
2731
2732 void computeUTau(MFloat* data, MInt cellId); // is never called
2733
2734 // sponge
2736 virtual void updateSpongeLayer();
2737 std::array<MFloat, 6> computeTargetValues();
2738 std::array<MFloat, nDim_ + 2> computeSpongeDeltas(MInt cellId, std::array<MFloat, 6>);
2739 // MFloat meanDensity, MFloat meanPressure, MFloat
2740 // meanDensityIn, MFloat meanPressureIn);
2741 void updateSpongeLayerRhs(MInt, std::array<MFloat, nDim_ + 2>);
2742 void checkCells(); //<-- XD version, but by now only used in 3D
2743 void checkForSrfcsMGC();
2744 void checkForSrfcsMGC_2();
2745 void checkForSrfcsMGC_2_(); //<-- Used only in 3D
2747 virtual void correctBoundarySurfaces();
2748 virtual void correctBoundarySurfaces_(); //<-- Only required in 3D
2749 void checkCellSurfaces();
2751
2756 void rebuildAzimuthalReconstructionConstants(MInt cellId, MInt offset, MFloat* recCoord, MInt mode = 0);
2757 void interpolateAzimuthalData(MFloat* data, MInt offset, MInt noVars, const MFloat* vars);
2758 void fillExcBufferAzimuthal(MInt cellId, MInt offset, MFloat* dataDest, MFloat* dataSrc, MInt noData,
2759 const std::vector<MInt>& rotIndex = std::vector<MInt>());
2760 void rotateVectorAzimuthal(MInt side, MFloat* data, MInt noData, const std::vector<MInt>& indices);
2761 void interpolateAzimuthalDataReverse(MFloat* data, MInt offset, MInt noVars, const MFloat* vars);
2765 // void copyVarsToSmallCells() override;
2766
2767 // azimuthal periodicity concept
2769 void computeRecConstPeriodic_(); //<-- Used only in 3D
2770 void identPeriodicCells();
2771 void identPeriodicCells_(); //<-- Used only in 3D
2772
2773 // void Muscl(MInt timerId = -1) override;
2774 // void nonReflectingBCCutOff() override;
2775 // void nonReflectingBCAfterTreatmentCutOff() override;
2776
2777 // ATTRIBUTES2(ATTRIBUTE_HOT, ATTRIBUTE_FLATTEN) virtual void LSReconstructCellCenter();
2778 ATTRIBUTES2(ATTRIBUTE_ALWAYS_INLINE, ATTRIBUTE_HOT)
2779 inline void LSReconstructCellCenter_(const MUint noSpecies);
2780 void LSReconstructCellCenterCons(const MUint noSpecies); // ATTRIBUTES2(ATTRIBUTE_ALWAYS_INLINE,ATTRIBUTE_HOT);
2781 ATTRIBUTES2(ATTRIBUTE_HOT, ATTRIBUTE_FLATTEN) virtual void computeSurfaceValues(MInt timerId = -1);
2782 ATTRIBUTES2(ATTRIBUTE_ALWAYS_INLINE, ATTRIBUTE_HOT) inline void computeSurfaceValues_(const MUint);
2783 ATTRIBUTES2(ATTRIBUTE_HOT, ATTRIBUTE_FLATTEN) virtual void computeSurfaceValuesLimited(MInt timerId = -1);
2784 virtual void computeSurfaceValuesLOCD(MInt timerId = -1);
2785 virtual void computeLimitedSurfaceValues(MInt timerId = -1);
2786 virtual void computeSurfaceValuesLimitedSlopes(MInt timerId = -1);
2787 virtual void computeSurfaceValuesLimitedSlopesMan(MInt timerId = -1);
2790
2792 void findNghbrIdsMGC();
2793 void findDirectNghbrs(MInt cellId, std::vector<MInt>& nghbrList);
2794 void findNeighborHood(MInt cellId, MInt layer, std::vector<MInt>& nghbrList);
2795
2796 void refineCell(const MInt) override;
2797 void removeChilds(const MInt) override;
2798 void removeCell(const MInt) override;
2799 void swapCells(const MInt, const MInt) override;
2800 void resizeGridMap() override;
2801 void swapProxy(const MInt, const MInt) override;
2802 MBool cellOutside(const MInt);
2803 MInt cellOutside(const MFloat*, const MInt, const MInt) override;
2804 // virtual void getBoundaryDistance(MFloatScratchSpace&);
2805 virtual void resetSurfaces();
2806 virtual void resetBoundaryCells(const MInt offset = 0);
2807
2808 // Reallocate memory of arrays depending on current number of cells
2810 // Reallocate memory of master/small cell id arrays depending on current number of cells
2812
2813 void prepareAdaptation() override;
2814 void setSensors(std::vector<std::vector<MFloat>>& sensors,
2815 std::vector<MFloat>& sensorWeight,
2816 std::vector<std::bitset<64>>& sensorCellFlag,
2817 std::vector<MInt>& sensorSolverId) override;
2818 void postAdaptation() override;
2819 void finalizeAdaptation() override;
2820
2821 // Sensors
2822 void sensorInterface(std::vector<std::vector<MFloat>>& sensors, std::vector<std::bitset<64>>& sensorCellFlag,
2823 std::vector<MFloat>& sensorWeight, MInt sensorOffset, MInt sen) override;
2824 void sensorInterfaceDelta(std::vector<std::vector<MFloat>>& sensors, std::vector<std::bitset<64>>& sensorCellFlag,
2825 std::vector<MFloat>& sensorWeight, MInt sensorOffset, MInt sen);
2826 void sensorInterfaceLsMb(std::vector<std::vector<MFloat>>& sensors, std::vector<std::bitset<64>>& sensorCellFlag,
2827 std::vector<MFloat>& sensorWeight, MInt sensorOffset, MInt sen);
2828 void sensorInterfaceLs(std::vector<std::vector<MFloat>>& sensors, std::vector<std::bitset<64>>& sensorCellFlag,
2829 std::vector<MFloat>& sensorWeight, MInt sensorOffset, MInt sen);
2830 void sensorCutOff(std::vector<std::vector<MFloat>>& sensors, std::vector<std::bitset<64>>& sensorCellFlag,
2831 std::vector<MFloat>& sensorWeight, MInt sensorOffset, MInt sen);
2832 void sensorPatch(std::vector<std::vector<MFloat>>& sensors, std::vector<std::bitset<64>>& sensorCellFlag,
2833 std::vector<MFloat>& sensorWeight, MInt sensorOffset, MInt sen) override;
2834 void bandRefinementSensorDerivative(std::vector<std::vector<MFloat>>& sensors,
2835 std::vector<std::bitset<64>>& sensorCellFlag, MInt sensorOffset, MInt sen,
2836 const std::vector<MFloat>& tau, const MFloat sensorThreshold);
2837
2840
2841 virtual void updateMultiSolverInformation(MBool fullReset = false);
2842 void resetSolver() override;
2843 virtual void resetSolverFull();
2844 void setCellWeights(MFloat*) override;
2845 void balance(const MInt* const noCellsToReceiveByDomain,
2846 const MInt* const noCellsToSendByDomain,
2847 const MInt* const targetDomainsByCell,
2848 const MInt oldNoCells) override;
2849 void balancePre() override;
2850 void balancePost() override;
2851 void finalizeBalance() override;
2852 // Partitioning
2853 MInt noLoadTypes() const override;
2854 void getDefaultWeights(MFloat* weights, std::vector<MString>& names) const;
2855 void getLoadQuantities(MInt* const loadQuantities) const override;
2856 MFloat getCellLoad(const MInt cellId, const MFloat* const weights) const override;
2857
2858 void getDomainDecompositionInformation(std::vector<std::pair<MString, MInt>>& domainInfo) override;
2859
2860 void saveSolverSolution(const MBool forceOutput = false, const MBool finalTimeStep = false) override;
2861 void writeRestartFile(const MBool, const MBool, const MString, MInt*) override;
2862 void writeRestartFile(MBool) override{};
2863 MBool prepareRestart(MBool, MBool&) override;
2864 // void reIntAfterRestart(MBool) override;
2865 void saveSampleFiles();
2866 virtual void saveRestartFile(const MBool);
2867 void saveDebugRestartFile();
2868 void loadRestartFile() override;
2870 // void computePrimitiveVariablesCoarseGrid() override;
2872
2873 void writeCenterLineVel();
2875
2878
2879 template <MInt stencil, class F>
2880 inline void Ausm_(F& fluxFct);
2881
2882 ATTRIBUTES2(ATTRIBUTE_HOT, ATTRIBUTE_ALWAYS_INLINE)
2883 inline void computePrimitiveVariables_();
2884 template <class _ = void, std::enable_if_t<isEEGas<SysEqn>, _*> = nullptr>
2885 ATTRIBUTES2(ATTRIBUTE_HOT, ATTRIBUTE_ALWAYS_INLINE)
2887 ATTRIBUTES2(ATTRIBUTE_HOT, ATTRIBUTE_ALWAYS_INLINE) inline void computeConservativeVariables_();
2888 template <class _ = void, std::enable_if_t<isEEGas<SysEqn>, _*> = nullptr>
2890 template <MInt stencil, class F>
2891 void viscousFlux_(F& viscousFluxFct);
2892 template <MInt stencil, class F>
2893 void viscousFluxCompact_(F& viscousFluxFct);
2894 template <MInt noSpecies>
2896
2899
2900 virtual void distributeFluxToCells();
2901 void implicitTimeStep() override;
2902 virtual MBool maxResidual(MInt mode = 0);
2903 void computeCellVolumes();
2904 template <class _ = void, std::enable_if_t<!isEEGas<SysEqn>, _*> = nullptr>
2905 ATTRIBUTES2(ATTRIBUTE_HOT, ATTRIBUTE_ALWAYS_INLINE)
2906 inline MBool rungeKuttaStep_(const MUint);
2907 template <class _ = void, std::enable_if_t<isEEGas<SysEqn>, _*> = nullptr>
2908 ATTRIBUTES2(ATTRIBUTE_HOT, ATTRIBUTE_ALWAYS_INLINE)
2909 inline MBool rungeKuttaStepEEGas();
2911 void computeSamplingTimeStep_(); //<-- Only available in 2D
2912
2917
2919 virtual void setConservativeVariables(MInt cellId);
2920 void setPrimitiveVariables(MInt cellId);
2921 template <class _ = void, std::enable_if_t<isEEGas<SysEqn>, _*> = nullptr>
2923 void divCheck(MInt);
2924
2925 template <MInt diag, MBool recorrectBndryCellCoords = false>
2927 template <MBool recorrectBndryCellCoords = false>
2928 MInt getNghbrLeafCells(const MInt cellId, MInt refCell, MInt layer, MInt* nghbrs, MInt dir, MInt dir1 = -1,
2929 MInt dir2 = -1) const;
2930
2931 void reduceVariables();
2933
2934 void generateBndryCells();
2935 void createBoundaryCells();
2936
2937 // function pointers
2940
2942
2943 void getInterpolatedVariables(const MInt cellId, const MFloat* position, MFloat* vars) override;
2944 template <MInt noSpecies>
2945 void getInterpolatedVariables(const MInt cellId, const MFloat* position, MFloat* vars);
2946 void getInterpolatedVariablesInCell(const MInt cellId, const MFloat* position, MFloat* vars);
2947 template <MInt a, MInt b, MBool old = false>
2948 void interpolateVariables(const MInt cellId, const MFloat* position, MFloat* result);
2949 template <MInt a, MInt b>
2950 void interpolateVariablesInCell(const MInt cellId, const MFloat* position,
2951 std::function<MFloat(MInt, MInt)> variables, MFloat* result);
2952
2953 // MString get_mSysEqnName();
2955
2957 MFloat cv_p(MInt cellId) const noexcept;
2959 MFloat cv_T(MInt cellId) const noexcept;
2961 MFloat cv_a(MInt cellId) const noexcept;
2962
2963 void setTimeStep();
2964
2965 protected:
2966 MFloat computeTimeStep(MInt cellId) const noexcept;
2967 MFloat computeTimeStepMethod(MInt cellId) const noexcept;
2970 MBool cellParticipatesInTimeStep(MInt cellId) const noexcept;
2971 MFloat computeTimeStepDiffusionNS(MFloat density, MFloat temperature, MFloat Re, MFloat C, MFloat dx) const noexcept;
2972 void computeAndSetTimeStep();
2973
2974 // Storage for required interpolation information in certain cells
2976 std::vector<std::vector<MFloat>> m_cellInterpolationMatrix{};
2977 std::vector<std::vector<MInt>> m_cellInterpolationIds{};
2978
2979 public:
2983
2985
2986 public:
2987 // Data members used to replace local static variables
2989 MPI_Comm comm_sponge{};
2992 static constexpr MInt s_maxNoSpongeZones = 10;
3002
3003 // Level-set solver ...
3004 static constexpr MInt s_maxNoEmbeddedBodies = 20;
3005 std::map<MInt, std::vector<MInt>> m_cellToNghbrHood;
3006
3009
3010 private:
3011 // crankAngle
3014
3016
3017 public:
3018 // Sandpaper Tripping stuff
3019 void initSandpaperTrip();
3020 void applySandpaperTrip();
3021 void saveSandpaperTripVars();
3024
3025 void dumpCellData(const MString name);
3026
3031 // MBool m_useSandpaperTrip;
3034
3044
3045 std::vector<MInt> m_tripCellIds;
3046 std::vector<MFloat> m_tripCoords;
3047
3060 MFloat* m_tripG = nullptr;
3061 MFloat* m_tripH1 = nullptr;
3062 MFloat* m_tripH2 = nullptr;
3066
3071 std::vector<MInt> m_maxLvlMpiSendNeighbor{};
3072 std::vector<MInt> m_maxLvlMpiRecvNeighbor{};
3073};
3074
3075
3077template <MInt nDim_, class SysEqn_>
3078// template <typename dataType>
3080 const MInt* const bufferIdToCellId, MFloat* const data) {
3081 TRACE();
3082
3083 MInt localBufferId = 0;
3084 for(MInt i = 0; i < oldNoCells; i++) {
3085 const MInt gridCellId = bufferIdToCellId[i];
3086
3087 if(gridCellId < 0) continue;
3088
3089 const MInt cellId = grid().tree().grid2solver(gridCellId);
3090 if(cellId < 0 || cellId >= noInternalCells()) {
3091 continue;
3092 }
3093
3094 switch(dataId) {
3095 case 0: {
3096 const MInt dataSize = CV->noVariables;
3097 std::copy_n(&a_variable(cellId, 0), dataSize, &data[localBufferId * dataSize]);
3098 break;
3099 }
3100 default:
3101 TERMM(1, "Unknown data id.");
3102 break;
3103 }
3104 localBufferId++;
3105 }
3106}
3107
3108
3110template <MInt nDim_, class SysEqn_>
3111// template <typename dataType>
3113 TRACE();
3114
3115 // Nothing to do if solver is not active
3116 if(!isActive()) {
3117 return;
3118 }
3119
3120 // Set the variables if this is the correct reinitialization stage
3121 if(m_loadBalancingReinitStage == 0) {
3122 switch(dataId) {
3123 case 0: {
3124 std::copy_n(data, noInternalCells() * CV->noVariables, &a_variable(0, 0));
3125 break;
3126 }
3127 default:
3128 TERMM(1, "Unknown data id.");
3129 }
3130 }
3131}
3132
3133
3134template <MInt nDim, class SysEqn>
3135template <class _, std::enable_if_t<isEEGas<SysEqn>, _*>>
3136inline MBool FvCartesianSolverXD<nDim, SysEqn>::uDLimiter(const MFloat* const uOtherPhase, MFloat* const pvars) {
3137 const MFloat uDLim = m_EEGas.uDLim;
3138 MBool change = false;
3139 for(MInt i = 0; i < nDim; i++) {
3140 if(!((pvars[i] - uOtherPhase[i]) <= uDLim)) {
3141 pvars[i] = uOtherPhase[i] + uDLim;
3142 change = true;
3143 } else if(!((pvars[i] - uOtherPhase[i]) >= -uDLim)) {
3144 pvars[i] = uOtherPhase[i] - uDLim;
3145 change = true;
3146 }
3147 }
3148 return change;
3149}
3150
3152template <MInt nDim, class SysEqn>
3153template <typename T>
3154void FvCartesianSolverXD<nDim, SysEqn>::exchangeDataFV(T* data, const MInt blockSize, MBool cartesian,
3155 const std::vector<MInt>& rotIndex) {
3156 TRACE();
3157
3158 RECORD_TIMER_START(m_tcomm);
3159 RECORD_TIMER_START(m_texchange);
3160
3161 exchangeData(data, blockSize);
3162
3163 if(grid().azimuthalPeriodicity()) {
3164 if(cartesian) {
3165 this->exchangeAzimuthalPer(data, blockSize);
3166 } else {
3167 if constexpr(std::is_same<T, MFloat>::value) {
3168 exchangeFloatDataAzimuthal(data, blockSize, rotIndex);
3169 } else {
3170 exchangeDataAzimuthal(data, blockSize);
3171 }
3172 }
3173 }
3174
3175 RECORD_TIMER_STOP(m_texchange);
3176 RECORD_TIMER_STOP(m_tcomm);
3177}
3178
3179
3183template <MInt nDim, class SysEqn>
3184template <typename T>
3186 TRACE();
3187
3188 if(grid().noAzimuthalNeighborDomains() == 0 && m_azimuthalRemappedNeighborDomains.size() > 0) {
3189 return;
3190 }
3191
3192 this->exchangeAzimuthalPer(&data[0], dataBlockSize);
3193
3194 MUint sndSize = maia::mpi::getBufferSize(m_azimuthalRemappedWindowCells);
3195 ScratchSpace<T> windowData(sndSize * dataBlockSize, AT_, "windowData");
3196 windowData.fill(0);
3197 MUint rcvSize = maia::mpi::getBufferSize(m_azimuthalRemappedHaloCells);
3198 ScratchSpace<T> haloData(rcvSize * dataBlockSize, AT_, "haloData");
3199 haloData.fill(0);
3200
3201 // Remapped Halos
3202 windowData.fill(0);
3203 haloData.fill(0);
3204 MInt sndCnt = 0;
3205 for(MUint i = 0; i < m_azimuthalRemappedNeighborDomains.size(); i++) {
3206 for(MUint j = 0; j < m_azimuthalRemappedWindowCells[i].size(); j++) {
3207 MInt cellId = m_azimuthalRemappedWindowCells[i][j];
3208 for(MInt b = 0; b < dataBlockSize; b++) {
3209 windowData[sndCnt * dataBlockSize + b] = data[cellId * dataBlockSize + b];
3210 }
3211 }
3212 }
3213 if(m_azimuthalRemappedNeighborDomains.size() > 0) {
3214 maia::mpi::exchangeBuffer(m_azimuthalRemappedNeighborDomains, m_azimuthalRemappedHaloCells,
3215 m_azimuthalRemappedWindowCells, mpiComm(), windowData.getPointer(), haloData.getPointer(),
3216 dataBlockSize);
3217 }
3218
3219 MInt rcvCnt = 0;
3220 for(MUint i = 0; i < m_azimuthalRemappedNeighborDomains.size(); i++) {
3221 for(MUint j = 0; j < m_azimuthalRemappedHaloCells[i].size(); j++) {
3222 MInt cellId = m_azimuthalRemappedHaloCells[i][j];
3223 for(MInt b = 0; b < dataBlockSize; b++) {
3224 data[cellId * dataBlockSize + b] = haloData[rcvCnt * dataBlockSize + b];
3225 }
3226 }
3227 }
3228}
3229
3230// Undefine macros that should not be used outside this file
3231#undef ENSURE_VALID_CELL_ID_CONTAINER
3232
3233#endif // FVSOLVERXD_H
GridCell
Grid cell Property Labels.
static constexpr MInt maxNoOverlappingBodies
FvGapCell(MInt cId, MInt rId, MInt sId, MInt body1, MInt body2)
MInt bodyIds[maxNoOverlappingBodies]
MFloat a_avariable(const MInt cellId, const MInt varId) const
Returns additional variable v of the cell cellId for variables varId.
MFloat m_static_logData_ic45301_freqFactor[s_logData_ic45301_maxNoEmbeddedBodies]
static constexpr MBool hasAV
MFloat a_variable(const MInt cellId, const MInt varId) const
Returns conservative variable v of the cell cellId for variables varId.
void(FvCartesianSolverXD::* m_reconstructSurfaceData)(MInt)
std::vector< std::vector< MInt > > m_splitChilds
const MChar ** m_variablesName
void computePrimitiveVariablesMultiSpecies_(const MUint)
typename CartesianSolver::Grid Grid
MBool m_static_updateBodyProperties_c453_firstRun
void computeSrfcs(MInt, MInt, MInt, MInt)
std::shared_ptr< Cantera::Solution > m_canteraSolution
MInt getCurrentTimeStep() const override
Return the current time step.
MFloat a_surfaceFactor(const MInt srfcId, const MInt varId) const
Returns the factor of surface srfcId for variable varId.
virtual void computeConservativeVariables()
Dispatches the computation of the conservative variables for different number of species.
MFloat & a_implicitCoefficient(const MInt cellId, const MInt coefId)
Returns the implicitCoefficient of cell cellId for coefficient coefId.
MInt c_level(const MInt cellId) const
Returns the grid level of the cell cellId.
void resetSolver() override
Reset the solver prior to load balancing.
std::vector< std::vector< MInt > > m_azimuthalMaxLevelWindowCells
MInt m_spongeAveragingOut[s_maxNoSpongeZones]
virtual void LSReconstructCellCenter()
Dispatch the reconstruction computation to the appropiate loop.
MFloat a_dynViscosity(const MFloat T) const
std::vector< MFloat > m_dampFactor
static constexpr MInt s_maxNoSamplingVariables
std::vector< MInt > m_associatedInternalCells
virtual MFloat & vorticityAtCell(const MInt cellId, const MInt dir)
MLong c_neighborId(const MInt cellId, const MInt dir, const MBool assertNeighborState=true) const
Returns the grid neighbor id of the grid cell cellId dir.
static constexpr MInt s_computeFlowStatistics_noSamples
void computeQCriterion(MFloatScratchSpace &qCriterion)
virtual void viscousFlux_Gequ_Pv_Plenum()
Computes the viscous flux using a central difference scheme, modified version for flame plenum comput...
MInt a_noSurfaces()
Returns the number of surfaces.
std::vector< MInt > m_reconstructionCellIds
virtual void computePrimitiveVariablesCoarseGrid()
Computes the primitive variables: velocity, density, and pressure from the conservative variables and...
static constexpr MInt s_logData_ic45301_maxNoEmbeddedBodies
MFloat cv_p(MInt cellId) const noexcept
Returns the pressure computed from the conservative variables of the cell cellId.
static constexpr const MInt m_noCorners
MFloat a_cellVolume(const MInt cellId) const
Returns the cell volume of the cell from the fvcellcollector cellId.
void(FvCartesianSolverXD::* m_computeViscousFluxMultiSpecies)(MInt)
virtual void initNearBoundaryExchange(const MInt mode=0, const MInt offset=0)
Setup the near-boundary communicator needed for the flux-redistribution method.
const MInt & a_identNghbrId(MInt nghbrId) const
Return ident nghbr Id.
std::vector< MFloat > * m_STGSpongeFactor
MBool a_isPeriodic(const MInt cellId) const
Returns IsPeriodic of the cell cellId.
MFloat m_static_applyBoundaryCondition_refMass
MFloat m_static_logData_ic45301_pressurePoints[s_logData_ic45301_maxNoPressurePoints *nDim]
virtual void loadGridFlowVarsPar(const MChar *fileName)
This function loads the flow information of the cells such as variables and attributes like u_velocit...
typename maia::grid::tree::Tree< nDim >::Cell Cell
void exchangeDataAzimuthal(T *data, const MInt dataBlockSize=1)
maia::fv::cell::BitsetType::reference a_isBndryGhostCell(const MInt cellId)
Returns isBndryGhostCell of the cell cellId.
std::vector< MFloat > gravity
MInt a_associatedBodyIds(const MInt cellId, const MInt set) const
Returns the associatedBodyIds for fv-CellId cellId and set.
MFloat a_nuEffOtherPhase(const MInt cellId) const
void exchangeFloatDataAzimuthal(MFloat *data, MInt noVars, const std::vector< MInt > &rotIndices)
MFloat computeTimeStepApeDirectional(MInt cellId) const noexcept
virtual MBool adaptationTrigger()
MFloat & a_psi(const MInt cellId)
Returns psi of the cell cellId for variables varId.
std::array< MInt, 2 *s_maxNoSamplingVariables > m_samplingVariablesStatus
Status of sampling variables to check if variable is already computed and exchanged.
MFloat computeWMViscositySpalding(MInt)
void setCellDataDlb(const MInt dataId, const MFloat *const data) override
Set solver data for DLB.
MFloat m_static_computeFlowStatistics_pdfAverage[s_computeFlowStatistics_noSamples2 *s_computeFlowStatistics_noPdfs *s_computeFlowStatistics_noPdfPoints]
MFloat m_static_logData_ic45299_amplitude[s_logData_ic45299_maxNoEmbeddedBodies]
void computeSpeciesReactionRates()
Dispatches the species reaction rate computation at each cell by calling the relevant method from the...
MInt getCellIdByIndex(const MInt index)
Required for sampling, for FV the index is already the cell id.
void setAndAllocateCombustionGequPvProperties()
reads in the combustion properties
MInt m_noSpongeBndryCndIds
number of sponge boundary IDs
void setMultilevelSecondary(const MBool state=true)
MInt a_splitChildId(const MInt sc, const MInt ssc)
MFloat a_flameSpeed(const MInt cellId, const MInt set) const
Returns the flamespeed-value for fv-CellId cellId and set.
MInt & a_noLevelSetFieldData()
Returns the noSets for fv-CellId cellId and set.
void viscousFluxCompact_(F &viscousFluxFct)
Computes the viscous fluxes using a compact stencil with increased stability for flows with dominatin...
MFloat & a_levelSetFunction(const MInt cellId, const MInt set)
Returns the levelSet-value for fv-CellId cellId and set.
void getSolverTimings(std::vector< std::pair< MString, MFloat > > &solverTimings, const MBool allTimings) override
Get solver timings.
void resizeGridMap() override
Swap the given cells.
virtual void determineLESAverageCells()
MFloat m_static_applyBoundaryCondition_EVelL2
Collector< FvBndryCell< nDim, SysEqn > > * m_bndryCells
virtual void calcSamplingVariables(const std::vector< MInt > &varIds, const MBool exchange) override
Calculate sampling variables.
FvBndryCndXD< nDim_, SysEqn > * m_fvBndryCnd
MBool requiresTimeStepUpdate() const
Returns true if the time-step should be updated on this step.
virtual void nonReflectingBCAfterTreatmentCutOff()
std::vector< MInt > m_reconstructionNghbrIds
const MInt & a_maxLevelHaloCells(MInt domain, MInt id) const
Return max level halo cells.
static constexpr MInt s_computeFlowStatistics_noSamples3
void setAndAllocateSpongeLayerProperties()
Reads and initializes properties associated with sponge boundary conditions.
MInt cellDataSizeDlb(const MInt dataId, const MInt gridCellId) override
Return data size to be communicated during DLB for a grid cell and given data id.
virtual MInt getAdjacentLeafCells_d2_c(const MInt, const MInt, MIntScratchSpace &, MIntScratchSpace &)
virtual void applyExternalOldSource()
void computeConservativeVariablesMultiSpecies_(const MUint)
MFloat reduceData(const MInt cellId, MFloat *data, const MInt dataBlockSize=1, const MBool average=true)
determines the value of 'data' in the given cell by recusively volumetric averaging among all its off...
void deleteSrfcs()
Deletes all surfaces existing.
virtual void advanceExternalSource()
static constexpr MInt s_logData_ic45301_maxNoPressurePoints
void balance(const MInt *const noCellsToReceiveByDomain, const MInt *const noCellsToSendByDomain, const MInt *const targetDomainsByCell, const MInt oldNoCells) override
Balance the solver.
MLong c_childId(const MInt cellId, const MInt pos) const
Returns the grid child id of the grid cell cellId at position pos.
void setMeanMolarWeight_PV(MInt cellId)
const MChar ** m_vorticityName
FvCartesianSolverXD()=delete
std::vector< std::vector< MInt > > m_azimuthalRemappedWindowCells
MFloat & a_rightHandSide(const MInt cellId, MInt const varId)
Returns the right hand side of the cell cellId for the variable varId.
const MInt & a_noPart(MInt cellId) const
Return no particles.
MFloat a_coordinate(const MInt cellId, const MInt dir) const
Returns the coordinate of the cell from the fvcellcollector cellId for dimension dir.
void computeConservativeVariablesCoarseGrid()
Computes the primitive variables: velocity, density, and pressure from the conservative variables and...
MFloat & a_curvatureG(const MInt cellId, const MInt set)
Returns the curvature-value for fv-CellId cellId and set.
void getGlobalSolverVars(std::vector< MFloat > &globalFloatVars, std::vector< MInt > &globalIdVars) override
Get/set global solver variables during DLB.
MFloat & a_speciesReactionRate(const MInt cellId, const MInt speciesIndex)
virtual void smallCellRHSCorrection(const MInt timerId=-1)
void writeRestartFile(MBool) override
Geom & geometry()
Access the solver's geometry (non-const version)
MFloat & a_uOtherPhase(const MInt cellId, const MInt dir)
void reInitActiveCellIdsMemory()
Allocate memory to arrays according to the current number of cells.
struct FvCartesianSolverXD::@8 m_EEGas
std::vector< MInt > findWallNormalNeighbors(MInt pointId)
MFloat computeWMViscositySpalding3D(MInt)
ATTRIBUTES2(ATTRIBUTE_ALWAYS_INLINE, ATTRIBUTE_HOT) inline void computeSurfaceValues_(const MUint)
virtual void updateJet()
jet volume forcing jet volume forcing with vortex rings. Velocity profile and forcing ref: "Effects o...
virtual void writeListOfActiveFlowCells()
MPI_Request * m_mpi_receiveRequest
virtual void updateMaterialNo()
void rotateVectorAzimuthal(MInt side, MFloat *data, MInt noData, const std::vector< MInt > &indices)
void sensorEntropyQuot(std::vector< std::vector< MFloat > > &sensors, std::vector< std::bitset< 64 > > &sensorCellFlag, std::vector< MFloat > &sensorWeight, MInt sensorOffset, MInt sen) override
MFloat a_surfaceArea(const MInt srfcId) const
Returns the area of surface srfcId.
std::vector< MFloat > m_normalSamplingCoords
MFloat c_cellLengthAtCell(const MInt cellId) const
Returns the length of the cell for level.
typename SysEqn::PrimitiveVariables PrimitiveVariables
MFloat c_cellLengthAtLevel(const MInt level) const
Returns the length of the cell for level.
MInt m_timeStepComputationInterval
How often should the time-step be recomputed?
ATTRIBUTES2(ATTRIBUTE_HOT, ATTRIBUTE_FLATTEN) virtual void computeSurfaceValuesLimited(MInt timerId
const MInt & a_bndryCndId(MInt bndryId) const
Return BndryCndId.
void setAndAllocateJetProperties()
reads in the jet properties
std::vector< MFloat > m_azimuthalRecConsts
void resetExternalSources()
Reset external sources.
MFloat & a_rhoInfinity()
Return rho infinity.
virtual void setConservativeVariables(MInt cellId)
computes conservative from primitive variables for given cell id
MFloat & a_slope(const MInt cellId, MInt const varId, const MInt dir) override
Returns the slope of the cell cellId for the variable varId in direction dir.
std::shared_ptr< Cantera::Transport > m_canteraTransport
MFloat a_speciesReactionRate(const MInt cellId, const MInt speciesIndex) const
void LSReconstructCellCenterCons(const MUint noSpecies)
MFloat a_curvatureG(const MInt cellId, const MInt set) const
Returns the curvature-value for fv-CellId cellId and set.
MInt noCellDataDlb() const override
Methods to inquire solver data information.
virtual void copyRHSIntoGhostCells()
maia::fv::cell::BitsetType::reference a_isSandpaperTripCell(const MInt cellId)
Returns isWMImgCell of the cell cellId.
virtual void setAdditionalActiveFlag(MIntScratchSpace &)
virtual MInt getAdjacentLeafCells_d0_c(const MInt, const MInt, MIntScratchSpace &, MIntScratchSpace &)
MInt & a_spongeBndryId(const MInt cellId, const MInt dir)
Returns the spongeBndryId of the cell cellId for direction dir.
MInt a_noSplitChilds(const MInt sc) const
void tripForceCoefficients(MFloat *, MFloat *, MFloat *, MInt, MInt)
MFloat & a_time()
Return time.
virtual void computeSurfaceValuesLOCD(MInt timerId=-1)
ATTRIBUTES2(ATTRIBUTE_HOT, ATTRIBUTE_ALWAYS_INLINE) inline void computePrimitiveVariables_()
const MFloat & a_time() const
Return time.
virtual void updateSplitParentVariables()
std::vector< MInt > m_cellInterpolationIndex
const MFloat & a_Ma() const
Returns the Mach number of the solver.
virtual MFloat getBoundaryHeatFlux(const MInt cellId) const
calculates heat flux of boundary cells
virtual void computeSurfaceValuesLimitedSlopes(MInt timerId=-1)
const MFloat & a_PInfinity() const
Return p infinity.
std::vector< MString > m_speciesName
void getInterpolatedVariablesInCell(const MInt cellId, const MFloat *position, MFloat *vars)
calculates interpolated variables for a given position in a given cell
MInt setUpBndryInterpolationStencil(const MInt, MInt *, const MFloat *)
void removeCell(const MInt) override
Remove the given cell.
MFloat m_static_computeFlowStatistics_jointPdfAverage[s_computeFlowStatistics_noSamples2 *s_computeFlowStatistics_noJointPdfs *s_computeFlowStatistics_noPdfPoints *s_computeFlowStatistics_noPdfPoints]
void getDefaultWeights(MFloat *weights, std::vector< MString > &names) const
Return the default weights for all load quantities.
void getInterpolatedVariables(const MInt cellId, const MFloat *position, MFloat *vars) override
calculates interpolated variables for a given position in a given cell
MFloat & a_oldVariable(const MInt cellId, const MInt varId)
Returns oldVariablesv of the cell cellId variables varId.
MBool a_isSandpaperTripCell(const MInt cellId) const
Returns isWMImgCell of the cell cellId.
MInt m_secondSpongeDirectionsOut[s_maxNoSpongeZones]
FvSurfaceCollector m_surfaces
virtual void computeReconstructionConstants()
void computeMeanMolarWeights_PV()
Dispatches the mean molar weight computation at the cell center from the primitive variables by calli...
MFloat a_tau(const MInt cellId, const MInt varId) const
Returns the tau of the cell cellId for variable varId.
std::vector< MInt > m_rotIndVarsCV
void findNeighborHood(MInt cellId, MInt layer, std::vector< MInt > &nghbrList)
Obtain list of neighbors for the given extend.
std::vector< MFloat > m_wallSetupOrigin
MInt & a_maxLevelWindowCells(MInt domain, MInt id)
Return max level window cells.
MFloat & a_avariable(const MInt cellId, const MInt varId)
Returns additional variable v of the cell cellId for variables varId.
void a_copyPropertiesSolver(const MInt fromCellId, const MInt toCellId)
Returns property p of the cell cellId.
void setAndAllocateAdaptationProperties()
This function reads the properties required for adaptive mesh refinement.
void initAzimuthalReconstruction()
const MFloat & a_externalSource(MInt cellId, MInt var) const
Return external source.
std::vector< std::vector< MInt > > m_wmImgCellIds
MFloat & a_surfaceVariable(const MInt srfcId, const MInt dir, const MInt varId)
Returns the variable varId of surface srfcId in direction dir.
MInt m_spongeDirectionsOut[s_maxNoSpongeZones]
void resetSponge()
reset sponge properties
std::vector< MFloatTensor > m_interpolationMatrices
std::vector< MFloat > * m_LESVarAverageBal
MFloat & a_externalSource(MInt cellId, MInt var)
Return external source.
MBool hasRestartTimeStep() const override
std::map< MInt, MInt > m_splitChildToSplitCell
MFloat a_spongeFactorStart(const MInt cellId) const
Returns the spongeFactorStart of the cell cellId.
MInt & a_surfaceOrientation(const MInt srfcId)
Returns the orientation of surface srfcId.
std::vector< MFloat > m_azimuthalCutRecCoord
MBool a_isInterface(const MInt cellId) const
Returns isInterface of the cell cellId.
virtual void cutOffBoundaryCondition()
virtual void resetRHSNonInternalCells()
MPI_Request m_timeStepReq
Request for reducing the time-step using non-blocking comm.
MInt noSolverTimers(const MBool allTimings) override
MBool a_isBndryCell(const MInt cellId) const override
Returns isBndryCell of the cell cellId.
std::vector< MFloat > m_wallNormalVectors
maia::fv::collector::FvCellCollector< nDim > m_cells
Collector for FV cells.
MBool m_timeStepConverged
Convergence status of the current time step.
void checkGhostCellIntegrity()
Checks whether cells' isGhost and the boundary Id coincede. Cells' isGhost is is used to tell the gri...
MFloat m_static_computeFlowStatistics_bodyCntAvg[s_computeFlowStatistics_noSamples *s_computeFlowStatistics_noReClasses]
void saveSolverSolution(const MBool forceOutput=false, const MBool finalTimeStep=false) override
Manages solver-specific output.
MFloat m_static_applyBoundaryCondition_ERhoL1
const MFloat & a_timeRef() const
Return time reference value.
void finalizeAdaptation() override
void swapCells(const MInt, const MInt) override
void linearInterpolation(MInt, MInt, MInt *)
std::vector< MInt > m_gapCellId
virtual void initInterpolationForCell(const MInt cellId)
Init the interpolation for points inside a given cell (based on interpolateVariables())
std::vector< MFloat > * m_RANSValues
SysEqn::PrimitiveVariables * PV
virtual void resetBoundaryCells(const MInt offset=0)
MFloat m_static_applyBoundaryCondition_oldVol2
void loadRestartTime(const MChar *fileName, MInt &globalTimeStepInput, MFloat &timeInput, MFloat &physicalTimeInput)
This function loads the flow information of the cells such as variables and attributes like u_velocit...
void extendStencil(const MInt)
extend the reconstruction sencil towards all diagonal cells on the first layer
MInt m_static_logData_ic45301_containingCellIds[s_logData_ic45301_maxNoPressurePoints]
MFloat & a_PInfinity()
Return p infinity.
MFloat m_static_computeFlowStatistics_thetaDensityAverage[s_computeFlowStatistics_noSamples *s_computeFlowStatistics_thetaSize *s_computeFlowStatistics_noDat]
MInt cellDataTypeDlb(const MInt dataId) const override
MFloat & a_surfaceCoefficient(const MInt srfcId, const MInt dimCoefficient)
Returns the coefficient dimCoefficient of surface srfcId.
MFloat a_oldVariable(const MInt cellId, const MInt varId) const
Returns oldVariables v of the cell cellId variables varId.
virtual void resetSolverFull()
MBool a_isHalo(const MInt cellId) const
Returns IsHalo of the cell cellId.
MBool m_static_constructGFieldPredictor_adaptiveGravity
MBool useTimeStepFromRestartFile() const
Returns true if the time-step from a restart file should be reused.
virtual MInt getAdjacentLeafCells_d2(const MInt, const MInt, MIntScratchSpace &, MIntScratchSpace &)
void prepareAdaptation() override
void bandRefinementSensorDerivative(std::vector< std::vector< MFloat > > &sensors, std::vector< std::bitset< 64 > > &sensorCellFlag, MInt sensorOffset, MInt sen, const std::vector< MFloat > &tau, const MFloat sensorThreshold)
MFloat m_static_applyBoundaryCondition_EVelL1
maia::fv::cell::BitsetType & a_properties(const MInt cellId)
Returns properties of the cell cellId.
void calculateHeatRelease()
calculates heatRelease, currently used for postprocessing (average_in)
void setAndAllocateZonalProperties()
std::array< MFloat, nDim_+2 > computeSpongeDeltas(MInt cellId, std::array< MFloat, 6 >)
void setCombustionGequPvVariables()
reads in the combustion properties
std::vector< MInt > m_wallSetupOriginSide
MInt m_spongeAveragingIn[s_maxNoSpongeZones]
void exchangeAzimuthalRemappedHaloCells()
void loadSampleVariables(MInt timeStep)
load variables for the specified timeStep
void assertDeleteNeighbor(const MInt cellId, const MInt dir) const
Checks wether the cell cellId has a valid neighbor in direction dir.
MFloat time() const override
returns the time
static constexpr MInt s_maxNoEmbeddedBodies
MFloat crankAngle(const MFloat, const MInt)
help-function for engine calculations which returns the crank-angle for a given time mode = 0: return...
const Geom & geometry() const
the references to CartesianGrid data members end here
MBool forceAdaptation() override
MFloat a_spongeFactor(const MInt cellId) const
Returns the spongeFactor of the cell cellId.
void setSamplingProperties()
Reads properties associated with variable sampling.
std::set< MInt > m_vtuGeometryOutput
void setMultilevelPrimary(const MBool state=true)
Designates solver as primary solver in multilevel computation.
const MFloat & a_bndryNormal(MInt bndryId, MInt dir) const
Return normal direction of bndry srfc.
MFloat m_static_smallCellCorrection_slipCoordinate
MInt & a_identNghbrId(MInt nghbrId)
Return ident nghbr Id.
MFloat m_static_applyBoundaryCondition_oldMass
MFloat & a_surfaceArea(const MInt srfcId)
Returns the area of surface srfcId.
std::vector< MFloat > * m_LESValues
std::vector< MInt > m_averageDir
std::vector< MInt > m_maxLvlMpiSendNeighbor
void buildLeastSquaresStencilSimple()
Determine the least squares stencil.
void bilinearInterpolation(MInt, MInt, MInt *)
MBool a_isInactive(const MInt cellId) const
void computeGamma()
Dispatches the gamma computation at each cell by calling the relevant function from the detChemSysEqn...
std::shared_ptr< Cantera::Kinetics > m_canteraKinetics
MFloat a_surfaceCoefficient(const MInt srfcId, const MInt dimCoefficient) const
Returns the coefficient dimCoefficient of surface srfcId.
MFloat & a_tau(const MInt cellId, const MInt varId)
Returns the tau of the cell cellId for variable varId.
MInt a_cutCellLevel(const MInt cellId) const
Returns the level for cutCells, this can either be the maxRefinementLevel or the level of the current...
maia::fv::cell::BitsetType::reference a_isGapCell(const MInt cellId)
Returns isGapCell of the cell cellId.
std::vector< MFloat > m_tripCoords
MBool m_isMultilevelPrimary
Stores whether this solver is the primary solver (i.e., it has the finshest mesh) of a multilevel com...
SysEqn::FluxVariables * FV
MFloat a_rightHandSide(const MInt cellId, MInt const varId) const
Returns the right hand side of the cell cellId for the variable varId.
MInt m_static_computeFlowStatistics_currentIndex
static constexpr MInt s_computeFlowStatistics_noAngles
maia::fv::cell::BitsetType::reference a_isWindow(const MInt cellId)
Returns IsWindow of the cell cellId.
void writeCutCellsToGridFile()
Writes cut cell information to an existing grid file in order to visualize it in ParaView.
MFloat & a_variable(const MInt cellId, const MInt varId)
Returns conservative variable v of the cell cellId for variables varId.
std::vector< std::vector< MInt > > m_neighborPointIds
maia::fv::cell::BitsetType::reference a_isPeriodic(const MInt cellId)
Returns IsPeriodic of the cell cellId.
MFloat a_levelSetFunction(const MInt cellId, const MInt set) const
Returns the levelSet-value for fv-CellId cellId and set.
static constexpr MInt s_computeFlowStatistics_noDat
std::array< MFloat, 6 > computeTargetValues()
constexpr MBool isMultilevelLowestSecondary() const
void a_resetPropertiesSolver(const MInt cellId)
Returns property p of the cell cellId.
virtual void viscousFlux_Gequ_Pv()
Computes the viscous flux using a central difference scheme.
MInt a_level(const MInt cellId) const
Returns the level of the cell from the fvcellcollector cellId.
void setMeanMolarWeight_CV(MInt cellId)
Computes the mean molar weight at the given cell ID from the primitive variables. The mean molar weig...
std::vector< FvGapCell > m_gapCells
virtual void getDimensionalizationParams(std::vector< std::pair< MFloat, MString > > &dimParams) const
get dimensionalization parameters
void assertValidGridCellId(const MInt cellId) const
Cecks wether the cell cellId is an actual grid-cell.
MInt noInternalCells() const override
Return the number of internal cells within this solver.
MLong c_parentId(const MInt cellId) const
Returns the grid parent id of the cell cellId.
std::map< MInt, std::vector< MInt > > m_cellToNghbrHood
const MFloat & a_bndryCutCoord(MInt bndryId, MInt i, MInt j) const
Return cut coordinates of bndry srfc.
std::shared_ptr< Cantera::ThermoPhase > m_canteraThermo
Collector< CartesianGridPoint< nDim > > * m_gridPoints
std::vector< std::vector< MInt > > m_wmImgWMSrfcIds
MInt a_reconstructionNeighborId(const MInt cellId, const MInt nghbrNo) const
Returns reconstruction neighbor n of the cell cellId.
void viscousFluxMultiSpecies_()
void computeUTau(MFloat *data, MInt cellId)
MFloat m_static_logData_ic45299_freqFactor[s_logData_ic45299_maxNoEmbeddedBodies]
static constexpr MInt s_maxNoSpongeZones
std::vector< std::vector< MInt > > m_azimuthalMaxLevelHaloCells
MBool postSolutionStep() override
MFloat & a_levelSetValuesMb(const MInt cellId, const MInt set)
Returns the levelSetMb-value for fv-CellId cellId and set.
void setInputOutputProperties()
Reads properties and initializes variables associated with input/output.
void reInitSmallCellIdsMemory()
Reallocate memory to small and master cell id arrays according to the current number of cells.
MBool prepareRestart(MBool, MBool &) override
Prepare the solvers for a grid-restart.
std::vector< MInt > m_LESAverageCells
SysEqn::ConservativeVariables * CV
void send(const MBool exchangeAll=false)
Send window cell data to corresponding neighbors.
std::vector< MFloat > gravityRefCoords
void saveDebugRestartFile()
Saves the solver restart file and the grid restartFile NOTE: for debugging purposes only!...
void(FvCartesianSolverXD::* m_computeViscousFlux)()
typename CartesianSolver::GridProxy GridProxy
MFloat * m_secondaryReferenceComposition
virtual void initSolutionStep(MInt)
Initializes the solver.
static constexpr MInt s_computeFlowStatistics_noPdfs
virtual void correctBoundarySurfaces_()
virtual void saveRestartFile(const MBool)
std::vector< MFloat > * m_curvatureG
MFloat & a_restrictedRHS(const MInt cellId, const MInt varId)
Returns the restrictedRHS of the cell cellId for variable varId.
MFloat a_localTimeStep(const MInt cellId) const
Returns the local time-step of the cell cellId.
MBool a_hasProperty(const MInt cellId, const SolverCell p) const
Returns solver cell property p of the cell cellId.
MFloat computeTimeStep(MInt cellId) const noexcept
void finalizeBalance() override
Reinitialize solver after all data structures have been recreated.
void sensorVorticity(std::vector< std::vector< MFloat > > &sensors, std::vector< std::bitset< 64 > > &sensorCellFlag, std::vector< MFloat > &sensorWeight, MInt sensorOffset, MInt sen) override
const MFloat & a_physicalTime() const
Return physical time.
const MInt & a_maxLevelWindowCells(MInt domain, MInt id) const
Return max level window cells.
static constexpr MInt s_computeFlowStatistics_noSamples2
MFloat & a_surfaceCoordinate(const MInt srfcId, const MInt dir)
Returns the coordinate of surface srfcId in direction dir.
MFloat & a_nuTOtherPhase(const MInt cellId)
void computeDomainAndSpongeDimensions()
Extracts the minimum and maximum coordinates of all cells in the grid.
void setRungeKuttaProperties()
This function reads the properties required for Runge Kutta time stepping.
virtual void initializeRungeKutta()
Reads the Runge-Kutta properties and initializes the variables required for Runge Kutta time stepping...
void finalizeMpiExchange()
Finalize non-blocking MPI communication (cancel open requests, free all requests)
std::vector< std::vector< MInt > > m_saSrfcProbeSrfcs
void startMpiExchange()
Begin non-blocking communication by posting new send requests.
static constexpr MBool hasSC
MBool a_isGapCell(const MInt cellId) const
Returns isGapCell of the cell cellId.
ATTRIBUTES2(ATTRIBUTE_ALWAYS_INLINE, ATTRIBUTE_HOT) inline void LSReconstructCellCenter_(const MUint noSpecies)
MFloat a_surfaceflux(const MInt srfcId, const MInt fVarId) const
Returns the flux fVarId for surface srfcId.
void saveGridFlowVarsPar(const MChar *fileName, MInt noTotalCells, MLong noInternalCells, MFloatScratchSpace &variables, std::vector< MString > &dbVariablesName, MInt, MIntScratchSpace &idVariables, std::vector< MString > &idVariablesName, MInt, MFloatScratchSpace &dbParameters, std::vector< MString > &dbParametersName, MIntScratchSpace &idParameters, std::vector< MString > &idParametersName, const MInt *recalcIds)
This function stores the massivley parallel flow information of the cells.
std::vector< std::pair< MFloat, MFloat > > m_globalSpongeLocations
FvCartesianSolverXD(MInt, MInt, const MBool *, maia::grid::Proxy< nDim_ > &gridProxy_, Geometry< nDim_ > &geometry_, const MPI_Comm comm)
virtual MBool maxResidual(MInt mode=0)
Computes the global root-mean-square residual. The residual is defined as time derivative of conserva...
MFloat & a_physicalTime()
Return physical time.
virtual void Ausm()
Dispatches the AUSM flux computation for different number of species.
MBool cellOutside(const MInt)
void setNumericalProperties()
Reads and initializes properties associated with the numerical method.
MInt & a_associatedBodyIds(const MInt cellId, const MInt set)
Returns the associatedBodyIds for fv-CellId cellId and set.
void computeGridCellCoordinates(MFloat *)
computes the coordinates of the grid cell centers and stores them into a one-dimensional array
MFloat a_surfaceCoordinate(const MInt srfcId, const MInt dir) const
Returns the coordinate of surface srfcId in direction dir.
MFloat & a_surfaceUpwindCoefficient(const MInt srfcId)
Returns the upwind coefficient of surface srfcId.
MInt a_noCells() const
Returns the number of cells.
MFloat & a_TInfinity()
Return T infinity.
MBool m_multilevel
Stores whether this solver is part of a multilevel computation.
void computeVorticity2D(MFloat *const vorticity)
MBool m_isInitSamplingVars
Indicator if sampling variables are initialized.
MInt & a_maxLevelHaloCells(MInt domain, MInt id)
Return max level halo cells.
std::vector< FvWMSurface< nDim > > m_wmSurfaces
void computeVorticity3D(MFloat *const vorticity)
void createBoundaryCells()
identifies bndry cells (Sets a_isInterface for the solver!)
std::vector< MInt > m_wmSurfaceProbeIds
MFloat & a_VVInfinity(MInt dir)
Return mean flow velocity.
MFloat & a_gradUOtherPhase(const MInt cellId, const MInt uDir, const MInt gradDir)
MFloat & a_surfaceFlux(const MInt srfcId, const MInt fVarId)
Returns the flux fVarId for surface srfcId.
MFloat setAndAllocateSpongeDomainProperties(MFloat)
reads in the sponge properties for the domain boundaries
void getSampleVariables(MInt cellId, const MFloat *&vars)
read only access to primitive variables of a single cell
virtual void filterConservativeVariablesAtFineToCoarseGridInterfaces()
static constexpr MInt s_computeFlowStatistics_noReClasses
std::vector< MInt > * m_spongeAverageCellId
std::set< MInt > m_cutOffInterface
MBool a_isBndryGhostCell(const MInt cellId) const
Returns isBndryGhostCell of the cell cellId.
MPI_Request * m_mpi_sendRequest
void initAzimuthalMaxLevelExchange()
void setConservativeVarsOnAzimuthalRecCells()
void sensorInterfaceLs(std::vector< std::vector< MFloat > > &sensors, std::vector< std::bitset< 64 > > &sensorCellFlag, std::vector< MFloat > &sensorWeight, MInt sensorOffset, MInt sen)
MFloat & a_alphaGas(const MInt cellId)
virtual void correctMasterCells()
adds the right hand side of small cells to their corresponding master cells and sets the small cell R...
MFloat & a_surfaceDeltaX(const MInt srfcId, const MInt varId)
Returns the delta X of surface srfcId for variable varId.
MInt getAdjacentLeafCells(const MInt, const MInt, MIntScratchSpace &, MIntScratchSpace &)
retrieves the first 'noLayers' layers of direct and(or diagonal neighbors to the given cell
void fillExcBufferAzimuthal(MInt cellId, MInt offset, MFloat *dataDest, MFloat *dataSrc, MInt noData, const std::vector< MInt > &rotIndex=std::vector< MInt >())
MFloat & a_dt1Variable(const MInt cellId, const MInt varId)
Returns dt1Variables of the cell CellId variables varId.
std::map< MInt, std::vector< MFloat > > m_vapourData
const MFloat & a_TInfinity() const
Return T infinity.
MInt m_secondSpongeDirectionsIn[s_maxNoSpongeZones]
std::vector< MInt > m_wallNormalPointDomains
MInt a_noSets() const
Returns the noSets for fv-CellId cellId and set.
static constexpr MInt nDim
MBool calcSlopesAfterStep()
Return if slopes should be calculated at after each step (not before)
MBool a_isSplitCell(const MInt cellId) const
std::vector< std::vector< MInt > > m_azimuthalRemappedHaloCells
MFloat * m_reconstructionConstantsPeriodic
void computeForceCoefficients(MFloat *)
MBool a_hasProperty(const MInt cellId, const Cell p) const
Returns grid cell property p of the cell cellId.
void azimuthalNearBoundaryReverseExchange()
MInt a_reconstructionNeighborId(const MInt cellId) const
Returns reconstruction data offset i of the cell cellId.
MFloat cv_a(MInt cellId) const noexcept
Returns the speed-of-sound computed from the conservative variables of the cell cellId.
virtual MInt getAdjacentLeafCells_d1_c(const MInt, const MInt, MIntScratchSpace &, MIntScratchSpace &)
std::set< MInt > m_splitSurfaces
MInt a_spongeBndryId(const MInt cellId, const MInt dir) const
Returns the spongeBndryId of the cell cellId for direction dir.
MFloat & a_surfaceFactor(const MInt srfcId, const MInt varId)
Returns the factor of surface srfcId for variable varId.
virtual void Muscl(MInt=-1)
Reconstructs the flux on the surfaces.
void sensorInterface(std::vector< std::vector< MFloat > > &sensors, std::vector< std::bitset< 64 > > &sensorCellFlag, std::vector< MFloat > &sensorWeight, MInt sensorOffset, MInt sen) override
virtual void convertPrimitiveRestartVariables()
converts the primitive restart variables to a new Mach Number
MFloat a_reactionRateBackup(const MInt cellId, const MInt reactionId) const
Returns the reactionRateBackup of the cell cellId for variables varId.
virtual void getSolverSamplingProperties(std::vector< MInt > &samplingVars, std::vector< MInt > &noSamplingVars, std::vector< std::vector< MString > > &samplingVarNames, const MString featureName="") override
Read sampling related properties.
void assertValidGridCellId(const MInt NotUsed(cellId)) const
MFloat a_FcellVolume(const MInt cellId) const
Returns the inverse cell volume of the cell from the fvcellcollector cellId.
void bilinearInterpolationAtBnd(MInt, MInt, MInt *)
MFloat & a_bndryNormal(MInt bndryId, MInt dir)
Return normal direction of bndry srfc.
MFloat a_alphaGas(const MInt cellId) const
std::vector< MFloat > m_averagePos
MFloat & a_dt2Variable(const MInt cellId, const MInt varId)
Returns dt2Variables of the cell CellId variables varId.
MFloat a_levelSetValuesMb(const MInt cellId, const MInt set) const
Returns the levelSetMb-value for fv-CellId cellId and set.
static constexpr MFloat m_volumeThreshold
void scatter()
Scatter received data of all neighbors to the corresponding halo cells.
std::vector< std::vector< MInt > > m_azimuthalMaxLevelWindowMap
virtual void initSolverSamplingVariables(const std::vector< MInt > &varIds, const std::vector< MInt > &noSamplingVars) override
Initialize sampling variables/allocate memory.
void sensorCutOff(std::vector< std::vector< MFloat > > &sensors, std::vector< std::bitset< 64 > > &sensorCellFlag, std::vector< MFloat > &sensorWeight, MInt sensorOffset, MInt sen)
void allocateAndInitSolverMemory()
Allocates the resources of the FV solver. Mostly arrays of size maxNoCells used in the main part of t...
void interpolateVariablesInCell(const MInt cellId, const MFloat *position, std::function< MFloat(MInt, MInt)> variables, MFloat *result)
Interpolate the given variable field inside a cell at a given position (based on interpolateVariables...
maia::fv::cell::BitsetType::reference a_hasProperty(const MInt cellId, const SolverCell p)
Returns solver cell property p of the cell cellId.
constexpr MBool isZonal() const
void swapProxy(const MInt, const MInt) override
MBool c_isToDelete(const MInt cellId) const
Returns the delete of the cell cellId.
std::vector< MFloat > gasSourceBox
MFloat & a_localTimeStep(const MInt cellId)
Returns the local time-step of the cell cellId.
MFloat a_storedSlope(const MInt cellId, MInt const varId, const MInt dir) const
Returns the stored slope of the cell cellId for the variable varId in direction dir.
std::vector< MInt > m_normalSamplingSide
void setAndAllocateDetailedChemistryProperties()
void azimuthalNearBoundaryExchange()
void interpolateAzimuthalDataReverse(MFloat *data, MInt offset, MInt noVars, const MFloat *vars)
void sensorPatch(std::vector< std::vector< MFloat > > &sensors, std::vector< std::bitset< 64 > > &sensorCellFlag, std::vector< MFloat > &sensorWeight, MInt sensorOffset, MInt sen) override
ATTRIBUTES2(ATTRIBUTE_HOT, ATTRIBUTE_ALWAYS_INLINE) inline MBool uDLimiter(const MFloat *const
MFloat & a_restrictedVar(const MInt cellId, const MInt varId)
Returns restricted variables of cell cellId for variable varId on level level.
void compute1DFlameSolution()
maia::fv::cell::BitsetType::reference a_isHalo(const MInt cellId)
Returns IsHalo of the cell cellId.
MBool m_timeStepNonBlocking
Reduce the timeStep using non-blocking communication;.
static constexpr const MInt m_noDirs
void setSensors(std::vector< std::vector< MFloat > > &sensors, std::vector< MFloat > &sensorWeight, std::vector< std::bitset< 64 > > &sensorCellFlag, std::vector< MInt > &sensorSolverId) override
set the sensors for the adaptation (i.e. which cell should be refined/removed?)
MFloat m_static_computeFlowStatistics_sdatAverage2[s_computeFlowStatistics_noSamples *s_computeFlowStatistics_noAngles *s_computeFlowStatistics_noAngleDat]
static constexpr MInt s_computeFlowStatistics_noSamples4
void setTestcaseProperties()
Reads and initializes properties associated with the physics of the simulation and allocates small ar...
MFloat m_static_computeFlowStatistics_pdfAverage2[s_computeFlowStatistics_noSamples2 *s_computeFlowStatistics_noPdfs *s_computeFlowStatistics_noPdfPoints]
MFloat m_static_computeFlowStatistics_thetaDensityAverage2[s_computeFlowStatistics_noSamples *s_computeFlowStatistics_thetaSize *s_computeFlowStatistics_noDat]
MInt getIdAtPoint(const MFloat *point, MBool NotUsed(globalUnique=false))
Return the leaf cell id containing the given point.
MFloat m_static_applyBoundaryCondition_EVelLoo
virtual void initializeMaxLevelExchange()
parallel: Store all necessary data in send buffer
MFloat cv_T(MInt cellId) const noexcept
Returns the temperature computed from the conservative variables of the cell cellId.
virtual void smallCellCorrection(const MInt timerId=-1)
Flux-redistribution method Apply a stable correction to small-cells and redistribute the defective fl...
MInt determineRestartTimeStep() const override
Determine the restart time step from the restart file (for useNonSpecifiedRestartFile = true)
void computeReconstructionConstantsSVD()
Compute the reconstruction constants using a weighted least squares approached solved via singular va...
MBool m_timeStepVolumeWeighted
Should the time-step in the boundary cells be weighted by their volume?
MFloat a_reactionRate(const MInt cellId, const MInt reactionId) const
Returns the reactionRate of the cell cellId for variables varId.
ATTRIBUTES2(ATTRIBUTE_HOT, ATTRIBUTE_FLATTEN) virtual void computeSurfaceValues(MInt timerId
SysEqn::SurfaceCoefficients * SC
MInt a_surfaceOrientation(const MInt srfcId) const
Returns the orientation of surface srfcId.
void sensorInterfaceLsMb(std::vector< std::vector< MFloat > > &sensors, std::vector< std::bitset< 64 > > &sensorCellFlag, std::vector< MFloat > &sensorWeight, MInt sensorOffset, MInt sen)
void exchangeGapInfo()
exchanges the Gap-Information with the solver-own communicators!
virtual void resetImplicitCoefficients()
virtual void writeVtkXmlFiles(const MString, const MString, MBool, MBool)
void preTimeStep() override
void interpolateVariables(const MInt cellId, const MFloat *position, MFloat *result)
calculates interpolated variables (in the range a, b) for a given position in a given cell
void limitWeights(MFloat *) override
Limit Weight types to avoid large memory disbalance between ranks for DLB.
void correctMajorSpeciesMassFraction()
Corrects the mass fraction of the predominant species to ensure conservation due to numerical or appr...
void preSolutionStep(MInt) override
static constexpr MInt s_computeFlowStatistics_thetaSize
std::vector< MInt > m_wallNormalPointCellIDs
void interpolateAzimuthalData(MFloat *data, MInt offset, MInt noVars, const MFloat *vars)
MInt & a_noSets()
Returns the noSets for fv-CellId cellId and set.
MFloat & a_storedSlope(const MInt cellId, MInt const varId, const MInt dir)
Returns the stored slope of the cell cellId for the variable varId in direction dir.
MFloat & a_spongeFactorStart(const MInt cellId)
Returns the spongeFactorStart of the cell cellId.
void refineCell(const MInt) override
MInt & a_noPart(MInt cellId)
Return no particles.
void computeSamplingTimeStep_()
computes the time step according to the sample variables
void getPrimitiveVariables(MInt, MFloat *, MFloat *, MInt)
void initSolver() override
Initializes the fv-solver.
MFloat a_implicitCoefficient(const MInt cellId, const MInt coefId) const
Returns the implicitCoefficient of cell cellId for coefficient coefId.
MInt c_noChildren(const MInt cellId) const
Returns the number of children of the cell cellId.
MFloat a_surfaceVariable(const MInt srfcId, const MInt dir, const MInt varId) const
Returns the variable varId of surface srfcId in direction dir.
void finishMpiExchange()
Finish non-blocking communication by waiting for receive requests.
MBool m_static_updateSpongeLayer_mbSpongeLayer
void gather()
Gather data of all window cells for all neighbors in the send buffers.
void initAzimuthalCartesianHaloInterpolation()
MFloat c_coordinate(const MInt cellId, const MInt dir) const
Returns the coordinate of the cell from the grid().tree() cellId for dimension dir.
std::map< std::string, MInt > speciesMap
Geometry< nDim > * m_geometry
void forceTimeStep(const MFloat dt)
Force time step externally.
std::vector< MFloat > m_spongeLocations
MFloat a_gradUOtherPhase(const MInt cellId, const MInt uDir, const MInt gradDir) const
void lhsBnd()
Apply lhsBnd.
MInt & a_reconstructionData(const MInt cellId)
Returns reconstruction data offset i of the cell cellId.
void sensorDerivative(std::vector< std::vector< MFloat > > &sensors, std::vector< std::bitset< 64 > > &sensorCellFlag, std::vector< MFloat > &sensorWeight, MInt sensorOffset, MInt sen) override
computes the sensor values for a derivative sensor
MFloat & a_cfl()
Returns the cfl number of the solver.
MInt noLoadTypes() const override
void balancePost() override
Reinitialize solver after setting solution data in DLB.
MInt a_surfaceNghbrCellId(const MInt srfcId, const MInt dir) const
Returns the neighbor cell id of surface srfcId in direction dir.
virtual void updateSpongeLayer()
computes the additional rhs of all cells lying inside the sponge layer to dissipate outgoing waves.
std::vector< MInt > m_rotIndVarsPV
void getHeatRelease(MFloat *&heatRelease)
returns
typename maia::CartesianSolver< nDim, FvCartesianSolverXD > CartesianSolver
MInt & a_storeNghbrId(MInt nghbrId)
Return store nghbr Id.
void getLoadQuantities(MInt *const loadQuantities) const override
Return the cumulative load quantities on this domain.
MFloat & a_reactionRate(const MInt cellId, const MInt reactionId)
Returns the reactionRate of the cell cellId for variables varId.
void removeChilds(const MInt) override
MFloat & a_coordinate(const MInt cellId, const MInt dir)
Returns the coordinate of the cell from the fvcellcollector cellId for dimension dir.
std::vector< MInt > m_interpolationPosition
const MFloat & a_cfl() const
std::vector< MInt > m_noAzimuthalReconstNghbrs
virtual void nonReflectingBCCutOff()
MFloat getCellLoad(const MInt cellId, const MFloat *const weights) const override
Return the load of a single cell (given computational weights).
const MInt & a_bndryGhostCellId(const MInt bndryId, const MInt srfc) const
void computeInitialPressureLossForChannelFlow()
Computes pressure loss for the initial condition of channel flow testcases as . Requires property ReT...
MFloat & a_nuEffOtherPhase(const MInt cellId)
void applyCoarseLevelCorrection()
Apply coarse-level correction to RHS.
std::vector< MInt > m_wmSurfaceProbeSrfcs
virtual void getVorticity(MFloat *const vorticity)
wrapper for vorticity computation
void implicitTimeStep() override
std::vector< MFloat > * m_flameSpeedG
MBool m_timeStepUpdated
time-step has been updated
const MInt & a_storeNghbrId(MInt nghbrId) const
Return store nghbr Id.
std::vector< MInt > m_azimuthalBndrySide
std::vector< MFloat > * m_LESVarAverage
virtual void applyInitialCondition()
Initializes the entire flow field.
void setGlobalSolverVars(std::vector< MFloat > &globalFloatVars, std::vector< MInt > &globalIdVars) override
Set global solver variables (see getGlobalSolverVars())
MLong c_globalId(const MInt cellId) const
Returns the global grid id of the grid cell cellId.
MBool hasSplitBalancing() const override
Return if load balancing for solver is split into multiple methods or implemented in balance()
const MFloat & a_rhoInfinity() const
Return rho infinity.
virtual MInt getAdjacentLeafCells_d1(const MInt, const MInt, MIntScratchSpace &, MIntScratchSpace &)
FvSurfaceCollector & m_surfaceCollector()
MInt & a_surfaceNghbrCellId(const MInt srfcId, const MInt dir)
Returns the neighbor cell id of surface srfcId in direction dir.
MFloat a_psi(const MInt cellId) const
Returns psi of the cell cellId for variables varId.
MFloat computeTimeStepEulerDirectional(MInt cellId) const noexcept
const MInt & a_restartInterval() const
Returns the restart interval of the solver.
maia::fv::cell::BitsetType::reference a_isInterface(const MInt cellId)
Returns isInterface of the cell cellId.
MPI_Comm globalMpiComm() const
Return the global MPI communicator used by the grid.
void cancelMpiRequests() override
Cancel open MPI (receive) requests.
std::vector< MInt > m_spongeCells
virtual void loadOldVariables(const MString &fileName)
This function loads oldVariable data from a restartFile-type file.
virtual void computePrimitiveVariables()
Dispatches the computation of the primitive variables for different number of species.
MFloat a_slope(const MInt cellId, MInt const varId, const MInt dir) const
Returns the slope of the cell cellId for the variable varId in direction dir.
MFloat m_static_advanceSolution_meanDragCoeff
maia::fv::cell::BitsetType::reference a_isWMImgCell(const MInt cellId)
Returns isWMImgCell of the cell cellId.
void initCanteraObjects()
Allocates the Cantera objects that define a thermodynamic phase, reaction kinetics and transport prop...
void lhsBndFinish()
Finish the split MPI communication and perform the left out part from lhsBnd().
MFloat a_pvariable(const MInt cellId, const MInt varId) const
Returns primitive variable v of the cell cellId for variables varId.
MInt & a_restartInterval()
Returns the restart interval of the solver.
MInt m_static_computeFlowStatistics_currentIndex2
void computeVorticity3DT(MFloat *const vorticity)
Compute vorticity and store in vorticity pointer (transposed version)
virtual void calcSamplingVarAtPoint(const MFloat *point, const MInt id, const MInt sampleVarId, MFloat *state, const MBool interpolate=false) override
Calculate the sampling variables at a given point in a cell.
std::vector< MInt > gasSourceCells
std::vector< MFloat > depthCorrectionCoefficients
List< MInt > * m_sortedPeriodicCells
MBool m_static_updateBodyProperties_c455_firstRun
void updateSpongeLayerRhs(MInt, std::array< MFloat, nDim_+2 >)
virtual MInt getAdjacentLeafCells_d0(const MInt, const MInt, MIntScratchSpace &, MIntScratchSpace &)
virtual void distributeFluxToCells()
Distributes the surface fluxes to the cell RHS.
MFloat m_static_computeFlowStatistics_sdatAverage[s_computeFlowStatistics_noSamples *s_computeFlowStatistics_noAngles *s_computeFlowStatistics_noAngleDat]
MFloat & a_spongeFactor(const MInt cellId)
Returns the spongeFactor of the cell cellId.
MFloat & a_timeRef()
Return time reference value.
std::vector< std::vector< MInt > > m_saSrfcProbeIds
void getCellDataDlb(const MInt dataId, const MInt oldNoCells, const MInt *const bufferIdToCellId, MFloat *const data) override
Return solver data for DLB.
MInt a_surfaceBndryCndId(const MInt srfcId) const
Returns the boundary condition of surface srfcId.
MFloat a_vortOtherPhase(const MInt cellId, const MInt dir) const
MFloat m_timeStepFixedValue
Forces the time-step to be set to a fixed value:
std::set< MInt > m_activeMeanVars
constexpr MBool isMultilevel() const
Return true if solver is part of a multilevel computation.
std::vector< MInt > m_azimuthalReconstNghbrIds
MInt noVariables() const override
Return the number of primitive variables.
MBool m_static_computeSurfaceValuesLimitedSlopesMan_correctWallBndryFluxes
void initializeFvCartesianSolver(const MBool *propertiesGroups)
FV Constructor: reads and allocate properties/variables:
maia::fv::cell::BitsetType::reference a_wasGapCell(const MInt cellId)
Returns wasGapCell of the cell cellId.
MBool m_static_computeSurfaceValuesLimitedSlopesMan_checkedBndryCndIds
MInt a_splitCellId(const MInt sc) const
MInt & a_surfaceBndryCndId(const MInt srfcId)
Returns the boundary condition of surface srfcId.
MFloat a_nuTOtherPhase(const MInt cellId) const
virtual void applyBoundaryCondition()
handles the application of boundary conditions to the ghost cells
virtual void computeLimitedSurfaceValues(MInt timerId=-1)
MInt a_noLevelSetFieldData() const
Returns the noSets for fv-CellId cellId and set.
struct FvCartesianSolverXD::@9 m_detChem
SysEqn::AdditionalVariables * AV
void tripFourierCoefficients(MFloat *, MInt, MFloat, MFloat)
void computeMeanMolarWeights_CV()
Dispatches the mean molar weight computation at the cell center from the conservative variables by ca...
std::vector< MInt > m_maxLvlMpiRecvNeighbor
void sensorParticle(std::vector< std::vector< MFloat > > &sensors, std::vector< std::bitset< 64 > > &sensorCellFlag, std::vector< MFloat > &sensorWeight, MInt sensorOffset, MInt sen) override
virtual void resetZonalLESAverage()
Initializes zonal exchange arrays.
MBool c_isLeafCell(const MInt cellId) const
static constexpr MInt s_logData_ic45299_maxNoEmbeddedBodies
MFloat m_static_computeFlowStatistics_sdatSum[s_computeFlowStatistics_noSamples *s_computeFlowStatistics_noAngles]
void setInfinityState()
Computes/defines the infinity values/state once and for all Ideally the infinity variables should not...
static constexpr MInt s_computeFlowStatistics_noAngleDat
virtual void computeSurfaceValuesLimitedSlopesMan(MInt timerId=-1)
aaplies the slope limiter to the slopes before calling computeSurfaceValues_
MFloat & a_flameSpeed(const MInt cellId, const MInt set)
Returns the flamespeed-value for fv-CellId cellId and set.
std::array< MFloat **, s_maxNoSamplingVariables > m_samplingVariables
Storage for solver specific sampling variables.
MFloat interpolateWallNormalPointVars(MInt var, MFloat coords[], MInt localId, std::vector< MInt > neighborList)
void viscousFlux_(F &viscousFluxFct)
Computes the viscous flux using a central difference scheme to approximate the slopes at the surface ...
MFloat & a_cellVolume(const MInt cellId)
Returns the cell volume of the cell from the fvcellcollector cellId.
MFloat a_dt1Variable(const MInt cellId, const MInt varId) const
Returns dt1Variables of the cell CellId variables varId.
MBool m_timeStepAvailable
Has the non-blocking reduction of the time-step finished?
MFloat m_static_applyBoundaryCondition_ERhoLoo
void setPrimitiveVariables(MInt cellId)
computes primitive from primitive variables for given cell id. This is the version for all SysEqn.
MInt a_noReconstructionNeighbors(const MInt cellId) const
Returns the noRcnstrctnNghbrIds of the cell cellId.
virtual void resetRHSCutOffCells()
void sensorSpecies(std::vector< std::vector< MFloat > > &sensors, std::vector< std::bitset< 64 > > &sensorCellFlag, std::vector< MFloat > &sensorWeight, MInt sensorOffset, MInt sen) override
void initializeTimers()
Initializes the communication timers.
void computeSurfaceCoefficients()
Dispatches the transport coefficients computation at each surfaces by calling the relevant function f...
virtual void setCellProperties()
virtual MFloat entropy(MInt cellId)
void computeAcousticSourceTermQe(MFloatScratchSpace &, MFloatScratchSpace &, MFloatScratchSpace &, MFloatScratchSpace &)
MInt getNghbrLeafCells(const MInt cellId, MInt refCell, MInt layer, MInt *nghbrs, MInt dir, MInt dir1=-1, MInt dir2=-1) const
returns the neighbor leaf cells in the specified direction 'dir' (dir1 and dir2 are used to identify ...
void setAndAllocateCombustionTFProperties()
Reads and initializes properties associated with combustion simulations.
void writeRestartFile(const MBool, const MBool, const MString, MInt *) override
virtual void reIntAfterRestart(MBool)
static constexpr const MInt m_noEdges
virtual void applyExternalSource()
Add external sources to the RHS.
MInt & a_reconstructionNeighborId(const MInt cellId, const MInt nghbrNo)
Returns reconstruction neighbor n of the cell cellId.
void checkForSrfcsMGC()
Check all existing cells if surfaces have to be created member function with the task to check all ex...
Collector< PointBasedCell< nDim > > * m_extractedCells
void exchangeExternalSources()
Exchange external sources.
void exchangeDataFV(T *data, const MInt blockSize=1, MBool cartesian=true, const std::vector< MInt > &rotIndex=std::vector< MInt >())
std::vector< std::vector< MFloat > > m_wmImgCoords
virtual void finalizeInitEnthalpySolver()
virtual void getVorticityT(MFloat *const vorticity)
wrapper for vorticity computation (transposed version)
virtual void loadRestartMaterial()
void oldPressure(MFloat *const p)
This function computes the pressure from the oldVariables.
MInt m_static_computeFlowStatistics_currentIndex4
void findDirectNghbrs(MInt cellId, std::vector< MInt > &nghbrList)
Obtain list of direct neighbors of given cell.
MBool a_isWindow(const MInt cellId) const
Returns IsWindow of the cell cellId.
virtual void initComputeSurfaceValuesLimitedSlopesMan1()
initializes the limiter at cells, that are in the vicinity of a given stl-geometry
void sensorInterfaceDelta(std::vector< std::vector< MFloat > > &sensors, std::vector< std::bitset< 64 > > &sensorCellFlag, std::vector< MFloat > &sensorWeight, MInt sensorOffset, MInt sen)
void setActiveFlag(MIntScratchSpace &, const MInt mode, const MInt offset)
Set the flag for the cells needed for near bndry exchange.
virtual void copyVarsToSmallCells()
MBool cellParticipatesInTimeStep(MInt cellId) const noexcept
Does the cell cellId participate in the time-step computation?
const MInt m_azimuthalNearBoundaryBackupMaxCount
void allocateCommunicationMemory()
Allocates and initializes send/receive buffers for multiSolver computations.
MFloat a_surfaceDeltaX(const MInt srfcId, const MInt varId) const
Returns the delta X of surface srfcId for variable varId.
MInt & a_bndryCndId(MInt bndryId)
Return BndryCndId.
MFloat & a_reactionRateBackup(const MInt cellId, const MInt reactionId)
Returns the reactionRateBackup of the cell cellId for variables varId.
void checkInfinityVarsConsistency()
Check that all infinity (or other global) variables are equal on all ranks.
MInt & a_level(const MInt cellId)
Returns the level of the cell from the fvcellcollector cellId.
MFloat & a_uOtherPhaseOld(const MInt cellId, const MInt dir)
MFloat a_restrictedRHS(const MInt cellId, const MInt varId) const
Returns the restrictedRHS of the cell cellId for variable varId.
std::vector< std::vector< MFloat > > m_cellInterpolationMatrix
void initAzimuthalNearBoundaryExchange(MIntScratchSpace &activeFlag)
void exchangeProperties()
exchanges isInactive and isOnCurrentMGLevel
virtual void correctBoundarySurfaces()
MInt a_hasNeighbor(const MInt cellId, const MInt dir, const MBool assertNeighborState=true) const
Returns noNeighborIds of the cell CellId for direction dir.
void createGridSlice(const MString &direction, const MFloat intercept, const MString &fileName, MInt *const sliceCellIds)
MFloat & a_bndryCutCoord(MInt bndryId, MInt i, MInt j)
Return cut coordinates of bndry srfc.
MFloat a_surfaceUpwindCoefficient(const MInt srfcId) const
Returns the upwind coefficient of surface srfcId.
void resetCutOffCells()
resets all Cut-Off Information should only be called before the adaptation and balance!
std::vector< MFloat > m_reconstructionConstants
MFloat computeTimeStepMethod(MInt cellId) const noexcept
Computes the time-step of the cell cellId.
void interpolateSurfaceDiffusionFluxOnCellCenter(MFloat *const, MFloat *const)
MBool m_static_constructGFieldPredictor_firstRun
MInt m_static_computeFlowStatistics_currentIndex3
virtual void initCellMaterialNo()
std::vector< MBool > m_averageReconstructNut
void checkCellSurfaces()
checks if the surfaces for a cell are correct and balanced The accumulated cell surfaces in +x direct...
virtual void resetZonalSolverData()
virtual bool rungeKuttaStep()
Dispatches the RungeKutta method for different number of species.
void getDomainDecompositionInformation(std::vector< std::pair< MString, MInt > > &domainInfo) override
Return decomposition information, i.e. number of local elements,...
MBool solutionStep() override
Performs one Runge-Kutta step of the FV solver, returns true if the time step is completed.
static constexpr MInt s_computeFlowStatistics_noPdfPoints
void setAndAllocateSpongeBoundaryProperties()
reads in the sponge properties for specific boundaries
MFloat timeStep(MBool canSolver=false) noexcept
std::vector< std::vector< MInt > > m_cellInterpolationIds
std::vector< MInt > m_azimuthalRemappedNeighborsDomainIndex
void checkForSrfcsMGC_2_()
Check all existing cells if surfaces have to be created member function with the task to check all ex...
MFloat & a_Ma()
Returns the Mach number of the solver.
virtual void updateMultiSolverInformation(MBool fullReset=false)
MFloat a_restrictedVar(const MInt cellId, const MInt varId) const
Returns restricted variables of cell cellId for variable varId on level level.
MFloat c_cellVolumeAtLevel(const MInt level) const
Returns the grid Volume of the cell for level.
virtual MBool gridPointIsInside(MInt, MInt)
MInt m_spongeDirectionsIn[s_maxNoSpongeZones]
void checkAzimuthalRecNghbrConsistency(MInt cellId)
MInt & a_bndryId(const MInt cellId)
Returns the bndryId of the cell cellId.
const MFloat & a_VVInfinity(MInt dir) const
Return mean flow velocity.
std::vector< MInt > m_splitCells
std::unique_ptr< OneDFlame > m_oneDimFlame
MFloat m_static_applyBoundaryCondition_ERhoL2
std::vector< MInt > m_azimuthalHaloActive
MBool a_isActive(const MInt cellId) const
void rebuildAzimuthalReconstructionConstants(MInt cellId, MInt offset, MFloat *recCoord, MInt mode=0)
constexpr MBool isMultilevelPrimary() const
Return true if solver is primary solver in multilevel computation.
void reduceVariables()
Check whether any of the extracted cells lie below the halo cell level and interpolate their variable...
void postTimeStep() override
: Performs the post time step
void receive(const MBool exchangeAll=false)
Receive halo cell data from corresponding neighbors.
MFloat a_uOtherPhase(const MInt cellId, const MInt dir) const
MFloat computeDomainLength(MInt direction)
void sensorEntropyGrad(std::vector< std::vector< MFloat > > &sensors, std::vector< std::bitset< 64 > > &sensorCellFlag, std::vector< MFloat > &sensorWeight, MInt sensorOffset, MInt sen) override
void finalizeInitSolver() override
Initializes the solver afer the initialRefinement!
std::vector< MInt > m_tripCellIds
MFloat a_dt2Variable(const MInt cellId, const MInt varId) const
Returns dt2Variables of the cell CellId variables varId.
std::array< MInt, Timers::_count > m_timers
virtual void initComputeSurfaceValuesLimitedSlopesMan2()
can be used to apply the slope limiter at certain positions such as refinement interfaces,...
virtual void initSTGSponge()
Initializes zonal exchange arrays.
std::vector< MFloat > m_wallNormalPointCoords
MInt & a_noReconstructionNeighbors(const MInt cellId)
Returns the noRcnstrctnNghbrIds of the cell cellId.
void dumpCellData(const MString name)
Dump cell data of each rank to a separate file for debugging purposes.
std::vector< MInt > m_azimuthalRemappedNeighborDomains
MBool a_isWMImgCell(const MInt cellId) const
Returns isWMImgCell of the cell cellId.
static constexpr MInt s_computeFlowStatistics_noJointPdfs
virtual void computeAzimuthalReconstructionConstants(MInt mode=0)
void setCellWeights(MFloat *) override
MFloat & a_pvariable(const MInt cellId, const MInt varId)
Returns primitive variable v of the cell cellId for variables varId.
MFloat computeRecConstSVD(const MInt cellId, const MInt offset, MFloatScratchSpace &tmpA, MFloatScratchSpace &tmpC, MFloatScratchSpace &weights, const MInt recDim, const MInt, const MInt, const std::array< MBool, nDim > dirs={}, const MBool relocateCenter=false)
compute the reconstruction constants of the given cell by a weighted least-squares approach via singu...
MFloat & a_vortOtherPhase(const MInt cellId, const MInt dir)
MFloat c_weight(const MInt cellId) const
Returns the weight of the cell cellId.
void balancePre() override
Reinitialize solver for DLB prior to setting solution data.
MInt a_bndryId(const MInt cellId) const
Returns the bndryId of the cell cellId.
virtual void getSampleVarsDerivatives(const MInt cellId, const MFloat *&vars)
Access derivatives of primitive variables of a given cell.
MFloat a_uOtherPhaseOld(const MInt cellId, const MInt dir) const
MFloat computeTimeStepDiffusionNS(MFloat density, MFloat temperature, MFloat Re, MFloat C, MFloat dx) const noexcept
MBool m_static_applyBoundaryCondition_firstRun
MBool checkNeighborActive(const MInt cellId, const MInt dir) const
Cecks wether the cell cellId has a valid neighbor in direction dir.
std::vector< MFloat > * m_levelSetValues
MFloat & a_FcellVolume(const MInt cellId) override
Returns the inverse cell volume of the cell from the fvcellcollector cellId.
const MInt & getAssociatedInternalCell(const MInt &cellId) const
Returns the Id of the split cell, if cellId is a split child.
void getSampleVariableNames(std::vector< MString > &varNames) override
Return the sample variable names (primitive variables)
virtual void LSReconstructCellCenter_Boundary()
Computes the slopes at the cell centers of only the boundary cells.
virtual void getBoundaryDistance(MFloatScratchSpace &)
Get distance to boundary, currently bc 3003. Should be replaced by more precise distance using STL in...
Definition: list.h:16
Definition: lsfvmb.h:24
Definition: fvstg.h:609
This class is a ScratchSpace.
Definition: scratch.h:758
void startLoadTimer(const MString name)
Definition: solver.h:293
MPI_Comm mpiComm() const
Return the MPI communicator used by this solver.
Definition: solver.h:380
MInt m_restartInterval
The number of timesteps before writing the next restart file.
Definition: solver.h:79
void stopLoadTimer(const MString &name)
Definition: solver.h:295
MFloat m_Ma
the Mach number
Definition: solver.h:71
Definition: iovtk.h:24
MPI_Comm mpiComm() const
Definition: iovtk.h:48
MInt neighborList(const MInt cellId, const MInt dir) const
constexpr MInt size() const
Return size (i.e., currently used number of nodes)
Definition: container.h:89
Class that represents FV cell collector.
Class that represents FV surface collector.
MFloat & area(const MInt id)
Accessor for area.
MFloat & coordinate(const MInt id, const MInt dir)
Accessor for coordinate.
MFloat & upwindCoefficient(const MInt id)
Accessor for upwind coefficient.
MFloat & factor(const MInt id, const MInt varId)
Accessor for factor.
MFloat & flux(const MInt id, const MInt fVarId)
Accessor for flux.
MFloat & deltaX(const MInt id, const MInt varId)
Accessor for deltaX.
MFloat & variable(const MInt id, const MInt dir, const MInt varId)
Accessor for variable.
MInt & nghbrCellId(const MInt id, const MInt dir)
Accessor for nghbrCellId.
MInt & bndryCndId(const MInt id)
Accessor for bndryCndId.
MInt & orientation(const MInt id)
Accessor for orientation.
MFloat & surfaceCoefficient(const MInt id, const MInt dimCoefficient)
Accessor for surfaceCoefficient.
@ RANS_SA_DV
Definition: enums.h:54
@ RANS_FS
Definition: enums.h:55
@ MFLOAT
Definition: enums.h:269
void mTerm(const MInt errorCode, const MString &location, const MString &message)
Definition: functions.cpp:29
FvCell
FV cell Property Labels.
constexpr bool isEEGas
Checks if the SysEqn is SysEqnEEGas.
MInt globalTimeStep
InfoOutFile m_log
int32_t MInt
Definition: maiatypes.h:62
uint32_t MUint
Definition: maiatypes.h:63
std::basic_string< char > MString
Definition: maiatypes.h:55
double MFloat
Definition: maiatypes.h:52
int64_t MLong
Definition: maiatypes.h:64
bool MBool
Definition: maiatypes.h:58
char MChar
Definition: maiatypes.h:56
MInt id
Definition: maiatypes.h:71
uint64_t MUlong
Definition: maiatypes.h:65
int MPI_Wait(MPI_Request *request, MPI_Status *status, const MString &name)
same as MPI_Wait
int MPI_Test(MPI_Request *request, int *flag, MPI_Status *status, const MString &name)
same as MPI_Test
int MPI_Allreduce(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm, const MString &name, const MString &sndvarname, const MString &rcvvarname)
same as MPI_Allreduce
void const MInt cellId
Definition: collector.h:239
std::bitset< p(FvCell::NumProperties)> BitsetType
MUint getBufferSize(const std::vector< std::vector< MInt > > &exchangeCells)
Generic exchange of data.
Definition: mpiexchange.h:681
void exchangeData(const MInt noNghbrDomains, const MInt *const nghbrDomains, const MInt *const noHaloCells, const MInt **const, const MInt *const noWindowCells, const MInt **const windowCells, const MPI_Comm comm, const U *const data, U *const haloBuffer, const MInt noDat=1)
Generic exchange of data.
Definition: mpiexchange.h:295
void exchangeBuffer(const MInt noExDomains, const MInt *const exDomainId, const MInt *const recvSize, const MInt *const sendSize, const MPI_Comm comm, U *const receiveBuffer, const U *const sendBuffer, const MInt noDat=1)
Generic exchange of data.
Definition: mpiexchange.h:44
Namespace for auxiliary functions/classes.
static constexpr const MInt RHODIVU
static constexpr const MInt UGRADRHO
static constexpr const MInt LAMB0
static constexpr const MInt DP
static constexpr const MInt DU
static constexpr const MInt GRADU
static constexpr const MInt UGRADU
static constexpr const MInt VORT0
static constexpr const MInt GRADPRHO
static constexpr const MInt DRHO
Definition: contexttypes.h:19