From 28d455fc5f5cf979470376ef9db5dd4a0c444652 Mon Sep 17 00:00:00 2001
From: Sebastian Eibl <sebastian.eibl@fau.de>
Date: Mon, 29 Mar 2021 18:22:03 +0200
Subject: [PATCH] added asserts to ensure interactionRadius is set properly

---
 .../kernel/InsertParticleIntoLinkedCells.templ.h   |  2 ++
 .../InsertParticleIntoSparseLinkedCells.templ.h    |  2 ++
 .../templates/mpi/SyncGhostOwners.templ.cpp        |  1 +
 .../templates/mpi/SyncNextNeighbors.templ.cpp      |  2 ++
 src/mesa_pd/common/AABBConversion.h                |  1 +
 src/mesa_pd/kernel/InsertParticleIntoLinkedCells.h |  4 ++++
 .../kernel/InsertParticleIntoSparseLinkedCells.h   |  4 ++++
 src/mesa_pd/mpi/SyncGhostOwners.cpp                |  1 +
 src/mesa_pd/mpi/SyncNextNeighbors.cpp              |  2 ++
 src/mesa_pd/mpi/SyncNextNeighborsBlockForest.cpp   |  2 ++
 .../mapping/ParticleMapping.cpp                    |  1 +
 .../momentum_exchange_method/SettlingSphere.cpp    |  6 ++++++
 .../utility/LubricationCorrection.cpp              | 14 ++++++++++++++
 tests/mesa_pd/ContactDetection.cpp                 |  2 +-
 tests/mesa_pd/kernel/GenerateAnalyticContacts.cpp  |  2 +-
 tests/mesa_pd/kernel/GenerateLinkedCells.cpp       |  1 +
 tests/mesa_pd/kernel/LinkedCellsVsBruteForce.cpp   |  2 +-
 17 files changed, 46 insertions(+), 3 deletions(-)

