URI:
       tFix calculation of reynolds number and visualization calls - sphere - GPU-based 3D discrete element method algorithm with optional fluid coupling
  HTML git clone git://src.adamsgaard.dk/sphere
   DIR Log
   DIR Files
   DIR Refs
   DIR LICENSE
       ---
   DIR commit fd6493eb51899c881c017dff8bae975365da046f
   DIR parent 439019dc191d4e17968abd9d9ea70164a2489b84
  HTML Author: Anders Damsgaard <anders@adamsgaard.dk>
       Date:   Mon,  2 Sep 2019 15:31:10 +0200
       
       Fix calculation of reynolds number and visualization calls
       
       Diffstat:
         M python/sphere.py                    |      25 +++++++++++++------------
       
       1 file changed, 13 insertions(+), 12 deletions(-)
       ---
   DIR diff --git a/python/sphere.py b/python/sphere.py
       t@@ -2097,7 +2097,7 @@ class sim:
                    dporos.SetNumberOfTuples(grid.GetNumberOfPoints())
        
                # array of scalars: Reynold's number
       -        self.ReynoldsNumber()
       +        Re = self.ReynoldsNumber()
                Re = vtk.vtkDoubleArray()
                Re.SetName("Reynolds number [-]")
                Re.SetNumberOfComponents(1)
       t@@ -2143,7 +2143,7 @@ class sim:
                            vel.SetTuple(idx, self.v_f[x, y, z, :])
                            poros.SetValue(idx, self.phi[x, y, z])
                            dporos.SetValue(idx, self.dphi[x, y, z])
       -                    Re.SetValue(idx, self.Re[x, y, z])
       +                    Re.SetValue(idx, Re[x, y, z])
                            if self.cfd_solver[0] == 1:
                                k.SetValue(idx, self.k[x, y, z])
                                K.SetValue(idx, self.K[x, y, z])
       t@@ -6083,7 +6083,8 @@ class sim:
                plt.close(fig)
        
            def plotSinFunction(self, baseval, A, f, phi=0.0, xlabel='$t$ [s]',
       -                        ylabel='$y$', plotstyle='.', outformat='png'):
       +                        ylabel='$y$', plotstyle='.', outformat='png',
       +                        verbose=True):
                '''
                Plot the values of a sinusoidal modulated base value. Saves the output
                as a plot in the current folder.
       t@@ -6742,9 +6743,8 @@ class sim:
                                tau[i] += -sb.force[j, 0]/A
        
                        if i > 0:
       -                    xdisp[i] = self.xdisp[i-1] + \
       -                                    sb.time_file_dt[0]*shearvel
       -                sigma_eff[i] = sb.w_force[0] / A
       +                    xdisp[i] = xdisp[i-1] + sb.time_file_dt[0]*shearvel
       +                sigma_eff[i] = sb.w_force[0]/A
                        sigma_def[i] = sb.w_sigma0[0]
        
                        # dilation in meters
       t@@ -6770,7 +6770,7 @@ class sim:
                    shear_strain = xdisp/w_x0
        
                    # Copy values so they can be modified during smoothing
       -            shear_strain_smooth = self.shear_strain
       +            shear_strain_smooth = shear_strain
                    tau_smooth = tau
                    sigma_def_smooth = sigma_def
        
       t@@ -6787,14 +6787,14 @@ class sim:
                        if smoothing_window == 'flat': # moving average
                            w = numpy.ones(smoothing, 'd')
                        else:
       -                    w = getattr(np, smoothing_window)(smoothing)
       +                    w = getattr(self.np, smoothing_window)(smoothing)
                        y = numpy.convolve(w/w.sum(), s, mode='same')
                        tau_smooth = y[smoothing-1:-smoothing+1]
        
                    # Plot stresses
                    if outformat != 'txt':
                        shearinfo = "$\\tau_p$={:.3} Pa at $\gamma$={:.3}".format(\
       -                        self.tau_p, self.tau_p_shearstrain)
       +                        tau_p, tau_p_shearstrain)
                        fig.text(0.01, 0.01, shearinfo, horizontalalignment='left',
                                 fontproperties=FontProperties(size=14))
                        ax1 = plt.subplot2grid((2, 1), (0, 0))
       t@@ -6817,9 +6817,9 @@ class sim:
                        ax2.set_ylabel('Dilation, $\Delta h/(2\\bar{r})$ [m]')
                        if smoothing > 2:
                            ax2.plot(shear_strain_smooth[1:-(smoothing+1)/2],
       -                             dilation_smooth[1:-(smoothing+1)/2], '-')
       +                             dilation[1:-(smoothing+1)/2], '-')
                        else:
       -                    ax2.plot(shear_strain, self.dilation, '-')
       +                    ax2.plot(shear_strain, dilation, '-')
                        ax2.grid()
        
                        if xlim:
       t@@ -6927,7 +6927,7 @@ class sim:
                            tau_p = tau_eff[i]
                            tau_p_shearstrain = xdisp[i]/w_x0
        
       -            shear_strain = self.xdisp/w_x0
       +            shear_strain = xdisp/w_x0
        
                    # Plot stresses
                    if outformat != 'txt':
       t@@ -7320,6 +7320,7 @@ class sim:
                    return
        
                # Optional save of figure content
       +        filename = ''
                if xlim:
                    filename = '{0}-{1}-{3}.{2}'.format(self.sid, method, outformat,
                                                        xlim[-1])