Skip to content

Commit

Permalink
Test LB profile observables in parallel (#4583)
Browse files Browse the repository at this point in the history
Fixes #4582, fixes #4581, fixes #4584

Description of changes:
- check that LB profile observables work in parallel
- remove outdated warning in the user guide that mentioned they could not run in parallel
- fix regression in the LB sedimentation tutorial
  • Loading branch information
kodiakhq[bot] authored Oct 4, 2022
2 parents dc51330 + 6e5a1f5 commit 466a27e
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@
"import espressomd.observables\n",
"import espressomd.accumulators\n",
"\n",
"espressomd.assert_features([\"LENNARD_JONES\", \"LB_BOUNDARIES\"])\n",
"\n",
"# imports for data handling, plotting, and progress bar\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
Expand Down
4 changes: 0 additions & 4 deletions src/python/espressomd/observables.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,10 +267,6 @@ class LBVelocityProfile(ProfileObservable):
``sampling_*``. Note that a small delta leads to a large number of sample
points and carries a performance cost.
.. WARNING::
In case of the CPU version of the LB fluid implementation, this observable
currently only works for a single core.
Parameters
----------
n_x_bins : :obj:`int`
Expand Down
4 changes: 2 additions & 2 deletions testsuite/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ python_test(FILE polymer_linear.py MAX_NUM_PROC 4)
python_test(FILE polymer_diamond.py MAX_NUM_PROC 4)
python_test(FILE auto_exclusions.py MAX_NUM_PROC 1)
python_test(FILE observable_cylindrical.py MAX_NUM_PROC 4)
python_test(FILE observable_cylindricalLB.py MAX_NUM_PROC 1 LABELS gpu)
python_test(FILE observable_cylindricalLB.py MAX_NUM_PROC 2 LABELS gpu)
python_test(FILE analyze_chains.py MAX_NUM_PROC 1)
python_test(FILE analyze_distance.py MAX_NUM_PROC 1)
python_test(FILE analyze_acf.py MAX_NUM_PROC 1)
Expand All @@ -247,7 +247,7 @@ python_test(FILE rescale.py MAX_NUM_PROC 2)
python_test(FILE array_properties.py MAX_NUM_PROC 4)
python_test(FILE analyze_distribution.py MAX_NUM_PROC 1)
python_test(FILE observable_profile.py MAX_NUM_PROC 4)
python_test(FILE observable_profileLB.py MAX_NUM_PROC 1 LABELS gpu)
python_test(FILE observable_profileLB.py MAX_NUM_PROC 2 LABELS gpu)
python_test(FILE rotate_system.py MAX_NUM_PROC 4)
python_test(FILE es_math.py MAX_NUM_PROC 1)
python_test(FILE random_pairs.py MAX_NUM_PROC 4)
Expand Down
2 changes: 1 addition & 1 deletion testsuite/python/observable_cylindricalLB.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class CylindricalLBObservableCommon:
Testcase for the CylindricalLBObservables.
"""
system = espressomd.System(box_l=3 * [15])
system = espressomd.System(box_l=3 * [14])
system.time_step = 0.01
system.cell_system.skin = 0.4

Expand Down
14 changes: 7 additions & 7 deletions testsuite/python/observable_profileLB.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@

TIME_STEP = 0.1
AGRID = 0.7
BOX_L_X = 17.0 * AGRID
BOX_L_Y = 15.0 * AGRID
BOX_L_Z = 13.0 * AGRID
BOX_L_X = 16.0 * AGRID
BOX_L_Y = 14.0 * AGRID
BOX_L_Z = 12.0 * AGRID
VISC = .7
DENS = 1.7
LB_PARAMS = {'agrid': AGRID,
Expand Down Expand Up @@ -78,9 +78,9 @@ def tearDown(self):

def set_fluid_velocities(self):
"""Set an x dependent fluid velocity."""
for x in range(int(self.system.box_l[0] / AGRID)):
for y in range(int(self.system.box_l[1] / AGRID)):
for z in range(int(self.system.box_l[2] / AGRID)):
for x in range(int(np.around(self.system.box_l[0] / AGRID))):
for y in range(int(np.around(self.system.box_l[1] / AGRID))):
for z in range(int(np.around(self.system.box_l[2] / AGRID))):
self.lbf[x, y, z].velocity = [float(x), 0.0, 0.0]

def test_velocity_profile(self):
Expand All @@ -98,7 +98,7 @@ def test_velocity_profile(self):
for y in range(obs_data.shape[1]):
for z in range(obs_data.shape[2]):
self.assertAlmostEqual(
obs_data[x, y, z, 0], float(x), places=5)
obs_data[x, y, z, 0], float(x), delta=2e-5)
self.assertEqual(np.prod(obs_data.shape),
LB_VELOCITY_PROFILE_PARAMS['n_x_bins'] *
LB_VELOCITY_PROFILE_PARAMS['n_y_bins'] *
Expand Down

0 comments on commit 466a27e

Please sign in to comment.