tRenamed darcy flow main file to porousflow. Darcy calls now in darcy.cpp - sph… | |
git clone git://src.adamsgaard.dk/sphere | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
commit 7b2baa5c83dfd64089f142f3e4f93eb7f6e91bbe | |
parent ca8bad69c8b6200751129a40c8526c87405688b5 | |
Author: Anders Damsgaard <[email protected]> | |
Date: Tue, 28 May 2013 10:22:09 +0200 | |
Renamed darcy flow main file to porousflow. Darcy calls now in darcy.cpp | |
Diffstat: | |
M src/CMakeLists.txt | 2 +- | |
M src/darcy.cpp | 102 +++++++++--------------------… | |
C src/darcy.cpp -> src/porousflow.cpp | 0 | |
3 files changed, 29 insertions(+), 75 deletions(-) | |
--- | |
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt | |
t@@ -18,7 +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… | |
+CUDA_ADD_EXECUTABLE(../porousflow porousflow.cpp darcy.cpp file_io.cpp sphere.… | |
#ADD_EXECUTABLE(unittests boost-unit-tests.cpp sphere.cpp) | |
#TARGET_LINK_LIBRARIES(unittests | |
diff --git a/src/darcy.cpp b/src/darcy.cpp | |
t@@ -1,85 +1,39 @@ | |
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ | |
-/* SPHERE source code by Anders Damsgaard Christensen, 2010-12, */ | |
-/* a 3D Discrete Element Method algorithm with CUDA GPU acceleration. */ | |
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ | |
- | |
-// Licence: GNU Public License (GPL) v. 3. See license.txt. | |
-// See doc/sphere-doc.pdf for full documentation. | |
-// Compile with GNU make by typing 'make' in the src/ directory. | |
-// SPHERE is called from the command line with './sphere_<architecture> projec… | |
- | |
- | |
-// Including library files | |
#include <iostream> | |
#include <string> | |
+#include <cstdio> | |
#include <cstdlib> | |
+#include <cmath> | |
+#include <vector> | |
+#include <algorithm> | |
-// Including user files | |
-#include "constants.h" | |
+#include "typedefs.h" | |
#include "datatypes.h" | |
+#include "constants.h" | |
#include "sphere.h" | |
-////////////////// | |
-// MAIN ROUTINE // | |
-////////////////// | |
-// The main loop returns the value 0 to the shell, if the program terminated | |
-// successfully, and 1 if an error occured which caused the program to crash. | |
-int main(const int argc, const char *argv[]) | |
-{ | |
- // Default values | |
- int verbose = 1; | |
- int dry = 0; | |
- int nfiles = 0; | |
- | |
- | |
- // Process input parameters | |
- int i; | |
- for (i=1; i<argc; ++i) { // skip argv[0] | |
- | |
- std::string argvi = std::string(argv[i]); | |
- | |
- // Display help if requested | |
- if (argvi == "-h" || argvi == "--help") { | |
- std::cout << argv[0] << ": particle dynamics simulator\n" | |
- << "Usage: " << argv[0] << " [OPTION[S]]... [FILE1 ...]\nOptio… | |
- << "-h, --help\t\tprint help\n" | |
- << "-n, --dry\t\tshow key experiment parameters and quit\n" | |
- << std::endl; | |
- return 0; // Exit with success | |
- } | |
+// Find hydraulic conductivities for each cell | |
- 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; | |
- | |
- // Create DEM class, read data from input binary, | |
- // do not check values, do not init cuda, do not transfer const | |
- // mem | |
- DEM dem(argvi, verbose, 0, dry, 0, 0); | |
- | |
- // Otherwise, start iterating through time | |
- dem.startDarcy(); | |
- | |
- | |
- } | |
+// 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; | |
} | |
- // Check whether there are input files specified | |
- if (!argv[0] || argc == 1 || nfiles == 0) { | |
- std::cerr << argv[0] << ": missing input binary file\n" | |
- << "See `" << argv[0] << " --help` for more information" | |
- << std::endl; | |
- return 1; // Return unsuccessful exit status | |
- } | |
- return 0; // Return successfull exit status | |
-} | |
-// END OF FILE | |
-// vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 | |
+} | |
+ | |
diff --git a/src/darcy.cpp b/src/porousflow.cpp |