forked from stanfordhpccenter/HTR-solver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
prometeo_rhs.inl
1197 lines (1046 loc) · 48.7 KB
/
prometeo_rhs.inl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Copyright (c) "2019, by Stanford University
// Developer: Mario Di Renzo
// Affiliation: Center for Turbulence Research, Stanford University
// URL: https://ctr.stanford.edu
// Citation: Di Renzo, M., Lin, F., and Urzay, J. (2020).
// HTR solver: An open-source exascale-oriented task-based
// multi-GPU high-order code for hypersonic aerothermodynamics.
// Computer Physics Communications 255, 107262"
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "prometeo_metric.inl"
#ifndef __CUDACC__
using std::max;
using std::min;
#endif
//-----------------------------------------------------------------------------
// INLINE FUNCTIONS FOR UpdateUsingEulerFluxUtils
//-----------------------------------------------------------------------------
template<direction dir>
__CUDA_H__
void UpdateUsingEulerFluxUtils<dir>::ComputeKGSums(double * Sums,
const AccessorRO<VecNEq, 3> Conserved,
const AccessorRO<double, 3> rho,
const AccessorRO<VecNSp, 3> MassFracs,
const AccessorRO< Vec3, 3> velocity,
const AccessorRO<double, 3> pressure,
const Point<3> p,
const int nType,
const coord_t dsize,
const Rect<3> bounds) {
// TODO: implement some sort of static_if
int iN;
if (dir == Xdir) iN = 0;
else if (dir == Ydir) iN = 1;
else if (dir == Zdir) iN = 2;
const double H = (Conserved[p][irE] + pressure[p])/rho[p];
for (int l=0; l < KennedyNSum[nType]; l++) {
// offset point
const Point<3> pp = warpPeriodic<dir, Plus>(bounds, p, dsize, l+1);
const int off_l = l*(nEq+1);
// compute the summations
const double rhom = rho[p] + rho[pp];
const double vm = -(velocity[p][iN] + velocity[pp][iN]);
for (int i=0; i<nSpec; i++)
Sums[off_l+i] = rhom*vm*(MassFracs[p][i] + MassFracs[pp][i]);
for (int i=0; i<3; i++)
Sums[off_l+irU+i] = rhom*vm*(velocity[p][i] + velocity[pp][i]);
Sums[off_l+irE] = rhom*vm*(H + (Conserved[pp][irE] + pressure[pp])/rho[pp]);
Sums[off_l+nEq] = (pressure[p] + pressure[pp]);
}
}
template<direction dir>
__CUDA_H__
void UpdateUsingEulerFluxUtils<dir>::KGFluxReconstruction(double *Flux,
const double *Sums,
const AccessorRO<VecNEq, 3> Conserved,
const AccessorRO< Vec3, 3> velocity,
const AccessorRO<double, 3> pressure,
const Point<3> p,
const int nType,
const coord_t dsize,
const Rect<3> bounds) {
// TODO: implement some sort of static_if
int iN;
if (dir == Xdir) iN = 0;
else if (dir == Ydir) iN = 1;
else if (dir == Zdir) iN = 2;
if (nType == L_S_node) {
// This is a staggered node
for (int i=0; i<nEq; i++)
Flux[i] = -(Conserved[p][i]*velocity[p][iN]);
Flux[irU+iN] -= pressure[p];
Flux[irE ] -= pressure[p]*velocity[p][iN];
}
else if (nType == Rm1_S_node) {
// This is a staggered node
const Point<3> pp = warpPeriodic<dir, Plus >(bounds, p, dsize, offP1(nType));
for (int i=0; i<nEq; i++)
Flux[i] = -(Conserved[pp][i]*velocity[pp][iN]);
Flux[irU+iN] -= pressure[pp];
Flux[irE ] -= pressure[pp]*velocity[pp][iN];
}
else {
double f[nEq+1];
double acc[nEq+1];
const double * Coeff = KennedyCoeff[nType];
for (int i=0; i<nEq+1; i++) f[i] = 0.0;
for (int l=0; l<KennedyOrder[nType]; l++) {
const int off_l = l*(nEq+1);
for (int i = 0; i < nEq+1; i++) acc[i] = 0.0;
for (int m = 0; m < l+1; m++) {
const int off_m = m*3*(nEq+1);
for (int i = 0; i < nEq+1; i++)
acc[i] += Sums[off_m + off_l + i];
}
for (int i=0; i<nEq+1; i++) f[i] += Coeff[l]*acc[i];
}
for (int i=0; i<nEq; i++) Flux[i] = 0.25*f[i];
// add pressure contribution to normal momentum equation
Flux[irU+iN] -= f[nEq];
}
}
template<direction dir>
__CUDA_H__
void UpdateUsingEulerFluxUtils<dir>::KGFluxReconstruction(double * Flux,
const AccessorRO<VecNEq, 3> Conserved,
const AccessorRO<double, 3> rho,
const AccessorRO<VecNSp, 3> MassFracs,
const AccessorRO< Vec3, 3> velocity,
const AccessorRO<double, 3> pressure,
const Point<3> p,
const int nType,
const coord_t dsize,
const Rect<3> bounds) {
// TODO: implement some sort of static_if
int iN;
if (dir == Xdir) iN = 0;
else if (dir == Ydir) iN = 1;
else if (dir == Zdir) iN = 2;
// Compute points of the stencil
const Point<3> pM2 = warpPeriodic<dir, Minus>(bounds, p, dsize, offM2(nType));
const Point<3> pM1 = warpPeriodic<dir, Minus>(bounds, p, dsize, offM1(nType));
const Point<3> pP1 = warpPeriodic<dir, Plus >(bounds, p, dsize, offP1(nType));
const Point<3> pP2 = warpPeriodic<dir, Plus >(bounds, p, dsize, offP2(nType));
const Point<3> pP3 = warpPeriodic<dir, Plus >(bounds, p, dsize, offP3(nType));
// Define common arrays
const double rhov[] = {rho[pM2], rho[pM1], rho[p ],
rho[pP1], rho[pP2], rho[pP3]};
// Put a minus here remembering that flux are on the RHS
const double vNorm[] = {-velocity[pM2][iN], -velocity[pM1][iN], -velocity[p ][iN],
-velocity[pP1][iN], -velocity[pP2][iN], -velocity[pP3][iN]};
// Species fluxes
__UNROLL__
for (int i=0; i<nSpec; i++) {
const double phi[] = {MassFracs[pM2][i], MassFracs[pM1][i], MassFracs[p ][i],
MassFracs[pP1][i], MassFracs[pP2][i], MassFracs[pP3][i]};
Flux[i] = KennedyReconstruct(rhov, vNorm, phi, nType);
}
// Momentum fluxes
__UNROLL__
for (int i=0; i<3; i++) {
const double phi[] = {velocity[pM2][i], velocity[pM1][i], velocity[p ][i],
velocity[pP1][i], velocity[pP2][i], velocity[pP3][i]};
Flux[irU+i] = KennedyReconstruct(rhov, vNorm, phi, nType);
}
{
const double phi[] ={pressure[pM2], pressure[pM1], pressure[p ],
pressure[pP1], pressure[pP2], pressure[pP3]};
Flux[irU+iN] -= KennedyReconstruct(phi, nType);
}
// Energy flux
{
const double phi[] = {(Conserved[pM2][irE] + pressure[pM2])/rho[pM2],
(Conserved[pM1][irE] + pressure[pM1])/rho[pM1],
(Conserved[p ][irE] + pressure[p ])/rho[p ],
(Conserved[pP1][irE] + pressure[pP1])/rho[pP1],
(Conserved[pP2][irE] + pressure[pP2])/rho[pP2],
(Conserved[pP3][irE] + pressure[pP3])/rho[pP3]};
Flux[irE] = KennedyReconstruct(rhov, vNorm, phi, nType);
}
}
template<direction dir>
__CUDA_H__
const typename UpdateUsingEulerFluxUtils<dir>::RoeAveragesStruct UpdateUsingEulerFluxUtils<dir>::ComputeRoeAverages(
const Mix &mix,
const double *ConservedL, const double *ConservedR,
const double *YiL, const double *YiR,
const double TL, const double TR,
const double pressureL, const double pressureR,
const double *velocityL, const double *velocityR,
const double rhoL, const double rhoR) {
// Compute quantities on the left (L) and right (R) states
const double MixWL = GetMolarWeightFromYi(YiL, mix);
const double MixWR = GetMolarWeightFromYi(YiR, mix);
const double gammaL = GetGamma(TL, MixWL, YiL, mix);
const double gammaR = GetGamma(TR, MixWR, YiR, mix);
/*const*/ double dpdrhoiL[nSpec]; Getdpdrhoi(dpdrhoiL, gammaL, TL, YiL, mix);
/*const*/ double dpdrhoiR[nSpec]; Getdpdrhoi(dpdrhoiR, gammaR, TR, YiR, mix);
const double dpdeL = Getdpde(rhoL, gammaL, mix);
const double dpdeR = Getdpde(rhoR, gammaR, mix);
const double TotalEnergyL = ConservedL[irE]/rhoL;
const double TotalEnergyR = ConservedR[irE]/rhoR;
const double TotalEnthalpyL = TotalEnergyL + pressureL/rhoL;
const double TotalEnthalpyR = TotalEnergyR + pressureR/rhoR;
// Compute Roe averaged state
RoeAveragesStruct avgs;
const double RoeFactorL = sqrt(rhoL)/(sqrt(rhoL) + sqrt(rhoR));
const double RoeFactorR = sqrt(rhoR)/(sqrt(rhoL) + sqrt(rhoR));
avgs.rho = sqrt(rhoL*rhoR);
__UNROLL__
for (int i=0; i<nSpec; i++)
avgs.Yi[i] = YiL[i]*RoeFactorL + YiR[i]*RoeFactorR;
__UNROLL__
for (int i=0; i<3; i++)
avgs.velocity[i] = velocityL[i]*RoeFactorL + velocityR[i]*RoeFactorR;
avgs.H = TotalEnthalpyL*RoeFactorL + TotalEnthalpyR*RoeFactorR;
avgs.E = TotalEnergyL*RoeFactorL + TotalEnergyR*RoeFactorR;
double dpdrhoiRoe[nSpec];
__UNROLL__
for (int i=0; i<nSpec; i++)
dpdrhoiRoe[i] = dpdrhoiL[i]*RoeFactorL + dpdrhoiR[i]*RoeFactorR;
const double dpdeRoe = dpdeL*RoeFactorL + dpdeR*RoeFactorR;
// correct the pressure derivatives in order to satisfy the pressure jump condition
// using the procedure in Shuen, Liou and Leer (1990)
const double dp = pressureR - pressureL;
const double de = TotalEnergyR - 0.5*dot(velocityR, velocityR)
-(TotalEnergyL - 0.5*dot(velocityL, velocityL));
double drhoi[nSpec];
__UNROLL__
for (int i=0; i<nSpec; i++)
drhoi[i] = ConservedR[i] - ConservedL[i];
// find the error in the pressure jump due to Roe averages
double dpError = dp - de*dpdeRoe;
double fact = de*dpdeRoe; fact *= fact;
__UNROLL__
for (int i=0; i<nSpec; i++)
dpError -= drhoi[i]*dpdrhoiRoe[i];
__UNROLL__
for (int i=0; i<nSpec; i++) {
const double dpi = drhoi[i]*dpdrhoiRoe[i];
fact += dpi*dpi;
}
// correct pressure derivatives
// this threshold should not be affect the solution since fact is zero when all the jumps are zero
fact = dpError/max(fact, 1e-6);
__UNROLL__
for (int i=0; i<nSpec; i++)
avgs.dpdrhoi[i] = dpdrhoiRoe[i]*(1.0 + dpdrhoiRoe[i]*drhoi[i]*fact);
avgs.dpde = dpdeRoe*(1.0 + dpdeRoe*de*fact);
// compute the Roe averaged speed of sound
double PovRhoRoe = avgs.H - avgs.E;
avgs.a2 = PovRhoRoe/avgs.rho*avgs.dpde;
__UNROLL__
for (int i=0; i<nSpec; i++)
avgs.a2 += avgs.Yi[i]*avgs.dpdrhoi[i];
avgs.a = sqrt(avgs.a2);
return avgs;
}
template<direction dir>
__CUDA_H__
void UpdateUsingEulerFluxUtils<dir>::computeLeftEigenvectors(double *L, const RoeAveragesStruct &avgs) {
// TODO: implement some sort of static_if
int iN; int iT1; int iT2;
if (dir == Xdir) { iN = 0; iT1 = 1; iT2 = 2; }
else if (dir == Ydir) { iN = 1; iT1 = 0; iT2 = 2; }
else if (dir == Zdir) { iN = 2; iT1 = 0; iT2 = 1; }
// initialize L
__UNROLL__
for (int i = 0; i<nEq*nEq; i++) L[i] = 0.0;
// Compute constants
const double iaRoe = 1.0/avgs.a;
const double iaRoe2 = 1.0/avgs.a2;
const double Coeff = (avgs.E - dot(avgs.velocity, avgs.velocity))*avgs.dpde/avgs.rho;
double b[nSpec];
__UNROLL__
for (int i=0; i<nSpec; i++)
b[i] = (Coeff - avgs.dpdrhoi[i])*iaRoe2;
const double d = avgs.dpde/(avgs.rho*avgs.a2);
const double c[] = {avgs.velocity[0]*d,
avgs.velocity[1]*d,
avgs.velocity[2]*d};
// First row
{
__UNROLL__
for (int j=0; j<nSpec; j++)
// 0*nEq + j
L[j] = -0.5*(b[j] - avgs.velocity[iN]*iaRoe);
__UNROLL__
for (int j=0; j<3; j++)
L[ nSpec+j] = -0.5*c[j];
L[ nSpec+iN] -= 0.5*iaRoe;
L[ nSpec+3 ] = 0.5*d;
}
// From 1 to nSpec
__UNROLL__
for (int i=1; i<nSpec+1; i++) {
const int row = i*nEq;
__UNROLL__
for (int j=0; j<nSpec; j++)
L[row+j] = avgs.Yi[i-1]*b[j];
L[row+i-1] += 1.0;
__UNROLL__
for (int j=0; j<3; j++)
L[row+nSpec+j] = avgs.Yi[i-1]*c[j];
L[row+nSpec+3] = -avgs.Yi[i-1]*d;
}
// nSpec + 1
{
const int row = (nSpec+1)*nEq;
__UNROLL__
for (int j=0; j<nSpec; j++)
L[row+j] = - avgs.velocity[iT1];
// L[row+nSpec+iN] = 0.0;
L[row+nSpec+iT1] = 1.0;
//L[row+nSpec+iT2] = 0.0;
//L[row+nSpec+ 3] = 0.0;
}
// nSpec + 2
{
const int row = (nSpec+2)*nEq;
__UNROLL__
for (int j=0; j<nSpec; j++)
L[row+j] = - avgs.velocity[iT2];
//L[row+nSpec+iN] = 0.0;
//L[row+nSpec+iT1] = 0.0;
L[row+nSpec+iT2] = 1.0;
//L[row+nSpec+ 3] = 0.0;
}
// nSpec+3
{
const int row = (nSpec+3)*nEq;
__UNROLL__
for (int j=0; j<nSpec; j++)
// (nEq-1)*nEq + j
L[row+j] = -0.5*(b[j] + avgs.velocity[iN]*iaRoe);
__UNROLL__
for (int j=0; j<3; j++)
L[row+nSpec+j] = -0.5*c[j];
L[row+nSpec+iN] += 0.5*iaRoe;
L[row+nSpec+3 ] = 0.5*d;
}
}
template<direction dir>
__CUDA_H__
void UpdateUsingEulerFluxUtils<dir>::computeRightEigenvectors(double *K, const RoeAveragesStruct &avgs) {
// TODO: implement some sort of static_if
int iN; int iT1; int iT2;
if (dir == Xdir) { iN = 0; iT1 = 1; iT2 = 2; }
else if (dir == Ydir) { iN = 1; iT1 = 0; iT2 = 2; }
else if (dir == Zdir) { iN = 2; iT1 = 0; iT2 = 1; }
// initialize K
__UNROLL__
for (int i = 0; i<nEq*nEq; i++) K[i] = 0.0;
// fill K
__UNROLL__
for (int i = 0; i<nSpec; i++) {
const int row = i*nEq;
K[row + 0] = avgs.Yi[i];
K[row + i+1] = 1.0;
K[row + nSpec+3] = avgs.Yi[i];
}
{
const int row = (nSpec+iN)*nEq;
K[row + 0] = avgs.velocity[iN] - avgs.a;
__UNROLL__
for (int i = 0; i<nSpec; i++)
K[row + i+1] = avgs.velocity[iN];
//K[row + nSpec+1] = 0.0;
//K[row + nSpec+2] = 0.0;
K[row + nSpec+3] = avgs.velocity[iN] + avgs.a;
}
{
const int row = (nSpec+iT1)*nEq;
K[row + 0] = avgs.velocity[iT1];
__UNROLL__
for (int i = 0; i<nSpec; i++)
K[row + i+1] = avgs.velocity[iT1];
K[row + nSpec+1] = 1.0;
//K[row + nSpec+2] = 0.0;
K[row + nSpec+3] = avgs.velocity[iT1];
}
{
const int row = (nSpec+iT2)*nEq;
K[row + 0] = avgs.velocity[iT2];
__UNROLL__
for (int i = 0; i<nSpec; i++)
K[row + i+1] = avgs.velocity[iT2];
//K[row + nSpec+1] = 0.0;
K[row + nSpec+2] = 1.0;
K[row + nSpec+3] = avgs.velocity[iT2];
}
{
const int row = (nSpec+3)*nEq;
K[row + 0] = avgs.H - avgs.velocity[iN]*avgs.a;
const double dedp = 1.0/avgs.dpde;
__UNROLL__
for (int i = 0; i<nSpec; i++)
K[row + i+1] = avgs.E - avgs.rho*avgs.dpdrhoi[i]*dedp;
K[row + nSpec+1] = avgs.velocity[iT1];
K[row + nSpec+2] = avgs.velocity[iT2];
K[row + nSpec+3] = avgs.H + avgs.velocity[iN]*avgs.a;
}
}
template<direction dir>
__CUDA_H__
void UpdateUsingEulerFluxUtils<dir>::getPlusMinusFlux(double *FluxP, double *FluxM,
const double *L,
const double *Conserved,
const double velocity,
const double pressure,
const double Lam1,
const double Lam,
const double LamN) {
// TODO: implement some sort of static_if
int iN;
if (dir == Xdir) iN = 0;
else if (dir == Ydir) iN = 1;
else if (dir == Zdir) iN = 2;
// Compute the Euler fluxes
double Flux[nEq];
__UNROLL__
for (int i=0; i<nEq; i++)
Flux[i] = Conserved[i]*velocity;
Flux[irU+iN] += pressure;
Flux[irE ] += pressure*velocity;
// Project in the characteristic space
double Q[nEq]; MatMul<nEq>(L, Conserved, Q);
double F[nEq]; MatMul<nEq>(L, Flux, F);
// Plus fluxes
FluxP[ 0] = F[ 0] + Lam1*Q[ 0];
__UNROLL__
for (int i=1; i < nEq-1; i++) FluxP[i] = F[i] + Lam*Q[i];
FluxP[nEq-1] = F[nEq-1] + LamN*Q[nEq-1];
// Minus fluxes
FluxM[ 0] = F[ 0] - Lam1*Q[ 0];
__UNROLL__
for (int i=1; i < nEq-1; i++) FluxM[i] = F[i] - Lam*Q[i];
FluxM[nEq-1] = F[nEq-1] - LamN*Q[nEq-1];
}
template<direction dir>
__CUDA_H__
void UpdateUsingEulerFluxUtils<dir>::TENOFluxReconstruction(double *Flux,
const AccessorRO<VecNEq, 3> Conserved,
const AccessorRO<double, 3> SoS,
const AccessorRO<double, 3> rho,
const AccessorRO< Vec3, 3> velocity,
const AccessorRO<double, 3> pressure,
const AccessorRO<VecNSp, 3> MassFracs,
const AccessorRO<double, 3> temperature,
const Point<3> p,
const int nType,
const Mix &mix,
const coord_t dsize,
const Rect<3> bounds) {
// TODO: implement some sort of static_if
int iN;
if (dir == Xdir) iN = 0;
else if (dir == Ydir) iN = 1;
else if (dir == Zdir) iN = 2;
// Compute points of the stencil
const Point<3> pM2 = warpPeriodic<dir, Minus>(bounds, p, dsize, offM2(nType));
const Point<3> pM1 = warpPeriodic<dir, Minus>(bounds, p, dsize, offM1(nType));
const Point<3> pP1 = warpPeriodic<dir, Plus >(bounds, p, dsize, offP1(nType));
const Point<3> pP2 = warpPeriodic<dir, Plus >(bounds, p, dsize, offP2(nType));
const Point<3> pP3 = warpPeriodic<dir, Plus >(bounds, p, dsize, offP3(nType));
// Compute maximum eigenvalues
const double Lam1 = max(max(max(max(max(
fabs(velocity[pM2][iN] - SoS[pM2]),
fabs(velocity[pM1][iN] - SoS[pM1])),
fabs(velocity[p ][iN] - SoS[p ])),
fabs(velocity[pP1][iN] - SoS[pP1])),
fabs(velocity[pP2][iN] - SoS[pP2])),
fabs(velocity[pP3][iN] - SoS[pP3]));
const double Lam = max(max(max(max(max(
fabs(velocity[pM2][iN]),
fabs(velocity[pM1][iN])),
fabs(velocity[p ][iN])),
fabs(velocity[pP1][iN])),
fabs(velocity[pP2][iN])),
fabs(velocity[pP3][iN]));
const double LamN = max(max(max(max(max(
fabs(velocity[pM2][iN] + SoS[pM2]),
fabs(velocity[pM1][iN] + SoS[pM1])),
fabs(velocity[p ][iN] + SoS[p ])),
fabs(velocity[pP1][iN] + SoS[pP1])),
fabs(velocity[pP2][iN] + SoS[pP2])),
fabs(velocity[pP3][iN] + SoS[pP3]));
// Compute the RoeAverages
const RoeAveragesStruct RoeAvgs = ComputeRoeAverages(mix,
Conserved[p].v, Conserved[pP1].v,
MassFracs[p].v, MassFracs[pP1].v,
temperature[p] , temperature[pP1],
pressure[p] , pressure[pP1],
velocity[p].v, velocity[pP1].v,
rho[p] , rho[pP1]);
// Compute left eigenvector matrix
double K[nEq*nEq]; computeLeftEigenvectors(K, RoeAvgs);
// Compute +/- fluxes
double FluxPM2[nEq]; double FluxMM2[nEq]; getPlusMinusFlux(FluxPM2, FluxMM2, K, Conserved[pM2].v, velocity[pM2][iN], pressure[pM2], Lam1, Lam, LamN);
double FluxPM1[nEq]; double FluxMM1[nEq]; getPlusMinusFlux(FluxPM1, FluxMM1, K, Conserved[pM1].v, velocity[pM1][iN], pressure[pM1], Lam1, Lam, LamN);
double FluxP [nEq]; double FluxM [nEq]; getPlusMinusFlux(FluxP , FluxM , K, Conserved[p ].v, velocity[p ][iN], pressure[p ], Lam1, Lam, LamN);
double FluxPP1[nEq]; double FluxMP1[nEq]; getPlusMinusFlux(FluxPP1, FluxMP1, K, Conserved[pP1].v, velocity[pP1][iN], pressure[pP1], Lam1, Lam, LamN);
double FluxPP2[nEq]; double FluxMP2[nEq]; getPlusMinusFlux(FluxPP2, FluxMP2, K, Conserved[pP2].v, velocity[pP2][iN], pressure[pP2], Lam1, Lam, LamN);
double FluxPP3[nEq]; double FluxMP3[nEq]; getPlusMinusFlux(FluxPP3, FluxMP3, K, Conserved[pP3].v, velocity[pP3][iN], pressure[pP3], Lam1, Lam, LamN);
// Reconstruct Fluxes
double FPlus[nEq];
__UNROLL__
for (int i=0; i<nEq; i++)
FPlus[i] = TENOreconstructionPlus(FluxPM2[i], FluxPM1[i], FluxP [i],
FluxPP1[i], FluxPP2[i], FluxPP3[i], nType);
double FMinus[nEq];
__UNROLL__
for (int i=0; i<nEq; i++)
FMinus[i] = TENOreconstructionMinus(FluxMM2[i], FluxMM1[i], FluxM [i],
FluxMP1[i], FluxMP2[i], FluxMP3[i], nType);
double F[nEq];
__UNROLL__
for (int i=0; i<nEq; i++)
F[i] = -0.5*(FPlus[i] + FMinus[i]);
// Compute right eigenvector matrix
computeRightEigenvectors(K, RoeAvgs);
// Go back to the physical space
MatMul<nEq>(K, F, Flux);
}
template<direction dir>
__CUDA_H__
void UpdateUsingEulerFluxUtils<dir>::TENOAFluxReconstruction(double *Flux,
const AccessorRO<VecNEq, 3> Conserved,
const AccessorRO<double, 3> SoS,
const AccessorRO<double, 3> rho,
const AccessorRO< Vec3, 3> velocity,
const AccessorRO<double, 3> pressure,
const AccessorRO<VecNSp, 3> MassFracs,
const AccessorRO<double, 3> temperature,
const Point<3> p,
const int nType,
const Mix &mix,
const coord_t dsize,
const Rect<3> bounds) {
// TODO: implement some sort of static_if
int iN;
if (dir == Xdir) iN = 0;
else if (dir == Ydir) iN = 1;
else if (dir == Zdir) iN = 2;
// Compute points of the stencil
const Point<3> pM2 = warpPeriodic<dir, Minus>(bounds, p, dsize, offM2(nType));
const Point<3> pM1 = warpPeriodic<dir, Minus>(bounds, p, dsize, offM1(nType));
const Point<3> pP1 = warpPeriodic<dir, Plus >(bounds, p, dsize, offP1(nType));
const Point<3> pP2 = warpPeriodic<dir, Plus >(bounds, p, dsize, offP2(nType));
const Point<3> pP3 = warpPeriodic<dir, Plus >(bounds, p, dsize, offP3(nType));
// Compute maximum eigenvalues
const double Lam1 = max(max(max(max(max(
fabs(velocity[pM2][iN] - SoS[pM2]),
fabs(velocity[pM1][iN] - SoS[pM1])),
fabs(velocity[p ][iN] - SoS[p ])),
fabs(velocity[pP1][iN] - SoS[pP1])),
fabs(velocity[pP2][iN] - SoS[pP2])),
fabs(velocity[pP3][iN] - SoS[pP3]));
const double Lam = max(max(max(max(max(
fabs(velocity[pM2][iN]),
fabs(velocity[pM1][iN])),
fabs(velocity[p ][iN])),
fabs(velocity[pP1][iN])),
fabs(velocity[pP2][iN])),
fabs(velocity[pP3][iN]));
const double LamN = max(max(max(max(max(
fabs(velocity[pM2][iN] + SoS[pM2]),
fabs(velocity[pM1][iN] + SoS[pM1])),
fabs(velocity[p ][iN] + SoS[p ])),
fabs(velocity[pP1][iN] + SoS[pP1])),
fabs(velocity[pP2][iN] + SoS[pP2])),
fabs(velocity[pP3][iN] + SoS[pP3]));
// Compute the RoeAverages
const RoeAveragesStruct RoeAvgs = ComputeRoeAverages(mix,
Conserved[p].v, Conserved[pP1].v,
MassFracs[p].v, MassFracs[pP1].v,
temperature[p] , temperature[pP1],
pressure[p] , pressure[pP1],
velocity[p].v, velocity[pP1].v,
rho[p] , rho[pP1]);
// Compute left eigenvector matrix
double K[nEq*nEq]; computeLeftEigenvectors(K, RoeAvgs);
// Compute +/- fluxes
double FluxPM2[nEq]; double FluxMM2[nEq]; getPlusMinusFlux(FluxPM2, FluxMM2, K, Conserved[pM2].v, velocity[pM2][iN], pressure[pM2], Lam1, Lam, LamN);
double FluxPM1[nEq]; double FluxMM1[nEq]; getPlusMinusFlux(FluxPM1, FluxMM1, K, Conserved[pM1].v, velocity[pM1][iN], pressure[pM1], Lam1, Lam, LamN);
double FluxP [nEq]; double FluxM [nEq]; getPlusMinusFlux(FluxP , FluxM , K, Conserved[p ].v, velocity[p ][iN], pressure[p ], Lam1, Lam, LamN);
double FluxPP1[nEq]; double FluxMP1[nEq]; getPlusMinusFlux(FluxPP1, FluxMP1, K, Conserved[pP1].v, velocity[pP1][iN], pressure[pP1], Lam1, Lam, LamN);
double FluxPP2[nEq]; double FluxMP2[nEq]; getPlusMinusFlux(FluxPP2, FluxMP2, K, Conserved[pP2].v, velocity[pP2][iN], pressure[pP2], Lam1, Lam, LamN);
double FluxPP3[nEq]; double FluxMP3[nEq]; getPlusMinusFlux(FluxPP3, FluxMP3, K, Conserved[pP3].v, velocity[pP3][iN], pressure[pP3], Lam1, Lam, LamN);
// Reconstruct Fluxes
double FPlus[nEq];
__UNROLL__
for (int i=0; i<nEq; i++)
FPlus[i] = TENOAreconstructionPlus(FluxPM2[i], FluxPM1[i], FluxP [i],
FluxPP1[i], FluxPP2[i], FluxPP3[i], nType);
double FMinus[nEq];
__UNROLL__
for (int i=0; i<nEq; i++)
FMinus[i] = TENOAreconstructionMinus(FluxMM2[i], FluxMM1[i], FluxM [i],
FluxMP1[i], FluxMP2[i], FluxMP3[i], nType);
double F[nEq];
__UNROLL__
for (int i=0; i<nEq; i++)
F[i] = -0.5*(FPlus[i] + FMinus[i]);
// Compute right eigenvector matrix
computeRightEigenvectors(K, RoeAvgs);
// Go back to the physical space
MatMul<nEq>(K, F, Flux);
}
//-----------------------------------------------------------------------------
// INLINE FUNCTIONS FOR UpdateUsingDiffusionFluxTask
//-----------------------------------------------------------------------------
template<>
__CUDA_H__
inline void UpdateUsingDiffusionFluxTask<Xdir>::GetSigma(
double *sigma, const int nType, const double m_s,
const AccessorRO<double, 3> mu,
const AccessorRO< Vec3, 3> velocity,
const AccessorRO< Vec3, 3> vGradY,
const AccessorRO< Vec3, 3> vGradZ,
const Point<3> p, const Point<3> pp1) {
const double mu_s = Interp2Staggered(nType, mu[p], mu[pp1]);
const double dUdX_s = m_s*(velocity[pp1][0] - velocity[p][0]);
const double dVdX_s = m_s*(velocity[pp1][1] - velocity[p][1]);
const double dWdX_s = m_s*(velocity[pp1][2] - velocity[p][2]);
const double dUdY_s = Interp2Staggered(nType, vGradY[p][0], vGradY[pp1][0]);
const double dVdY_s = Interp2Staggered(nType, vGradY[p][1], vGradY[pp1][1]);
const double dUdZ_s = Interp2Staggered(nType, vGradZ[p][0], vGradZ[pp1][0]);
const double dWdZ_s = Interp2Staggered(nType, vGradZ[p][2], vGradZ[pp1][2]);
sigma[0] = mu_s*(4*dUdX_s - 2*dVdY_s - 2*dWdZ_s)/3;
sigma[1] = mu_s*(dVdX_s+dUdY_s);
sigma[2] = mu_s*(dWdX_s+dUdZ_s);
}
template<>
__CUDA_H__
inline void UpdateUsingDiffusionFluxTask<Ydir>::GetSigma(
double *sigma, const int nType, const double m_s,
const AccessorRO<double, 3> mu,
const AccessorRO< Vec3, 3> velocity,
const AccessorRO< Vec3, 3> vGradX,
const AccessorRO< Vec3, 3> vGradZ,
const Point<3> p, const Point<3> pp1) {
const double mu_s = Interp2Staggered(nType, mu[p], mu[pp1]);
const double dUdY_s = m_s*(velocity[pp1][0] - velocity[p][0]);
const double dVdY_s = m_s*(velocity[pp1][1] - velocity[p][1]);
const double dWdY_s = m_s*(velocity[pp1][2] - velocity[p][2]);
const double dUdX_s = Interp2Staggered(nType, vGradX[p][0], vGradX[pp1][0]);
const double dVdX_s = Interp2Staggered(nType, vGradX[p][1], vGradX[pp1][1]);
const double dVdZ_s = Interp2Staggered(nType, vGradZ[p][1], vGradZ[pp1][1]);
const double dWdZ_s = Interp2Staggered(nType, vGradZ[p][2], vGradZ[pp1][2]);
sigma[0] = mu_s*(dUdY_s+dVdX_s);
sigma[1] = mu_s*(4*dVdY_s - 2*dUdX_s - 2*dWdZ_s)/3;
sigma[2] = mu_s*(dWdY_s+dVdZ_s);
}
template<>
__CUDA_H__
inline void UpdateUsingDiffusionFluxTask<Zdir>::GetSigma(
double *sigma, const int nType, const double m_s,
const AccessorRO<double, 3> mu,
const AccessorRO< Vec3, 3> velocity,
const AccessorRO< Vec3, 3> vGradX,
const AccessorRO< Vec3, 3> vGradY,
const Point<3> p, const Point<3> pp1) {
const double mu_s = Interp2Staggered(nType, mu[p], mu[pp1]);
const double dUdZ_s = m_s*(velocity[pp1][0] - velocity[p][0]);
const double dVdZ_s = m_s*(velocity[pp1][1] - velocity[p][1]);
const double dWdZ_s = m_s*(velocity[pp1][2] - velocity[p][2]);
const double dUdX_s = Interp2Staggered(nType, vGradX[p][0], vGradX[pp1][0]);
const double dWdX_s = Interp2Staggered(nType, vGradX[p][2], vGradX[pp1][2]);
const double dVdY_s = Interp2Staggered(nType, vGradY[p][1], vGradY[pp1][1]);
const double dWdY_s = Interp2Staggered(nType, vGradY[p][2], vGradY[pp1][2]);
sigma[0] = mu_s*(dUdZ_s+dWdX_s);
sigma[1] = mu_s*(dVdZ_s+dWdY_s);
sigma[2] = mu_s*(4*dWdZ_s - 2*dUdX_s - 2*dVdY_s)/3;
}
template<direction dir>
__CUDA_H__
inline void UpdateUsingDiffusionFluxTask<dir>::GetDiffusionFlux(
double *Flux, const int nType, const double m_s, const Mix &mix,
const AccessorRO<double, 3> rho,
const AccessorRO<double, 3> mu,
const AccessorRO<double, 3> lam,
const AccessorRO<VecNSp, 3> Di,
const AccessorRO<double, 3> temperature,
const AccessorRO< Vec3, 3> velocity,
const AccessorRO<VecNSp, 3> Xi,
const AccessorRO<VecNEq, 3> rhoYi,
const AccessorRO< Vec3, 3> vGradY,
const AccessorRO< Vec3, 3> vGradZ,
const Point<3> p,
const coord_t size,
const Rect<3> bounds) {
// access i+1 point (warp around boundaries)
const Point<3> pp1 = warpPeriodic<dir, Plus>(bounds, p, size, 1);
// Mixture properties at the staggered location
const double rho_s = Interp2Staggered(nType, rho[p], rho[pp1]);
const double iMixW_s = 1.0/Interp2Staggered(nType, GetMolarWeightFromXi(Xi.ptr(p )->v, mix),
GetMolarWeightFromXi(Xi.ptr(pp1)->v, mix));
// Primitive and conserved variables at the staggered location
const double T_s = Interp2Staggered(nType, temperature[p], temperature[pp1]);
const double vel_s[] = {Interp2Staggered(nType, velocity[p][0], velocity[pp1][0]),
Interp2Staggered(nType, velocity[p][1], velocity[pp1][1]),
Interp2Staggered(nType, velocity[p][2], velocity[pp1][2])};
// Viscous stress
double sigma[3]; GetSigma(sigma, nType, m_s, mu, velocity, vGradY, vGradZ, p, pp1);
// Assemble the fluxes
const double uSigma = dot(vel_s, sigma);
double heatFlux = Interp2Staggered(nType, lam[p], lam[pp1])*m_s*(temperature[p] - temperature[pp1]);
// Species diffusion velocity
double YiVi[nSpec];
double ViCorr = 0.0;
__UNROLL__
for (int i=0; i<nSpec; i++) {
YiVi[i] = Interp2Staggered(nType, Di[p][i], Di[pp1][i])*
m_s*(Xi[p][i] - Xi[pp1][i])*
GetSpeciesMolarWeight(i, mix)*iMixW_s;
ViCorr += YiVi[i];
}
// Partial Densities Fluxes
__UNROLL__
for (int i=0; i<nSpec; i++) {
const double rhoYiVi = rho_s*YiVi[i] - ViCorr*Interp2Staggered(nType, rhoYi[p][i], rhoYi[pp1][i]);
Flux[i] = -rhoYiVi;
heatFlux += rhoYiVi*GetSpeciesEnthalpy(i, T_s, mix);
}
// Momentum Flux
__UNROLL__
for (int i=0; i<3; i++)
Flux[irU+i] = sigma[i];
// Energy Flux
Flux[irE] = (uSigma - heatFlux);
}
//-----------------------------------------------------------------------------
// INLINE FUNCTIONS FOR UpdateUsingFluxNSCBCInflowTask
//-----------------------------------------------------------------------------
template<direction dir>
__CUDA_H__
void UpdateUsingFluxNSCBCInflowMinusSideTask<dir>::addLODIfluxes(double *RHS,
const AccessorRO<VecNSp, 3> MassFracs,
const AccessorRO<double, 3> pressure,
const double SoS,
const double rho,
const double T,
const double *velocity,
const double *vGrad,
const double *dudt,
const double dTdt,
const Point<3> p,
const int nType,
const double m,
const Mix &mix) {
// TODO: implement some sort of static_if
const int iN = (dir == Xdir) ? 0 :
(dir == Ydir) ? 1 :
/*(dir == Zdir) ?*/ 2;
if (velocity[iN] >= SoS) {
// Supersonic inlet
__UNROLL__
for (int l=0; l<nEq; l++)
RHS[l] = 0.0;
}
else {
// Subsonic inlet (add NSCBC fluxes)
const Point<3> p_int = (dir == Xdir) ? Point<3>(p.x+1, p.y , p.z ) :
(dir == Ydir) ? Point<3>(p.x , p.y+1, p.z ) :
/*(dir == Ydir) ?*/Point<3>(p.x , p.y , p.z+1);
// Thermo-chemical quantities
const double MixW_bnd = GetMolarWeightFromYi(MassFracs[p].v, mix);
const double Cp_bnd = GetHeatCapacity(T, MassFracs[p].v, mix);
// characteristic velocity leaving the domain
const double lambda_1 = velocity[iN] - SoS;
// characteristic velocity entering the domain
const double lambda = velocity[iN];
// compute waves amplitudes
const double dp_dn = getDerivLeftBC(nType, pressure[p], pressure[p_int], m);
const double du_dn = vGrad[iN];
double dY_dn[nSpec];
__UNROLL__
for (int s=0; s<nSpec; s++)
dY_dn[s] = getDerivLeftBC(nType, MassFracs[p][s], MassFracs[p_int][s], m);
const double L1 = lambda_1*(dp_dn - rho*SoS*du_dn);
double LS[nSpec];
__UNROLL__
for (int s=0; s<nSpec; s++)
LS[s] = lambda*dY_dn[s];
const double LN = L1 - 2*rho*SoS*dudt[iN];
double L2 = dTdt/T + (LN + L1)/(2*rho*Cp_bnd*T);
__UNROLL__
for (int s=0; s<nSpec; s++)
L2 -= MixW_bnd/GetSpeciesMolarWeight(s, mix)*LS[s];
L2 *= -rho*SoS*SoS;
// Compute LODI fluxes
const double d1 = (0.5*(L1 + LN) - L2)/(SoS*SoS);
// Update the RHS
__UNROLL__
for (int s=0; s<nSpec; s++)
RHS[s] -= (d1*MassFracs[p][s] + rho*LS[s]);
}
}
template<direction dir>
__CUDA_H__
void UpdateUsingFluxNSCBCInflowPlusSideTask<dir>::addLODIfluxes(double *RHS,
const AccessorRO<VecNSp, 3> MassFracs,
const AccessorRO<double, 3> pressure,
const double SoS,
const double rho,
const double T,
const double *velocity,
const double *vGrad,
const double *dudt,
const double dTdt,
const Point<3> p,
const int nType,
const double m,
const Mix &mix) {
// TODO: implement some sort of static_if
const int iN = (dir == Xdir) ? 0 :
(dir == Ydir) ? 1 :
/*(dir == Zdir) ?*/ 2;
if (velocity[iN] <= -SoS) {
// Supersonic inlet
__UNROLL__
for (int l=0; l<nEq; l++)
RHS[l] = 0.0;
}
else {
// Subsonic inlet (add NSCBC fluxes)
const Point<3> p_int = (dir == Xdir) ? Point<3>(p.x-1, p.y , p.z ) :
(dir == Ydir) ? Point<3>(p.x , p.y-1, p.z ) :
/*(dir == Ydir) ?*/Point<3>(p.x , p.y , p.z-1);
// Thermo-chemical quantities
const double MixW_bnd = GetMolarWeightFromYi(MassFracs[p].v, mix);
const double Cp_bnd = GetHeatCapacity(T, MassFracs[p].v, mix);
// characteristic velocity leaving the domain
const double lambda_N = velocity[iN] + SoS;
// characteristic velocity entering the domain
const double lambda = velocity[iN];
// compute waves amplitudes
const double dp_dn = getDerivRightBC(nType, pressure[p_int], pressure[p], m);
const double du_dn = vGrad[iN];
double dY_dn[nSpec];
__UNROLL__
for (int s=0; s<nSpec; s++)
dY_dn[s] = getDerivRightBC(nType, MassFracs[p_int][s], MassFracs[p][s], m);
const double LN = lambda_N*(dp_dn + rho*SoS*du_dn);
double LS[nSpec];
__UNROLL__
for (int s=0; s<nSpec; s++)
LS[s] = lambda*dY_dn[s];
const double L1 = LN + 2*rho*SoS*dudt[iN];
double L2 = dTdt/T + (LN + L1)/(2*rho*Cp_bnd*T);
__UNROLL__
for (int s=0; s<nSpec; s++)
L2 -= MixW_bnd/GetSpeciesMolarWeight(s, mix)*LS[s];
L2 *= -rho*SoS*SoS;
// Compute LODI fluxes
const double d1 = (0.5*(L1 + LN) - L2)/(SoS*SoS);
// Update the RHS
__UNROLL__
for (int s=0; s<nSpec; s++)
RHS[s] -= (d1*MassFracs[p][s] + rho*LS[s]);
}
}
//-----------------------------------------------------------------------------
// INLINE FUNCTIONS FOR UpdateUsingFluxNSCBCOutflowTask
//-----------------------------------------------------------------------------
template<direction dir>
__CUDA_H__
void UpdateUsingFluxNSCBCOutflowMinusSideTask<dir>::addLODIfluxes(double *RHS,