665 {
666 auto values = cell.template getField<VELOCITY>();
667 for (int iD=0; iD<DESCRIPTOR::d; ++iD) {
668 u[iD] = values[iD];
669 }
670 auto rho = cell.template getField<descriptors::RHO>();
671 auto gradRho = cell.template getField<descriptors::NABLARHO>();
672
673
674 auto force = cell.template getField<descriptors::FORCE>();
675 const V p = TYPE().computeRho(cell);
676
679
680 V popOnWall = V{};
681 for (auto e : onWallIndices) {
682 popOnWall += cell[e];
683 }
684 popOnWall -= cell[0];
685
686 V popNormal = V{};
687 for (auto e : normalIndices) {
688 popNormal += cell[e];
689 }
690
693 V pops = V{2}*popNormal+popOnWall;
694 V term =
cs2*(V{2}*rho-gradRho[direction])/(V{2}*rho*w0);
695 V otherU = 0;
696 for (int iDim = 1; iDim < DESCRIPTOR::d; ++iDim) {
697 u[(direction+iDim)%DESCRIPTOR::d] = 0.5/rho*force[(direction+iDim)%DESCRIPTOR::d];
698 otherU +=
cs2*0.5*u[(direction+iDim)%DESCRIPTOR::d]*gradRho[(direction+iDim)%DESCRIPTOR::d]
699 -0.5*w0*rho*u[(direction+iDim)%DESCRIPTOR::d]*u[(direction+iDim)%DESCRIPTOR::d];
700 }
701 u[direction] = orientation*(-term +
util::sqrt(term*term + V{2}/rho/w0*(
cs2*(pops+0.5*force[direction])-(V{1}-w0)*p+otherU)));
702 }
platform_constant Fraction cs2
constexpr T invCs2() any_platform
constexpr T t(unsigned iPop, tag::CUM) any_platform
constexpr auto populationsContributingToVelocity() any_platform
Return array of population indices where c[iVel] == value.