Skip to content
GitLab
Menu
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
ad3473ed
Commit
ad3473ed
authored
Oct 16, 2020
by
Jonathan Lambrechts
Browse files
remove state in all .py files
parent
8668533f
Pipeline
#8535
failed with stages
in 1 minute and 33 seconds
Changes
45
Pipelines
1
Show whitespace changes
Inline
Side-by-side
testcases/avalanch/avalanch1fluid/avalanch1fluidfriction.py
View file @
ad3473ed
...
@@ -82,7 +82,7 @@ fluid.set_wall_boundary("Left")
...
@@ -82,7 +82,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 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
.
state
(),
p
.
contact_forces
(),
init
=
True
)
fluid
.
set_particles
(
p
.
mass
(),
p
.
volume
(),
p
.
position
(),
p
.
velocity
(),
p
.
contact_forces
(),
init
=
True
)
# Write output files for post-visualization.
# Write output files for post-visualization.
fluid
.
export_vtk
(
outputdir
,
0
,
0
)
fluid
.
export_vtk
(
outputdir
,
0
,
0
)
...
...
testcases/avalanch/avalanch1fluid/avalanch1fluidnofriction.py
View file @
ad3473ed
...
@@ -113,7 +113,7 @@ fluid.set_strong_boundary("Top",1,0)
...
@@ -113,7 +113,7 @@ fluid.set_strong_boundary("Top",1,0)
fluid
.
set_strong_boundary
(
"Left"
,
0
,
0
)
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
.
state
(),
p
.
contact_forces
(),
init
=
True
)
fluid
.
set_particles
(
p
.
mass
(),
p
.
volume
(),
p
.
position
(),
p
.
velocity
(),
p
.
contact_forces
(),
init
=
True
)
# Pressure initialization
# Pressure initialization
fluid
.
solution
()[:,
2
]
=
(
H
-
fluid
.
coordinates
()[:,
1
])
*
(
-
g
[
1
])
*
rhof
fluid
.
solution
()[:,
2
]
=
(
H
-
fluid
.
coordinates
()[:,
1
])
*
(
-
g
[
1
])
*
rhof
# Write output files for post-visualization.
# Write output files for post-visualization.
...
...
testcases/avalanch/avalanch2fluids/avalanch2fluids.py
View file @
ad3473ed
...
@@ -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
.
state
(),
p
.
contact_forces
(),
init
=
True
)
fluid
.
set_particles
(
p
.
mass
(),
p
.
volume
(),
p
.
position
(),
p
.
velocity
(),
p
.
contact_forces
(),
init
=
True
)
#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
()
...
...
testcases/avalanch/avalanch2fluids/avalanch2fluidsnofriction.py
View file @
ad3473ed
...
@@ -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
.
state
(),
p
.
contact_forces
(),
init
=
True
)
fluid
.
set_particles
(
p
.
mass
(),
p
.
volume
(),
p
.
position
(),
p
.
velocity
(),
p
.
contact_forces
(),
init
=
True
)
# 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
()
...
...
testcases/couette-2d/couette.py
View file @
ad3473ed
...
@@ -117,7 +117,7 @@ fluid.set_wall_boundary("Outer",velocity=[0,0],pressure=0)
...
@@ -117,7 +117,7 @@ fluid.set_wall_boundary("Outer",velocity=[0,0],pressure=0)
fluid
.
set_strong_boundary
(
"Inner"
,
0
,
lambda
x
:
(
x
[:,
1
]
/
rout
)
*
0.1
)
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
.
state
(),
p
.
contact_forces
(),
init
=
True
)
fluid
.
set_particles
(
p
.
mass
(),
p
.
volume
(),
p
.
position
(),
p
.
velocity
(),
p
.
contact_forces
(),
init
=
True
)
fluid
.
export_vtk
(
outputdir
,
0
,
0
)
fluid
.
export_vtk
(
outputdir
,
0
,
0
)
tic
=
time
.
time
()
tic
=
time
.
time
()
#
#
...
...
testcases/depot-2d/depot.py
View file @
ad3473ed
...
@@ -109,7 +109,7 @@ fluid.set_wall_boundary("Bottom")
...
@@ -109,7 +109,7 @@ fluid.set_wall_boundary("Bottom")
fluid
.
set_wall_boundary
(
"Lateral"
)
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
.
state
(),
p
.
contact_forces
(),
init
=
True
)
fluid
.
set_particles
(
p
.
mass
(),
p
.
volume
(),
p
.
position
(),
p
.
velocity
(),
p
.
contact_forces
(),
init
=
True
)
fluid
.
export_vtk
(
outputdir
,
0
,
0
)
fluid
.
export_vtk
(
outputdir
,
0
,
0
)
p
.
write_vtk
(
outputdir
,
0
,
0
)
p
.
write_vtk
(
outputdir
,
0
,
0
)
...
...
testcases/depot-3d/depot.py
View file @
ad3473ed
...
@@ -104,7 +104,7 @@ fluid.set_wall_boundary("Bottom")
...
@@ -104,7 +104,7 @@ fluid.set_wall_boundary("Bottom")
fluid
.
set_wall_boundary
(
"X"
)
fluid
.
set_wall_boundary
(
"X"
)
fluid
.
set_wall_boundary
(
"Z"
)
fluid
.
set_wall_boundary
(
"Z"
)
#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
.
state
(),
p
.
contact_forces
(),
init
=
True
)
fluid
.
set_particles
(
p
.
mass
(),
p
.
volume
(),
p
.
position
(),
p
.
velocity
(),
p
.
contact_forces
(),
init
=
True
)
tic
=
time
.
time
()
tic
=
time
.
time
()
fluid
.
export_vtk
(
outputdir
,
0
,
0
)
fluid
.
export_vtk
(
outputdir
,
0
,
0
)
...
...
testcases/deprecated/hydro-quebec-2d/run.py
View file @
ad3473ed
...
@@ -80,7 +80,7 @@ ii = 0
...
@@ -80,7 +80,7 @@ ii = 0
mv
.
velocity
=
-
1
/
tEnd
mv
.
velocity
=
-
1
/
tEnd
p
.
setBoundaryVelocity
(
"Pile"
,
[
0
,
mv
.
velocity
])
p
.
setBoundaryVelocity
(
"Pile"
,
[
0
,
mv
.
velocity
])
fluid
.
set_particles
(
p
.
mass
(),
p
.
volume
(),
p
.
state
())
fluid
.
set_particles
(
p
.
mass
(),
p
.
volume
(),
p
.
position
(),
p
.
velocity
())
p
.
write_vtk
(
outputdir
,
ii
,
t
)
p
.
write_vtk
(
outputdir
,
ii
,
t
)
p
.
write_boundary_vtk
(
outputdir
,
ii
,
t
)
p
.
write_boundary_vtk
(
outputdir
,
ii
,
t
)
fluid
.
write_solution
(
outputdir
,
ii
,
t
,
"vtk"
)
fluid
.
write_solution
(
outputdir
,
ii
,
t
,
"vtk"
)
...
@@ -91,7 +91,7 @@ while t < tEnd :
...
@@ -91,7 +91,7 @@ while t < tEnd :
forces
=
fluid
.
solve
()
forces
=
fluid
.
solve
()
p
.
iterate
(
dt
,
forces
)
p
.
iterate
(
dt
,
forces
)
fluid
.
set_mesh_position
(
fluid
.
mesh_position
()
+
mv
.
call
(
fluid
.
mesh_position
())
*
dt
)
fluid
.
set_mesh_position
(
fluid
.
mesh_position
()
+
mv
.
call
(
fluid
.
mesh_position
())
*
dt
)
fluid
.
set_particles
(
p
.
mass
(),
p
.
volume
(),
p
.
state
())
fluid
.
set_particles
(
p
.
mass
(),
p
.
volume
(),
p
.
position
(),
p
.
velocity
())
mv
.
position
+=
dt
*
mv
.
velocity
mv
.
position
+=
dt
*
mv
.
velocity
t
+=
dt
t
+=
dt
ii
+=
1
ii
+=
1
...
...
testcases/deprecated/hydro-quebec-3d/run.py
View file @
ad3473ed
...
@@ -83,7 +83,7 @@ mv.position = 0.5
...
@@ -83,7 +83,7 @@ mv.position = 0.5
t
=
0
t
=
0
ii
=
0
ii
=
0
fluid
.
set_particles
(
p
.
mass
(),
p
.
volume
(),
p
.
state
())
fluid
.
set_particles
(
p
.
mass
(),
p
.
volume
(),
p
.
position
(),
p
.
velocity
())
p
.
write
(
outputdir
,
ii
,
t
)
p
.
write
(
outputdir
,
ii
,
t
)
fluid
.
write_solution
(
outputdir
,
ii
,
t
)
fluid
.
write_solution
(
outputdir
,
ii
,
t
)
fluid
.
write_position
(
outputdir
,
ii
,
t
)
fluid
.
write_position
(
outputdir
,
ii
,
t
)
...
@@ -96,7 +96,7 @@ while t < tEnd :
...
@@ -96,7 +96,7 @@ while t < tEnd :
forces
=
fluid
.
solve
()
forces
=
fluid
.
solve
()
p
.
iterate
(
dt
,
forces
)
p
.
iterate
(
dt
,
forces
)
fluid
.
set_mesh_position
(
fluid
.
mesh_position
()
+
mv
.
cb
(
fluid
.
mesh_position
())
*
dt
)
fluid
.
set_mesh_position
(
fluid
.
mesh_position
()
+
mv
.
cb
(
fluid
.
mesh_position
())
*
dt
)
fluid
.
set_particles
(
p
.
mass
(),
p
.
volume
(),
p
.
state
())
fluid
.
set_particles
(
p
.
mass
(),
p
.
volume
(),
p
.
position
(),
p
.
velocity
())
mv
.
position
+=
dt
*
mv
.
velocity
mv
.
position
+=
dt
*
mv
.
velocity
t
+=
dt
t
+=
dt
ii
+=
1
ii
+=
1
...
...
testcases/drag-2d/drag.py
View file @
ad3473ed
...
@@ -54,12 +54,11 @@ filename = outputdir + "/Drag.csv"
...
@@ -54,12 +54,11 @@ filename = outputdir + "/Drag.csv"
#Injected particles
#Injected particles
p
=
scontact
.
ParticleProblem
(
2
,
True
,
True
)
p
=
scontact
.
ParticleProblem
(
2
,
True
,
True
)
p
.
read_vtk
(
"depot/outputNotOk"
,
10
)
p
.
read_vtk
(
"depot/outputNotOk"
,
10
)
p
.
remove_particles_flag
((
p
.
state
().
x
[:,
1
]
-
p
.
r
()[:,
0
]
>
0.5
)
*
(
p
.
state
().
x
[:,
1
]
+
p
.
r
()[:,
0
]
<
0.61
))
p
.
remove_particles_flag
((
p
.
position
()
[:,
1
]
-
p
.
r
()[:,
0
]
>
0.5
)
*
(
p
.
position
()
[:,
1
]
+
p
.
r
()[:,
0
]
<
0.61
))
#Flow particles
#Flow particles
p2
=
scontact
.
ParticleProblem
(
2
,
True
,
True
)
p2
=
scontact
.
ParticleProblem
(
2
,
True
,
True
)
p2
.
read_vtk
(
"depot/outputNotOk"
,
10
)
p2
.
read_vtk
(
"depot/outputNotOk"
,
10
)
state2
=
p2
.
state
()
p2
.
remove_particles_flag
(
p2
.
position
()[:,
1
]
+
p2
.
r
()[:,
0
]
<
0.5
)
p2
.
remove_particles_flag
(
state2
.
x
[:,
1
]
+
p2
.
r
()[:,
0
]
<
0.5
)
p2
.
clear_boundaries
()
p2
.
clear_boundaries
()
p2
.
load_msh_boundaries
(
"mesh.msh"
,
[
"Inner"
,
"Left"
,
"Right"
],
material
=
"Steel"
)
p2
.
load_msh_boundaries
(
"mesh.msh"
,
[
"Inner"
,
"Left"
,
"Right"
],
material
=
"Steel"
)
p2
.
set_friction_coefficient
(
0.3
,
"Sand"
,
"Sand"
)
p2
.
set_friction_coefficient
(
0.3
,
"Sand"
,
"Sand"
)
...
@@ -75,7 +74,7 @@ p2.write_vtk(outputdir, 0, 0)
...
@@ -75,7 +74,7 @@ p2.write_vtk(outputdir, 0, 0)
#fluid.set_wall_boundary("Right", velocity = [0,0])
#fluid.set_wall_boundary("Right", velocity = [0,0])
#fluid.set_open_boundary("Bottom", velocity = [0,vit])
#fluid.set_open_boundary("Bottom", velocity = [0,vit])
#fluid.set_open_boundary("Top",pressure = 0)
#fluid.set_open_boundary("Top",pressure = 0)
#fluid.set_particles(p2.mass(), p2.volume(),
state2
, p2.contact_forces(),init=True)
#fluid.set_particles(p2.mass(), p2.volume(),
p2.position(), p2.velocity()
, p2.contact_forces(),init=True)
#fluid.export_vtk(outputdir, 0.,0)
#fluid.export_vtk(outputdir, 0.,0)
#
#
# COMPUTATION LOOP
# COMPUTATION LOOP
...
@@ -83,17 +82,15 @@ p2.write_vtk(outputdir, 0, 0)
...
@@ -83,17 +82,15 @@ p2.write_vtk(outputdir, 0, 0)
def
accumulate
(
F
,
nsub
):
def
accumulate
(
F
,
nsub
):
F
+=
np
.
sum
(
p2
.
get_boundary_forces
(
"Inner"
),
axis
=
0
)
/
nsub
F
+=
np
.
sum
(
p2
.
get_boundary_forces
(
"Inner"
),
axis
=
0
)
/
nsub
while
t
<
tEnd
:
while
t
<
tEnd
:
state2
=
p2
.
state
()
p2
.
forced_flag
()[(
p2
.
position
()[:,
1
]
+
p2
.
r
()[:,
0
]
<=
-
0.5
)]
=
1
p2
.
forced_flag
()[(
state2
.
x
[:,
1
]
+
p2
.
r
()[:,
0
]
<=
-
0.5
)]
=
1
if
t
>
2
:
if
t
>
2
:
state2
.
v
[
p2
.
forced_flag
()
==
1
,:]
=
[
0
,
vit
]
p2
.
velocity
()
[
p2
.
forced_flag
()
==
1
,:]
=
[
0
,
vit
]
else
:
else
:
state2
.
v
[
p2
.
forced_flag
()
==
1
,:]
=
[
0
,
0
]
p2
.
velocity
()[
p2
.
forced_flag
()
==
1
,:]
=
[
0
,
0
]
state2
.
omega
[
p2
.
forced_flag
()
==
0
]
=
1
p2
.
omega
()[
p2
.
forced_flag
()
==
0
]
=
1
p2
.
set_state
(
state2
)
if
max
(
p2
.
position
()[:,
1
]
+
p2
.
r
()[:,
0
])
<
0.5
and
t
<
9
:
if
max
(
p2
.
state
().
x
[:,
1
]
+
p2
.
r
()[:,
0
])
<
0.5
and
t
<
9
:
p2
.
add_particles
(
p
.
position
(),
p
.
r
(),
p
.
mass
(),
v
=
p
.
velocity
(),
tag
=
"Sand"
,
forced
=
p
.
forced_flag
(),
contact_forces
=
p
.
contact_forces
())
p2
.
add_particles
(
p
.
state
().
x
,
p
.
r
(),
p
.
mass
(),
v
=
p
.
state
().
v
,
tag
=
"Sand"
,
forced
=
p
.
forced_flag
(),
contact_forces
=
p
.
contact_forces
())
p2
.
remove_particles_flag
(
(
p2
.
position
()[:,
1
]
+
p2
.
r
()[:,
0
]
>-
0.55
))
p2
.
remove_particles_flag
(
(
p2
.
state
().
x
[:,
1
]
+
p2
.
r
()[:,
0
]
>-
0.55
))
F
=
np
.
zeros
(
2
)
F
=
np
.
zeros
(
2
)
#time_integration.particle_changed(fluid,p2)
#time_integration.particle_changed(fluid,p2)
time_integration
.
iterate
(
None
,
p2
,
dt
,
1
,
contact_tol
=
5e-7
,
external_particles_forces
=
g
*
p2
.
mass
(),
after_sub_iter
=
lambda
nsub
:
accumulate
(
F
,
nsub
))
time_integration
.
iterate
(
None
,
p2
,
dt
,
1
,
contact_tol
=
5e-7
,
external_particles_forces
=
g
*
p2
.
mass
(),
after_sub_iter
=
lambda
nsub
:
accumulate
(
F
,
nsub
))
...
...
testcases/drag-3d/drag.py
View file @
ad3473ed
...
@@ -60,14 +60,12 @@ filename = outputdir + "/Drag.csv"
...
@@ -60,14 +60,12 @@ filename = outputdir + "/Drag.csv"
#Injected particles
#Injected particles
p
=
scontact
.
ParticleProblem
(
3
,
True
,
True
)
p
=
scontact
.
ParticleProblem
(
3
,
True
,
True
)
p
.
read_vtk
(
"depot/"
+
str
(
numDep
),
2
)
p
.
read_vtk
(
"depot/"
+
str
(
numDep
),
2
)
p
.
remove_particles_flag
((
p
.
state
().
x
[:,
1
]
-
p
.
r
()[:,
0
]
>
0.5
)
*
(
p
.
state
().
x
[:,
1
]
+
p
.
r
()[:,
0
]
<
0.52
))
p
.
remove_particles_flag
((
p
.
position
()[:,
1
]
-
p
.
r
()[:,
0
]
>
0.5
)
*
(
p
.
position
()[:,
1
]
+
p
.
r
()[:,
0
]
<
0.52
))
state
=
p
.
state
()
p
.
velocity
()[:,
1
]
=
vit
state
.
v
[:,
1
]
=
vit
p
.
set_state
(
state
)
#Flow particles
#Flow particles
p2
=
scontact
.
ParticleProblem
(
3
,
True
,
True
)
p2
=
scontact
.
ParticleProblem
(
3
,
True
,
True
)
p
.
read_vtk
(
"depot/"
+
str
(
numDep
),
2
)
p
.
read_vtk
(
"depot/"
+
str
(
numDep
),
2
)
p2
.
remove_particles_flag
(
p2
.
state
().
x
[:,
1
]
+
p2
.
r
()[:,
0
]
<
0.5
)
p2
.
remove_particles_flag
(
p2
.
position
()
[:,
1
]
+
p2
.
r
()[:,
0
]
<
0.5
)
p2
.
clear_boundaries
()
p2
.
clear_boundaries
()
p2
.
load_msh_boundaries
(
"mesh.msh"
,
[
"Inner"
,
"Left"
,
"Right"
,
"Front"
,
"Rear"
],
material
=
"Steel"
)
p2
.
load_msh_boundaries
(
"mesh.msh"
,
[
"Inner"
,
"Left"
,
"Right"
,
"Front"
,
"Rear"
],
material
=
"Steel"
)
p2
.
set_friction_coefficient
(
mupart
,
"Sand"
,
"Sand"
)
p2
.
set_friction_coefficient
(
mupart
,
"Sand"
,
"Sand"
)
...
@@ -93,14 +91,12 @@ p2.write_vtk(outputdir, 0, 0)
...
@@ -93,14 +91,12 @@ p2.write_vtk(outputdir, 0, 0)
def
accumulate
(
F
,
nsub
):
def
accumulate
(
F
,
nsub
):
F
+=
np
.
sum
(
p2
.
get_boundary_forces
(
"Inner"
),
axis
=
0
)
/
nsub
F
+=
np
.
sum
(
p2
.
get_boundary_forces
(
"Inner"
),
axis
=
0
)
/
nsub
while
t
<
tEnd
:
while
t
<
tEnd
:
state2
=
p2
.
state
()
p2
.
forced_flag
()[(
p2
.
position
()[:,
1
]
+
p2
.
r
()[:,
0
]
<=
-
0.5
)]
=
1
p2
.
forced_flag
()[(
state2
.
x
[:,
1
]
+
p2
.
r
()[:,
0
]
<=
-
0.5
)]
=
1
p2
.
velocity
()[
p2
.
forced_flag
()
==
1
,:]
=
[
0
,
vit
,
0
]
state2
.
v
[
p2
.
forced_flag
()
==
1
,:]
=
[
0
,
vit
,
0
]
p2
.
omega
()[
p2
.
forced_flag
()
==
1
,:]
=
[
0
,
0
,
0
]
state2
.
omega
[
p2
.
forced_flag
()
==
1
,:]
=
[
0
,
0
,
0
]
if
max
(
p2
.
position
()[:,
1
]
+
p2
.
r
()[:,
0
])
<
0.5
and
t
<
21
:
p2
.
set_state
(
state2
)
p2
.
add_particles
(
p
.
position
(),
p
.
r
(),
p
.
mass
(),
v
=
p
.
velocity
(),
tag
=
"Sand"
,
forced
=
p
.
forced_flag
(),
contact_forces
=
p
.
contact_forces
())
if
max
(
p2
.
state
().
x
[:,
1
]
+
p2
.
r
()[:,
0
])
<
0.5
and
t
<
21
:
p2
.
remove_particles_flag
(
(
p2
.
position
()[:,
1
]
+
p2
.
r
()[:,
0
]
>-
0.52
))
p2
.
add_particles
(
p
.
state
().
x
,
p
.
r
(),
p
.
mass
(),
v
=
p
.
state
().
v
,
tag
=
"Sand"
,
forced
=
p
.
forced_flag
(),
contact_forces
=
p
.
contact_forces
())
p2
.
remove_particles_flag
(
(
p2
.
state
().
x
[:,
1
]
+
p2
.
r
()[:,
0
]
>-
0.52
))
F
=
np
.
zeros
(
3
)
F
=
np
.
zeros
(
3
)
#time_integration.particle_changed(fluid,p2)
#time_integration.particle_changed(fluid,p2)
time_integration
.
iterate
(
None
,
p2
,
dt
,
1
,
contact_tol
=
1e-6
,
external_particles_forces
=
g
*
p2
.
mass
(),
after_sub_iter
=
lambda
nsub
:
accumulate
(
F
,
nsub
))
time_integration
.
iterate
(
None
,
p2
,
dt
,
1
,
contact_tol
=
1e-6
,
external_particles_forces
=
g
*
p2
.
mass
(),
after_sub_iter
=
lambda
nsub
:
accumulate
(
F
,
nsub
))
...
...
testcases/drop-2d/InteractingDrops/Diag/2DiagDrops.py
View file @
ad3473ed
...
@@ -123,7 +123,7 @@ fluid.set_wall_boundary("Top", pressure=0)
...
@@ -123,7 +123,7 @@ fluid.set_wall_boundary("Top", pressure=0)
fluid
.
set_wall_boundary
(
"Bottom"
)
fluid
.
set_wall_boundary
(
"Bottom"
)
fluid
.
set_wall_boundary
(
"Lateral"
)
fluid
.
set_wall_boundary
(
"Lateral"
)
# 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
.
state
(),
p
.
contact_forces
(),
init
=
True
)
fluid
.
set_particles
(
p
.
mass
(),
p
.
volume
(),
p
.
position
(),
p
.
velocity
(),
p
.
contact_forces
(),
init
=
True
)
fluid
.
solution
()[:,
2
]
=
(
H
-
(
fluid
.
coordinates
()[:,
1
]
+
0.25
))
*
(
-
g
[
1
])
*
rho
fluid
.
solution
()[:,
2
]
=
(
H
-
(
fluid
.
coordinates
()[:,
1
]
+
0.25
))
*
(
-
g
[
1
])
*
rho
t
=
0
t
=
0
...
...
testcases/drop-2d/InteractingDrops/Vert/2VertDrops.py
View file @
ad3473ed
...
@@ -123,7 +123,7 @@ fluid.set_wall_boundary("Top", pressure=0)
...
@@ -123,7 +123,7 @@ fluid.set_wall_boundary("Top", pressure=0)
fluid
.
set_wall_boundary
(
"Bottom"
)
fluid
.
set_wall_boundary
(
"Bottom"
)
fluid
.
set_wall_boundary
(
"Lateral"
)
fluid
.
set_wall_boundary
(
"Lateral"
)
# 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
.
state
(),
p
.
contact_forces
(),
init
=
True
)
fluid
.
set_particles
(
p
.
mass
(),
p
.
volume
(),
p
.
position
(),
p
.
velocity
(),
p
.
contact_forces
(),
init
=
True
)
fluid
.
solution
()[:,
2
]
=
(
H
-
(
fluid
.
coordinates
()[:,
1
]
+
0.25
))
*
(
-
g
[
1
])
*
rho
fluid
.
solution
()[:,
2
]
=
(
H
-
(
fluid
.
coordinates
()[:,
1
]
+
0.25
))
*
(
-
g
[
1
])
*
rho
t
=
0
t
=
0
...
...
testcases/drop-2d/SimpleDrop/drop.py
View file @
ad3473ed
...
@@ -116,7 +116,7 @@ fluid.set_wall_boundary("Top", pressure=0)
...
@@ -116,7 +116,7 @@ fluid.set_wall_boundary("Top", pressure=0)
fluid
.
set_wall_boundary
(
"Bottom"
)
fluid
.
set_wall_boundary
(
"Bottom"
)
fluid
.
set_wall_boundary
(
"Lateral"
)
fluid
.
set_wall_boundary
(
"Lateral"
)
# 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
.
state
(),
p
.
contact_forces
(),
init
=
True
)
fluid
.
set_particles
(
p
.
mass
(),
p
.
volume
(),
p
.
position
(),
p
.
velocity
(),
p
.
contact_forces
(),
init
=
True
)
t
=
0
t
=
0
fluid
.
solution
()[:,
2
]
=
(
fluid
.
coordinates
()[:,
1
]
-
0.6
)
*
rho
*
g
[
1
]
fluid
.
solution
()[:,
2
]
=
(
fluid
.
coordinates
()[:,
1
]
-
0.6
)
*
rho
*
g
[
1
]
...
...
testcases/drop-2d/SimpleDrop/dropReload.py
View file @
ad3473ed
...
@@ -82,7 +82,7 @@ fluid.set_wall_boundary("Bottom")
...
@@ -82,7 +82,7 @@ fluid.set_wall_boundary("Bottom")
fluid
.
set_wall_boundary
(
"Lateral"
)
fluid
.
set_wall_boundary
(
"Lateral"
)
fluid
.
import_vtk
(
outputrel
+
"/fluid_%05d.vtu"
%
iReload
)
fluid
.
import_vtk
(
outputrel
+
"/fluid_%05d.vtu"
%
iReload
)
fluid
.
set_particles
(
p
.
mass
(),
p
.
volume
(),
p
.
state
(),
reload
=
1
)
fluid
.
set_particles
(
p
.
mass
(),
p
.
volume
(),
p
.
position
(),
p
.
velocity
(),
reload
=
1
)
ii
=
(
iReload
-
1
)
*
outf
+
1
ii
=
(
iReload
-
1
)
*
outf
+
1
t
=
ii
*
dt
t
=
ii
*
dt
...
@@ -111,7 +111,7 @@ while t < tEnd :
...
@@ -111,7 +111,7 @@ while t < tEnd :
p
.
iterate
(
dt
/
nsub
,
forces
)
p
.
iterate
(
dt
/
nsub
,
forces
)
t
+=
dt
t
+=
dt
fluid
.
set_particles
(
p
.
mass
(),
p
.
volume
(),
p
.
state
())
fluid
.
set_particles
(
p
.
mass
(),
p
.
volume
(),
p
.
position
(),
p
.
velocity
())
# Output files writting
# Output files writting
if
ii
%
outf
==
0
:
if
ii
%
outf
==
0
:
...
...
testcases/drop-3d/InteractingDrops/Diag/2DiagDrops.py
View file @
ad3473ed
...
@@ -129,7 +129,7 @@ H = 0.5
...
@@ -129,7 +129,7 @@ H = 0.5
fluid
.
solution
()[:,
3
]
=
(
H
-
(
fluid
.
coordinates
()[:,
1
]
+
0.25
))
*
(
-
g
[
1
])
*
rho
fluid
.
solution
()[:,
3
]
=
(
H
-
(
fluid
.
coordinates
()[:,
1
]
+
0.25
))
*
(
-
g
[
1
])
*
rho
# 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
.
state
(),
p
.
contact_forces
(),
init
=
True
)
fluid
.
set_particles
(
p
.
mass
(),
p
.
volume
(),
p
.
position
(),
p
.
velocity
(),
p
.
contact_forces
(),
init
=
True
)
t
=
0
t
=
0
fluid
.
export_vtk
(
outputdir
,
0
,
0
)
fluid
.
export_vtk
(
outputdir
,
0
,
0
)
...
...
testcases/drop-3d/InteractingDrops/DifferentDensities/2DDDrops.py
View file @
ad3473ed
...
@@ -139,7 +139,7 @@ H = 0.5
...
@@ -139,7 +139,7 @@ H = 0.5
fluid
.
solution
()[:,
3
]
=
(
H
-
(
fluid
.
coordinates
()[:,
1
]
+
0.25
))
*
(
-
g
[
1
])
*
rho
fluid
.
solution
()[:,
3
]
=
(
H
-
(
fluid
.
coordinates
()[:,
1
]
+
0.25
))
*
(
-
g
[
1
])
*
rho
# 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
.
state
(),
p
.
contact_forces
(),
init
=
True
)
fluid
.
set_particles
(
p
.
mass
(),
p
.
volume
(),
p
.
position
(),
p
.
velocity
(),
p
.
contact_forces
(),
init
=
True
)
t
=
0
t
=
0
fluid
.
export_vtk
(
outputdir
,
0
,
0
)
fluid
.
export_vtk
(
outputdir
,
0
,
0
)
...
...
testcases/drop-3d/InteractingDrops/Vert/2VertDrops.py
View file @
ad3473ed
...
@@ -128,7 +128,7 @@ H = 0.5
...
@@ -128,7 +128,7 @@ H = 0.5
fluid
.
solution
()[:,
3
]
=
(
H
-
(
fluid
.
coordinates
()[:,
1
]
+
0.25
))
*
(
-
g
[
1
])
*
rho
fluid
.
solution
()[:,
3
]
=
(
H
-
(
fluid
.
coordinates
()[:,
1
]
+
0.25
))
*
(
-
g
[
1
])
*
rho
# 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
.
state
(),
p
.
contact_forces
(),
init
=
True
)
fluid
.
set_particles
(
p
.
mass
(),
p
.
volume
(),
p
.
position
(),
p
.
velocity
(),
p
.
contact_forces
(),
init
=
True
)
t
=
0
t
=
0
tic
=
time
.
time
()
tic
=
time
.
time
()
...
...
testcases/drop-3d/SimpleDrop/drop.py
View file @
ad3473ed
...
@@ -114,7 +114,7 @@ fluid.set_wall_boundary("X")
...
@@ -114,7 +114,7 @@ fluid.set_wall_boundary("X")
fluid
.
set_wall_boundary
(
"Z"
)
fluid
.
set_wall_boundary
(
"Z"
)
fluid
.
solution
()[:,
3
]
=
(
fluid
.
coordinates
()[:,
1
]
-
0.6
)
*
rho
*
g
[
1
]
fluid
.
solution
()[:,
3
]
=
(
fluid
.
coordinates
()[:,
1
]
-
0.6
)
*
rho
*
g
[
1
]
# 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
.
state
(),
p
.
contact_forces
(),
init
=
True
)
fluid
.
set_particles
(
p
.
mass
(),
p
.
volume
(),
p
.
position
(),
p
.
velocity
(),
p
.
contact_forces
(),
init
=
True
)
t
=
0
t
=
0
fluid
.
export_vtk
(
outputdir
,
0
,
0
)
fluid
.
export_vtk
(
outputdir
,
0
,
0
)
...
...
testcases/funnel/depot.py
View file @
ad3473ed
...
@@ -93,11 +93,11 @@ fluid.set_wall_boundary("Lateral")
...
@@ -93,11 +93,11 @@ fluid.set_wall_boundary("Lateral")
fluid
.
set_wall_boundary
(
"Funnel"
)
fluid
.
set_wall_boundary
(
"Funnel"
)
fluid
.
set_open_boundary
(
"Hole"
,
pressure
=
0
)
fluid
.
set_open_boundary
(
"Hole"
,
pressure
=
0
)
fluid
.
set_particles
(
p
.
mass
(),
p
.
volume
(),
p
.
state
())
fluid
.
set_particles
(
p
.
mass
(),
p
.
volume
(),
p
.
position
(),
p
.
velocity
())
fluid
.
export_vtk
(
outputdir
,
0
,
0
)
fluid
.
export_vtk
(
outputdir
,
0
,
0
)
tic
=
time
.
time
()
tic
=
time
.
time
()
fluid
.
set_particles
(
p
.
mass
(),
p
.
volume
(),
p
.
state
())
fluid
.
set_particles
(
p
.
mass
(),
p
.
volume
(),
p
.
position
(),
p
.
velocity
())
while
t
<
tEnd
:
while
t
<
tEnd
:
fluid
.
implicit_euler
(
dt
)
fluid
.
implicit_euler
(
dt
)
forces
=
fluid
.
compute_node_force
(
dt
)
forces
=
fluid
.
compute_node_force
(
dt
)
...
@@ -107,7 +107,7 @@ while t < tEnd :
...
@@ -107,7 +107,7 @@ while t < tEnd :
print
(
"NSUB"
,
nsub
,
"VMAX"
,
vmax
,
"VMAX * dt"
,
vmax
*
dt
,
"r"
,
min
(
p
.
r
()))
print
(
"NSUB"
,
nsub
,
"VMAX"
,
vmax
,
"VMAX * dt"
,
vmax
*
dt
,
"r"
,
min
(
p
.
r
()))
for
i
in
range
(
nsub
)
:
for
i
in
range
(
nsub
)
:
p
.
iterate
(
dt
/
nsub
,
forces
,
1e-6
)
p
.
iterate
(
dt
/
nsub
,
forces
,
1e-6
)
fluid
.
set_particles
(
p
.
mass
(),
p
.
volume
(),
p
.
state
())
fluid
.
set_particles
(
p
.
mass
(),
p
.
volume
(),
p
.
position
(),
p
.
velocity
())
t
+=
dt
t
+=
dt
if
ii
%
outf
==
0
:
if
ii
%
outf
==
0
:
ioutput
=
int
(
ii
/
outf
)
+
1
ioutput
=
int
(
ii
/
outf
)
+
1
...
...
Prev
1
2
3
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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