tmore diagnostics upon failure - sphere - GPU-based 3D discrete element method … | |
git clone git://src.adamsgaard.dk/sphere | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
commit 4de2ec1b49c4412169d419cf33b2a39f79ed9047 | |
parent 90c2fb7d69cb5dfcfdf6f426af69b9ecf80c38de | |
Author: Anders Damsgaard <[email protected]> | |
Date: Wed, 18 Jun 2014 09:03:30 +0200 | |
more diagnostics upon failure | |
Diffstat: | |
A tests/cfd_simple.py | 23 +++++++++++++++++++++++ | |
M tests/pytestutils.py | 6 ++++++ | |
2 files changed, 29 insertions(+), 0 deletions(-) | |
--- | |
diff --git a/tests/cfd_simple.py b/tests/cfd_simple.py | |
t@@ -0,0 +1,23 @@ | |
+#!/usr/bin/env python | |
+import sphere | |
+from pytestutils import * | |
+ | |
+orig = sphere.sim('cfd_simple', fluid=True) | |
+orig.cleanup() | |
+orig.defineWorldBoundaries([0.3, 0.3, 0.3], dx = 0.1) | |
+orig.initFluid(mu=0.0) | |
+orig.initTemporal(total = 0.5, file_dt = 0.05, dt = 1.0e-4) | |
+#orig.bc_bot[0] = 1 # No-flow BC at bottom (Neumann) | |
+ | |
+# Homogeneous pressure, no gravity | |
+orig.run(verbose=False) | |
+orig.writeVTKall() | |
+ | |
+py = sphere.sim(sid=orig.sid, fluid=True) | |
+py.readlast(verbose = False) | |
+ones = numpy.ones((orig.num)) | |
+zeros = numpy.zeros((orig.num[0], orig.num[1], orig.num[2], 3)) | |
+compareNumpyArraysClose(ones, py.p_f, "Conservation of pressure:", | |
+ tolerance = 1.0e-5) | |
+compareNumpyArraysClose(zeros, py.v_f, "Flow field: ", | |
+ tolerance = 1.0e-5) | |
diff --git a/tests/pytestutils.py b/tests/pytestutils.py | |
t@@ -52,5 +52,11 @@ def compareNumpyArraysClose(first, second, string, toleranc… | |
print(string + passed()) | |
else : | |
print(string + failed()) | |
+ print(numpy.min(first.v_f)) | |
+ print(numpy.mean(first.v_f)) | |
+ print(numpy.max(first.v_f)) | |
+ print(numpy.min(second.v_f)) | |
+ print(numpy.mean(second.v_f)) | |
+ print(numpy.max(second.v_f)) | |
raise Exception("Failed") | |
return(1) |