Skip to content

Commit

Permalink
Fix regression in CPU LB thermalization.
Browse files Browse the repository at this point in the history
  • Loading branch information
pkreissl committed Aug 3, 2020
1 parent d2f437b commit 07f633e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/core/grid_based_algorithms/lb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,7 @@ lb_thermalize_modes(Lattice::index_t index, const std::array<T, 19> &modes,
rng_type{}(c, {{static_cast<uint64_t>(index), 2ul}}),
rng_type{}(c, {{static_cast<uint64_t>(index), 3ul}})};

auto rng = [&](int i) { return uniform(noise[i / 4][i % 4]); };
auto rng = [&](int i) { return uniform(noise[i / 4][i % 4]) - 0.5; };

return {/* conserved modes */
{modes[0], modes[1], modes[2], modes[3],
Expand Down
18 changes: 9 additions & 9 deletions testsuite/python/lb_pressure_tensor_acf.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def test(self):
lb = self.lb_class(agrid=AGRID, dens=DENS, visc=VISC,
tau=TAU, kT=KT, seed=SEED)
system.actors.add(lb)
system.thermostat.set_lb(LB_fluid=lb, seed=2)
system.thermostat.set_lb(LB_fluid=lb, seed=SEED + 1)

# Warmup
system.integrator.run(500)
Expand All @@ -78,7 +78,7 @@ def test(self):
for i in range(3):
for j in range(i + 1, 3):
avg_ij = np.average(p_node[:, i, j])
avg_ji = np.average(p_node[:, i, j])
avg_ji = np.average(p_node[:, j, i])
self.assertEqual(avg_ij, avg_ji)

self.assertLess(avg_ij, tol_node)
Expand All @@ -87,7 +87,7 @@ def test(self):
for i in range(3):
for j in range(i + 1, 3):
avg_ij = np.average(p_global[:, i, j])
avg_ji = np.average(p_global[:, i, j])
avg_ji = np.average(p_global[:, j, i])
self.assertEqual(avg_ij, avg_ji)

self.assertLess(avg_ij, tol_global)
Expand Down Expand Up @@ -126,13 +126,13 @@ def f(x, a, b): return a * np.exp(-b * x)
self.assertAlmostEqual(np.average(all_viscs),
VISC * DENS, delta=VISC * DENS * .07)


# DISABLE CPU TEST UNTIL #3804 IS SOLVED
# class TestLBPressureACFCPU(TestLBPressureACF, ut.TestCase):
#
# def setUp(self):
# self.lb_class = espressomd.lb.LBFluid
#
#
class TestLBPressureACFCPU(TestLBPressureACF, ut.TestCase):

def setUp(self):
self.lb_class = espressomd.lb.LBFluid



@utx.skipIfMissingGPU()
Expand Down

0 comments on commit 07f633e

Please sign in to comment.