tnew scripts to test diffusivity - 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 691512da76d9cead278563ec13a6805fb263b530
(DIR) parent 1699089cd735a2dea713d15dd7dd4108f9631767
(HTM) Author: Anders Damsgaard <anders.damsgaard@geo.au.dk>
Date: Thu, 14 Aug 2014 10:58:46 +0200
new scripts to test diffusivity
Diffstat:
A python/diffusivity-test.py | 74 +++++++++++++++++++++++++++++++
A python/diffusivity-test.sh | 49 +++++++++++++++++++++++++++++++
2 files changed, 123 insertions(+), 0 deletions(-)
---
(DIR) diff --git a/python/diffusivity-test.py b/python/diffusivity-test.py
t@@ -0,0 +1,74 @@
+#!/usr/bin/env python
+import sphere
+import numpy
+import sys
+
+# launch with:
+# $ python diffusivity-test <DEVICE> <C_PHI> <C_GRAD_P>
+
+# Unique simulation parameters
+device = int(sys.argv[1])
+c_phi = float(sys.argv[2])
+c_grad_p = float(sys.argv[3])
+
+# Unconsolidated input
+sim = sphere.sim('diffusivity-relax')
+sim.readlast()
+
+# Load sequence as per Bowles 1992, p. 135, units: Pa. dp/p = 1
+sigma0_list = numpy.array([5.0e3, 10.0e3, 20.0e3, 40.0e3, 80.0e3, 160.0e3])
+
+i = 0
+for sigma0 in sigma0_list:
+
+ # Read previous output if not first load test
+ if (i > 0):
+ sim.sid = 'cons-sigma0=' + str(sigma0_list[i-1]) + '-c_phi=' + \
+ str(c_phi) + '-c_grad_p=' + str(c_grad_p)
+ sim.readlast()
+
+ sim.sid = 'cons-sigma0=' + str(sigma0) + '-c_phi=' + str(c_phi) + \
+ '-c_grad_p=' + str(c_grad_p)
+ print('\n###### ' + sim.sid + ' ######')
+
+ # Checkerboard colors
+ x_min = numpy.min(sim.x[:,0])
+ x_max = numpy.max(sim.x[:,0])
+ y_min = numpy.min(sim.x[:,1])
+ y_max = numpy.max(sim.x[:,1])
+ z_min = numpy.min(sim.x[:,2])
+ z_max = numpy.max(sim.x[:,2])
+ color_nx = 6
+ color_ny = 6
+ color_nz = 6
+ for i in range(sim.np):
+ ix = numpy.floor((sim.x[i,0] - x_min)/(x_max/color_nx))
+ iy = numpy.floor((sim.x[i,1] - y_min)/(y_max/color_ny))
+ iz = numpy.floor((sim.x[i,2] - z_min)/(z_max/color_nz))
+ sim.color[i] = (-1)**ix + (-1)**iy + (-1)**iz
+
+ sim.cleanup()
+ sim.adjustUpperWall()
+ sim.zeroKinematics()
+
+ sim.consolidate(normal_stress = sigma0)
+
+ sim.initFluid(mu = 17.87e-4, p = 1.0e5, hydrostatic = True)
+ sim.setFluidBottomNoFlow()
+ sim.setFluidTopFixedPressure()
+ sim.setDEMstepsPerCFDstep(10)
+ sim.setMaxIterations(2e5)
+ sim.initTemporal(total = 5.0, file_dt = 0.01, epsilon=0.07)
+
+ # Fix lowermost particles
+ dz = sim.L[2]/sim.num[2]
+ I = numpy.nonzero(sim.x[:,2] < 1.5*dz)
+ sim.fixvel[I] = 1
+
+ sim.run(dry=True)
+ sim.run(device=0)
+ #sim.writeVTKall()
+ sim.visualize('walls')
+ sim.visualize('fluid-pressure')
+
+ i += 1
(DIR) diff --git a/python/diffusivity-test.sh b/python/diffusivity-test.sh
t@@ -0,0 +1,49 @@
+#!/bin/sh
+#PBS -N diffusivity-test
+#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 diffusivity-test.py 0 1.0 1.00 &
+python diffusivity-test.py 1 1.0 0.10 &
+python diffusivity-test.py 2 1.0 0.01 &
+wait
+
+#cp $WORKDIR/output/* $ORIGDIR/output/
+
+echo "End at `date`"