38template<
typename DESCRIPTOR>
41 std::is_same<typename DESCRIPTOR::category_tag, descriptors::tag::MRT>::value,
42 "DESCRIPTOR is tagged as MRT");
45 template <
typename RHO,
typename U,
typename V=RHO>
49 const V uSqr = util::normSqr<U,DESCRIPTOR::d>(u);
50 for (
int jPop = 0; jPop < DESCRIPTOR::q; ++jPop) {
51 equ += descriptors::m<V,DESCRIPTOR>(iPop,jPop) *
53 descriptors::t<V,DESCRIPTOR>(jPop));
59 template <
typename MOMENTAEQ,
typename RHO,
typename U,
typename V=RHO>
61 const RHO& rho,
const U& u)
63 const V uSqr = util::normSqr<U,DESCRIPTOR::d>(u);
64 for (
int iPop = 0; iPop < DESCRIPTOR::q; ++iPop) {
65 momentaEq[iPop] = V{};
66 for (
int jPop = 0; jPop < DESCRIPTOR::q; ++jPop) {
67 momentaEq[iPop] += descriptors::m<V,DESCRIPTOR>(iPop,jPop) *
69 descriptors::t<V,DESCRIPTOR>(jPop));
74 template <
typename MOMENTA,
typename CELL,
typename V=
typename CELL::value_t>
77 for (
int iPop = 0; iPop < DESCRIPTOR::q; ++iPop) {
79 for (
int jPop = 0; jPop < DESCRIPTOR::q; ++jPop) {
80 momenta[iPop] += descriptors::m<V,DESCRIPTOR>(iPop,jPop) *
81 (cell[jPop] + descriptors::t<V,DESCRIPTOR>(jPop));
87 template <
typename CELL,
typename RHO,
typename U,
typename INVM_S,
typename V=
typename CELL::value_t>
89 const RHO& rho,
const U& u,
92 V uSqr = util::normSqr<V,DESCRIPTOR::d>(u);
93 V momenta[DESCRIPTOR::q] { };
94 V momentaEq[DESCRIPTOR::q] { };
99 for (
int iPop=0; iPop < DESCRIPTOR::q; ++iPop) {
101 for (
int jPop = 0; jPop < DESCRIPTOR::q; ++jPop) {
102 collisionTerm += invM_S[iPop][jPop] * (momenta[jPop] - momentaEq[jPop]);
104 cell[iPop] -= collisionTerm;
110 template <
typename CELL,
typename RHO,
typename U,
typename OMEGA,
typename INVM_S_SGS,
typename V=
typename CELL::value_t>
112 const RHO& rho,
const U& u,
114 const INVM_S_SGS& invM_S_SGS)
116 V uSqr = util::normSqr<V,DESCRIPTOR::d>(u);
117 V momenta[DESCRIPTOR::q];
118 V momentaEq[DESCRIPTOR::q];
123 for (
int iPop=0; iPop < DESCRIPTOR::q; ++iPop) {
125 for (
int jPop = 0; jPop < DESCRIPTOR::q; ++jPop) {
126 collisionTerm += invM_S_SGS[iPop][jPop] * (momenta[jPop] - momentaEq[jPop]);
128 cell[iPop] -= collisionTerm;
137 template <
typename CELL,
typename RHO,
typename U,
typename INVM_S,
typename FORCE,
typename V=
typename CELL::value_t>
139 const RHO& rho,
const U& u,
140 const INVM_S& invM_S,
144 for (
int iD=0; iD < DESCRIPTOR::d; ++iD) {
145 f_u += force[iD] * u[iD];
148 for (
int iPop=0; iPop < DESCRIPTOR::q; ++iPop) {
151 for (
int iD=0; iD < DESCRIPTOR::d; ++iD) {
152 c_u += descriptors::c<DESCRIPTOR>(iPop,iD)*u[iD];
153 c_f += descriptors::c<DESCRIPTOR>(iPop,iD)*force[iD];
155 V f1 = descriptors::t<V,DESCRIPTOR>(iPop)*rho*c_f*descriptors::invCs2<V,DESCRIPTOR>();
156 V f2 = descriptors::t<V,DESCRIPTOR>(iPop)*rho*(c_u*c_f*descriptors::invCs2<V,DESCRIPTOR>()-f_u)*descriptors::invCs2<V,DESCRIPTOR>();
159 for (
int jPop=0; jPop < DESCRIPTOR::q; ++jPop) {
160 invMsM += invM_S[iPop][jPop]*descriptors::m<V,DESCRIPTOR>(jPop,iPop);
162 cell[iPop] += f1 + f2 - invMsM*f2*V{0.5};
DESCRIPTORBASE for all types of 2D and 3D lattices.
Top level namespace for all of OpenLB.
static V secondOrder(int iPop, const RHO &rho, const U &u, const USQR &uSqr) any_platform
Computation of equilibrium distribution, second order in u.
static void computeMomenta(MOMENTA &momenta, CELL &cell)
static V mrtSGSCollision(CELL &cell, const RHO &rho, const U &u, const OMEGA &omega, const INVM_S_SGS &invM_S_SGS)
MRT SGS collision step.
static V mrtCollision(CELL &cell, const RHO &rho, const U &u, const INVM_S &invM_S)
MRT collision step.
static V equilibrium(int iPop, const RHO &rho, const U &u)
Computation of equilibrium distribution (in momenta space)
static void addExternalForce(CELL &cell, const RHO &rho, const U &u, const INVM_S &invM_S, const FORCE &force)
Ladd-Verberg-I body force model for MRT A.Ladd, R.
static void computeEquilibrium(MOMENTAEQ &momentaEq, const RHO &rho, const U &u)
Computation of all equilibrium distribution (in momenta space)