24#ifndef SET_NEW_SLIP_BOUNDARY_3D_HH
25#define SET_NEW_SLIP_BOUNDARY_3D_HH
31template <
typename T,
typename DESCRIPTOR,
int discreteNormalX,
int discreteNormalY,
int discreteNormalZ>
40 template <
typename CELL>
45 int mult = 2 / (discreteNormalX*discreteNormalX + discreteNormalY*discreteNormalY + discreteNormalZ*discreteNormalZ);
46 int reflectionPop[DESCRIPTOR::q] = {0};
47 for (
int iPop = 1; iPop < DESCRIPTOR::q; iPop++) {
48 reflectionPop[iPop] = 0;
50 int scalarProduct = descriptors::c<DESCRIPTOR>(iPop,0)*discreteNormalX + descriptors::c<DESCRIPTOR>(iPop,1)*discreteNormalY + descriptors::c<DESCRIPTOR>(iPop,2)*discreteNormalZ;
51 if (scalarProduct < 0) {
54 mirrorDirection0 = -descriptors::c<DESCRIPTOR>(iPop,0);
55 mirrorDirection1 = -descriptors::c<DESCRIPTOR>(iPop,1);
56 mirrorDirection2 = -descriptors::c<DESCRIPTOR>(iPop,2);
59 mirrorDirection0 = descriptors::c<DESCRIPTOR>(iPop,0) - mult*scalarProduct*discreteNormalX;
60 mirrorDirection1 = descriptors::c<DESCRIPTOR>(iPop,1) - mult*scalarProduct*discreteNormalY;
61 mirrorDirection2 = descriptors::c<DESCRIPTOR>(iPop,2) - mult*scalarProduct*discreteNormalZ;
64 for (
int i = 1; i < DESCRIPTOR::q; i++) {
65 if (descriptors::c<DESCRIPTOR>(i,0)==mirrorDirection0
66 && descriptors::c<DESCRIPTOR>(i,1)==mirrorDirection1
67 && descriptors::c<DESCRIPTOR>(i,2)==mirrorDirection2) {
68 reflectionPop[iPop] = i;
74 for (
int iPop = 1; iPop < DESCRIPTOR::q; iPop++) {
75 if (reflectionPop[iPop]!=0) {
76 cell[iPop] = cell[reflectionPop[iPop]];
82template<
typename T,
typename DESCRIPTOR>
88template<
typename T,
typename DESCRIPTOR>
91 OstreamManager clout(std::cout,
"setInterpolatedVelocityBoundary");
93 bool includeOuterCells =
false;
94 if (indicator->getSuperGeometry().getOverlap() == 1) {
95 includeOuterCells =
true;
96 clout <<
"WARNING: overlap == 1, boundary conditions set on overlap despite unknown neighbor materials" << std::endl;
99 setNewSlipBoundary<T,DESCRIPTOR>(sLattice.
getBlock(iC), indicator->getBlockIndicatorF(iC),includeOuterCells);
101 addPoints2CommBC(sLattice,std::forward<
decltype(indicator)>(indicator), _overlap);
105template <
typename T,
typename DESCRIPTOR>
108 using namespace boundaryhelper;
110 const int margin = includeOuterCells ? 0 : 1;
111 std::vector<int> discreteNormal(4,0);
112 blockGeometryStructure.forSpatialLocations([&](
auto iX,
auto iY,
auto iZ) {
113 if (blockGeometryStructure.getNeighborhoodRadius({iX, iY, iZ}) >= margin
114 && indicator(iX, iY, iZ)) {
115 discreteNormal = blockGeometryStructure.getStatistics().getType(iX, iY, iZ);
121 promisePostProcessorForNormal<T, DESCRIPTOR, SlipBoundaryPostProcessor3D>(
125 dynamics = _block.template getDynamics<NoCollideDynamics<T,DESCRIPTOR>>();
127 dynamics = _block.template getDynamics<BounceBack<T,DESCRIPTOR>>();
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.
Smart pointer for managing the various ways of passing functors around.
class for marking output with some text
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.
cpu::simd::Pack< T > fabs(cpu::simd::Pack< T > value)
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.
OperatorScope
Block-wide operator application scopes.
@ PerCell
Per-cell application, i.e. OPERATOR::apply is passed a CELL concept implementation.
void setNewSlipBoundary(SuperLattice< T, DESCRIPTOR > &sLattice, SuperGeometry< T, 3 > &superGeometry, int material)
void setBoundary(BlockLattice< T, DESCRIPTOR > &block, int iX, int iY, Dynamics< T, DESCRIPTOR > *dynamics, PostProcessorGenerator2D< T, DESCRIPTOR > *postProcessor)
Interface for per-cell dynamics.
static constexpr OperatorScope scope
void apply(CELL &cell) any_platform
Communication after collision.