OpenLB 1.8.1
Loading...
Searching...
No Matches
olb::equilibrium< DESCRIPTOR > Struct Template Reference

#include <lbm.h>

+ Collaboration diagram for olb::equilibrium< DESCRIPTOR >:

Static Public Member Functions

template<typename RHO , typename U , typename V = RHO>
static V firstOrder (int iPop, const RHO &rho, const U &u) any_platform
 Computation of equilibrium distribution, first order in u.
 
template<typename RHO , typename U , typename USQR , typename V = RHO>
static V secondOrder (int iPop, const RHO &rho, const U &u, const USQR &uSqr) any_platform
 Computation of equilibrium distribution, second order in u.
 
template<typename RHO , typename U , typename V = RHO>
static V secondOrder (int iPop, const RHO &rho, const U &u) any_platform
 Computation of equilibrium distribution, second order in u.
 
template<typename RHO , typename U , typename USQR , typename V = RHO>
static V thirdOrder (int iPop, const RHO &rho, const U &u, const USQR &uSqr) any_platform
 Computation of equilibrium distribution, third order in u.
 
template<typename RHO , typename U , typename V = RHO>
static V thirdOrder (int iPop, const RHO &rho, const U &u) any_platform
 Computation of equilibrium distribution, third order in u.
 
template<typename RHO , typename U , typename V = RHO>
static V P1 (int iPop, const RHO &rho, const U &u) any_platform
 
template<typename J , typename JSQR , typename PRESSURE , typename V = PRESSURE>
static V incompressible (int iPop, const J &j, const JSQR &jSqr, const PRESSURE &pressure) any_platform
 
template<typename J , typename PRESSURE , typename V = PRESSURE>
static V incompressible (int iPop, const J &j, const PRESSURE &pressure) any_platform
 
template<typename RHO , typename U , typename USQR , typename PRESSURE , typename V = PRESSURE>
static V mpincompressible (int iPop, const RHO &rho, const U &u, const USQR &uSqr, const PRESSURE &pressure) any_platform
 
template<typename RHO , typename U , typename PRESSURE , typename V = PRESSURE>
static V mpincompressible (int iPop, const RHO &rho, const U &u, const PRESSURE &pressure) any_platform
 
template<typename V >
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 regularization init to circumvent pi computation
 
template<typename V , typename PI >
static V fromPiToFneq (int iPop, const PI &pi) any_platform
 Compute off-equilibrium part of the f's from the stress tensor Pi.
 
template<typename V >
static V fromJneqToFneq (int iPop, const V jNeq[DESCRIPTOR::d]) any_platform
 

Detailed Description

template<typename DESCRIPTOR>
struct olb::equilibrium< DESCRIPTOR >

Definition at line 34 of file lbm.h.

Member Function Documentation

◆ firstOrder()

template<typename DESCRIPTOR >
template<typename RHO , typename U , typename V = RHO>
static V olb::equilibrium< DESCRIPTOR >::firstOrder ( int iPop,
const RHO & rho,
const U & u )
inlinestatic

Computation of equilibrium distribution, first order in u.

Definition at line 37 of file lbm.h.

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
45 * ( V{1} + c_u * descriptors::invCs2<V,DESCRIPTOR>() )
47 }
constexpr T invCs2() any_platform
Definition functions.h:107
constexpr T t(unsigned iPop, tag::CUM) any_platform
Definition cum.h:108
constexpr int c(unsigned iPop, unsigned iDim) any_platform
Definition functions.h:83

References olb::descriptors::c(), olb::descriptors::invCs2(), and olb::descriptors::t().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fromJgradToFneq()

template<typename DESCRIPTOR >
template<typename V >
static V olb::equilibrium< DESCRIPTOR >::fromJgradToFneq ( int iPop,
const V Jgrad[DESCRIPTOR::d *DESCRIPTOR::d],
V omega )
inlinestatic

compute off-equilibrium part of the populations from gradient of the flux for asymmetric regularization init to circumvent pi computation

Definition at line 192 of file lbm.h.

195 {
196 using L = DESCRIPTOR;
197 V fNeq{};
198 int iJgrad = 0;
199 for (int iAlpha=0; iAlpha < L::d; ++iAlpha) {
200 for (int iBeta=0; iBeta < L::d; ++iBeta) {
201 V toAdd = descriptors::c<L>(iPop,iAlpha) * descriptors::c<L>(iPop,iBeta);
202 if (iAlpha == iBeta) {
203 toAdd -= 1./descriptors::invCs2<V,L>();
204 }
205 else {
206 toAdd *= V{2};
207 }
208 toAdd *= Jgrad[iJgrad++];
209 fNeq += toAdd;
210 }
211 }
212 fNeq *= - descriptors::t<V,L>(iPop) * descriptors::invCs2<V,L>() / omega;
213 return fNeq;
214 }

