tavoid divide by zero in inviscid fluid - 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 6976fe3a898d772d6d3bf0726f566a50c537e817
(DIR) parent 3cd8e98d6f47fed8ba248b3d20f6326577c648d5
(HTM) Author: Anders Damsgaard <anders.damsgaard@geo.au.dk>
Date: Mon, 10 Nov 2014 12:47:00 +0100
avoid divide by zero in inviscid fluid
Diffstat:
M python/sphere.py | 2 +-
M tests/cfd_tests_darcy.py | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
---
(DIR) diff --git a/python/sphere.py b/python/sphere.py
t@@ -2776,7 +2776,7 @@ class sim:
# Navier-Stokes
if self.cfd_solver[0] == 0:
- dt_min_von_neumann = 0.5*dx_min**2/self.mu[0]
+ dt_min_von_neumann = 0.5*dx_min**2/(self.mu[0] + 1.0e-16)
return numpy.min([dt_min_von_neumann, dt_min_cfl])*safety
(DIR) diff --git a/tests/cfd_tests_darcy.py b/tests/cfd_tests_darcy.py
t@@ -27,9 +27,9 @@ orig.run(device=2, verbose=False)
#orig.run(verbose=True)
py = sphere.sim(sid = orig.sid, fluid = True)
-ones = numpy.ones((orig.num))
+zeros = numpy.zeros((orig.num))
py.readlast(verbose = False)
-compareNumpyArrays(ones, py.p_f, "Conservation of pressure:")
+compareNumpyArrays(zeros, py.p_f, "Conservation of pressure:")
# Convergence rate (1/3)
it = numpy.loadtxt("../output/" + orig.sid + "-conv.log")
t@@ -48,7 +48,7 @@ else:
# Add pressure gradient
print("# Pressure gradient")
-orig.p_f[:,:,-1] = 1.1
+orig.p_f[:,:,-1] = 1.0
#orig.setTolerance(1.0e-8)
#orig.time_dt[0] *= 0.01
orig.cleanup()