tadd coloring - sphere - GPU-based 3D discrete element method algorithm with op… | |
git clone git://src.adamsgaard.dk/sphere | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
commit c187341cc547490c3de9c3397af82b2893e0d1d4 | |
parent 6d7378e8949c392dece9dbb1aec3d30bf8ef6c96 | |
Author: Anders Damsgaard <[email protected]> | |
Date: Thu, 19 Jun 2014 11:15:23 +0200 | |
add coloring | |
Diffstat: | |
M python/shortening.py | 42 ++++++++++++++++++-----------… | |
1 file changed, 25 insertions(+), 17 deletions(-) | |
--- | |
diff --git a/python/shortening.py b/python/shortening.py | |
t@@ -14,18 +14,18 @@ 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, 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], | |
- [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 1, 1, 1, 1, 1, 1, 1], | |
- [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], | |
- [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], | |
- [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], | |
- [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 2, 2], | |
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] | |
)) | |
t@@ -40,7 +40,7 @@ Lx = dx*nx | |
Ly = dy*ny | |
Lz = dz*nz | |
-sim = sphere.sim('shortening', nw=0) | |
+sim = sphere.sim('shortening-relaxation', nw=0) | |
# insert particles into each cube in 90 degree CCW rotated coordinate system | |
# around y | |
t@@ -56,10 +56,17 @@ for z in range(nz): | |
pos = [ cube.x[i,0] + x*dx, | |
Ly - ((dz - cube.x[i,2]) + z*dz), | |
cube.x[i,1] + y*dy ] | |
- sim.addParticle(pos, radius=cube.radius[i]) | |
+ sim.addParticle(pos, radius=cube.radius[i], color=grid[z,y]) | |
-sim.defineWorldBoundaries(L=[Lx, Lz*3, Ly]) | |
+# move to y=0 | |
+min_y = numpy.min(sim.x[:,1] - sim.radius[:]) | |
+sim.x[:,1] = sim.x[:,1] - min_y | |
+ | |
+# move to z=0 | |
+min_z = numpy.min(sim.x[:,2] - sim.radius[:]) | |
+sim.x[:,2] = sim.x[:,2] - min_z | |
+sim.defineWorldBoundaries(L=[Lx, Lz*3, Ly]) | |
sim.k_t[0] = 2.0/3.0*sim.k_n[0] | |
sim.writeVTK() | |
t@@ -78,7 +85,7 @@ sim.periodicBoundariesX() | |
sim.uniaxialStrainRate(wvel = 0.0) | |
# Set duration of simulation, automatically determine timestep, etc. | |
-sim.initTemporal(total=3.0, file_dt = 0.001) | |
+sim.initTemporal(total=3.0, file_dt = 0.01) | |
sim.zeroKinematics() | |
sim.run(dry=True) | |
t@@ -87,8 +94,9 @@ sim.writeVTKall() | |
## Shortening | |
-sim = sphere.sim('shortening', nw=1) | |
+sim = sphere.sim('shortening-relaxation', nw=1) | |
sim.readlast() | |
+sim.sid = 'shortening' | |
sim.initTemporal(current=0.0, total=5.0, file_dt = 0.01) | |
# push down upper wall |