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
e5f227f7
Commit
e5f227f7
authored
May 05, 2021
by
Jonathan Lambrechts
Browse files
Merge branch 'fix_periodic' into 'master'
Fix periodic See merge request
!20
parents
b60343a1
320a778d
Pipeline
#9344
passed with stages
in 3 minutes and 50 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
testcases/periodicTest/2D/depot.py
View file @
e5f227f7
...
...
@@ -39,16 +39,13 @@ os.chdir(dir_path)
outputdir
=
"outputDepotNP"
if
not
os
.
path
.
isdir
(
outputdir
)
:
os
.
makedirs
(
outputdir
)
subprocess
.
call
([
"gmsh"
,
"-2"
,
"meshDepot.geo"
,
"-clscale"
,
"1"
])
#subprocess.call(["gmsh", "-2", "meshDepot.geo","-clscale","1"])
t
=
0
ii
=
0
#physical parameters
# g = np.array([0.001,-0.001])
# g = np.array([0.1,-0.5]) # gravity
g
=
np
.
array
([
0.
,
-
9.81
])
# gravity
rho
=
1000
# fluid density
rhop
=
1500
# particle density
...
...
@@ -91,16 +88,16 @@ fluid.set_wall_boundary("Top",velocity=[0,0])
# fluid.set_strong_boundary("Bottom",0,0)
# if strong boundary on periodic line, it should be forced on both sides
fluid
.
set_strong_boundary
(
"Right"
,
2
,
0
)
fluid
.
set_strong_boundary
(
"Left"
,
2
,
0
)
#
fluid.set_strong_boundary("Right",2,0)
#
fluid.set_strong_boundary("Left",2,0)
ii
=
0
t
=
0
#set initial_condition
fluid
.
set_particles
(
p
.
mass
(),
p
.
volume
(),
p
.
state
(),
p
.
contact_forces
())
fluid
.
export
_vtk
(
outputdir
,
0
,
0
)
fluid
.
set_particles
(
p
.
mass
(),
p
.
volume
(),
p
.
position
(),
p
.
velocity
(),
p
.
contact_forces
())
fluid
.
write
_vtk
(
outputdir
,
0
,
0
)
G
=
np
.
zeros
((
p
.
n_particles
(),
2
))
G
[:,
1
]
=
p
.
mass
()[:,
0
]
*
g
[
1
]
...
...
@@ -109,23 +106,20 @@ ii = 0
tic
=
time
.
time
()
while
t
<
tEnd
:
#Fluid solver
oldstate
=
np
.
copy
(
p
.
state
())
time_integration
.
iterate
(
fluid
,
p
,
dt
,
min_nsub
=
5
,
external_particles_forces
=
G
)
state
=
p
.
state
()
state
.
x
[:,
0
]
=
np
.
fmod
(
state
.
x
[:,
0
],
L
)
ind
=
np
.
where
(
state
.
x
[:,
0
]
<=
0
)
state
.
x
[
ind
,
0
]
+=
L
p
.
set_state
(
state
)
p
.
position
()[:,
0
]
=
np
.
fmod
(
p
.
position
()[:,
0
],
L
)
ind
=
np
.
where
(
p
.
position
()[:,
0
]
<=
0
)
p
.
position
()[
ind
,
0
]
+=
L
fluid
.
set_particles
(
p
.
mass
(),
p
.
volume
(),
p
.
position
(),
p
.
velocity
(),
p
.
contact_forces
())
fluid
.
set_particles
(
p
.
mass
(),
p
.
volume
(),
oldstate
,
p
.
contact_forces
(),
init
=
False
)
fluid
.
set_particles
(
p
.
mass
(),
p
.
volume
(),
p
.
state
(),
p
.
contact_forces
(),
init
=
False
)
#Output files writting
t
+=
dt
if
ii
%
outf
==
0
:
ioutput
=
int
(
ii
/
outf
)
+
1
fluid
.
export
_vtk
(
outputdir
,
t
,
ioutput
)
fluid
.
write
_vtk
(
outputdir
,
ioutput
,
t
)
p
.
write_vtk
(
outputdir
,
ioutput
,
t
)
ii
+=
1
print
(
"%i : %.2g/%.2g (cpu %.6g)"
%
(
ii
,
t
,
tEnd
,
time
.
time
()
-
tic
))
...
...
testcases/periodicTest/2D/poiseuilleGrain.py
View file @
e5f227f7
...
...
@@ -96,8 +96,8 @@ ii = 0
t
=
0
#set initial_condition
fluid
.
set_particles
(
p
.
mass
(),
p
.
volume
(),
p
.
state
(),
p
.
contact_forces
())
fluid
.
export
_vtk
(
outputdir
,
0
,
0
)
fluid
.
set_particles
(
p
.
mass
(),
p
.
volume
(),
p
.
position
(),
p
.
velocity
(),
p
.
contact_forces
())
fluid
.
write
_vtk
(
outputdir
,
0
,
0
)
G
=
p
.
mass
()
*
g
ii
=
0
...
...
@@ -105,22 +105,18 @@ tic = time.time()
while
t
<
tEnd
:
# while ii < 10:
#Fluid solver
oldstate
=
np
.
copy
(
p
.
state
())
time_integration
.
iterate
(
fluid
,
p
,
dt
,
external_particles_forces
=
G
)
t
+=
dt
state
=
p
.
state
()
state
.
x
[:,
0
]
=
np
.
fmod
(
state
.
x
[:,
0
],
L
)
ind
=
np
.
where
(
state
.
x
[:,
0
]
<=
0
)
state
.
x
[
ind
,
0
]
+=
L
p
.
set_state
(
state
)
fluid
.
set_particles
(
p
.
mass
(),
p
.
volume
(),
oldstate
,
p
.
contact_forces
(),
init
=
False
)
fluid
.
set_particles
(
p
.
mass
(),
p
.
volume
(),
p
.
state
(),
p
.
contact_forces
(),
init
=
False
)
p
.
position
()[:,
0
]
=
np
.
fmod
(
p
.
position
()[:,
0
],
L
)
ind
=
p
.
position
()[:,
0
]
<=
0
p
.
position
()[
ind
,
0
]
+=
L
fluid
.
set_particles
(
p
.
mass
(),
p
.
volume
(),
p
.
position
(),
p
.
velocity
(),
p
.
contact_forces
())
#Output files writting
if
ii
%
outf
==
0
:
ioutput
=
int
(
ii
/
outf
)
+
1
fluid
.
export
_vtk
(
outputdir
,
t
,
ioutput
)
fluid
.
write
_vtk
(
outputdir
,
ioutput
,
t
)
p
.
write_vtk
(
outputdir
,
ioutput
,
t
)
ii
+=
1
print
(
"%i : %.2g/%.2g (cpu %.6g)"
%
(
ii
,
t
,
tEnd
,
time
.
time
()
-
tic
))
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