Commit 86e8b17c authored by Nathan Coppin's avatar Nathan Coppin
Browse files

updating testcases part 1

parent 9ccc26a3
Pipeline #8908 passed with stages
in 5 minutes and 22 seconds
...@@ -108,7 +108,9 @@ static void particleBoundingBox(const Particle *p, const double x[DIMENSION], do ...@@ -108,7 +108,9 @@ static void particleBoundingBox(const Particle *p, const double x[DIMENSION], do
pmax[i] = x[i] + p->r; pmax[i] = x[i] + p->r;
} }
} }
static double particleProblemGetMu(const ParticleProblem *p, int mat0, int mat1) {
return p->mu[mat0*particleProblemNMaterial(p)+mat1];
}
static void _cross (const double *a, const double *b, double *c) { static void _cross (const double *a, const double *b, double *c) {
c[0] = a[1] * b[2] - a[2] * b[1]; c[0] = a[1] * b[2] - a[2] * b[1];
c[1] = a[2] * b[0] - a[0] * b[2]; c[1] = a[2] * b[0] - a[0] * b[2];
...@@ -160,7 +162,7 @@ static int contact_init_particle_particle (Contact *c, const ParticleProblem *p, ...@@ -160,7 +162,7 @@ static int contact_init_particle_particle (Contact *c, const ParticleProblem *p,
c->r1 = p1->r; c->r1 = p1->r;
#endif #endif
c->type = PARTICLE_PARTICLE; c->type = PARTICLE_PARTICLE;
c->mu = 0; c->mu = particleProblemGetMu(p,p->particleMaterial[id0],p->particleMaterial[id1]);;
return c->D < alert; return c->D < alert;
} }
...@@ -197,11 +199,6 @@ size_t particleProblemAddBoundaryDiskTagId(ParticleProblem *p, const double x[DI ...@@ -197,11 +199,6 @@ size_t particleProblemAddBoundaryDiskTagId(ParticleProblem *p, const double x[DI
return vectorSize(p->disks) - 1; return vectorSize(p->disks) - 1;
} }
static double particleProblemGetMu(const ParticleProblem *p, int mat0, int mat1) {
return p->mu[mat0*particleProblemNMaterial(p)+mat1];
}
size_t particleProblemAddBoundaryDisk(ParticleProblem *p, const double x[DIMENSION], double r, const char *tag, const char *materialTag) { size_t particleProblemAddBoundaryDisk(ParticleProblem *p, const double x[DIMENSION], double r, const char *tag, const char *materialTag) {
return particleProblemAddBoundaryDiskTagId(p,x,r,particleProblemGetTagId(p,tag),particleProblemGetMaterialTagId(p,materialTag)); return particleProblemAddBoundaryDiskTagId(p,x,r,particleProblemGetTagId(p,tag),particleProblemGetMaterialTagId(p,materialTag));
} }
...@@ -1539,6 +1536,7 @@ size_t particleProblemGetMaterialTagId(ParticleProblem *p, const char *tag) { ...@@ -1539,6 +1536,7 @@ size_t particleProblemGetMaterialTagId(ParticleProblem *p, const char *tag) {
vectorPushN(&p->mu, n*n); vectorPushN(&p->mu, n*n);
for (int i = 0; i < n; ++i){ for (int i = 0; i < n; ++i){
for (int j = 0; j < n; ++j) { for (int j = 0; j < n; ++j) {
p->mu[i*n + j] = 0;
p->mu[i] = (i==n-1 || j== n-1) ? 0 : oldmu[i*(n-1)+j]; p->mu[i] = (i==n-1 || j== n-1) ? 0 : oldmu[i*(n-1)+j];
} }
} }
......
...@@ -82,24 +82,21 @@ fluid.set_wall_boundary("Left") ...@@ -82,24 +82,21 @@ fluid.set_wall_boundary("Left")
fluid.set_wall_boundary("Top",pressure=0) fluid.set_wall_boundary("Top",pressure=0)
fluid.set_wall_boundary("Right") fluid.set_wall_boundary("Right")
# Set locations of the grains in the mesh and compute the porosity in each computation cell. # Set locations of the grains in the mesh and compute the porosity in each computation cell.
fluid.set_particles(p.mass(), p.volume(), p.position(), p.velocity(),p.contact_forces(),init=True) fluid.set_particles(p.mass(), p.volume(), p.position(), p.velocity(),p.contact_forces())
# Write output files for post-visualization. # Write output files for post-visualization.
fluid.export_vtk(outputdir,0,0) fluid.write_vtk(outputdir,0,0)
tic = time.time() tic = time.time()
G = np.zeros((p.n_particles(),p.dim()))
G[:,1] = g[1]*p.mass()[:,0]
# #
# COMPUTATION LOOP # COMPUTATION LOOP
# #
while t < tEnd : while t < tEnd :
time_integration.iterate(fluid,p,dt,min_nsub=5,contact_tol=5e-9,external_particles_forces=G) time_integration.iterate(fluid,p,dt,min_nsub=5,external_particles_forces=g*p.mass())
t += dt t += dt
# Output files writing. # Output files writing.
if ii%outf == 0 : if ii%outf == 0 :
ioutput = int(ii/outf) + 1 ioutput = int(ii/outf) + 1
p.write_vtk(outputdir, ioutput, t) p.write_vtk(outputdir, ioutput, t)
fluid.export_vtk(outputdir, t, ioutput) fluid.write_vtk(outputdir, ioutput, t)
ii += 1 ii += 1
print("%i : %.2g/%.2g (cpu %.6g)" % (ii, t, tEnd, time.time() - tic)) print("%i : %.2g/%.2g (cpu %.6g)" % (ii, t, tEnd, time.time() - tic))
...@@ -51,7 +51,7 @@ H = 0.2 # domain height ...@@ -51,7 +51,7 @@ H = 0.2 # domain height
outf = 10 # number of iterations between output files outf = 10 # number of iterations between output files
dt = 1e-3 # time step dt = 1e-3 # time step
tEnd = 10 # final time tEnd = 10 # final time
use_pre_deposit = False # set if the deposit in ../depot/depot.py has been achieved. If false an hexagonal packing is used for the inital column use_pre_deposit = True # set if the deposit in ../depot/depot.py has been achieved. If false an hexagonal packing is used for the inital column
# #
# PARTICLES PROBLEM # PARTICLES PROBLEM
...@@ -86,7 +86,7 @@ if use_pre_deposit: ...@@ -86,7 +86,7 @@ if use_pre_deposit:
p1 = scontact.ParticleProblem(2) p1 = scontact.ParticleProblem(2)
# Use particles deposit computed by the depot.py file of "depot" folder. # Use particles deposit computed by the depot.py file of "depot" folder.
p1.read_vtk("../depot/output",25) p1.read_vtk("../depot/output",25)
p.add_particles(p1.position(),p1.r(),p1.mass(),v=p1.velocity(),tag="Sand") p.add_particles(p1.position(),p1.r(),p1.mass(),v=p1.velocity())
else: else:
r = 5e-4 # particles radius r = 5e-4 # particles radius
hexagonal_packing(0,0,0.08,0.165,0.9*r,1.1*r) hexagonal_packing(0,0,0.08,0.165,0.9*r,1.1*r)
...@@ -114,26 +114,22 @@ fluid.set_strong_boundary("Left",0,0) ...@@ -114,26 +114,22 @@ fluid.set_strong_boundary("Left",0,0)
fluid.set_strong_boundary("Right",0,0) fluid.set_strong_boundary("Right",0,0)
# Set locations of the grains in the mesh and compute the porosity in each computation cell. # Set locations of the grains in the mesh and compute the porosity in each computation cell.
fluid.set_particles(p.mass(), p.volume(), p.position(), p.velocity(), p.contact_forces()) fluid.set_particles(p.mass(), p.volume(), p.position(), p.velocity(), p.contact_forces())
# Pressure initialization
fluid.solution()[:,2] = (H-fluid.coordinates()[:,1])*(-g[1])*rhof
# Write output files for post-visualization. # Write output files for post-visualization.
fluid.export_vtk(outputdir,0,0) fluid.write_vtk(outputdir,0,0)
tic = time.time() tic = time.time()
G = np.zeros((p.n_particles(),p.dim()))
G[:,1] = g[1]*p.mass()[:,0]
# #
# COMPUTATION LOOP # COMPUTATION LOOP
# #
while t < tEnd : while t < tEnd :
time_integration.iterate(fluid, p, dt, min_nsub=10, external_particles_forces=G) time_integration.iterate(fluid, p, dt, min_nsub=10, external_particles_forces=g*p.mass())
t += dt t += dt
# Output files writing. # Output files writing.
if ii%outf == 0 : if ii%outf == 0 :
ioutput = int(ii/outf) + 1 ioutput = int(ii/outf) + 1
p.write_vtk(outputdir, ioutput, t) p.write_vtk(outputdir, ioutput, t)
fluid.export_vtk(outputdir, t, ioutput) fluid.write_vtk(outputdir, ioutput, t)
ii += 1 ii += 1
print("%i : %.2g/%.2g (cpu %.6g)" % (ii, t, tEnd, time.time() - tic)) print("%i : %.2g/%.2g (cpu %.6g)" % (ii, t, tEnd, time.time() - tic))
...@@ -85,7 +85,7 @@ if not os.path.isdir(outputdir) : ...@@ -85,7 +85,7 @@ if not os.path.isdir(outputdir) :
# Physical parameters # Physical parameters
g = np.array([0,-9.81]) # gravity g = np.array([0,-9.81]) # gravity
# Particles # Particles
r = 0.0005 # radius r = 0.0015 # radius
lx = 0.1 # particles area width lx = 0.1 # particles area width
ly = 0.18 # particles area height ly = 0.18 # particles area height
N = 15000 # number of particles N = 15000 # number of particles
...@@ -99,7 +99,7 @@ num = 1e-6 # sea water kinematic viscosity ...@@ -99,7 +99,7 @@ num = 1e-6 # sea water kinematic viscosity
# Numerical parameters # Numerical parameters
outf = 10 #number of iterations between output files outf = 10 #number of iterations between output files
dt = 1e-4 #time step dt = 1e-3 #time step
tEnd = 10 #final time tEnd = 10 #final time
# #
...@@ -130,7 +130,7 @@ fluid.set_wall_boundary("Left") ...@@ -130,7 +130,7 @@ fluid.set_wall_boundary("Left")
fluid.set_wall_boundary("Top",pressure=0) fluid.set_wall_boundary("Top",pressure=0)
fluid.set_wall_boundary("Right") fluid.set_wall_boundary("Right")
# Set location of the particles in the mesh and compute the porosity in each computation cell # Set location of the particles in the mesh and compute the porosity in each computation cell
fluid.set_particles(p.mass(), p.volume(), p.position(), p.velocity(), p.contact_forces(), init=True) fluid.set_particles(p.mass(), p.volume(), p.position(), p.velocity(), p.contact_forces())
#Access to fluid fields and node coordiantes #Access to fluid fields and node coordiantes
s = fluid.solution() s = fluid.solution()
x = fluid.coordinates() x = fluid.coordinates()
...@@ -139,22 +139,20 @@ c = np.ndarray((fluid.n_nodes())) ...@@ -139,22 +139,20 @@ c = np.ndarray((fluid.n_nodes()))
c[:] = 0 c[:] = 0
c[x[:,0]<lx] = 1 c[x[:,0]<lx] = 1
fluid.set_concentration_cg(c) fluid.set_concentration_cg(c)
fluid.export_vtk(outputdir,0,0) fluid.write_vtk(outputdir,0,0)
tic = time.time() tic = time.time()
G = np.zeros((p.n_particles(),p.dim())
G[:,1] = g[1]*p.mass()[:,0]
# #
# COMPUTATION LOOP # COMPUTATION LOOP
# #
while t < tEnd : while t < tEnd :
time_integration.iterate(fluid, p, dt, min_nsub=10, external_particles_forces=G) time_integration.iterate(fluid, p, dt, min_nsub=10, external_particles_forces=g*p.mass())
t += dt t += dt
# Output files writing # Output files writing
if ii %outf == 0 : if ii %outf == 0 :
ioutput = int(ii/outf) + 1 ioutput = int(ii/outf) + 1
p.write_vtk(outputdir, ioutput, t) p.write_vtk(outputdir, ioutput, t)
fluid.export_vtk(outputdir, t, ioutput) fluid.write_vtk(outputdir, ioutput, t)
ii += 1 ii += 1
print("%i : %.2g/%.2g (cpu %.6g)" % (ii, t, tEnd, time.time() - tic)) print("%i : %.2g/%.2g (cpu %.6g)" % (ii, t, tEnd, time.time() - tic))
...@@ -36,7 +36,7 @@ import time ...@@ -36,7 +36,7 @@ import time
import shutil import shutil
import random import random
outputdir = "output" outputdir = "output2fluids"
if not os.path.isdir(outputdir) : if not os.path.isdir(outputdir) :
os.makedirs(outputdir) os.makedirs(outputdir)
...@@ -51,8 +51,8 @@ rhom = 1050 # sea water density ...@@ -51,8 +51,8 @@ rhom = 1050 # sea water density
num = 1e-6 # sea water kinematic viscosity num = 1e-6 # sea water kinematic viscosity
# Numerical parameters # Numerical parameters
outf = 100 # number of iterations between output files outf = 10 # number of iterations between output files
dt = 1e-5 # time step dt = 1e-3 # time step
tEnd = 1 # final time tEnd = 1 # final time
# #
...@@ -83,7 +83,7 @@ fluid.set_wall_boundary("Left") ...@@ -83,7 +83,7 @@ fluid.set_wall_boundary("Left")
fluid.set_wall_boundary("Top",pressure=0) fluid.set_wall_boundary("Top",pressure=0)
fluid.set_wall_boundary("Right") fluid.set_wall_boundary("Right")
# Set location of the particles in the mesh and compute the porosity in each computation cell # Set location of the particles in the mesh and compute the porosity in each computation cell
fluid.set_particles(p.mass(), p.volume(), p.position(), p.velocity(),p.contact_forces(),init=True) fluid.set_particles(p.mass(), p.volume(), p.position(), p.velocity(),p.contact_forces())
# Access to fluid fields and node coordiantes # Access to fluid fields and node coordiantes
s = fluid.solution() s = fluid.solution()
x = fluid.coordinates() x = fluid.coordinates()
...@@ -93,22 +93,20 @@ c = np.ndarray((fluid.n_nodes())) ...@@ -93,22 +93,20 @@ c = np.ndarray((fluid.n_nodes()))
c[:] = 0 c[:] = 0
c[x[:,0]<lx] = 1 c[x[:,0]<lx] = 1
fluid.set_concentration_cg(c) fluid.set_concentration_cg(c)
fluid.export_vtk(outputdir,0,0) fluid.write_vtk(outputdir,0,0)
tic = time.time() tic = time.time()
G = np.zeros((p.n_particles(),p.dim())
G[:,1] = g[1]*p.mass()[:,0]
# #
# COMPUTATION LOOP # COMPUTATION LOOP
# #
while t < tEnd : while t < tEnd :
time_integration.iterate(fluid,p,dt,min_nsub=5,contact_tol=5e-9,external_particles_forces=G) time_integration.iterate(fluid,p,dt,min_nsub=10,external_particles_forces=g*p.mass())
t += dt t += dt
# Output files writting # Output files writting
if ii %outf == 0 : if ii %outf == 0 :
ioutput = int(ii/outf) + 1 ioutput = int(ii/outf) + 1
p.write_vtk(outputdir, ioutput, t) p.write_vtk(outputdir, ioutput, t)
fluid.export_vtk(outputdir, t, ioutput) fluid.write_vtk(outputdir, ioutput, t)
ii += 1 ii += 1
print("%i : %.2g/%.2g (cpu %.6g)" % (ii, t, tEnd, time.time() - tic)) print("%i : %.2g/%.2g (cpu %.6g)" % (ii, t, tEnd, time.time() - tic))
...@@ -57,27 +57,26 @@ p1.read_vtk("../depot/output",25) ...@@ -57,27 +57,26 @@ p1.read_vtk("../depot/output",25)
p = scontact.ParticleProblem(2,True,True) p = scontact.ParticleProblem(2,True,True)
p.load_msh_boundaries("mesh.msh", ["Top", "Bottom", "Left", "Right"],material="Steel") p.load_msh_boundaries("mesh.msh", ["Top", "Bottom", "Left", "Right"],material="Steel")
p.add_particles(p1.position(),p1.r(),p1.mass(),tag="Sand") p.add_particles(p1.position(),p1.r(),p1.mass(),tag="Sand")
#Taking friction into account
p.set_friction_coefficient(0.3,"Steel","Sand")#Wall-Particle
p.set_friction_coefficient(0.3,"Sand","Sand")#Particle-Particle
p.write_vtk(outputdir, 0, 0) p.write_vtk(outputdir, 0, 0)
#Taking friction into account
p.set_friction_coefficient(0.9,"Steel","Sand")#Wall-Particle
p.set_friction_coefficient(0.9,"Sand","Sand")#Particle-Particle
# Initial time and iteration. # Initial time and iteration.
t = 0 t = 0
ii = 0 ii = 0
outf = 5 outf = 5
G = np.zeros((p.n_particles(),p.dim()))
G[:,1] = g[1]*p.mass()[:,0]
# #
# COMPUTATION LOOP # COMPUTATION LOOP
# #
i = 0 i = 0
while t < tEnd : print(p.n_particles())
print(i) while t < tEnd :
i = i+1 i = i+1
time_integration.iterate(None,p,dt,min_nsub=20,contact_tol=2.5e-8,external_particles_forces=G) time_integration.iterate(None,p,dt,min_nsub=5,external_particles_forces=g*p.mass())
t += dt t += dt
# Output files writing. # Output files writing.
if ii%outf == 0 : if ii%outf == 0 :
......
...@@ -71,15 +71,15 @@ ii = 0 ...@@ -71,15 +71,15 @@ ii = 0
# Physical parameters # Physical parameters
g = -9.81 #gravity g = np.array([0,-9.81]) #gravity
rhop = 1500 #particles density rhop = 1500 #particles density
r = 0.5e-3 #radius r = 1.5e-3 #radius
ly = 0.2 #particles area height ly = 0.2 #particles area height
lx = 0.1 #particles area width lx = 0.1 #particles area width
tEnd = 5 #final time tEnd = 5 #final time
# Numerical parameters # Numerical parameters
dt = 1e-4 #time step dt = 5e-4 #time step
# #
# PARTICLE PROBLEM # PARTICLE PROBLEM
...@@ -90,16 +90,14 @@ p.read_vtk(outputdir,0) ...@@ -90,16 +90,14 @@ p.read_vtk(outputdir,0)
print("r = %g, m = %g\n" % (p.r()[0], p.mass()[0])) print("r = %g, m = %g\n" % (p.r()[0], p.mass()[0]))
print("RHOP = %g" % rhop) print("RHOP = %g" % rhop)
print("number of grains = %d"%len(p.r())) print("number of grains = %d"%len(p.r()))
outf = 2000 #number of iterations between output files outf = 400 #number of iterations between output files
tic = time.time() tic = time.time()
G = np.zeros((p.n_particles(),p.dim())
G[:,1] = p.mass()[:,0]*g-p.velocity()[:,1]
# #
# COMPUTATION LOOP # COMPUTATION LOOP
# #
while t < tEnd : while t < tEnd :
time_integration.iterate(None, p, dt, min_nsub=1, external_particles_forces=G) time_integration.iterate(None, p, dt, min_nsub=1, external_particles_forces=g*p.mass())
t += dt t += dt
# Output files writing # Output files writing
if ii %outf == 0 : if ii %outf == 0 :
......
...@@ -118,7 +118,7 @@ fluid.set_strong_boundary("Inner",0,lambda x : (x[:,1]/rout)*0.1) ...@@ -118,7 +118,7 @@ fluid.set_strong_boundary("Inner",0,lambda x : (x[:,1]/rout)*0.1)
fluid.set_strong_boundary("Inner",1,lambda x : (-x[:,0]/rout)*0.1) fluid.set_strong_boundary("Inner",1,lambda x : (-x[:,0]/rout)*0.1)
# Set location of the grains in the mesh and compute the porosity in each computation cell # Set location of the grains in the mesh and compute the porosity in each computation cell
fluid.set_particles(p.mass(), p.volume(), p.position(), p.velocity(), p.contact_forces()) fluid.set_particles(p.mass(), p.volume(), p.position(), p.velocity(), p.contact_forces())
fluid.export_vtk(outputdir,0,0) fluid.write_vtk(outputdir,0,0)
tic = time.time() tic = time.time()
# #
# COMPUTATION LOOP # COMPUTATION LOOP
...@@ -130,6 +130,6 @@ while t < tEnd : ...@@ -130,6 +130,6 @@ while t < tEnd :
if ii %outf == 0 : if ii %outf == 0 :
ioutput = int(ii/outf) + 1 ioutput = int(ii/outf) + 1
p.write_vtk(outputdir, ioutput, t) p.write_vtk(outputdir, ioutput, t)
fluid.export_vtk(outputdir, t, ioutput) fluid.write_vtk(outputdir, ioutput, t)
ii += 1 ii += 1
print("%i : %.2g/%.2g (cpu %.6g)" % (ii, t, tEnd, time.time()-tic)) print("%i : %.2g/%.2g (cpu %.6g)" % (ii, t, tEnd, time.time()-tic))
...@@ -69,14 +69,14 @@ if not os.path.isdir(outputdir) : ...@@ -69,14 +69,14 @@ if not os.path.isdir(outputdir) :
# Physical parameters # Physical parameters
g = np.array([0,-9.81]) # gravity g = np.array([0,-9.81]) # gravity
r = 1e-3 # particles radius r = 1.5e-3 # particles radius
rhop = 1500 # particles density rhop = 1500 # particles density
rho = 1000 # fluid density rho = 1000 # fluid density
nu = 1e-6 # kinematic viscosity nu = 1e-6 # kinematic viscosity
# Numerical parameters # Numerical parameters
outf = 5 # number of iterations between output files outf = 5 # number of iterations between output files
dt = 2.5e-3 # time step dt = 1e-3 # time step
tEnd = 100 # final time tEnd = 100 # final time
# Geometrical parameters # Geometrical parameters
...@@ -110,24 +110,21 @@ fluid.set_wall_boundary("Lateral") ...@@ -110,24 +110,21 @@ fluid.set_wall_boundary("Lateral")
fluid.set_wall_boundary("Top",pressure=0) fluid.set_wall_boundary("Top",pressure=0)
# Set location of the particles in the mesh and compute the porosity in each computation cell # Set location of the particles in the mesh and compute the porosity in each computation cell
fluid.set_particles(p.mass(), p.volume(), p.position(), p.velocity(), p.contact_forces()) fluid.set_particles(p.mass(), p.volume(), p.position(), p.velocity(), p.contact_forces())
fluid.export_vtk(outputdir,0,0) fluid.write_vtk(outputdir,0,0)
p.write_vtk(outputdir, 0, 0) p.write_vtk(outputdir, 0, 0)
tic = time.time() tic = time.time()
G = np.zeros((p.n_particles(),2))
G[:,1] = p.mass()[:,0]*g[1]
# #
# COMPUTATION LOOP # COMPUTATION LOOP
# #
while t < tEnd : while t < tEnd :
time_integration.iterate(fluid, p, dt, min_nsub=5, external_particles_forces=G) time_integration.iterate(fluid, p, dt, min_nsub=5, external_particles_forces=g*p.mass())
t += dt t += dt
# Output files writting # Output files writting
if ii %outf == 0 : if ii %outf == 0 :
ioutput = int(ii/outf) + 1 ioutput = int(ii/outf) + 1
p.write_vtk(outputdir, ioutput, t) p.write_vtk(outputdir, ioutput, t)
fluid.export_vtk(outputdir, t, ioutput) fluid.write_vtk(outputdir, ioutput, t)
ii += 1 ii += 1
print("%i : %.2g/%.2g (cpu %.6g)" % (ii, t, tEnd, time.time() - tic)) print("%i : %.2g/%.2g (cpu %.6g)" % (ii, t, tEnd, time.time() - tic))
...@@ -104,19 +104,17 @@ fluid.set_wall_boundary("Z") ...@@ -104,19 +104,17 @@ fluid.set_wall_boundary("Z")
fluid.set_particles(p.mass(), p.volume(), p.position(), p.velocity(), p.contact_forces()) fluid.set_particles(p.mass(), p.volume(), p.position(), p.velocity(), p.contact_forces())
tic = time.time() tic = time.time()
fluid.export_vtk(outputdir,0,0) fluid.write_vtk(outputdir,0,0)
G = np.zeros((p.n_particles(),p.dim()))
G[:,1] = p.mass()[:,0]*g[1]
# #
# COMPUTATION LOOP # COMPUTATION LOOP
# #
while t < tEnd : while t < tEnd :
time_integration.iterate(fluid, p, dt,min_nsub=20, contact_tol = 1e-8,external_particles_forces=G) time_integration.iterate(fluid, p, dt,min_nsub=20, contact_tol = 1e-8,external_particles_forces=g*p.mass())
t += dt t += dt
# Output files writing # Output files writing
if ii %outf == 0 : if ii %outf == 0 :
ioutput = int(ii/outf) + 1 ioutput = int(ii/outf) + 1
p.write_vtk(outputdir, ioutput, t) p.write_vtk(outputdir, ioutput, t)
fluid.export_vtk(outputdir, t, ioutput) fluid.write_vtk(outputdir, ioutput, t)
ii += 1 ii += 1
print("%i : %.2g/%.2g (cpu %.6g)" % (ii, t, tEnd, time.time() - tic))