OpenLB 1.7
Loading...
Searching...
No Matches
lbm.h
Go to the documentation of this file.
1/* This file is part of the OpenLB library
2 *
3 * Copyright (C) 2006, 2007 Jonas Latt
4 * 2021 Adrian Kummerlaender
5 * E-mail contact: info@openlb.net
6 * The most recent release of OpenLB can be downloaded at
7 * <http://www.openlb.net/>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public
20 * License along with this program; if not, write to the Free
21 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 * Boston, MA 02110-1301, USA.
23*/
24
25#ifndef DYNAMICS_LBM_H
26#define DYNAMICS_LBM_H
27
28#include "core/util.h"
29#include "descriptorFunction.h"
30
31namespace olb {
32
33template <typename DESCRIPTOR>
36 template <typename RHO, typename U, typename V=RHO>
37 static V firstOrder(int iPop, const RHO& rho, const U& u) any_platform
38 {
39 V c_u{};
40 for (int iD=0; iD < DESCRIPTOR::d; ++iD) {
41 c_u += descriptors::c<DESCRIPTOR>(iPop,iD)*u[iD];
42 }
43 return rho
44 * descriptors::t<V,DESCRIPTOR>(iPop)
45 * ( V{1} + c_u * descriptors::invCs2<V,DESCRIPTOR>() )
46 - descriptors::t<V,DESCRIPTOR>(iPop);
47 }
48
50 template <typename RHO, typename U, typename USQR, typename V=RHO>
51 static V secondOrder(int iPop, const RHO& rho, const U& u, const USQR& uSqr) any_platform
52 {
53 V c_u{};
54 for (int iD=0; iD < DESCRIPTOR::d; ++iD) {
55 c_u += descriptors::c<DESCRIPTOR>(iPop,iD)*u[iD];
56 }
57 return rho
58 * descriptors::t<V,DESCRIPTOR>(iPop)
59 * ( V{1}
60 + descriptors::invCs2<V,DESCRIPTOR>() * c_u
61 + descriptors::invCs2<V,DESCRIPTOR>() * descriptors::invCs2<V,DESCRIPTOR>() * V{0.5} * c_u * c_u
62 - descriptors::invCs2<V,DESCRIPTOR>() * V{0.5} * uSqr)
63 - descriptors::t<V,DESCRIPTOR>(iPop);
64 }
66 template <typename RHO, typename U, typename V=RHO>
67 static V secondOrder(int iPop, const RHO& rho, const U& u) any_platform
68 {
69 const V uSqr = util::normSqr<U,DESCRIPTOR::d>(u);
70 return secondOrder(iPop, rho, u, uSqr);
71 }
72
73 // compute equilibrium f^eq_i eq. (5.32) from DOI:10.1002/9780470177013
74 template <typename RHO, typename U, typename V=RHO>
75 static V P1(int iPop, const RHO& rho, const U& u) any_platform
76 {
77 V c_u{};
78 // compute scalar product of c[iPop]*u
79 for (int iD=0; iD < DESCRIPTOR::d; ++iD) {
80 c_u += descriptors::c<DESCRIPTOR>(iPop,iD)*u[iD];
81 }
82 return descriptors::t<V,DESCRIPTOR>(iPop) * (rho + c_u)
83 - descriptors::t<V,DESCRIPTOR>(iPop);
84 }
85
86 template <typename J, typename JSQR, typename PRESSURE, typename V=PRESSURE>
87 static V incompressible(int iPop, const J& j, const JSQR& jSqr, const PRESSURE& pressure) any_platform
88 {
89 V c_j{};
90 for (int iD=0; iD < DESCRIPTOR::d; ++iD) {
91 c_j += descriptors::c<DESCRIPTOR>(iPop,iD)*j[iD];
92 }
93 return descriptors::t<V,DESCRIPTOR>(iPop)
94 * ( descriptors::invCs2<V,DESCRIPTOR>() * pressure
95 + descriptors::invCs2<V,DESCRIPTOR>() * c_j
96 + descriptors::invCs2<V,DESCRIPTOR>() * descriptors::invCs2<V,DESCRIPTOR>()/V{2} * c_j * c_j
97 - descriptors::invCs2<V,DESCRIPTOR>()/V{2} * jSqr )
98 - descriptors::t<V,DESCRIPTOR>(iPop);
99 }
100 template <typename J, typename PRESSURE, typename V=PRESSURE>
101 static V incompressible(int iPop, const J& j, const PRESSURE& pressure) any_platform
102 {
103 const V jSqr = util::normSqr<J,DESCRIPTOR::d>(j);
104 return incompressible(iPop, j, jSqr, pressure);
105 }
106
109 template <typename V>
110 static V fromJgradToFneq(int iPop,
111 const V Jgrad[DESCRIPTOR::d * DESCRIPTOR::d],
112 V omega) any_platform
113 {
114 using L = DESCRIPTOR;
115 V fNeq{};
116 int iJgrad = 0;
117 for (int iAlpha=0; iAlpha < L::d; ++iAlpha) {
118 for (int iBeta=0; iBeta < L::d; ++iBeta) {
119 V toAdd = descriptors::c<L>(iPop,iAlpha) * descriptors::c<L>(iPop,iBeta);
120 if (iAlpha == iBeta) {
121 toAdd -= 1./descriptors::invCs2<V,L>();
122 }
123 else {
124 toAdd *= V{2};
125 }
126 toAdd *= Jgrad[iJgrad++];
127 fNeq += toAdd;
128 }
129 }
130 fNeq *= - descriptors::t<V,L>(iPop) * descriptors::invCs2<V,L>() / omega;
131 return fNeq;
132 }
133
135
142 template <typename V, typename PI>
143 static V fromPiToFneq(int iPop, const PI& pi) any_platform
144 {
145 using L = DESCRIPTOR;
146 V fNeq{};
147 int iPi = 0;
148 // Iterate only over superior triangle + diagonal, and add
149 // the elements under the diagonal by symmetry
150 for (int iAlpha=0; iAlpha < L::d; ++iAlpha) {
151 for (int iBeta=iAlpha; iBeta < L::d; ++iBeta) {
152 V toAdd = descriptors::c<L>(iPop,iAlpha)*descriptors::c<L>(iPop,iBeta);
153 if (iAlpha == iBeta) {
154 toAdd -= V{1}/descriptors::invCs2<V,L>();
155 }
156 else {
157 toAdd *= V{2}; // multiply off-diagonal elements by 2
158 } // because the Q tensor is symmetric
159 toAdd *= pi[iPi++];
160 fNeq += toAdd;
161 }
162 }
163 fNeq *= descriptors::t<V,L>(iPop) * descriptors::invCs2<V,L>() * descriptors::invCs2<V,L>() / V{2};
164 return fNeq;
165 }
166
167 template <typename V>
168 static V fromJneqToFneq(int iPop, const V jNeq[DESCRIPTOR::d]) any_platform
169 {
170 V fNeq{};
171 for (int iD = 0; iD < DESCRIPTOR::d; ++iD) {
172 fNeq += descriptors::c<DESCRIPTOR>(iPop,iD) * jNeq[iD];
173 }
174 fNeq *= descriptors::t<V,DESCRIPTOR>(iPop) * descriptors::invCs2<V,DESCRIPTOR>();
175 return fNeq;
176 }
177
178};
179
181template <typename DESCRIPTOR>
182struct lbm {
184 template <typename CELL, typename V=typename CELL::value_t>
185 static V computeRho(CELL& cell) any_platform
186 {
187 V rho = V();
188 for (int iPop=0; iPop < DESCRIPTOR::q; ++iPop) {
189 rho += cell[iPop];
190 }
191 rho += V{1};
192 return rho;
193 }
194
196 template <typename CELL, typename J, typename V=typename CELL::value_t>
197 static void computeJ(CELL& cell, J& j) any_platform
198 {
199 for (int iD=0; iD < DESCRIPTOR::d; ++iD) {
200 j[iD] = V();
201 }
202 for (int iPop=0; iPop < DESCRIPTOR::q; ++iPop) {
203 for (int iD=0; iD < DESCRIPTOR::d; ++iD) {
204 j[iD] += cell[iPop]*descriptors::c<DESCRIPTOR>(iPop,iD);
205 }
206 }
207 }
208
210 template <typename CELL, typename RHO, typename J, typename V=typename CELL::value_t>
211 static void computeRhoJ(CELL& cell, RHO& rho, J& j) any_platform
212 {
213 rho = computeRho(cell);
214 computeJ(cell, j);
215 }
216
218 template <typename CELL, typename RHO, typename U, typename V=typename CELL::value_t>
219 static void computeRhoU(CELL& cell, RHO& rho, U& u) any_platform
220 {
221 computeRhoJ(cell, rho, u);
222 for (int iD=0; iD < DESCRIPTOR::d; ++iD) {
223 u[iD] /= rho;
224 }
225 }
226
228 template <typename CELL, typename RHO, typename U, typename PI, typename V=typename CELL::value_t>
229 static void computeStress(CELL& cell, const RHO& rho, const U& u, PI& pi) any_platform
230 {
231 int iPi = 0;
232 for (int iAlpha=0; iAlpha < DESCRIPTOR::d; ++iAlpha) {
233 for (int iBeta=iAlpha; iBeta < DESCRIPTOR::d; ++iBeta) {
234 pi[iPi] = V();
235 for (int iPop=0; iPop < DESCRIPTOR::q; ++iPop) {
236 pi[iPi] += descriptors::c<DESCRIPTOR>(iPop,iAlpha)*
237 descriptors::c<DESCRIPTOR>(iPop,iBeta) * cell[iPop];
238 }
239 // stripe off equilibrium contribution
240 pi[iPi] -= rho*u[iAlpha]*u[iBeta];
241 if (iAlpha==iBeta) {
242 pi[iPi] -= V{1} / descriptors::invCs2<V,DESCRIPTOR>()*(rho-V{1});
243 }
244 ++iPi;
245 }
246 }
247 }
248
250 template <typename CELL, typename RHO, typename U, typename PI, typename V=typename CELL::value_t>
251 static void computeAllMomenta(CELL& cell, RHO& rho, U& u, PI& pi) any_platform
252 {
253 computeRhoU(cell, rho, u);
254 computeStress(cell, rho, u, pi);
255 }
256
257 template <typename CELL, typename FEQ, typename V=typename CELL::value_t>
258 static void computeFeq(CELL& cell, FEQ& fEq) any_platform
259 {
260 V rho {};
261 V u[DESCRIPTOR::d] {};
262 computeRhoU(cell, rho, u);
263 const V uSqr = util::normSqr<V,DESCRIPTOR::d>(u);
264 for (int iPop=0; iPop < DESCRIPTOR::q; ++iPop) {
265 fEq[iPop] = equilibrium<DESCRIPTOR>::secondOrder(iPop, rho, u, uSqr);
266 }
267 }
268
270 template <typename CELL, typename FNEQ, typename RHO, typename U, typename V=typename CELL::value_t>
271 static void computeFneq(CELL& cell, FNEQ& fNeq, const RHO& rho, const U& u) any_platform
272 {
273 const V uSqr = util::normSqr<U,DESCRIPTOR::d>(u);
274 for (int iPop=0; iPop < DESCRIPTOR::q; ++iPop) {
275 fNeq[iPop] = cell[iPop] - equilibrium<DESCRIPTOR>::secondOrder(iPop, rho, u, uSqr);
276 }
277 }
278
279 template <typename CELL, typename FNEQ, typename V=typename CELL::value_t>
280 static void computeFneq(CELL& cell, FNEQ& fNeq) any_platform
281 {
282 V rho{};
283 V u[DESCRIPTOR::d] {};
284 computeRhoU(cell, rho, u);
285 computeFneq(cell, fNeq, rho, u);
286 }
287
289 template <typename CELL, typename RHO, typename VELOCITY, typename OMEGA, typename V=typename CELL::value_t>
290 static V bgkCollision(CELL& cell, const RHO& rho, const VELOCITY& u, const OMEGA& omega) any_platform
291 {
292 const V uSqr = util::normSqr<VELOCITY,DESCRIPTOR::d>(u);
293 for (int iPop=0; iPop < DESCRIPTOR::q; ++iPop) {
294 cell[iPop] *= V{1} - omega;
295 cell[iPop] += omega * equilibrium<DESCRIPTOR>::secondOrder(iPop, rho, u, uSqr);
296 }
297 return uSqr;
298 }
299
301 template <typename CELL, typename RHO, typename VELOCITY, typename OMEGA, typename V=typename CELL::value_t>
302 static V adeBgkCollision(CELL& cell, const RHO& rho, const VELOCITY& u, const OMEGA& omega) any_platform
303 {
304 const V uSqr = util::normSqr<VELOCITY,DESCRIPTOR::d>(u);
305 for (int iPop=0; iPop < DESCRIPTOR::q; ++iPop) {
306 cell[iPop] *= V{1} - omega;
307 cell[iPop] += omega * equilibrium<DESCRIPTOR>::firstOrder(iPop, rho, u);
308 }
309 return uSqr;
310 }
311
313 template <typename CELL, typename PRESSURE, typename J, typename OMEGA, typename V=typename CELL::value_t>
314 static V incBgkCollision(CELL& cell, const PRESSURE& pressure, const J& j, const OMEGA& omega) any_platform
315 {
316 const V jSqr = util::normSqr<J,DESCRIPTOR::d>(j);
317 for (int iPop=0; iPop < DESCRIPTOR::q; ++iPop) {
318 cell[iPop] *= V{1} - omega;
319 cell[iPop] += omega * equilibrium<DESCRIPTOR>::template incompressible<J,V,V>(iPop, j, jSqr, pressure);
320 }
321 return jSqr;
322 }
323
325 template <typename CELL, typename RHO, typename U, typename RATIORHO, typename OMEGA, typename V=typename CELL::value_t>
326 static V constRhoBgkCollision(CELL& cell, const RHO& rho, const U& u,
327 const RATIORHO& ratioRho, const OMEGA& omega) any_platform
328 {
329 const V uSqr = util::normSqr<U,DESCRIPTOR::d>(u);
330 for (int iPop=0; iPop < DESCRIPTOR::q; ++iPop) {
331 V feq = equilibrium<DESCRIPTOR>::secondOrder(iPop, rho, u, uSqr);
332 cell[iPop] =
333 ratioRho*(feq+descriptors::t<V,DESCRIPTOR>(iPop))-descriptors::t<V,DESCRIPTOR>(iPop) +
334 (V{1}-omega)*(cell[iPop]-feq);
335 }
336 return uSqr;
337 }
338
340 template <typename CELL, typename RHO, typename U, typename OMEGA, typename V=typename CELL::value_t>
341 static V rlbCollision(CELL& cell, const RHO& rho, const U& u, const OMEGA& omega) any_platform
342 {
343 const V uSqr = util::normSqr<U,DESCRIPTOR::d>(u);
344 // First-order moment for the regularization
345 V j1[DESCRIPTOR::d];
346 for ( int iD = 0; iD < DESCRIPTOR::d; ++iD ) {
347 j1[iD] = V();
348 }
349
350 V fEq[DESCRIPTOR::q];
351 for ( int iPop = 0; iPop < DESCRIPTOR::q; ++iPop ) {
352 fEq[iPop] = equilibrium<DESCRIPTOR>::firstOrder( iPop, rho, u );
353 for ( int iD = 0; iD < DESCRIPTOR::d; ++iD ) {
354 j1[iD] += descriptors::c<DESCRIPTOR>(iPop,iD) * ( cell[iPop] - fEq[iPop] );
355 }
356 }
357
358 // Collision step
359 for ( int iPop = 0; iPop < DESCRIPTOR::q; ++iPop ) {
360 V fNeq = V();
361 for ( int iD = 0; iD < DESCRIPTOR::d; ++iD ) {
362 fNeq += descriptors::c<DESCRIPTOR>(iPop,iD) * j1[iD];
363 }
364 fNeq *= descriptors::t<V,DESCRIPTOR>(iPop) * descriptors::invCs2<V,DESCRIPTOR>();
365 cell[iPop] = fEq[iPop] + ( V{1} - omega ) * fNeq;
366 }
367 return uSqr;
368 }
369
371 template <typename CELL, typename RHO, typename U, typename PI, typename OMEGA, typename V=typename CELL::value_t>
372 static V rlbCollision(CELL& cell, const RHO& rho, const U& u, const PI& pi, const OMEGA& omega) any_platform
373 {
374 const V uSqr = util::normSqr<U,DESCRIPTOR::d>(u);
375 cell[0] = equilibrium<DESCRIPTOR>::secondOrder(0, rho, u, uSqr)
376 + (V{1}-omega) * equilibrium<DESCRIPTOR>::template fromPiToFneq<V>(0, pi);
377 for (int iPop=1; iPop <= DESCRIPTOR::q/2; ++iPop) {
378 cell[iPop] = equilibrium<DESCRIPTOR>::secondOrder(iPop, rho, u, uSqr);
379 cell[iPop+DESCRIPTOR::q/2] = equilibrium<DESCRIPTOR>::secondOrder(iPop+DESCRIPTOR::q/2, rho, u, uSqr);
380
381 V fNeq = (V{1}-omega) * equilibrium<DESCRIPTOR>::template fromPiToFneq<V>(iPop, pi);
382 cell[iPop] += fNeq;
383 cell[iPop+DESCRIPTOR::q/2] += fNeq;
384 }
385 return uSqr;
386 }
387
388 template <typename CELL, typename NEWRHO, typename NEWU, typename V=typename CELL::value_t>
389 static void defineEqFirstOrder(CELL& cell, const NEWRHO& newRho, const NEWU& newU) any_platform
390 {
391 for (int iPop=0; iPop < DESCRIPTOR::q; ++iPop) {
392 cell[iPop] = equilibrium<DESCRIPTOR>::firstOrder(iPop, newRho, newU);
393 }
394 }
395
396 template <typename CELL, typename OLDRHO, typename OLDU, typename NEWRHO, typename NEWU, typename V=typename CELL::value_t>
397 static void defineNEq(CELL& cell,
398 const OLDRHO& oldRho, const OLDU& oldU,
399 const NEWRHO& newRho, const NEWU& newU) any_platform
400 {
401 const V oldUSqr = util::normSqr<OLDU,DESCRIPTOR::d>(oldU);
402 const V newUSqr = util::normSqr<NEWU,DESCRIPTOR::d>(newU);
403 for (int iPop=0; iPop < DESCRIPTOR::q; ++iPop) {
404 cell[iPop] += equilibrium<DESCRIPTOR>::secondOrder(iPop, newRho, newU, newUSqr)
405 - equilibrium<DESCRIPTOR>::secondOrder(iPop, oldRho, oldU, oldUSqr);
406 }
407 }
408
409 template <typename CELL, typename RHO, typename U, typename PI, typename V=typename CELL::value_t>
410 static void defineNEqFromPi(CELL& cell,
411 const RHO& rho,
412 const U& u,
413 const PI& pi) any_platform
414 {
415 const V uSqr = util::normSqr<U,DESCRIPTOR::d>(u);
416 for (int iPop=0; iPop < DESCRIPTOR::q; ++iPop) {
417 cell[iPop] = equilibrium<DESCRIPTOR>::secondOrder(iPop, rho, u, uSqr)
418 + equilibrium<DESCRIPTOR>::template fromPiToFneq<V>(iPop, pi);
419 }
420 }
421
423 template <typename CELL, typename FORCE, typename V=typename CELL::value_t>
424 static V computePiNeqNormSqr(CELL& cell, const FORCE& force) any_platform
425 {
426 V rho, u[DESCRIPTOR::d], pi[util::TensorVal<DESCRIPTOR>::n];
427 computeAllMomenta(cell, rho, u, pi);
428 V ForceTensor[util::TensorVal<DESCRIPTOR>::n];
429 // Creation of body force tensor (rho/2.)*(G_alpha*U_beta + U_alpha*G_Beta)
430 int iPi = 0;
431 for (int Alpha=0; Alpha<DESCRIPTOR::d; ++Alpha) {
432 for (int Beta=Alpha; Beta<DESCRIPTOR::d; ++Beta) {
433 ForceTensor[iPi] = rho/2.*(force[Alpha]*u[Beta] + u[Alpha]*force[Beta]);
434 ++iPi;
435 }
436 }
437 // Creation of second-order moment off-equilibrium tensor
438 for (int iPi=0; iPi < util::TensorVal<DESCRIPTOR >::n; ++iPi) {
439 pi[iPi] += ForceTensor[iPi];
440 }
441 V PiNeqNormSqr = pi[0]*pi[0] + 2.*pi[1]*pi[1] + pi[2]*pi[2];
442 if constexpr (util::TensorVal<DESCRIPTOR>::n == 6) {
443 PiNeqNormSqr += pi[2]*pi[2] + pi[3]*pi[3] + 2.*pi[4]*pi[4] +pi[5]*pi[5];
444 }
445 return PiNeqNormSqr;
446 }
447
449 template <typename CELL, typename V=typename CELL::value_t>
451 {
452 V rho, u[DESCRIPTOR::d], pi[util::TensorVal<DESCRIPTOR>::n];
453 computeAllMomenta(cell, rho, u, pi);
454 V PiNeqNormSqr = pi[0]*pi[0] + 2.*pi[1]*pi[1] + pi[2]*pi[2];
455 if constexpr (util::TensorVal<DESCRIPTOR >::n == 6) {
456 PiNeqNormSqr += pi[2]*pi[2] + pi[3]*pi[3] + 2.*pi[4]*pi[4] +pi[5]*pi[5];
457 }
458 return PiNeqNormSqr;
459 }
460
462 template <typename CELL, typename RHO, typename U, typename OMEGA, typename FORCE, typename V=typename CELL::value_t>
463 static void addExternalForce(CELL& cell, const RHO& rho, const U& u, const OMEGA& omega, const FORCE& force) any_platform
464 {
465 for (int iPop=0; iPop < DESCRIPTOR::q; ++iPop) {
466 V c_u{};
467 for (int iD=0; iD < DESCRIPTOR::d; ++iD) {
468 c_u += descriptors::c<DESCRIPTOR>(iPop,iD)*u[iD];
469 }
470 c_u *= descriptors::invCs2<V,DESCRIPTOR>() * descriptors::invCs2<V,DESCRIPTOR>();
471 V forceTerm{};
472 for (int iD=0; iD < DESCRIPTOR::d; ++iD) {
473 forceTerm +=
474 ( (descriptors::c<DESCRIPTOR>(iPop,iD) - u[iD]) * descriptors::invCs2<V,DESCRIPTOR>()
475 + c_u * descriptors::c<DESCRIPTOR>(iPop,iD)
476 )
477 * force[iD];
478 }
479 forceTerm *= descriptors::t<V,DESCRIPTOR>(iPop);
480 forceTerm *= V{1} - omega * V{0.5};
481 forceTerm *= rho;
482 cell[iPop] += forceTerm;
483 }
484 }
485};
486
487}
488
489#endif
490
491#include "lbm.cse.h"
Top level namespace for all of OpenLB.
#define any_platform
Define preprocessor macros for device-side functions, constant storage.
Definition platform.h:78
static V fromPiToFneq(int iPop, const PI &pi) any_platform
Compute off-equilibrium part of the f's from the stress tensor Pi.
Definition lbm.h:143
static V secondOrder(int iPop, const RHO &rho, const U &u) any_platform
Computation of equilibrium distribution, second order in u.
Definition lbm.h:67
static V incompressible(int iPop, const J &j, const JSQR &jSqr, const PRESSURE &pressure) any_platform
Definition lbm.h:87
static V fromJneqToFneq(int iPop, const V jNeq[DESCRIPTOR::d]) any_platform
Definition lbm.h:168
static V P1(int iPop, const RHO &rho, const U &u) any_platform
Definition lbm.h:75
static V secondOrder(int iPop, const RHO &rho, const U &u, const USQR &uSqr) any_platform
Computation of equilibrium distribution, second order in u.
Definition lbm.h:51
static V fromJgradToFneq(int iPop, const V Jgrad[DESCRIPTOR::d *DESCRIPTOR::d], V omega) any_platform
compute off-equilibrium part of the populations from gradient of the flux for asymmetric regularizati...
Definition lbm.h:110
static V firstOrder(int iPop, const RHO &rho, const U &u) any_platform
Computation of equilibrium distribution, first order in u.
Definition lbm.h:37
static V incompressible(int iPop, const J &j, const PRESSURE &pressure) any_platform
Definition lbm.h:101
Collection of common computations for LBM.
Definition lbm.h:182
static V adeBgkCollision(CELL &cell, const RHO &rho, const VELOCITY &u, const OMEGA &omega) any_platform
Advection diffusion BGK collision step.
Definition lbm.h:302
static void defineEqFirstOrder(CELL &cell, const NEWRHO &newRho, const NEWU &newU) any_platform
Definition lbm.h:389
static V constRhoBgkCollision(CELL &cell, const RHO &rho, const U &u, const RATIORHO &ratioRho, const OMEGA &omega) any_platform
BGK collision step with density correction.
Definition lbm.h:326
static void computeFeq(CELL &cell, FEQ &fEq) any_platform
Definition lbm.h:258
static V computePiNeqNormSqr(CELL &cell) any_platform
Computes squared norm of non-equilibrium part of 2nd momentum for standard (non-forced) dynamics.
Definition lbm.h:450
static void computeJ(CELL &cell, J &j) any_platform
Computation of momentum.
Definition lbm.h:197
static void computeFneq(CELL &cell, FNEQ &fNeq, const RHO &rho, const U &u) any_platform
Computation of non-equilibrium distribution.
Definition lbm.h:271
static void computeAllMomenta(CELL &cell, RHO &rho, U &u, PI &pi) any_platform
Computation of all hydrodynamic variables.
Definition lbm.h:251
static V rlbCollision(CELL &cell, const RHO &rho, const U &u, const PI &pi, const OMEGA &omega) any_platform
Renormalized DESCRIPTOR Boltzmann collision operator, fIn --> fOut.
Definition lbm.h:372
static void computeFneq(CELL &cell, FNEQ &fNeq) any_platform
Definition lbm.h:280
static V computePiNeqNormSqr(CELL &cell, const FORCE &force) any_platform
Computes squared norm of non-equilibrium part of 2nd momentum for forced dynamics.
Definition lbm.h:424
static V rlbCollision(CELL &cell, const RHO &rho, const U &u, const OMEGA &omega) any_platform
RLB advection diffusion collision step.
Definition lbm.h:341
static void computeRhoJ(CELL &cell, RHO &rho, J &j) any_platform
Computation of hydrodynamic variables.
Definition lbm.h:211
static V computeRho(CELL &cell) any_platform
Computation of density.
Definition lbm.h:185
static void addExternalForce(CELL &cell, const RHO &rho, const U &u, const OMEGA &omega, const FORCE &force) any_platform
Add a force term after BGK collision.
Definition lbm.h:463
static V bgkCollision(CELL &cell, const RHO &rho, const VELOCITY &u, const OMEGA &omega) any_platform
BGK collision step.
Definition lbm.h:290
static void computeStress(CELL &cell, const RHO &rho, const U &u, PI &pi) any_platform
Computation of stress tensor.
Definition lbm.h:229
static void defineNEq(CELL &cell, const OLDRHO &oldRho, const OLDU &oldU, const NEWRHO &newRho, const NEWU &newU) any_platform
Definition lbm.h:397
static V incBgkCollision(CELL &cell, const PRESSURE &pressure, const J &j, const OMEGA &omega) any_platform
Incompressible BGK collision step.
Definition lbm.h:314
static void defineNEqFromPi(CELL &cell, const RHO &rho, const U &u, const PI &pi) any_platform
Definition lbm.h:410
static void computeRhoU(CELL &cell, RHO &rho, U &u) any_platform
Computation of hydrodynamic variables.
Definition lbm.h:219
Compute number of elements of a symmetric d-dimensional tensor.
Definition util.h:210
Set of functions commonly used in LB computations – header file.