tdem_cfd_tests.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
       ---
       tdem_cfd_tests.py (1772B)
       ---
            1 #!/usr/bin/env python
            2 from pytestutils import *
            3 
            4 import sphere
            5 import sys
            6 import numpy
            7 import matplotlib.pyplot as plt
            8 
            9 print('### DEM/CFD tests - Dirichlet/Neumann BCs and a single particle ###')
           10 
           11 print('# No gravity')
           12 orig = sphere.sim('dem_cfd', fluid = True)
           13 cleanup(orig)
           14 orig.defaultParams(mu_s = 0.4, mu_d = 0.4)
           15 orig.addParticle([0.2, 0.2, 0.6], 0.05)
           16 orig.defineWorldBoundaries([0.4, 0.4, 1.0], dx = 0.1)
           17 orig.initFluid(mu = 8.9e-4)
           18 orig.initTemporal(total = 0.5, file_dt = 0.05, dt = 1.0e-4)
           19 py = sphere.sim(sid = orig.sid, fluid = True)
           20 orig.bc_bot[0] = 1      # No-flow BC at bottom (Neumann)
           21 #orig.run(dry=True)
           22 orig.run(verbose=False)
           23 #orig.writeVTKall()
           24 py.readlast(verbose = False)
           25 ones = numpy.ones((orig.num))
           26 zeros = numpy.zeros((orig.num[0], orig.num[1], orig.num[2], 3))
           27 compareNumpyArraysClose(ones, py.p_f, 'Conservation of pressure:',
           28         tolerance = 1.0e-1)
           29 compareNumpyArraysClose([0,0,0], py.vel[0], 'Particle velocity:\t',
           30         tolerance = 1.0e-5)
           31 compareNumpyArraysClose(zeros, py.v_f, 'Fluid velocities:\t',
           32         tolerance = 1.0e-4)
           33 
           34 print('# Gravity')
           35 orig = sphere.sim('dem_cfd', fluid = True)
           36 cleanup(orig)
           37 orig.defaultParams(mu_s = 0.4, mu_d = 0.4)
           38 orig.addParticle([0.2, 0.2, 0.6], 0.02)
           39 orig.defineWorldBoundaries([0.4, 0.4, 1], dx = 0.04)
           40 orig.initFluid(mu = 8.9e-4)
           41 #orig.initTemporal(total = 0.5, file_dt = 0.01)
           42 orig.initTemporal(total = 1.0e-4, file_dt = 1.0e-5)
           43 py = sphere.sim(sid = orig.sid, fluid = True)
           44 orig.g[2] = -10.0
           45 orig.bc_bot[0] = 1      # No-flow BC at bottom (Neumann)
           46 orig.setTolerance(1.0e-3)
           47 orig.setMaxIterations(2e4)
           48 orig.run(dry=True)
           49 orig.run(verbose=True)
           50 orig.writeVTKall()
           51 py.readlast(verbose = False)
           52 ones = numpy.ones((orig.num))
           53 zeros = numpy.zeros((orig.num[0], orig.num[1], orig.num[2], 3))