References olb::descriptors::c(), olb::descriptors::invCs2(), and olb::descriptors::t().

+ Here is the call graph for this function:

◆ fromJneqToFneq()

template<typename DESCRIPTOR >
template<typename V >
static V olb::equilibrium< DESCRIPTOR >::fromJneqToFneq ( int iPop,
const V jNeq[DESCRIPTOR::d] )
inlinestatic

Definition at line 250 of file lbm.h.

251 {
252 V fNeq{};
253 for (int iD = 0; iD < DESCRIPTOR::d; ++iD) {
254 fNeq += descriptors::c<DESCRIPTOR>(iPop,iD) * jNeq[iD];
255 }
257 return fNeq;
258 }

References olb::descriptors::c(), olb::descriptors::invCs2(), and olb::descriptors::t().

+ Here is the call graph for this function:

◆ fromPiToFneq()

template<typename DESCRIPTOR >
template<typename V , typename PI >
static V olb::equilibrium< DESCRIPTOR >::fromPiToFneq ( int iPop,
const PI & pi )
inlinestatic

Compute off-equilibrium part of the f's from the stress tensor Pi.

Implements the following formula (with Einstein index contraction):

\[ f_i^{neq} = t_i / (2 c_s^4) *
                (c_{ia} c_{ib} - c_s^2 \delta_{ab}) \Pi_{ab} \]

By Pi we mean the tensor computed from the off-equilibrium functions:

\[ \Pi = \sum c_i c_i f_i^{neq}
        = \sum c_i c_i f_i - \rho u u - c_s^2 \rho\ Id \]

Definition at line 225 of file lbm.h.

226 {
227 using L = DESCRIPTOR;
228 V fNeq{};
229 int iPi = 0;
230 // Iterate only over superior triangle + diagonal, and add
231 // the elements under the diagonal by symmetry
232 for (int iAlpha=0; iAlpha < L::d; ++iAlpha) {
233 for (int iBeta=iAlpha; iBeta < L::d; ++iBeta) {
234 V toAdd = descriptors::c<L>(iPop,iAlpha)*descriptors::c<L>(iPop,iBeta);
235 if (iAlpha == iBeta) {
236 toAdd -= V{1}/descriptors::invCs2<V,L>();
237 }
238 else {
239 toAdd *= V{2}; // multiply off-diagonal elements by 2
240 } // because the Q tensor is symmetric
241 toAdd *= pi[iPi++];
242 fNeq += toAdd;
243 }
244 }
246 return fNeq;
247 }

References olb::descriptors::c(), olb::descriptors::invCs2(), and olb::descriptors::t().

+ Here is the call graph for this function:

◆ incompressible() [1/2]

template<typename DESCRIPTOR >
template<typename J , typename JSQR , typename PRESSURE , typename V = PRESSURE>
static V olb::equilibrium< DESCRIPTOR >::incompressible ( int iPop,
const J & j,
const JSQR & jSqr,
const PRESSURE & pressure )
inlinestatic

Definition at line 146 of file lbm.h.

147 {
148 V c_j{};
149 for (int iD=0; iD < DESCRIPTOR::d; ++iD) {
150 c_j += descriptors::c<DESCRIPTOR>(iPop,iD)*j[iD];
151 }
153 * ( descriptors::invCs2<V,DESCRIPTOR>() * pressure
156 - descriptors::invCs2<V,DESCRIPTOR>()/V{2} * jSqr )
158 }

References olb::descriptors::c(), olb::descriptors::invCs2(), and olb::descriptors::t().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ incompressible() [2/2]

template<typename DESCRIPTOR >
template<typename J , typename PRESSURE , typename V = PRESSURE>
static V olb::equilibrium< DESCRIPTOR >::incompressible ( int iPop,
const J & j,
const PRESSURE & pressure )
inlinestatic

Definition at line 160 of file lbm.h.

161 {
162 const V jSqr = util::normSqr<J,DESCRIPTOR::d>(j);
163 return incompressible(iPop, j, jSqr, pressure);
164 }
auto normSqr(const ARRAY_LIKE &u) any_platform
Compute norm square of a d-dimensional vector.
Definition util.h:145
static V incompressible(int iPop, const J &j, const JSQR &jSqr, const PRESSURE &pressure) any_platform
Definition lbm.h:146

