Commit | Line | Data |
---|---|---|
10988083 MW |
1 | // -------------------------------------------------------------------------- |
2 | // | |
3 | // Copyright | |
4 | // Markus Wittmann, 2016-2017 | |
5 | // RRZE, University of Erlangen-Nuremberg, Germany | |
6 | // markus.wittmann -at- fau.de or hpc -at- rrze.fau.de | |
7 | // | |
8 | // Viktor Haag, 2016 | |
9 | // LSS, University of Erlangen-Nuremberg, Germany | |
10 | // | |
11 | // This file is part of the Lattice Boltzmann Benchmark Kernels (LbmBenchKernels). | |
12 | // | |
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. | |
17 | // | |
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. | |
22 | // | |
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/>. | |
25 | // | |
26 | // -------------------------------------------------------------------------- | |
27 | #include "BenchKernelD3Q19ListAaCommon.h" | |
28 | ||
29 | #include "Memory.h" | |
30 | #include "Vtk.h" | |
31 | #include "LikwidIf.h" | |
32 | ||
33 | #include <inttypes.h> | |
34 | #include <math.h> | |
35 | ||
36 | void FNAME(D3Q19ListAaKernel)(LatticeDesc * ld, KernelData * kernelData, CaseData * cd) | |
37 | { | |
38 | Assert(ld != NULL); | |
39 | Assert(kernelData != NULL); | |
40 | Assert(cd != NULL); | |
41 | ||
0fde6e45 MW |
42 | Assert(cd->Omega > F(0.0)); |
43 | Assert(cd->Omega < F(2.0)); | |
10988083 MW |
44 | |
45 | KernelData * kd = (KernelData *)kernelData; | |
46 | KernelDataList * kdl = (KernelDataList *)kernelData; | |
47 | ||
48 | PdfT omega = cd->Omega; | |
49 | PdfT omegaEven = omega; | |
50 | // 1/4: best stability; | |
51 | // 1/12: removes third-order advection error (best advection); | |
52 | // 1/6: removes fourth-order diffusion error (best diffusion); | |
53 | // 3/16: exact location of bounce back for poiseuille flow | |
0fde6e45 MW |
54 | PdfT magicParam = F(1.0)/F(12.0); |
55 | PdfT omegaOdd = F(1.0)/( F(0.5) + magicParam/(F(1.0)/omega - F(0.5)) ); | |
10988083 | 56 | |
0fde6e45 MW |
57 | PdfT evenPart = F(0.0); |
58 | PdfT oddPart = F(0.0); | |
59 | PdfT dir_indep_trm = F(0.0); | |
10988083 | 60 | |
0fde6e45 MW |
61 | const PdfT w_0 = F(1.0) / F(3.0); |
62 | const PdfT w_1 = F(1.0) / F(18.0); | |
63 | const PdfT w_2 = F(1.0) / F(36.0); | |
10988083 | 64 | |
0fde6e45 MW |
65 | const PdfT w_1_x3 = w_1 * F(3.0); const PdfT w_1_nine_half = w_1 * F(9.0)/F(2.0); PdfT w_1_indep = F(0.0); |
66 | const PdfT w_2_x3 = w_2 * F(3.0); const PdfT w_2_nine_half = w_2 * F(9.0)/F(2.0); PdfT w_2_indep = F(0.0); | |
10988083 MW |
67 | |
68 | PdfT ui; | |
69 | ||
70 | PdfT ux, uy, uz; | |
71 | PdfT dens; | |
72 | ||
73 | // Declare pdf_N, pdf_E, pdf_S, pdf_W, ... | |
74 | #define X(name, idx, idxinv, x, y, z) PdfT JOIN(pdf_,name); | |
75 | D3Q19_LIST | |
76 | #undef X | |
77 | ||
78 | PdfT * src = kd->Pdfs[0]; | |
79 | ||
80 | int maxIterations = cd->MaxIterations; | |
81 | int nFluid = kdl->nFluid; | |
82 | int nCells = kdl->nCells; | |
83 | ||
84 | uint32_t adjListIndex; | |
85 | uint32_t * adjList = kdl->AdjList; | |
86 | ||
87 | ||
88 | ||
89 | #ifdef VTK_OUTPUT | |
90 | if (cd->VtkOutput) { | |
91 | kd->PdfsActive = src; | |
92 | VtkWrite(ld, kd, cd, -1); | |
93 | } | |
94 | #endif | |
95 | ||
96 | #ifdef STATISTICS | |
97 | kd->PdfsActive = src; | |
98 | KernelStatistics(kd, ld, cd, 0); | |
99 | #endif | |
100 | ||
101 | // TODO: outer openmp parallel | |
102 | for(int iter = 0; iter < maxIterations; iter += 2) { | |
103 | ||
104 | ||
105 | // -------------------------------------------------------------------- | |
106 | // even time step | |
107 | ||
108 | X_LIKWID_START("list-aa-even"); | |
109 | ||
0fde6e45 | 110 | #ifdef _OPENMP |
10988083 MW |
111 | #pragma omp parallel for default(none) \ |
112 | shared(nFluid, nCells, kd, kdl, adjList, omegaOdd, omegaEven, src) \ | |
113 | private(ux, uy, uz, dens, adjListIndex, evenPart, oddPart, dir_indep_trm, w_1_indep, w_2_indep, ui,\ | |
114 | pdf_C, \ | |
115 | pdf_N, pdf_E, pdf_S, pdf_W, \ | |
116 | pdf_NE, pdf_SE, pdf_SW, pdf_NW, \ | |
117 | pdf_T, pdf_TN, pdf_TE, pdf_TS, pdf_TW, \ | |
118 | pdf_B, pdf_BN, pdf_BE, pdf_BS, pdf_BW) | |
0fde6e45 MW |
119 | #endif |
120 | #ifdef INTEL_OPT_DIRECTIVES | |
121 | #pragma ivdep | |
122 | #pragma vector always | |
123 | #pragma simd | |
124 | #endif | |
10988083 MW |
125 | for (int index = 0; index < nFluid; ++index) { |
126 | ||
127 | ||
128 | #define I(index, dir) P_INDEX_3((nCells), (index), (dir)) | |
129 | ||
130 | // Load PDFs of local cell: pdf_N = src[I(x, y, z, D3Q19_N)]; ... | |
131 | #define X(name, idx, idxinv, _x, _y, _z) JOIN(pdf_,name) = src[I(index, idx)]; | |
132 | D3Q19_LIST | |
133 | #undef X | |
134 | ||
135 | // #define LID_DRIVEN_CAVITY | |
136 | ||
137 | #ifdef LID_DRIVEN_CAVITY | |
138 | int nX = kd->Dims[0]; | |
139 | int nY = kd->Dims[1]; | |
140 | int nZ = kd->Dims[2]; | |
141 | ||
142 | int x = kdl->Coords[C_INDEX_X(index)]; | |
143 | int y = kdl->Coords[C_INDEX_Y(index)]; | |
144 | int z = kdl->Coords[C_INDEX_Z(index)]; | |
145 | ||
146 | if (z == nZ - 4 && x > 3 && x < (nX - 4) && y > 3 && y < (nY - 4)) { | |
147 | ux = 0.1 * 0.577; | |
148 | uy = 0.0; | |
149 | uz = 0.0; | |
150 | } else { | |
151 | #endif | |
152 | ux = pdf_E + pdf_NE + pdf_SE + pdf_TE + pdf_BE - | |
153 | pdf_W - pdf_NW - pdf_SW - pdf_TW - pdf_BW; | |
154 | uy = pdf_N + pdf_NE + pdf_NW + pdf_TN + pdf_BN - | |
155 | pdf_S - pdf_SE - pdf_SW - pdf_TS - pdf_BS; | |
156 | uz = pdf_T + pdf_TE + pdf_TW + pdf_TN + pdf_TS - | |
157 | pdf_B - pdf_BE - pdf_BW - pdf_BN - pdf_BS; | |
158 | #ifdef LID_DRIVEN_CAVITY | |
159 | } | |
160 | #endif | |
161 | ||
162 | dens = pdf_C + | |
163 | pdf_N + pdf_E + pdf_S + pdf_W + | |
164 | pdf_NE + pdf_SE + pdf_SW + pdf_NW + | |
165 | pdf_T + pdf_TN + pdf_TE + pdf_TS + pdf_TW + | |
166 | pdf_B + pdf_BN + pdf_BE + pdf_BS + pdf_BW; | |
167 | ||
0fde6e45 | 168 | dir_indep_trm = dens - (ux * ux + uy * uy + uz * uz)*F(3.0)/F(2.0); |
10988083 MW |
169 | |
170 | // direction: w_0 | |
171 | src[I(index, D3Q19_C) ] = pdf_C - omegaEven*(pdf_C - w_0*dir_indep_trm); | |
172 | ||
173 | // direction: w_1 | |
174 | w_1_indep = w_1*dir_indep_trm; | |
175 | ||
176 | ui = uy; | |
0fde6e45 MW |
177 | evenPart = omegaEven*( F(0.5)*(pdf_N + pdf_S) - ui*ui*w_1_nine_half - w_1_indep ); |
178 | oddPart = omegaOdd*(F(0.5)*(pdf_N - pdf_S) - ui*w_1_x3 ); | |
10988083 MW |
179 | src[I(index, D3Q19_S)] = pdf_N - evenPart - oddPart; |
180 | src[I(index, D3Q19_N)] = pdf_S - evenPart + oddPart; | |
181 | ||
182 | ui = ux; | |
0fde6e45 MW |
183 | evenPart = omegaEven*( F(0.5)*(pdf_E + pdf_W) - ui*ui*w_1_nine_half - w_1_indep ); |
184 | oddPart = omegaOdd*(F(0.5)*(pdf_E - pdf_W) - ui*w_1_x3 ); | |
10988083 MW |
185 | src[I(index, D3Q19_W)] = pdf_E - evenPart - oddPart; |
186 | src[I(index, D3Q19_E)] = pdf_W - evenPart + oddPart; | |
187 | ||
188 | ui = uz; | |
0fde6e45 MW |
189 | evenPart = omegaEven*( F(0.5)*(pdf_T + pdf_B) - ui*ui*w_1_nine_half - w_1_indep ); |
190 | oddPart = omegaOdd*(F(0.5)*(pdf_T - pdf_B) - ui*w_1_x3 ); | |
10988083 MW |
191 | src[I(index, D3Q19_B)] = pdf_T - evenPart - oddPart; |
192 | src[I(index, D3Q19_T)] = pdf_B - evenPart + oddPart; | |
193 | ||
194 | // direction: w_2 | |
195 | w_2_indep = w_2*dir_indep_trm; | |
196 | ||
197 | ui = -ux + uy; | |
0fde6e45 MW |
198 | evenPart = omegaEven*( F(0.5)*(pdf_NW + pdf_SE) - ui*ui*w_2_nine_half - w_2_indep ); |
199 | oddPart = omegaOdd*(F(0.5)*(pdf_NW - pdf_SE) - ui*w_2_x3 ); | |
10988083 MW |
200 | src[I(index, D3Q19_SE)] = pdf_NW - evenPart - oddPart; |
201 | src[I(index, D3Q19_NW)] = pdf_SE - evenPart + oddPart; | |
202 | ||
203 | ui = ux + uy; | |
0fde6e45 MW |
204 | evenPart = omegaEven*( F(0.5)*(pdf_NE + pdf_SW) - ui*ui*w_2_nine_half - w_2_indep ); |
205 | oddPart = omegaOdd*(F(0.5)*(pdf_NE - pdf_SW) - ui*w_2_x3 ); | |
10988083 MW |
206 | src[I(index, D3Q19_SW)] = pdf_NE - evenPart - oddPart; |
207 | src[I(index, D3Q19_NE)] = pdf_SW - evenPart + oddPart; | |
208 | ||
209 | ui = -ux + uz; | |
0fde6e45 MW |
210 | evenPart = omegaEven*( F(0.5)*(pdf_TW + pdf_BE) - ui*ui*w_2_nine_half - w_2_indep ); |
211 | oddPart = omegaOdd*(F(0.5)*(pdf_TW - pdf_BE) - ui*w_2_x3 ); | |
10988083 MW |
212 | src[I(index, D3Q19_BE)] = pdf_TW - evenPart - oddPart; |
213 | src[I(index, D3Q19_TW)] = pdf_BE - evenPart + oddPart; | |
214 | ||
215 | ui = ux + uz; | |
0fde6e45 MW |
216 | evenPart = omegaEven*( F(0.5)*(pdf_TE + pdf_BW) - ui*ui*w_2_nine_half - w_2_indep ); |
217 | oddPart = omegaOdd*(F(0.5)*(pdf_TE - pdf_BW) - ui*w_2_x3 ); | |
10988083 MW |
218 | src[I(index, D3Q19_BW)] = pdf_TE - evenPart - oddPart; |
219 | src[I(index, D3Q19_TE)] = pdf_BW - evenPart + oddPart; | |
220 | ||
221 | ui = -uy + uz; | |
0fde6e45 MW |
222 | evenPart = omegaEven*( F(0.5)*(pdf_TS + pdf_BN) - ui*ui*w_2_nine_half - w_2_indep ); |
223 | oddPart = omegaOdd*(F(0.5)*(pdf_TS - pdf_BN) - ui*w_2_x3 ); | |
10988083 MW |
224 | src[I(index, D3Q19_BN)] = pdf_TS - evenPart - oddPart; |
225 | src[I(index, D3Q19_TS)] = pdf_BN - evenPart + oddPart; | |
226 | ||
227 | ui = uy + uz; | |
0fde6e45 MW |
228 | evenPart = omegaEven*( F(0.5)*(pdf_TN + pdf_BS) - ui*ui*w_2_nine_half - w_2_indep ); |
229 | oddPart = omegaOdd*(F(0.5)*(pdf_TN - pdf_BS) - ui*w_2_x3 ); | |
10988083 MW |
230 | src[I(index, D3Q19_BS)] = pdf_TN - evenPart - oddPart; |
231 | src[I(index, D3Q19_TN)] = pdf_BS - evenPart + oddPart; | |
232 | ||
233 | } // loop over fluid nodes | |
234 | ||
235 | X_LIKWID_STOP("list-aa-even"); | |
236 | ||
237 | // save current iteration | |
238 | kdl->Iteration = iter; | |
239 | #ifdef VERIFICATION | |
240 | kd->PdfsActive = src; | |
241 | KernelAddBodyForce(kd, ld, cd); | |
242 | #endif | |
243 | ||
244 | // -------------------------------------------------------------------- | |
245 | // odd time step | |
246 | ||
247 | X_LIKWID_START("list-aa-odd"); | |
248 | ||
249 | #ifdef _OPENMP | |
250 | #pragma omp parallel for default(none) \ | |
251 | shared(nFluid, nCells, kd, kdl, adjList, omegaOdd, omegaEven, src) \ | |
252 | private(ux, uy, uz, dens, adjListIndex, evenPart, oddPart, dir_indep_trm, w_1_indep, w_2_indep, ui,\ | |
253 | pdf_C, \ | |
254 | pdf_N, pdf_E, pdf_S, pdf_W, \ | |
255 | pdf_NE, pdf_SE, pdf_SW, pdf_NW, \ | |
256 | pdf_T, pdf_TN, pdf_TE, pdf_TS, pdf_TW, \ | |
257 | pdf_B, pdf_BN, pdf_BE, pdf_BS, pdf_BW) | |
0fde6e45 MW |
258 | #endif |
259 | #ifdef INTEL_OPT_DIRECTIVES | |
260 | #pragma ivdep | |
10988083 MW |
261 | #endif |
262 | for (int index = 0; index < nFluid; ++index) { | |
263 | ||
264 | ||
265 | adjListIndex = index * N_D3Q19_IDX; | |
266 | ||
267 | // Load PDFs of local cell: pdf_N = src[adjList[adjListIndex + D3Q19_S]]; ... | |
268 | pdf_C = src[P_INDEX_3(nCells, index, D3Q19_C)]; | |
269 | ||
270 | #define X(name, idx, idxinv, _x, _y, _z) JOIN(pdf_,name) = src[adjList[adjListIndex + idxinv]]; | |
271 | D3Q19_LIST_WO_C | |
272 | #undef X | |
273 | ||
274 | #ifdef LID_DRIVEN_CAVITY | |
275 | int nX = kd->Dims[0]; | |
276 | int nY = kd->Dims[1]; | |
277 | int nZ = kd->Dims[2]; | |
278 | ||
279 | int x = kdl->Coords[C_INDEX_X(index)]; | |
280 | int y = kdl->Coords[C_INDEX_Y(index)]; | |
281 | int z = kdl->Coords[C_INDEX_Z(index)]; | |
282 | ||
283 | if (z == nZ - 4 && x > 3 && x < (nX - 4) && y > 3 && y < (nY - 4)) { | |
0fde6e45 MW |
284 | ux = F(0.1) * F(0.5)77; |
285 | uy = F(0.0); | |
286 | uz = F(0.0); | |
10988083 MW |
287 | } else { |
288 | #endif | |
289 | ux = pdf_E + pdf_NE + pdf_SE + pdf_TE + pdf_BE - | |
290 | pdf_W - pdf_NW - pdf_SW - pdf_TW - pdf_BW; | |
291 | uy = pdf_N + pdf_NE + pdf_NW + pdf_TN + pdf_BN - | |
292 | pdf_S - pdf_SE - pdf_SW - pdf_TS - pdf_BS; | |
293 | uz = pdf_T + pdf_TE + pdf_TW + pdf_TN + pdf_TS - | |
294 | pdf_B - pdf_BE - pdf_BW - pdf_BN - pdf_BS; | |
295 | #ifdef LID_DRIVEN_CAVITY | |
296 | } | |
297 | #endif | |
298 | ||
299 | dens = pdf_C + | |
300 | pdf_N + pdf_E + pdf_S + pdf_W + | |
301 | pdf_NE + pdf_SE + pdf_SW + pdf_NW + | |
302 | pdf_T + pdf_TN + pdf_TE + pdf_TS + pdf_TW + | |
303 | pdf_B + pdf_BN + pdf_BE + pdf_BS + pdf_BW; | |
304 | ||
0fde6e45 | 305 | dir_indep_trm = dens - (ux * ux + uy * uy + uz * uz)*F(3.0)/F(2.0); |
10988083 MW |
306 | |
307 | adjListIndex = index * N_D3Q19_IDX; | |
308 | ||
309 | // direction: w_0 | |
310 | src[I(index, D3Q19_C) ] = pdf_C - omegaEven*(pdf_C - w_0*dir_indep_trm); | |
311 | ||
312 | // direction: w_1 | |
313 | w_1_indep = w_1*dir_indep_trm; | |
314 | ||
315 | ui = uy; | |
0fde6e45 MW |
316 | evenPart = omegaEven*( F(0.5)*(pdf_N + pdf_S) - ui*ui*w_1_nine_half - w_1_indep ); |
317 | oddPart = omegaOdd*(F(0.5)*(pdf_N - pdf_S) - ui*w_1_x3 ); | |
10988083 MW |
318 | src[adjList[adjListIndex + D3Q19_N]] = pdf_N - evenPart - oddPart; |
319 | src[adjList[adjListIndex + D3Q19_S]] = pdf_S - evenPart + oddPart; | |
320 | ||
321 | ui = ux; | |
0fde6e45 MW |
322 | evenPart = omegaEven*( F(0.5)*(pdf_E + pdf_W) - ui*ui*w_1_nine_half - w_1_indep ); |
323 | oddPart = omegaOdd*(F(0.5)*(pdf_E - pdf_W) - ui*w_1_x3 ); | |
10988083 MW |
324 | src[adjList[adjListIndex + D3Q19_E]] = pdf_E - evenPart - oddPart; |
325 | src[adjList[adjListIndex + D3Q19_W]] = pdf_W - evenPart + oddPart; | |
326 | ||
327 | ui = uz; | |
0fde6e45 MW |
328 | evenPart = omegaEven*( F(0.5)*(pdf_T + pdf_B) - ui*ui*w_1_nine_half - w_1_indep ); |
329 | oddPart = omegaOdd*(F(0.5)*(pdf_T - pdf_B) - ui*w_1_x3 ); | |
10988083 MW |
330 | src[adjList[adjListIndex + D3Q19_T]] = pdf_T - evenPart - oddPart; |
331 | src[adjList[adjListIndex + D3Q19_B]] = pdf_B - evenPart + oddPart; | |
332 | ||
333 | // direction: w_2 | |
334 | w_2_indep = w_2*dir_indep_trm; | |
335 | ||
336 | ui = -ux + uy; | |
0fde6e45 MW |
337 | evenPart = omegaEven*( F(0.5)*(pdf_NW + pdf_SE) - ui*ui*w_2_nine_half - w_2_indep ); |
338 | oddPart = omegaOdd*(F(0.5)*(pdf_NW - pdf_SE) - ui*w_2_x3 ); | |
10988083 MW |
339 | src[adjList[adjListIndex + D3Q19_NW]] = pdf_NW - evenPart - oddPart; |
340 | src[adjList[adjListIndex + D3Q19_SE]] = pdf_SE - evenPart + oddPart; | |
341 | ||
342 | ui = ux + uy; | |
0fde6e45 MW |
343 | evenPart = omegaEven*( F(0.5)*(pdf_NE + pdf_SW) - ui*ui*w_2_nine_half - w_2_indep ); |
344 | oddPart = omegaOdd*(F(0.5)*(pdf_NE - pdf_SW) - ui*w_2_x3 ); | |
10988083 MW |
345 | src[adjList[adjListIndex + D3Q19_NE]] = pdf_NE - evenPart - oddPart; |
346 | src[adjList[adjListIndex + D3Q19_SW]] = pdf_SW - evenPart + oddPart; | |
347 | ||
348 | ui = -ux + uz; | |
0fde6e45 MW |
349 | evenPart = omegaEven*( F(0.5)*(pdf_TW + pdf_BE) - ui*ui*w_2_nine_half - w_2_indep ); |
350 | oddPart = omegaOdd*(F(0.5)*(pdf_TW - pdf_BE) - ui*w_2_x3 ); | |
10988083 MW |
351 | src[adjList[adjListIndex + D3Q19_TW]] = pdf_TW - evenPart - oddPart; |
352 | src[adjList[adjListIndex + D3Q19_BE]] = pdf_BE - evenPart + oddPart; | |
353 | ||
354 | ui = ux + uz; | |
0fde6e45 MW |
355 | evenPart = omegaEven*( F(0.5)*(pdf_TE + pdf_BW) - ui*ui*w_2_nine_half - w_2_indep ); |
356 | oddPart = omegaOdd*(F(0.5)*(pdf_TE - pdf_BW) - ui*w_2_x3 ); | |
10988083 MW |
357 | src[adjList[adjListIndex + D3Q19_TE]] = pdf_TE - evenPart - oddPart; |
358 | src[adjList[adjListIndex + D3Q19_BW]] = pdf_BW - evenPart + oddPart; | |
359 | ||
360 | ui = -uy + uz; | |
0fde6e45 MW |
361 | evenPart = omegaEven*( F(0.5)*(pdf_TS + pdf_BN) - ui*ui*w_2_nine_half - w_2_indep ); |
362 | oddPart = omegaOdd*(F(0.5)*(pdf_TS - pdf_BN) - ui*w_2_x3 ); | |
10988083 MW |
363 | src[adjList[adjListIndex + D3Q19_TS]] = pdf_TS - evenPart - oddPart; |
364 | src[adjList[adjListIndex + D3Q19_BN]] = pdf_BN - evenPart + oddPart; | |
365 | ||
366 | ui = uy + uz; | |
0fde6e45 MW |
367 | evenPart = omegaEven*( F(0.5)*(pdf_TN + pdf_BS) - ui*ui*w_2_nine_half - w_2_indep ); |
368 | oddPart = omegaOdd*(F(0.5)*(pdf_TN - pdf_BS) - ui*w_2_x3 ); | |
10988083 MW |
369 | src[adjList[adjListIndex + D3Q19_TN]] = pdf_TN - evenPart - oddPart; |
370 | src[adjList[adjListIndex + D3Q19_BS]] = pdf_BS - evenPart + oddPart; | |
371 | ||
372 | #undef I | |
373 | } // loop over fluid nodes | |
374 | ||
375 | X_LIKWID_STOP("list-aa-odd"); | |
376 | ||
377 | // save current iteration | |
378 | kdl->Iteration = iter + 1; | |
379 | ||
380 | #ifdef VERIFICATION | |
381 | kd->PdfsActive = src; | |
382 | KernelAddBodyForce(kd, ld, cd); | |
383 | #endif | |
384 | ||
385 | #ifdef VTK_OUTPUT | |
386 | if (cd->VtkOutput && (iter % cd->VtkModulus) == 0) { | |
387 | kd->PdfsActive = src; | |
388 | VtkWrite(ld, kd, cd, iter); | |
389 | } | |
390 | #endif | |
391 | ||
392 | #ifdef STATISTICS | |
393 | kd->PdfsActive = src; | |
394 | KernelStatistics(kd, ld, cd, iter); | |
395 | #endif | |
396 | ||
397 | ||
398 | } // for (int iter = 0; ... | |
399 | ||
400 | ||
401 | #ifdef VTK_OUTPUT | |
402 | if (cd->VtkOutput) { | |
403 | kd->PdfsActive = src; | |
404 | VtkWrite(ld, kd, cd, maxIterations); | |
405 | } | |
406 | #endif | |
407 | ||
408 | #ifdef STATISTICS | |
409 | kd->PdfsActive = src; | |
410 | KernelStatistics(kd, ld, cd, maxIterations); | |
411 | #endif | |
412 | ||
413 | return; | |
414 | } |