tadded alternative script to test capillary cohesion - sphere - GPU-based 3D discrete element method algorithm with optional fluid coupling
(HTM) git clone git://src.adamsgaard.dk/sphere
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) LICENSE
---
(DIR) commit 0f1185f84c194087b38e96293082d0f4f73d5afa
(DIR) parent 320c1b1838e62c81afa76531759a7265a805e36f
(HTM) Author: Anders Damsgaard <anders.damsgaard@geo.au.dk>
Date: Mon, 1 Sep 2014 10:44:51 +0200
added alternative script to test capillary cohesion
Diffstat:
A python/capillary-cohesion2.py | 71 +++++++++++++++++++++++++++++++
A python/capillary-cohesion2.sh | 48 +++++++++++++++++++++++++++++++
2 files changed, 119 insertions(+), 0 deletions(-)
---
(DIR) diff --git a/python/capillary-cohesion2.py b/python/capillary-cohesion2.py
t@@ -0,0 +1,71 @@
+#!/usr/bin/env python
+
+# This script simulates the effect of capillary cohesion on a sand pile put on a
+# desk.
+
+# start with
+# $ python capillary-cohesion.py <DEVICE> <COHESION>
+# 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
+import sys
+
+device = sys.argv[1]
+cohesion = sys.argv[2]
+
+cube = sphere.sim('cube-init')
+cube.readlast()
+cube.adjustUpperWall(z_adjust=1.0)
+
+# Fill out grid with cubic packages
+grid = numpy.array((
+ [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [ 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0],
+ [ 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0],
+ [ 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0],
+ [ 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0],
+ [ 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0],
+ [ 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0],
+ [ 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0],
+ [ 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0]))
+
+# World dimensions and cube grid
+nx = 1 # horizontal (thickness) cubes
+ny = grid.shape[1] # horizontal cubes
+nz = grid.shape[0] # vertical cubes
+dx = cube.L[0]
+dy = cube.L[1]
+dz = cube.L[2]
+Lx = dx*nx
+Ly = dy*ny
+Lz = dz*nz
+
+sim = sphere.sim('cap2-cohesion=' + str(cohesion), nw=0)
+
+for z in range(nz):
+ for y in range(ny):
+ for x in range(nx):
+
+ if (grid[z,y] == 0):
+ continue # skip to next iteration
+
+ for i in range(cube.np):
+ # x=x, y=y, z=z
+ pos = [ cube.x[i,0] + x*dx,
+ cube.x[i,1] + y*dy,
+ cube.x[i,2] + z*dz ]
+ sim.addParticle(pos, radius=cube.radius[i], color=grid[z,y])
+
+sim.checkerboardColors()
+sim.defaultParams(capillaryCohesion=cohesion)
+sim.g[2] = -10.0
+sim.run(device=device)
+
+sim.writeVTKall()
(DIR) diff --git a/python/capillary-cohesion2.sh b/python/capillary-cohesion2.sh
t@@ -0,0 +1,48 @@
+#!/bin/sh
+#PBS -N cap2-cohesion
+#PBS -l nodes=1:ppn=3
+#PBS -l walltime=19200:00:00
+#PBS -q qfermi
+#PBS -M adc@geo.au.dk
+#PBS -m abe
+
+# Grendel CUDA
+source /com/gcc/4.6.4/load.sh
+CUDAPATH=/com/cuda/5.5.22
+export PATH=$HOME/bin:$PATH
+export PATH=$CUDAPATH/bin:$PATH
+export LD_LIBRARY_PATH=$CUDAPATH/lib64:$CUDAPATH/lib:$LD_LIBRARY_PATH
+
+# Manually installed Python modules
+export PYTHONPATH=$HOME/.local/lib/python:$PYTHONPATH
+export PYTHONPATH=$HOME/.local/lib64/python:$PYTHONPATH
+
+# Manually installed Python
+#export PATH=/home/adc/.local/bin:$PATH
+
+# Shared Python2.7
+PYTHON=/com/python/2.7.6
+export PYTHONPATH=$PYTHON/lib:$PYTHONPATH
+export PATH=$PYTHON/bin:$PATH
+
+echo "`whoami`@`hostname`"
+echo "Start at `date`"
+
+ORIGDIR=/home/adc/code/sphere
+#WORKDIR=/scratch/$PBS_JOBID
+WORKDIR=$ORIGDIR
+
+#cp -r $ORIGDIR/* $WORKDIR
+
+cd $WORKDIR
+nvidia-smi
+rm CMakeCache.txt
+cmake . && make
+cd python
+python capillary-cohesion2.py 0 0 &
+python capillary-cohesion2.py 1 1 &
+wait
+
+#cp $WORKDIR/output/* $ORIGDIR/output/
+
+echo "End at `date`"