References olb::equilibrium< DESCRIPTOR >::incompressible(), and olb::util::normSqr().

+ Here is the call graph for this function:

◆ mpincompressible() [1/2]

template<typename DESCRIPTOR >
template<typename RHO , typename U , typename PRESSURE , typename V = PRESSURE>
static V olb::equilibrium< DESCRIPTOR >::mpincompressible ( int iPop,
const RHO & rho,
const U & u,
const PRESSURE & pressure )
inlinestatic

Definition at line 183 of file lbm.h.

184 {
185 const V uSqr = util::normSqr<U,DESCRIPTOR::d>(u);
186 return mpincompressible(iPop, rho, u, uSqr, pressure);
187 }
static V mpincompressible(int iPop, const RHO &rho, const U &u, const USQR &uSqr, const PRESSURE &pressure) any_platform
Definition lbm.h:167

References olb::equilibrium< DESCRIPTOR >::mpincompressible(), and olb::util::normSqr().

+ Here is the call graph for this function:

◆ mpincompressible() [2/2]

template<typename DESCRIPTOR >
template<typename RHO , typename U , typename USQR , typename PRESSURE , typename V = PRESSURE>
static V olb::equilibrium< DESCRIPTOR >::mpincompressible ( int iPop,
const RHO & rho,
const U & u,
const USQR & uSqr,
const PRESSURE & pressure )
inlinestatic

Definition at line 167 of file lbm.h.

168 {
169 V c_u{};
170 if (iPop == 0) {
171 return descriptors::invCs2<V,DESCRIPTOR>() * pressure * (descriptors::t<V,DESCRIPTOR>(iPop)-V{1})
173 }
174 else {
175 for (int iD=0; iD < DESCRIPTOR::d; ++iD) {
176 c_u += descriptors::c<DESCRIPTOR>(iPop,iD)*u[iD];
177 }
179 * ( pressure + rho*(c_u + descriptors::invCs2<V,DESCRIPTOR>()*V{0.5}*c_u*c_u - uSqr*V{0.5}) );
180 }
181 }

References olb::descriptors::c(), olb::descriptors::invCs2(), and olb::descriptors::t().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ P1()

template<typename DESCRIPTOR >
template<typename RHO , typename U , typename V = RHO>
static V olb::equilibrium< DESCRIPTOR >::P1 ( int iPop,
const RHO & rho,
const U & u )
inlinestatic

Definition at line 134 of file lbm.h.

135 {
136 V c_u{};
137 // compute scalar product of c[iPop]*u
138 for (int iD=0; iD < DESCRIPTOR::d; ++iD) {
139 c_u += descriptors::c<DESCRIPTOR>(iPop,iD)*u[iD];
140 }
141 return descriptors::t<V,DESCRIPTOR>(iPop) * (rho + c_u)
143 }

References olb::descriptors::c(), and olb::descriptors::t().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ secondOrder() [1/2]

template<typename DESCRIPTOR >
template<typename RHO , typename U , typename V = RHO>
static V olb::equilibrium< DESCRIPTOR >::secondOrder ( int iPop,
const RHO & rho,
const U & u )
inlinestatic

Computation of equilibrium distribution, second order in u.

Definition at line 67 of file lbm.h.

68 {
69 const V uSqr = util::normSqr<U,DESCRIPTOR::d>(u);
70 return secondOrder(iPop, rho, u, uSqr);
71 }
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

References olb::util::normSqr(), and olb::equilibrium< DESCRIPTOR >::secondOrder().

+ Here is the call graph for this function:

◆ secondOrder() [2/2]

template<typename DESCRIPTOR >
template<typename RHO , typename U , typename USQR , typename V = RHO>
static V olb::equilibrium< DESCRIPTOR >::secondOrder ( int iPop,
const RHO & rho,
const U & u,
const USQR & uSqr )
inlinestatic

Computation of equilibrium distribution, second order in u.

Definition at line 51 of file lbm.h.

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
59 * ( V{1}
62 - descriptors::invCs2<V,DESCRIPTOR>() * V{0.5} * uSqr)
64 }

References olb::descriptors::c(), olb::descriptors::invCs2(), and olb::descriptors::t().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ thirdOrder() [1/2]

template<typename DESCRIPTOR >
template<typename RHO , typename U , typename V = RHO>
static V olb::equilibrium< DESCRIPTOR >::thirdOrder ( int iPop,
const RHO & rho,
const U & u )
inlinestatic

