27#ifndef SET_BOUZIDI_VELOCITY_BOUNDARY_2D_HH
28#define SET_BOUZIDI_VELOCITY_BOUNDARY_2D_HH
40template<
typename T,
typename DESCRIPTOR,
class MixinDynamics>
42 std::vector<int> bulkMaterials)
51template<
typename T,
typename DESCRIPTOR,
class MixinDynamics>
56 T _epsFraction = 0.0001;
66 clout <<
"epsFraction=" << _epsFraction << std::endl;
68 for (
int iCloc = 0; iCloc < sLattice.
getLoadBalancer().size(); ++iCloc) {
70 <<
" starts to read distances for Velocity Boundary..." << std::endl;
72 bulkIndicator->getBlockIndicatorF(iCloc),
75 <<
" finished reading distances for Velocity Boundary." << std::endl;
86template<
typename T,
typename DESCRIPTOR,
class MixinDynamics>
89 block.forSpatialLocations([&](
auto iX,
auto iY) {
90 if (boundaryIndicator(iX,iY)) {
100template<
typename T,
typename DESCRIPTOR,
class MixinDynamics>
103 T _epsFraction = 0.0001;
105 T distances[DESCRIPTOR::q];
106 for (
int iPop = 1; iPop < DESCRIPTOR::q ; ++iPop) {
107 distances[iPop] = -1;
110 for (
int iPop = 1; iPop < DESCRIPTOR::q ; ++iPop) {
113 if (blockGeometryStructure.
isInside(iXn,iYn) && bulkIndicator(iXn,iYn)) {
116 blockGeometryStructure.
getPhysR(physR,{iXn,iYn});
117 T voxelSize=blockGeometryStructure.
getDeltaR();
123 if (!geometryIndicator.
distance(dist,physC,direction,blockGeometryStructure.
getIcGlob() ) ) {
131 direction2[0] -= 2.*epsX;
132 direction2[1] -= 2.*epsY;
134 if ( !geometryIndicator.
distance(dist,physC2,direction2,blockGeometryStructure.
getIcGlob())) {
135 clout <<
"ERROR: no boundary found at (" << iXn <<
"," << iYn <<
") ~ ("
136 << physR[0] <<
"," << physR[1] <<
"), "
140 T distNew = (dist -
util::sqrt(epsX*epsX+epsY*epsY))/cPhysNorm;
145 dist = 0.5 * cPhysNorm;
146 clout <<
"WARNING: distance at (" << iXn <<
"," << iYn <<
") ~ ("
147 << physR[0] <<
"," << physR[1] <<
"), "
162template<
typename T,
typename DESCRIPTOR,
class MixinDynamics>
165 typedef DESCRIPTOR L;
166 T location[DESCRIPTOR::d];
167 blockGeometryStructure.
getPhysR(location, {x,y});
169 T distancesCopy[L::q];
170 T spacing = blockGeometryStructure.
getDeltaR();
171 for (
int iPop = 1; iPop < L::q ; ++iPop) {
172 distancesCopy[iPop] = spacing*(1.-distances[iPop]);
174 distancesCopy[iPop] = -1;
180 for (
int iPop = 1; iPop < L::q ; ++iPop) {
189template<
typename T,
typename DESCRIPTOR,
class MixinDynamics>
193 if (blockGeometryStructure.
getMaterial({x-descriptors::c<DESCRIPTOR >(iPop,0), y-descriptors::c<DESCRIPTOR >(iPop,1)}) != 1) {
203 if (postProcessor && !block.isPadding({x,y})) {
204 block.addPostProcessor(*postProcessor);
209template<
typename T,
typename DESCRIPTOR,
class MixinDynamics>
214 block.defineDynamics({x,y}, dynamics);
Representation of a block geometry.
Vector< T, D > getPhysR(LatticeR< D > latticeR) const
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 (discrete)
BlockGeometry< T, 2 > & getBlockGeometry()
Get underlying block geometry structure.
bool isInside(LatticeR< D > latticeR) const
Return whether location is valid.
Smart pointer for managing the various ways of passing functors around.
IndicatorF2D is an application from .
virtual bool distance(S &distance, const Vector< S, 2 > &origin, S precision, const Vector< S, 2 > &direction)
returns false or true and pos. distance if there was one found for an given origin and 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.
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.
Dynamics for offLattice boundary conditions OffDynamics are basically NoLatticeDynamics with the addi...
constexpr int c(unsigned iPop, unsigned iDim) any_platform
constexpr int opposite(unsigned iPop) any_platform
void setOffDynamics(BlockLattice< T, DESCRIPTOR > &block, int x, int y, T location[DESCRIPTOR::d], T distances[DESCRIPTOR::q])
void setBouzidiVelocityBoundary(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.
bool nearZero(T a) any_platform
return true if a is close to zero
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.
Interface for per-cell dynamics.