tpermeability-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
---
tpermeability-starter.py (1401B)
---
1 #!/usr/bin/env python
2 import sphere
3 import numpy
4 import sys
5
6 # launch with:
7 # $ python permeability-starter <DEVICE> <C_PHI> <C_GRAD_P> <DP_1, DP_2, ...>
8
9 for dp_str in sys.argv[4:]:
10
11 dp = float(dp_str)
12 device = int(sys.argv[1])
13 c_phi = float(sys.argv[2])
14 c_grad_p = float(sys.argv[3])
15
16 # Read initial configuration
17 sim = sphere.sim('diffusivity-relax')
18 sim.readlast()
19
20 sim.sid = 'permeability-dp=' + str(dp) + '-c_phi=' + str(c_phi) + \
21 '-c_grad_p=' + str(c_grad_p)
22 print(sim.sid)
23 sim.cleanup()
24
25 sim.g[2] = 0.0
26 sim.nw = 0
27 sim.initGrid()
28 sim.zeroKinematics()
29 sim.initFluid(mu = 17.87e-4, p = 1.0e5, hydrostatic=True)
30
31 # Initialize to linear hydraulic gradient
32 p_bottom = 10.0
33 p_top = p_bottom + dp
34 dz = sim.L[2]/sim.num[2]
35 for iz in range(sim.num[2]-1):
36 #z = dz*iz + 0.5*dz # cell-center z-coordinate
37 z = dz*iz
38 sim.p_f[:,:,iz] = p_bottom + dp/sim.L[2] * z
39
40 # Fix lowermost particles
41 I = numpy.nonzero(sim.x[:,2] < 1.5*dz)
42 sim.fixvel[I] = 1
43
44 sim.setFluidTopFixedPressure()
45 sim.setFluidBottomFixedPressure()
46 sim.p_f[:,:,-1] = p_top
47 sim.setDEMstepsPerCFDstep(10)
48 sim.initTemporal(total = 4.0, file_dt = 0.01, epsilon=0.07)
49 sim.c_phi[0] = c_phi
50 sim.c_grad_p[0] = c_grad_p
51
52 sim.run(dry=True)
53 sim.run(device=device)
54 #sim.writeVTKall()