         }
     }
 
+    int result = BlockReduce(temp_storage).Reduce(max_speed,cub::Max());
     __syncthreads();
     for(int thread_index = threadIdx.x; thread_index<mx*my; thread_index+=blockDim.x){
 

            {
                I_speeds = I + mw*zs;
                speeds[I_speeds] = s[mw];
            } 



    ys = (2*mbc + mx)*xs;
    zs = (2*mbc + my)*xs*ys;

    double max_speed = 0;

    for(int thread_index = threadIdx.x; thread_index<num_ifaces; thread_index+=blockDim.x)
    {

