tImprove plotting and reduce number of time steps read - 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 451d62b9147f55f551565c422a24c022860c492c
 (DIR) parent 6fc9ec5215b4ee5c0ed3e666ac0a0298d6fec7f3
 (HTM) Author: Anders Damsgaard <anders@adamsgaard.dk>
       Date:   Tue, 26 Nov 2019 14:47:16 +0100
       
       Improve plotting and reduce number of time steps read
       
       Diffstat:
         M python/supraglacial-plots.py        |      27 +++++++++++++--------------
       
       1 file changed, 13 insertions(+), 14 deletions(-)
       ---
 (DIR) diff --git a/python/supraglacial-plots.py b/python/supraglacial-plots.py
       t@@ -88,15 +88,15 @@ plt.savefig('supraglacial_flux.pdf')
        '''
        
        # time series
       -
       +fig = plt.figure(figsize=(8,12))
        for dpdz in dpdz_values:
            for slope_angle in slope_angle_values:
                sim = sphere.sim("supraglacial-slope{}-dpdz{}".format(slope_angle, dpdz), fluid=True)
                print('### ' + sim.id())
                sim.readlast()
        
       -        N_time = sim.status() - 1
       -        timesteps = np.linspace(1, sim.time_current[0], N_time)
       +        N_time = min(100, sim.status())
       +        timesteps = np.linspace(sim.time_file_dt[0], sim.time_current[0] - sim.time_file_dt[0], N_time)
                porosity = np.empty(N_time)
                velocity = np.empty(N_time)
                displacement = np.empty(N_time)
       t@@ -105,8 +105,8 @@ for dpdz in dpdz_values:
                v_x_space_avg = np.empty_like(z)
                xsum_space_avg = np.empty_like(z)
        
       -        for it in np.arange(1, N_time):
       -            sim.readstep(it)
       +        for it in np.arange(N_time):
       +            sim.readTime(timesteps[it])
        
                    dz = np.max(sim.x[:,2])/len(z)
                    for i in range(len(z)):
       t@@ -119,27 +119,26 @@ for dpdz in dpdz_values:
                    displacement[it] = np.mean(sim.xyzsum[:,0])
                    flux[it] = np.trapz(xsum_space_avg/sim.time_current, dx=dz)
        
       -        ax1 = plt.subplot(4,1,1)
       +        ax1 = plt.subplot(3,1,1)
                plt.plot(timesteps, porosity, '-')
                plt.ylabel('Porosity [-]')
                plt.setp(ax1.get_xticklabels(), visible=False)
        
       -        ax2 = plt.subplot(4,1,2)
       -        plt.semilogy(timesteps, velocity, '-')
       -        plt.ylabel('Avg. velocity [m/s]')
       -        plt.setp(ax2.get_xticklabels(), visible=False)
       +        #ax2 = plt.subplot(3,1,2)
       +        #plt.semilogy(timesteps, velocity, '-')
       +        #plt.ylabel('Avg. velocity [m/s]')
       +        #plt.setp(ax2.get_xticklabels(), visible=False)
        
       -        ax3 = plt.subplot(4,1,3)
       -        plt.plot(timesteps, displacement, '-')
       +        ax3 = plt.subplot(3,1,2)
       +        plt.semilogy(timesteps, displacement, '-')
                plt.ylabel('Cumulative displacement [m]')
                plt.setp(ax3.get_xticklabels(), visible=False)
        
       -        ax1 = plt.subplot(4,1,4)
       +        ax1 = plt.subplot(3,1,3)
                plt.semilogy(timesteps, flux, '-')
                plt.ylabel('Cumulative flux [m$^2$/s]')
                plt.xlabel('Time [s]')
        
       -        plt.tight_layout()
                plt.savefig(sim.id() + '-timeseries.png')
                plt.savefig(sim.id() + '-timeseries.pdf')
                plt.clf()