tcfd_simple.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_simple.py (1184B)
       ---
            1 #!/usr/bin/env python
            2 import sphere
            3 from pytestutils import *
            4 
            5 orig = sphere.sim('cfd_simple', 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=0.0)
           10 orig.initFluid(mu=8.9e-4)
           11 #orig.initTemporal(total = 0.5, file_dt = 0.05, dt = 1.0e-4)
           12 orig.initTemporal(total = 1.0e-0, file_dt = 1.0e-1, dt = 1.0e-3)
           13 orig.bc_bot[0] = 1      # No-flow BC at bottom (Neumann)
           14 orig.g[2] = -10.0
           15 
           16 # Homogeneous pressure, no gravity
           17 orig.run(verbose=False)
           18 orig.writeVTKall()
           19 
           20 py = sphere.sim(sid=orig.sid, fluid=True)
           21 py.readlast(verbose = False)
           22 ones = numpy.ones((orig.num))
           23 zeros = numpy.zeros((orig.num[0], orig.num[1], orig.num[2], 3))
           24 #compareNumpyArraysClose(ones, py.p_f, "Conservation of pressure:",
           25         #tolerance = 1.0e-5)
           26 #compareNumpyArraysClose(zeros, py.v_f, "Flow field:              ",
           27         #tolerance = 1.0e-5)
           28 ideal_grad_p_z = numpy.linspace(
           29         orig.p_f[0,0,0] + orig.L[2]*orig.rho_f*numpy.abs(orig.g[2]),
           30         orig.p_f[0,0,-1], orig.num[2])
           31 compareNumpyArraysClose(ideal_grad_p_z, py.p_f[0,0,:],
           32         "Pressure gradient:\t", tolerance=1.0e2)
           33 #orig.cleanup()