23#ifndef ADVECTION_DIFFUSION_BOUNDARY_POST_PROCESSOR_3D_HH
24#define ADVECTION_DIFFUSION_BOUNDARY_POST_PROCESSOR_3D_HH
34template<
typename T,
typename DESCRIPTOR>
37 int discreteNormalX,
int discreteNormalY,
int discreteNormalZ)
38 : x0(x0_), x1(x1_), y0(y0_), y1(y1_), z0(z0_), z1(z1_)
42 this->
getName() =
"ConvectionBoundaryProcessor3D";
44 interpolationPop[0] = 0;
45 for (
int iPop = 1; iPop < DESCRIPTOR::q; iPop++) {
46 interpolationPop[iPop] = 0;
48 if (descriptors::c<DESCRIPTOR>(iPop,0)*discreteNormalX + descriptors::c<DESCRIPTOR>(iPop,1)*discreteNormalY + descriptors::c<DESCRIPTOR>(iPop,2)*discreteNormalZ > 0) {
50 interpolationPop[iPop] = 1;
55template<
typename T,
typename DESCRIPTOR>
58 int y1_,
int z0_,
int z1_)
60 int newX0, newX1, newY0, newY1, newZ0, newZ1;
62 x0, x1, y0, y1, z0, z1,
63 x0_, x1_, y0_, y1_, z0_, z1_,
64 newX0, newX1, newY0, newY1, newZ0, newZ1 ) ) {
66 auto& pop = blockLattice.template getField<descriptors::POPULATION>();
68#ifdef PARALLEL_MODE_OMP
69 #pragma omp parallel for
71 for (
int iPop = 1; iPop < DESCRIPTOR::q; ++iPop) {
72 if (interpolationPop[iPop] != 0) {
73 for (
int iX=newX0; iX<=newX1; ++iX) {
74 for (
int iY=newY0; iY<=newY1; ++iY) {
75 for (
int iZ=newZ0; iZ<=newZ1; ++iZ) {
76 const auto c = descriptors::c<DESCRIPTOR>(iPop);
77 if (blockLattice.
isInside(iX+c[0],iY+c[0],iZ+c[0]) && blockLattice.
isInside(iX+2*c[0],iY+2*c[0],iZ+2*c[0])) {
79 T v = 0.5 * ( pop[iPop][blockLattice.
getCellId(iX+ c[0],iY+ c[1],iZ+ c[2])]
80 + pop[iPop][blockLattice.
getCellId(iX+2*c[0],iY+2*c[1],iZ+2*c[2])]);
81 pop[iPop][blockLattice.
getCellId(iX,iY,iZ)] = v;
91template<
typename T,
typename DESCRIPTOR>
95 processSubDomain(blockLattice, x0, x1, y0, y1, z0, z1);
104template<
typename T,
typename DESCRIPTOR>
107 int z1_,
int discreteNormalX,
int discreteNormalY,
int discreteNormalZ)
108 : x0(x0_), x1(x1_), y0(y0_), y1(y1_), z0(z0_), z1(z1_)
110 this->
getName() =
"ZeroDistributionBoundaryProcessor3D";
114 for (
int iPop = 1; iPop < DESCRIPTOR::q; iPop++) {
117 if (descriptors::c<DESCRIPTOR>(iPop,0)*discreteNormalX + descriptors::c<DESCRIPTOR>(iPop,1)*discreteNormalY + descriptors::c<DESCRIPTOR>(iPop,2)*discreteNormalZ > 0) {
123template<
typename T,
typename DESCRIPTOR>
126 int y0_,
int y1_,
int z0_,
int z1_)
128 int newX0, newX1, newY0, newY1, newZ0, newZ1;
130 x0, x1, y0, y1, z0, z1,
131 x0_, x1_, y0_, y1_, z0_, z1_,
132 newX0, newX1, newY0, newY1, newZ0, newZ1 ) ) {
134#ifdef PARALLEL_MODE_OMP
135 #pragma omp parallel for
137 for (
int iX=newX0; iX<=newX1; ++iX) {
138 for (
int iY=newY0; iY<=newY1; ++iY) {
139 for (
int iZ=newZ0; iZ<=newZ1; ++iZ) {
140 for (
int iPop = 1; iPop < DESCRIPTOR::q ; ++iPop) {
141 if (resetPop[iPop]!=0) {
142 blockLattice.
get(iX,iY,iZ)[iPop] = -descriptors::t<T,DESCRIPTOR>(iPop);
151template<
typename T,
typename DESCRIPTOR>
155 processSubDomain(blockLattice, x0, x1, y0, y1, z0, z1);
160template<
typename T,
typename DESCRIPTOR,
typename FIELD_A,
typename FIELD_B>
163 int discreteNormalX_,
int discreteNormalY_,
int discreteNormalZ_)
164 : x0(x0_), x1(x1_), y0(y0_), y1(y1_), z0(z0_), z1(z1_),
165 discreteNormalX(discreteNormalX_), discreteNormalY(discreteNormalY_),
166 discreteNormalZ(discreteNormalZ_)
169 this->
getName() =
"ExtFieldBoundaryProcessor3D";
173template<
typename T,
typename DESCRIPTOR,
typename FIELD_A,
typename FIELD_B>
180 int newX0, newX1, newY0, newY1, newZ0, newZ1;
183 x0, x1, y0, y1, z0, z1,
184 x0_, x1_, y0_, y1_, z0_, z1_,
185 newX0, newX1, newY0, newY1, newZ0, newZ1 ) ) {
186#ifdef PARALLEL_MODE_OMP
187 #pragma omp parallel for
189 for (
int iX=newX0; iX<=newX1; ++iX) {
190 for (
int iY=newY0; iY<=newY1; ++iY) {
191 for (
int iZ=newZ0; iZ<=newZ1; ++iZ) {
192 auto self = blockLattice.
get(iX,iY,iZ);
193 auto neighbor = self.neighbor({discreteNormalX, discreteNormalY, discreteNormalZ});
195 self.template setField<FIELD_A>(neighbor.template getField<FIELD_B>());
198 self.template setField<FIELD_B>(neighbor.template getField<FIELD_A>());
207template<
typename T,
typename DESCRIPTOR,
typename FIELD_A,
typename FIELD_B>
211 processSubDomain(blockLattice, x0, x1, y0, y1, z0, z1);
216template<
typename T,
typename DESCRIPTOR>
219 int z1_,
int discreteNormalX_,
int discreteNormalY_,
int discreteNormalZ_)
221 discreteNormalX(discreteNormalX_), discreteNormalY(discreteNormalY_),
222 discreteNormalZ(discreteNormalZ_)
225template<
typename T,
typename DESCRIPTOR>
230 this->y1, this->z0, this->z1,
236template<
typename T,
typename DESCRIPTOR>
241 this->y0, this->y1, this->z0, this->z1,
242 discreteNormalX, discreteNormalY, discreteNormalZ);
247template<
typename T,
typename DESCRIPTOR>
250 int z0_,
int z1_,
int discreteNormalX_,
int discreteNormalY_,
int discreteNormalZ_)
252 discreteNormalX(discreteNormalX_), discreteNormalY(discreteNormalY_),
253 discreteNormalZ(discreteNormalZ_)
256template<
typename T,
typename DESCRIPTOR>
261 this->y0, this->y1, this->z0, this->z1,
262 discreteNormalX, discreteNormalY, discreteNormalZ);
265template<
typename T,
typename DESCRIPTOR>
270 this->x1, this->y0, this->y1, this->z0, this->z1,
271 discreteNormalX, discreteNormalY, discreteNormalZ);
276template<
typename T,
typename DESCRIPTOR,
typename FIELD_A,
typename FIELD_B>
279 int z1_,
int discreteNormalX_,
int discreteNormalY_,
int discreteNormalZ_)
281 discreteNormalX(discreteNormalX_),
282 discreteNormalY(discreteNormalY_),
283 discreteNormalZ(discreteNormalZ_)
286template<
typename T,
typename DESCRIPTOR,
typename FIELD_A,
typename FIELD_B>
291 this->y1, this->z0, this->z1,
292 discreteNormalX, discreteNormalY, discreteNormalZ);
295template<
typename T,
typename DESCRIPTOR,
typename FIELD_A,
typename FIELD_B>
300 this->y0, this->y1, this->z0, this->z1,
301 discreteNormalX, discreteNormalY, discreteNormalZ);
Platform-abstracted block lattice for external access and inter-block interaction.
Cell< T, DESCRIPTOR > get(CellID iCell)
Get Cell interface for index iCell.
CellID getCellId(LatticeR< D > latticeR) const
Get 1D cell ID.
bool isInside(LatticeR< D > latticeR) const
Return whether location is valid.
This class interpolates missing f_i from values near the boundary to get a more stable outflow condit...
ConvectionBoundaryProcessor3D(int x0_, int x1_, int y0_, int y1_, int z0_, int z1_, int discreteNormalX_, int discreteNormalY_, int discreteNormalZ_)
void process(BlockLattice< T, DESCRIPTOR > &blockLattice) override
Execute post-processing step.
void processSubDomain(BlockLattice< T, DESCRIPTOR > &blockLattice, int x0_, int x1_, int y0_, int y1_, int z0_, int z1_) override
Execute post-processing step on a sublattice.
PostProcessorGenerator3D< T, DESCRIPTOR > * clone() const override
ConvectionBoundaryProcessorGenerator3D(int x0_, int x1_, int y0_, int y1_, int z0_, int z1_, int discreteNormalX_, int discreteNormalY_, int discreteNormalZ_)
PostProcessor3D< T, DESCRIPTOR > * generate() const override
This class copies missing values in the external field from the neighbour in normal direction.
ExtFieldBoundaryProcessor3D(int x0_, int x1_, int y0_, int y1_, int z0_, int z1_, int discreteNormalX_, int discreteNormalY_, int discreteNormalZ_)
void process(BlockLattice< T, DESCRIPTOR > &blockLattice) override
Execute post-processing step.
void processSubDomain(BlockLattice< T, DESCRIPTOR > &blockLattice, int x0_, int x1_, int y0_, int y1_, int z0_, int z1_) override
Execute post-processing step on a sublattice.
ExtFieldBoundaryProcessorGenerator3D(int x0_, int x1_, int y0_, int y1_, int z0_, int z1_, int discreteNormalX_, int discreteNormalY_, int discreteNormalZ_)
PostProcessorGenerator3D< T, DESCRIPTOR > * clone() const override
PostProcessor3D< T, DESCRIPTOR > * generate() const override
std::string & getName()
read and write access to name
This class resets some values of the distribution on the boundary that can have arbitrary values to b...
void process(BlockLattice< T, DESCRIPTOR > &blockLattice) override
Execute post-processing step.
void processSubDomain(BlockLattice< T, DESCRIPTOR > &blockLattice, int x0_, int x1_, int y0_, int y1_, int z0_, int z1_) override
Execute post-processing step on a sublattice.
ZeroDistributionBoundaryProcessor3D(int x0_, int x1_, int y0_, int y1_, int z0_, int z1_, int discreteNormalX_, int discreteNormalY_, int discreteNormalZ_)
PostProcessor3D< T, DESCRIPTOR > * generate() const override
ZeroDistributionBoundaryProcessorGenerator3D(int x0_, int x1_, int y0_, int y1_, int z0_, int z1_, int discreteNormalX_, int discreteNormalY_, int discreteNormalZ_)
PostProcessorGenerator3D< T, DESCRIPTOR > * clone() const override
bool intersect(int x0, int x1, int y0, int y1, int x0_, int x1_, int y0_, int y1_, int &newX0, int &newX1, int &newY0, int &newY1)
Top level namespace for all of OpenLB.
#define OLB_PRECONDITION(COND)
Set of functions commonly used in LB computations – header file.