tdisable vtk output, avoid divide by zero when determining Re - sphere - GPU-ba… | |
git clone git://src.adamsgaard.dk/sphere | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
commit 83fba892f1c1133c173995fa2b80f288902d91af | |
parent 6976fe3a898d772d6d3bf0726f566a50c537e817 | |
Author: Anders Damsgaard <[email protected]> | |
Date: Mon, 10 Nov 2014 12:49:41 +0100 | |
disable vtk output, avoid divide by zero when determining Re | |
Diffstat: | |
M python/sphere.py | 3 ++- | |
M tests/cfd_tests.py | 6 +++--- | |
2 files changed, 5 insertions(+), 4 deletions(-) | |
--- | |
diff --git a/python/sphere.py b/python/sphere.py | |
t@@ -5005,7 +5005,8 @@ class sim: | |
self.v_f_magn[x,y,z] = \ | |
self.v_f[x,y,z,:].dot(self.v_f[x,y,z,:]) | |
- self.Re = self.rho_f*self.v_f_magn*self.L[0]/self.num[0]/self.mu | |
+ self.Re = self.rho_f*self.v_f_magn*self.L[0]/self.num[0]/(self.mu + \ | |
+ 1.0e-16) | |
return self.Re | |
def plotLoadCurve(self, graphics_format='png'): | |
diff --git a/tests/cfd_tests.py b/tests/cfd_tests.py | |
t@@ -26,9 +26,9 @@ orig.run(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/2) | |
it = numpy.loadtxt("../output/" + orig.sid + "-conv.log") | |
t@@ -52,7 +52,7 @@ orig.run(verbose=False) | |
#orig.run(verbose=True) | |
py.readlast(verbose = False) | |
ideal_grad_p_z = numpy.linspace(orig.p_f[0,0,0], orig.p_f[0,0,-1], orig.num[2]) | |
-orig.writeVTKall() | |
+#orig.writeVTKall() | |
compareNumpyArraysClose(numpy.zeros((1,orig.num[2])),\ | |
ideal_grad_p_z - py.p_f[0,0,:],\ | |
"Pressure gradient:\t", tolerance=1.0e-1) |