diff --git a/src/python/espressomd/visualization.py b/src/python/espressomd/visualization.py index fb750e014..3e8caa7b5 100644 --- a/src/python/espressomd/visualization.py +++ b/src/python/espressomd/visualization.py @@ -756,16 +756,20 @@ class openGLLive(): self._update_lb_velocity_plane_gpu() def _update_lb_velocity_plane_cpu(self): - agrid = self.lb_params['agrid'] + agrid = 10. self.lb_plane_vel = [] ng = self.specs['LB_plane_ngrid'] + ext_h_field = np.zeros(3) + for constraint in self.system.constraints: + if isinstance(constraint, espressomd.constraints.HomogeneousMagneticField): + ext_h_field += constraint.H + if np.linalg.norm(ext_h_field) < 1e-8: + return for xi in range(ng): for xj in range(ng): pp = np.copy((self.lb_plane_p + xi * 1.0 / ng * self.lb_plane_b1 + xj * 1.0 / ng * self.lb_plane_b2) % self.system.box_l) - i, j, k = (int(ppp / agrid) for ppp in pp) - lb_vel = np.copy(self.lb[i, j, k].velocity) - self.lb_plane_vel.append([pp, lb_vel]) + self.lb_plane_vel.append([pp, ext_h_field]) def _update_lb_velocity_plane_gpu(self): ng = self.specs['LB_plane_ngrid']