tdynamically update what grains are moving at fixed velocity - Granular.jl - Julia package for granular dynamics simulation
 (HTM) git clone git://src.adamsgaard.dk/Granular.jl
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 12955ead91015506572472d8c6db8a3379707a6c
 (DIR) parent 9d7b77cc31093b7d6c8c87a496b6afa35cb35101
 (HTM) Author: Anders Damsgaard <andersd@riseup.net>
       Date:   Thu, 16 Nov 2017 09:37:30 -0800
       
       dynamically update what grains are moving at fixed velocity
       
       Diffstat:
         M examples/shear.jl                   |      26 +++++++++++---------------
       
       1 file changed, 11 insertions(+), 15 deletions(-)
       ---
 (DIR) diff --git a/examples/shear.jl b/examples/shear.jl
       t@@ -199,21 +199,6 @@ sim.id = "$(id_prefix)-shear-N$(N)Pa-vel_shear$(vel_shear)m-s"
        # Set all linear and rotational velocities to zero
        Granular.zeroKinematics!(sim)
        
       -# Prescribe the shear velocity to the uppermost grains
       -for grain in sim.grains
       -    if grain.lin_pos[2] >= sim.walls[1].pos - fixed_thickness
       -
       -        # do not allow changes in velocity
       -        grain.fixed = true
       -        
       -        # allow free up/down movement to permit dilation, which partially
       -        # overrides the `fixed` flag
       -        grain.allow_y_acc = true
       -
       -        grain.lin_vel[1] = vel_shear
       -    end
       -end
       -
        # Set current time to zero and reset output file counter
        Granular.resetTime!(sim)
        
       t@@ -240,6 +225,17 @@ const surface_area = (x_max - x_min)
        shear_force = 0.
        while sim.time < sim.time_total
        
       +    # Prescribe the shear velocity to the uppermost grains
       +    for grain in sim.grains
       +        if grain.lin_pos[2] >= sim.walls[1].pos - fixed_thickness
       +            grain.fixed = true
       +            grain.allow_y_acc = true
       +            grain.lin_vel[1] = vel_shear
       +        else
       +            grain.fixed = false
       +        end
       +    end
       +
            for i=1:100  # run for 100 steps before measuring shear stress and dilation
                Granular.run!(sim, single_step=true)
            end