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
65 #elif defined(PRECISION_SP)
68 #error PRECISION must be defined as dp or sp.
71 #define F(number) (PdfT)(number)
101 #define D3Q19_C 18 // IMPORTANT: Center particle must be the last one.
106 #error X is not allowed to be defined here!
109 // The following list must be sorted ascending according
110 // to the index of the direction, i.e. D3Q19_N, D3Q19_S, ...
112 X(N, D3Q19_N, D3Q19_S, 0, 1, 0) \
113 X(S, D3Q19_S, D3Q19_N, 0, -1, 0) \
114 X(E, D3Q19_E, D3Q19_W, 1, 0, 0) \
115 X(W, D3Q19_W, D3Q19_E, -1, 0, 0) \
116 X(NE, D3Q19_NE, D3Q19_SW, 1, 1, 0) \
117 X(SE, D3Q19_SE, D3Q19_NW, 1, -1, 0) \
118 X(NW, D3Q19_NW, D3Q19_SE, -1, 1, 0) \
119 X(SW, D3Q19_SW, D3Q19_NE, -1, -1, 0) \
120 X(T, D3Q19_T, D3Q19_B, 0, 0, 1) \
121 X(TN, D3Q19_TN, D3Q19_BS, 0, 1, 1) \
122 X(TE, D3Q19_TE, D3Q19_BW, 1, 0, 1) \
123 X(TW, D3Q19_TW, D3Q19_BE, -1, 0, 1) \
124 X(TS, D3Q19_TS, D3Q19_BN, 0, -1, 1) \
125 X(B, D3Q19_B, D3Q19_T, 0, 0, -1) \
126 X(BS, D3Q19_BS, D3Q19_TN, 0, -1, -1) \
127 X(BN, D3Q19_BN, D3Q19_TS, 0, 1, -1) \
128 X(BW, D3Q19_BW, D3Q19_TE, -1, 0, -1) \
129 X(BE, D3Q19_BE, D3Q19_TW, 1, 0, -1) \
130 X(C, D3Q19_C, D3Q19_C, 0, 0, 0)
132 #define D3Q19_LIST_WO_C \
133 X(N, D3Q19_N, D3Q19_S, 0, 1, 0) \
134 X(S, D3Q19_S, D3Q19_N, 0, -1, 0) \
135 X(E, D3Q19_E, D3Q19_W, 1, 0, 0) \
136 X(W, D3Q19_W, D3Q19_E, -1, 0, 0) \
137 X(NE, D3Q19_NE, D3Q19_SW, 1, 1, 0) \
138 X(SE, D3Q19_SE, D3Q19_NW, 1, -1, 0) \
139 X(NW, D3Q19_NW, D3Q19_SE, -1, 1, 0) \
140 X(SW, D3Q19_SW, D3Q19_NE, -1, -1, 0) \
141 X(T, D3Q19_T, D3Q19_B, 0, 0, 1) \
142 X(TN, D3Q19_TN, D3Q19_BS, 0, 1, 1) \
143 X(TE, D3Q19_TE, D3Q19_BW, 1, 0, 1) \
144 X(TW, D3Q19_TW, D3Q19_BE, -1, 0, 1) \
145 X(TS, D3Q19_TS, D3Q19_BN, 0, -1, 1) \
146 X(B, D3Q19_B, D3Q19_T, 0, 0, -1) \
147 X(BS, D3Q19_BS, D3Q19_TN, 0, -1, -1) \
148 X(BN, D3Q19_BN, D3Q19_TS, 0, 1, -1) \
149 X(BW, D3Q19_BW, D3Q19_TE, -1, 0, -1) \
150 X(BE, D3Q19_BE, D3Q19_TW, 1, 0, -1)
153 extern int D3Q19_X[N_D3Q19];
154 extern int D3Q19_Y[N_D3Q19];
155 extern int D3Q19_Z[N_D3Q19];
156 extern int D3Q19_INV[N_D3Q19];
158 extern const char * D3Q19_NAMES[N_D3Q19];
162 typedef struct CaseData_ {
173 int StatisticsModulus;
177 typedef struct KernelData_ {
187 int * BounceBackPdfsSrc;
188 int * BounceBackPdfsDst;
191 void (* BoundaryConditionsGetPdf)(struct KernelData_ * kd, int x, int y, int z, int dir, PdfT * pdf);
192 void (* BoundaryConditionsSetPdf)(struct KernelData_ * kd, int x, int y, int z, int dir, PdfT pdf);
194 void (* GetNode)(struct KernelData_ * kd, int x, int y, int z, PdfT * pdfs);
195 void (* SetNode)(struct KernelData_ * kd, int x, int y, int z, PdfT * pdfs);
197 void (* Kernel)(LatticeDesc * ld, struct KernelData_ * kd, CaseData * cd);
201 typedef struct Parameters_ {
208 void KernelComputeBoundaryConditions(KernelData * kd, LatticeDesc * ld, CaseData * cd);
210 PdfT KernelDensity(KernelData * kd, LatticeDesc * ld);
212 void KernelStatistics(KernelData * kd, LatticeDesc * ld, CaseData * cd, int iteration);
213 void KernelStatisticsAdv(KernelData * kd, LatticeDesc * ld, CaseData * cd, int iteration, int forceOutput);
216 void KernelSetInitialDensity (LatticeDesc * ld, KernelData * kd, CaseData * cd);
217 void KernelSetInitialVelocity(LatticeDesc * ld, KernelData * kd, CaseData * cd);
219 void KernelVerifiy(LatticeDesc * ld, KernelData * kd, CaseData * cd, PdfT * errorNorm);
221 void KernelAddBodyForce(KernelData * kd, LatticeDesc * ld, CaseData * cd);
223 #endif // __KERNEL_H__