19template <MInt nDim,
class SysEqn>
28 using Grid =
typename CartesianSolver::Grid;
29 using GridProxy =
typename CartesianSolver::GridProxy;
38 using CartesianSolver::domainId;
39 using CartesianSolver::domainOffset;
40 using CartesianSolver::grid;
41 using CartesianSolver::haloCellId;
42 using CartesianSolver::isActive;
43 using CartesianSolver::m_freeIndices;
44 using CartesianSolver::m_recalcIds;
45 using CartesianSolver::m_restart;
46 using CartesianSolver::m_restartFile;
47 using CartesianSolver::m_restartInterval;
48 using CartesianSolver::m_restartOffset;
49 using CartesianSolver::m_restartTimeStep;
50 using CartesianSolver::m_solutionInterval;
51 using CartesianSolver::m_solutionOffset;
52 using CartesianSolver::m_solutionOutput;
53 using CartesianSolver::m_solutionTimeSteps;
54 using CartesianSolver::m_solverId;
55 using CartesianSolver::maxLevel;
56 using CartesianSolver::maxNoGridCells;
57 using CartesianSolver::maxRefinementLevel;
58 using CartesianSolver::maxUniformRefinementLevel;
59 using CartesianSolver::minLevel;
60 using CartesianSolver::mpiComm;
61 using CartesianSolver::noHaloCells;
62 using CartesianSolver::noNeighborDomains;
63 using CartesianSolver::noWindowCells;
64 using CartesianSolver::outputDir;
65 using CartesianSolver::restartDir;
66 using CartesianSolver::returnIdleRecord;
67 using CartesianSolver::returnLoadRecord;
68 using CartesianSolver::saveGridFlowVars;
69 using CartesianSolver::solverId;
70 using CartesianSolver::updateDomainInfo;
71 using CartesianSolver::windowCellId;
100 std::vector<MString>& variablesName,
112 void setSensors(std::vector<std::vector<MFloat>>& sensors,
113 std::vector<MFloat>& sensorWeight,
114 std::vector<std::bitset<64>>& sensorCellFlag,
115 std::vector<MInt>& sensorSolverId)
override;
138 if(cellId > (
m_cells.size() - 1))
return -1;
139 return grid().tree().hasNeighbor(cellId, dir);
152 MInt a_level(
const MInt)
const { TERMM(1,
"Make this function return something meaningful in future!"); }
186 return m_cells.hasProperty(cellId, SolverCell::IsHalo);
194 return m_cells.hasProperty(cellId, SolverCell::IsWindow);
210 : std::make_pair(std::numeric_limits<MInt>::max(), std::numeric_limits<MInt>::min());
240 TERMM(1,
"solverCelldataType: invalid data id " + std::to_string(dataId));
246 MFloat*
const data)
override {
274 "statisticCombustionAnalysis",
276 "averageSpeedOfSound",
322 template <
typename dataType>
337 TERMM(1,
"Unknown data id.");
343 template <
typename dataType>
345 dataType*
const data) {
348 MInt localBufferId = 0;
349 for(
MInt i = 0; i < oldNoCells; i++) {
350 const MInt gridCellId = bufferIdToCellId[i];
352 if(gridCellId < 0)
continue;
354 const MInt cellId =
grid().tree().grid2solver(gridCellId);
362 std::copy_n(&
a_variable(cellId, 0), dataSize, &data[localBufferId * dataSize]);
366 TERMM(1,
"Unknown data id.");
376 IF_CONSTEXPR(
nDim == 2) {
377 std::array<MInt, 2>
a = {0, 1};
381 std::array<MInt, 3>
a = {0, 1, 2};
GridCell
Grid cell Property Labels.
MFloat getCellLoad(const MInt cellId, const MFloat *const weights) const override
Return the load of a single cell (given computational weights).
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.
void prepareAdaptation() override
prepare solver adaptation
void postAdaptation() override
reinit the solver after a single adaptation step
MBool hasSplitBalancing() const override
Return if load balancing for solver is split into multiple methods or implemented in balance()
void finalizeInitSolver() override
MInt noInternalCells() const override
Return the number of internal cells within this solver.
void setCellDataDlb_(const MInt dataId, const dataType *const data)
Set the solver cell data after DLB.
MBool m_adaptationSinceLastRestart
void getDefaultWeights(MFloat *weights, std::vector< MString > &names) const
Return the default weights for all load quantities.
MBool solutionStep() override
void refineCell(const MInt) override
MInt noLoadTypes() const override
Return the number of Ls load types.
void getCellDataDlb(const MInt dataId, const MInt oldNoCells, const MInt *const bufferIdToCellId, MFloat *const data) override
void writeRestartFile(MBool) override
void resizeGridMap() override
Swap the given cells.
void setCellWeights(MFloat *) override
sets the cell-weight for balancing and a restarting
MInt c_noCells() const
Returns the number of grid-cells.
typename CartesianSolver::GridProxy GridProxy
MFloat time() const override
Return the time.
void getDomainDecompositionInformation(std::vector< std::pair< MString, MInt > > &domainInfo) override
Return decomposition information, i.e. number of local elements,...
void setPropertyVariableOffset(MString s, MInt start, MInt length)
void loadGridFlowVars(const MChar *fileName, MInt noVariables, std::vector< MString > name)
This function reads the parallel Netcdf cartesian grid cell based solution/restart file currently use...
MInt getVariablePropertyIndex(MString s)
Return the number of primitive variables.
void finalizeAdaptation() override
reinit the solver after the full adaptation loop!
MInt noCellDataDlb() const override
Methods to inquire solver data information.
void saveRestartFile(const MBool writeBackup)
static constexpr MInt nDim
Geom & geometry() const
Access the solver's geometry.
maia::post::cell::BitsetType::reference a_isHalo(const MInt cellId)
Returns IsHalo of the cell cellId.
std::vector< std::pair< MInt, MInt > > m_variableOffset
MBool prepareRestart(MBool, MBool &) override
Prepare the solvers for a grid-restart.
maia::post::cell::BitsetType::reference a_isWindow(const MInt cellId)
Returns IsWindow of the cell cellId.
MInt a_level(const MInt) const
MInt cellOutside(const MFloat *, const MInt, const MInt) override
checks if a child lies outSide of the domain! necessary for refinement at the bndry!
void saveDataFile(const MBool writeBackup, const MString fileName, const MInt noVars, std::vector< MString > &variablesName, MFloat *variables)
MInt cellDataTypeDlb(const MInt dataId) const override
MFloat & a_variable(const MInt cellId, const MInt varId)
Returns conservative variable v of the cell cellId for variables varId.
const std::vector< MString > m_propertyName
MFloat c_coordinate(const MInt cellId, const MInt dim) const
Returns the coordinate of the cell from the grid().tree() cellId for dimension dir.
void getCellDataDlb_(const MInt dataId, const MInt oldNoCells, const MInt *const bufferIdToCellId, dataType *const data)
Store the solver data for a given data id ordered in the given buffer for DLB.
MLong c_childId(const MInt cellId, const MInt pos) const
MFloat a_variable(const MInt cellId, const MInt varId) const
Returns conservative variable v of the cell cellId for variables varId.
MBool a_isWindow(const MInt cellId) const
Returns IsWindow of the cell cellId.
void removeChilds(const MInt) override
Coarsen the given cell.
MInt a_hasNeighbor(const MInt cellId, const MInt dir) const
Returns wether cell cellId has a neighbor in dir dir.
MInt c_noChildren(const MInt cellId) const
Returns the number of children of the cell cellId.
void balancePre() override
Reinitialize solver for DLB prior to setting solution data.
void finalizeBalance() override
Reinitialize solver after all data structures have been recreated.
MLong c_parentId(const MInt cellId) const
Returns the grid parent id of the cell cellId.
void initSolver() override
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 a single adaptation step
std::pair< MInt, MInt > getPropertyVariableOffset(MString s)
void getSolverTimings(std::vector< std::pair< MString, MFloat > > &solverTimings, const MBool) override
Get solver timings.
MInt m_loadBalancingReinitStage
MInt c_level(const MInt cellId) const
Returns the grid level of the cell cellId.
void removeCell(const MInt) override
Remove the given cell.
void swapCells(const MInt, const MInt) override
MString getVariableName(MInt offset)
typename maia::grid::tree::Tree< nDim >::Cell Cell
MInt noVariables() const
Return the number of primitive variables.
MBool m_forceWriteRestart
MLong c_globalId(const MInt cellId) const
Returns the global grid id of the grid cell cellId.
std::vector< MString > m_variablesName
void preTimeStep() override
void setAndAllocateSolverData(const MBool)
std::vector< MString > m_fileVarNames
void resetSolver() override
Reset the solver prior to load balancing.
void saveSolverSolution(const MBool, const MBool)
maia::post::collector::PostCellCollector< nDim > m_cells
Collector for POST data.
typename maia::CartesianSolver< nDim, PostData > CartesianSolver
void reIntAfterRestart(MBool)
This function resets the grid-trigger after a restart that is handled by the grid-controller!
static constexpr std::array< MInt, nDim > getArray012()
Static indices for accessing post variables in nDim spatial dimensions.
void postTimeStep() override
static const std::vector< std::vector< MString > > m_averageVariableName
void copyGridProperties()
typename CartesianSolver::Grid Grid
void setCellDataDlb(const MInt dataId, const MFloat *const data) override
Set solver data for DLB.
void loadMeanFile(const MString fileName)
load a file for averaging
MFloat & a_averagedVariable(const MInt cellId, const MInt varId)
MString m_currentGridFileName
void balancePost() override
Reinitialize solver for DLB after to setting solution data.
void writeRestartFile(const MBool, const MBool, const MString, MInt *) override
std::vector< MString > fileVarNames() const
const MFloat & c_coordinate(const MInt cellId, const MInt dim)
Returns the coordinate of the cell from the grid().tree() cellId for dimension dir.
MBool a_isHalo(const MInt cellId) const
Returns IsHalo of the cell cellId.
void swapProxy(const MInt cellId0, const MInt cellId1) override
void getLoadQuantities(MInt *const loadQuantities) const override
Return the cumulative load quantities on this domain.
void a_resetPropertiesSolver(const MInt cellId)
Returns property p of the cell cellId.
MBool isActive() const override
Class that represents Post cell collector.
std::basic_string< char > MString
PostCell
POST cell Property Labels.