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
86e8b17c
Commit
86e8b17c
authored
Jan 19, 2021
by
Nathan Coppin
Browse files
updating testcases part 1
parent
9ccc26a3
Pipeline
#8908
passed with stages
in 5 minutes and 22 seconds
Changes
49
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
testcases/drag-3d/drag.py
View file @
86e8b17c
...
@@ -74,17 +74,17 @@ p2.write_vtk(outputdir, 0, 0)
...
@@ -74,17 +74,17 @@ p2.write_vtk(outputdir, 0, 0)
#
#
# FLUID PROBLEM
# FLUID PROBLEM
#
#
#
fluid = fluid.FluidProblem(3,g,[nu*rho],[rho],drag_in_stab=0)
fluid
=
fluid
.
FluidProblem
(
3
,
g
,[
nu
*
rho
],[
rho
],
drag_in_stab
=
0
)
#
fluid.load_msh("mesh.msh")
fluid
.
load_msh
(
"mesh.msh"
)
#
fluid.set_wall_boundary("Inner")
fluid
.
set_wall_boundary
(
"Inner"
)
#
fluid.set_wall_boundary("Left", velocity = [0,0,0])
fluid
.
set_wall_boundary
(
"Left"
,
velocity
=
[
0
,
0
,
0
])
#
fluid.set_wall_boundary("Right", velocity = [0,0,0])
fluid
.
set_wall_boundary
(
"Right"
,
velocity
=
[
0
,
0
,
0
])
#
fluid.set_open_boundary("Bottom", velocity = [0,vit,0])
fluid
.
set_open_boundary
(
"Bottom"
,
velocity
=
[
0
,
vit
,
0
])
#
fluid.set_wall_boundary("Front", velocity = [0,0,0])
fluid
.
set_wall_boundary
(
"Front"
,
velocity
=
[
0
,
0
,
0
])
#
fluid.set_wall_boundary("Rear", velocity = [0,0,0])
fluid
.
set_wall_boundary
(
"Rear"
,
velocity
=
[
0
,
0
,
0
])
#
fluid.set_open_boundary("Top",pressure = 0)
fluid
.
set_open_boundary
(
"Top"
,
pressure
=
0
)
#
fluid.set_particles(p2.mass(), p2.volume(), p2.position(), p2.velocity(), p2.contact_forces()
,init=True
)
fluid
.
set_particles
(
p2
.
mass
(),
p2
.
volume
(),
p2
.
position
(),
p2
.
velocity
(),
p2
.
contact_forces
())
#
fluid.export_vtk(outputdir, 0
.
,0)
fluid
.
export_vtk
(
outputdir
,
0
,
0
)
#
#
# COMPUTATION LOOP
# COMPUTATION LOOP
#
#
...
@@ -98,16 +98,16 @@ while t < tEnd :
...
@@ -98,16 +98,16 @@ while t < tEnd :
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
.
position
(),
p
.
r
(),
p
.
mass
(),
v
=
p
.
velocity
(),
tag
=
"Sand"
,
forced
=
p
.
forced_flag
(),
contact_forces
=
p
.
contact_forces
())
p2
.
remove_particles_flag
(
(
p2
.
position
()[:,
1
]
+
p2
.
r
()[:,
0
]
>-
0.52
))
p2
.
remove_particles_flag
(
(
p2
.
position
()[:,
1
]
+
p2
.
r
()[:,
0
]
>-
0.52
))
F
=
np
.
zeros
(
3
)
F
=
np
.
zeros
(
3
)
#time_integration.particle_changed(fluid,p2
)
fluid
.
set_particles
(
p2
.
mass
(),
p2
.
volume
(),
p2
.
position
(),
p2
.
velocity
(),
p2
.
contact_forces
()
)
time_integration
.
iterate
(
None
,
p2
,
dt
,
1
,
contact_tol
=
1e-6
,
external_particles_forces
=
g
*
p2
.
mass
(),
after_sub_iter
=
lambda
n_divide
:
accumulate
(
F
,
n_divide
))
time_integration
.
iterate
(
None
,
p2
,
dt
,
1
,
contact_tol
=
1e-6
,
external_particles_forces
=
g
*
p2
.
mass
(),
after_sub_iter
=
lambda
n_divide
:
accumulate
(
F
,
n_divide
))
with
open
(
filename
,
"a"
)
as
file1
:
with
open
(
filename
,
"a"
)
as
file1
:
#
F += fluid.boundary_force()[0,:]
F
+=
fluid
.
boundary_force
()[
0
,:]
file1
.
write
(
str
(
F
[
0
])
+
";"
+
str
(
F
[
1
])
+
";"
+
str
(
F
[
2
])
+
";"
+
str
(
t
)
+
"
\n
"
)
file1
.
write
(
str
(
F
[
0
])
+
";"
+
str
(
F
[
1
])
+
";"
+
str
(
F
[
2
])
+
";"
+
str
(
t
)
+
"
\n
"
)
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
p2
.
write_vtk
(
outputdir
,
ioutput
,
t
)
p2
.
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"
%
(
ii
,
t
,
tEnd
))
print
(
"%i : %.2g/%.2g"
%
(
ii
,
t
,
tEnd
))
testcases/drop-2d/InteractingDrops/Diag/2DiagDrops.py
View file @
86e8b17c
...
@@ -123,14 +123,12 @@ fluid.set_wall_boundary("Top", pressure=0)
...
@@ -123,14 +123,12 @@ 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
.
position
(),
p
.
velocity
(),
p
.
contact_forces
(),
init
=
True
)
fluid
.
set_particles
(
p
.
mass
(),
p
.
volume
(),
p
.
position
(),
p
.
velocity
(),
p
.
contact_forces
())
fluid
.
solution
()[:,
2
]
=
(
H
-
(
fluid
.
coordinates
()[:,
1
]
+
0.25
))
*
(
-
g
[
1
])
*
rho
t
=
0
t
=
0
fluid
.
export
_vtk
(
outputdir
,
0
,
0
)
fluid
.
write
_vtk
(
outputdir
,
0
,
0
)
tic
=
time
.
time
()
tic
=
time
.
time
()
G
=
p
.
mass
()
*
g
#
#
# COMPUTATION LOOP
# COMPUTATION LOOP
#
#
...
@@ -142,12 +140,12 @@ while t < tEnd :
...
@@ -142,12 +140,12 @@ while t < tEnd :
# Adaptation of the mesh.
# Adaptation of the mesh.
if
(
ii
%
15
==
0
and
ii
!=
0
):
if
(
ii
%
15
==
0
and
ii
!=
0
):
fluid
.
adapt_mesh
(
5e-3
,
8e-4
,
50000
,
old_n_particles
=
number_p
,
old_particle_position
=
position_p
,
old_particle_volume
=
volume_p
)
fluid
.
adapt_mesh
(
5e-3
,
8e-4
,
50000
,
old_n_particles
=
number_p
,
old_particle_position
=
position_p
,
old_particle_volume
=
volume_p
)
time_integration
.
iterate
(
fluid
,
p
,
dt
,
external_particles_forces
=
G
)
time_integration
.
iterate
(
fluid
,
p
,
dt
,
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
))
testcases/drop-2d/InteractingDrops/Vert/2VertDrops.py
View file @
86e8b17c
...
@@ -123,14 +123,12 @@ fluid.set_wall_boundary("Top", pressure=0)
...
@@ -123,14 +123,12 @@ 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
.
position
(),
p
.
velocity
(),
p
.
contact_forces
(),
init
=
True
)
fluid
.
set_particles
(
p
.
mass
(),
p
.
volume
(),
p
.
position
(),
p
.
velocity
(),
p
.
contact_forces
())
fluid
.
solution
()[:,
2
]
=
(
H
-
(
fluid
.
coordinates
()[:,
1
]
+
0.25
))
*
(
-
g
[
1
])
*
rho
t
=
0
t
=
0
fluid
.
export
_vtk
(
outputdir
,
0
,
0
)
fluid
.
write
_vtk
(
outputdir
,
0
,
0
)
tic
=
time
.
time
()
tic
=
time
.
time
()
G
=
p
.
mass
()
*
g
#
#
# COMPUTATION LOOP
# COMPUTATION LOOP
#
#
...
@@ -142,12 +140,12 @@ while t < tEnd :
...
@@ -142,12 +140,12 @@ while t < tEnd :
# Adaptation of the mesh.
# Adaptation of the mesh.
if
(
ii
%
15
==
0
and
ii
!=
0
):
if
(
ii
%
15
==
0
and
ii
!=
0
):
fluid
.
adapt_mesh
(
5e-3
,
8e-4
,
50000
,
old_n_particles
=
number_p
,
old_particle_position
=
position_p
,
old_particle_volume
=
volume_p
)
fluid
.
adapt_mesh
(
5e-3
,
8e-4
,
50000
,
old_n_particles
=
number_p
,
old_particle_position
=
position_p
,
old_particle_volume
=
volume_p
)
time_integration
.
iterate
(
fluid
,
p
,
dt
,
external_particles_forces
=
G
)
time_integration
.
iterate
(
fluid
,
p
,
dt
,
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
))
testcases/drop-2d/SimpleDrop/drop.py
View file @
86e8b17c
...
@@ -119,11 +119,9 @@ fluid.set_wall_boundary("Lateral")
...
@@ -119,11 +119,9 @@ fluid.set_wall_boundary("Lateral")
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
())
t
=
0
t
=
0
fluid
.
solution
()[:,
2
]
=
(
fluid
.
coordinates
()[:,
1
]
-
0.6
)
*
rho
*
g
[
1
]
fluid
.
write_vtk
(
outputdir
,
0
,
0
)
fluid
.
export_vtk
(
outputdir
,
0
,
0
)
tic
=
time
.
time
()
tic
=
time
.
time
()
G
=
p
.
mass
()
*
g
#
#
# COMPUTATION LOOP
# COMPUTATION LOOP
#
#
...
@@ -136,13 +134,13 @@ while t < tEnd :
...
@@ -136,13 +134,13 @@ while t < tEnd :
if
(
ii
%
15
==
0
and
ii
!=
0
):
if
(
ii
%
15
==
0
and
ii
!=
0
):
fluid
.
adapt_mesh
(
2e-2
,
1e-3
,
10000
,
old_n_particles
=
number_p
,
old_particle_position
=
position_p
,
old_particle_volume
=
volume_p
)
fluid
.
adapt_mesh
(
2e-2
,
1e-3
,
10000
,
old_n_particles
=
number_p
,
old_particle_position
=
position_p
,
old_particle_volume
=
volume_p
)
time_integration
.
iterate
(
fluid
,
p
,
dt
,
external_particles_forces
=
G
)
time_integration
.
iterate
(
fluid
,
p
,
dt
,
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
))
testcases/goutte/liqDrop.py
View file @
86e8b17c
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
#!/usr/bin/env python
#!/usr/bin/env python
from
migflow
import
fluid
from
migflow
import
fluid
from
migflow
import
scontact
from
migflow
import
scontact
from
migflow
import
time_integration
import
numpy
as
np
import
numpy
as
np
import
os
import
os
...
@@ -89,13 +90,13 @@ fluid.set_concentration_cg(c)
...
@@ -89,13 +90,13 @@ fluid.set_concentration_cg(c)
#set initial_condition
#set initial_condition
fluid
.
export
_vtk
(
outputdir
,
0
,
0
)
fluid
.
write
_vtk
(
outputdir
,
0
,
0
)
ii
=
0
ii
=
0
tic
=
time
.
time
()
tic
=
time
.
time
()
while
t
<
tEnd
:
while
t
<
tEnd
:
#Fluid solver
#Fluid solver
fluid
.
implicit_euler
(
dt
)
time_integration
.
iterate
(
fluid
,
None
,
dt
)
#if (ii%11==0 and ii != 0):
#if (ii%11==0 and ii != 0):
# fluid.adapt_mesh(1e-2,1e-4,5000)
# fluid.adapt_mesh(1e-2,1e-4,5000)
t
+=
dt
t
+=
dt
...
@@ -103,5 +104,5 @@ while t < tEnd :
...
@@ -103,5 +104,5 @@ while t < tEnd :
print
(
"%i : %.2g/%.2g (cpu %.6g)"
%
(
ii
,
t
,
tEnd
,
time
.
time
()
-
tic
))
print
(
"%i : %.2g/%.2g (cpu %.6g)"
%
(
ii
,
t
,
tEnd
,
time
.
time
()
-
tic
))
if
ii
%
outf
==
0
:
if
ii
%
outf
==
0
:
ioutput
=
int
(
ii
/
outf
)
+
1
ioutput
=
int
(
ii
/
outf
)
+
1
fluid
.
export
_vtk
(
outputdir
,
t
,
ioutput
)
fluid
.
write
_vtk
(
outputdir
,
ioutput
,
t
)
ii
+=
1
ii
+=
1
testcases/hopper-2d/hopper.py
View file @
86e8b17c
...
@@ -51,7 +51,7 @@ def genInitialPosition(filename, r, rhop) :
...
@@ -51,7 +51,7 @@ def genInitialPosition(filename, r, rhop) :
p
.
write_vtk
(
outputdir
,
0
,
0
)
p
.
write_vtk
(
outputdir
,
0
,
0
)
# Physical parameters
# Physical parameters
g
=
np
.
array
([
0
,
-
9.81
])
g
=
np
.
array
([
0
,
-
9.81
])
r
=
8
e-
3
r
=
1
e-
2
rhop
=
2500
rhop
=
2500
mupart
=
0.12
mupart
=
0.12
# Numerical parameters
# Numerical parameters
...
@@ -59,7 +59,7 @@ dt = 1e-3 #time step
...
@@ -59,7 +59,7 @@ dt = 1e-3 #time step
t
=
0
#initial time
t
=
0
#initial time
tEnd
=
13
#final time
tEnd
=
13
#final time
ii
=
0
#iteration number
ii
=
0
#iteration number
outf
=
100
0
#iterations between data frames
outf
=
100
#iterations between data frames
# Define output directory
# Define output directory
outputdir
=
"output"
outputdir
=
"output"
if
not
os
.
path
.
isdir
(
outputdir
)
:
if
not
os
.
path
.
isdir
(
outputdir
)
:
...
@@ -74,11 +74,8 @@ p = scontact.ParticleProblem(2,friction_enabled = True,rotation_enabled=True)
...
@@ -74,11 +74,8 @@ p = scontact.ParticleProblem(2,friction_enabled = True,rotation_enabled=True)
p2
=
scontact
.
ParticleProblem
(
2
,
friction_enabled
=
True
,
rotation_enabled
=
True
)
p2
=
scontact
.
ParticleProblem
(
2
,
friction_enabled
=
True
,
rotation_enabled
=
True
)
p
.
read_vtk
(
outputdir
,
0
)
p
.
read_vtk
(
outputdir
,
0
)
p2
.
read_vtk
(
outputdir
,
0
)
p2
.
read_vtk
(
outputdir
,
0
)
x2
=
p2
.
position
()
x2
=
np
.
copy
(
p2
.
position
())
p2
.
remove_particles_flag
((
x2
[:,
1
]
+
p2
.
r
()[:,
0
]
<
1.15
))
p2
.
remove_particles_flag
((
x2
[:,
1
]
+
p2
.
r
()[:,
0
]
<
1.15
)
*
(
x2
[:,
1
]
+
p2
.
r
()[:,
0
]
>
1.1
)
*
(
x2
[:,
0
]
+
p2
.
r
()[:,
0
]
<
0.15
)
*
(
x2
[:,
0
]
+
p2
.
r
()[:,
0
]
>-
0.15
))
p2
.
remove_particles_flag
((
x2
[:,
1
]
+
p2
.
r
()[:,
0
]
>
1.1
))
p2
.
remove_particles_flag
((
x2
[:,
0
]
+
p2
.
r
()[:,
0
]
<
0.15
))
p2
.
remove_particles_flag
((
x2
[:,
0
]
+
p2
.
r
()[:,
0
]
>-
0.15
))
p2
.
position
()[:,
1
]
-=
0.6
p2
.
position
()[:,
1
]
-=
0.6
p
.
clear_boundaries
()
p
.
clear_boundaries
()
p
.
load_msh_boundaries
(
"mesh.msh"
,
[
"Inner"
],
material
=
"Steel"
)
p
.
load_msh_boundaries
(
"mesh.msh"
,
[
"Inner"
],
material
=
"Steel"
)
...
@@ -92,8 +89,8 @@ p.write_vtk(outputdir, 0, 0)
...
@@ -92,8 +89,8 @@ p.write_vtk(outputdir, 0, 0)
# COMPUTATION LOOP
# COMPUTATION LOOP
#
#
opened
=
0
opened
=
0
def
accumulate
(
F
,
n
sub
):
def
accumulate
(
F
,
n
divide
):
F
+=
np
.
sum
(
p
.
get_boundary_forces
(
"Inner"
),
axis
=
0
)
/
n
sub
F
+=
np
.
sum
(
p
.
get_boundary_forces
(
"Inner"
),
axis
=
0
)
/
n
divide
while
t
<
tEnd
:
while
t
<
tEnd
:
if
t
>=
3
and
opened
==
0
:
if
t
>=
3
and
opened
==
0
:
opened
=
1
opened
=
1
...
@@ -105,7 +102,7 @@ while t < tEnd :
...
@@ -105,7 +102,7 @@ while t < tEnd :
p
.
add_particles
(
p2
.
position
(),
p2
.
r
(),
p2
.
mass
(),
v
=
p2
.
velocity
(),
tag
=
"Sand"
,
forced
=
p2
.
forced_flag
(),
contact_forces
=
p2
.
contact_forces
())
p
.
add_particles
(
p2
.
position
(),
p2
.
r
(),
p2
.
mass
(),
v
=
p2
.
velocity
(),
tag
=
"Sand"
,
forced
=
p2
.
forced_flag
(),
contact_forces
=
p2
.
contact_forces
())
#Solving the contacts
#Solving the contacts
F
=
np
.
zeros
(
2
)
F
=
np
.
zeros
(
2
)
time_integration
.
iterate
(
None
,
p
,
dt
,
min_nsub
=
1
,
contact_tol
=
1e-7
,
external_particles_forces
=
g
*
p
.
mass
(),
after_sub_iter
=
lambda
n
sub
:
accumulate
(
F
,
n
sub
))
time_integration
.
iterate
(
None
,
p
,
dt
,
min_nsub
=
1
,
contact_tol
=
1e-7
,
external_particles_forces
=
g
*
p
.
mass
(),
after_sub_iter
=
lambda
n
divide
:
accumulate
(
F
,
n
divide
))
#Removing particles outside the hopper
#Removing particles outside the hopper
p
.
remove_particles_flag
(
(
p
.
position
()[:,
1
]
>-
0.6
))
p
.
remove_particles_flag
(
(
p
.
position
()[:,
1
]
>-
0.6
))
#Computing mean velocity and writing to file
#Computing mean velocity and writing to file
...
...
testcases/hopper-2d/mesh.geo
View file @
86e8b17c
...
@@ -48,8 +48,7 @@ Physical Line("LeftUp") = {23};
...
@@ -48,8 +48,7 @@ Physical Line("LeftUp") = {23};
Physical Line("LeftDown") = {21};
Physical Line("LeftDown") = {21};
Physical Line("LockDown") = {20};
Physical Line("LockDown") = {20};
Physical Line("LockUp") = {24};
Physical Line("LockUp") = {24};
Line Loop(20) = {16, 17, 18, 19, 20, 21, 22, 23, 24, 25};
Line Loop(20) = {17, 18, 19, 20, 21, 22, 23, 24};
/* Plane Surface */
/* Plane Surface */
Plane Surface(1) = {20, 10};
Plane Surface(1) = {20, 10};
Physical Surface("Domain") = {1};
Physical Surface("Domain") = {1};
...
...
testcases/hopper-3d/hopper.py
View file @
86e8b17c
...
@@ -52,14 +52,14 @@ def genInitialPosition(filename, r, rhop) :
...
@@ -52,14 +52,14 @@ def genInitialPosition(filename, r, rhop) :
p
.
write_vtk
(
outputdir
,
0
,
0
)
p
.
write_vtk
(
outputdir
,
0
,
0
)
# Physical parameters
# Physical parameters
g
=
np
.
array
([
0
,
-
9.81
,
0
])
g
=
np
.
array
([
0
,
-
9.81
,
0
])
r
=
1e-2
r
=
1.
1e-2
rhop
=
2500
rhop
=
2500
# Numerical parameters
# Numerical parameters
dt
=
1e-3
#time step
dt
=
1e-3
#time step
t
=
0
#initial time
t
=
0
#initial time
tEnd
=
40
#final time
tEnd
=
40
#final time
ii
=
0
#iteration number
ii
=
0
#iteration number
outf
=
100
0
#iterations between data frames
outf
=
100
#iterations between data frames
# Define output directory
# Define output directory
outputdir
=
"output"
outputdir
=
"output"
if
not
os
.
path
.
isdir
(
outputdir
)
:
if
not
os
.
path
.
isdir
(
outputdir
)
:
...
@@ -69,24 +69,15 @@ filename = outputdir + "/Drag.csv"
...
@@ -69,24 +69,15 @@ filename = outputdir + "/Drag.csv"
#
#
# PARTICLE PROBLEM
# PARTICLE PROBLEM
#
#
fric
=
friction
[
num
][
0
]
genInitialPosition
(
outputdir
,
r
,
rhop
)
genInitialPosition
(
outputdir
,
r
,
rhop
)
if
use_lmgc
:
p
=
scontact
.
ParticleProblem
(
3
,
friction_enabled
=
True
,
rotation_enabled
=
True
)
friction
=
0.3
#friction coefficient
p
.
set_friction_coefficient
(
0.3
,
"Sand"
,
"Sand"
)
lmgc90Interface
.
scontactTolmgc90
(
outputdir
,
3
,
0
,
fric
)
p
.
set_friction_coefficient
(
0.3
,
"Sand"
,
"Steel"
)
p
=
lmgc90Interface
.
ParticleProblem
(
3
)
else
:
p
=
scontact
.
ParticleProblem
(
3
,
friction_enabled
=
True
,
rotation_enabled
=
True
)
p
.
set_friction_coefficient
(
0.3
,
"Sand"
,
"Sand"
)
p
.
set_friction_coefficient
(
0.3
,
"Sand"
,
"Steel"
)
p2
=
scontact
.
ParticleProblem
(
3
,
friction_enabled
=
True
,
rotation_enabled
=
True
)
p2
=
scontact
.
ParticleProblem
(
3
,
friction_enabled
=
True
,
rotation_enabled
=
True
)
p
.
read_vtk
(
outputdir
,
0
)
p
.
read_vtk
(
outputdir
,
0
)
p2
.
read_vtk
(
outputdir
,
0
)
p2
.
read_vtk
(
outputdir
,
0
)
x2
=
p2
.
position
()
x2
=
p2
.
position
()
p2
.
remove_particles_flag
((
x2
[:,
1
]
+
p2
.
r
()[:,
0
]
<
1.25
))
p2
.
remove_particles_flag
((
x2
[:,
1
]
+
p2
.
r
()[:,
0
]
<
1.25
)
*
(
x2
[:,
1
]
+
p2
.
r
()[:,
0
]
>
1.1
)
*
(
x2
[:,
0
]
+
p2
.
r
()[:,
0
]
<
0.18
)
*
(
x2
[:,
0
]
+
p2
.
r
()[:,
0
]
>-
0.18
))
p2
.
remove_particles_flag
((
x2
[:,
1
]
+
p2
.
r
()[:,
0
]
>
1.1
))
p2
.
remove_particles_flag
((
x2
[:,
0
]
+
p2
.
r
()[:,
0
]
<
0.18
))
p2
.
remove_particles_flag
((
x2
[:,
0
]
+
p2
.
r
()[:,
0
]
>-
0.18
))
p2
.
position
()[:,
1
]
-=
0.5
p2
.
position
()[:,
1
]
-=
0.5
p
.
clear_boundaries
()
p
.
clear_boundaries
()
p
.
load_msh_boundaries
(
"mesh"
+
".msh"
,
[
"Inner"
,
"Right"
,
"Left"
,
"Front"
,
"Rear"
,
"LockDown"
],
material
=
"Steel"
)
p
.
load_msh_boundaries
(
"mesh"
+
".msh"
,
[
"Inner"
,
"Right"
,
"Left"
,
"Front"
,
"Rear"
,
"LockDown"
],
material
=
"Steel"
)
...
...
testcases/square/square.py
View file @
86e8b17c
...
@@ -77,7 +77,7 @@ x = fluid.coordinates()
...
@@ -77,7 +77,7 @@ x = fluid.coordinates()
c
[:]
=
0
c
[:]
=
0
c
[
np
.
logical_and
(
np
.
abs
(
x
[:,
0
])
<
R
,
np
.
abs
(
x
[:,
1
])
<
R
)]
=
1
c
[
np
.
logical_and
(
np
.
abs
(
x
[:,
0
])
<
R
,
np
.
abs
(
x
[:,
1
])
<
R
)]
=
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
()
...
@@ -91,5 +91,5 @@ while t < tEnd :
...
@@ -91,5 +91,5 @@ while t < tEnd :
print
(
"%i : %.2g/%.2g (cpu %.6g)"
%
(
ii
,
t
,
tEnd
,
time
.
time
()
-
tic
))
print
(
"%i : %.2g/%.2g (cpu %.6g)"
%
(
ii
,
t
,
tEnd
,
time
.
time
()
-
tic
))
if
ii
%
outf
==
0
:
if
ii
%
outf
==
0
:
ioutput
=
int
(
ii
/
outf
)
+
1
ioutput
=
int
(
ii
/
outf
)
+
1
fluid
.
export
_vtk
(
outputdir
,
t
,
ioutput
)
fluid
.
write
_vtk
(
outputdir
,
ioutput
,
t
)
ii
+=
1
ii
+=
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