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
c408a08b
Commit
c408a08b
authored
Apr 18, 2021
by
Nathan Coppin
Browse files
adding plot.py
parent
b73b598c
Changes
1
Hide whitespace changes
Inline
Side-by-side
testcases/hopper-3d/plot.py
View file @
c408a08b
...
...
@@ -5,27 +5,32 @@ import shutil
import
random
import
csv
import
matplotlib.pyplot
as
plt
filename
=
"fric/1output005r=6e-3mu=3171/Drag.csv"
filename
=
"../../../../../media/coppinn/Maxtor/Hopper/hopper04/2/Drag.csv"
filename
=
"../../../Latex/ArticleContacts/Drag/noRelaxStressDrag64/2/Drag.csv"
with
open
(
filename
)
as
file1
:
reader
=
csv
.
reader
(
file1
,
delimiter
=
";"
,
quoting
=
csv
.
QUOTE_NONNUMERIC
)
data
=
[
r
for
r
in
reader
]
data
=
np
.
array
(
data
);
react
=
data
[:,
1
]
prod
=
np
.
zeros_like
(
react
)
ranges
=
25
startMean
=
6000
ranges
=
500
startMean
=
7000
endMean
=
20000
endMean2
=
4500
print
(
react
)
for
i
in
range
(
len
(
react
)):
if
i
<
ranges
:
prod
[
i
]
=
np
.
sum
(
react
[
0
:
i
+
ranges
])
/
(
i
+
ranges
)
elif
len
(
react
)
-
i
<
ranges
:
prod
[
i
]
=
np
.
sum
(
react
[
i
-
ranges
:])
/
((
len
(
react
)
-
i
)
+
ranges
)
else
:
prod
[
i
]
=
np
.
sum
(
react
[
i
-
ranges
:
i
+
ranges
])
/
(
2
*
ranges
)
print
(
"Mean :"
,
np
.
mean
(
prod
[
startMean
:]),
"
\n
Velocity :"
,
np
.
mean
(
data
[
startMean
:,
4
])
*
1000
,
"mm/s"
)
mean
=
np
.
ones_like
(
prod
[
startMean
:])
*
np
.
mean
(
prod
[
startMean
:])
plt
.
plot
(
data
[:,
3
],
-
prod
,
color
=
'black'
)
plt
.
plot
(
data
[
startMean
:,
3
],
-
mean
,
color
=
'red'
)
prod
[
i
]
=
np
.
sum
(
react
[
i
-
ranges
:
i
])
/
(
ranges
)
#print("Mean :",np.mean(prod[startMean:]),"\nVelocity :",np.mean(data[startMean:, 4])*1000, "mm/s")
mean
=
np
.
ones_like
(
react
[
startMean
:
endMean
])
*
np
.
mean
(
react
[
startMean
:
endMean
])
plt
.
plot
(
data
[:,
3
],
-
prod
,
color
=
'black'
,
linewidth
=
2
)
plt
.
plot
(
data
[:,
3
],
-
react
,
'.'
,
color
=
'black'
,
alpha
=
0.03
,
markersize
=
2.5
)
plt
.
plot
(
data
[
startMean
:
endMean
,
3
],
-
mean
,
color
=
'darkorange'
,
linewidth
=
2.5
)
mean2
=
np
.
ones_like
(
react
[:
endMean2
])
*
np
.
mean
(
react
[:
endMean2
])
plt
.
plot
(
data
[:
endMean2
,
3
],
-
mean2
,
color
=
'darkturquoise'
,
linewidth
=
2.5
)
plt
.
xlabel
(
"Time [s]"
,
size
=
15
)
plt
.
ylabel
(
"
Drag force
[N]"
,
size
=
15
)
plt
.
title
(
"v = %.1f mm/s"
%
(
np
.
mean
(
data
[
startMean
:,
4
])
*
1000
),
size
=
19
)
plt
.
ylabel
(
"
F
[N]"
,
size
=
15
,
rotation
=
0
)
plt
.
ylim
([
0
,
25
]
)
plt
.
show
()
Write
Preview
Markdown
is supported
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