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
Hide whitespace changes
Inline
Side-by-side
validation/darcy/darcy.py
View file @
ad3473ed
...
...
@@ -114,7 +114,7 @@ class Darcy(unittest.TestCase) :
fluid
.
set_wall_boundary
(
"Bottom"
,
velocity
=
[
0
,
0
])
fluid
.
set_wall_boundary
(
"Top"
,
velocity
=
[
0
,
0
])
fp
=
np
.
zeros_like
(
fluid
.
porosity
())
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
)
t
=
0
...
...
validation/inclined2d/inclined2d.py
View file @
ad3473ed
...
...
@@ -59,8 +59,7 @@ class Inclined2d(unittest.TestCase) :
#
vit
=
[]
ref
=
np
.
array
([
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
])
*
0.55278468635
state
=
p
.
state
()
G
=
np
.
zeros_like
(
state
.
v
)
G
=
np
.
zeros_like
(
p
.
velocity
())
G
[:,
1
]
=
g
[
1
]
*
p
.
mass
()[:,
0
]
*
cos
(
radians
(
25
))
G
[:,
0
]
=
-
g
[
1
]
*
p
.
mass
()[:,
0
]
*
sin
(
radians
(
25
))
while
t
<
tEnd
:
...
...
@@ -68,7 +67,7 @@ class Inclined2d(unittest.TestCase) :
t
+=
dt
ii
+=
1
if
ii
%
200
==
0
:
vit
.
append
(
np
.
sqrt
(
np
.
sum
(
p
.
state
().
v
**
2
)))
vit
.
append
(
np
.
sqrt
(
np
.
sum
(
p
.
velocity
()
**
2
)))
print
(
"%i : %.5g/%.5g"
%
(
ii
,
t
,
tEnd
))
error
=
max
(
abs
(
ref
-
np
.
array
(
vit
))
/
ref
)
self
.
assertLess
(
error
,.
5
/
100.
,
"error is too large in inclined2d"
)
validation/inclined3d/inclined3d.py
View file @
ad3473ed
...
...
@@ -60,8 +60,7 @@ class Inclined3d(unittest.TestCase) :
#
vit
=
[]
ref
=
np
.
array
([
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
])
*
0.59226930681
state
=
p
.
state
()
G
=
np
.
zeros_like
(
state
.
v
)
G
=
np
.
zeros_like
(
p
.
velocity
())
G
[:,
2
]
=
g
[
2
]
*
p
.
mass
()[:,
0
]
*
cos
(
radians
(
25
))
G
[:,
0
]
=
-
g
[
2
]
*
p
.
mass
()[:,
0
]
*
sin
(
radians
(
25
))
*
2
**
0.5
/
2
G
[:,
1
]
=
-
g
[
2
]
*
p
.
mass
()[:,
0
]
*
sin
(
radians
(
25
))
*
2
**
0.5
/
2
...
...
@@ -70,7 +69,7 @@ class Inclined3d(unittest.TestCase) :
t
+=
dt
ii
+=
1
if
ii
%
200
==
0
:
vit
.
append
(
np
.
sqrt
(
np
.
sum
(
p
.
state
().
v
**
2
)))
vit
.
append
(
np
.
sqrt
(
np
.
sum
(
p
.
velocity
()
**
2
)))
print
(
"%i : %.5g/%.5g"
%
(
ii
,
t
,
tEnd
))
error
=
max
(
abs
(
ref
-
np
.
array
(
vit
))
/
ref
)
self
.
assertLess
(
error
,.
5
/
100.
,
"error is too large in inclined3d"
)
validation/oneGrain/oneGrain.py
View file @
ad3473ed
...
...
@@ -86,7 +86,7 @@ class Poiseuille(unittest.TestCase) :
t
=
0
fluid
.
set_particles
(
p
.
mass
(),
p
.
volume
(),
p
.
state
(),
p
.
contact_forces
())
fluid
.
set_particles
(
p
.
mass
(),
p
.
volume
(),
p
.
position
(),
p
.
velocity
(),
p
.
contact_forces
())
fluid
.
export_vtk
(
outputdir
,
0
,
0
)
...
...
@@ -103,7 +103,7 @@ class Poiseuille(unittest.TestCase) :
p
.
write_vtk
(
outputdir
,
ioutput
,
t
)
ii
+=
1
print
(
"%i : %.2g/%.2g (cpu %.6g)"
%
(
ii
,
t
,
tEnd
,
time
.
time
()
-
tic
))
V
.
append
(
abs
(
p
.
state
().
v
[
0
,
1
]))
V
.
append
(
abs
(
p
.
velocity
()
[
0
,
1
]))
V
=
np
.
array
(
V
)
Vref
=
np
.
array
(
Vref
)
...
...
validation/weight/weight.py
View file @
ad3473ed
...
...
@@ -105,9 +105,7 @@ class Weight(unittest.TestCase) :
p
=
scontact
.
ParticleProblem
(
2
,
True
,
True
)
p
.
set_friction_coefficient
(
0.
)
p
.
read_vtk
(
outputdir
,
0
)
state
=
p
.
state
()
state
.
v
[:,
0
]
=
np
.
random
.
uniform
(
0
,
1e-3
,
state
.
v
.
shape
[
0
])
p
.
set_state
(
state
)
p
.
velocity
()[:,
0
]
=
np
.
random
.
uniform
(
0
,
1e-3
,
p
.
velocity
().
shape
[
0
])
# Initial time and iteration
t
=
0
ii
=
0
...
...
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