Skip to content

Commit 7ec4ab4

Browse files
committed
Merge branch '4825' into le_merge
2 parents 36a2604 + f418147 commit 7ec4ab4

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/core/lb/particle_coupling.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,11 +277,12 @@ void ParticleCoupling::kernel(Particle &p) {
277277

278278
// Calculate coupling force
279279
Utils::Vector3d force_on_particle = {};
280+
auto folded_pos = box_geo.folded_position(p.pos());
280281

281282
#ifdef ENGINE
282283
if (not p.swimming().is_engine_force_on_fluid)
283284
#endif
284-
for (auto pos : positions_in_halo(p.pos(), box_geo, agrid)) {
285+
for (auto pos : positions_in_halo(folded_pos, box_geo, agrid)) {
285286
if (in_local_halo(pos, agrid)) {
286287
auto const vel_offset = lb_drift_velocity_offset(p) +
287288
lees_edwards_vel_shift(pos, p.pos(), box_geo);
@@ -301,7 +302,7 @@ void ParticleCoupling::kernel(Particle &p) {
301302

302303
// couple positions including shifts by one box length to add
303304
// forces to ghost layers
304-
for (auto pos : positions_in_halo(p.pos(), box_geo, agrid)) {
305+
for (auto pos : positions_in_halo(folded_pos, box_geo, agrid)) {
305306
if (in_local_domain(pos)) {
306307
/* Particle is in our LB volume, so this node
307308
* is responsible to adding its force */

testsuite/python/lb.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,16 @@ def test_viscous_coupling_pairs(self):
566566
np.testing.assert_allclose(
567567
np.sum(applied_forces, axis=0), [0, 0, 0])
568568

569+
def test_viscous_coupling_rounding(self):
570+
lbf = self.lb_class(**self.params, **self.lb_params)
571+
self.system.lb = lbf
572+
self.system.thermostat.set_lb(LB_fluid=lbf, seed=3, gamma=self.gamma)
573+
p = self.system.part.add(pos=[-1E-30] * 3, v=[-1, 0, 0])
574+
self.system.integrator.run(1)
575+
for _ in range(20):
576+
self.system.integrator.run(1)
577+
self.assertTrue(np.all(p.f != 0.0))
578+
569579
def test_thermalization_force_balance(self):
570580
system = self.system
571581

0 commit comments

Comments
 (0)