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