27#ifndef SET_BOUZIDI_ZERO_VELOCITY_BOUNDARY_HH
28#define SET_BOUZIDI_ZERO_VELOCITY_BOUNDARY_HH
39template<
typename T,
typename DESCRIPTOR>
41 std::vector<int> bulkMaterials)
43 setBouzidiZeroVelocityBoundary<T,DESCRIPTOR>(sLattice, superGeometry.
getMaterialIndicator(material),
47template<
typename T,
typename DESCRIPTOR>
49 std::vector<int> bulkMaterials)
53 setBouzidiZeroVelocityBoundary<T,DESCRIPTOR>(sLattice, std::forward<
decltype(boundaryIndicator)>(boundaryIndicator), superGeometry.
getMaterialIndicator(std::move(bulkMaterials)),
57template<
typename T,
typename DESCRIPTOR>
63 T _epsFraction = 0.0001;
67 clout <<
"epsFraction=" << _epsFraction << std::endl;
70 for (
int iCloc = 0; iCloc < sLattice.
getLoadBalancer().size(); ++iCloc) {
73 <<
" starts to read distances for ZeroVelocity Boundary..." << std::endl;
75 setBouzidiZeroVelocityBoundary<T,DESCRIPTOR>(sLattice.
getBlock(iCloc),
76 boundaryIndicator->getBlockIndicatorF(iCloc),
77 bulkIndicator->getBlockIndicatorF(iCloc),
78 geometryIndicator, _epsFraction);
81 <<
" finished reading distances for ZeroVelocity Boundary." << std::endl;
88 addPoints2CommBC(sLattice,std::forward<
decltype(boundaryIndicator)>(boundaryIndicator), overlap);
93template<
typename T,
typename DESCRIPTOR>
97 if (boundaryIndicator(iX,iY,iZ)) {
98 setBouzidiZeroVelocityBoundary1<T,DESCRIPTOR>(block,
111template<
typename T,
typename DESCRIPTOR>
116 T distances[DESCRIPTOR::q];
117 std::fill(std::begin(distances), std::end(distances), -1);
119 for (
int iPop = 1; iPop < DESCRIPTOR::q ; ++iPop) {
121 const int iXn = iX + c[0];
122 const int iYn = iY + c[1];
123 const int iZn = iZ + c[2];
124 if (blockGeometryStructure.
isInside(iXn,iYn,iZn)) {
125 if (bulkIndicator(iXn,iYn,iZn)) {
128 blockGeometryStructure.
getPhysR(physR,{iXn,iYn,iZn});
129 T voxelSize=blockGeometryStructure.
getDeltaR();
133 Vector<T,3> direction(-voxelSize*c[0],-voxelSize*c[1],-voxelSize*c[2]);
134 T cPhysNorm = voxelSize*
util::sqrt(c[0]*c[0]+c[1]*c[1]+c[2]*c[2]);
136 if (!geometryIndicator.
distance(dist,physC,direction,blockGeometryStructure.
getIcGlob() ) ) {
137 T epsX = voxelSize*c[0]*_epsFraction;
138 T epsY = voxelSize*c[1]*_epsFraction;
139 T epsZ = voxelSize*c[2]*_epsFraction;
146 direction2[0] -= 2.*epsX;
147 direction2[1] -= 2.*epsY;
148 direction2[2] -= 2.*epsZ;
150 if ( !geometryIndicator.
distance(dist,physC2,direction2,blockGeometryStructure.
getIcGlob())) {
151 clout <<
"ERROR: no boundary found at (" << iXn <<
"," << iYn <<
"," << iZn <<
") ~ ("
152 << physR[0] <<
"," << physR[1] <<
"," << physR[2] <<
"), "
153 <<
"in direction " << descriptors::opposite<DESCRIPTOR >(iPop)
157 T distNew = (dist -
util::sqrt(epsX*epsX+epsY*epsY+epsZ*epsZ))/cPhysNorm;
162 dist = 0.5 * cPhysNorm;
163 clout <<
"WARNING: distance at (" << iXn <<
"," << iYn <<
"," << iZn <<
") ~ ("
164 << physR[0] <<
"," << physR[1] <<
"," << physR[2] <<
"), "
165 <<
"in direction " << descriptors::opposite<DESCRIPTOR >(iPop) <<
": "
172 distances[descriptors::opposite<DESCRIPTOR>(iPop)] = dist/cPhysNorm;
175 if (blockGeometryStructure.
getMaterial(iXn,iYn,iZn) != 0) {
176 auto postProcessor = std::unique_ptr<PostProcessorGenerator3D<T, DESCRIPTOR>>{
183 setBouzidiZeroVelocityBoundary<T,DESCRIPTOR>(block,blockGeometryStructure, iX, iY, iZ, distances);
186template<
typename T,
typename DESCRIPTOR>
189 for (
int iPop = 1; iPop < DESCRIPTOR::q; ++iPop) {
192 setBouzidiZeroVelocityBoundary<T,DESCRIPTOR>(block, blockGeometryStructure, x-c[0], y-c[1], z-c[2], iPop, distances[iPop]);
197template<
typename T,
typename DESCRIPTOR>
200 auto postProcessor = std::unique_ptr<PostProcessorGenerator3D<T, DESCRIPTOR>>{
nullptr };
203 if (blockGeometryStructure.
getMaterial(x-c[0], y-c[1], z-c[2]) != 1) {
210 if (postProcessor && !block.
isPadding({x,y,z})) {
Representation of a block geometry.
Vector< T, D > getPhysR(LatticeR< D > latticeR)
int getMaterial(LatticeR< D > latticeR) const
returns the (iX,iY) entry in the 2D scalar field
int getIcGlob() const
Read only access to the global iC number which is given !=-1 if the block geometries are part of a su...
T getDeltaR() const
Read only access to the voxel size given in SI units (meter)
Base block indicator functor.
BlockGeometry< T, 3 > & getBlockGeometry()
Get underlying block geometry structure.
Platform-abstracted block lattice for external access and inter-block interaction.
virtual void addPostProcessor(std::type_index stage, LatticeR< DESCRIPTOR::d > latticeR, PostProcessorPromise< T, DESCRIPTOR > &&promise)=0
Schedule post processor for application to latticeR in stage.
void forSpatialLocations(F f) const
bool isPadding(LatticeR< D > latticeR) const
Return whether location is valid.
bool isInside(LatticeR< D > latticeR) const
Return whether location is valid.
Smart pointer for managing the various ways of passing functors around.
IndicatorF3D is an application from .
virtual bool distance(S &distance, const Vector< S, 3 > &origin, S precision, const Vector< S, 3 > &direction)
class for marking output with some text
void setMultiOutput(bool b)
enable message output for all MPI processes, disabled by default
Representation of a statistic for a parallel 2D geometry.
std::unique_ptr< SuperIndicatorF< T, D > > getMaterialIndicator(std::vector< int > &&materials)
Returns a material indicator using the given vector of materials.
Base indicator functor (discrete)
Super class maintaining block lattices for a cuboid decomposition.
BlockLattice< T, DESCRIPTOR > & getBlock(int locC)
Return BlockLattice with local index locC.
LoadBalancer< T > & getLoadBalancer()
Read and write access to the load balancer.
Linear Bouzidi BC Generator.
void setBouzidiZeroVelocityBoundary1(BlockLattice< T, DESCRIPTOR > &block, BlockGeometry< T, 3 > &blockGeometryStructure, int iX, int iY, int iZ, IndicatorF3D< T > &geometryIndicator, BlockIndicatorF3D< T > &bulkIndicator, T _epsFraction)
void setBouzidiZeroVelocityBoundary(SuperLattice< T, DESCRIPTOR > &sLattice, SuperGeometry< T, 2 > &superGeometry, int material, IndicatorF2D< T > &geometryIndicator, std::vector< int > bulkMaterials=std::vector< int >(1, 1))
Set offDynamics with boundary links and post processors using indicators.
cpu::simd::Pack< T > sqrt(cpu::simd::Pack< T > value)
bool nearZero(const ADf< T, DIM > &a)
Top level namespace for all of OpenLB.
void addPoints2CommBC(SuperLattice< T, DESCRIPTOR > &sLattice, FunctorPtr< SuperIndicatorF2D< T > > &&indicator, int _overlap)
Adds needed Cells to the Communicator _commBC in SuperLattice.