tshear2-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
       ---
       tshear2-starter.py (1920B)
       ---
            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('cons2-20kPa', fluid=False)
           23 sim.readlast()
           24 
           25 #if sigma0 == 20.0e3 and c_phi == 1.0 and c_grad_p == 0.1:
           26 #    sim.sid = 'shear-sigma0=20000.0-c_phi=1.0-c_grad_p=0.1-hi_mu-lo_visc-hw-noshear'
           27 #    sim.readlast()
           28 
           29 if fluid:
           30     sim.id('shear2-sigma0=' + str(sigma0) + '-c_phi=' + str(c_phi) + \
           31             '-c_grad_p=' + str(c_grad_p) + '-hi_mu-lo_visc-hw')
           32 else:
           33     sim.id('shear2-sigma0=' + str(sigma0) + '-hw')
           34 
           35 print(sim.sid)
           36 sim.fluid = fluid
           37 
           38 sim.checkerboardColors(nx=6,ny=6,nz=6)
           39 sim.cleanup()
           40 sim.adjustUpperWall()
           41 sim.zeroKinematics()
           42 
           43 sim.shear(1.0/20.0)
           44 #sim.shear(0.0)
           45 
           46 if fluid:
           47     #sim.num[2] *= 2
           48     #sim.L[2] *= 2.0
           49     sim.initFluid(mu = 1.787e-6, p = 600.0e3, hydrostatic = True)
           50     #sim.initFluid(mu = 17.87e-4, p = 1.0e5, hydrostatic = True)
           51     sim.setFluidBottomNoFlow()
           52     sim.setFluidTopFixedPressure()
           53     sim.setDEMstepsPerCFDstep(10)
           54     sim.setMaxIterations(2e5)
           55     sim.c_phi[0] = c_phi
           56     sim.c_grad_p[0] = c_grad_p
           57     sim.w_sigma0[0] = sigma0
           58 
           59 sim.initTemporal(total = 20.0, file_dt = 0.01, epsilon=0.07)
           60 #sim.initTemporal(total = 20.0, file_dt = 0.01, epsilon=0.05)
           61 sim.w_m[0] = numpy.abs(sigma0*sim.L[0]*sim.L[1]/sim.g[2])
           62 sim.mu_s[0] = 0.5
           63 sim.mu_d[0] = 0.5
           64 
           65 # Fix lowermost particles
           66 dz = sim.L[2]/sim.num[2]
           67 I = numpy.nonzero(sim.x[:,2] < 1.5*dz)
           68 sim.fixvel[I] = 1
           69 
           70 sim.run(dry=True)
           71 sim.run(device=device)
           72 #sim.writeVTKall()
           73 #sim.visualize('walls')
           74 #sim.visualize('fluid-pressure')