diff --git a/python/mesa_pd/templates/kernel/InsertParticleIntoLinkedCells.templ.h b/python/mesa_pd/templates/kernel/InsertParticleIntoLinkedCells.templ.h
index 96bcd932d..9cf3952cd 100644
--- a/python/mesa_pd/templates/kernel/InsertParticleIntoLinkedCells.templ.h
+++ b/python/mesa_pd/templates/kernel/InsertParticleIntoLinkedCells.templ.h
@@ -77,7 +77,9 @@ inline void InsertParticleIntoLinkedCells::operator()(const size_t p_idx, Access
       ac.setNextParticle(p_idx, lc.infiniteParticles_.exchange(int_c(p_idx)));
    } else
    {
+      WALBERLA_ASSERT_GREATER(ac.getInteractionRadius(p_idx), 0_r, "Did you forget to set the interaction radius?");
       {%- for dim in range(3) %}
+      WALBERLA_ASSERT_LESS(2_r * ac.getInteractionRadius(p_idx), lc.cellDiameter_[0], "Interaction radius is to large for this cell size. Contacts might get lost.");
       int hash{{dim}} = static_cast<int>(std::floor((ac.getPosition(p_idx)[{{dim}}] - minCorner[{{dim}}]) * lc.invCellDiameter_[{{dim}}]));
       {%- endfor %}
       {%- for dim in range(3) %}
diff --git a/python/mesa_pd/templates/kernel/InsertParticleIntoSparseLinkedCells.templ.h b/python/mesa_pd/templates/kernel/InsertParticleIntoSparseLinkedCells.templ.h
index ff10b7b6d..3edaf2bb0 100644
--- a/python/mesa_pd/templates/kernel/InsertParticleIntoSparseLinkedCells.templ.h
+++ b/python/mesa_pd/templates/kernel/InsertParticleIntoSparseLinkedCells.templ.h
@@ -77,7 +77,9 @@ inline void InsertParticleIntoSparseLinkedCells::operator()(const size_t p_idx,
       ac.setNextParticle(p_idx, lc.infiniteParticles_.exchange(int_c(p_idx)));
    } else
    {
+      WALBERLA_ASSERT_GREATER(ac.getInteractionRadius(p_idx), 0_r, "Did you forget to set the interaction radius?");
       {%- for dim in range(3) %}
+      WALBERLA_ASSERT_LESS(2_r * ac.getInteractionRadius(p_idx), lc.cellDiameter_[0], "Interaction radius is to large for this cell size. Contacts might get lost.");
       int hash{{dim}} = static_cast<int>(std::floor((ac.getPosition(p_idx)[{{dim}}] - minCorner[{{dim}}]) * lc.invCellDiameter_[{{dim}}]));
       {%- endfor %}
       {%- for dim in range(3) %}
diff --git a/python/mesa_pd/templates/mpi/SyncGhostOwners.templ.cpp b/python/mesa_pd/templates/mpi/SyncGhostOwners.templ.cpp
index 7336ec1e8..d1b5865b8 100644
--- a/python/mesa_pd/templates/mpi/SyncGhostOwners.templ.cpp
+++ b/python/mesa_pd/templates/mpi/SyncGhostOwners.templ.cpp
@@ -72,6 +72,7 @@ void SyncGhostOwners::updateAndMigrate( data::ParticleStorage& ps,
    std::set<walberla::mpi::MPIRank> recvRanks; // potential message senders
    for( auto pIt = ps.begin(); pIt != ps.end(); ++pIt)
    {
+      WALBERLA_ASSERT_GREATER(pIt->getInteractionRadius(), 0_r, "Did you forget to set the interaction radius?");
       if (isSet( pIt->getFlags(), GHOST))
       {
          if (!isSet( pIt->getFlags(), NON_COMMUNICATING) || syncNonCommunicatingBodies)
diff --git a/python/mesa_pd/templates/mpi/SyncNextNeighbors.templ.cpp b/python/mesa_pd/templates/mpi/SyncNextNeighbors.templ.cpp
index 3dd7ca3c4..bd1d1b284 100644
--- a/python/mesa_pd/templates/mpi/SyncNextNeighbors.templ.cpp
+++ b/python/mesa_pd/templates/mpi/SyncNextNeighbors.templ.cpp
@@ -87,6 +87,8 @@ void SyncNextNeighbors::generateSynchronizationMessages(walberla::mpi::BufferSys
    // position update
    for( auto pIt = ps.begin(); pIt != ps.end(); )
    {
+      WALBERLA_ASSERT_GREATER(pIt->getInteractionRadius(), 0_r, "Did you forget to set the interaction radius?");
+
       //skip all ghost particles
       if (data::particle_flags::isSet( pIt->getFlags(), data::particle_flags::GHOST))
       {
diff --git a/src/mesa_pd/common/AABBConversion.h b/src/mesa_pd/common/AABBConversion.h
index 33896f25f..c105d1ed2 100644
--- a/src/mesa_pd/common/AABBConversion.h
+++ b/src/mesa_pd/common/AABBConversion.h
@@ -32,6 +32,7 @@ namespace mesa_pd {
 
 math::AABB getAABBFromInteractionRadius(const Vector3<real_t> & pos, const real_t interactionRadius )
 {
+   WALBERLA_ASSERT_GREATER(interactionRadius, 0_r, "Did you forget to set the interaction radius?");
    return math::AABB( pos[0]-interactionRadius, pos[1]-interactionRadius, pos[2]-interactionRadius,
                       pos[0]+interactionRadius, pos[1]+interactionRadius, pos[2]+interactionRadius );
 }
diff --git a/src/mesa_pd/kernel/InsertParticleIntoLinkedCells.h b/src/mesa_pd/kernel/InsertParticleIntoLinkedCells.h
index a2cbd5c57..088e0577f 100644
--- a/src/mesa_pd/kernel/InsertParticleIntoLinkedCells.h
+++ b/src/mesa_pd/kernel/InsertParticleIntoLinkedCells.h
@@ -72,8 +72,12 @@ inline void InsertParticleIntoLinkedCells::operator()(const size_t p_idx, Access
       ac.setNextParticle(p_idx, lc.infiniteParticles_.exchange(int_c(p_idx)));
    } else
    {
+      WALBERLA_ASSERT_GREATER(ac.getInteractionRadius(p_idx), 0_r, "Did you forget to set the interaction radius?");
+      WALBERLA_ASSERT_LESS(2_r * ac.getInteractionRadius(p_idx), lc.cellDiameter_[0], "Interaction radius is to large for this cell size. Contacts might get lost.");
       int hash0 = static_cast<int>(std::floor((ac.getPosition(p_idx)[0] - minCorner[0]) * lc.invCellDiameter_[0]));
+      WALBERLA_ASSERT_LESS(2_r * ac.getInteractionRadius(p_idx), lc.cellDiameter_[0], "Interaction radius is to large for this cell size. Contacts might get lost.");
       int hash1 = static_cast<int>(std::floor((ac.getPosition(p_idx)[1] - minCorner[1]) * lc.invCellDiameter_[1]));
+      WALBERLA_ASSERT_LESS(2_r * ac.getInteractionRadius(p_idx), lc.cellDiameter_[0], "Interaction radius is to large for this cell size. Contacts might get lost.");
       int hash2 = static_cast<int>(std::floor((ac.getPosition(p_idx)[2] - minCorner[2]) * lc.invCellDiameter_[2]));
       if (hash0 < 0) hash0 = 0;
       if (hash0 >= lc.numCellsPerDim_[0]) hash0 = lc.numCellsPerDim_[0] - 1;
diff --git a/src/mesa_pd/kernel/InsertParticleIntoSparseLinkedCells.h b/src/mesa_pd/kernel/InsertParticleIntoSparseLinkedCells.h
index 6975337c4..44af0f3b6 100644
--- a/src/mesa_pd/kernel/InsertParticleIntoSparseLinkedCells.h
+++ b/src/mesa_pd/kernel/InsertParticleIntoSparseLinkedCells.h
@@ -72,8 +72,12 @@ inline void InsertParticleIntoSparseLinkedCells::operator()(const size_t p_idx,
       ac.setNextParticle(p_idx, lc.infiniteParticles_.exchange(int_c(p_idx)));
    } else
    {
+      WALBERLA_ASSERT_GREATER(ac.getInteractionRadius(p_idx), 0_r, "Did you forget to set the interaction radius?");
+      WALBERLA_ASSERT_LESS(2_r * ac.getInteractionRadius(p_idx), lc.cellDiameter_[0], "Interaction radius is to large for this cell size. Contacts might get lost.");
       int hash0 = static_cast<int>(std::floor((ac.getPosition(p_idx)[0] - minCorner[0]) * lc.invCellDiameter_[0]));
+      WALBERLA_ASSERT_LESS(2_r * ac.getInteractionRadius(p_idx), lc.cellDiameter_[0], "Interaction radius is to large for this cell size. Contacts might get lost.");
       int hash1 = static_cast<int>(std::floor((ac.getPosition(p_idx)[1] - minCorner[1]) * lc.invCellDiameter_[1]));
+      WALBERLA_ASSERT_LESS(2_r * ac.getInteractionRadius(p_idx), lc.cellDiameter_[0], "Interaction radius is to large for this cell size. Contacts might get lost.");
       int hash2 = static_cast<int>(std::floor((ac.getPosition(p_idx)[2] - minCorner[2]) * lc.invCellDiameter_[2]));
       if (hash0 < 0) hash0 = 0;
       if (hash0 >= lc.numCellsPerDim_[0]) hash0 = lc.numCellsPerDim_[0] - 1;
diff --git a/src/mesa_pd/mpi/SyncGhostOwners.cpp b/src/mesa_pd/mpi/SyncGhostOwners.cpp
index e9eceaf88..7bec109a4 100644
--- a/src/mesa_pd/mpi/SyncGhostOwners.cpp
+++ b/src/mesa_pd/mpi/SyncGhostOwners.cpp
@@ -72,6 +72,7 @@ void SyncGhostOwners::updateAndMigrate( data::ParticleStorage& ps,
    std::set<walberla::mpi::MPIRank> recvRanks; // potential message senders
    for( auto pIt = ps.begin(); pIt != ps.end(); ++pIt)
    {
+      WALBERLA_ASSERT_GREATER(pIt->getInteractionRadius(), 0_r, "Did you forget to set the interaction radius?");
       if (isSet( pIt->getFlags(), GHOST))
       {
          if (!isSet( pIt->getFlags(), NON_COMMUNICATING) || syncNonCommunicatingBodies)
diff --git a/src/mesa_pd/mpi/SyncNextNeighbors.cpp b/src/mesa_pd/mpi/SyncNextNeighbors.cpp
index 44f3946e7..3f9e5a2db 100644
--- a/src/mesa_pd/mpi/SyncNextNeighbors.cpp
+++ b/src/mesa_pd/mpi/SyncNextNeighbors.cpp
@@ -87,6 +87,8 @@ void SyncNextNeighbors::generateSynchronizationMessages(walberla::mpi::BufferSys
    // position update
    for( auto pIt = ps.begin(); pIt != ps.end(); )
    {
+      WALBERLA_ASSERT_GREATER(pIt->getInteractionRadius(), 0_r, "Did you forget to set the interaction radius?");
+
       //skip all ghost particles
       if (data::particle_flags::isSet( pIt->getFlags(), data::particle_flags::GHOST))
       {
diff --git a/src/mesa_pd/mpi/SyncNextNeighborsBlockForest.cpp b/src/mesa_pd/mpi/SyncNextNeighborsBlockForest.cpp
index f4adbf79f..a8528aa1a 100644
--- a/src/mesa_pd/mpi/SyncNextNeighborsBlockForest.cpp
+++ b/src/mesa_pd/mpi/SyncNextNeighborsBlockForest.cpp
@@ -111,6 +111,8 @@ void SyncNextNeighborsBlockForest::generateSynchronizationMessages(walberla::mpi
    // position update
    for( auto pIt = ps.begin(); pIt != ps.end(); )
    {
+      WALBERLA_ASSERT_GREATER(pIt->getInteractionRadius(), 0_r, "Did you forget to set the interaction radius?");
+
       //skip all ghost particles
       if (data::particle_flags::isSet( pIt->getFlags(), data::particle_flags::GHOST))
       {
diff --git a/tests/lbm_mesapd_coupling/mapping/ParticleMapping.cpp b/tests/lbm_mesapd_coupling/mapping/ParticleMapping.cpp
index ea60887f3..b2ecf7107 100644
--- a/tests/lbm_mesapd_coupling/mapping/ParticleMapping.cpp
+++ b/tests/lbm_mesapd_coupling/mapping/ParticleMapping.cpp
@@ -769,6 +769,7 @@ int main( int argc, char **argv )
       {
          mesa_pd::data::Particle&& p = *ps->create(true);
          p.setPosition(halfSpacePosition);
+         p.setInteractionRadius(std::numeric_limits<real_t>::infinity());
          p.setOwner(mpi::MPIManager::instance()->rank());
          p.setShapeID(halfSpaceShape);
          mesa_pd::data::particle_flags::set(p.getFlagsRef(), mesa_pd::data::particle_flags::INFINITE);
diff --git a/tests/lbm_mesapd_coupling/momentum_exchange_method/SettlingSphere.cpp b/tests/lbm_mesapd_coupling/momentum_exchange_method/SettlingSphere.cpp
index 2cc78a22f..202601669 100644
--- a/tests/lbm_mesapd_coupling/momentum_exchange_method/SettlingSphere.cpp
+++ b/tests/lbm_mesapd_coupling/momentum_exchange_method/SettlingSphere.cpp
@@ -281,6 +281,7 @@ void createPlaneSetup(const shared_ptr<mesa_pd::data::ParticleStorage> & ps, con
    // create bounding planes
    mesa_pd::data::Particle p0 = *ps->create(true);
    p0.setPosition(simulationDomain.minCorner());
+   p0.setInteractionRadius(std::numeric_limits<real_t>::infinity());
    p0.setShapeID(ss->create<mesa_pd::data::HalfSpace>( Vector3<real_t>(0,0,1) ));
    p0.setOwner(mpi::MPIManager::instance()->rank());
    p0.setType(0);
@@ -289,6 +290,7 @@ void createPlaneSetup(const shared_ptr<mesa_pd::data::ParticleStorage> & ps, con
 
    mesa_pd::data::Particle p1 = *ps->create(true);
    p1.setPosition(simulationDomain.maxCorner());
+   p1.setInteractionRadius(std::numeric_limits<real_t>::infinity());
    p1.setShapeID(ss->create<mesa_pd::data::HalfSpace>( Vector3<real_t>(0,0,-1) ));
    p1.setOwner(mpi::MPIManager::instance()->rank());
    p1.setType(0);
@@ -297,6 +299,7 @@ void createPlaneSetup(const shared_ptr<mesa_pd::data::ParticleStorage> & ps, con
 
    mesa_pd::data::Particle p2 = *ps->create(true);
    p2.setPosition(simulationDomain.minCorner());
+   p2.setInteractionRadius(std::numeric_limits<real_t>::infinity());
    p2.setShapeID(ss->create<mesa_pd::data::HalfSpace>( Vector3<real_t>(1,0,0) ));
    p2.setOwner(mpi::MPIManager::instance()->rank());
    p2.setType(0);
@@ -305,6 +308,7 @@ void createPlaneSetup(const shared_ptr<mesa_pd::data::ParticleStorage> & ps, con
 
    mesa_pd::data::Particle p3 = *ps->create(true);
    p3.setPosition(simulationDomain.maxCorner());
+   p3.setInteractionRadius(std::numeric_limits<real_t>::infinity());
    p3.setShapeID(ss->create<mesa_pd::data::HalfSpace>( Vector3<real_t>(-1,0,0) ));
    p3.setOwner(mpi::MPIManager::instance()->rank());
    p3.setType(0);
@@ -313,6 +317,7 @@ void createPlaneSetup(const shared_ptr<mesa_pd::data::ParticleStorage> & ps, con
 
    mesa_pd::data::Particle p4 = *ps->create(true);
    p4.setPosition(simulationDomain.minCorner());
+   p4.setInteractionRadius(std::numeric_limits<real_t>::infinity());
    p4.setShapeID(ss->create<mesa_pd::data::HalfSpace>( Vector3<real_t>(0,1,0) ));
    p4.setOwner(mpi::MPIManager::instance()->rank());
    p4.setType(0);
@@ -321,6 +326,7 @@ void createPlaneSetup(const shared_ptr<mesa_pd::data::ParticleStorage> & ps, con
 
    mesa_pd::data::Particle p5 = *ps->create(true);
    p5.setPosition(simulationDomain.maxCorner());
+   p5.setInteractionRadius(std::numeric_limits<real_t>::infinity());
    p5.setShapeID(ss->create<mesa_pd::data::HalfSpace>( Vector3<real_t>(0,-1,0) ));
    p5.setOwner(mpi::MPIManager::instance()->rank());
    p5.setType(0);
diff --git a/tests/lbm_mesapd_coupling/utility/LubricationCorrection.cpp b/tests/lbm_mesapd_coupling/utility/LubricationCorrection.cpp
index bef4e3e46..b96ab7fb0 100644
--- a/tests/lbm_mesapd_coupling/utility/LubricationCorrection.cpp
+++ b/tests/lbm_mesapd_coupling/utility/LubricationCorrection.cpp
@@ -147,24 +147,28 @@ int main( int argc, char **argv )
 
       mesa_pd::data::Particle&& p1 = *ps->create();
       p1.setPosition(position1);
+      p1.setInteractionRadius(sphereRadius);
       p1.setShapeID(sphereShape);
       p1.setLinearVelocity(Vector3<real_t>(relativeVelocity,-relativeVelocity,real_t(0.5)*relativeVelocity));
       auto idxSph1 = p1.getIdx();
 
       mesa_pd::data::Particle&& p2 = *ps->create();
       p2.setPosition(position2);
+      p2.setInteractionRadius(sphereRadius);
       p2.setShapeID(sphereShape);
       p2.setLinearVelocity(Vector3<real_t>(real_t(0),real_t(2),real_t(0)));
       auto idxSph2 = p2.getIdx();
 
       mesa_pd::data::Particle&& p3 = *ps->create();
       p3.setPosition(position3);
+      p3.setInteractionRadius(sphereRadius);
       p3.setShapeID(sphereShape);
       p3.setLinearVelocity(Vector3<real_t>(real_t(2),real_t(0),real_t(2)));
       auto idxSph3 = p3.getIdx();
 
       mesa_pd::data::Particle&& p4 = *ps->create();
       p4.setPosition(position4);
+      p4.setInteractionRadius(sphereRadius);
       p4.setShapeID(sphereShape);
       p4.setLinearVelocity(Vector3<real_t>(real_t(0),real_t(0),real_t(-0.5)*relativeVelocity));
       auto idxSph4 = p4.getIdx();
@@ -228,24 +232,28 @@ int main( int argc, char **argv )
 
       mesa_pd::data::Particle&& p1 = *ps->create();
       p1.setPosition(position1);
+      p1.setInteractionRadius(sphereRadius);
       p1.setShapeID(sphereShape);
       p1.setLinearVelocity(Vector3<real_t>(relativeVelocity,-relativeVelocity,real_t(0.5)*relativeVelocity));
       auto idxSph1 = p1.getIdx();
 
       mesa_pd::data::Particle&& p2 = *ps->create();
       p2.setPosition(position2);
+      p2.setInteractionRadius(sphereRadius);
       p2.setShapeID(sphereShape);
       p2.setLinearVelocity(Vector3<real_t>(real_t(0),real_t(2),real_t(0)));
       auto idxSph2 = p2.getIdx();
 
       mesa_pd::data::Particle&& p3 = *ps->create();
       p3.setPosition(position3);
+      p3.setInteractionRadius(sphereRadius);
       p3.setShapeID(sphereShape);
       p3.setLinearVelocity(Vector3<real_t>(real_t(2),real_t(0),real_t(2)));
       auto idxSph3 = p3.getIdx();
 
       mesa_pd::data::Particle&& p4 = *ps->create();
       p4.setPosition(position4);
+      p4.setInteractionRadius(sphereRadius);
       p4.setShapeID(sphereShape);
       p4.setLinearVelocity(Vector3<real_t>(real_t(0),real_t(0),real_t(-0.5)*relativeVelocity));
       auto idxSph4 = p4.getIdx();
@@ -328,6 +336,7 @@ int main( int argc, char **argv )
 
       mesa_pd::data::Particle&& p1 = *ps->create();
       p1.setPosition(position1);
+      p1.setInteractionRadius(sphereRadius);
       p1.setShapeID(sphereShape);
       p1.setLinearVelocity(Vector3<real_t>(real_t(0),real_t(0),relativeVelocity));
       auto idxSph1 = p1.getIdx();
@@ -335,29 +344,34 @@ int main( int argc, char **argv )
       // mix up order to test Sph - HSp and HSp - Sph variants
       mesa_pd::data::Particle&& pW = *ps->create(true);
       pW.setPosition(wallPosition);
+      pW.setInteractionRadius(std::numeric_limits<real_t>::infinity());
       pW.setShapeID(planeShape);
       auto idxWall = pW.getIdx();
 
       mesa_pd::data::Particle&& p2 = *ps->create();
       p2.setPosition(position2);
+      p2.setInteractionRadius(sphereRadius);
       p2.setShapeID(sphereShape);
       p2.setLinearVelocity(Vector3<real_t>(real_t(0),real_t(0),-relativeVelocity));
       auto idxSph2 = p2.getIdx();
 
       mesa_pd::data::Particle&& p3 = *ps->create();
       p3.setPosition(position3);
+      p3.setInteractionRadius(sphereRadius);
       p3.setShapeID(sphereShape);
       p3.setLinearVelocity(Vector3<real_t>(real_t(0),real_t(0),relativeVelocity));
       auto idxSph3 = p3.getIdx();
 
       mesa_pd::data::Particle&& p4 = *ps->create();
       p4.setPosition(position4);
+      p4.setInteractionRadius(sphereRadius);
       p4.setShapeID(sphereShape);
       p4.setLinearVelocity(Vector3<real_t>(real_t(0),real_t(0),relativeVelocity));
       auto idxSph4 = p4.getIdx();
 
       mesa_pd::data::Particle&& p5 = *ps->create();
       p5.setPosition(position5);
+      p5.setInteractionRadius(sphereRadius);
       p5.setShapeID(sphereShape);
       p5.setLinearVelocity(Vector3<real_t>(real_t(0),real_t(0),relativeVelocity));
       auto idxSph5 = p5.getIdx();
diff --git a/tests/mesa_pd/ContactDetection.cpp b/tests/mesa_pd/ContactDetection.cpp
index 41e62d75f..56cb7fd81 100644
--- a/tests/mesa_pd/ContactDetection.cpp
+++ b/tests/mesa_pd/ContactDetection.cpp
@@ -80,7 +80,7 @@ int main( const int particlesPerAxis = 2, const real_t radius = real_t(0.9) )
 
    math::seedRandomGenerator( static_cast<unsigned int>(1337 * walberla::mpi::MPIManager::instance()->worldRank()) );
 
-   const real_t spacing(1.0);
+   const real_t spacing = 2.1_r * radius;
 
    WALBERLA_LOG_INFO_ON_ROOT("*** BLOCKFOREST ***");
    const int centerParticles  = particlesPerAxis * particlesPerAxis * particlesPerAxis;
diff --git a/tests/mesa_pd/kernel/GenerateAnalyticContacts.cpp b/tests/mesa_pd/kernel/GenerateAnalyticContacts.cpp
index 4762aed06..fcd2b82c8 100644
--- a/tests/mesa_pd/kernel/GenerateAnalyticContacts.cpp
+++ b/tests/mesa_pd/kernel/GenerateAnalyticContacts.cpp
@@ -79,7 +79,7 @@ int main( int argc, char ** argv )
    auto ps = std::make_shared<data::ParticleStorage>(100);
    auto ss = std::make_shared<data::ShapeStorage>();
    ParticleAccessorWithShape accessor(ps, ss);
-   data::LinkedCells      lc(math::AABB(-1,-1,-1,4,4,4), real_t(1));
+   data::LinkedCells      lc(math::AABB(-1,-1,-1,4,4,4), real_t(1.3));
 
    //initialize particles
    const real_t radius  = real_t(0.6);
diff --git a/tests/mesa_pd/kernel/GenerateLinkedCells.cpp b/tests/mesa_pd/kernel/GenerateLinkedCells.cpp
index 3ee5183cf..2aaf342ae 100644
--- a/tests/mesa_pd/kernel/GenerateLinkedCells.cpp
+++ b/tests/mesa_pd/kernel/GenerateLinkedCells.cpp
@@ -66,6 +66,7 @@ int main( int argc, char ** argv )
    {
       data::Particle&& p    = *storage->create();
       p.getPositionRef()    = (*it);
+      p.setInteractionRadius(0.1_r);
       p.setShapeID(smallSphere);
    }
 
diff --git a/tests/mesa_pd/kernel/LinkedCellsVsBruteForce.cpp b/tests/mesa_pd/kernel/LinkedCellsVsBruteForce.cpp
index c52e39327..8743d6ac3 100644
--- a/tests/mesa_pd/kernel/LinkedCellsVsBruteForce.cpp
+++ b/tests/mesa_pd/kernel/LinkedCellsVsBruteForce.cpp
@@ -100,7 +100,7 @@ int main( int argc, char ** argv )
    //init data structures
    auto ps = std::make_shared<data::ParticleStorage>(100);
    auto ss = std::make_shared<data::ShapeStorage>();
-   data::LinkedCells     lc(blk.getAABB(), real_t(1));
+   data::LinkedCells     lc(blk.getAABB(), real_t(1.1));
    std::vector<collision_detection::AnalyticContactDetection> cs1(100);
    std::vector<collision_detection::AnalyticContactDetection> cs2(100);
 
-- 
GitLab