timprove plots - 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 ebdb4c4ac6aa55ff50601a0df75884ccefee9b3a
 (DIR) parent 42b7039c127fbf0f3ac1938530e333d450284af2
 (HTM) Author: Anders Damsgaard <anders.damsgaard@geo.au.dk>
       Date:   Thu,  2 Oct 2014 19:54:09 +0200
       
       improve plots
       
       Diffstat:
         M python/shear-results-pressures.py   |       9 +++++----
         M python/shear-results.py             |      30 ++++++++++++++++++++++--------
       
       2 files changed, 27 insertions(+), 12 deletions(-)
       ---
 (DIR) diff --git a/python/shear-results-pressures.py b/python/shear-results-pressures.py
       t@@ -20,8 +20,9 @@ sigma0 = float(sys.argv[1])
        c_grad_p = float(sys.argv[2])
        c_phi = 1.0
        
       -sid = 'shear-sigma0=' + str(sigma0) + '-c_phi=' + \
       -                str(c_phi) + '-c_grad_p=' + str(c_grad_p) + '-hi_mu-lo_visc'
       +#sid = 'shear-sigma0=' + str(sigma0) + '-c_phi=' + \
       +#                str(c_phi) + '-c_grad_p=' + str(c_grad_p) + '-hi_mu-lo_visc'
       +sid = 'halfshear-sigma0=' + str(sigma0) + '-c=' + str(c_grad_p) + '-shear'
        sim = sphere.sim(sid, fluid=True)
        sim.readfirst(verbose=False)
        
       t@@ -74,8 +75,8 @@ ax1.set_xlim([0, shear_strain[-1]])
        ax1.set_ylim([zpos_c[0], sim.w_x[0]])
        ax1.set_xlabel('Shear strain $\\gamma$ [-]')
        ax1.set_ylabel('Vertical position $z$ [m]')
       -#cb1 = plt.colorbar(im1, boundaries=[min_p, numpy.abs(min_p)])
       -cb1 = plt.colorbar(cmap=cmap, norm=norm)
       +#cb1 = plt.colorbar()
       +cb1 = plt.colorbar(im1, cmap=cmap, norm=norm)
        cb1.set_label('Deviatoric pressure $p_\\text{f}$ [kPa]')
        cb1.solids.set_rasterized(True)
        
 (DIR) diff --git a/python/shear-results.py b/python/shear-results.py
       t@@ -16,9 +16,8 @@ import matplotlib.pyplot as plt
        #sigma0_list = numpy.array([1.0e3, 2.0e3, 4.0e3, 10.0e3, 20.0e3, 40.0e3])
        #sigma0 = 10.0e3
        sigma0 = float(sys.argv[1])
       -cvals = [1.0, 0.1]
       -#cvals = [1.0]
       -c_phi = 1.0
       +#cvals = [1.0, 0.1]
       +cvals = [1.0]
        
        shear_strain = [[], [], []]
        friction = [[], [], []]
       t@@ -32,7 +31,8 @@ f_n_max  = [[], [], []]
        fluid=True
        
        # dry shear
       -sid = 'shear-sigma0=' + sys.argv[1] + '-hw'
       +#sid = 'shear-sigma0=' + sys.argv[1] + '-hw'
       +sid = 'halfshear-sigma0=' + sys.argv[1] + '-shear'
        sim = sphere.sim(sid)
        sim.readlast(verbose=False)
        sim.visualize('shear')
       t@@ -41,14 +41,23 @@ shear_strain[0] = sim.shear_strain
        friction[0] = sim.tau/sim.sigma_eff
        dilation[0] = sim.dilation
        
       +f_n_mean[0] = numpy.zeros_like(shear_strain[0])
       +f_n_max[0]  = numpy.zeros_like(shear_strain[0])
       +for i in numpy.arange(sim.status()):
       +    sim.readstep(i, verbose=False)
       +    sim.findNormalForces()
       +    f_n_mean[0][i] = numpy.mean(sim.f_n_magn)
       +    f_n_max[0][i]  = numpy.max(sim.f_n_magn)
       +
        # wet shear
        c = 1
        for c in numpy.arange(1,len(cvals)+1):
            c_grad_p = cvals[c-1]
        
       -    sid = 'shear-sigma0=' + str(sigma0) + '-c_phi=' + \
       -                    str(c_phi) + '-c_grad_p=' + str(c_grad_p) + \
       -                    '-hi_mu-lo_visc-hw'
       +    #sid = 'shear-sigma0=' + str(sigma0) + '-c_phi=' + \
       +                    #str(c_phi) + '-c_grad_p=' + str(c_grad_p) + \
       +                    #'-hi_mu-lo_visc-hw'
       +    sid = 'halfshear-sigma0=' + str(sigma0) + '-c=' + str(c_grad_p) + '-shear'
            if os.path.isfile('../output/' + sid + '.status.dat'):
        
                sim = sphere.sim(sid, fluid=fluid)
       t@@ -93,6 +102,7 @@ for c in numpy.arange(1,len(cvals)+1):
        #fig = plt.figure(figsize=(8,8)) # (w,h)
        #fig = plt.figure(figsize=(8,12))
        fig = plt.figure(figsize=(8,16))
       +fig.subplots_adjust(hspace=0)
        
        #plt.subplot(3,1,1)
        #plt.ticklabel_format(style='sci', axis='y', scilimits=(0,0))
       t@@ -103,6 +113,8 @@ ax3 = plt.subplot(413, sharex=ax1)
        ax4 = plt.subplot(414, sharex=ax1)
        ax1.plot(shear_strain[0], friction[0], label='dry')
        ax2.plot(shear_strain[0], dilation[0], label='dry')
       +ax4.plot(shear_strain[0], f_n_mean[0], '-', label='dry')
       +ax4.plot(shear_strain[0], f_n_max[0], '--')
        
        color = ['b','g','r']
        for c in numpy.arange(1,len(cvals)+1):
       t@@ -128,7 +140,7 @@ for c in numpy.arange(1,len(cvals)+1):
            ax4.plot(shear_strain[c][1:], f_n_max[c][1:], '--' + color[c])
                    #label='$c$ = %.2f' % (cvals[c-1]), linewidth=2)
        
       -ax3.set_xlabel('Shear strain $\\gamma$ [-]')
       +ax4.set_xlabel('Shear strain $\\gamma$ [-]')
        
        ax1.set_ylabel('Shear friction $\\tau/\\sigma\'$ [-]')
        ax2.set_ylabel('Dilation $\\Delta h/(2r)$ [-]')
       t@@ -139,10 +151,12 @@ ax4.set_ylabel('Particle contact force $||\\boldsymbol{f}_\\text{p}||$ [N]')
        
        plt.setp(ax1.get_xticklabels(), visible=False)
        plt.setp(ax2.get_xticklabels(), visible=False)
       +plt.setp(ax3.get_xticklabels(), visible=False)
        
        ax1.grid()
        ax2.grid()
        ax3.grid()
       +ax4.grid()
        
        legend_alpha=0.5
        ax1.legend(loc='best', prop={'size':18}, fancybox=True, framealpha=legend_alpha)