tadded triaxial and uniaxial example scripts - sphere - GPU-based 3D discrete e… | |
git clone git://src.adamsgaard.dk/sphere | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
commit 95180945f0ef9f2bf1ad44f25f43ef7fec95c52d | |
parent a715612236ad2daa95f223638876f0b63b387605 | |
Author: Anders Damsgaard <[email protected]> | |
Date: Wed, 21 Aug 2013 14:47:23 +0200 | |
added triaxial and uniaxial example scripts | |
Diffstat: | |
A python/triaxial.py | 90 +++++++++++++++++++++++++++++… | |
A python/uniaxial.py | 56 +++++++++++++++++++++++++++++… | |
2 files changed, 146 insertions(+), 0 deletions(-) | |
--- | |
diff --git a/python/triaxial.py b/python/triaxial.py | |
t@@ -0,0 +1,90 @@ | |
+#!/usr/bin/env python | |
+ | |
+# Import sphere functionality | |
+from sphere import * | |
+ | |
+### EXPERIMENT SETUP ### | |
+initialization = True | |
+consolidation = True | |
+rendering = True | |
+plots = True | |
+ | |
+# Number of particles | |
+np = 2e3 | |
+ | |
+# Common simulation id | |
+sim_id = "triaxial-test" | |
+ | |
+# Normal stress (sigma_3) | |
+devs = 10e3 | |
+ | |
+ | |
+### INITIALIZATION ### | |
+ | |
+# New class | |
+init = Spherebin(np = np, nd = 3, nw = 0, sid = sim_id + "-init") | |
+ | |
+# Save radii | |
+init.generateRadii(radius_mean = 0.05) | |
+ | |
+# Use default params | |
+init.defaultParams(gamma_n = 0.0, mu_s = 0.4, mu_d = 0.4) | |
+ | |
+# Initialize positions in random grid (also sets world size) | |
+init.initRandomGridPos(gridnum = numpy.array([12, 12, 1000]), periodic = 1, co… | |
+ | |
+# Set duration of simulation | |
+init.initTemporal(total = 5.0) | |
+ | |
+if (initialization == True): | |
+ # Write input file for sphere | |
+ init.writebin() | |
+ | |
+ # Run sphere | |
+ init.run() | |
+ | |
+ if (plots == True): | |
+ # Make a graph of energies | |
+ visualize(init.sid, "energy", savefig=True, outformat='png') | |
+ | |
+ #if (rendering == True): | |
+ # Render images with raytracer | |
+ #init.render(method = "angvel", max_val = 0.3, verbose = False) | |
+ | |
+ | |
+### CONSOLIDATION ### | |
+ | |
+# New class | |
+cons = Spherebin(np = np, nw = 1, sid = sim_id + "-cons") | |
+ | |
+# Read last output file of initialization step | |
+lastf = status(sim_id + "-init") | |
+cons.readbin("../output/" + sim_id + "-init.output{:0=5}.bin".format(lastf), v… | |
+ | |
+# Setup triaxial experiment | |
+cons.triaxial(wvel = -cons.L[2]*0.01, deviatoric_stress = devs) # one percent … | |
+ | |
+# Set duration of simulation | |
+cons.initTemporal(total = 5.0) | |
+ | |
+cons.w_m[:] *= 0.001 | |
+ | |
+ | |
+ | |
+if (consolidation == True): | |
+ # Write input file for sphere | |
+ cons.writebin() | |
+ | |
+ # Run sphere | |
+ cons.run(dry=True) # show values, don't run | |
+ cons.run() # run | |
+ | |
+ if (plots == True): | |
+ # Make a graph of energies | |
+ visualize(cons.sid, "energy", savefig=True, outformat='png') | |
+ visualize(cons.sid, "walls", savefig=True, outformat='png') | |
+ | |
+ if (rendering == True): | |
+ # Render images with raytracer | |
+ cons.render(method = "pres", max_val = 1e4, verbose = False) | |
+ | |
diff --git a/python/uniaxial.py b/python/uniaxial.py | |
t@@ -0,0 +1,56 @@ | |
+#!/usr/bin/env python | |
+ | |
+# Import sphere functionality | |
+from sphere import * | |
+ | |
+### EXPERIMENT SETUP ### | |
+consolidation = True | |
+rendering = True | |
+plots = True | |
+ | |
+# Number of particles | |
+np = 2e3 | |
+ | |
+# Common simulation id | |
+sim_id = "uniaxial-test" | |
+ | |
+ | |
+### CONSOLIDATION ### | |
+ | |
+# New class | |
+cons = Spherebin(np = np, nw = 1, sid = sim_id + "-cons") | |
+ | |
+# Read last output file of initialization step | |
+lastf = status("shear-test-init") | |
+cons.readbin("../output/shear-test-init.output{:0=5}.bin".format(lastf), verbo… | |
+ | |
+# Setup consolidation experiment | |
+cons.uniaxialStrainRate(wvel = -cons.L[2]*0.05) # five percent of height per s… | |
+ | |
+# Set duration of simulation | |
+cons.initTemporal(total = 3.0) | |
+#cons.initTemporal(total = 0.0019, file_dt = 0.00009) | |
+#cons.initTemporal(total = 0.0019, file_dt = 1e-6) | |
+#cons.initTemporal(total = 0.19, file_dt = 0.019) | |
+ | |
+cons.w_m[0] *= 0.001 | |
+ | |
+ | |
+ | |
+if (consolidation == True): | |
+ # Write input file for sphere | |
+ cons.writebin() | |
+ | |
+ # Run sphere | |
+ cons.run(dry=True) # show values, don't run | |
+ cons.run() # run | |
+ | |
+ if (plots == True): | |
+ # Make a graph of energies | |
+ visualize(cons.sid, "energy", savefig=True, outformat='png') | |
+ visualize(cons.sid, "walls", savefig=True, outformat='png') | |
+ | |
+ if (rendering == True): | |
+ # Render images with raytracer | |
+ cons.render(method = "pres", max_val = 1e4, verbose = False) | |
+ |