24template <MInt nDim, MInt nDist,
class SysEqn>
36template <MInt nDim, MInt nDist,
class SysEqn>
42 const MInt timeStep = s->getCurrentTimeStep();
43 const MUint noSpongeCells = this->m_spongeCells.size();
44 maia::parallelFor<true>(0, noSpongeCells, [=](
MInt spongeCellId) {
45 auto& cell = this->m_spongeCells[spongeCellId];
46 const MInt cellId = cell.cellId;
47 if((timeStep - 1) %
IPOW2(s->maxLevel() - s->a_level(cellId)) != 0)
return;
49 const MFloat deltaRho = s->a_variable(cellId, s->PV->RHO) - this->m_trgRho;
50 s->a_variable(cellId, s->PV->RHO) -= cell.spongeFactor * deltaRho;
53 s->a_distribution(cellId, Ld::lastId()) = s->a_variable(cellId, s->PV->RHO);
55 s->a_distribution(cellId, nDist - 1) -= s->a_distribution(cellId, dist);
72template <MInt nDim, MInt nDist,
class SysEqn>
86template <MInt nDim, MInt nDist,
class SysEqn>
90 m_trgEq = s.
getEqDists(this->m_trgRho, this->m_trgU.data());
93template <MInt nDim, MInt nDist,
class SysEqn>
98 const MInt timeStep = s->getCurrentTimeStep();
99 const MUint noSpongeCells = this->m_spongeCells.size();
100 maia::parallelFor<true>(0, noSpongeCells, [=](
MInt spongeCellId) {
101 auto& cell = this->m_spongeCells[spongeCellId];
102 const MInt cellId = cell.cellId;
103 if((timeStep - 1) %
IPOW2(s->maxLevel() - s->a_level(cellId)) != 0)
return;
104 std::array<MFloat, nDim> u{};
105 for(
MInt d = 0; d < nDim; d++) {
106 u[d] = s->a_variable(cellId, d);
108 std::array<MFloat, nDist> eqDist = s->
getEqDists(s->a_variable(cellId, s->PV->RHO), u.data());
109 for(
MInt i = 0; i < nDist; i++) {
110 s->a_distribution(cellId, i) -= cell.spongeFactor * (eqDist[i] - m_trgEq[i]);
122template <MInt nDim, MInt nDist,
class SysEqn>
134template <MInt nDim, MInt nDist,
class SysEqn>
139 const MInt timeStep = s->getCurrentTimeStep();
140 const MUint noSpongeCells = this->m_spongeCells.size();
141 maia::parallelFor<true>(0, noSpongeCells, [=](
MInt spongeCellId) {
142 auto& cell = this->m_spongeCells[spongeCellId];
143 const MInt cellId = cell.cellId;
144 if((timeStep - 1) %
IPOW2(s->maxLevel() - s->a_level(cellId)) != 0)
return;
145 s->a_nu(cellId) *= (1.0 + cell.spongeFactor);
151 reg_SpongeRhoConstd2q9C(
"LB_SPONGE_RHOCONST");
153 reg_SpongeRhoConstd2q9(
"LB_SPONGE_RHOCONST");
155 reg_SpongeRhoConstd3q27C(
"LB_SPONGE_RHOCONST");
157 reg_SpongeRhoConstd3q27(
"LB_SPONGE_RHOCONST");
160 reg_SpongeEqConstd2q9C(
"LB_SPONGE_EQCONST");
162 reg_SpongeEqConstd2q9(
"LB_SPONGE_EQCONST");
164 reg_SpongeEqConstd3q27C(
"LB_SPONGE_EQCONST");
166 reg_SpongeEqConstd3q27(
"LB_SPONGE_EQCONST");
169 reg_SpongeViscoisty2q9C(
"LB_SPONGE_VISCOSITY");
171 reg_SpongeViscoisty2q9(
"LB_SPONGE_VISCOSITY");
This class represents all LB models.
std::array< MFloat, nDist > getEqDists(const MFloat rho, const MFloat *const velocity)
Calls function to return the equilibrium distribution.
Class for registering a source term to the factory registry.
LB sponge source term : sponge towards const target f_eq(rho_trg, u_trg)
LbSrcTerm_spongeEqConst(LbSolverDxQy< nDim, nDist, SysEqn > *p_solver)
void apply_preCollision() override
void apply_postPropagation() override
void apply_postCollision() override
std::array< MFloat, nDist > m_trgEq
Base class for lb sponge layers.
LB sponge source term : sponge towards const target f_eq(rho_trg, u)
LbSrcTerm_spongeRhoConst(LbSolverDxQy< nDim, nDist, SysEqn > *p_solver)
void apply_postCollision() override
void apply_preCollision() override
void apply_postPropagation() override
LB sponge source term : sponge viscosity towards outside.
void apply_preCollision() override
void apply_postPropagation() override
LbSrcTerm_spongeVisocity(LbSolverDxQy< nDim, nDist, SysEqn > *p_solver)
void apply_postCollision() override
constexpr MLong IPOW2(MInt x)
MFloat dist(const Point< DIM > &p, const Point< DIM > &q)
LB lattice descriptor for arrays depending on D and Q.