timprove time step selection logic - sphere - GPU-based 3D discrete element met… | |
git clone git://src.adamsgaard.dk/sphere | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
commit 9d47bd9498be4b5070067209963f832b81fa75c3 | |
parent 9c151584116fc9b0a5b998903775373d1b7db9b0 | |
Author: Anders Damsgaard <[email protected]> | |
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(-) | |
--- | |
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 |