Computation of equilibrium distribution, third order in u.

Definition at line 126 of file lbm.h.

127 {
128 const V uSqr = util::normSqr<U,DESCRIPTOR::d>(u);
129 return thirdOrder(iPop, rho, u, uSqr);
130 }
static V thirdOrder(int iPop, const RHO &rho, const U &u, const USQR &uSqr) any_platform
Computation of equilibrium distribution, third order in u.
Definition lbm.h:75

References olb::util::normSqr(), and olb::equilibrium< DESCRIPTOR >::thirdOrder().

+ Here is the call graph for this function:

◆ thirdOrder() [2/2]

template<typename DESCRIPTOR >
template<typename RHO , typename U , typename USQR , typename V = RHO>
static V olb::equilibrium< DESCRIPTOR >::thirdOrder ( int iPop,
const RHO & rho,
const U & u,
const USQR & uSqr )
inlinestatic

Computation of equilibrium distribution, third order in u.

Definition at line 75 of file lbm.h.

76 {
77 V c_u{};
78 for (int iD=0; iD < DESCRIPTOR::d; ++iD) {
79 c_u += descriptors::c<DESCRIPTOR>(iPop,iD)*u[iD];
80 }
82
83 V aEqThrdXXY = u[0] * u[0] * u[1];
84 V aEqThrdXYY = u[0] * u[1] * u[1];
85
86 //Hermite polynomes https://doi.org/10.1017/S0022112005008153
88 V hermite2XY = descriptors::c<DESCRIPTOR>(iPop,0)*descriptors::c<DESCRIPTOR>(iPop,1);
90
91 V hermite3XXY = hermite2XX * descriptors::c<DESCRIPTOR>(iPop,1);
93
94 V thirdOrderTerms = V{1. / 2.} * reciSpeedOfSoundHc * (hermite3XXY + hermite3XYY) * (aEqThrdXXY + aEqThrdXYY)
95 + V{1. / 6.} * reciSpeedOfSoundHc * (hermite3XXY - hermite3XYY) * (aEqThrdXXY - aEqThrdXYY);
96 if constexpr (DESCRIPTOR::d == 3) {
97 V aEqThrdXXZ = u[0] * u[0] * u[2];
98 V aEqThrdXZZ = u[0] * u[2] * u[2];
99 V aEqThrdYYZ = u[1] * u[1] * u[2];
100 V aEqThrdYZZ = u[1] * u[2] * u[2];
101
102 V hermite2YZ = descriptors::c<DESCRIPTOR>(iPop,1)*descriptors::c<DESCRIPTOR>(iPop,2);
103 V hermite2XZ = descriptors::c<DESCRIPTOR>(iPop,0)*descriptors::c<DESCRIPTOR>(iPop,2);
104
105 V hermite3XXZ = hermite2XX * descriptors::c<DESCRIPTOR>(iPop,2);
106 V hermite3XZZ = hermite2XZ * descriptors::c<DESCRIPTOR>(iPop,2) - descriptors::c<DESCRIPTOR>(iPop,0)/descriptors::invCs2<V,DESCRIPTOR>();
107 V hermite3YYZ = hermite2YY * descriptors::c<DESCRIPTOR>(iPop,2);
108 V hermite3YZZ = hermite2YZ * descriptors::c<DESCRIPTOR>(iPop,2) - descriptors::c<DESCRIPTOR>(iPop,1)/descriptors::invCs2<V,DESCRIPTOR>();
109
110 thirdOrderTerms += V{1. / 2.} * reciSpeedOfSoundHc * (hermite3XZZ + hermite3YZZ) * (aEqThrdXZZ + aEqThrdYZZ)
111 + V{1. / 2.} * reciSpeedOfSoundHc * (hermite3YYZ + hermite3XXZ) * (aEqThrdYYZ + aEqThrdXXZ)
112 + V{1. / 6.} * reciSpeedOfSoundHc * (hermite3XZZ - hermite3YZZ) * (aEqThrdXZZ - aEqThrdYZZ)
113 + V{1. / 6.} * reciSpeedOfSoundHc * (hermite3YYZ - hermite3XXZ) * (aEqThrdYYZ - aEqThrdXXZ);
114 }
115 return rho
117 * ( V{1}
120 - descriptors::invCs2<V,DESCRIPTOR>() * V{0.5} * uSqr
121 + thirdOrderTerms)
123 }

References olb::descriptors::c(), olb::descriptors::invCs2(), and olb::descriptors::t().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

The documentation for this struct was generated from the following file: