ttests designed to check fluid-particle interaction terms - sphere - GPU-based … | |
git clone git://src.adamsgaard.dk/sphere | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
commit 84c23d36a1d3f1e6224370ff727a1e96b733e34f | |
parent d4498a6a19388e3df4852a8d98c457c1c0527b7e | |
Author: Anders Damsgaard <[email protected]> | |
Date: Tue, 24 Jun 2014 14:46:40 +0200 | |
ttests designed to check fluid-particle interaction terms | |
Diffstat: | |
A tests/fluid_particle_interaction.py | 55 +++++++++++++++++++++++++++++… | |
1 file changed, 55 insertions(+), 0 deletions(-) | |
--- | |
diff --git a/tests/fluid_particle_interaction.py b/tests/fluid_particle_interac… | |
t@@ -0,0 +1,55 @@ | |
+#!/usr/bin/env python | |
+import sphere | |
+from pytestutils import * | |
+ | |
+sim = sphere.sim('fluid_particle_interaction', fluid=True) | |
+sim.cleanup() | |
+ | |
+sim.defineWorldBoundaries([1.0, 1.0, 1.0], dx = 0.1) | |
+sim.initFluid() | |
+sim.rho[0] = 1000.0 # particle density = fluid density | |
+ | |
+ | |
+# No gravity, pressure gradient enforced by Dirichlet boundaries. | |
+# The particle should be sucked towards the low pressure | |
+print('# Test 1: Test pressure gradient force') | |
+sim.p_f[:,:,0] = 10.0 | |
+sim.p_f[:,:,-1] = 1.0 | |
+sim.addParticle([0.5, 0.5, 0.5], 0.05) | |
+sim.initTemporal(total=0.1, file_dt=0.01) | |
+ | |
+sim.run() | |
+#sim.writeVTKall() | |
+ | |
+sim.readlast() | |
+test(sim.vel[0,2] > 0.0, 'Particle velocity:') | |
+ | |
+ | |
+ | |
+# Sidewards gravity, homogenous pressure, Neumann boundaries. | |
+# Fluid should flow towards +x and drag particles in the same direction | |
+print('# Test 2: Test fluid drag force') | |
+sim.initFluid() | |
+sim.zeroKinematics() | |
+sim.bc_bot[0] = 2 # no-slip | |
+sim.bc_top[0] = 2 # no-slip | |
+sim.g[0] = 10.0 | |
+ | |
+sim.deleteParticle(0) | |
+sim.addParticle([0.5, 0.5, 0.75], 0.05) | |
+sim.addParticle([0.5, 0.5, 0.50], 0.05) | |
+sim.addParticle([0.5, 0.5, 0.25], 0.05) | |
+ | |
+sim.initTemporal(total=0.1, file_dt=0.01) | |
+ | |
+sim.run() | |
+#sim.writeVTKall() | |
+ | |
+sim.readlast() | |
+test(sim.v_f[:,:,:,0] > 0.0, 'Fluid velocity:') | |
+test(sim.vel[0,0] > 0.0, 'Particle 0 velocity:') | |
+test(sim.vel[1,0] > 0.0, 'Particle 1 velocity:') | |
+test(sim.vel[2,0] > 0.0, 'Particle 2 velocity:') | |
+ | |
+ | |
+#sim.cleanup() |