merge with kernels from MH's master thesis
[LbmBenchmarkKernelsPublic.git] / src / BenchKernelD3Q19.c
index bd6d43c3ac374a04f9a7dd2a60dd1f22c288ccc3..62989c89e747ff32c74fee3906a507c32ce4efa1 100644 (file)
@@ -43,8 +43,8 @@ void FNAME(D3Q19Kernel)(LatticeDesc * ld, KernelData * kernelData, CaseData * cd
        Assert(kernelData != NULL);
        Assert(cd != NULL);
 
-       Assert(cd->Omega > 0.0);
-       Assert(cd->Omega < 2.0);
+       Assert(cd->Omega > F(0.0));
+       Assert(cd->Omega < F(2.0));
 
        KernelData * kd = (KernelData *)kernelData;
 
@@ -61,20 +61,24 @@ void FNAME(D3Q19Kernel)(LatticeDesc * ld, KernelData * kernelData, CaseData * cd
 
        PdfT omega = cd->Omega;
        PdfT omegaEven = omega;
-//     PdfT omegaOdd = 8.0*((2.0-omegaEven)/(8.0-omegaEven)); //"standard" trt odd relaxation parameter
-       PdfT magicParam = 1.0/12.0;     // 1/4: best stability; 1/12: removes third-order advection error (best advection);     1/6: removes fourth-order diffusion error (best diffusion);     3/16: exact location of bounce back for poiseuille flow
-       PdfT omegaOdd = 1.0/( 0.5 + magicParam/(1.0/omega - 0.5) );
+       // PdfT omegaOdd = 8.0*((F(2.0)-omegaEven)/(8.0-omegaEven)); //"standard" trt odd relaxation parameter
+       PdfT magicParam = F(1.0) / F(12.0);
+       // 1/ 4: best stability;
+       // 1/12: removes third-order advection error (best advection);
+       // 1/ 6: removes fourth-order diffusion error (best diffusion);
+       // 3/16: exact location of bounce back for poiseuille flow
+       PdfT omegaOdd = F(1.0) / (F(0.5) + magicParam / (F(1.0) / omega - F(0.5)));
 
-       PdfT evenPart = 0.0;
-       PdfT oddPart = 0.0;
-       PdfT dir_indep_trm = 0.0;
+       PdfT evenPart = F(0.0);
+       PdfT oddPart = F(0.0);
+       PdfT dir_indep_trm = F(0.0);
 
-       PdfT w_0 = 1.0 /  3.0;
-       PdfT w_1 = 1.0 / 18.0;
-       PdfT w_2 = 1.0 / 36.0;
+       PdfT w_0 = F(1.0) / F( 3.0);
+       PdfT w_1 = F(1.0) / F(18.0);
+       PdfT w_2 = F(1.0) / F(36.0);
 
-       PdfT w_1_x3 = w_1 * 3.0;        PdfT w_1_nine_half = w_1 * 9.0/2.0;     PdfT w_1_indep = 0.0;
-       PdfT w_2_x3 = w_2 * 3.0;        PdfT w_2_nine_half = w_2 * 9.0/2.0;     PdfT w_2_indep = 0.0;
+       PdfT w_1_x3 = w_1 * F(3.0);     PdfT w_1_nine_half = w_1 * F(9.0)/F(2.0);       PdfT w_1_indep = F(0.0);
+       PdfT w_2_x3 = w_2 * F(3.0);     PdfT w_2_nine_half = w_2 * F(9.0)/F(2.0);       PdfT w_2_indep = F(0.0);
 
        PdfT ux, uy, uz, ui;
        PdfT dens;
@@ -97,12 +101,14 @@ void FNAME(D3Q19Kernel)(LatticeDesc * ld, KernelData * kernelData, CaseData * cd
        }
        #endif
 
+       X_KERNEL_START(kernelData);
+
        for (int iter = 0; iter < maxIterations; ++iter) {
 
                X_LIKWID_START("os");
 
                #ifdef _OPENMP
-               #pragma omp parallel for collapse(3) default(none) \
+               #pragma omp parallel for collapse(2) default(none) \
                                shared(gDims,src, dst, w_0, w_1, w_2, omegaEven, omegaOdd, \
                                w_1_x3, w_2_x3, w_1_nine_half, w_2_nine_half, cd, \
                                oX, oY, oZ, nX, nY, nZ) \
@@ -114,10 +120,14 @@ void FNAME(D3Q19Kernel)(LatticeDesc * ld, KernelData * kernelData, CaseData * cd
                                        pdf_B, pdf_BN, pdf_BE, pdf_BS, pdf_BW, \
                                        evenPart, oddPart, w_1_indep, w_2_indep)
                #endif
-
                for (int x = oX; x < nX + oX; ++x) {
                        for (int y = oY; y < nY + oY; ++y) {
-                               for (int z = oZ; z < nZ + oZ; ++z) {
+                               #ifdef INTEL_OPT_DIRECTIVES
+                                       #pragma ivdep
+                                       #pragma vector always
+                                       #pragma simd
+                               #endif
+                               for (int z = oZ; z < nZ + oZ; ++z) { // LOOP os
                                        #define I(x, y, z, dir) P_INDEX_5(gDims, (x), (y), (z), (dir))
 
 #ifdef PROP_MODEL_PUSH
@@ -145,9 +155,9 @@ void FNAME(D3Q19Kernel)(LatticeDesc * ld, KernelData * kernelData, CaseData * cd
                                        #ifdef LID_DRIVEN_CAVITY
 
                                        if (z == nZ - 4 + oZ && x > 3 + oX && x < (nX - 4 + oX) && y > 3 + oY  && y < (nY - 4 + oY)) {
-                                               ux = 0.1 * 0.577;
-                                               uy = 0.0;
-                                               uz = 0.0;
+                                               ux = F(0.1 * 0.577);
+                                               uy = F(0.0);
+                                               uz = F(0.0);
 
                                        } else {
                                        #endif
@@ -168,7 +178,7 @@ void FNAME(D3Q19Kernel)(LatticeDesc * ld, KernelData * kernelData, CaseData * cd
                                                        pdf_T  + pdf_TN + pdf_TE + pdf_TS + pdf_TW +
                                                        pdf_B  + pdf_BN + pdf_BE + pdf_BS + pdf_BW;
 
-                                       dir_indep_trm = dens - (ux * ux + uy * uy + uz * uz)*3.0/2.0;
+                                       dir_indep_trm = dens - (ux * ux + uy * uy + uz * uz) * F(3.0) / F(2.0);
 
 #ifdef PROP_MODEL_PUSH
 
@@ -179,20 +189,20 @@ void FNAME(D3Q19Kernel)(LatticeDesc * ld, KernelData * kernelData, CaseData * cd
                                        w_1_indep = w_1*dir_indep_trm;
 
                                        ui = uy;
-                                       evenPart = omegaEven*( 0.5*(pdf_N + pdf_S) - ui*ui*w_1_nine_half - w_1_indep );
-                                       oddPart = omegaOdd*(0.5*(pdf_N - pdf_S) - ui*w_1_x3 );
+                                       evenPart = omegaEven*( F(0.5)*(pdf_N + pdf_S) - ui*ui*w_1_nine_half - w_1_indep );
+                                       oddPart = omegaOdd*(F(0.5)*(pdf_N - pdf_S) - ui*w_1_x3 );
                                        dst[I(x, y + 1,   z, D3Q19_N)]  = pdf_N - evenPart - oddPart;
                                        dst[I(x, y - 1,   z, D3Q19_S)]  = pdf_S - evenPart + oddPart;
 
                                        ui = ux;
-                                       evenPart = omegaEven*( 0.5*(pdf_E + pdf_W) - ui*ui*w_1_nine_half - w_1_indep );
-                                       oddPart = omegaOdd*(0.5*(pdf_E - pdf_W) - ui*w_1_x3 );
+                                       evenPart = omegaEven*( F(0.5)*(pdf_E + pdf_W) - ui*ui*w_1_nine_half - w_1_indep );
+                                       oddPart = omegaOdd*(F(0.5)*(pdf_E - pdf_W) - ui*w_1_x3 );
                                        dst[I(x + 1,   y,   z, D3Q19_E)]  = pdf_E - evenPart - oddPart;
                                        dst[I(x - 1,   y,   z, D3Q19_W)]  = pdf_W - evenPart + oddPart;
 
                                        ui = uz;
-                                       evenPart = omegaEven*( 0.5*(pdf_T + pdf_B) - ui*ui*w_1_nine_half - w_1_indep );
-                                       oddPart = omegaOdd*(0.5*(pdf_T - pdf_B) - ui*w_1_x3 );
+                                       evenPart = omegaEven*( F(0.5)*(pdf_T + pdf_B) - ui*ui*w_1_nine_half - w_1_indep );
+                                       oddPart = omegaOdd*(F(0.5)*(pdf_T - pdf_B) - ui*w_1_x3 );
                                        dst[I(x,   y, z + 1, D3Q19_T)]  = pdf_T - evenPart - oddPart;
                                        dst[I(x,   y, z - 1, D3Q19_B)]  = pdf_B - evenPart + oddPart;
 
@@ -200,38 +210,38 @@ void FNAME(D3Q19Kernel)(LatticeDesc * ld, KernelData * kernelData, CaseData * cd
                                        w_2_indep = w_2*dir_indep_trm;
 
                                        ui = -ux + uy;
-                                       evenPart = omegaEven*( 0.5*(pdf_NW + pdf_SE) - ui*ui*w_2_nine_half - w_2_indep );
-                                       oddPart = omegaOdd*(0.5*(pdf_NW - pdf_SE) - ui*w_2_x3 );
+                                       evenPart = omegaEven*( F(0.5)*(pdf_NW + pdf_SE) - ui*ui*w_2_nine_half - w_2_indep );
+                                       oddPart = omegaOdd*(F(0.5)*(pdf_NW - pdf_SE) - ui*w_2_x3 );
                                        dst[I(x - 1, y + 1,   z, D3Q19_NW)] = pdf_NW - evenPart - oddPart;
                                        dst[I(x + 1, y - 1,   z, D3Q19_SE)] = pdf_SE - evenPart + oddPart;
 
                                        ui = ux + uy;
-                                       evenPart = omegaEven*( 0.5*(pdf_NE + pdf_SW) - ui*ui*w_2_nine_half - w_2_indep );
-                                       oddPart = omegaOdd*(0.5*(pdf_NE - pdf_SW) - ui*w_2_x3 );
+                                       evenPart = omegaEven*( F(0.5)*(pdf_NE + pdf_SW) - ui*ui*w_2_nine_half - w_2_indep );
+                                       oddPart = omegaOdd*(F(0.5)*(pdf_NE - pdf_SW) - ui*w_2_x3 );
                                        dst[I(x + 1, y + 1,   z, D3Q19_NE)] = pdf_NE - evenPart - oddPart;
                                        dst[I(x - 1, y - 1,   z, D3Q19_SW)] = pdf_SW - evenPart + oddPart;
 
                                        ui = -ux + uz;
-                                       evenPart = omegaEven*( 0.5*(pdf_TW + pdf_BE) - ui*ui*w_2_nine_half - w_2_indep );
-                                       oddPart = omegaOdd*(0.5*(pdf_TW - pdf_BE) - ui*w_2_x3 );
+                                       evenPart = omegaEven*( F(0.5)*(pdf_TW + pdf_BE) - ui*ui*w_2_nine_half - w_2_indep );
+                                       oddPart = omegaOdd*(F(0.5)*(pdf_TW - pdf_BE) - ui*w_2_x3 );
                                        dst[I(x - 1,   y, z + 1, D3Q19_TW)] = pdf_TW - evenPart - oddPart;
                                        dst[I(x + 1,   y, z - 1, D3Q19_BE)] = pdf_BE - evenPart + oddPart;
 
                                        ui = ux + uz;
-                                       evenPart = omegaEven*( 0.5*(pdf_TE + pdf_BW) - ui*ui*w_2_nine_half - w_2_indep );
-                                       oddPart = omegaOdd*(0.5*(pdf_TE - pdf_BW) - ui*w_2_x3 );
+                                       evenPart = omegaEven*( F(0.5)*(pdf_TE + pdf_BW) - ui*ui*w_2_nine_half - w_2_indep );
+                                       oddPart = omegaOdd*(F(0.5)*(pdf_TE - pdf_BW) - ui*w_2_x3 );
                                        dst[I(x + 1,   y, z + 1, D3Q19_TE)] = pdf_TE - evenPart - oddPart;
                                        dst[I(x - 1,   y, z - 1, D3Q19_BW)] = pdf_BW - evenPart + oddPart;
 
                                        ui = -uy + uz;
-                                       evenPart = omegaEven*( 0.5*(pdf_TS + pdf_BN) - ui*ui*w_2_nine_half - w_2_indep );
-                                       oddPart = omegaOdd*(0.5*(pdf_TS - pdf_BN) - ui*w_2_x3 );
+                                       evenPart = omegaEven*( F(0.5)*(pdf_TS + pdf_BN) - ui*ui*w_2_nine_half - w_2_indep );
+                                       oddPart = omegaOdd*(F(0.5)*(pdf_TS - pdf_BN) - ui*w_2_x3 );
                                        dst[I(x, y - 1, z + 1, D3Q19_TS)] = pdf_TS - evenPart - oddPart;
                                        dst[I(x, y + 1, z - 1, D3Q19_BN)] = pdf_BN - evenPart + oddPart;
 
                                        ui = uy + uz;
-                                       evenPart = omegaEven*( 0.5*(pdf_TN + pdf_BS) - ui*ui*w_2_nine_half - w_2_indep );
-                                       oddPart = omegaOdd*(0.5*(pdf_TN - pdf_BS) - ui*w_2_x3 );
+                                       evenPart = omegaEven*( F(0.5)*(pdf_TN + pdf_BS) - ui*ui*w_2_nine_half - w_2_indep );
+                                       oddPart = omegaOdd*(F(0.5)*(pdf_TN - pdf_BS) - ui*w_2_x3 );
                                        dst[I(x, y + 1, z + 1, D3Q19_TN)] = pdf_TN - evenPart - oddPart;
                                        dst[I(x, y - 1, z - 1, D3Q19_BS)] = pdf_BS - evenPart + oddPart;
 
@@ -244,20 +254,20 @@ void FNAME(D3Q19Kernel)(LatticeDesc * ld, KernelData * kernelData, CaseData * cd
                                        w_1_indep = w_1*dir_indep_trm;
 
                                        ui = uy;
-                                       evenPart = omegaEven*( 0.5*(pdf_N + pdf_S) - ui*ui*w_1_nine_half - w_1_indep );
-                                       oddPart = omegaOdd*(0.5*(pdf_N - pdf_S) - ui*w_1_x3 );
+                                       evenPart = omegaEven*( F(0.5)*(pdf_N + pdf_S) - ui*ui*w_1_nine_half - w_1_indep );
+                                       oddPart = omegaOdd*(F(0.5)*(pdf_N - pdf_S) - ui*w_1_x3 );
                                        dst[I(x, y, z, D3Q19_N)]  = pdf_N - evenPart - oddPart;
                                        dst[I(x, y, z, D3Q19_S)]  = pdf_S - evenPart + oddPart;
 
                                        ui = ux;
-                                       evenPart = omegaEven*( 0.5*(pdf_E + pdf_W) - ui*ui*w_1_nine_half - w_1_indep );
-                                       oddPart = omegaOdd*(0.5*(pdf_E - pdf_W) - ui*w_1_x3 );
+                                       evenPart = omegaEven*( F(0.5)*(pdf_E + pdf_W) - ui*ui*w_1_nine_half - w_1_indep );
+                                       oddPart = omegaOdd*(F(0.5)*(pdf_E - pdf_W) - ui*w_1_x3 );
                                        dst[I(x, y, z, D3Q19_E)]  = pdf_E - evenPart - oddPart;
                                        dst[I(x, y, z, D3Q19_W)]  = pdf_W - evenPart + oddPart;
 
                                        ui = uz;
-                                       evenPart = omegaEven*( 0.5*(pdf_T + pdf_B) - ui*ui*w_1_nine_half - w_1_indep );
-                                       oddPart = omegaOdd*(0.5*(pdf_T - pdf_B) - ui*w_1_x3 );
+                                       evenPart = omegaEven*( F(0.5)*(pdf_T + pdf_B) - ui*ui*w_1_nine_half - w_1_indep );
+                                       oddPart = omegaOdd*(F(0.5)*(pdf_T - pdf_B) - ui*w_1_x3 );
                                        dst[I(x, y, z, D3Q19_T)]  = pdf_T - evenPart - oddPart;
                                        dst[I(x, y, z, D3Q19_B)]  = pdf_B - evenPart + oddPart;
 
@@ -265,38 +275,38 @@ void FNAME(D3Q19Kernel)(LatticeDesc * ld, KernelData * kernelData, CaseData * cd
                                        w_2_indep = w_2*dir_indep_trm;
 
                                        ui = -ux + uy;
-                                       evenPart = omegaEven*( 0.5*(pdf_NW + pdf_SE) - ui*ui*w_2_nine_half - w_2_indep );
-                                       oddPart = omegaOdd*(0.5*(pdf_NW - pdf_SE) - ui*w_2_x3 );
+                                       evenPart = omegaEven*( F(0.5)*(pdf_NW + pdf_SE) - ui*ui*w_2_nine_half - w_2_indep );
+                                       oddPart = omegaOdd*(F(0.5)*(pdf_NW - pdf_SE) - ui*w_2_x3 );
                                        dst[I(x, y, z, D3Q19_NW)] = pdf_NW - evenPart - oddPart;
                                        dst[I(x, y, z, D3Q19_SE)] = pdf_SE - evenPart + oddPart;
 
                                        ui = ux + uy;
-                                       evenPart = omegaEven*( 0.5*(pdf_NE + pdf_SW) - ui*ui*w_2_nine_half - w_2_indep );
-                                       oddPart = omegaOdd*(0.5*(pdf_NE - pdf_SW) - ui*w_2_x3 );
+                                       evenPart = omegaEven*( F(0.5)*(pdf_NE + pdf_SW) - ui*ui*w_2_nine_half - w_2_indep );
+                                       oddPart = omegaOdd*(F(0.5)*(pdf_NE - pdf_SW) - ui*w_2_x3 );
                                        dst[I(x, y, z, D3Q19_NE)] = pdf_NE - evenPart - oddPart;
                                        dst[I(x, y, z, D3Q19_SW)] = pdf_SW - evenPart + oddPart;
 
                                        ui = -ux + uz;
-                                       evenPart = omegaEven*( 0.5*(pdf_TW + pdf_BE) - ui*ui*w_2_nine_half - w_2_indep );
-                                       oddPart = omegaOdd*(0.5*(pdf_TW - pdf_BE) - ui*w_2_x3 );
+                                       evenPart = omegaEven*( F(0.5)*(pdf_TW + pdf_BE) - ui*ui*w_2_nine_half - w_2_indep );
+                                       oddPart = omegaOdd*(F(0.5)*(pdf_TW - pdf_BE) - ui*w_2_x3 );
                                        dst[I(x, y, z, D3Q19_TW)] = pdf_TW - evenPart - oddPart;
                                        dst[I(x, y, z, D3Q19_BE)] = pdf_BE - evenPart + oddPart;
 
                                        ui = ux + uz;
-                                       evenPart = omegaEven*( 0.5*(pdf_TE + pdf_BW) - ui*ui*w_2_nine_half - w_2_indep );
-                                       oddPart = omegaOdd*(0.5*(pdf_TE - pdf_BW) - ui*w_2_x3 );
+                                       evenPart = omegaEven*( F(0.5)*(pdf_TE + pdf_BW) - ui*ui*w_2_nine_half - w_2_indep );
+                                       oddPart = omegaOdd*(F(0.5)*(pdf_TE - pdf_BW) - ui*w_2_x3 );
                                        dst[I(x, y, z, D3Q19_TE)] = pdf_TE - evenPart - oddPart;
                                        dst[I(x, y, z, D3Q19_BW)] = pdf_BW - evenPart + oddPart;
 
                                        ui = -uy + uz;
-                                       evenPart = omegaEven*( 0.5*(pdf_TS + pdf_BN) - ui*ui*w_2_nine_half - w_2_indep );
-                                       oddPart = omegaOdd*(0.5*(pdf_TS - pdf_BN) - ui*w_2_x3 );
+                                       evenPart = omegaEven*( F(0.5)*(pdf_TS + pdf_BN) - ui*ui*w_2_nine_half - w_2_indep );
+                                       oddPart = omegaOdd*(F(0.5)*(pdf_TS - pdf_BN) - ui*w_2_x3 );
                                        dst[I(x, y, z, D3Q19_TS)] = pdf_TS - evenPart - oddPart;
                                        dst[I(x, y, z, D3Q19_BN)] = pdf_BN - evenPart + oddPart;
 
                                        ui = uy + uz;
-                                       evenPart = omegaEven*( 0.5*(pdf_TN + pdf_BS) - ui*ui*w_2_nine_half - w_2_indep );
-                                       oddPart = omegaOdd*(0.5*(pdf_TN - pdf_BS) - ui*w_2_x3 );
+                                       evenPart = omegaEven*( F(0.5)*(pdf_TN + pdf_BS) - ui*ui*w_2_nine_half - w_2_indep );
+                                       oddPart = omegaOdd*(F(0.5)*(pdf_TN - pdf_BS) - ui*w_2_x3 );
                                        dst[I(x, y, z, D3Q19_TN)] = pdf_TN - evenPart - oddPart;
                                        dst[I(x, y, z, D3Q19_BS)] = pdf_BS - evenPart + oddPart;
 
@@ -312,6 +322,7 @@ void FNAME(D3Q19Kernel)(LatticeDesc * ld, KernelData * kernelData, CaseData * cd
                // Stop counters before bounce back. Else computing loop balance will be incorrect.
                X_LIKWID_STOP("os");
 
+
                // Fixup bounce back PDFs.
                #ifdef _OPENMP
                #pragma omp parallel for default(none) \
@@ -347,6 +358,8 @@ void FNAME(D3Q19Kernel)(LatticeDesc * ld, KernelData * kernelData, CaseData * cd
 
        } // for (int iter = 0; ...
 
+       X_KERNEL_END(kernelData);
+
        #ifdef VTK_OUTPUT
 
        if (cd->VtkOutput) {
@@ -366,8 +379,8 @@ void FNAME(D3Q19BlkKernel)(LatticeDesc * ld, KernelData * kernelData, CaseData *
        Assert(kernelData != NULL);
        Assert(cd != NULL);
 
-       Assert(cd->Omega > 0.0);
-       Assert(cd->Omega < 2.0);
+       Assert(cd->Omega > F(0.0));
+       Assert(cd->Omega < F(2.0));
 
        KernelData * kd = (KernelData *)kernelData;
 
@@ -391,20 +404,24 @@ void FNAME(D3Q19BlkKernel)(LatticeDesc * ld, KernelData * kernelData, CaseData *
 
        PdfT omega = cd->Omega;
        PdfT omegaEven = omega;
-//     PdfT omegaOdd = 8.0*((2.0-omegaEven)/(8.0-omegaEven)); //"standard" trt odd relaxation parameter
-       PdfT magicParam = 1.0/12.0;     // 1/4: best stability; 1/12: removes third-order advection error (best advection);     1/6: removes fourth-order diffusion error (best diffusion);     3/16: exact location of bounce back for poiseuille flow
-       PdfT omegaOdd = 1.0/( 0.5 + magicParam/(1.0/omega - 0.5) );
+       // PdfT omegaOdd = 8.0*((F(2.0)-omegaEven)/(8.0-omegaEven)); //"standard" trt odd relaxation parameter
+       PdfT magicParam = F(1.0)/F(12.0);
+       // 1/ 4: best stability;
+       // 1/12: removes third-order advection error (best advection);
+       // 1/ 6: removes fourth-order diffusion error (best diffusion);
+       // 3/16: exact location of bounce back for poiseuille flow
+       PdfT omegaOdd = F(1.0) / (F(0.5) + magicParam / (F(1.0) / omega - F(0.5)));
 
-       PdfT evenPart = 0.0;
-       PdfT oddPart = 0.0;
-       PdfT dir_indep_trm = 0.0;
+       PdfT evenPart = F(0.0);
+       PdfT oddPart = F(0.0);
+       PdfT dir_indep_trm = F(0.0);
 
-       PdfT w_0 = 1.0 /  3.0;
-       PdfT w_1 = 1.0 / 18.0;
-       PdfT w_2 = 1.0 / 36.0;
+       PdfT w_0 = F(1.0) / F( 3.0);
+       PdfT w_1 = F(1.0) / F(18.0);
+       PdfT w_2 = F(1.0) / F(36.0);
 
-       PdfT w_1_x3 = w_1 * 3.0;        PdfT w_1_nine_half = w_1 * 9.0/2.0;     PdfT w_1_indep = 0.0;
-       PdfT w_2_x3 = w_2 * 3.0;        PdfT w_2_nine_half = w_2 * 9.0/2.0;     PdfT w_2_indep = 0.0;
+       PdfT w_1_x3 = w_1 * F(3.0);     PdfT w_1_nine_half = w_1 * F(9.0)/F(2.0);       PdfT w_1_indep = F(0.0);
+       PdfT w_2_x3 = w_2 * F(3.0);     PdfT w_2_nine_half = w_2 * F(9.0)/F(2.0);       PdfT w_2_indep = F(0.0);
 
        PdfT ux, uy, uz, ui;
        PdfT dens;
@@ -433,6 +450,8 @@ void FNAME(D3Q19BlkKernel)(LatticeDesc * ld, KernelData * kernelData, CaseData *
        nThreads = omp_get_max_threads();
        #endif
 
+       X_KERNEL_START(kernelData);
+
        for (int iter = 0; iter < maxIterations; ++iter) {
 
                #ifdef _OPENMP
@@ -478,6 +497,11 @@ void FNAME(D3Q19BlkKernel)(LatticeDesc * ld, KernelData * kernelData, CaseData *
 
                                        for (int x = bX; x < eX; ++x) {
                                                for (int y = bY; y < eY; ++y) {
+                                                       #ifdef INTEL_OPT_DIRECTIVES
+                                                               #pragma ivdep
+                                                               #pragma vector always
+                                                               #pragma simd
+                                                       #endif
                                                        for (int z = bZ; z < eZ; ++z) {
 
                                        #define I(x, y, z, dir) P_INDEX_5(gDims, (x), (y), (z), (dir))
@@ -505,7 +529,7 @@ void FNAME(D3Q19BlkKernel)(LatticeDesc * ld, KernelData * kernelData, CaseData *
                                        #ifdef LID_DRIVEN_CAVITY
 
                                        if (z == nZ - 4 + oZ && x > 3 + oX && x < (nX - 4 + oX) && y > 3 + oY  && y < (nY - 4 + oY)) {
-                                               ux = 0.1 * 0.577;
+                                               ux = 0.1 * F(0.5)77;
                                                uy = 0.0;
                                                uz = 0.0;
 
@@ -528,7 +552,7 @@ void FNAME(D3Q19BlkKernel)(LatticeDesc * ld, KernelData * kernelData, CaseData *
                                                        pdf_T  + pdf_TN + pdf_TE + pdf_TS + pdf_TW +
                                                        pdf_B  + pdf_BN + pdf_BE + pdf_BS + pdf_BW;
 
-                                       dir_indep_trm = dens - (ux * ux + uy * uy + uz * uz)*3.0/2.0;
+                                       dir_indep_trm = dens - (ux * ux + uy * uy + uz * uz) * F(3.0) / F(2.0);
 
 #ifdef PROP_MODEL_PUSH
 
@@ -539,20 +563,20 @@ void FNAME(D3Q19BlkKernel)(LatticeDesc * ld, KernelData * kernelData, CaseData *
                                        w_1_indep = w_1*dir_indep_trm;
 
                                        ui = uy;
-                                       evenPart = omegaEven*( 0.5*(pdf_N + pdf_S) - ui*ui*w_1_nine_half - w_1_indep );
-                                       oddPart = omegaOdd*(0.5*(pdf_N - pdf_S) - ui*w_1_x3 );
+                                       evenPart = omegaEven*( F(0.5)*(pdf_N + pdf_S) - ui*ui*w_1_nine_half - w_1_indep );
+                                       oddPart = omegaOdd*(F(0.5)*(pdf_N - pdf_S) - ui*w_1_x3 );
                                        dst[I(x, y + 1,   z, D3Q19_N)]  = pdf_N - evenPart - oddPart;
                                        dst[I(x, y - 1,   z, D3Q19_S)]  = pdf_S - evenPart + oddPart;
 
                                        ui = ux;
-                                       evenPart = omegaEven*( 0.5*(pdf_E + pdf_W) - ui*ui*w_1_nine_half - w_1_indep );
-                                       oddPart = omegaOdd*(0.5*(pdf_E - pdf_W) - ui*w_1_x3 );
+                                       evenPart = omegaEven*( F(0.5)*(pdf_E + pdf_W) - ui*ui*w_1_nine_half - w_1_indep );
+                                       oddPart = omegaOdd*(F(0.5)*(pdf_E - pdf_W) - ui*w_1_x3 );
                                        dst[I(x + 1,   y,   z, D3Q19_E)]  = pdf_E - evenPart - oddPart;
                                        dst[I(x - 1,   y,   z, D3Q19_W)]  = pdf_W - evenPart + oddPart;
 
                                        ui = uz;
-                                       evenPart = omegaEven*( 0.5*(pdf_T + pdf_B) - ui*ui*w_1_nine_half - w_1_indep );
-                                       oddPart = omegaOdd*(0.5*(pdf_T - pdf_B) - ui*w_1_x3 );
+                                       evenPart = omegaEven*( F(0.5)*(pdf_T + pdf_B) - ui*ui*w_1_nine_half - w_1_indep );
+                                       oddPart = omegaOdd*(F(0.5)*(pdf_T - pdf_B) - ui*w_1_x3 );
                                        dst[I(x,   y, z + 1, D3Q19_T)]  = pdf_T - evenPart - oddPart;
                                        dst[I(x,   y, z - 1, D3Q19_B)]  = pdf_B - evenPart + oddPart;
 
@@ -560,38 +584,38 @@ void FNAME(D3Q19BlkKernel)(LatticeDesc * ld, KernelData * kernelData, CaseData *
                                        w_2_indep = w_2*dir_indep_trm;
 
                                        ui = -ux + uy;
-                                       evenPart = omegaEven*( 0.5*(pdf_NW + pdf_SE) - ui*ui*w_2_nine_half - w_2_indep );
-                                       oddPart = omegaOdd*(0.5*(pdf_NW - pdf_SE) - ui*w_2_x3 );
+                                       evenPart = omegaEven*( F(0.5)*(pdf_NW + pdf_SE) - ui*ui*w_2_nine_half - w_2_indep );
+                                       oddPart = omegaOdd*(F(0.5)*(pdf_NW - pdf_SE) - ui*w_2_x3 );
                                        dst[I(x - 1, y + 1,   z, D3Q19_NW)] = pdf_NW - evenPart - oddPart;
                                        dst[I(x + 1, y - 1,   z, D3Q19_SE)] = pdf_SE - evenPart + oddPart;
 
                                        ui = ux + uy;
-                                       evenPart = omegaEven*( 0.5*(pdf_NE + pdf_SW) - ui*ui*w_2_nine_half - w_2_indep );
-                                       oddPart = omegaOdd*(0.5*(pdf_NE - pdf_SW) - ui*w_2_x3 );
+                                       evenPart = omegaEven*( F(0.5)*(pdf_NE + pdf_SW) - ui*ui*w_2_nine_half - w_2_indep );
+                                       oddPart = omegaOdd*(F(0.5)*(pdf_NE - pdf_SW) - ui*w_2_x3 );
                                        dst[I(x + 1, y + 1,   z, D3Q19_NE)] = pdf_NE - evenPart - oddPart;
                                        dst[I(x - 1, y - 1,   z, D3Q19_SW)] = pdf_SW - evenPart + oddPart;
 
                                        ui = -ux + uz;
-                                       evenPart = omegaEven*( 0.5*(pdf_TW + pdf_BE) - ui*ui*w_2_nine_half - w_2_indep );
-                                       oddPart = omegaOdd*(0.5*(pdf_TW - pdf_BE) - ui*w_2_x3 );
+                                       evenPart = omegaEven*( F(0.5)*(pdf_TW + pdf_BE) - ui*ui*w_2_nine_half - w_2_indep );
+                                       oddPart = omegaOdd*(F(0.5)*(pdf_TW - pdf_BE) - ui*w_2_x3 );
                                        dst[I(x - 1,   y, z + 1, D3Q19_TW)] = pdf_TW - evenPart - oddPart;
                                        dst[I(x + 1,   y, z - 1, D3Q19_BE)] = pdf_BE - evenPart + oddPart;
 
                                        ui = ux + uz;
-                                       evenPart = omegaEven*( 0.5*(pdf_TE + pdf_BW) - ui*ui*w_2_nine_half - w_2_indep );
-                                       oddPart = omegaOdd*(0.5*(pdf_TE - pdf_BW) - ui*w_2_x3 );
+                                       evenPart = omegaEven*( F(0.5)*(pdf_TE + pdf_BW) - ui*ui*w_2_nine_half - w_2_indep );
+                                       oddPart = omegaOdd*(F(0.5)*(pdf_TE - pdf_BW) - ui*w_2_x3 );
                                        dst[I(x + 1,   y, z + 1, D3Q19_TE)] = pdf_TE - evenPart - oddPart;
                                        dst[I(x - 1,   y, z - 1, D3Q19_BW)] = pdf_BW - evenPart + oddPart;
 
                                        ui = -uy + uz;
-                                       evenPart = omegaEven*( 0.5*(pdf_TS + pdf_BN) - ui*ui*w_2_nine_half - w_2_indep );
-                                       oddPart = omegaOdd*(0.5*(pdf_TS - pdf_BN) - ui*w_2_x3 );
+                                       evenPart = omegaEven*( F(0.5)*(pdf_TS + pdf_BN) - ui*ui*w_2_nine_half - w_2_indep );
+                                       oddPart = omegaOdd*(F(0.5)*(pdf_TS - pdf_BN) - ui*w_2_x3 );
                                        dst[I(x, y - 1, z + 1, D3Q19_TS)] = pdf_TS - evenPart - oddPart;
                                        dst[I(x, y + 1, z - 1, D3Q19_BN)] = pdf_BN - evenPart + oddPart;
 
                                        ui = uy + uz;
-                                       evenPart = omegaEven*( 0.5*(pdf_TN + pdf_BS) - ui*ui*w_2_nine_half - w_2_indep );
-                                       oddPart = omegaOdd*(0.5*(pdf_TN - pdf_BS) - ui*w_2_x3 );
+                                       evenPart = omegaEven*( F(0.5)*(pdf_TN + pdf_BS) - ui*ui*w_2_nine_half - w_2_indep );
+                                       oddPart = omegaOdd*(F(0.5)*(pdf_TN - pdf_BS) - ui*w_2_x3 );
                                        dst[I(x, y + 1, z + 1, D3Q19_TN)] = pdf_TN - evenPart - oddPart;
                                        dst[I(x, y - 1, z - 1, D3Q19_BS)] = pdf_BS - evenPart + oddPart;
 
@@ -604,20 +628,20 @@ void FNAME(D3Q19BlkKernel)(LatticeDesc * ld, KernelData * kernelData, CaseData *
                                        w_1_indep = w_1*dir_indep_trm;
 
                                        ui = uy;
-                                       evenPart = omegaEven*( 0.5*(pdf_N + pdf_S) - ui*ui*w_1_nine_half - w_1_indep );
-                                       oddPart = omegaOdd*(0.5*(pdf_N - pdf_S) - ui*w_1_x3 );
+                                       evenPart = omegaEven*( F(0.5)*(pdf_N + pdf_S) - ui*ui*w_1_nine_half - w_1_indep );
+                                       oddPart = omegaOdd*(F(0.5)*(pdf_N - pdf_S) - ui*w_1_x3 );
                                        dst[I(x, y, z, D3Q19_N)]  = pdf_N - evenPart - oddPart;
                                        dst[I(x, y, z, D3Q19_S)]  = pdf_S - evenPart + oddPart;
 
                                        ui = ux;
-                                       evenPart = omegaEven*( 0.5*(pdf_E + pdf_W) - ui*ui*w_1_nine_half - w_1_indep );
-                                       oddPart = omegaOdd*(0.5*(pdf_E - pdf_W) - ui*w_1_x3 );
+                                       evenPart = omegaEven*( F(0.5)*(pdf_E + pdf_W) - ui*ui*w_1_nine_half - w_1_indep );
+                                       oddPart = omegaOdd*(F(0.5)*(pdf_E - pdf_W) - ui*w_1_x3 );
                                        dst[I(x, y, z, D3Q19_E)]  = pdf_E - evenPart - oddPart;
                                        dst[I(x, y, z, D3Q19_W)]  = pdf_W - evenPart + oddPart;
 
                                        ui = uz;
-                                       evenPart = omegaEven*( 0.5*(pdf_T + pdf_B) - ui*ui*w_1_nine_half - w_1_indep );
-                                       oddPart = omegaOdd*(0.5*(pdf_T - pdf_B) - ui*w_1_x3 );
+                                       evenPart = omegaEven*( F(0.5)*(pdf_T + pdf_B) - ui*ui*w_1_nine_half - w_1_indep );
+                                       oddPart = omegaOdd*(F(0.5)*(pdf_T - pdf_B) - ui*w_1_x3 );
                                        dst[I(x, y, z, D3Q19_T)]  = pdf_T - evenPart - oddPart;
                                        dst[I(x, y, z, D3Q19_B)]  = pdf_B - evenPart + oddPart;
 
@@ -625,38 +649,38 @@ void FNAME(D3Q19BlkKernel)(LatticeDesc * ld, KernelData * kernelData, CaseData *
                                        w_2_indep = w_2*dir_indep_trm;
 
                                        ui = -ux + uy;
-                                       evenPart = omegaEven*( 0.5*(pdf_NW + pdf_SE) - ui*ui*w_2_nine_half - w_2_indep );
-                                       oddPart = omegaOdd*(0.5*(pdf_NW - pdf_SE) - ui*w_2_x3 );
+                                       evenPart = omegaEven*( F(0.5)*(pdf_NW + pdf_SE) - ui*ui*w_2_nine_half - w_2_indep );
+                                       oddPart = omegaOdd*(F(0.5)*(pdf_NW - pdf_SE) - ui*w_2_x3 );
                                        dst[I(x, y, z, D3Q19_NW)] = pdf_NW - evenPart - oddPart;
                                        dst[I(x, y, z, D3Q19_SE)] = pdf_SE - evenPart + oddPart;
 
                                        ui = ux + uy;
-                                       evenPart = omegaEven*( 0.5*(pdf_NE + pdf_SW) - ui*ui*w_2_nine_half - w_2_indep );
-                                       oddPart = omegaOdd*(0.5*(pdf_NE - pdf_SW) - ui*w_2_x3 );
+                                       evenPart = omegaEven*( F(0.5)*(pdf_NE + pdf_SW) - ui*ui*w_2_nine_half - w_2_indep );
+                                       oddPart = omegaOdd*(F(0.5)*(pdf_NE - pdf_SW) - ui*w_2_x3 );
                                        dst[I(x, y, z, D3Q19_NE)] = pdf_NE - evenPart - oddPart;
                                        dst[I(x, y, z, D3Q19_SW)] = pdf_SW - evenPart + oddPart;
 
                                        ui = -ux + uz;
-                                       evenPart = omegaEven*( 0.5*(pdf_TW + pdf_BE) - ui*ui*w_2_nine_half - w_2_indep );
-                                       oddPart = omegaOdd*(0.5*(pdf_TW - pdf_BE) - ui*w_2_x3 );
+                                       evenPart = omegaEven*( F(0.5)*(pdf_TW + pdf_BE) - ui*ui*w_2_nine_half - w_2_indep );
+                                       oddPart = omegaOdd*(F(0.5)*(pdf_TW - pdf_BE) - ui*w_2_x3 );
                                        dst[I(x, y, z, D3Q19_TW)] = pdf_TW - evenPart - oddPart;
                                        dst[I(x, y, z, D3Q19_BE)] = pdf_BE - evenPart + oddPart;
 
                                        ui = ux + uz;
-                                       evenPart = omegaEven*( 0.5*(pdf_TE + pdf_BW) - ui*ui*w_2_nine_half - w_2_indep );
-                                       oddPart = omegaOdd*(0.5*(pdf_TE - pdf_BW) - ui*w_2_x3 );
+                                       evenPart = omegaEven*( F(0.5)*(pdf_TE + pdf_BW) - ui*ui*w_2_nine_half - w_2_indep );
+                                       oddPart = omegaOdd*(F(0.5)*(pdf_TE - pdf_BW) - ui*w_2_x3 );
                                        dst[I(x, y, z, D3Q19_TE)] = pdf_TE - evenPart - oddPart;
                                        dst[I(x, y, z, D3Q19_BW)] = pdf_BW - evenPart + oddPart;
 
                                        ui = -uy + uz;
-                                       evenPart = omegaEven*( 0.5*(pdf_TS + pdf_BN) - ui*ui*w_2_nine_half - w_2_indep );
-                                       oddPart = omegaOdd*(0.5*(pdf_TS - pdf_BN) - ui*w_2_x3 );
+                                       evenPart = omegaEven*( F(0.5)*(pdf_TS + pdf_BN) - ui*ui*w_2_nine_half - w_2_indep );
+                                       oddPart = omegaOdd*(F(0.5)*(pdf_TS - pdf_BN) - ui*w_2_x3 );
                                        dst[I(x, y, z, D3Q19_TS)] = pdf_TS - evenPart - oddPart;
                                        dst[I(x, y, z, D3Q19_BN)] = pdf_BN - evenPart + oddPart;
 
                                        ui = uy + uz;
-                                       evenPart = omegaEven*( 0.5*(pdf_TN + pdf_BS) - ui*ui*w_2_nine_half - w_2_indep );
-                                       oddPart = omegaOdd*(0.5*(pdf_TN - pdf_BS) - ui*w_2_x3 );
+                                       evenPart = omegaEven*( F(0.5)*(pdf_TN + pdf_BS) - ui*ui*w_2_nine_half - w_2_indep );
+                                       oddPart = omegaOdd*(F(0.5)*(pdf_TN - pdf_BS) - ui*w_2_x3 );
                                        dst[I(x, y, z, D3Q19_TN)] = pdf_TN - evenPart - oddPart;
                                        dst[I(x, y, z, D3Q19_BS)] = pdf_BS - evenPart + oddPart;
 
@@ -712,6 +736,8 @@ void FNAME(D3Q19BlkKernel)(LatticeDesc * ld, KernelData * kernelData, CaseData *
 
        } // for (int iter = 0; ...
 
+       X_KERNEL_END(kernelData);
+
        #ifdef VTK_OUTPUT
 
        if (cd->VtkOutput) {
This page took 0.102495 seconds and 5 git commands to generate.