Skip to content

Commit

Permalink
Testsuite: Backport faster lb stokes sphere test from #2392
Browse files Browse the repository at this point in the history
  • Loading branch information
RudolfWeeber committed Jan 16, 2019
1 parent 7be0665 commit 1fb3c44
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions testsuite/python/lb_stokes_sphere.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@
'tau': TIME_STEP}
# System setup
radius = 5.4
box_width = 44
box_width = 36
real_width = box_width + 2 * AGRID
box_length = 50
box_length = 36
v = [0, 0, 0.01] # The boundary slip


Expand All @@ -61,8 +61,6 @@ def test_stokes(self):
self.system.actors.clear()
self.system.lbboundaries.clear()
self.system.actors.add(self.lbf)
# The temperature is zero.
self.system.thermostat.set_lb(kT=0)

# Setup walls
walls = [None] * 4
Expand Down Expand Up @@ -102,19 +100,21 @@ def size(vector):
tmp += k * k
return np.sqrt(tmp)

self.system.integrator.run(800)
self.system.integrator.run(200)

stokes_force = 6 * np.pi * KVISC * radius * size(v)
print("Stokes' Law says: f=%f" % stokes_force)

# get force that is exerted on the sphere
for i in range(4):
self.system.integrator.run(200)
force = sphere.get_force()
print("Measured force: f=%f" % size(force))
self.assertLess(abs(1.0 - size(force) / stokes_force), 0.06)

##Invoke the GPU LB
force = sphere.get_force()
np.testing.assert_allclose(
force,
[0,
0,
stokes_force],
rtol=0.06,
atol=stokes_force * 0.06)
self.system.integrator.run(300)
np.testing.assert_allclose(sphere.get_force(), force, atol=0.02)


@ut.skipIf(not espressomd.has_features(
Expand All @@ -124,8 +124,6 @@ class LBGPUStokes(ut.TestCase, Stokes):
def setUp(self):
self.lbf = espressomd.lb.LBFluidGPU(**LB_PARAMS)

#Invoke the CPU LB


@ut.skipIf(not espressomd.has_features(
['LB', 'LB_BOUNDARIES', 'EXTERNAL_FORCES']), "Skipping test due to missing features.")
Expand Down

0 comments on commit 1fb3c44

Please sign in to comment.