24#ifndef RTLBM_BOUNDARY_DYNAMICS_HH
25#define RTLBM_BOUNDARY_DYNAMICS_HH
35template<
typename T,
typename DESCRIPTOR,
typename MOMENTA,
int direction,
int orientation>
37 : legacy::BasicDynamics<T,DESCRIPTOR,MOMENTA>()
39 this->
getName() =
"RtlbmDiffuseBoundaryDynamics";
42template<
typename T,
typename DESCRIPTOR,
typename MOMENTA,
int direction,
int orientation>
45 return descriptors::t<T,DESCRIPTOR>(iPop)*rho - descriptors::t<T,DESCRIPTOR>(iPop);
48template<
typename T,
typename DESCRIPTOR,
typename MOMENTA,
int direction,
int orientation>
52 using MomentaF =
typename MOMENTA::template type<DESCRIPTOR>;
53 T dirichletTemperature =
MomentaF().computeRho(cell);
54 constexpr auto missing_iPop = util::subIndexOutgoing<L,direction,orientation>();
57 for (
int i : missing_iPop ) {
58 sumWeights += descriptors::t<T,L>(i);
61 for (
int i : missing_iPop ) {
62 cell[i] = descriptors::t<T,L>(i)*dirichletTemperature/sumWeights - descriptors::t<T,L>(i);
67template<
typename T,
typename DESCRIPTOR,
typename MOMENTA,
int direction,
int orientation>
73template<
typename T,
typename DESCRIPTOR,
typename MOMENTA,
int direction,
int orientation>
79template<
typename T,
typename DESCRIPTOR,
typename MOMENTA,
int plane,
int normal1,
int normal2>
81 : legacy::BasicDynamics<T,DESCRIPTOR,MOMENTA>()
83 this->
getName() =
"RtlbmDiffuseEdgeBoundaryDynamics";
86template<
typename T,
typename DESCRIPTOR,
typename MOMENTA,
int plane,
int normal1,
int normal2>
89 return descriptors::t<T,DESCRIPTOR>(iPop)*rho - descriptors::t<T,DESCRIPTOR>(iPop);
92template<
typename T,
typename DESCRIPTOR,
typename MOMENTA,
int plane,
int normal1,
int normal2>
96 using MomentaF =
typename MOMENTA::template type<DESCRIPTOR>;
97 T dirichletTemperature =
MomentaF().computeRho(cell);
98 std::vector<int> missing_iPop = util::subIndexOutgoing3DonEdges<L,plane,normal1,normal2>();
101 for (
int i : missing_iPop ) {
102 sumWeights += descriptors::t<T,L>(i);
105 for (
int i : missing_iPop ) {
106 cell[i] = descriptors::t<T,L>(i)*dirichletTemperature/sumWeights - descriptors::t<T,L>(i);
111template<
typename T,
typename DESCRIPTOR,
typename MOMENTA,
int plane,
int normal1,
int normal2>
117template<
typename T,
typename DESCRIPTOR,
typename MOMENTA,
int plane,
int normal1,
int normal2>
123template<
typename T,
typename DESCRIPTOR,
typename MOMENTA,
int xNormal,
int yNormal,
int zNormal>
125 : legacy::BasicDynamics<T,DESCRIPTOR,MOMENTA>()
127 this->
getName() =
"RtlbmDiffuseCornerBoundaryDynamics";
130template<
typename T,
typename DESCRIPTOR,
typename MOMENTA,
int xNormal,
int yNormal,
int zNormal>
133 return descriptors::t<T,DESCRIPTOR>(iPop)*rho - descriptors::t<T,DESCRIPTOR>(iPop);
136template<
typename T,
typename DESCRIPTOR,
typename MOMENTA,
int xNormal,
int yNormal,
int zNormal>
139 typedef DESCRIPTOR L;
140 using MomentaF =
typename MOMENTA::template type<DESCRIPTOR>;
141 T dirichletTemperature =
MomentaF().computeRho(cell);
142 std::vector<int>
const missing_iPop = util::subIndexOutgoing3DonCorners<L,xNormal,yNormal,zNormal>();
145 for (
int i : missing_iPop ) {
146 sumWeights += descriptors::t<T,L>(i);
149 for (
int i : missing_iPop ) {
150 cell[i] = descriptors::t<T,L>(i)*dirichletTemperature/sumWeights - descriptors::t<T,L>(i);
155template<
typename T,
typename DESCRIPTOR,
typename MOMENTA,
int xNormal,
int yNormal,
int zNormal>
161template<
typename T,
typename DESCRIPTOR,
typename MOMENTA,
int xNormal,
int yNormal,
int zNormal>
170template<
typename T,
typename DESCRIPTOR,
typename MOMENTA,
int direction,
int orientation>
172 : legacy::BasicDynamics<T,DESCRIPTOR,MOMENTA>()
174 this->
getName() =
"RtlbmDiffuseConstBoundaryDynamics";
177template<
typename T,
typename DESCRIPTOR,
typename MOMENTA,
int direction,
int orientation>
180 return descriptors::t<T,DESCRIPTOR>(iPop)*rho - descriptors::t<T,DESCRIPTOR>(iPop);
183template<
typename T,
typename DESCRIPTOR,
typename MOMENTA,
int direction,
int orientation>
193 typedef DESCRIPTOR L;
195 for (
int iPop = 0; iPop < L::q; ++iPop ) {
196 cell[iPop] = - descriptors::t<T,L>(iPop);
199 constexpr auto missing_iPop = util::subIndexOutgoing<L,direction,orientation>();
202 for (
int i : missing_iPop ) {
203 sumWeights += descriptors::t<T,L>(i);
206 using MomentaF =
typename MOMENTA::template type<DESCRIPTOR>;
207 T dirichletTemperature =
MomentaF().computeRho(cell);
208 for (
int i : missing_iPop ) {
209 cell[i] = descriptors::t<T,L>(i)*dirichletTemperature/sumWeights - descriptors::t<T,L>(i);
214template<
typename T,
typename DESCRIPTOR,
typename MOMENTA,
int direction,
int orientation>
220template<
typename T,
typename DESCRIPTOR,
typename MOMENTA,
int direction,
int orientation>
228template<
typename T,
typename DESCRIPTOR,
typename MOMENTA,
int plane,
int normal1,
int normal2>
230 : legacy::BasicDynamics<T,DESCRIPTOR,MOMENTA>()
232 this->
getName() =
"RtlbmDiffuseConstEdgeBoundaryDynamics";
235template<
typename T,
typename DESCRIPTOR,
typename MOMENTA,
int plane,
int normal1,
int normal2>
238 return descriptors::t<T,DESCRIPTOR>(iPop)*rho - descriptors::t<T,DESCRIPTOR>(iPop);
241template<
typename T,
typename DESCRIPTOR,
typename MOMENTA,
int plane,
int normal1,
int normal2>
251 typedef DESCRIPTOR L;
254 for (
int iPop = 0; iPop < L::q; ++iPop ) {
255 cell[iPop] = - descriptors::t<T,L>(iPop);
258 constexpr auto missing_iPop = util::subIndexOutgoing3DonEdges<L,plane,normal1,normal2>();
260 for (
int i : missing_iPop ) {
261 sumWeights += descriptors::t<T,L>(i);
264 using MomentaF =
typename MOMENTA::template type<DESCRIPTOR>;
265 T dirichletTemperature =
MomentaF().computeRho(cell);
266 for (
int i : missing_iPop ) {
267 cell[i] = descriptors::t<T,L>(i)*dirichletTemperature/sumWeights - descriptors::t<T,L>(i);
272template<
typename T,
typename DESCRIPTOR,
typename MOMENTA,
int plane,
int normal1,
int normal2>
278template<
typename T,
typename DESCRIPTOR,
typename MOMENTA,
int plane,
int normal1,
int normal2>
286template<
typename T,
typename DESCRIPTOR,
typename MOMENTA,
int xNormal,
int yNormal,
int zNormal>
288 : legacy::BasicDynamics<T,DESCRIPTOR,MOMENTA>()
290 this->
getName() =
"RtlbmDiffuseConstCornerBoundaryDynamics";
293template<
typename T,
typename DESCRIPTOR,
typename MOMENTA,
int xNormal,
int yNormal,
int zNormal>
296 return descriptors::t<T,DESCRIPTOR>(iPop)*rho - descriptors::t<T,DESCRIPTOR>(iPop);
299template<
typename T,
typename DESCRIPTOR,
typename MOMENTA,
int xNormal,
int yNormal,
int zNormal>
309 typedef DESCRIPTOR L;
312 for (
int iPop = 0; iPop < L::q; ++iPop ) {
313 cell[iPop] = - descriptors::t<T,L>(iPop);
316 auto missing_iPop = util::subIndexOutgoing3DonCorners<L,xNormal,yNormal,zNormal>();
318 for (
int i : missing_iPop ) {
319 sumWeights += descriptors::t<T,L>(i);
322 using MomentaF =
typename MOMENTA::template type<DESCRIPTOR>;
323 T dirichletTemperature =
MomentaF().computeRho(cell);
324 for (
int i : missing_iPop ) {
325 cell[i] = descriptors::t<T,L>(i)*dirichletTemperature/sumWeights - descriptors::t<T,L>(i);
331template<
typename T,
typename DESCRIPTOR,
typename MOMENTA,
int xNormal,
int yNormal,
int zNormal>
337template<
typename T,
typename DESCRIPTOR,
typename MOMENTA,
int xNormal,
int yNormal,
int zNormal>
344template<
typename T,
typename DESCRIPTOR,
typename MOMENTA,
int direction,
int orientation>
346 : legacy::BasicDynamics<T,DESCRIPTOR,MOMENTA>()
348 this->
getName() =
"RtlbmDirectedBoundaryDynamics";
351template<
typename T,
typename DESCRIPTOR,
typename MOMENTA,
int direction,
int orientation>
354 return rho*descriptors::t<T,DESCRIPTOR>(iPop) - descriptors::t<T,DESCRIPTOR>(iPop);
357template<
typename T,
typename DESCRIPTOR,
typename MOMENTA,
int direction,
int orientation>
360 typedef DESCRIPTOR L;
361 using MomentaF =
typename MOMENTA::template type<DESCRIPTOR>;
362 T dirichletTemperature =
MomentaF().computeRho(cell);
364 for (
int iPop = 0; iPop < L::q; ++iPop ) {
365 cell[iPop] = - descriptors::t<T,L>(iPop);
368 constexpr auto missingDiagonal = util::subIndexOutgoing<L,direction,orientation>();
369 for (
int i : missingDiagonal ) {
372 if ( util::normSqr<int>({descriptors::c<L>(i,0), descriptors::c<L>(i,1), descriptors::c<L>(i,2)}) == 1 ) {
374 cell[i] = (1-descriptors::t<T,L>(0))*dirichletTemperature - descriptors::t<T,L>(i);
376 if ( DESCRIPTOR::template provides<descriptors::tag::RTLBM>() ) {
377 cell[i] = dirichletTemperature - descriptors::t<T,L>(i);
382 cell[0] = descriptors::t<T,L>(0)*dirichletTemperature - descriptors::t<T,L>(0);
387template<
typename T,
typename DESCRIPTOR,
typename MOMENTA,
int direction,
int orientation>
393template<
typename T,
typename DESCRIPTOR,
typename MOMENTA,
int direction,
int orientation>
399template<
typename T,
typename DESCRIPTOR,
typename MOMENTA,
int plane,
int normal1,
int normal2>
401 : legacy::BasicDynamics<T,DESCRIPTOR,MOMENTA>()
403 this->
getName() =
"RtlbmDirectedEdgeBoundaryDynamics";
406template<
typename T,
typename DESCRIPTOR,
typename MOMENTA,
int plane,
int normal1,
int normal2>
409 return rho*descriptors::t<T,DESCRIPTOR>(iPop) - descriptors::t<T,DESCRIPTOR>(iPop);
412template<
typename T,
typename DESCRIPTOR,
typename MOMENTA,
int plane,
int normal1,
int normal2>
415 typedef DESCRIPTOR L;
416 using MomentaF =
typename MOMENTA::template type<DESCRIPTOR>;
417 T dirichletTemperature =
MomentaF().computeRho(cell);
419 for (
int iPop = 0; iPop < L::q; ++iPop ) {
420 cell[iPop] = - descriptors::t<T,L>(iPop);
423 std::vector<int>
const missingDiagonal = util::subIndexOutgoing3DonEdges<DESCRIPTOR,plane,normal1,normal2>();
424 for (
int i : missingDiagonal ) {
427 if ( util::normSqr<int>({descriptors::c<L>(i,0), descriptors::c<L>(i,1), descriptors::c<L>(i,2)}) == 1 ) {
429 cell[i] = (1-descriptors::t<T,L>(0))*dirichletTemperature - descriptors::t<T,L>(i);
431 if ( DESCRIPTOR::template provides<descriptors::tag::RTLBM>() ) {
432 cell[i] = dirichletTemperature - descriptors::t<T,L>(i);
437 cell[0] = descriptors::t<T,L>(0)*dirichletTemperature - descriptors::t<T,L>(0);
442template<
typename T,
typename DESCRIPTOR,
typename MOMENTA,
int plane,
int normal1,
int normal2>
448template<
typename T,
typename DESCRIPTOR,
typename MOMENTA,
int plane,
int normal1,
int normal2>
455template<
typename T,
typename DESCRIPTOR,
typename MOMENTA,
int xNormal,
int yNormal,
int zNormal>
457 : legacy::BasicDynamics<T,DESCRIPTOR,MOMENTA>()
459 this->
getName() =
"RtlbmDirectedCornerBoundaryDynamics";
462template<
typename T,
typename DESCRIPTOR,
typename MOMENTA,
int xNormal,
int yNormal,
int zNormal>
465 return rho*descriptors::t<T,DESCRIPTOR>(iPop) - descriptors::t<T,DESCRIPTOR>(iPop);
468template<
typename T,
typename DESCRIPTOR,
typename MOMENTA,
int xNormal,
int yNormal,
int zNormal>
471 typedef DESCRIPTOR L;
472 using MomentaF =
typename MOMENTA::template type<DESCRIPTOR>;
473 T dirichletTemperature =
MomentaF().computeRho(cell);
475 for (
int iPop = 0; iPop < L::q; ++iPop ) {
476 cell[iPop] = - descriptors::t<T,L>(iPop);
479 std::vector<int>
const missingDiagonal = util::subIndexOutgoing3DonCorners<DESCRIPTOR,xNormal,yNormal,zNormal>();
480 for (
int i : missingDiagonal ) {
483 if ( util::normSqr<int>({descriptors::c<L>(i,0), descriptors::c<L>(i,1), descriptors::c<L>(i,2)}) == 1 ) {
485 cell[i] = (1-descriptors::t<T,L>(0))*dirichletTemperature - descriptors::t<T,L>(i);
487 if ( DESCRIPTOR::template provides<descriptors::tag::RTLBM>() ) {
488 cell[i] = dirichletTemperature - descriptors::t<T,L>(i);
493 cell[0] = descriptors::t<T,L>(0)*dirichletTemperature - descriptors::t<T,L>(0);
498template<
typename T,
typename DESCRIPTOR,
typename MOMENTA,
int xNormal,
int yNormal,
int zNormal>
504template<
typename T,
typename DESCRIPTOR,
typename MOMENTA,
int xNormal,
int yNormal,
int zNormal>
Highest-level interface to Cell data.
CellStatistic< T > collide(Cell< T, DESCRIPTOR > &cell) override
Collision step for flat boundary.
T computeEquilibrium(int iPop, T rho, const T u[DESCRIPTOR::d]) const override
Compute equilibrium distribution function.
T getOmega() const
place holder
void setOmega(T omega_)
place holder
RtlbmDiffuseBoundaryDynamics(T omega_)
Constructor.
T getOmega() const
place holder
RtlbmDiffuseConstBoundaryDynamics(T omega_)
Constructor.
CellStatistic< T > collide(Cell< T, DESCRIPTOR > &cell) override
Collision step for flat boundary.
void setOmega(T omega_)
place holder
T computeEquilibrium(int iPop, T rho, const T u[DESCRIPTOR::d]) const override
Compute equilibrium distribution function.
CellStatistic< T > collide(Cell< T, DESCRIPTOR > &cell) override
Collision step for corner.
T computeEquilibrium(int iPop, T rho, const T u[DESCRIPTOR::d]) const override
Compute equilibrium distribution function.
RtlbmDiffuseConstCornerBoundaryDynamics(T omega_)
Constructor.
void setOmega(T omega_)
place holder
T getOmega() const
place holder
T getOmega() const
place holder
CellStatistic< T > collide(Cell< T, DESCRIPTOR > &cell) override
Collision step for edges.
void setOmega(T omega_)
place holder
RtlbmDiffuseConstEdgeBoundaryDynamics(T omega_)
Constructor.
T computeEquilibrium(int iPop, T rho, const T u[DESCRIPTOR::d]) const override
Compute equilibrium distribution function.
T getOmega() const
place holder
CellStatistic< T > collide(Cell< T, DESCRIPTOR > &cell) override
Collision step for corner.
void setOmega(T omega_)
place holder
RtlbmDiffuseCornerBoundaryDynamics(T omega_)
Constructor.
T computeEquilibrium(int iPop, T rho, const T u[DESCRIPTOR::d]) const override
Compute equilibrium distribution function.
CellStatistic< T > collide(Cell< T, DESCRIPTOR > &cell) override
Collision step for flat boundary.
void setOmega(T omega_)
place holder
T getOmega() const
place holder
RtlbmDiffuseEdgeBoundaryDynamics(T omega_)
Constructor.
T computeEquilibrium(int iPop, T rho, const T u[DESCRIPTOR::d]) const override
Compute equilibrium distribution function.
RtlbmDirectedBoundaryDynamics(T omega_)
Constructor.
T computeEquilibrium(int iPop, T rho, const T u[DESCRIPTOR::d]) const override
Compute equilibrium distribution function.
CellStatistic< T > collide(Cell< T, DESCRIPTOR > &cell) override
Collision step for directed boundary walls.
void setOmega(T omega_)
place holder
T getOmega() const
place holder
CellStatistic< T > collide(Cell< T, DESCRIPTOR > &cell) override
Collision step for directed boundary walls.
RtlbmDirectedCornerBoundaryDynamics(T omega_)
Constructor.
T computeEquilibrium(int iPop, T rho, const T u[DESCRIPTOR::d]) const override
Compute equilibrium distribution function.
T getOmega() const
place holder
void setOmega(T omega_)
place holder
T computeEquilibrium(int iPop, T rho, const T u[DESCRIPTOR::d]) const override
Compute equilibrium distribution function.
T getOmega() const
place holder
CellStatistic< T > collide(Cell< T, DESCRIPTOR > &cell) override
Collision step for directed boundary walls.
RtlbmDirectedEdgeBoundaryDynamics(T omega_)
Constructor.
void setOmega(T omega_)
place holder
Top level namespace for all of OpenLB.
Return value of any collision.
virtual std::string getName() const
Return human-readable name.
typename MOMENTA::template type< DESCRIPTOR > MomentaF