timprove shearStrain function - 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 9f8b77e89f90aa53dc6c0c2cfe65c417e62ef1a6
 (DIR) parent 4655081fc0453fd7a0e469a1b199e67687920dc4
 (HTM) Author: Anders Damsgaard <anders.damsgaard@geo.au.dk>
       Date:   Tue, 17 Feb 2015 14:24:06 +0100
       
       improve shearStrain function
       
       use current displacement of fixed particles instead of multiplying the current
       velocities
       
       Diffstat:
         M python/sphere.py                    |      21 +++++++++++++++++++--
       
       1 file changed, 19 insertions(+), 2 deletions(-)
       ---
 (DIR) diff --git a/python/sphere.py b/python/sphere.py
       t@@ -4210,7 +4210,9 @@ class sim:
                w_x0 = self.w_x[0]
        
                # Displacement of the upper, fixed particles in the shear direction
       -        xdisp = self.time_current[0] * self.shearVel()
       +        #xdisp = self.time_current[0] * self.shearVel()
       +        fixvel = numpy.nonzero(self.fixvel > 0.0)
       +        xdisp = numpy.max(self.xyzsum[fixvel,0])
        
                # Return shear strain
                return xdisp/w_x0
       t@@ -6088,6 +6090,7 @@ class sim:
                    tau = numpy.empty(sb.status())
                    N = numpy.empty(sb.status())
                    v = numpy.empty(sb.status())
       +            shearstrain = numpy.empty(sb.status())
                    for i in numpy.arange(sb.status()):
                        sb.readstep(i+1, verbose=False)
                        #tau = sb.shearStress()
       t@@ -6095,24 +6098,38 @@ class sim:
                        #tau[i] = sb.shearStress()[0] # measured shear stress along x
                        N[i] = sb.currentNormalStress() # defined normal stress
                        v[i] = sb.shearVel()
       +                shearstrain[i] = sb.shearStrain()
        
                    # remove nonzero sliding velocities and their associated values
                    idx = numpy.nonzero(v)
                    v_nonzero = v[idx]
                    tau_nonzero = tau[idx]
                    N_nonzero = N[idx]
       +            shearstrain_nonzero = shearstrain[idx]
        
                    ax1 = plt.subplot(111)
                    #ax1.semilogy(N/1000., v)
                    #ax1.semilogy(tau_nonzero/N_nonzero, v_nonzero, '+k')
                    #ax1.plot(tau/N, v, '.')
       -            ax1.scatter(tau_nonzero/N_nonzero, v_nonzero, c=idx)
       +            friction = tau_nonzero/N_nonzero
       +            CS = ax1.scatter(friction, v_nonzero, c=shearstrain_nonzero,
       +                    linewidth=0)
                    ax1.set_yscale('log')
       +            x_min = numpy.floor(numpy.min(friction))
       +            x_max = numpy.ceil(numpy.max(friction))
       +            ax1.set_xlim([x_min, x_max])
       +            y_min = numpy.min(v_nonzero)*0.5
       +            y_max = numpy.max(v_nonzero)*2.0
       +            ax1.set_ylim([y_min, y_max])
       +
       +            plt.colorbar(CS)
        
                    #ax1.set_xlabel('Effective normal stress [kPa]')
                    ax1.set_xlabel('Friction $\\tau/N$ [-]')
                    ax1.set_ylabel('Shear velocity [m/s]')
        
       +
       +
                    '''
                    ax2 = plt.subplot(212)
                    ax2.plot(tau/N, v, '.')