timprove time step selection logic - 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 9d47bd9498be4b5070067209963f832b81fa75c3
 (DIR) parent 9c151584116fc9b0a5b998903775373d1b7db9b0
 (HTM) Author: Anders Damsgaard <anders.damsgaard@geo.au.dk>
       Date:   Thu,  6 Nov 2014 12:47:15 +0100
       
       improve time step selection logic
       
       Diffstat:
         M python/sphere.py                    |      13 +++++++------
       
       1 file changed, 7 insertions(+), 6 deletions(-)
       ---
 (DIR) diff --git a/python/sphere.py b/python/sphere.py
       t@@ -2885,7 +2885,7 @@ class sim:
                :type epsilon: float
                '''
        
       -        if dt > 0:
       +        if dt > 0.0:
                    self.time_dt[0] = dt
                    if (self.np[0] > 0):
                        print("Warning: Manually specifying the time step length when "
       t@@ -2906,14 +2906,15 @@ class sim:
                    # Computational time step (O'Sullivan et al, 2003)
                    #self.time_dt[0] = 0.17*math.sqrt(m_min/k_max)
        
       -        # Check numerical stability of the fluid phase, by criteria derived by
       -        # von Neumann stability analysis of the diffusion and advection terms
       +        elif self.fluid == False:
       +            raise Exception('Error: Could not automatically set a time step.')
       +
       +        # Check numerical stability of the fluid phase, by criteria derived
       +        # by von Neumann stability analysis of the diffusion and advection
       +        # terms
                if self.fluid:
       -            fluid_time_dt = self.largestFluidTimeStep(safety = 0.5)
                    self.time_dt[0] = numpy.min([fluid_time_dt, self.time_dt[0]])
        
       -        else:
       -            raise Exception('Error: Could not automatically set a time step.')
        
                # Time at start
                self.time_current[0] = current