Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
fluidparticles
MigFlow
Commits
f7382959
Commit
f7382959
authored
Oct 25, 2018
by
Matthieu Constant
Browse files
fix time.clock python
parent
b613f0f7
Changes
10
Hide whitespace changes
Inline
Side-by-side
testcases/avalanch/avalanch1fluid/avalanch1fluidnofriction.py
View file @
f7382959
...
...
@@ -97,7 +97,7 @@ fluid.set_weak_boundary("Right","Wall")
#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
())
fluid
.
export_vtk
(
outputdir
,
0
,
0
)
tic
=
time
.
clock
()
tic
=
time
.
time
()
fluid
.
set_particles
(
p
.
mass
(),
p
.
volume
(),
p
.
position
(),
p
.
velocity
())
#Computation loop
while
t
<
tEnd
:
...
...
@@ -128,4 +128,4 @@ while t < tEnd :
p
.
write_vtk
(
outputdir
,
ioutput
,
t
)
fluid
.
export_vtk
(
outputdir
,
t
,
ioutput
)
ii
+=
1
print
(
"%i : %.2g/%.2g (cpu %.6g)"
%
(
ii
,
t
,
tEnd
,
time
.
clock
()
-
tic
))
print
(
"%i : %.2g/%.2g (cpu %.6g)"
%
(
ii
,
t
,
tEnd
,
time
.
time
()
-
tic
))
testcases/avalanch/avalanch2fluids/avalanch2fluids.py
View file @
f7382959
...
...
@@ -58,7 +58,7 @@ def genInitialPosition(filename, N, r, lx, ly, rhop) :
[
nb_laid_particles
,
coors
]
=
pre
.
depositInBox2D
(
radii
,
lx
*
4
,
ly
/
10
)
#Add a grain at each centre position
for
i
in
range
(
nb_laid_particles
):
p
.
add_particle
(
coors
[
2
*
i
:
2
*
i
+
2
],
radii
[
i
],
radii
[
i
]
**
2
*
np
.
pi
*
rhop
)
;
p
.
add_particle
(
coors
[
2
*
i
:
2
*
i
+
2
],
radii
[
i
],
radii
[
i
]
**
2
*
np
.
pi
*
rhop
)
#Grains horizontal translation
p
.
position
()[:,
0
]
+=
0.1
...
...
@@ -66,7 +66,7 @@ def genInitialPosition(filename, N, r, lx, ly, rhop) :
radii
=
pre
.
granulo_Random
(
N
,
Ra
,
Rb
)
[
nb_laid_particles
,
coors
]
=
pre
.
depositInBox2D
(
radii
,
lx
,
ly
)
for
i
in
range
(
nb_laid_particles
):
p
.
add_particle
(
coors
[
2
*
i
:
2
*
i
+
2
],
radii
[
i
],
radii
[
i
]
**
2
*
np
.
pi
*
rhop
)
;
p
.
add_particle
(
coors
[
2
*
i
:
2
*
i
+
2
],
radii
[
i
],
radii
[
i
]
**
2
*
np
.
pi
*
rhop
)
p
.
write_vtk
(
filename
,
0
,
0
)
#Define output directory
...
...
@@ -145,7 +145,7 @@ for i in range(len(x[:,0])):
s
[
i
,
3
]
=
1
fluid
.
export_vtk
(
outputdir
,
0
,
0
)
tic
=
time
.
clock
()
tic
=
time
.
time
()
fluid
.
set_particles
(
p
.
mass
(),
p
.
volume
(),
p
.
position
(),
p
.
velocity
())
#Computation loop
while
t
<
tEnd
:
...
...
@@ -176,4 +176,4 @@ while t < tEnd :
p
.
write_vtk
(
outputdir
,
ioutput
,
t
)
fluid
.
export_vtk
(
outputdir
,
t
,
ioutput
)
ii
+=
1
print
(
"%i : %.2g/%.2g (cpu %.6g)"
%
(
ii
,
t
,
tEnd
,
time
.
clock
()
-
tic
))
print
(
"%i : %.2g/%.2g (cpu %.6g)"
%
(
ii
,
t
,
tEnd
,
time
.
time
()
-
tic
))
testcases/avalanch/avalanch2fluids/avalanch2fluidsnofriction.py
View file @
f7382959
...
...
@@ -111,7 +111,7 @@ for i in range(len(x[:,0])):
s
[
i
,
3
]
=
1
fluid
.
export_vtk
(
outputdir
,
0
,
0
)
tic
=
time
.
clock
()
tic
=
time
.
time
()
fluid
.
set_particles
(
p
.
mass
(),
p
.
volume
(),
p
.
position
(),
p
.
velocity
())
#Computation loop
while
t
<
tEnd
:
...
...
@@ -142,4 +142,4 @@ while t < tEnd :
p
.
write_vtk
(
outputdir
,
ioutput
,
t
)
fluid
.
export_vtk
(
outputdir
,
t
,
ioutput
)
ii
+=
1
print
(
"%i : %.2g/%.2g (cpu %.6g)"
%
(
ii
,
t
,
tEnd
,
time
.
clock
()
-
tic
))
print
(
"%i : %.2g/%.2g (cpu %.6g)"
%
(
ii
,
t
,
tEnd
,
time
.
time
()
-
tic
))
testcases/avalanch/depot/dep.py
View file @
f7382959
...
...
@@ -55,7 +55,7 @@ def genInitialPosition(filename, r, ly, lx, rhop) :
for
i
in
range
(
len
(
x
))
:
r1
=
np
.
random
.
uniform
(.
95
*
r
,
1.05
*
r
)
#Args : add_particles(centre, radius, mass)
p
.
add_particle
((
x
[
i
],
y
[
i
]),
r1
,
r1
**
2
*
np
.
pi
*
rhop
)
;
p
.
add_particle
((
x
[
i
],
y
[
i
]),
r1
,
r1
**
2
*
np
.
pi
*
rhop
)
p
.
write_vtk
(
outputdir
,
0
,
0
)
#Define output directory
...
...
@@ -87,7 +87,7 @@ print("r = %g, m = %g\n" % (p.r()[0], p.mass()[0]))
print
(
"RHOP = %g"
%
rhop
)
outf
=
200
#number of iterations between output files
tic
=
time
.
clock
()
tic
=
time
.
time
()
forces
=
np
.
zeros_like
(
p
.
velocity
())
#Computation loop
while
t
<
tEnd
:
...
...
@@ -108,6 +108,6 @@ while t < tEnd :
ioutput
=
int
(
ii
/
outf
)
+
1
p
.
write_vtk
(
outputdir
,
ioutput
,
t
)
ii
+=
1
print
(
"%i : %.2g/%.2g (cpu %.6g)"
%
(
ii
,
t
,
tEnd
,
time
.
clock
()
-
tic
))
print
(
"%i : %.2g/%.2g (cpu %.6g)"
%
(
ii
,
t
,
tEnd
,
time
.
time
()
-
tic
))
testcases/couette-2d/betonlmgc.py
View file @
f7382959
...
...
@@ -159,7 +159,7 @@ fluid.set_weak_boundary("Outer","Wall")
fluid
.
set_particles
(
p
.
mass
(),
p
.
volume
(),
p
.
position
(),
p
.
velocity
())
fluid
.
export_vtk
(
outputdir
,
0
,
0
)
tic
=
time
.
clock
()
tic
=
time
.
time
()
#Computation loop
fluid
.
set_particles
(
p
.
mass
(),
p
.
volume
(),
p
.
position
(),
p
.
velocity
())
while
t
<
tEnd
:
...
...
@@ -188,4 +188,4 @@ while t < tEnd :
p
.
write_vtk
(
outputdir
,
ioutput
,
t
)
fluid
.
export_vtk
(
outputdir
,
t
,
ioutput
)
ii
+=
1
print
(
"%i : %.2g/%.2g (cpu %.6g)"
%
(
ii
,
t
,
tEnd
,
time
.
clock
()
-
tic
))
print
(
"%i : %.2g/%.2g (cpu %.6g)"
%
(
ii
,
t
,
tEnd
,
time
.
time
()
-
tic
))
testcases/couette-2d/melangeur.py
View file @
f7382959
...
...
@@ -69,7 +69,7 @@ def genInitialPosition(filename, r, rout, rin, rhop) :
for
i
in
range
(
x
.
shape
[
0
])
:
if
y
[
i
]
<
0
:
rhop1
=
random
.
choice
([
rhop
*
.
9
,
1.1
*
rhop
,
rhop
])
p
.
add_particle
((
x
[
i
],
y
[
i
]),
r
,
r
**
2
*
np
.
pi
*
rhop1
)
;
p
.
add_particle
((
x
[
i
],
y
[
i
]),
r
,
r
**
2
*
np
.
pi
*
rhop1
)
p
.
write_vtk
(
filename
,
0
,
0
)
...
...
@@ -159,4 +159,4 @@ while t < tEnd :
p
.
write_vtk
(
outputdir
,
ioutput
,
t
)
fluid
.
export_vtk
(
outputdir
,
t
,
ioutput
)
ii
+=
1
print
(
"%i : %.2g/%.2g (cpu %.6g)"
%
(
ii
,
t
,
tEnd
,
time
.
clock
()
-
tic
))
print
(
"%i : %.2g/%.2g (cpu %.6g)"
%
(
ii
,
t
,
tEnd
,
time
.
time
()
-
tic
))
testcases/depot-2d/dep.py
View file @
f7382959
...
...
@@ -58,7 +58,7 @@ def genInitialPosition(filename, r, H, ly, lx, rhop) :
y
=
y
.
flat
#Add a grain at each centre position
for
i
in
range
(
len
(
x
))
:
p
.
add_particle
((
x
[
i
],
y
[
i
]),
r
,
r
**
2
*
np
.
pi
*
rhop
)
;
p
.
add_particle
((
x
[
i
],
y
[
i
]),
r
,
r
**
2
*
np
.
pi
*
rhop
)
p
.
write_vtk
(
filename
,
0
,
0
)
#Define output directory
...
...
@@ -132,7 +132,7 @@ fluid.set_particles(p.mass(), p.volume(), p.position(), p.velocity())
fluid
.
export_vtk
(
outputdir
,
0
,
0
)
tic
=
time
.
clock
()
tic
=
time
.
time
()
#Computation loop
fluid
.
set_particles
(
p
.
mass
(),
p
.
volume
(),
p
.
position
(),
p
.
velocity
())
while
t
<
tEnd
:
...
...
@@ -161,4 +161,4 @@ while t < tEnd :
p
.
write_vtk
(
outputdir
,
ioutput
,
t
)
fluid
.
export_vtk
(
outputdir
,
t
,
ioutput
)
ii
+=
1
print
(
"%i : %.2g/%.2g (cpu %.6g)"
%
(
ii
,
t
,
tEnd
,
time
.
clock
()
-
tic
))
print
(
"%i : %.2g/%.2g (cpu %.6g)"
%
(
ii
,
t
,
tEnd
,
time
.
time
()
-
tic
))
testcases/drop-2d/InteractingDrops/Diag/2DiagDrops.py
View file @
f7382959
...
...
@@ -170,7 +170,7 @@ if init:
t
=
0
fluid
.
export_vtk
(
outputdir
,
0
,
0
)
tic
=
time
.
clock
()
tic
=
time
.
time
()
#Computation loop
fluid
.
set_particles
(
p
.
mass
(),
p
.
volume
(),
p
.
position
(),
p
.
velocity
())
while
t
<
tEnd
:
...
...
@@ -201,4 +201,4 @@ while t < tEnd :
p
.
write_vtk
(
outputdir
,
ioutput
,
t
)
fluid
.
export_vtk
(
outputdir
,
t
,
ioutput
)
ii
+=
1
print
(
"%i : %.2g/%.2g (cpu %.6g)"
%
(
ii
,
t
,
tEnd
,
time
.
clock
()
-
tic
))
print
(
"%i : %.2g/%.2g (cpu %.6g)"
%
(
ii
,
t
,
tEnd
,
time
.
time
()
-
tic
))
testcases/drop-2d/InteractingDrops/Vert/2VertDrops.py
View file @
f7382959
...
...
@@ -171,7 +171,7 @@ if init:
t
=
0
fluid
.
export_vtk
(
outputdir
,
0
,
0
)
tic
=
time
.
clock
()
tic
=
time
.
time
()
#Computation loop
fluid
.
set_particles
(
p
.
mass
(),
p
.
volume
(),
p
.
position
(),
p
.
velocity
())
while
t
<
tEnd
:
...
...
@@ -202,4 +202,4 @@ while t < tEnd :
p
.
write_vtk
(
outputdir
,
ioutput
,
t
)
fluid
.
export_vtk
(
outputdir
,
t
,
ioutput
)
ii
+=
1
print
(
"%i : %.2g/%.2g (cpu %.6g)"
%
(
ii
,
t
,
tEnd
,
time
.
clock
()
-
tic
))
print
(
"%i : %.2g/%.2g (cpu %.6g)"
%
(
ii
,
t
,
tEnd
,
time
.
time
()
-
tic
))
testcases/drop-2d/SimpleDrop/drop.py
View file @
f7382959
...
...
@@ -61,7 +61,7 @@ def genInitialPosition(filename, r, rout, rhop, compacity) :
for
i
in
range
(
x
.
shape
[
0
])
:
#Add grains object with properties defined above
p
.
add_particle
((
x
[
i
]
+
2
*
random
.
uniform
(
-
e
/
2
+
r
,
e
/
2
-
r
),
y
[
i
]
+
2
*
random
.
uniform
(
-
e
/
2
+
r
,
e
/
2
-
r
)),
r
,
r
**
2
*
np
.
pi
*
rhop
)
;
p
.
add_particle
((
x
[
i
]
+
2
*
random
.
uniform
(
-
e
/
2
+
r
,
e
/
2
-
r
),
y
[
i
]
+
2
*
random
.
uniform
(
-
e
/
2
+
r
,
e
/
2
-
r
)),
r
,
r
**
2
*
np
.
pi
*
rhop
)
#Vertical shift of the grains to the top of the box
p
.
position
()[:,
1
]
+=
0.52
...
...
@@ -165,7 +165,7 @@ if init:
t
=
0
fluid
.
export_vtk
(
outputdir
,
0
,
0
)
tic
=
time
.
clock
()
tic
=
time
.
time
()
#Computation loop
fluid
.
set_particles
(
p
.
mass
(),
p
.
volume
(),
p
.
position
(),
p
.
velocity
())
while
t
<
tEnd
:
...
...
@@ -196,4 +196,4 @@ while t < tEnd :
p
.
write_vtk
(
outputdir
,
ioutput
,
t
)
fluid
.
export_vtk
(
outputdir
,
t
,
ioutput
)
ii
+=
1
print
(
"%i : %.2g/%.2g (cpu %.6g)"
%
(
ii
,
t
,
tEnd
,
time
.
clock
()
-
tic
))
print
(
"%i : %.2g/%.2g (cpu %.6g)"
%
(
ii
,
t
,
tEnd
,
time
.
time
()
-
tic
))
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment