1 // --------------------------------------------------------------------------
4 // Markus Wittmann, 2016-2017
5 // RRZE, University of Erlangen-Nuremberg, Germany
6 // markus.wittmann -at- fau.de or hpc -at- rrze.fau.de
9 // LSS, University of Erlangen-Nuremberg, Germany
11 // This file is part of the Lattice Boltzmann Benchmark Kernels (LbmBenchKernels).
13 // LbmBenchKernels is free software: you can redistribute it and/or modify
14 // it under the terms of the GNU General Public License as published by
15 // the Free Software Foundation, either version 3 of the License, or
16 // (at your option) any later version.
18 // LbmBenchKernels is distributed in the hope that it will be useful,
19 // but WITHOUT ANY WARRANTY; without even the implied warranty of
20 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 // GNU General Public License for more details.
23 // You should have received a copy of the GNU General Public License
24 // along with LbmBenchKernels. If not, see <http://www.gnu.org/licenses/>.
26 // --------------------------------------------------------------------------
33 #ifdef DATA_LAYOUT_NAME
34 #error DATA_LAYOUT_NAME must not be defined here.
37 #ifdef PROP_MODEL_NAME
38 #error PROP_MODEL_NAME must not be defined here.
42 #ifdef DATA_LAYOUT_SOA
43 #define DATA_LAYOUT_NAME SoA
46 #ifdef DATA_LAYOUT_AOS
47 #define DATA_LAYOUT_NAME AoS
50 #ifdef PROP_MODEL_PUSH
51 #define PROP_MODEL_NAME Push
54 #ifdef PROP_MODEL_PULL
55 #define PROP_MODEL_NAME Pull
59 #define PROP_MODEL_NAME AA
95 #define D3Q19_C 18 // IMPORTANT: Center particle must be the last one.
100 #error X is not allowed to be defined here!
103 // The following list must be sorted ascending according
104 // to the index of the direction, i.e. D3Q19_N, D3Q19_S, ...
106 X(N, D3Q19_N, D3Q19_S, 0, 1, 0) \
107 X(S, D3Q19_S, D3Q19_N, 0, -1, 0) \
108 X(E, D3Q19_E, D3Q19_W, 1, 0, 0) \
109 X(W, D3Q19_W, D3Q19_E, -1, 0, 0) \
110 X(NE, D3Q19_NE, D3Q19_SW, 1, 1, 0) \
111 X(SE, D3Q19_SE, D3Q19_NW, 1, -1, 0) \
112 X(NW, D3Q19_NW, D3Q19_SE, -1, 1, 0) \
113 X(SW, D3Q19_SW, D3Q19_NE, -1, -1, 0) \
114 X(T, D3Q19_T, D3Q19_B, 0, 0, 1) \
115 X(TN, D3Q19_TN, D3Q19_BS, 0, 1, 1) \
116 X(TE, D3Q19_TE, D3Q19_BW, 1, 0, 1) \
117 X(TW, D3Q19_TW, D3Q19_BE, -1, 0, 1) \
118 X(TS, D3Q19_TS, D3Q19_BN, 0, -1, 1) \
119 X(B, D3Q19_B, D3Q19_T, 0, 0, -1) \
120 X(BS, D3Q19_BS, D3Q19_TN, 0, -1, -1) \
121 X(BN, D3Q19_BN, D3Q19_TS, 0, 1, -1) \
122 X(BW, D3Q19_BW, D3Q19_TE, -1, 0, -1) \
123 X(BE, D3Q19_BE, D3Q19_TW, 1, 0, -1) \
124 X(C, D3Q19_C, D3Q19_C, 0, 0, 0)
126 #define D3Q19_LIST_WO_C \
127 X(N, D3Q19_N, D3Q19_S, 0, 1, 0) \
128 X(S, D3Q19_S, D3Q19_N, 0, -1, 0) \
129 X(E, D3Q19_E, D3Q19_W, 1, 0, 0) \
130 X(W, D3Q19_W, D3Q19_E, -1, 0, 0) \
131 X(NE, D3Q19_NE, D3Q19_SW, 1, 1, 0) \
132 X(SE, D3Q19_SE, D3Q19_NW, 1, -1, 0) \
133 X(NW, D3Q19_NW, D3Q19_SE, -1, 1, 0) \
134 X(SW, D3Q19_SW, D3Q19_NE, -1, -1, 0) \
135 X(T, D3Q19_T, D3Q19_B, 0, 0, 1) \
136 X(TN, D3Q19_TN, D3Q19_BS, 0, 1, 1) \
137 X(TE, D3Q19_TE, D3Q19_BW, 1, 0, 1) \
138 X(TW, D3Q19_TW, D3Q19_BE, -1, 0, 1) \
139 X(TS, D3Q19_TS, D3Q19_BN, 0, -1, 1) \
140 X(B, D3Q19_B, D3Q19_T, 0, 0, -1) \
141 X(BS, D3Q19_BS, D3Q19_TN, 0, -1, -1) \
142 X(BN, D3Q19_BN, D3Q19_TS, 0, 1, -1) \
143 X(BW, D3Q19_BW, D3Q19_TE, -1, 0, -1) \
144 X(BE, D3Q19_BE, D3Q19_TW, 1, 0, -1)
147 extern int D3Q19_X[N_D3Q19];
148 extern int D3Q19_Y[N_D3Q19];
149 extern int D3Q19_Z[N_D3Q19];
150 extern int D3Q19_INV[N_D3Q19];
152 extern const char * D3Q19_NAMES[N_D3Q19];
156 typedef struct CaseData_ {
167 int StatisticsModulus;
171 typedef struct KernelData_ {
181 int * BounceBackPdfsSrc;
182 int * BounceBackPdfsDst;
185 void (* BoundaryConditionsGetPdf)(struct KernelData_ * kd, int x, int y, int z, int dir, PdfT * pdf);
186 void (* BoundaryConditionsSetPdf)(struct KernelData_ * kd, int x, int y, int z, int dir, PdfT pdf);
188 void (* GetNode)(struct KernelData_ * kd, int x, int y, int z, PdfT * pdfs);
189 void (* SetNode)(struct KernelData_ * kd, int x, int y, int z, PdfT * pdfs);
191 void (* Kernel)(LatticeDesc * ld, struct KernelData_ * kd, CaseData * cd);
195 typedef struct Parameters_ {
202 void KernelComputeBoundaryConditions(KernelData * kd, LatticeDesc * ld, CaseData * cd);
204 PdfT KernelDensity(KernelData * kd, LatticeDesc * ld);
206 void KernelStatistics(KernelData * kd, LatticeDesc * ld, CaseData * cd, int iteration);
207 void KernelStatisticsAdv(KernelData * kd, LatticeDesc * ld, CaseData * cd, int iteration, int forceOutput);
210 void KernelSetInitialDensity (LatticeDesc * ld, KernelData * kd, CaseData * cd);
211 void KernelSetInitialVelocity(LatticeDesc * ld, KernelData * kd, CaseData * cd);
213 void KernelVerifiy(LatticeDesc * ld, KernelData * kd, CaseData * cd, PdfT * errorNorm);
215 void KernelAddBodyForce(KernelData * kd, LatticeDesc * ld, CaseData * cd);
217 #endif // __KERNEL_H__