     if (current_node < device_settings.num_mpm_nodes) {
         float mass = node_mass[current_node];  //
         if (mass > 0) {
-            rhs[current_node * 3 + 0] = mass * grid_vel[current_node * 3 + 0];  //
-            rhs[current_node * 3 + 1] = mass * grid_vel[current_node * 3 + 1];  //
-            rhs[current_node * 3 + 2] = mass * grid_vel[current_node * 3 + 2];  //
+            rhs[current_node + device_settings.num_mpm_nodes * 0] =
+                mass * grid_vel[current_node + device_settings.num_mpm_nodes * 0];  //
+            rhs[current_node + device_settings.num_mpm_nodes * 1] =
+                mass * grid_vel[current_node + device_settings.num_mpm_nodes * 1];  //
+            rhs[current_node + device_settings.num_mpm_nodes * 2] =
+                mass * grid_vel[current_node + device_settings.num_mpm_nodes * 2];  //
         } else {
-            rhs[current_node * 3 + 0] = 0;
-            rhs[current_node * 3 + 1] = 0;
-            rhs[current_node * 3 + 2] = 0;
+            rhs[current_node + device_settings.num_mpm_nodes * 0] = 0;
+            rhs[current_node + device_settings.num_mpm_nodes * 1] = 0;
+            rhs[current_node + device_settings.num_mpm_nodes * 2] = 0;
         }
     }
 }

CUDA_GLOBAL void kIncrementVelocity(float* delta_v, float* old_vel_node_mpm, float* grid_vel) {
    const int i = blockIdx.x * blockDim.x + threadIdx.x;
    if (i < device_settings.num_mpm_nodes) {
        grid_vel[i * 3 + 0] += delta_v[i * 3 + 0] - old_vel_node_mpm[i * 3 + 0];
        grid_vel[i * 3 + 1] += delta_v[i * 3 + 1] - old_vel_node_mpm[i * 3 + 1];
        grid_vel[i * 3 + 2] += delta_v[i * 3 + 2] - old_vel_node_mpm[i * 3 + 2];
    }
}



            float mass = node_mass[current_node];  //
            if (mass > 0) {
                atomicAdd(&grid_vel[current_node + device_settings.num_mpm_nodes * 0], -fx / mass);  //
                atomicAdd(&grid_vel[current_node + device_settings.num_mpm_nodes * 1], -fy / mass);  //
                atomicAdd(&grid_vel[current_node + device_settings.num_mpm_nodes * 2], -fz / mass);  //
            })
    }
}
