thalfshear-starter-rate.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
---
thalfshear-starter-rate.py (1955B)
---
1 #!/usr/bin/env python
2 import sphere
3 import numpy
4 import sys
5
6 # launch with:
7 # $ python halfshear-starter-rate.py <DEVICE> <FLUID> <C_PHI> <C_V> <SIGMA_0> <VELOCITY FACTOR>
8
9 device = int(sys.argv[1])
10 wet = int(sys.argv[2])
11 c_phi = float(sys.argv[3])
12 c_v = float(sys.argv[4])
13 sigma0 = float(sys.argv[5])
14 velfac = float(sys.argv[6])
15
16 #sim = sphere.sim('diffusivity-sigma0=' + str(sigma0) + '-c_phi=' + \
17 # str(c_phi) + '-c_grad_p=' + str(c_grad_p), fluid=True)
18 if wet == 1:
19 fluid = True
20 else:
21 fluid = False
22
23 #sim = sphere.sim('diffusivity-sigma0=' + str(sigma0) +'-c_phi=1.0-c_grad_p=1.0',
24 # fluid=True)
25 sim = sphere.sim('halfshear-sigma0=' + str(sigma0), fluid=False)
26 print('Input: ' + sim.sid)
27 sim.readlast()
28
29 sim.fluid = fluid
30 if fluid:
31 sim.id('halfshear-sigma0=' + str(sigma0) + '-c_v=' + str(c_v) + \
32 '-velfac=' + str(velfac) + '-shear')
33 else:
34 sim.id('halfshear-sigma0=' + str(sigma0) + \
35 '-velfac=' + str(velfac) + '-shear')
36
37 sim.checkerboardColors(nx=6,ny=3,nz=6)
38 sim.cleanup()
39 sim.adjustUpperWall()
40 sim.zeroKinematics()
41
42 sim.shear(1.0/20.0 * velfac)
43
44 if fluid:
45 #sim.num[2] *= 2
46 #sim.L[2] *= 2.0
47 sim.initFluid(mu = 1.787e-6, p = 600.0e3, hydrostatic = True)
48 #sim.initFluid(mu = 17.87e-4, p = 1.0e5, hydrostatic = True)
49 sim.setFluidBottomNoFlow()
50 sim.setFluidTopFixedPressure()
51 sim.setDEMstepsPerCFDstep(100)
52 sim.setMaxIterations(2e5)
53 sim.c_phi[0] = c_phi
54 sim.c_v[0] = c_v
55
56 sim.initTemporal(total = 20.0/velfac, file_dt = 0.01/velfac, epsilon=0.07)
57 sim.w_sigma0[0] = sigma0
58 sim.w_m[0] = numpy.abs(sigma0*sim.L[0]*sim.L[1]/sim.g[2])
59 sim.mu_s[0] = 0.5
60 sim.mu_d[0] = 0.5
61 sim.setDampingNormal(0.0)
62 sim.setDampingTangential(0.0)
63
64 # Fix lowermost particles
65 #dz = sim.L[2]/sim.num[2]
66 #I = numpy.nonzero(sim.x[:,2] < 1.5*dz)
67 #sim.fixvel[I] = 1
68
69 sim.run(dry=True)
70 sim.run(device=device)
71 #sim.writeVTKall()
72 #sim.visualize('walls')
73 #sim.visualize('fluid-pressure')