Skip to content

Commit

Permalink
Make lb_pressure_tensor_acf test faster.
Browse files Browse the repository at this point in the history
  • Loading branch information
pkreissl committed Aug 3, 2020
1 parent ad9a70f commit f722423
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions testsuite/python/lb_pressure_tensor_acf.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,19 @@ def test(self):
system.integrator.run(500)

# sampling
steps = 50000
p_global = np.zeros((steps, 3, 3))
p_node = np.zeros((steps, 3, 3))
p_global = np.zeros((self.steps, 3, 3))
p_node = np.zeros((self.steps, 3, 3))

node = lb[0, 0, 0]

for i in range(steps):
for i in range(self.steps):
p_node[i] = node.pressure_tensor
p_global[i] = lb.pressure_tensor

system.integrator.run(2)

# Test that <sigma_[i!=j]> ~=0 and sigma_[ij]=sigma_[ji]
tol_global = 4 / np.sqrt(steps)
tol_global = 4 / np.sqrt(self.steps)
tol_node = tol_global * np.sqrt(N_CELLS**3)

# check single node
Expand Down Expand Up @@ -101,7 +100,7 @@ def test(self):
# Calculate acf
tmp = np.correlate(
p_global[:, i, j], p_global[:, i, j], mode="full")
acf = tmp[len(tmp) // 2:] / steps
acf = tmp[len(tmp) // 2:] / self.steps

# integrate first part numerically, fit exponential to tail
t_max_fit = 50 * TAU
Expand Down Expand Up @@ -132,13 +131,15 @@ class TestLBPressureACFCPU(TestLBPressureACF, ut.TestCase):

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


@utx.skipIfMissingGPU()
class TestLBPressureACFGPU(TestLBPressureACF, ut.TestCase):

def setUp(self):
self.lb_class = espressomd.lb.LBFluidGPU
self.steps = 15000


if __name__ == "__main__":
Expand Down

0 comments on commit f722423

Please sign in to comment.