Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
python-tools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Germain Clavier
python-tools
Commits
3d183406
Commit
3d183406
authored
Jan 31, 2022
by
Germain Clavier
Browse files
Options
Downloads
Patches
Plain Diff
Added Rayleigh_vel plot and velplot.py example script
parent
478774b6
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
lammps/Rayleigh_vel.pdf
+0
-0
0 additions, 0 deletions
lammps/Rayleigh_vel.pdf
lammps/velplot.py
+90
-0
90 additions, 0 deletions
lammps/velplot.py
with
90 additions
and
0 deletions
lammps/Rayleigh_vel.pdf
0 → 100644
+
0
−
0
View file @
3d183406
File added
This diff is collapsed.
Click to expand it.
lammps/velplot.py
0 → 100644
+
90
−
0
View file @
3d183406
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import
numpy
as
np
import
matplotlib
as
mpl
from
matplotlib
import
pyplot
as
plt
class
Smallbox
:
def
__init__
(
self
):
self
.
x
=
0.
self
.
y
=
0.
self
.
vx
=
0.
self
.
vy
=
0.
self
.
atoms
=
0.
self
.
temp
=
0.
def
__repr__
(
self
):
return
"
{} {} {} {} {}
"
.
format
(
self
.
x
,
self
.
y
,
self
.
vx
,
self
.
vy
,
self
.
atoms
)
def
read_file
(
filename
):
with
open
(
filename
,
'
r
'
)
as
f
:
for
_
in
range
(
3
):
f
.
readline
()
head
=
f
.
readline
().
split
()
nentries
=
int
(
head
[
1
])
boxes
=
[]
for
_
in
range
(
nentries
):
boxes
.
append
(
Smallbox
())
minrec
=
0
maxrec
=
0
nrec
=
0
while
True
:
for
i
in
range
(
nentries
):
line
=
f
.
readline
().
strip
()
if
not
line
:
break
line
=
line
.
split
()
nbox
=
int
(
line
[
0
])
-
1
xbox
=
float
(
line
[
1
])
ybox
=
float
(
line
[
2
])
atbox
=
float
(
line
[
3
])
vxbox
=
float
(
line
[
4
])
vybox
=
float
(
line
[
5
])
tbox
=
float
(
line
[
6
])
boxes
[
nbox
].
vx
+=
vxbox
boxes
[
nbox
].
vy
+=
vybox
boxes
[
nbox
].
atoms
+=
atbox
boxes
[
nbox
].
temp
+=
tbox
if
boxes
[
nbox
].
x
==
0.
:
boxes
[
nbox
].
x
=
xbox
if
boxes
[
nbox
].
y
==
0.
:
boxes
[
nbox
].
y
=
ybox
nrec
+=
1
line
=
f
.
readline
().
strip
()
if
not
line
:
break
print
(
nrec
,
end
=
'
\r
'
)
for
b
in
boxes
:
b
.
vx
/=
nrec
b
.
vy
/=
nrec
b
.
atoms
/=
nrec
b
.
temp
/=
nrec
return
boxes
def
main
():
boxes
=
read_file
(
"
vel.bin.ave
"
)
lx
=
456.4354645876385
ly
=
54.772255750516614
ratio
=
lx
/
ly
circle_coord
=
(
lx
/
2.
,
ly
/
2.
)
circle
=
plt
.
Circle
(
circle_coord
,
10
,
color
=
'
#FF000030
'
)
fig1
,
ax1
=
plt
.
subplots
(
figsize
=
(
16
,
16
/
ratio
))
x
=
np
.
array
([
b
.
x
*
lx
for
b
in
boxes
if
b
.
atoms
>
0.
])
y
=
np
.
array
([
b
.
y
*
ly
for
b
in
boxes
if
b
.
atoms
>
0.
])
vx
=
np
.
array
([
b
.
vx
for
b
in
boxes
if
b
.
atoms
>
0.
])
vy
=
np
.
array
([
b
.
vy
for
b
in
boxes
if
b
.
atoms
>
0.
])
t
=
np
.
array
([
b
.
temp
for
b
in
boxes
if
b
.
atoms
>
0.
])
ax1
.
quiver
(
x
,
y
,
vx
,
vy
,
t
,
cmap
=
'
jet
'
)
# , scale=1., scale_units='xy')
# ax1.add_patch(circle)
plt
.
savefig
(
'
toto.pdf
'
,
format
=
'
pdf
'
,
dpi
=
600
)
return
if
__name__
==
"
__main__
"
:
try
:
main
()
except
KeyboardInterrupt
:
raise
SystemExit
(
"
User interruption.
"
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment