24 bool evaluateDifferentialSource,
25 bool evaluateAlgebraicSource,
26 bool copyOldTimeStepAndScaleWithTimeStepSize,
30 const TempDataEnumerator& fluxEnumerator,
31 const TempDataEnumerator& differentialSourceEnumerator,
32 const TempDataEnumerator& KODissipationEnumerator,
36 double* tempDifferentialSourceX,
37 double* tempDifferentialSourceY,
38 double* tempDifferentialSourceZ,
39 double* tempKODissipationX,
40 double* tempKODissipationY,
41 double* tempKODissipationZ
43 const bool evaluateKODissipation = KOSigma>0.0;
46 if ( Dimensions==3 and copyOldTimeStepAndScaleWithTimeStepSize ) {
47 for (
int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
48 for (
int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
49 for (
int z = 0; z < numberOfGridCellsPerPatchPerAxis; z++)
50 for (
int unknown=0; unknown<unknowns; unknown++)
51 for (
int patchIndex=0; patchIndex<patchData.
numberOfCells; patchIndex++) {
52 const double timeStepSize = copyOldTimeStepAndScaleWithTimeStepSize ? patchData.
dt[patchIndex] : 1.0;
54 patchData.
QIn[patchIndex],
57 gridCellIndex3d(x,y,z),
59 patchData.
QOut[patchIndex],
64 else if (Dimensions==3 and not copyOldTimeStepAndScaleWithTimeStepSize){
65 for (
int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
66 for (
int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
67 for (
int z = 0; z < numberOfGridCellsPerPatchPerAxis; z++)
68 for (
int patchIndex=0; patchIndex<patchData.
numberOfCells; patchIndex++) {
69 const double timeStepSize = copyOldTimeStepAndScaleWithTimeStepSize ? patchData.
dt[patchIndex] : 1.0;
70 for (
int unknown=0; unknown<unknowns; unknown++) {
73 gridCellIndex3d(x,y,z),
75 patchData.
QOut[patchIndex],
81 else if (Dimensions==2 and copyOldTimeStepAndScaleWithTimeStepSize) {
82 for (
int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
83 for (
int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
84 for (
int unknown=0; unknown<unknowns; unknown++)
85 for (
int patchIndex=0; patchIndex<patchData.
numberOfCells; patchIndex++) {
86 const double timeStepSize = copyOldTimeStepAndScaleWithTimeStepSize ? patchData.
dt[patchIndex] : 1.0;
88 patchData.
QIn[patchIndex],
93 patchData.
QOut[patchIndex],
99 for (
int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
100 for (
int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
101 for (
int unknown=0; unknown<unknowns; unknown++)
102 for (
int patchIndex=0; patchIndex<patchData.
numberOfCells; patchIndex++) {
103 const double timeStepSize = copyOldTimeStepAndScaleWithTimeStepSize ? patchData.
dt[patchIndex] : 1.0;
106 gridCellIndex2d(x,y),
108 patchData.
QOut[patchIndex],
116 if (Dimensions==2 and evaluateAlgebraicSource) {
117 for (
int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
118 for (
int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
119 for (
int patchIndex=0; patchIndex<patchData.
numberOfCells; patchIndex++) {
120 const double timeStepSize = copyOldTimeStepAndScaleWithTimeStepSize ? patchData.
dt[patchIndex] : 1.0;
121 ::exahype2::fd::internal::addAlgebraicSourceTerm_LoopBody<Solver>(
122 patchData.
QIn[patchIndex],
127 gridCellIndex2d(x,y),
128 patchData.
t[patchIndex],
130 patchData.
QOut[patchIndex],
135 else if (Dimensions==3 and evaluateAlgebraicSource) {
136 for (
int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
137 for (
int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
138 for (
int z = 0; z < numberOfGridCellsPerPatchPerAxis; z++)
139 for (
int patchIndex=0; patchIndex<patchData.
numberOfCells; patchIndex++) {
140 const double timeStepSize = copyOldTimeStepAndScaleWithTimeStepSize ? patchData.
dt[patchIndex] : 1.0;
141 ::exahype2::fd::internal::addAlgebraicSourceTerm_LoopBody<Solver>(
142 patchData.
QIn[patchIndex],
147 gridCellIndex3d(x,y,z),
148 patchData.
t[patchIndex],
150 patchData.
QOut[patchIndex],
157 if (evaluateFlux and Dimensions==2) {
158 for (
int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
159 for (
int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
160 for (
int patchIndex=0; patchIndex<patchData.
numberOfCells; patchIndex++) {
161 const double timeStepSize = copyOldTimeStepAndScaleWithTimeStepSize ? patchData.
dt[patchIndex] : 1.0;
162 internal::computeFlux_LoopBody<Solver>(
163 patchData.
QIn[patchIndex],
168 gridCellIndex2d(x,y),
169 patchData.
t[patchIndex],
176 for (
int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
177 for (
int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
178 for (
int patchIndex=0; patchIndex<patchData.
numberOfCells; patchIndex++) {
179 const double timeStepSize = copyOldTimeStepAndScaleWithTimeStepSize ? patchData.
dt[patchIndex] : 1.0;
180 internal::computeFlux_LoopBody<Solver>(
181 patchData.
QIn[patchIndex],
186 gridCellIndex2d(x,y),
187 patchData.
t[patchIndex],
194 for (
int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
195 for (
int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
196 for (
int unknown=0; unknown<unknowns; unknown++)
197 for (
int patchIndex=0; patchIndex<patchData.
numberOfCells; patchIndex++) {
198 const double timeStepSize = copyOldTimeStepAndScaleWithTimeStepSize ? patchData.
dt[patchIndex] : 1.0;
201 tempFluxX, tempFluxY, tempFluxZ,
206 gridCellIndex2d(x,y),
209 *(patchData.
QOut + patchIndex),
214 else if (evaluateFlux and Dimensions==3) {
215 for (
int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
216 for (
int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
217 for (
int z = 0; z < numberOfGridCellsPerPatchPerAxis; z++)
218 for (
int patchIndex=0; patchIndex<patchData.
numberOfCells; patchIndex++) {
219 const double timeStepSize = copyOldTimeStepAndScaleWithTimeStepSize ? patchData.
dt[patchIndex] : 1.0;
220 internal::computeFlux_LoopBody<Solver>(
221 patchData.
QIn[patchIndex],
226 gridCellIndex3d(x,y,z),
227 patchData.
t[patchIndex],
234 for (
int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
235 for (
int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
236 for (
int z = 0; z < numberOfGridCellsPerPatchPerAxis; z++)
237 for (
int patchIndex=0; patchIndex<patchData.
numberOfCells; patchIndex++) {
238 const double timeStepSize = copyOldTimeStepAndScaleWithTimeStepSize ? patchData.
dt[patchIndex] : 1.0;
239 internal::computeFlux_LoopBody<Solver>(
240 patchData.
QIn[patchIndex],
245 gridCellIndex3d(x,y,z),
246 patchData.
t[patchIndex],
253 for (
int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
254 for (
int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
255 for (
int z = 0; z < numberOfGridCellsPerPatchPerAxis; z++)
256 for (
int patchIndex=0; patchIndex<patchData.
numberOfCells; patchIndex++) {
257 const double timeStepSize = copyOldTimeStepAndScaleWithTimeStepSize ? patchData.
dt[patchIndex] : 1.0;
258 internal::computeFlux_LoopBody<Solver>(
259 patchData.
QIn[patchIndex],
264 gridCellIndex3d(x,y,z),
265 patchData.
t[patchIndex],
273 for (
int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
274 for (
int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
275 for (
int z = 0; z < numberOfGridCellsPerPatchPerAxis; z++)
276 for (
int unknown=0; unknown<unknowns; unknown++)
277 for (
int patchIndex=0; patchIndex<patchData.
numberOfCells; patchIndex++) {
278 const double timeStepSize = copyOldTimeStepAndScaleWithTimeStepSize ? patchData.
dt[patchIndex] : 1.0;
280 tempFluxX, tempFluxY, tempFluxZ,
285 gridCellIndex3d(x,y,z),
288 *(patchData.
QOut + patchIndex),
295 if (evaluateDifferentialSource and Dimensions==2) {
296 for (
int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
297 for (
int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
298 for (
int patchIndex=0; patchIndex<patchData.
numberOfCells; patchIndex++) {
299 const double timeStepSize = copyOldTimeStepAndScaleWithTimeStepSize ? patchData.
dt[patchIndex] : 1.0;
300 internal::computeDifferentialSourceTerm_LoopBody<Solver>(
301 patchData.
QIn[patchIndex],
306 gridCellIndex2d(x,y),
307 patchData.
t[patchIndex],
310 tempDifferentialSourceX,
315 for (
int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
316 for (
int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
317 for (
int patchIndex=0; patchIndex<patchData.
numberOfCells; patchIndex++) {
318 const double timeStepSize = copyOldTimeStepAndScaleWithTimeStepSize ? patchData.
dt[patchIndex] : 1.0;
319 internal::computeDifferentialSourceTerm_LoopBody<Solver>(
320 patchData.
QIn[patchIndex],
325 gridCellIndex2d(x,y),
326 patchData.
t[patchIndex],
329 tempDifferentialSourceY,
334 for (
int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
335 for (
int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
336 for (
int unknown=0; unknown<unknowns; unknown++)
337 for (
int patchIndex=0; patchIndex<patchData.
numberOfCells; patchIndex++) {
338 const double timeStepSize = copyOldTimeStepAndScaleWithTimeStepSize ? patchData.
dt[patchIndex] : 1.0;
340 tempDifferentialSourceX, tempDifferentialSourceY, tempDifferentialSourceZ,
345 gridCellIndex2d(x,y),
348 *(patchData.
QOut + patchIndex),
353 else if (evaluateDifferentialSource and Dimensions==3) {
354 for (
int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
355 for (
int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
356 for (
int z = 0; z < numberOfGridCellsPerPatchPerAxis; z++)
357 for (
int patchIndex=0; patchIndex<patchData.
numberOfCells; patchIndex++) {
358 const double timeStepSize = copyOldTimeStepAndScaleWithTimeStepSize ? patchData.
dt[patchIndex] : 1.0;
359 internal::computeDifferentialSourceTerm_LoopBody<Solver>(
360 patchData.
QIn[patchIndex],
365 gridCellIndex3d(x,y,z),
366 patchData.
t[patchIndex],
369 tempDifferentialSourceX,
374 for (
int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
375 for (
int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
376 for (
int z = 0; z < numberOfGridCellsPerPatchPerAxis; z++)
377 for (
int patchIndex=0; patchIndex<patchData.
numberOfCells; patchIndex++) {
378 const double timeStepSize = copyOldTimeStepAndScaleWithTimeStepSize ? patchData.
dt[patchIndex] : 1.0;
379 internal::computeDifferentialSourceTerm_LoopBody<Solver>(
380 patchData.
QIn[patchIndex],
385 gridCellIndex3d(x,y,z),
386 patchData.
t[patchIndex],
389 tempDifferentialSourceY,
394 for (
int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
395 for (
int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
396 for (
int z = 0; z < numberOfGridCellsPerPatchPerAxis; z++)
397 for (
int patchIndex=0; patchIndex<patchData.
numberOfCells; patchIndex++) {
398 const double timeStepSize = copyOldTimeStepAndScaleWithTimeStepSize ? patchData.
dt[patchIndex] : 1.0;
399 internal::computeDifferentialSourceTerm_LoopBody<Solver>(
400 patchData.
QIn[patchIndex],
405 gridCellIndex3d(x,y,z),
406 patchData.
t[patchIndex],
409 tempDifferentialSourceZ,
414 for (
int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
415 for (
int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
416 for (
int z = 0; z < numberOfGridCellsPerPatchPerAxis; z++)
417 for (
int unknown=0; unknown<unknowns; unknown++)
418 for (
int patchIndex=0; patchIndex<patchData.
numberOfCells; patchIndex++) {
419 const double timeStepSize = copyOldTimeStepAndScaleWithTimeStepSize ? patchData.
dt[patchIndex] : 1.0;
421 tempDifferentialSourceX, tempDifferentialSourceY, tempDifferentialSourceZ,
426 gridCellIndex3d(x,y,z),
429 *(patchData.
QOut + patchIndex),
436 if (evaluateKODissipation and Dimensions==2) {
437 for (
int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
438 for (
int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
439 for (
int patchIndex=0; patchIndex<patchData.
numberOfCells; patchIndex++) {
440 const double timeStepSize = copyOldTimeStepAndScaleWithTimeStepSize ? patchData.
dt[patchIndex] : 1.0;
442 patchData.
QIn[patchIndex],
447 gridCellIndex2d(x,y),
448 patchData.
t[patchIndex],
455 for (
int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
456 for (
int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
457 for (
int patchIndex=0; patchIndex<patchData.
numberOfCells; patchIndex++) {
458 const double timeStepSize = copyOldTimeStepAndScaleWithTimeStepSize ? patchData.
dt[patchIndex] : 1.0;
460 patchData.
QIn[patchIndex],
465 gridCellIndex2d(x,y),
466 patchData.
t[patchIndex],
473 for (
int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
474 for (
int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
475 for (
int unknown=0; unknown<unknowns; unknown++)
476 for (
int patchIndex=0; patchIndex<patchData.
numberOfCells; patchIndex++) {
477 const double timeStepSize = copyOldTimeStepAndScaleWithTimeStepSize ? patchData.
dt[patchIndex] : 1.0;
479 KOSigma, tempKODissipationX, tempKODissipationY, tempKODissipationZ,
484 gridCellIndex2d(x,y),
487 *(patchData.
QOut + patchIndex),
492 else if (evaluateKODissipation and Dimensions==3) {
493 for (
int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
494 for (
int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
495 for (
int z = 0; z < numberOfGridCellsPerPatchPerAxis; z++)
496 for (
int patchIndex=0; patchIndex<patchData.
numberOfCells; patchIndex++) {
497 const double timeStepSize = copyOldTimeStepAndScaleWithTimeStepSize ? patchData.
dt[patchIndex] : 1.0;
499 patchData.
QIn[patchIndex],
504 gridCellIndex3d(x,y,z),
505 patchData.
t[patchIndex],
512 for (
int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
513 for (
int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
514 for (
int z = 0; z < numberOfGridCellsPerPatchPerAxis; z++)
515 for (
int patchIndex=0; patchIndex<patchData.
numberOfCells; patchIndex++) {
516 const double timeStepSize = copyOldTimeStepAndScaleWithTimeStepSize ? patchData.
dt[patchIndex] : 1.0;
518 patchData.
QIn[patchIndex],
523 gridCellIndex3d(x,y,z),
524 patchData.
t[patchIndex],
531 for (
int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
532 for (
int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
533 for (
int z = 0; z < numberOfGridCellsPerPatchPerAxis; z++)
534 for (
int patchIndex=0; patchIndex<patchData.
numberOfCells; patchIndex++) {
535 const double timeStepSize = copyOldTimeStepAndScaleWithTimeStepSize ? patchData.
dt[patchIndex] : 1.0;
537 patchData.
QIn[patchIndex],
542 gridCellIndex3d(x,y,z),
543 patchData.
t[patchIndex],
550 for (
int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
551 for (
int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
552 for (
int z = 0; z < numberOfGridCellsPerPatchPerAxis; z++)
553 for (
int unknown=0; unknown<unknowns; unknown++)
554 for (
int patchIndex=0; patchIndex<patchData.
numberOfCells; patchIndex++) {
555 const double timeStepSize = copyOldTimeStepAndScaleWithTimeStepSize ? patchData.
dt[patchIndex] : 1.0;
557 KOSigma, tempKODissipationX, tempKODissipationY, tempKODissipationZ,
562 gridCellIndex3d(x,y,z),
565 *(patchData.
QOut + patchIndex),