diff --git a/src/lbm_mesapd_coupling/momentum_exchange_method/MovingParticleMapping.h b/src/lbm_mesapd_coupling/momentum_exchange_method/MovingParticleMapping.h index 29c161d4f0378d60e416e4dac2a3e887d2185ccd..88d3112369193368602fec3c9e9506bad89a2b7f 100644 --- a/src/lbm_mesapd_coupling/momentum_exchange_method/MovingParticleMapping.h +++ b/src/lbm_mesapd_coupling/momentum_exchange_method/MovingParticleMapping.h @@ -165,9 +165,9 @@ private: } } - - // cell is already an obstacle (maybe from another particle) - if( isFlagSet( cellFlagPtr, obstacle ) ) { + else if( isFlagSet( cellFlagPtr, obstacle ) ) + { + // cell is already an obstacle (maybe from another particle) auto formerParticleUid = (*particleField)(x, y, z); auto formerParticleIdx = ac_->uidToIdx(formerParticleUid); if(!isSet(ac_->getFlags(formerParticleIdx), mesa_pd::data::particle_flags::FIXED) ) @@ -179,10 +179,9 @@ private: (*particleField)(x, y, z) = particleUid; } } - - // cell is a former obstacle cell (maybe from another particle that has moved away) - if( isFlagSet( cellFlagPtr, formerObstacle ) ) + else if( isFlagSet( cellFlagPtr, formerObstacle ) ) { + // cell is a former obstacle cell (maybe from another particle that has moved away) boundaryHandling->setBoundary( obstacle, x, y, z ); removeFlag( cellFlagPtr, formerObstacle ); (*particleField)(x, y, z) = particleUid; @@ -333,8 +332,12 @@ private: { if( singleCast(particleIdx, ac, containsPointFctr, ac, Vector3<real_t>(cx,cy,cz)) ) { - boundaryHandling->forceBoundary(obstacleFlag, x, y, z); - (*particleField)(x,y,z) = ac.getUid(particleIdx); + if(boundaryHandling->isDomain(x,y,z)) + { + boundaryHandling->forceBoundary(obstacleFlag, x, y, z); + (*particleField)(x,y,z) = ac.getUid(particleIdx); + } + // no else -> will not overwrite pre-existing boundary cells, e.g. of previously applied applied mapping (e.g. when first mapping global particles) } cx += dx; } diff --git a/src/lbm_mesapd_coupling/utility/InspectionProbe.h b/src/lbm_mesapd_coupling/utility/InspectionProbe.h index 4513cdfaf616982c2d11aa1d5253ce2d49459eab..b2644017f7d0d373ffc61352e404ffa20be119f8 100644 --- a/src/lbm_mesapd_coupling/utility/InspectionProbe.h +++ b/src/lbm_mesapd_coupling/utility/InspectionProbe.h @@ -74,6 +74,11 @@ public: } } + void setPosition(Vector3<real_t> probeLocation) + { + probeLocation_ = probeLocation; + } + private: void printStatusOfCellSurrounding(Cell centerCell, const IBlock& block) @@ -121,7 +126,7 @@ private: void printToScreen(bool isFluid, real_t rho, Vector3<real_t> velocity) { - if(printToScreen_) WALBERLA_LOG_INFO("Values in probe at position " << probeLocation_ << ": " << (isFluid?"F":"P") << ", rho = " << rho << ", velocity = " << velocity); + if(printToScreen_) WALBERLA_LOG_INFO("Values in probe at position " << probeLocation_ << " on rank " << mpi::MPIManager::instance()->rank() << ": " << (isFluid?"F":"P") << ", rho = " << rho << ", velocity = " << velocity); } void writeToFile(bool isFluid, real_t rho, Vector3<real_t> velocity) diff --git a/src/lbm_mesapd_coupling/utility/ParticleSelector.h b/src/lbm_mesapd_coupling/utility/ParticleSelector.h index 9baf0a4a1bb36d3938a6fcaefeeb0b10f480a1dd..a18a91af44075a41384b513093b6062a180bac92 100644 --- a/src/lbm_mesapd_coupling/utility/ParticleSelector.h +++ b/src/lbm_mesapd_coupling/utility/ParticleSelector.h @@ -24,6 +24,7 @@ #include "mesa_pd/data/Flags.h" #include "mesa_pd/data/IAccessor.h" #include "mesa_pd/data/shape/Sphere.h" +#include "mesa_pd/kernel/ParticleSelector.h" namespace walberla { namespace lbm_mesapd_coupling { @@ -76,8 +77,9 @@ struct StokesNumberBasedSphereSelector static_assert(std::is_base_of<mesa_pd::data::IAccessor, ParticleAccessor_T>::value, "Provide a valid accessor as template"); lbm_mesapd_coupling::RegularParticlesSelector regularParticlesSelector; + mesa_pd::kernel::SelectLocal localParticlesSelector; - if(regularParticlesSelector(particleIdx, ac)) + if(regularParticlesSelector(particleIdx, ac) && localParticlesSelector(particleIdx, ac)) { // check for non-fixed spheres if( ac.getShape(particleIdx)->getShapeType() == mesa_pd::data::Sphere::SHAPE_TYPE )