Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TurTLE
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TurTLE
TurTLE
Commits
8739ef7d
Commit
8739ef7d
authored
9 years ago
by
Chichi Lalescu
Browse files
Options
Downloads
Patches
Plain Diff
compute acceleration over less points
parent
41f314f6
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/test_base.py
+31
-28
31 additions, 28 deletions
tests/test_base.py
tox_plain.ini
+2
-2
2 additions, 2 deletions
tox_plain.ini
with
33 additions
and
30 deletions
tests/test_base.py
+
31
−
28
View file @
8739ef7d
...
...
@@ -106,7 +106,10 @@ def launch(
# smoothness = opt.smoothness,
# fields_name = 'regular')
for
info
in
[(
2
,
'
Heun
'
),
(
4
,
'
cRK4
'
)]:
(
2
,
'
AdamsBashforth
'
),
(
4
,
'
cRK4
'
),
(
4
,
'
AdamsBashforth
'
),
(
6
,
'
AdamsBashforth
'
)]:
c
.
add_particles
(
integration_steps
=
info
[
0
],
integration_method
=
info
[
1
],
...
...
@@ -142,7 +145,7 @@ def launch(
return
c
def
acceleration_test
(
c
,
m
=
3
,
species
=
9
):
def
acceleration_test
(
c
,
m
=
3
,
species
=
0
):
import
numpy
as
np
import
matplotlib.pyplot
as
plt
from
bfps.tools
import
get_fornberg_coeffs
...
...
@@ -158,35 +161,35 @@ def acceleration_test(c, m = 3, species = 9):
fc
=
get_fornberg_coeffs
(
0
,
range
(
-
n
,
n
+
1
))
dt
=
d
[
'
parameters/dt
'
].
value
*
d
[
'
parameters/niter_part
'
].
value
num_acc1
=
sum
(
fc
[
1
,
n
-
i
]
*
vel
[
n
-
i
:
vel
.
shape
[
0
]
-
i
-
n
]
for
i
in
range
(
-
n
,
n
+
1
))
/
dt
num_acc2
=
sum
(
fc
[
2
,
n
-
i
]
*
pos
[
n
-
i
:
pos
.
shape
[
0
]
-
i
-
n
]
for
i
in
range
(
-
n
,
n
+
1
))
/
dt
**
2
num_vel1
=
sum
(
fc
[
1
,
n
-
i
]
*
pos
[
n
-
i
:
pos
.
shape
[
0
]
-
i
-
n
]
for
i
in
range
(
-
n
,
n
+
1
))
/
dt
num_acc1
=
sum
(
fc
[
1
,
n
-
i
]
*
vel
[
1
+
n
-
i
:
vel
.
shape
[
0
]
-
i
-
n
-
1
]
for
i
in
range
(
-
n
,
n
+
1
))
/
dt
num_acc2
=
sum
(
fc
[
2
,
n
-
i
]
*
pos
[
1
+
n
-
i
:
pos
.
shape
[
0
]
-
i
-
n
-
1
]
for
i
in
range
(
-
n
,
n
+
1
))
/
dt
**
2
num_vel1
=
sum
(
fc
[
1
,
n
-
i
]
*
pos
[
1
+
n
-
i
:
pos
.
shape
[
0
]
-
i
-
n
-
1
]
for
i
in
range
(
-
n
,
n
+
1
))
/
dt
pid
=
np
.
unravel_index
(
np
.
argmax
(
np
.
abs
(
num_acc1
[:]
-
acc
[
n
:
-
n
])),
dims
=
num_acc1
.
shape
)
def
SNR
(
a
,
b
):
return
-
20
*
np
.
log10
(
np
.
average
((
a
-
b
)
**
2
)
**
.
5
/
np
.
average
(
a
**
2
)
**
.
5
)
return
-
10
*
np
.
log10
(
np
.
mean
((
a
-
b
)
**
2
,
axis
=
(
0
,
2
))
/
np
.
mean
(
a
**
2
,
axis
=
(
0
,
2
)))
pid
=
np
.
argmax
(
SNR
(
num_acc1
,
acc
[
n
+
1
:
-
n
-
1
]))
print
(
'
SNR diffpos vs vel {0}, SNR diffvel vs acc {1}, SNR diffpos vs acc {2}
'
.
format
(
SNR
(
num_vel1
,
vel
[
n
:
-
n
]
),
SNR
(
num_acc1
,
acc
[
n
:
-
n
]
),
SNR
(
num_acc2
,
acc
[
n
:
-
n
]
)))
#
for cc in range(3):
#
a.plot(num_acc1[:, pid
[1]
, cc], color = col[cc])
#
#
a.plot(num_acc2[:, pid
[1]
, cc], color = col[cc], dashes = (2, 2))
#
a.plot(acc[m:, pid
[1]
, cc], color = col[cc], dashes = (1, 1))
#
for n in range(1, m):
#
fc = get_fornberg_coeffs(0, range(-n, n+1))
#
dt = d['parameters/dt'].value*d['parameters/niter_part'].value
#
num_acc1 = sum(fc[1, n-i]*vel[n-i:vel.shape[0]-i-n] for i in range(-n, n+1)) / dt
#
num_acc2 = sum(fc[2, n-i]*pos[n-i:pos.shape[0]-i-n] for i in range(-n, n+1)) / dt**2
#
for cc in range(3):
#
a.plot(num_acc1[m-n:, pid
[1]
, cc], color = col[cc])
#
#
a.plot(num_acc2[m-n:, pid
[1]
, cc], color = col[cc], dashes = (2, 2))
#
fig.tight_layout()
#
fig.savefig('acc_test_{0}_{1}.pdf'.format(c.simname, species))
return
None
np
.
mean
(
SNR
(
num_vel1
,
vel
[
n
+
1
:
-
n
-
1
])
),
np
.
mean
(
SNR
(
num_acc1
,
acc
[
n
+
1
:
-
n
-
1
])
),
np
.
mean
(
SNR
(
num_acc2
,
acc
[
n
+
1
:
-
n
-
1
])
)))
for
cc
in
range
(
3
):
a
.
plot
(
num_acc1
[:,
pid
,
cc
],
color
=
col
[
cc
])
a
.
plot
(
num_acc2
[:,
pid
,
cc
],
color
=
col
[
cc
],
dashes
=
(
2
,
2
))
a
.
plot
(
acc
[
m
+
1
:,
pid
,
cc
],
color
=
col
[
cc
],
dashes
=
(
1
,
1
))
for
n
in
range
(
1
,
m
):
fc
=
get_fornberg_coeffs
(
0
,
range
(
-
n
,
n
+
1
))
dt
=
d
[
'
parameters/dt
'
].
value
*
d
[
'
parameters/niter_part
'
].
value
num_acc1
=
sum
(
fc
[
1
,
n
-
i
]
*
vel
[
n
-
i
:
vel
.
shape
[
0
]
-
i
-
n
]
for
i
in
range
(
-
n
,
n
+
1
))
/
dt
num_acc2
=
sum
(
fc
[
2
,
n
-
i
]
*
pos
[
n
-
i
:
pos
.
shape
[
0
]
-
i
-
n
]
for
i
in
range
(
-
n
,
n
+
1
))
/
dt
**
2
for
cc
in
range
(
3
):
a
.
plot
(
num_acc1
[
m
-
n
:,
pid
,
cc
],
color
=
col
[
cc
])
a
.
plot
(
num_acc2
[
m
-
n
:,
pid
,
cc
],
color
=
col
[
cc
],
dashes
=
(
2
,
2
))
fig
.
tight_layout
()
fig
.
savefig
(
'
acc_test_{0}_{1}.pdf
'
.
format
(
c
.
simname
,
species
))
return
pid
if
__name__
==
'
__main__
'
:
print
(
'
this file doesn
\'
t do anything
'
)
...
...
This diff is collapsed.
Click to expand it.
tox_plain.ini
+
2
−
2
View file @
8739ef7d
...
...
@@ -13,8 +13,8 @@ commands =
python
tests/test_plain.py
\
-n
32
--run
--initialize
--ncpu
4
\
--nparticles
10
--niter_todo
24
\
--precision
single
--wd
"data/single"
\
--multiplejob
--precision
single
--wd
"data/single"
#
\
#
--multiplejob
#python tests/test_plain.py -n 32 --run --initialize --multiplejob --ncpu 2 --nparticles 16 --niter_todo 64 --precision single --wd "data/single"
#python tests/test_plain.py -n 32 --run --initialize --multiplejob --ncpu 2 --nparticles 16 --niter_todo 64 --precision double --wd "data/double"
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