tfluid_particle_interaction_darcy.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
       ---
       tfluid_particle_interaction_darcy.py (1611B)
       ---
            1 #!/usr/bin/env python
            2 import sphere
            3 from pytestutils import *
            4 
            5 sim = sphere.sim('fluid_particle_interaction', fluid=True)
            6 sim.cleanup()
            7 
            8 sim.defineWorldBoundaries([1.0, 1.0, 1.0], dx = 0.1)
            9 #sim.defineWorldBoundaries([1.0, 1.0, 1.0], dx = 0.25)
           10 sim.initFluid(cfd_solver = 1)
           11 
           12 
           13 # No gravity, pressure gradient enforced by Dirichlet boundaries.
           14 # The particle should be sucked towards the low pressure
           15 print('# Test 1: Test pressure gradient force')
           16 sim.p_f[:,:,-1] = 1.0
           17 #sim.addParticle([0.5, 0.5, 0.5], 0.01)
           18 sim.addParticle([0.55, 0.55, 0.55], 0.05)
           19 #sim.vel[0,2] = 1.0e-2
           20 sim.initTemporal(total=0.001, file_dt=0.0001)
           21 #sim.time_file_dt[0] = sim.time_dt[0]*1
           22 #sim.time_total[0] = sim.time_dt[0]*100
           23 
           24 #sim.g[2] = -10.
           25 sim.run(verbose=False)
           26 #sim.run()
           27 #sim.run(dry=True)
           28 #sim.run(cudamemcheck=True)
           29 #sim.writeVTKall()
           30 
           31 sim.readlast(verbose=False)
           32 test(sim.vel[0,2] < 0.0, 'Particle velocity:')
           33 
           34 sim.cleanup()
           35 
           36 
           37 # Gravity, pressure gradient enforced by Dirichlet boundaries.
           38 # The particle should be sucked towards the low pressure
           39 print('# Test 2: Test pressure gradient force from buoyancy')
           40 
           41 sim = sphere.sim('fluid_particle_interaction', fluid=True)
           42 sim.defineWorldBoundaries([1.0, 1.0, 1.0], dx = 0.1)
           43 sim.initFluid(cfd_solver = 1)
           44 sim.p_f[:,:,-1] = 0.0
           45 sim.addParticle([0.5, 0.5, 0.5], 0.01)
           46 sim.initTemporal(total=0.001, file_dt=0.0001)
           47 #sim.time_file_dt[0] = sim.time_dt[0]
           48 #sim.time_total[0] = sim.time_dt[0]
           49 
           50 sim.g[2] = -10.
           51 sim.run(verbose=False)
           52 #sim.run()
           53 #sim.run(dry=True)
           54 #sim.run(cudamemcheck=True)
           55 #sim.writeVTKall()
           56 
           57 sim.readlast(verbose=False)
           58 test(sim.vel[0,2] < 0.0, 'Particle velocity:')