tadd gravity flag - sphere - GPU-based 3D discrete element method algorithm wit… | |
git clone git://src.adamsgaard.dk/sphere | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
commit 6cd635fc47e08ae3bfa52306235f5a5bf94ba36a | |
parent 5702a349deb400506e747ef13fe3b2f18a67e593 | |
Author: Anders Damsgaard <[email protected]> | |
Date: Fri, 29 Aug 2014 15:23:59 +0200 | |
add gravity flag | |
Diffstat: | |
M python/capillary-cohesion.py | 15 ++++++++++++++- | |
M python/capillary-cohesion.sh | 5 +++-- | |
2 files changed, 17 insertions(+), 3 deletions(-) | |
--- | |
diff --git a/python/capillary-cohesion.py b/python/capillary-cohesion.py | |
t@@ -4,10 +4,13 @@ | |
# desk. | |
# start with | |
-# $ python capillary-cohesion.py <DEVICE> <COHESION> | |
+# $ python capillary-cohesion.py <DEVICE> <COHESION> <GRAVITY> | |
# where DEVICE specifies the index of the GPU (0 is the most common value). | |
# COHESION should have the value of 0 or 1. 0 denotes a dry simulation without | |
# cohesion, 1 denotes a wet simulation with capillary cohesion. | |
+# GRAVITY toggles gravitational acceleration. Without it, the particles are | |
+# placed in the middle of a volume. With it enabled, the particles are put on | |
+# top of a flat wall. | |
import sphere | |
import numpy | |
t@@ -15,6 +18,7 @@ import sys | |
device = sys.argv[1] | |
cohesion = sys.argv[2] | |
+gravity = sys.argv[3] | |
# Create packing | |
sim = sphere.sim('cap-cohesion=' + str(cohesion) + '-init', np=2000) | |
t@@ -39,6 +43,15 @@ sim.num[0] *= 5 | |
sim.num[1] *= 5 | |
sim.x[:,0] += 0.5*sim.L[0] - 0.5*init_lx | |
sim.x[:,1] += 0.5*sim.L[1] - 0.5*init_ly | |
+ | |
+if gravity == 0: | |
+ init_lz = sim.L[2] | |
+ sim.L[2] *= 5 | |
+ sim.num[2] *= 5 | |
+ sim.w_x[0] = sim.L[2] | |
+ sim.x[:,2] += 0.5*sim.L[2] - 0.5*init_lz | |
+ sim.g[2] = 0.0 | |
+ | |
sim.initTemporal(2.0, file_dt=0.01, epsilon=0.07) | |
sim.run() | |
diff --git a/python/capillary-cohesion.sh b/python/capillary-cohesion.sh | |
t@@ -39,8 +39,9 @@ nvidia-smi | |
rm CMakeCache.txt | |
cmake . && make | |
cd python | |
-python capillary-cohesion.py 0 0 & | |
-python capillary-cohesion.py 1 1 & | |
+python capillary-cohesion.py 0 0 1 & | |
+python capillary-cohesion.py 1 1 1 & | |
+python capillary-cohesion.py 1 1 0 & | |
wait | |
#cp $WORKDIR/output/* $ORIGDIR/output/ |