tcapillary-cohesion.py - 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
---
tcapillary-cohesion.py (2071B)
---
1 #!/usr/bin/env python
2
3 # This script simulates the effect of capillary cohesion on a sand pile put on a
4 # desk.
5
6 # start with
7 # $ python capillary-cohesion.py <DEVICE> <COHESION> <GRAVITY>
8 # where DEVICE specifies the index of the GPU (0 is the most common value).
9 # COHESION should have the value of 0 or 1. 0 denotes a dry simulation without
10 # cohesion, 1 denotes a wet simulation with capillary cohesion.
11 # GRAVITY toggles gravitational acceleration. Without it, the particles are
12 # placed in the middle of a volume. With it enabled, the particles are put on
13 # top of a flat wall.
14
15 import sphere
16 #import numpy
17 import sys
18
19 device = int(sys.argv[1])
20 cohesion = int(sys.argv[2])
21 gravity = int(sys.argv[3])
22
23 # Create packing
24 sim = sphere.sim('cap-cohesion=' + str(cohesion) + '-init-grav=' \
25 + str(gravity), np=2000)
26 #sim.mu_s[0] = 0.0
27 #sim.mu_d[0] = 0.0
28 #sim.k_n[0] = 1.0e7
29 #sim.k_t[0] = 1.0e7
30 sim.generateRadii(psd='uni', mean=1.0e-3, variance=1.0e-4)
31 sim.contactModel(1)
32 sim.initRandomGridPos(gridnum=[24, 24, 10000], padding=1.4)
33 sim.defaultParams(gamma_t = 1.0e3, capillaryCohesion=1)
34 sim.initTemporal(5.0, file_dt=0.01, epsilon=0.07)
35 #I = numpy.nonzero(sim.x[:,2] < sim.L[2]*0.5)
36 #sim.vel[I[0], 2] = 0.01 # add a instability seeding perturbation
37 #I = numpy.nonzero(sim.x[:,2] > sim.L[2]*0.5)
38 #sim.vel[I[0], 2] = -0.01 # add a instability seeding perturbation
39 if gravity == 1:
40 sim.g[2] = -10.0
41 sim.run(dry=True)
42 sim.run(device=device)
43 sim.writeVTKall()
44
45 # if gravity is enabled, read last output file, place the sediment in a large
46 # box, and restart time
47 if gravity == 1:
48 sim.readlast()
49 sim.sid = 'cap-cohesion=' + str(cohesion)
50 sim.defaultParams(capillaryCohesion=cohesion)
51 sim.adjustUpperWall()
52 init_lx = sim.L[0]
53 init_ly = sim.L[1]
54 sim.L[0] *= 5
55 sim.L[1] *= 5
56 sim.num[0] *= 5
57 sim.num[1] *= 5
58 sim.x[:,0] += 0.5*sim.L[0] - 0.5*init_lx
59 sim.x[:,1] += 0.5*sim.L[1] - 0.5*init_ly
60
61 sim.initTemporal(2.0, file_dt=0.01, epsilon=0.07)
62 sim.run(dry=True)
63 sim.run(device=device)
64 sim.writeVTKall()