92 {
93 TRACE();
95
96 s.m_nu = s.m_Ma * LBCS / s.m_Re * s.m_referenceLength;
98 const MInt pCellId = s.m_activeCellList[index];
99 const MInt lvlDiff = s.maxLevel() - s.a_level(pCellId);
100 if((globalTimeStep - 1) % IPOW2(lvlDiff) != 0) return;
101
102 constexpr MInt nDimSqr = nDim * nDim;
103 std::array<MFloat, nDimSqr> c{};
104 const MFloat rho = s.a_variable(pCellId, s.PV->RHO);
105#ifndef WAR_NVHPC_PSTL
106 const MFloat*
const u = &s.a_variable(pCellId, s.PV->U);
107 const MFloat*
const dist = &s.a_oldDistribution(pCellId, 0);
108 s.
sysEqn().calcMomentumFlux(rho, u,
dist, c.data());
109#else
113 u[d] = s.a_variable(pCellId, d);
114 }
116 dist[d] = s.a_oldDistribution(pCellId, d);
117 }
118 s.
sysEqn().calcMomentumFlux(rho, u,
dist, c.data());
119#endif
120
121
122 std::array<MFloat, nDimSqr> localS{};
123
125 MInt noIterations = 0;
126 MBool converged =
false;
127 MFloat nuOld = s.a_oldNu(pCellId);
128 const MFloat F1Brho = F1 / rho;
129 while(!converged && noIterations < 50) {
130 MFloat omega = F2 / (F6 * nuOld * FFPOW2(lvlDiff) + F1);
131 for(MInt d = 0; d < nDimSqr; d++) {
132 localS[d] = -F3B2 * omega * F1Brho * c[d];
133 }
134
136 const MFloat volumeStrains = F1B3 * (localS[0] + localS[4] + localS[8]);
137 localS[0] -= volumeStrains;
138 localS[4] -= volumeStrains;
139 localS[8] -= volumeStrains;
140 }
141
142
144 for(
MInt d = 0; d < nDimSqr; d++) {
145 D += localS[d] * localS[d];
146 }
147 const MFloat gamma_dot = sqrt(F2 * D);
148
150
151 if(fabs(nuOld - nu) < 1e-10) converged = true;
152
153 nuOld = nu;
154 noIterations++;
155 }
156
157 s.a_nu(pCellId) = nu;
158 });
159}
This class represents all LB models.
constexpr SysEqn sysEqn() const
MFloat(LbSrcTerm_nonnewtonian::* m_getNuFromNonNewtonianModel)(const MFloat gamma_dot)
static constexpr MInt nDist
static constexpr MInt nDim
void parallelFor(MInt begin, MInt end, UnaryFunction &&f)
Wrapper function for parallel for loop.
MFloat dist(const Point< DIM > &p, const Point< DIM > &q)