tadd initialization and consolidation script - sphere - GPU-based 3D discrete e… | |
git clone git://src.adamsgaard.dk/sphere | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
commit cb145bb36bca6fad2bdcdbe633d5c135eb3bf66a | |
parent 2d6d6b6937b1b3894180194600a3ffdaa24f0e37 | |
Author: Anders Damsgaard Christensen <[email protected]> | |
Date: Wed, 15 Jun 2016 17:30:26 -0700 | |
add initialization and consolidation script | |
Diffstat: | |
A python/alejandro-init-cons.py | 103 +++++++++++++++++++++++++++++… | |
1 file changed, 103 insertions(+), 0 deletions(-) | |
--- | |
diff --git a/python/alejandro-init-cons.py b/python/alejandro-init-cons.py | |
t@@ -0,0 +1,103 @@ | |
+#!/usr/bin/env python | |
+ | |
+# Import sphere functionality | |
+import sphere | |
+ | |
+# EXPERIMENT SETUP # | |
+initialization = True | |
+consolidation = True | |
+plots = True | |
+ | |
+# CUDA device to use | |
+device = 0 | |
+ | |
+# Number of particles | |
+np = 2e3 | |
+ | |
+# Common simulation id | |
+sim_id = "alejandro" | |
+ | |
+# Consolidation stress [Pa] | |
+N = 10e3 | |
+ | |
+# INITIALIZATION # | |
+ | |
+# New class | |
+init = sphere.sim(np=np, nd=3, nw=0, sid=sim_id + "-init") | |
+ | |
+# Save radii | |
+init.generateRadii(mean=0.01) | |
+ | |
+# Use default params | |
+init.defaultParams(k_n=1.16e7, k_t=1.16e7, gamma_n=100.0, mu_s=0.5, mu_d=0.5) | |
+ | |
+# Add gravity | |
+init.g[2] = -9.81 | |
+ | |
+# Periodic x and y boundaries | |
+init.periodicBoundariesX() | |
+ | |
+# Initialize positions in random grid (also sets world size) | |
+hcells = np**(1.0/3.0) | |
+init.initRandomGridPos(gridnum=[hcells, hcells, 1e9]) | |
+ | |
+# Set duration of simulation | |
+init.initTemporal(total=10.0, epsilon=0.07) | |
+ | |
+if (initialization): | |
+ | |
+ # Run sphere | |
+ init.run(dry=True) | |
+ init.run(device=device) | |
+ | |
+ if (plots): | |
+ # Make a graph of energies | |
+ init.visualize('energy') | |
+ | |
+ init.writeVTKall() | |
+ | |
+ | |
+# CONSOLIDATION # | |
+ | |
+# New class | |
+cons = sphere.sim( | |
+ np=init.np, | |
+ nw=1, | |
+ sid=sim_id + | |
+ "-cons-N={}".format(N)) | |
+ | |
+# Read last output file of initialization step | |
+lastf = sphere.status(sim_id + "-init") | |
+cons.readbin( | |
+ "../output/" + | |
+ sim_id + | |
+ "-init.output{:0=5}.bin".format(lastf), | |
+ verbose=False) | |
+ | |
+cons.periodicBoundariesX() | |
+ | |
+# Setup consolidation experiment | |
+cons.consolidate(normal_stress=N) | |
+cons.w_m[0] = cons.totalMass() | |
+ | |
+# Disable all viscosities | |
+cons.gamma_n[0] = 0.0 | |
+cons.gamma_t[0] = 0.0 | |
+cons.gamma_wn[0] = 0.0 | |
+cons.gamma_wt[0] = 0.0 | |
+ | |
+# Set duration of simulation | |
+cons.initTemporal(total=5.0, epsilon=0.07) | |
+ | |
+if (consolidation): | |
+ | |
+ # Run sphere | |
+ cons.run(dry=True) # show values, don't run | |
+ cons.run(device=device) # run | |
+ | |
+ if (plots): | |
+ # Make a graph of energies | |
+ cons.visualize('energy') | |
+ cons.visualize('walls') | |
+ | |
+ cons.writeVTKall() |