tadded ghost nodes to vidx - sphere - GPU-based 3D discrete element method algo… | |
git clone git://src.adamsgaard.dk/sphere | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
commit 9110244001e9a56f0e98907b59b5c870a8ae8951 | |
parent a9f8a2dd9e09d2d28668068702d302ed7f6fbe46 | |
Author: Anders Damsgaard <[email protected]> | |
Date: Tue, 3 Jun 2014 16:52:27 +0200 | |
added ghost nodes to vidx | |
Diffstat: | |
M CMakeLists.txt | 10 +++++----- | |
M src/navierstokes.cuh | 10 ++++++++-- | |
M tests/io_tests_fluid.py | 4 ++-- | |
3 files changed, 15 insertions(+), 9 deletions(-) | |
--- | |
diff --git a/CMakeLists.txt b/CMakeLists.txt | |
t@@ -29,13 +29,13 @@ find_package(OpenMP) | |
enable_testing() | |
# Set build type = Debug | |
-#set(CMAKE_BUILD_TYPE Debug) | |
-#if (CUDA_FOUND) | |
-# set(CUDA_NVCC_FLAGS -g;-G) | |
-#endif() | |
+set(CMAKE_BUILD_TYPE Debug) | |
+if (CUDA_FOUND) | |
+ set(CUDA_NVCC_FLAGS -g;-G) | |
+endif() | |
# Set build type = Release | |
-set(CMAKE_BUILD_TYPE Release) | |
+#set(CMAKE_BUILD_TYPE Release) | |
# Add source directory to project. | |
add_subdirectory(src) | |
diff --git a/src/navierstokes.cuh b/src/navierstokes.cuh | |
t@@ -222,8 +222,14 @@ __inline__ __device__ unsigned int idx( | |
__inline__ __device__ unsigned int vidx( | |
const int x, const int y, const int z) | |
{ | |
- return x + (devC_grid.num[0]+1)*y | |
- + (devC_grid.num[0]+1)*(devC_grid.num[1]+1)*z; | |
+ // without ghost nodes | |
+ //return x + (devC_grid.num[0]+1)*y | |
+ //+ (devC_grid.num[0]+1)*(devC_grid.num[1]+1)*z; | |
+ | |
+ // with ghost nodes | |
+ // the ghost nodes are placed at x,y,z = -1 and WIDTH+1 | |
+ return (x+1) + (devC_grid.num[0]+3)*(y+1) | |
+ + (devC_grid.num[0]+3)*(devC_grid.num[1]+3)*(z+1); | |
} | |
// Find averaged cell velocities from cell-face velocities. This function works | |
diff --git a/tests/io_tests_fluid.py b/tests/io_tests_fluid.py | |
t@@ -22,8 +22,8 @@ py.readbin("../input/" + orig.sid + ".bin", verbose=False) | |
compare(orig, py, "Python IO:") | |
# Test C++ IO routines | |
-orig.run(verbose=True, hideinputfile=True) | |
-#orig.run(verbose=True, hideinputfile=False) | |
+#orig.run(verbose=True, hideinputfile=True) | |
+orig.run(verbose=True, hideinputfile=False, cudamemcheck=True) | |
cpp = sphere.sim(fluid=True) | |
cpp.readbin("../output/" + orig.sid + ".output00000.bin", verbose=False) | |
compare(orig, cpp, "C++ IO: ") |