11 int numberOfGridCellsPerPatchPerAxis,
14 int auxiliaryVariables,
17 bool evaluateDifferentialSource,
18 bool evaluateAlgebraicSource,
19 bool copyOldTimeStepAndScaleWithTimeStepSize,
22 NonconservativeProduct DifferentialSource,
23 Source AlgebraicSource
29 bool evaluateKODissipation = KOSigma>0.0;
30 bool second_order_formulation =
false;
35 logDebug(
"timeStep_patchwise_heap_functors(...)",
"size of temp flux field=" << QOutEnumerator.
size() );
39 double* tempDifferentialSourceX = evaluateDifferentialSource ? tarch::allocateMemory<double>( QOutEnumerator.
size(),
tarch::MemoryLocation::Heap ) :
nullptr;
40 double* tempDifferentialSourceY = evaluateDifferentialSource ? tarch::allocateMemory<double>( QOutEnumerator.
size(),
tarch::MemoryLocation::Heap ) :
nullptr;
41 double* tempDifferentialSourceZ = (evaluateDifferentialSource and Dimensions==3) ? tarch::allocateMemory<double>( QOutEnumerator.
size(),
tarch::MemoryLocation::Heap ) :
nullptr;
44 double* tempKODissipationZ = (evaluateKODissipation and Dimensions==3) ? tarch::allocateMemory<double>( QOutEnumerator.
size(),
tarch::MemoryLocation::Heap ) :
nullptr;
46 for (
int patchIndex=0; patchIndex<patchData.
numberOfCells; patchIndex++) {
47 const double timeStepSize = copyOldTimeStepAndScaleWithTimeStepSize ? patchData.
dt[patchIndex] : 1.0;
50 if ( Dimensions==3 and copyOldTimeStepAndScaleWithTimeStepSize ) {
51 for (
int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
52 for (
int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
53 for (
int z = 0; z < numberOfGridCellsPerPatchPerAxis; z++)
54 for (
int unknown=0; unknown<unknowns; unknown++) {
56 patchData.
QIn[patchIndex],
59 gridCellIndex3d(x,y,z),
61 patchData.
QOut[patchIndex],
66 else if (Dimensions==3 and not copyOldTimeStepAndScaleWithTimeStepSize){
67 for (
int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
68 for (
int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
69 for (
int z = 0; z < numberOfGridCellsPerPatchPerAxis; z++)
71 for (
int unknown=0; unknown<unknowns; unknown++) {
74 gridCellIndex3d(x,y,z),
76 patchData.
QOut[patchIndex],
82 else if (Dimensions==2 and copyOldTimeStepAndScaleWithTimeStepSize) {
83 for (
int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
84 for (
int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
85 for (
int unknown=0; unknown<unknowns; unknown++) {
87 patchData.
QIn[patchIndex],
92 patchData.
QOut[patchIndex],
98 for (
int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
99 for (
int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++){
100 for (
int unknown=0; unknown<unknowns; unknown++) {
103 gridCellIndex2d(x,y),
105 patchData.
QOut[patchIndex],
196 if (Dimensions==2 and evaluateAlgebraicSource) {
197 for (
int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
198 for (
int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++) {
200 patchData.
QIn[patchIndex],
206 gridCellIndex2d(x,y),
207 patchData.
t[patchIndex],
209 patchData.
QOut[patchIndex],
214 else if (Dimensions==3 and evaluateAlgebraicSource) {
215 for (
int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
216 for (
int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
217 for (
int z = 0; z < numberOfGridCellsPerPatchPerAxis; z++) {
219 patchData.
QIn[patchIndex],
225 gridCellIndex3d(x,y,z),
226 patchData.
t[patchIndex],
228 patchData.
QOut[patchIndex],
235 if (evaluateFlux and Dimensions==2) {
236 for (
int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
237 for (
int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++) {
238 internal::computeFlux_LoopBody(
239 patchData.
QIn[patchIndex],
245 gridCellIndex2d(x,y),
246 patchData.
t[patchIndex],
253 for (
int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
254 for (
int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++) {
255 internal::computeFlux_LoopBody(
256 patchData.
QIn[patchIndex],
262 gridCellIndex2d(x,y),
263 patchData.
t[patchIndex],
270 for (
int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
271 for (
int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
272 for (
int unknown=0; unknown<unknowns; unknown++) {
274 internal::updateSolutionWithFlux_LoopBody(
275 tempFluxX, tempFluxY, tempFluxZ,
280 gridCellIndex2d(x,y),
283 *(patchData.
QOut + patchIndex),
288 else if (evaluateFlux and Dimensions==3) {
289 for (
int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
290 for (
int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
291 for (
int z = 0; z < numberOfGridCellsPerPatchPerAxis; z++) {
292 internal::computeFlux_LoopBody(
293 patchData.
QIn[patchIndex],
299 gridCellIndex3d(x,y,z),
300 patchData.
t[patchIndex],
307 for (
int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
308 for (
int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
309 for (
int z = 0; z < numberOfGridCellsPerPatchPerAxis; z++) {
310 internal::computeFlux_LoopBody(
311 patchData.
QIn[patchIndex],
317 gridCellIndex3d(x,y,z),
318 patchData.
t[patchIndex],
325 for (
int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
326 for (
int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
327 for (
int z = 0; z < numberOfGridCellsPerPatchPerAxis; z++) {
328 internal::computeFlux_LoopBody(
329 patchData.
QIn[patchIndex],
335 gridCellIndex3d(x,y,z),
336 patchData.
t[patchIndex],
344 for (
int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
345 for (
int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
346 for (
int z = 0; z < numberOfGridCellsPerPatchPerAxis; z++)
347 for (
int unknown=0; unknown<unknowns; unknown++) {
348 internal::updateSolutionWithFlux_LoopBody(
349 tempFluxX, tempFluxY, tempFluxZ,
354 gridCellIndex3d(x,y,z),
357 *(patchData.
QOut + patchIndex),
364 if (evaluateDifferentialSource and Dimensions==2) {
365 for (
int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
366 for (
int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++) {
367 internal::computeDifferentialSourceTerm_LoopBody(
368 patchData.
QIn[patchIndex],
374 gridCellIndex2d(x,y),
375 patchData.
t[patchIndex],
378 tempDifferentialSourceX,
383 for (
int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
384 for (
int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++) {
385 internal::computeDifferentialSourceTerm_LoopBody(
386 patchData.
QIn[patchIndex],
392 gridCellIndex2d(x,y),
393 patchData.
t[patchIndex],
396 tempDifferentialSourceY,
401 for (
int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
402 for (
int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
403 for (
int unknown=0; unknown<unknowns; unknown++) {
404 internal::updateSolutionWithDifferentialSourceTerm_LoopBody(
405 tempDifferentialSourceX, tempDifferentialSourceY, tempDifferentialSourceZ,
410 gridCellIndex2d(x,y),
413 *(patchData.
QOut + patchIndex),
418 else if (evaluateDifferentialSource and Dimensions==3) {
419 for (
int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
420 for (
int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
421 for (
int z = 0; z < numberOfGridCellsPerPatchPerAxis; z++) {
422 internal::computeDifferentialSourceTerm_LoopBody(
423 patchData.
QIn[patchIndex],
429 gridCellIndex3d(x,y,z),
430 patchData.
t[patchIndex],
433 tempDifferentialSourceX,
438 for (
int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
439 for (
int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
440 for (
int z = 0; z < numberOfGridCellsPerPatchPerAxis; z++) {
441 internal::computeDifferentialSourceTerm_LoopBody(
442 patchData.
QIn[patchIndex],
448 gridCellIndex3d(x,y,z),
449 patchData.
t[patchIndex],
452 tempDifferentialSourceY,
457 for (
int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
458 for (
int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
459 for (
int z = 0; z < numberOfGridCellsPerPatchPerAxis; z++) {
460 internal::computeDifferentialSourceTerm_LoopBody(
461 patchData.
QIn[patchIndex],
467 gridCellIndex3d(x,y,z),
468 patchData.
t[patchIndex],
471 tempDifferentialSourceZ,
476 for (
int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
477 for (
int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
478 for (
int z = 0; z < numberOfGridCellsPerPatchPerAxis; z++)
479 for (
int unknown=0; unknown<unknowns; unknown++) {
480 internal::updateSolutionWithDifferentialSourceTerm_LoopBody(
481 tempDifferentialSourceX, tempDifferentialSourceY, tempDifferentialSourceZ,
486 gridCellIndex3d(x,y,z),
489 *(patchData.
QOut + patchIndex),
496 if (evaluateKODissipation and Dimensions==2) {
497 for (
int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
498 for (
int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++) {
499 internal::computeKreissOligerDissipationTerm_LoopBody(
500 patchData.
QIn[patchIndex],
505 gridCellIndex2d(x,y),
506 patchData.
t[patchIndex],
513 for (
int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
514 for (
int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++) {
515 internal::computeKreissOligerDissipationTerm_LoopBody(
516 patchData.
QIn[patchIndex],
521 gridCellIndex2d(x,y),
522 patchData.
t[patchIndex],
529 for (
int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
530 for (
int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
531 for (
int unknown=0; unknown<unknowns; unknown++) {
532 internal::updateSolutionWithKODissipationTerm_LoopBody(
533 KOSigma, tempKODissipationX, tempKODissipationY, tempKODissipationZ,
538 gridCellIndex2d(x,y),
541 *(patchData.
QOut + patchIndex),
546 else if (evaluateKODissipation and Dimensions==3) {
547 for (
int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
548 for (
int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
549 for (
int z = 0; z < numberOfGridCellsPerPatchPerAxis; z++) {
550 internal::computeKreissOligerDissipationTerm_LoopBody(
551 patchData.
QIn[patchIndex],
556 gridCellIndex3d(x,y,z),
557 patchData.
t[patchIndex],
564 for (
int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
565 for (
int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
566 for (
int z = 0; z < numberOfGridCellsPerPatchPerAxis; z++) {
567 internal::computeKreissOligerDissipationTerm_LoopBody(
568 patchData.
QIn[patchIndex],
573 gridCellIndex3d(x,y,z),
574 patchData.
t[patchIndex],
581 for (
int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
582 for (
int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
583 for (
int z = 0; z < numberOfGridCellsPerPatchPerAxis; z++) {
584 internal::computeKreissOligerDissipationTerm_LoopBody(
585 patchData.
QIn[patchIndex],
590 gridCellIndex3d(x,y,z),
591 patchData.
t[patchIndex],
598 for (
int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
599 for (
int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
600 for (
int z = 0; z < numberOfGridCellsPerPatchPerAxis; z++)
601 for (
int unknown=0; unknown<unknowns; unknown++) {
602 internal::updateSolutionWithKODissipationTerm_LoopBody(
603 KOSigma, tempKODissipationX, tempKODissipationY, tempKODissipationZ,
608 gridCellIndex3d(x,y,z),
611 *(patchData.
QOut + patchIndex),
631 int numberOfGridCellsPerPatchPerAxis,
634 int auxiliaryVariables
644 for (
int patchIndex=0; patchIndex<patchData.
numberOfCells; patchIndex++) {
646 for (
int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
647 for (
int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++) {
648 internal::computeAuxiliaryVariables_LoopBody(
649 patchData.
QIn[patchIndex],
654 gridCellIndex2d(x,y),
659 for (
int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
660 for (
int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++) {
661 internal::computeAuxiliaryVariables_LoopBody(
662 patchData.
QIn[patchIndex],
667 gridCellIndex2d(x,y),
672 }
else if (Dimensions==3) {
673 for (
int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
674 for (
int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
675 for (
int z = 0; z < numberOfGridCellsPerPatchPerAxis; z++) {
676 internal::computeAuxiliaryVariables_LoopBody(
677 patchData.
QIn[patchIndex],
682 gridCellIndex3d(x,y,z),
688 for (
int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
689 for (
int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
690 for (
int z = 0; z < numberOfGridCellsPerPatchPerAxis; z++) {
691 internal::computeAuxiliaryVariables_LoopBody(
692 patchData.
QIn[patchIndex],
697 gridCellIndex3d(x,y,z),
703 for (
int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
704 for (
int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
705 for (
int z = 0; z < numberOfGridCellsPerPatchPerAxis; z++) {
706 internal::computeAuxiliaryVariables_LoopBody(
707 patchData.
QIn[patchIndex],
712 gridCellIndex3d(x,y,z),
719 if ( Dimensions==3 ) {
720 for (
int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
721 for (
int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
722 for (
int z = 0; z < numberOfGridCellsPerPatchPerAxis; z++)
723 for (
int unknown=0; unknown<unknowns; unknown++) {
725 patchData.
QIn[patchIndex],
728 gridCellIndex3d(x,y,z),
730 patchData.
QOut[patchIndex],
734 }
else if (Dimensions==2) {
735 for (
int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
736 for (
int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
737 for (
int unknown=0; unknown<unknowns; unknown++) {
739 patchData.
QIn[patchIndex],
742 gridCellIndex2d(x,y),
744 patchData.
QOut[patchIndex],