OpenLB 1.7
Loading...
Searching...
No Matches
mrtLatticeDescriptors.h
Go to the documentation of this file.
1/* This file is part of the OpenLB library
2 *
3 * Copyright (C) 2019 Adrian Kummerlaender
4 * E-mail contact: info@openlb.net
5 * The most recent release of OpenLB can be downloaded at
6 * <http://www.openlb.net/>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public
19 * License along with this program; if not, write to the Free
20 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
22*/
23
30#ifndef MRT_LATTICE_DESCRIPTORS_H
31#define MRT_LATTICE_DESCRIPTORS_H
32
33#include "latticeDescriptors.h"
34
35namespace olb {
36
38
49namespace descriptors {
50
51namespace tag {
52
53struct MRT : public CATEGORY, public DESCRIPTOR_TAG { };
54
55}
56
57
58
59namespace mrt_data {
60
62
63// Matrix of base change between f and moments : moments=M.f
64template <unsigned D, unsigned Q>
66
67// inverse of base change matrix : f=invM.moments
68template <unsigned D, unsigned Q>
70
71// relaxation times
72template <unsigned D, unsigned Q>
74
75// relaxation times
76template <unsigned D, unsigned Q>
78
79template <unsigned D, unsigned Q>
81
82// relevant indexes of r. t. for shear viscosity
83template <unsigned D, unsigned Q>
84platform_constant int shearViscIndexes[shearIndexes<D,Q>] = {};
85
86// relevant index of r. t. for bulk viscosity
87template <unsigned D, unsigned Q>
89
91
96template <>
98 { 1, 1, 1, 1, 1},
99 { 0,-1, 0, 1, 0},
100 { 0, 0,-1, 0, 1},
101 {-4, 1, 1, 1, 1},
102 { 0, 1,-1, 1,-1}
103};
104
108template <>
110 { 1, 1, 1, 1, 1, 1, 1, 1, 1},
111 {-4, 2, -1, 2, -1, 2, -1, 2, -1},
112 { 4, 1, -2, 1, -2, 1, -2, 1, -2},
113 { 0, -1, -1, -1, 0, 1, 1, 1, 0},
114 { 0, -1, 2, -1, 0, 1, -2, 1, 0},
115 { 0, 1, 0, -1, -1, -1, 0, 1, 1},
116 { 0, 1, 0, -1, 2, -1, 0, 1, -2},
117 { 0, 0, 1, 0, -1, 0, 1, 0, -1},
118 { 0, -1, 0, 1, 0, -1, 0, 1, 0}
119};
120
122
130template <>
132 // Li, Yang et al 2016: The directions are modified for the OpenLB definition
133 {1, 1, 1, 1, 1, 1, 1},
134 {0, -1, 0, 0, 1, 0, 0},
135 {0, 0, -1, 0, 0, 1, 0},
136 {0, 0, 0, -1, 0, 0, 1},
137 {6, -1, -1, -1, -1, -1, -1},
138 {0, 2, -1, -1, 2, -1, -1},
139 {0, 0, 1, -1, 0, 1, -1}
140};
141
146template <>
148 { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
149 {-30,-11,-11,-11, 8, 8, 8, 8, 8, 8,-11,-11,-11, 8, 8, 8, 8, 8, 8},
150 { 12, -4, -4, -4, 1, 1, 1, 1, 1, 1, -4, -4, -4, 1, 1, 1, 1, 1, 1},
151 { 0, -1, 0, 0, -1, -1, -1, -1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0},
152 { 0, 4, 0, 0, -1, -1, -1, -1, 0, 0, -4, 0, 0, 1, 1, 1, 1, 0, 0},
153 { 0, 0, -1, 0, -1, 1, 0, 0, -1, -1, 0, 1, 0, 1, -1, 0, 0, 1, 1},
154 { 0, 0, 4, 0, -1, 1, 0, 0, -1, -1, 0, -4, 0, 1, -1, 0, 0, 1, 1},
155 { 0, 0, 0, -1, 0, 0, -1, 1, -1, 1, 0, 0, 1, 0, 0, 1, -1, 1, -1},
156 { 0, 0, 0, 4, 0, 0, -1, 1, -1, 1, 0, 0, -4, 0, 0, 1, -1, 1, -1},
157 { 0, 2, -1, -1, 1, 1, 1, 1, -2, -2, 2, -1, -1, 1, 1, 1, 1, -2, -2},
158 { 0, -4, 2, 2, 1, 1, 1, 1, -2, -2, -4, 2, 2, 1, 1, 1, 1, -2, -2},
159 { 0, 0, 1, -1, 1, 1, -1, -1, 0, 0, 0, 1, -1, 1, 1, -1, -1, 0, 0},
160 { 0, 0, -2, 2, 1, 1, -1, -1, 0, 0, 0, -2, 2, 1, 1, -1, -1, 0, 0},
161 { 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 0, 0, 0, 1, -1, 0, 0, 0, 0},
162 { 0, 0, 0, 0, 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 0, 0, 0, 1, -1},
163 { 0, 0, 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 0, 0, 0, 1, -1, 0, 0},
164 { 0, 0, 0, 0, -1, -1, 1, 1, 0, 0, 0, 0, 0, 1, 1, -1, -1, 0, 0},
165 { 0, 0, 0, 0, 1, -1, 0, 0, -1, -1, 0, 0, 0, -1, 1, 0, 0, 1, 1},
166 { 0, 0, 0, 0, 0, 0, -1, 1, 1, -1, 0, 0, 0, 0, 0, 1, -1, -1, 1}
167};
168
169template <>
171 {{1, 5}, 0, 0, {-1, 5}, 0},
172 {{1, 5}, {-1, 2}, 0, { 1, 20}, { 1, 4}},
173 {{1, 5}, 0, {-1, 2}, { 1, 20}, {-1, 4}},
174 {{1, 5}, { 1, 2}, 0, { 1, 20}, { 1, 4}},
175 {{1, 5}, 0, { 1, 2}, { 1, 20}, {-1, 4}}
176};
177
178template <>
180 {{1, 9}, {-1, 9}, { 1, 9}, 0, 0, 0, 0, 0, 0},
181 {{1, 9}, { 1, 18}, { 1, 36}, {-1, 6}, {-1, 12}, { 1, 6}, { 1, 12}, 0, {-1, 4}},
182 {{1, 9}, {-1, 36}, {-1, 18}, {-1, 6}, { 1, 6}, 0, 0, { 1, 4}, 0},
183 {{1, 9}, { 1, 18}, { 1, 36}, {-1, 6}, {-1, 12}, {-1, 6}, {-1, 12}, 0, { 1, 4}},
184 {{1, 9}, {-1, 36}, {-1, 18}, 0, 0, {-1, 6}, { 1, 6}, {-1, 4}, 0},
185 {{1, 9}, { 1, 18}, { 1, 36}, { 1, 6}, { 1, 12}, {-1, 6}, {-1, 12}, 0, {-1, 4}},
186 {{1, 9}, {-1, 36}, {-1, 18}, { 1, 6}, {-1, 6}, 0, 0, { 1, 4}, 0},
187 {{1, 9}, { 1, 18}, { 1, 36}, { 1, 6}, { 1, 12}, { 1, 6}, { 1, 12}, 0, { 1, 4}},
188 {{1, 9}, {-1, 36}, {-1, 18}, 0, 0, { 1, 6}, {-1, 6}, {-1, 4}, 0}
189};
190
191template <>
193 // Li, Yang et al 2016: The directions are modified for the OpenLB definition
194 {{1, 7}, 0, 0, 0, { 1, 7}, 0, 0},
195 {{1, 7}, {-1, 2}, 0, 0, {-1, 42}, { 1, 6}, 0},
196 {{1, 7}, 0, {-1, 2}, 0, {-1, 42}, {-1, 12}, { 1, 4}},
197 {{1, 7}, 0, 0, {-1, 2}, {-1, 42}, {-1, 12}, {-1, 4}},
198 {{1, 7}, { 1, 2}, 0, 0, {-1, 42}, { 1, 6}, 0},
199 {{1, 7}, 0, { 1, 2}, 0, {-1, 42}, {-1, 12}, { 1, 4}},
200 {{1, 7}, 0, 0, { 1, 2}, {-1, 42}, {-1, 12}, {-1, 4}}
201};
202
203template <>
205 { {1,19}, { -5, 399}, { 1, 21}, 0, 0, 0, 0,
206 0, 0, 0, 0, 0, 0,
207 0, 0, 0, 0, 0, 0
208 },/*0*/
209 { {1,19}, {-11, 2394}, {-1, 63}, {-1, 10}, { 1, 10}, 0, 0,
210 0, 0, { 1, 18}, {-1, 18}, 0, 0,
211 0, 0, 0, 0, 0, 0
212 },/*1*/
213 { {1,19}, {-11, 2394}, {-1, 63}, 0, 0, {-1, 10}, { 1, 10},
214 0, 0, {-1, 36}, { 1, 36}, { 1, 12}, {-1, 12},
215 0, 0, 0, 0, 0, 0
216 },/*2*/
217 { {1,19}, {-11, 2394}, {-1, 63}, 0, 0, 0, 0,
218 { -1, 10}, { 1, 10}, {-1, 36}, { 1, 36}, {-1, 12}, { 1, 12},
219 0, 0, 0, 0, 0, 0
220 },/*3*/
221 { {1,19}, { 4, 1197}, { 1, 252}, {-1, 10}, {-1, 40}, {-1, 10}, {-1, 40},
222 0, 0, { 1, 36}, { 1, 72}, { 1, 12}, { 1, 24},
223 { 1, 4}, 0, 0, {-1, 8}, { 1, 8}, 0
224 },/*4*/
225 { {1,19}, { 4, 1197}, { 1, 252}, {-1, 10}, {-1, 40}, { 1, 10}, { 1, 40},
226 0, 0, { 1, 36}, { 1, 72}, { 1, 12}, { 1, 24},
227 { -1, 4}, 0, 0, {-1, 8}, {-1, 8}, 0
228 },/*5*/
229 { {1,19}, { 4, 1197}, { 1, 252}, {-1, 10}, {-1, 40}, 0, 0,
230 { -1, 10}, {-1, 40}, { 1, 36}, { 1, 72}, {-1, 12}, {-1, 24},
231 0, 0, { 1, 4}, { 1, 8}, 0, {-1, 8}
232 },/*6*/
233 { {1,19}, { 4, 1197}, { 1, 252}, {-1, 10}, {-1, 40}, 0, 0,
234 { 1, 10}, { 1, 40}, { 1, 36}, { 1, 72}, {-1, 12}, {-1, 24},
235 0, 0, {-1, 4}, { 1, 8}, 0, { 1, 8}
236 },/*7*/
237 { {1,19}, { 4, 1197}, { 1, 252}, 0, 0, {-1, 10}, {-1, 40},
238 { -1, 10}, {-1, 40}, {-1, 18}, {-1, 36}, 0, 0,
239 0, { 1, 4}, 0, 0, {-1, 8}, { 1, 8}
240 },/*8*/
241 { {1,19}, { 4, 1197}, { 1, 252}, 0, 0, {-1, 10}, {-1, 40},
242 { 1, 10}, { 1, 40}, {-1, 18}, {-1, 36}, 0, 0,
243 0, {-1, 4}, 0, 0, {-1, 8}, {-1, 8}
244 },/*9*/
245 { {1,19}, {-11, 2394}, {-1, 63}, { 1, 10}, {-1, 10}, 0, 0,
246 0, 0, { 1, 18}, {-1, 18}, 0, 0,
247 0, 0, 0, 0, 0, 0
248 },/*10*/
249 { {1,19}, {-11, 2394}, {-1, 63}, 0, 0, { 1, 10}, {-1, 10},
250 0, 0, {-1, 36}, { 1, 36}, { 1, 12}, {-1, 12},
251 0, 0, 0, 0, 0, 0
252 },/*11*/
253 { {1,19}, {-11, 2394}, {-1, 63}, 0, 0, 0, 0,
254 { 1, 10}, {-1, 10}, {-1, 36}, { 1, 36}, {-1, 12}, { 1, 12},
255 0, 0, 0, 0, 0, 0
256 },/*12*/
257 { {1,19}, { 4, 1197}, { 1, 252}, { 1, 10}, { 1, 40}, { 1, 10}, { 1, 40},
258 0, 0, { 1, 36}, { 1, 72}, { 1, 12}, { 1, 24},
259 { 1, 4}, 0, 0, { 1, 8}, {-1, 8}, 0
260 },/*13*/
261 { {1,19}, { 4, 1197}, { 1, 252}, { 1, 10}, { 1, 40}, {-1, 10}, {-1, 40},
262 0, 0, { 1, 36}, { 1, 72}, { 1, 12}, { 1, 24},
263 { -1, 4}, 0, 0, { 1, 8}, { 1, 8}, 0
264 },/*14*/
265 { {1,19}, { 4, 1197}, { 1, 252}, { 1, 10}, { 1, 40}, 0, 0,
266 { 1, 10}, { 1, 40}, { 1, 36}, { 1, 72}, {-1, 12}, {-1, 24},
267 0, 0, { 1, 4}, {-1, 8}, 0, { 1, 8}
268 },/*15*/
269 { {1,19}, { 4, 1197}, { 1, 252}, { 1, 10}, { 1, 40}, 0, 0,
270 { -1, 10}, {-1, 40}, { 1, 36}, { 1, 72}, {-1, 12}, {-1, 24},
271 0, 0, {-1, 4}, {-1, 8}, 0, {-1, 8}
272 },/*16*/
273 { {1,19}, { 4, 1197}, { 1, 252}, 0, 0, { 1, 10}, { 1, 40},
274 { 1, 10}, { 1, 40}, {-1, 18}, {-1, 36}, 0, 0,
275 0, { 1, 4}, 0, 0, { 1, 8}, {-1, 8}
276 },/*17*/
277 { {1,19}, { 4, 1197}, { 1, 252}, 0, 0, { 1, 10}, { 1, 40},
278 { -1, 10}, {-1, 40}, {-1, 18}, {-1, 36}, 0, 0,
279 0, {-1, 4}, 0, 0, { 1, 8}, { 1, 8}
280 }/*18*/
281};
282
283template <>
285 0, 0, 0, {3, 2}, {3, 2}
286};
287
288// s7=s8 to have a shear viscosity nu
289// and the bulk viscosity depends on s2.
290template <>
292 0, {11, 10}, {11, 10}, 0, {11, 10}, 0, {11, 10}, 0, 0
293};
294
295template <>
297 // Original MRT Relaxation times
298 /*s0*/ 0, // rho (conserved)
299 /*s1*/ 0, // Function of the thermal diffusivity: S_a = 1/t_a = 1/(4*a + 1/2)
300 /*s2*/ 0, // Function of the thermal diffusivity: S_a = 1/t_a = 1/(4*a + 1/2)
301 /*s3*/ 0, // Function of the thermal diffusivity: S_a = 1/t_a = 1/(4*a + 1/2)
302 /*s4*/ {19, 10},
303 /*s5*/ {19, 10},
304 /*s6*/ {19, 10}
305};
306
307// Original MRT Relaxation times
308template <>
310 /*s0*/ 0, // rho (conserved)
311 /*s1*/ { 119, 100},
312 /*s2*/ { 7, 5},
313 /*s3*/ 0, // rho*ux (conserved)
314 /*s4*/ { 6, 5},
315 /*s5*/ 0, // rho*uy (conserved)
316 /*s6*/ { 6, 5}, // = s4
317 /*s7*/ 0, // rho*uz (conserved)
318 /*s8*/ { 6, 5}, // = s4
319 /*s9*/ 0, //should be equal to s13, used to define nu
320 /*s10*/ { 7, 5},
321 /*s11*/ 0, // = s9,
322 /*s12*/ { 7, 5},
323 /*s13*/ 0, //should be equal to s9, used to define nu
324 /*s14*/ 0, // = s13,
325 /*s15*/ 0, // = s13,
326 /*s16*/ { 99, 50},
327 /*s17*/ { 99, 50}, // = s16,
328 /*s18*/ { 99, 50} // = s16,
329};
330
331// Use these relaxation time for higher stability
332template <>
334 /*s0*/ 0, // rho (conserved)
335 /*s1*/ 1,
336 /*s2*/ 1,
337 /*s3*/ 0, // rho*ux (conserved)
338 /*s4*/ 1,
339 /*s5*/ 0, // rho*uy (conserved)
340 /*s6*/ 1, // = s4
341 /*s7*/ 0, // rho*uz (conserved)
342 /*s8*/ 1, // = s4
343 /*s9*/ 0, //should be equal to s13, used to define nu
344 /*s10*/ 1,
345 /*s11*/ 0, // = s9,
346 /*s12*/ 1,
347 /*s13*/ 0, //should be equal to s9, used to define nu
348 /*s14*/ 0, // = s13,
349 /*s15*/ 0, // = s13,
350 /*s16*/ 1,
351 /*s17*/ 1, // = s16,
352 /*s18*/ 1 // = s16,
353};
354
355template <>
357
358template <>
360
361template <>
363
364template <>
366
367template <>
369
370template <>
372
373template <>
375
376template <>
378
379template <>
381
382template <>
384
385} // mrt_data
386
387template <typename T, unsigned D, unsigned Q>
388constexpr T t(unsigned iPop, tag::MRT)
389{
390 return data::t<D,Q>[iPop].template as<T>();
391}
392
393template <typename T, unsigned D, unsigned Q>
394constexpr T m(unsigned iPop, unsigned jPop, tag::MRT)
395{
396 return mrt_data::M<D,Q>[iPop][jPop].template as<T>();
397}
398
399template <typename T, typename DESCRIPTOR>
400constexpr T m(unsigned iPop, unsigned jPop)
401{
402 return m<T, DESCRIPTOR::d, DESCRIPTOR::q>(iPop, jPop, typename DESCRIPTOR::category_tag());
403}
404
405template <typename T, unsigned D, unsigned Q>
406constexpr T invM(unsigned iPop, unsigned jPop, tag::MRT)
407{
408 return mrt_data::invM<D,Q>[iPop][jPop].template as<T>();
409}
410
411template <typename T, typename DESCRIPTOR>
412constexpr T invM(unsigned iPop, unsigned jPop)
413{
414 return invM<T, DESCRIPTOR::d, DESCRIPTOR::q>(iPop, jPop, typename DESCRIPTOR::category_tag());
415}
416
417template <typename T, unsigned D, unsigned Q>
418constexpr T s(unsigned iPop, tag::MRT)
419{
420 return mrt_data::s<D,Q>[iPop].template as<T>();
421}
422
423template <typename T, typename DESCRIPTOR>
424constexpr T s(unsigned iPop)
425{
426 return s<T, DESCRIPTOR::d, DESCRIPTOR::q>(iPop, typename DESCRIPTOR::category_tag());
427}
428
429template <typename T, unsigned D, unsigned Q>
430constexpr T s_2(unsigned iPop, tag::MRT)
431{
432 return mrt_data::s_2<D,Q>[iPop].template as<T>();
433}
434
435template <typename T, typename DESCRIPTOR>
436constexpr T s_2(unsigned iPop)
437{
438 return s_2<T, DESCRIPTOR::d, DESCRIPTOR::q>(iPop, typename DESCRIPTOR::category_tag());
439}
440
441template <unsigned D, unsigned Q>
442constexpr int shearIndexes(tag::MRT)
443{
444 return mrt_data::shearIndexes<D,Q>;
445}
446
447template <typename DESCRIPTOR>
448constexpr int shearIndexes()
449{
450 return shearIndexes<DESCRIPTOR::d, DESCRIPTOR::q>(typename DESCRIPTOR::category_tag());
451}
452
453template <unsigned D, unsigned Q>
454constexpr int shearViscIndexes(unsigned iPop, tag::MRT)
455{
456 return mrt_data::shearViscIndexes<D,Q>[iPop];
457}
458
459template <typename DESCRIPTOR>
460constexpr int shearViscIndexes(unsigned iPop)
461{
462 return shearViscIndexes<DESCRIPTOR::d, DESCRIPTOR::q>(iPop, typename DESCRIPTOR::category_tag());
463}
464
465template <unsigned D, unsigned Q>
467{
468 return mrt_data::bulkViscIndex<D,Q>;
469}
470
471template <typename DESCRIPTOR>
472constexpr int bulkViscIndex()
473{
474 return bulkViscIndex<DESCRIPTOR::d, DESCRIPTOR::q>(typename DESCRIPTOR::category_tag());
475}
476
477} // namespace descriptors
478
479} // namespace olb
480
481#endif
Floating-point independent fraction type.
Definition fraction.h:34
Descriptor for all types of 2D and 3D lattices.
platform_constant_definition int shearViscIndexes< 3, 7 >[shearIndexes< 3, 7 >]
platform_constant_definition int shearIndexes< 2, 5 >
platform_constant_definition int bulkViscIndex< 2, 9 >
platform_constant Fraction s_2[Q]
platform_constant int shearIndexes
platform_constant_definition Fraction invM< 2, 5 >[5][5]
platform_constant_definition int shearIndexes< 3, 19 >
platform_constant Fraction s[Q]
platform_constant int shearViscIndexes[shearIndexes< D, Q >]
platform_constant_definition Fraction s< 2, 9 >[9]
platform_constant_definition int shearIndexes< 3, 7 >
platform_constant_definition int shearViscIndexes< 2, 5 >[shearIndexes< 2, 5 >]
platform_constant_definition Fraction s< 3, 19 >[19]
platform_constant_definition int shearViscIndexes< 3, 19 >[shearIndexes< 3, 19 >]
platform_constant_definition Fraction s< 3, 7 >[7]
platform_constant_definition Fraction invM< 3, 19 >[19][19]
platform_constant Fraction invM[Q][Q]
platform_constant_definition int shearViscIndexes< 2, 9 >[shearIndexes< 2, 9 >]
platform_constant Fraction M[Q][Q]
platform_constant_definition Fraction s< 2, 5 >[5]
platform_constant_definition Fraction invM< 3, 7 >[7][7]
platform_constant int bulkViscIndex
platform_constant_definition Fraction M< 3, 7 >[7][7]
Advection Diffusion MRT D3Q7.
platform_constant_definition Fraction M< 2, 5 >[5][5]
Advection Diffusion MRT D2Q5.
platform_constant_definition int shearIndexes< 2, 9 >
platform_constant_definition Fraction s_2< 3, 19 >[19]
platform_constant_definition Fraction M< 2, 9 >[9][9]
MRT D2Q9 lattice.
platform_constant_definition Fraction invM< 2, 9 >[9][9]
platform_constant_definition int bulkViscIndex< 3, 19 >
platform_constant_definition Fraction M< 3, 19 >[19][19]
MRT D3Q19 lattice.
constexpr T m(unsigned iPop, unsigned jPop, tag::MRT)
constexpr T s(unsigned iPop, tag::MRT)
constexpr int shearViscIndexes(unsigned iPop, tag::MRT)
constexpr int bulkViscIndex()
constexpr T t(unsigned iPop, tag::CUM) any_platform
Definition cum.h:69
constexpr int shearIndexes()
constexpr T s_2(unsigned iPop, tag::MRT)
constexpr T invM(unsigned iPop, unsigned jPop, tag::MRT)
Top level namespace for all of OpenLB.
#define platform_constant_definition
Definition platform.h:80
#define platform_constant
Definition platform.h:79
Base of a descriptor tag.
Base of all tags describing the category of a descriptor.