tfix velocity stepping - sphere - GPU-based 3D discrete element method algorithm with optional fluid coupling
 (HTM) git clone git://src.adamsgaard.dk/sphere
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) LICENSE
       ---
 (DIR) commit 8969c3ac331a2d47ba81c55ff62645143ea82995
 (DIR) parent c698b231f3331b4f61b1ac3b1c65d7738e890397
 (HTM) Author: Anders Damsgaard <anders.damsgaard@geo.au.dk>
       Date:   Mon,  4 Apr 2016 09:43:05 -0700
       
       fix velocity stepping
       
       Diffstat:
         M output/cube-init.status.dat         |       2 +-
         M src/device.cu                       |       9 +++++++--
       
       2 files changed, 8 insertions(+), 3 deletions(-)
       ---
 (DIR) diff --git a/output/cube-init.status.dat b/output/cube-init.status.dat
       t@@ -1 +1 @@
       -4.2000e+00 7.0000e+01 21
       +5.0000e+00 8.3333e+01 25
 (DIR) diff --git a/src/device.cu b/src/device.cu
       t@@ -943,6 +943,7 @@ __host__ void DEM::startTime()
            double t_ratio;     // ration between time flow in model vs. reality
        
            // Hard-coded parameters for stepwise velocity change
       +    int velocity_state = 1;  // 1: v1, 2: v2
            int change_velocity_state = 0;  // 1: increase velocity, 2: decrease vel.
            const Float velocity_factor = 1.1;  // v2 = v1*velocity_factor
            const Float v2_start = 5.0; // seconds
       t@@ -2346,10 +2347,14 @@ __host__ void DEM::startTime()
                    }
        
                    // Determine whether it is time to step the velocity
       -            if (time.current >= v2_start && time.current < v2_end)
       +            if (time.current >= v2_start && time.current < v2_end &&
       +                    velocity_state == 1) {
                        change_velocity_state = 1.0;
       -            else if (time.current >= 10.0)
       +                velocity_state = 2;
       +            } else if (time.current >= 10.0 && velocity_state == 2) {
                        change_velocity_state = -1.0;
       +                velocity_state = 1;
       +            }
        
                    // Update particle kinematics
                    if (PROFILING == 1)