You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the thermalized CPU LB with boundaries that create corners, unphysical currents occur. See below an example. With the CPU implementation, there are currents in y and z direction without any external forces or velocity boundary conditions. For the GPU implementation, this does not happen.
fromespressomdimportSystem, lb, lbboundaries, shapesimportmatplotlib.pyplotaspltimportnumpyasnpimpl='CPU'#'GPU'box_l= [40,15,40]
LB_params= {'agrid':1,
'tau':1,
'dens':1,
'visc':0.2,
'kT':1e-8,
'seed':41}
padding=4system=System(box_l=box_l)
system.cell_system.skin=1system.time_step=LB_params['tau']
ifimpl=='GPU':
lbf=lb.LBFluidGPU(**LB_params)
elifimpl=='CPU':
lbf=lb.LBFluid(**LB_params)
system.actors.add(lbf)
top_wall=shapes.Wall(dist=-(box_l[2]-padding), normal= [0,0,-1])
bottom_wall=shapes.Wall(dist=padding, normal= [0,0,1])
left_wall=shapes.Wall(dist=padding, normal= [1,0,0])
right_wall=shapes.Wall(dist=-(box_l[0]-padding), normal= [-1,0,0])
forwallin [top_wall,bottom_wall, left_wall,right_wall]:
noslip_wall=lbboundaries.LBBoundary(shape=wall)
system.lbboundaries.add(noslip_wall)
system.integrator.run(100)
#lbf.print_vtk_velocity(f'./velocity_{impl}.vtk') probe_xs=np.linspace(0,box_l[0],num=40)
vels_over_time= []
n_samples=100for_inrange(n_samples):
probe_vels=np.array([lbf.get_interpolated_velocity([x,0,box_l[2]/2.]) forxinprobe_xs])
vels_over_time.append(np.mean(probe_vels,axis=0))
system.integrator.run(10)
vels_over_time=np.array(vels_over_time)
mean_vel=np.mean(vels_over_time, axis=0)
std_vel=np.std(vels_over_time, axis=0)
SEM_vel=std_vel/np.sqrt(n_samples)
print(f'velocity = {mean_vel} +- {SEM_vel}')
print(np.all(np.abs(mean_vel)<std_vel))
#I know we should compare to the standard error of the mean (divide by sqrt(n_samples)) but that takes forever to produce True on GPU. #fig = plt.figure()#for direction in [0,1,2]:#plt.plot(probe_xs, probe_vels[:,direction], label = f'v_{direction}')#plt.xlabel('x')#plt.legend()#plt.show()
The text was updated successfully, but these errors were encountered:
Fixes#3804 , fixes#3772
The issue was actually a regression that happened with the switch to philox in commit
[f3cc4ba](f3cc4ba). Random numbers formerly part of the interval (-0.5,0.5] were replaced by random numers in (0,1].
With this fix the `lb_pressure_tensor_acf.py` runs successfully for both CPU and GPU. However, as @KaiSzuttor correctly mentioned in PR #3831 the CPU part of the test takes a while to execute (on my machine, single core the whole test takes 136 s). I could try to make that faster which, however, would require tweaking the tolerance limits `tol_node` and `tol_global`. @RudolfWeeber , what was your reasoning behind the chosen limits? Or are they semi-arbitrary choices?
Further, this PR corrects the comparison of the off-diagonal elements `avg_ij` vs. `avg_ji` in the test.
jngrad
pushed a commit
to jngrad/espresso
that referenced
this issue
Oct 13, 2020
Fixesespressomd#3804 , fixesespressomd#3772
The issue was actually a regression that happened with the switch to philox in commit
[f3cc4ba](espressomd@f3cc4ba). Random numbers formerly part of the interval (-0.5,0.5] were replaced by random numers in (0,1].
With this fix the `lb_pressure_tensor_acf.py` runs successfully for both CPU and GPU. However, as @KaiSzuttor correctly mentioned in PR espressomd#3831 the CPU part of the test takes a while to execute (on my machine, single core the whole test takes 136 s). I could try to make that faster which, however, would require tweaking the tolerance limits `tol_node` and `tol_global`. @RudolfWeeber , what was your reasoning behind the chosen limits? Or are they semi-arbitrary choices?
Further, this PR corrects the comparison of the off-diagonal elements `avg_ij` vs. `avg_ji` in the test.
When using the thermalized CPU LB with boundaries that create corners, unphysical currents occur. See below an example. With the CPU implementation, there are currents in y and z direction without any external forces or velocity boundary conditions. For the GPU implementation, this does not happen.
The text was updated successfully, but these errors were encountered: