tcfd_inclined.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
       ---
       tcfd_inclined.py (1702B)
       ---
            1 #!/usr/bin/env python
            2 import sphere
            3 from pytestutils import *
            4 
            5 orig = sphere.sim('cfd_incl', fluid=True)
            6 orig.cleanup()
            7 #orig.defineWorldBoundaries([0.3, 0.3, 0.3], dx = 0.1)
            8 orig.defineWorldBoundaries([0.3, 0.3, 0.3], dx = 0.06)
            9 orig.initFluid(mu=8.9e-4) # inviscid "fluids" (mu=0) won't work!
           10 #orig.initTemporal(total = 0.5, file_dt = 0.05, dt = 1.0e-4)
           11 orig.initTemporal(total = 1.0e-0, file_dt = 1.0e-1, dt = 1.0e-3)
           12 orig.bc_bot[0] = 1 # No-flow, free slip BC at bottom (Neumann)
           13 #orig.bc_bot[0] = 2 # No-flow, no slip BC at bottom (Neumann)
           14 #orig.bc_top[0] = 1 # No-flow, free slip BC at top (Neumann)
           15 
           16 angle = 10.0 # slab inclination in degrees
           17 g_magnitude = 10.0
           18 orig.g[0] =  numpy.sin(numpy.radians(angle))*g_magnitude
           19 orig.g[2] = -numpy.cos(numpy.radians(angle))*g_magnitude
           20 
           21 tau_d = orig.g * orig.rho_f * orig.L[2] # analytical driving stress
           22 v_sur = tau_d * orig.L[2] / orig.mu     # analytical surface velocity
           23 
           24 # increase the max iterations for first step
           25 orig.setMaxIterations(1e5)
           26 
           27 # Homogeneous pressure, no gravity
           28 orig.run(verbose=False)
           29 orig.writeVTKall()
           30 
           31 py = sphere.sim(sid=orig.sid, fluid=True)
           32 py.readlast(verbose = False)
           33 ones = numpy.ones((orig.num))
           34 zeros = numpy.zeros((orig.num[0], orig.num[1], orig.num[2], 3))
           35 #compareNumpyArraysClose(ones, py.p_f, "Conservation of pressure:",
           36         #tolerance = 1.0e-5)
           37 #compareNumpyArraysClose(zeros, py.v_f, "Flow field:              ",
           38         #tolerance = 1.0e-5)
           39 #ideal_grad_p_z = numpy.linspace(
           40         #orig.p_f[0,0,0] + orig.L[2]*orig.rho_f*numpy.abs(orig.g[2]),
           41         #orig.p_f[0,0,-1], orig.num[2])
           42 #compareNumpyArraysClose(ideal_grad_p_z, py.p_f[0,0,:],
           43         #"Pressure gradient:\t", tolerance=1.0e2)
           44 #orig.cleanup()