Skip to content

Commit

Permalink
Merge branch '4825' into le_merge
Browse files Browse the repository at this point in the history
  • Loading branch information
RudolfWeeber committed Nov 27, 2023
2 parents 36a2604 + f418147 commit 7ec4ab4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/core/lb/particle_coupling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,11 +277,12 @@ void ParticleCoupling::kernel(Particle &p) {

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

#ifdef ENGINE
if (not p.swimming().is_engine_force_on_fluid)
#endif
for (auto pos : positions_in_halo(p.pos(), box_geo, agrid)) {
for (auto pos : positions_in_halo(folded_pos, box_geo, agrid)) {
if (in_local_halo(pos, agrid)) {
auto const vel_offset = lb_drift_velocity_offset(p) +
lees_edwards_vel_shift(pos, p.pos(), box_geo);
Expand All @@ -301,7 +302,7 @@ void ParticleCoupling::kernel(Particle &p) {

// couple positions including shifts by one box length to add
// forces to ghost layers
for (auto pos : positions_in_halo(p.pos(), box_geo, agrid)) {
for (auto pos : positions_in_halo(folded_pos, box_geo, agrid)) {
if (in_local_domain(pos)) {
/* Particle is in our LB volume, so this node
* is responsible to adding its force */
Expand Down
10 changes: 10 additions & 0 deletions testsuite/python/lb.py
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,16 @@ def test_viscous_coupling_pairs(self):
np.testing.assert_allclose(
np.sum(applied_forces, axis=0), [0, 0, 0])

def test_viscous_coupling_rounding(self):
lbf = self.lb_class(**self.params, **self.lb_params)
self.system.lb = lbf
self.system.thermostat.set_lb(LB_fluid=lbf, seed=3, gamma=self.gamma)
p = self.system.part.add(pos=[-1E-30] * 3, v=[-1, 0, 0])
self.system.integrator.run(1)
for _ in range(20):
self.system.integrator.run(1)
self.assertTrue(np.all(p.f != 0.0))

def test_thermalization_force_balance(self):
system = self.system

Expand Down

0 comments on commit 7ec4ab4

Please sign in to comment.