tStarted darcy flow implementation - sphere - GPU-based 3D discrete element met… | |
git clone git://src.adamsgaard.dk/sphere | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
commit ca8bad69c8b6200751129a40c8526c87405688b5 | |
parent 1cb4f6b13a8d8d7a4f23be5b744f818804de98b0 | |
Author: Anders Damsgaard <[email protected]> | |
Date: Tue, 28 May 2013 10:07:34 +0200 | |
Started darcy flow implementation | |
Diffstat: | |
M src/CMakeLists.txt | 1 + | |
M src/darcy.cpp | 8 ++++---- | |
M src/sphere.cpp | 26 ++++++++++++++++++++++++++ | |
M src/sphere.h | 4 ++++ | |
4 files changed, 35 insertions(+), 4 deletions(-) | |
--- | |
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt | |
t@@ -18,6 +18,7 @@ SET(CUDA_NVCC_FLAGS "--use_fast_math;-O3;-gencode=arch=compu… | |
CUDA_ADD_EXECUTABLE(../sphere main.cpp file_io.cpp sphere.cpp device.cu utilit… | |
CUDA_ADD_EXECUTABLE(../porosity porosity.cpp file_io.cpp sphere.cpp device.cu … | |
CUDA_ADD_EXECUTABLE(../forcechains forcechains.cpp file_io.cpp sphere.cpp devi… | |
+CUDA_ADD_EXECUTABLE(../darcy darcy.cpp file_io.cpp sphere.cpp device.cu utilit… | |
#ADD_EXECUTABLE(unittests boost-unit-tests.cpp sphere.cpp) | |
#TARGET_LINK_LIBRARIES(unittests | |
diff --git a/src/darcy.cpp b/src/darcy.cpp | |
t@@ -29,6 +29,7 @@ int main(const int argc, const char *argv[]) | |
// Default values | |
int verbose = 1; | |
int dry = 0; | |
+ int nfiles = 0; | |
// Process input parameters | |
t@@ -49,11 +50,11 @@ int main(const int argc, const char *argv[]) | |
else if (argvi == "-n" || argvi == "--dry") | |
dry = 1; | |
- } | |
- | |
// The rest of the values must be input binary files | |
else { | |
+ nfiles++; | |
+ | |
if (verbose == 1) | |
std::cout << argv[0] << ": processing input file: " << argvi << | |
std::endl; | |
t@@ -64,8 +65,7 @@ int main(const int argc, const char *argv[]) | |
DEM dem(argvi, verbose, 0, dry, 0, 0); | |
// Otherwise, start iterating through time | |
- else | |
- dem.startDarcy(); | |
+ dem.startDarcy(); | |
} | |
diff --git a/src/sphere.cpp b/src/sphere.cpp | |
t@@ -732,4 +732,30 @@ void DEM::forcechains(const std::string format, const int… | |
} | |
+// Find hydraulic conductivities for each cell | |
+ | |
+// Solve Darcy flow through particles | |
+void DEM::startDarcy( | |
+ const Float cellsizemultiplier) | |
+{ | |
+ // Number of cells | |
+ int nx = grid.L[0]/grid.num[0]; | |
+ int ny = grid.L[1]/grid.num[1]; | |
+ int nz = grid.L[2]/grid.num[2]; | |
+ | |
+ // Cell size | |
+ Float dx = grid.L[0]/nx; | |
+ Float dy = grid.L[1]/nx; | |
+ Float dz = grid.L[2]/nx; | |
+ | |
+ if (verbose == 1) { | |
+ std::cout << "Fluid grid dimensions: " | |
+ << nx << " * " | |
+ << ny << " * " | |
+ << nz << std::endl; | |
+ } | |
+ | |
+ | |
+} | |
+ | |
// vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 | |
diff --git a/src/sphere.h b/src/sphere.h | |
t@@ -136,6 +136,7 @@ class DEM { | |
// Lattice-Boltzmann data arrays (D3Q19) | |
Float *f; // Fluid distribution (f0..f18) | |
+ Float *f_new; // t+deltaT fluid distribution (f0..f18) | |
Float *dev_f; // Device equivalent | |
Float *dev_f_new; // Device equivalent | |
Float4 *v_rho; // Fluid velocity v (xyz), and pressure rho (w) | |
t@@ -206,6 +207,9 @@ class DEM { | |
const double lower_cutoff = 0.0, | |
const double upper_cutoff = 1.0e9); | |
+ // Calculate Darcy fluid flow through material | |
+ void startDarcy( | |
+ const Float cellsizemultiplier = 1.0); | |
}; | |