             {
                 I_speeds = I + mw*zs;
                 speeds[I_speeds] = s[mw];
+                if(fabs(s[mw])*dtdx>max_speed){
+                    max_speed=fabs(s[mw])*dtdx;
+                }
             } 
 
 

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

#if 0        

                                double* waves, double *speeds,
                                cudaclaw_cuda_rpn2_t rpn2)
{
    typedef cub::BlockReduce<int,128> BlockReduce;
    __shared__ typename BlockReduce::TempStorage temp_storage;
    int mq, mw, m;
    int xs, ys, zs;
    int I, I_q, I_aux, I_waves, I_speeds;
