30template <MInt nDim,
class SysEqn>
32template <MInt nDim,
class SysEqn>
34template <MInt nDim,
class SysEqn>
36template <MInt nDim,
class CouplingX>
38template <MInt nDim,
class SysEqn>
40template <MInt nDim,
class ppType>
43template <MInt nDim,
class SysEqn>
46 template <MInt nDim_,
class CouplingX>
52 template <MInt nDim_,
class ppType>
66 using Grid =
typename CartesianSolver::Grid;
67 using GridProxy =
typename CartesianSolver::GridProxy;
68 using CartesianSolver::disableDlbTimers;
69 using CartesianSolver::domainId;
70 using CartesianSolver::enableDlbTimers;
71 using CartesianSolver::getIdentifier;
72 using CartesianSolver::grid;
73 using CartesianSolver::isActive;
74 using CartesianSolver::m_restart;
75 using CartesianSolver::m_restartInterval;
76 using CartesianSolver::m_restartTimeStep;
77 using CartesianSolver::m_solutionInterval;
78 using CartesianSolver::m_solverId;
79 using CartesianSolver::m_useNonSpecifiedRestartFile;
80 using CartesianSolver::mpiComm;
81 using CartesianSolver::noDomains;
82 using CartesianSolver::outputDir;
83 using CartesianSolver::readSolverSamplingVarNames;
84 using CartesianSolver::restartDir;
85 using CartesianSolver::returnIdleRecord;
86 using CartesianSolver::returnLoadRecord;
87 using CartesianSolver::solverId;
88 using CartesianSolver::startLoadTimer;
89 using CartesianSolver::stopLoadTimer;
90 using CartesianSolver::updateDomainInfo;
115 std::cerr <<
"loadSampleVariables DgCartesianSolver " << timeStep << std::endl;
118 std::cerr <<
"getSampleVariables DgCartesianSolver " << cellId <<
" " << vars << std::endl;
121 std::cerr <<
"getSampleVariables DgCartesianSolver " << cellId << std::endl;
125 std::cerr <<
"getHeatRelease DgCartesianSolver " << heatRelease << std::endl;
140 MInt a_noCells()
const { TERMM(1,
"Make this function return something meaningful in future!"); }
142 MInt a_level(
const MInt)
const { TERMM(1,
"Make this function return something meaningful in future!"); }
185 const MInt extendDir,
188 std::vector<MBool>& cellHasUpdatedMeans,
189 std::vector<MInt>& SurfaceWantsToMPISend,
190 MBool& noMoreUpdates);
227 const std::vector<MString>& varNames,
228 const MFloat*
const data)
const;
280 MInt* recalcIdTree)
override;
288 grid().resizeGridMap(
grid().tree().size());
293 void setSensors(std::vector<std::vector<MFloat>>& NotUsed(sensors),
294 std::vector<MFloat>& NotUsed(sensorWeight),
295 std::vector<std::bitset<64>>& NotUsed(sensorCellFlag),
296 std::vector<MInt>& NotUsed(sensorSolverId))
override{};
300 grid().updateOther();
305 MBool step(
const MFloat externalDt = -std::numeric_limits<MFloat>::infinity(),
const MBool substep =
false);
320 const MBool interpolate)
override;
322 std::vector<std::vector<MString>>& samplingVarNames,
323 const MString featureName =
"")
override;
327 const std::vector<MInt>& NotUsed(noSamplingVars)){};
336 void calcErrorNorms(
const MFloat t, std::vector<MFloat>& L2Error, std::vector<MFloat>& LInfError,
337 std::vector<MFloat>& L2ErrLocal, std::vector<MFloat>& LInfErrLocal);
366 template <MBool forward, MInt noVars>
369 template <MBool forward, MInt noVars>
372 template <MBool forward, MInt noVars>
375 template <MBool forward>
377 template <MBool forward>
404 const MInt*
const NotUsed(noCellsToSendByDomain),
405 const MInt*
const NotUsed(targetDomainsByCell),
406 const MInt NotUsed(oldNoCells))
override {
407 TERMM(1,
"Use split balancing methods for DG solver instead of balance().");
428 template <
typename dataType>
430 dataType*
const data);
432 MInt*
const data)
override {
436 MFloat*
const data)
override {
439 template <
typename dataType>
445 std::vector<MInt>& NotUsed(globalIntVars))
override;
447 std::vector<MInt>& NotUsed(globalIdVars))
override;
450#ifdef MAIA_TIMER_FUNCTION
461 void getSolverTimings(std::vector<std::pair<MString, MFloat>>& solverTimings,
const MBool allTimings)
override;
471 count += bc->noCellDataDlb();
591#ifdef DG_USE_MPI_BUFFERS
597#ifdef DG_USE_MPI_DERIVED_TYPES
847#if defined(DG_USE_MPI_BUFFERS) && defined(DG_USE_MPI_DERIVED_TYPES)
848#error Both methods of doing MPI surface exchanges are enabled. Pick one.
850#if !defined(DG_USE_MPI_BUFFERS) && !defined(DG_USE_MPI_DERIVED_TYPES)
851#error No method of doing MPI surface exchanges is enabled. Pick one.
856#if defined(DG_USE_MPI_DERIVED_TYPES) && defined(DG_USE_MPI_WAITSOME)
857#error It makes no sense to use MPI_Waitsome with the derived data types.
862template <MInt nDim,
class SysEqn>
864 static constexpr const MInt count = 5;
866 static constexpr const MInt ELEM_CELL_ID = 0;
867 static constexpr const MInt ELEM_POLY_DEG = 1;
868 static constexpr const MInt ELEM_NO_NODES_1D = 2;
869 static constexpr const MInt ELEM_VARIABLES = 3;
870 static constexpr const MInt ELEM_NODE_VARS = 4;
875template <MInt nDim,
class SysEqn>
876const std::array<MInt, DgCartesianSolver<nDim, SysEqn>::CellData::count>
892template <MInt nDim,
class SysEqn>
897 const MInt noVars = SysEqn::noVars();
903 std::vector<MFloat> flux(maxNoNodesXD * noVars * nDim);
906#pragma omp parallel for firstprivate(flux)
908 for(
MInt elementId = 0; elementId < noElements; elementId++) {
909 const MInt polyDeg = polyDegs[elementId];
910 const MInt noNodes1D = noNodes[elementId];
911 const MFloat*
const dhat = &m_interpolation[polyDeg][noNodes1D].m_Dhat[0];
916 fluxFct.calcFlux(&elem.
nodeVars(elementId), &elem.
variables(elementId), noNodes1D, &flux[0]);
918 IF_CONSTEXPR(nDim == 2) {
920 MFloatTensor f(&flux[0], noNodes1D, noNodes1D, nDim, noVars);
921 for(
MInt i = 0; i < noNodes1D; i++) {
922 for(
MInt j = 0; j < noNodes1D; j++) {
923 for(
MInt n = 0; n < noVars; n++) {
925 for(
MInt l = 0; l < noNodes1D; l++) {
926 ut[index] += dhat[i * noNodes1D + l] * f(l, j, 0, n) + dhat[j * noNodes1D + l] * f(i, l, 1, n);
933 else IF_CONSTEXPR(nDim == 3) {
935 MFloatTensor f(&flux[0], noNodes1D, noNodes1D, noNodes1D, nDim, noVars);
937 for(
MInt i = 0; i < noNodes1D; i++) {
938 for(
MInt j = 0; j < noNodes1D; j++) {
939 for(
MInt k = 0; k < noNodes1D; k++) {
940 for(
MInt n = 0; n < noVars; n++) {
941 for(
MInt l = 0; l < noNodes1D; l++) {
942 ut[index] += dhat[i * noNodes1D + l] * f(l, j, k, 0, n) + dhat[j * noNodes1D + l] * f(i, l, k, 1, n)
943 + dhat[k * noNodes1D + l] * f(i, j, l, 2, n);
968template <MInt nDim,
class SysEqn>
977#pragma omp parallel for
980 for(
MInt srfcId = begin; srfcId < end; srfcId++) {
989 riemannFct.calcRiemann(nodeVarsL, nodeVarsR, stateL, stateR, noNodes1D, dirId, flux);
1007template <MInt nDim,
class SysEqn>
1010 const MInt noElements,
1017 const MInt maxDataBlockSize =
ipow(m_maxNoNodes1D, nDim) * SysEqn::noVars();
1018 std::vector<MFloat> sources(maxDataBlockSize);
1021#pragma omp parallel for firstprivate(sources)
1023 for(
MInt elementId = 0; elementId < noElements; elementId++) {
1025 const MInt dataBlockSize = noNodesXD * SysEqn::noVars();
1026 sourceFct.calcSource(&elem.
nodeVars(elementId), &elem.
variables(elementId), noNodes1D[elementId], t,
1030 for(
MInt dataId = 0; dataId < dataBlockSize; dataId++) {
1031 rhs[dataId] += sources[dataId];
1048template <MInt nDim,
class SysEqn>
1049template <
typename DataType>
1051 const MInt oldNoCells,
1052 const MInt*
const bufferIdToCellId,
1053 DataType*
const data) {
1057 MInt prevCellId = -1;
1058 for(
MInt i = 0; i < oldNoCells; i++) {
1059 const MInt mapping = bufferIdToCellId[i];
1061 if(mapping <= prevCellId) {
1062 TERMM(1,
"Error: assembling data buffers for unsorted cells not supported yet in DG solver.");
1064 prevCellId = mapping;
1068 const MInt noElements = m_elements.size();
1070 if(dataId > -1 && dataId < noDgCartesianSolverCellData()) {
1073 case CellData::ELEM_CELL_ID:
1074 std::copy_n(&m_elements.cellId(0), noElements, data);
1076 case CellData::ELEM_POLY_DEG:
1077 std::copy_n(&m_elements.polyDeg(0), noElements, data);
1079 case CellData::ELEM_NO_NODES_1D:
1080 std::copy_n(&m_elements.noNodes1D(0), noElements, data);
1082 case CellData::ELEM_VARIABLES: {
1083 MInt dataOffset = 0;
1085 for(
MInt elementId = 0; elementId < noElements; elementId++) {
1086 const MInt noNodesXD = m_elements.noNodesXD(elementId);
1087 const MInt dataSize = noNodesXD * SysEqn::noVars();
1088 std::copy_n(&m_elements.variables(elementId), dataSize, &data[dataOffset]);
1089 dataOffset += dataSize;
1093 case CellData::ELEM_NODE_VARS: {
1094 MInt dataOffset = 0;
1096 for(
MInt elementId = 0; elementId < noElements; elementId++) {
1097 const MInt noNodesXD = m_elements.noNodesXD(elementId);
1098 const MInt dataSize = noNodesXD * SysEqn::noNodeVars();
1099 std::copy_n(&m_elements.nodeVars(elementId), dataSize, &data[dataOffset]);
1100 dataOffset += dataSize;
1105 TERMM(1,
"Unknown data id (" + std::to_string(dataId) +
").");
1108 }
else if(dataId >= noDgCartesianSolverCellData() && dataId < noCellDataDlb()) {
1110 MInt offset = noDgCartesianSolverCellData();
1111 for(
auto&& bc : m_boundaryConditions) {
1112 const MInt bcNoCellData = bc->noCellDataDlb();
1113 if(dataId >= offset && dataId < offset + bcNoCellData) {
1114 bc->getCellDataDlb(dataId - offset, data);
1117 offset += bcNoCellData;
1121 TERMM(1,
"Invalid dataId (" + std::to_string(dataId) +
").");
1135template <MInt nDim,
class SysEqn>
1136template <
typename DataType>
1141 if(!grid().isActive()) {
1145 const MInt noElements = m_elements.size();
1147 if(dataId > -1 && dataId < noDgCartesianSolverCellData()) {
1149 if(m_loadBalancingReinitStage != 0) {
1155 case CellData::ELEM_CELL_ID:
1156 std::copy_n(data, noElements, &m_elements.cellId(0));
1158 case CellData::ELEM_POLY_DEG:
1159 std::copy_n(data, noElements, &m_elements.polyDeg(0));
1161 case CellData::ELEM_NO_NODES_1D:
1162 std::copy_n(data, noElements, &m_elements.noNodes1D(0));
1164 case CellData::ELEM_VARIABLES: {
1165 MInt dataOffset = 0;
1166 for(
MInt elementId = 0; elementId < noElements; elementId++) {
1168 const MInt noNodesXD = m_elements.noNodesXD(elementId);
1169 const MInt dataSize = noNodesXD * SysEqn::noVars();
1170 std::copy_n(&data[dataOffset], dataSize, &m_elements.variables(elementId));
1171 dataOffset += dataSize;
1175 case CellData::ELEM_NODE_VARS: {
1176 MInt dataOffset = 0;
1177 for(
MInt elementId = 0; elementId < noElements; elementId++) {
1179 const MInt noNodesXD = m_elements.noNodesXD(elementId);
1180 const MInt dataSize = noNodesXD * SysEqn::noNodeVars();
1181 std::copy_n(&data[dataOffset], dataSize, &m_elements.nodeVars(elementId));
1182 dataOffset += dataSize;
1187 TERMM(1,
"Unknown data id.");
1190 }
else if(dataId >= noDgCartesianSolverCellData() && dataId < noCellDataDlb()) {
1193 if(m_loadBalancingReinitStage != 2) {
1198 MInt offset = noDgCartesianSolverCellData();
1199 for(
auto&& bc : m_boundaryConditions) {
1200 const MInt bcNoCellData = bc->noCellDataDlb();
1201 if(dataId >= offset && dataId < offset + bcNoCellData) {
1202 bc->setCellDataDlb(dataId - offset, data);
1205 offset += bcNoCellData;
1211 if(m_loadBalancingReinitStage == 2) {
1212 TERMM(1,
"Invalid dataId: " + std::to_string(dataId));
GridCell
Grid cell Property Labels.
Intermediate class for coupling DG solver with APE sysEqn.
Class to handle creation of boundary condition objects.
std::unique_ptr< DgBoundaryCondition< nDim, SysEqn > > ReturnType
MInt m_statLocalNoMpiSurfaces
MInt m_statLocalNoHrefSurfs
MInt m_endAutoSaveCheckInterval
MBool needHElementForCell(const MInt cellId)
Return true if h-element is needed for cell, false otherwise.
std::vector< MInt > m_statLocalNoActiveDOFsPolyDeg
std::array< MInt, 2 *nDim > getBoundaryConditionIds(const MInt cellId)
Determine if element is boundary is cut by geometry elements and return corresponding boundary condit...
std::vector< MFloat > m_projectionMatricesH
MInt m_statGlobalPolyDegSum
void finalizeAdaptation() override
finalize adaptation for split sadptation after the adaptation loop
void calcRegularSurfaceFlux(const MInt begin, const MInt end, SurfaceCollector &surf, F &riemannFct)
Calculate the numerical flux for a regular (i.e. inner or MPI) surface.
MInt noLoadTypes() const override
Return the number of DG load types.
void resetBuffer(const MInt totalSize, MFloat *const buffer)
Reset the given buffer to zero.
std::vector< maia::dg::GridMapOffset > m_gridMapOffsets
void resetExternalSources()
DgBoundaryConditionFactory< nDim, SysEqn > m_boundaryConditionFactory
MBool hasMpiExchange() const
void prolongToSurfaces()
Extrapolate the solution from inside the elements to the surfaces.
MFloat * mortarP(const MInt sourcePolyDeg, const MInt targetPolyDeg)
void checkCellProperties()
Check all relevant bit properties in the cells.
MFloat m_sourceRampUpTime
void calcSurfaceIntegral()
Calculate the surface integral for all faces of element and update dU/dt.
void applyJacobian()
Adds the negative of the inverse Jacobian to the time derivative.
std::vector< MPI_Datatype > m_recvTypes
void preTimeStep() override
Perform pre-time-step operations, e.g. set new dt if required.
std::vector< std::vector< MFloat > > m_recvBuffers
void forceTimeStep(const MFloat dt)
Force time step externally.
void initTimers()
Initialize all solver-wide timers and start the solver timer.
void calcInnerSurfaceFlux()
Calculate the numerical flux on the internal surfaces and update m_flux.
typename CartesianSolver::Grid Grid
MBool calcStateAtPoint(const MFloat *point, MFloat *state)
returns the cellId of a cell containing a given point
typename DgBoundaryConditionFactory< nDim, SysEqn >::ReturnType BC
std::vector< MFloat * > m_projectionMatrixPointersH
void calcMortarProjectionH(const MInt srfcId, const MInt dir, MFloat *source, MFloat *destination, ElementCollector &elem, SurfaceCollector &surf)
Calculate the h-refinement mortar projection.
std::vector< MFloat > m_prefPatchesPolyDeg
MLong m_statGlobalNoPrefSurfs
MInt getLevelOfDirectNeighborCell(const MInt cellId, const MInt dir)
MLong m_statGlobalNoBoundarySurfaces
MLong m_statGlobalNoHElements
MBool m_writeNodeVarsFile
MInt a_hasNeighbor(const MInt cellId, const MInt dir) const
MInt m_loadBalancingReinitStage
void applyExternalSourceTerms(const MFloat time)
Add the external coupling source terms to the right hand side.
virtual void reIntAfterRestart(MBool)
MInt getHElementId(const MInt elementId) const
Return h-element id of a given element (if it exists).
void createHElement(const MInt cellId)
Create h-element for cell with id cellId.
MBool m_mpiSendRequestsOpen
MFloat calcTimeStep()
Calculate the next time step.
void loadNodeVarsFile()
Load node variables from file.
MInt noVariables() const override
Return the number of variables.
void swapProxy(const MInt cellId0, const MInt cellId1)
Swap the given cells.
void resizeGridMap()
Swap the given cells.
void calcSamplingVarAtPoint(const MFloat *point, const MInt elementId, const MInt sampleVarId, MFloat *state, const MBool interpolate) override
Calculate the state vector at a given point and for the specified sampling variable.
void createElement(const MInt cellId)
Create element for cell with id cellId.
MBool m_weightDgRbcElements
MLong m_statGlobalNoElements
MLong m_statGlobalNoActiveDOFs
std::vector< MFloat > m_timeIntegrationCoefficientsB
MInt m_noBoundarySurfaces
std::vector< std::vector< DgInterpolation > > m_interpolation
MLong m_statGlobalMaxNoCells
MInt m_statLocalNoActiveCells
maia::dg::collector::ElementCollector< nDim, SysEqn > ElementCollector
MBool m_alwaysSaveFinalSolution
void initSurfaces()
Create for all elements and directions surfaces if necessary.
void setGlobalSolverVars(std::vector< MFloat > &NotUsed(globalFloatVars), std::vector< MInt > &NotUsed(globalIdVars)) override
Set global solver variables for DLB (same on each domain)
DgInterpolation m_interpAnalysis
MBool pointIsInside(const MFloat *const coordinates)
Check if point is inside the computational domain.
void calcMpiSurfaceFlux()
Calculate the numerical flux on the MPI surfaces and update m_flux.
void initJacobian()
Calculates the inverse Jacobian for each element.
void exchangeMpiSurfacePolyDeg()
MBool hasAdaptivePref() const
Return true if adaptive hp-refinement is activated.
MInt getIdAtPoint(const MFloat *point, const MBool globalUnique=false)
Return the element id containing a given point.
MInt m_statLocalNoHaloCells
std::vector< MFloat > m_timeIntegrationCoefficientsA
MInt m_maxNoGridMapOffsets
void getSolverSamplingProperties(std::vector< MInt > &samplingVarIds, std::vector< MInt > &noSamplingVars, std::vector< std::vector< MString > > &samplingVarNames, const MString featureName="") override
Return sampling properties for the DG solver.
void getLoadQuantities(MInt *const loadQuantities) const override
Return the cumulative load quantities on this domain.
std::vector< std::vector< MFloatTensor > > m_vdmAnalysis
void writeRestartFile(const MBool writeRestart, const MBool writeBackup, const MString gridFileName, MInt *recalcIdTree) override
Write a restart file.
MInt m_statGlobalMinLevel
MInt initMpiSurface(const MInt elementId, const MInt dir)
Check if the surface of the element in the given direction is a MPI surface. If it is,...
MInt noSolverTimers(const MBool allTimings) override
Geom & geometry()
Access the solver's geometry (non-const version)
MInt getCurrentTimeStep() const override
MBool m_alwaysSaveFinalRestart
MInt m_noAnalyzeTimeSteps
MInt calculateNeededNoSurfaces()
Determine the number of surfaces that need to be created on this domain.
MInt m_statGlobalMaxLevel
MBool solutionStep() override
Perform one Runge-Kutta step/stage.
MInt initInnerSurface(const MInt elementId, const MInt dir)
Check if the surface of the element in the given direction is an inner surface without h/p-refinement...
void cleanUp() override
Clean up after a simulation run.
MBool m_saveNodeVariablesToSolutionFile
virtual void calcSamplingVariables(const std::vector< MInt > &NotUsed(varIds), const MBool NotUsed(exchange))
MInt getCellIdByIndex(const MInt index)
Return cell id belonging to an element id/index.
std::vector< BC > m_boundaryConditions
MString getRestartFileName(const MInt timeStep, const MInt useNonSpecifiedRestartFile)
Return name of a restart file for the given time step.
static const std::array< MInt, CellData::count > s_cellDataTypeDlb
MLong m_statGlobalMaxNoSurfaces
void getCellDataDlb(const MInt dataId, const MInt oldNoCells, const MInt *const bufferIdToCellId, MFloat *const data) override
virtual void saveRestartFile()
Saves a file to disk with all information that is necessary to restart the calculations from here.
MBool isMpiSurface(const MInt id) const
Return true if a surface is a MPI surface.
std::vector< MPI_Request > m_recvRequests
std::vector< MFloat * > m_projectionMatrixPointersP
MInt m_statLocalNoBoundarySurfaces
MBool hasSurface(const MInt elementId, const MInt dir)
Check if a surface exists for the element in the given direction.
MLong m_statGlobalNoMpiSurfaces
void calcMortarProjection(const MInt srfcId, const MInt dir, MFloat *source, MFloat *destination, ElementCollector &elem, SurfaceCollector &surf)
void setCellDataDlb(const MInt dataId, const MInt *const data) override
void calculateHeatRelease()
void initDgCartesianSolver()
Initializes basic properties of the solver.
void globalToLocalIds() override
Change global into local ids.
void initMortarProjections()
Calculate all necessary mortar projection matrices.
MBool m_writeTimeDerivative
MInt createHMPISurfaces(const MInt elementId, const MInt dir)
MFloat m_adaptiveThreshold
void setInputOutputProperties()
MInt cellDataTypeDlb(const MInt dataId) const override
Get data type of cell data.
MInt m_dgIntegrationMethod
void checkGridMap(const MString &donorGridFileName)
Perform some sanity checks on loaded grid map.
MInt m_statLocalMaxNoCells
MInt m_noExchangeNghbrDomains
MInt noDgCartesianSolverCellData() const
void setCellWeights(MFloat *solverCellWeight) override
Set cell weights with constant weighting factor weightPerNode.
void getSampleVariables(MInt cellId, const MFloat *&vars)
MBool m_updateCellWeights
MInt m_innerSurfacesOffset
void loadSampleVariables(MInt timeStep)
MInt m_statLocalNoActiveDOFs
std::array< MInt, 2 *nDim > m_cutOffBoundaryConditionIds
std::array< MInt, Timers::_count > m_timers
MBool m_isInitMpiExchange
Geom & m_geometry
Reference to geometry object.
void calcSourceTerms(MFloat t)
Calculates the source terms for each node and adds them to the time derivative of the conservative va...
void saveNodeVarsFile()
Save node variables to file.
void extendNodeVariables()
Extends nodeVars from given planes to given directions.
MInt m_statLocalNoInternalCells
void updateNodeVariablesSingleElement(const MInt elementId, const MInt extendDir, MIntTensor hForwardSurfaceId, MIntTensor hReverseSurfaceId, std::vector< MBool > &cellHasUpdatedMeans, std::vector< MInt > &SurfaceWantsToMPISend, MBool &noMoreUpdates)
Sets nodeVars of an element to values on the surface opposite to extendDir.
MInt m_statLocalNoElements
MFloat time() const override
Return the time.
void adaptiveRefinement(const MInt timeStep)
Apply adaptive refinement (right now: only p-refinement)
void initNodeCoordinates()
Calculates the coordinates of the integration nodes within each element.
~DgCartesianSolver() override
Frees resources that were allocated in the constructor and that are not automatically released when t...
void calcVolumeIntegral()
Calculate the volume integral for all elements and update m_rightHandSide.
void calcElementNodeCoordinates(const MInt elementId)
Calculates the coordinates of the integration nodes within the element.
const MFloat & a_coordinate(const MInt cellId, const MInt dim) const
void getCellDataDlb(const MInt dataId, const MInt oldNoCells, const MInt *const bufferIdToCellId, MInt *const data) override
std::vector< std::vector< MInt > > m_mpiSurfaces
MInt m_statLocalMinPolyDeg
maia::dg::collector::SurfaceCollector< nDim, SysEqn > SurfaceCollector
MLong m_statGlobalNoHrefSurfs
MFloat * mortarH(const MInt polyDeg, const MInt position)
void setCellDataDlb(const MInt dataId, const MFloat *const data) override
void initPolynomialDegree()
Calculate and set initial polynomial degree and number of nodes in all elements.
void loadGridMap(const MString &gridMapFileName)
Load previously created grid map.
void initInterpolation()
Calculates necessary coefficients for interpolation and stores them once for the whole solver.
void initElements()
Initialize all elements by iterating over all cells and creating an element for each internal leaf ce...
void calcMortarProjectionP(const MInt srfcId, const MInt dir, MFloat *source, MFloat *destination, ElementCollector &elem, SurfaceCollector &surf)
Calculate the p-refinement mortar projection.
std::vector< MPI_Datatype > m_sendTypes
MInt m_statGlobalMinPolyDeg
SurfaceCollector m_surfaces
MInt m_statLocalPolyDegSum
std::vector< std::array< MFloat, 2 *nDim > > m_prefPatchesCoords
DgSponge< nDim, SysEqn > & sponge()
MLong m_statGlobalNoCells
typename maia::grid::tree::Tree< nDim >::Cell Cell
PointData< nDim, DgCartesianSolver< nDim, SysEqn > > m_pointData
void calcBoundarySurfaceFlux(MFloat t)
Calculate the numerical flux on the boundary surfaces and update m_flux.
std::vector< MString > m_prefPatchesOperators
void savePartitionCellWorkloads()
void saveSolverSolution(const MBool forceOutput, const MBool finalTimeStep) override
Save the solver solution, i.e. write solution files and sampling/slice output.
std::vector< MPI_Request > m_sendRequests
void calcErrorEstimate(std::vector< MFloat > &errorEstimate)
Calculate error estimate for adaptive hp-refinement.
void initSolver() override
Initialize the solver.
void updateWeightsAndWorkloads()
GeometryIntersection< nDim > * m_geometryIntersection
constexpr const Geom & geometry() const
Access the solver's geometry.
void postAdaptation() override
post adaptation for split adaptation within the adaptation loop
MBool m_restoreDefaultWeights
void allocateAndInitSolverMemory()
Allocates main memory resources.
MBool m_mpiRecvRequestsOpen
MInt m_statLocalNoPrefSurfs
void analyzeTimeStep(MFloat t, MFloat runTimeRelative, MFloat runTimeTotal, MInt timeStep, MFloat dt)
Calculates and prints the L^2 and L^inf errors (using calcErrorNorms()) for the current time.
void initData()
Initialize solver data, i.e. set initial conditions or load restart file.
MInt m_statLocalMaxPolyDeg
MFloat getCellLoad(const MInt cellId, const MFloat *const weights) const override
Return the load of a single cell (given computational weights).
virtual void initSolverSamplingVariables(const std::vector< MInt > &NotUsed(varIds), const std::vector< MInt > &NotUsed(noSamplingVars))
MInt getLevelByElementId(const MInt elementId)
MBool needElementForCell(const MInt cellId)
Return true if element is needed for cell, false otherwise.
MBool hasPref() const
Return true if p-refinement is set.
MLong m_statGlobalNoActiveCells
MInt noCellDataDlb() const override
Methods to inquire solver data information.
MBool hasNeighborCell(const MInt elementId, const MInt dir)
SurfaceData< nDim, DgCartesianSolver< nDim, SysEqn > > m_surfaceData
void getSolverTimings(std::vector< std::pair< MString, MFloat > > &solverTimings, const MBool allTimings) override
Get solver timings.
MInt cellDataSizeDlb(const MInt dataId, const MInt cellId) override
Return data size of cell data.
MLong m_statGlobalNoHaloCells
MInt a_level(const MInt) const
void interpolateElement(const MInt elementId, const MInt newPolyDeg)
Interpolate an element to a different polynomial degree.
void initMainLoop()
Perform all operations that prepare the execution of the main loop.
MLong m_statGlobalNoSurfaces
void initSimulationStatistics()
void getGlobalSolverVars(std::vector< MFloat > &NotUsed(globalFloatVars), std::vector< MInt > &NotUsed(globalIntVars)) override
Get global solver variables that need to be communicated for DLB (same on each domain)
void getDomainDecompositionInformation(std::vector< std::pair< MString, MInt > > &domainInfo) override
Return decomposition information, i.e. number of local elements,...
void balancePost() override
Reinitialize solver after setting solution data.
void calcErrorNorms(const MFloat t, std::vector< MFloat > &L2Error, std::vector< MFloat > &LInfError, std::vector< MFloat > &L2ErrLocal, std::vector< MFloat > &LInfErrLocal)
Calculate the L^2 and L^infinity error norms at a given time. The error is calculated in comparison t...
typename CartesianSolver::GridProxy GridProxy
void setSensors(std::vector< std::vector< MFloat > > &NotUsed(sensors), std::vector< MFloat > &NotUsed(sensorWeight), std::vector< std::bitset< 64 > > &NotUsed(sensorCellFlag), std::vector< MInt > &NotUsed(sensorSolverId)) override
void applySurfaceIntegral(MFloat *rhs, const MInt polyDeg, const MInt noNodes1D, const MInt srfcId, const MInt side, const MFloat *flux, SurfaceCollector &surf)
Calculate the surface integral for a face of an element and update dU/dt.
MInt initBoundarySurface(const MInt elementId, const MInt dir)
Check if the surface of the element in the given direction is a boundary surface. If it is init,...
MInt createSurface(const MInt elementId, const MInt dir, MInt nghbrId=-1)
void cancelMpiRequests() override
Cancel open MPI (receive) requests.
std::array< MLong, 6 > m_statGlobalNoCutOffBoundarySurfaces
MInt m_calcTimeStepInterval
void getHeatRelease(MFloat *&heatRelease)
MInt m_dgTimeIntegrationScheme
void timeStepRk(const MFloat t, const MFloat dt, const MInt substep=-1)
Time integration using the five-stage fourth-order low-storage Runge-Kutta scheme as described in the...
void saveNodalData(const MString &fileNameBase, const MInt noVars, const std::vector< MString > &varNames, const MFloat *const data) const
Save nodal data to file.
MInt m_statLocalNoSurfaces
std::array< MInt, 2 *nDim > m_noCutOffBoundarySurfaces
MInt m_statLocalNoInnerSurfaces
void calcDgTimeDerivative(const MFloat t, const MFloat tStage)
Main routine to calculate the discontinuous Galerkin time derivative. After this method was called,...
void subTimeStepRk(const MFloat dt, const MInt stage, const MInt totalSize, const MFloat *const rhs, MFloat *const variables, MFloat *const timeIntStorage)
Perform one Runge-Kutta substep on the given elements.
void extendNodeVariablesSingleDirection(const MInt extendDir, const MFloat extendOffset, const MFloat extendLimit)
Set nodeVars upstream of given plane to values of elements in plane.
MInt getElementIdAtPoint(const MFloat *point, MBool globalUnique=false)
returns the elementId of a element containing a given point
void initPrefinement()
Set polynomial degree for static p-refinement case.
ElementCollector m_elements
void initGridMap()
Determine grid-to-grid mapping.
std::vector< MFloat > m_timeIntegrationCoefficientsC
MInt noBcSolverCellData() const
void run()
Main method to run this solver.
void getSampleVariables(const MInt cellId, std::vector< MFloat > &)
MBool prepareRestart(MBool, MBool &) override
Return true if the solver wants to write a restart file.
void finalizeInitSolver() override
Finalization of the solver initialization.
MInt m_statGlobalMaxPolyDeg
void localToGlobalIds() override
Change local into global ids.
void finishMpiSurfaceExchange()
Finish sending the window-side data and finish receiving the halo-side data for all MPI surfaces.
void initHElements()
Initialize all helements by iterating over all cells and creating an element for each coarse cell in ...
typename maia::CartesianSolver< nDim, DgCartesianSolver > CartesianSolver
void postTimeStep()
Perform post-time-step operations, e.g. advance time, error analysis.
void getCellDataDlb_(const MInt dataId, const MInt oldNoCells, const MInt *const bufferIdToCellId, dataType *const data)
virtual void initInterpolationForCell(const MInt NotUsed(cellId))
MBool step(const MFloat externalDt=-std::numeric_limits< MFloat >::infinity(), const MBool substep=false)
Advance the solution by one time step.
DgSlices< nDim, SysEqn > m_slice
HElementCollector m_helements
std::time_t m_endAutoSaveTime
MBool isAdaptationTimeStep(const MInt timeStep) const
Return if the given timestep is an adaptation timestep.
void resetSolver() override
Reset solver (for load balancing)
void setNumericalProperties()
Reads properties associated with the numerical method.
MInt m_noMinutesEndAutoSave
std::vector< std::vector< MInt > > m_mpiRecvSurfaces
void calcSurfaceNodeCoordinates(const MInt surfaceId)
MBool m_writeInitialSolution
MFloat m_weightPerElement
void loadRestartFile() override
Load restart file with all information that is necessary to restart the calculations from here.
std::vector< MInt > m_prefPatchesNoNodes1D
void balancePre() override
Reinitialize solver prior to setting solution data in DLB.
void initSolverObjects()
Initializes the solver. This must be called before using any of the discretization methods,...
void setCellDataDlb_(const MInt dataId, const dataType *const data)
std::vector< MInt > m_exchangeNghbrDomains
MInt noInternalCells() const override
Return the number of internal cells within this solver.
MLong m_statGlobalNoInnerSurfaces
void applyForwardProjection()
void startMpiSurfaceExchange()
Start sending the window-side data and start receiving the halo-side data for all MPI surfaces.
MBool hasSplitBalancing() const override
Return if load balancing for solver is split into multiple methods or implemented in balance()
DgSponge< nDim, SysEqn > m_sponge
void finalizeMpiExchange()
MBool m_endAutoSaveWritten
MLong m_statGlobalNoInternalCells
std::vector< MFloat > m_projectionMatricesP
void updateNodeVariables()
Update all node variables at the surfaces.
MBool isMpiRoot() const
Return true if this is the root rank of the solver MPI communicator.
virtual void initialCondition()
Set the initial condition in all elements.
void finalizeBalance() override
MInt m_statLocalNoHElements
void saveSolutionFile()
Saves all available data to disk.
MInt m_statLocalMaxNoSurfaces
void getDefaultWeights(MFloat *weights, std::vector< MString > &names) const
Return the default weights for all load quantities.
MFloat m_analyzeTimeStart
MFloatTensor m_wVolumeAnalysis
void prepareAdaptation() override
prepare adaptation for split adaptation before the adaptation loop
void outputInitSummary()
Print initialization summary to user and m_log.
MBool m_useCutOffBoundaries
VolumeData< nDim, DgCartesianSolver< nDim, SysEqn > > m_volumeData
std::vector< std::vector< MFloat > > m_sendBuffers
virtual void resetRHS()
Reset the time derivative of the conservative variables to zero.
void balance(const MInt *const NotUsed(noCellsToReceiveByDomain), const MInt *const NotUsed(noCellsToSendByDomain), const MInt *const NotUsed(targetDomainsByCell), const MInt NotUsed(oldNoCells)) override
Perform load balancing.
Coupling condition for direct-hybrid LES-CAA computations.
Class stores precalculated values for interpolation & integration on the reference interval [-1,...
Determine all coordinates and alloc buffer size create a valid 2D grid which represents a slice from ...
Container for sponge elements.
This class is responsible for the point data feature. It records the state of all sampling variables ...
virtual MInt domainId() const
Return the domainId (rank)
MPI_Comm mpiComm() const
Return the MPI communicator used by this solver.
MInt solverId() const
Return the solverId.
virtual MInt noDomains() const
void updateDomainInfo(const MInt domainId, const MInt noDomains, const MPI_Comm mpiComm, const MString &loc)
Set new domain information.
Surface data sampling class. Records all sampling variables on all surface elements and outputs addit...
Class to handle sampling of volume data.
constexpr GridProxy & grid() const
MBool isActive() const override
Class that represents DG element collector.
MInt & polyDeg(const MInt id)
Accessor for polynomial degree.
MInt noNodesXD(const MInt id) const
Accessor for number of nodes XD (const version).
MFloat & nodeCoordinates(const MInt id)
Accessor for node coordinates.
MInt & cellId(const MInt id)
Accessor for cell id.
MInt maxNoNodesXD() const
Return maximum number of nodes XD.
MFloat & nodeVars(const MInt id)
Accessor for node variables.
MFloat & variables(const MInt id, const MInt pos)
Accessor for variables.
MFloat & rightHandSide(const MInt id)
Accessor for right hand side.
MInt noNodes1D(const MInt id) const
Accessor for number of nodes 1D (const version).
Class that represents DG element collector.
Class that represents DG element collector.
MInt & noNodes1D(const MInt srfcId)
Accessor for number of nodes 1D.
MFloat & nodeVars(const MInt srfcId, const MInt side)
Accessor for node variables.
MFloat & flux(const MInt srfcId)
Accessor for flux.
MFloat & variables(const MInt srfcId, const MInt side)
Accessor for variables.
MInt & orientation(const MInt srfcId)
Accessor for orientation.
Provides a lightweight and fast class for accessing 1D arrays as multi-dimensional tensors (up to 4D)...
MInt ipow(MInt base, MInt exp)
Integer exponent function for non-negative exponents.
std::basic_string< char > MString
static constexpr const MInt count