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
96e9436e
Commit
96e9436e
authored
6 years ago
by
Cristian Lalescu
Browse files
Options
Downloads
Patches
Plain Diff
finalize test of particle cloud code
parent
54d91695
No related branches found
No related tags found
1 merge request
!23
WIP: Feature/use cmake
Pipeline
#43298
failed
6 years ago
Stage: test
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
bfps/DNS.py
+5
-7
5 additions, 7 deletions
bfps/DNS.py
bfps/__main__.py
+1
-1
1 addition, 1 deletion
bfps/__main__.py
bfps/test/test_bfps_NSVEparticles.py
+25
-0
25 additions, 0 deletions
bfps/test/test_bfps_NSVEparticles.py
bfps/test/test_particle_clouds.py
+32
-5
32 additions, 5 deletions
bfps/test/test_particle_clouds.py
with
63 additions
and
13 deletions
bfps/DNS.py
+
5
−
7
View file @
96e9436e
...
@@ -791,13 +791,17 @@ class DNS(_code):
...
@@ -791,13 +791,17 @@ class DNS(_code):
ncomponents
=
6
ncomponents
=
6
with
h5py
.
File
(
self
.
get_checkpoint_0_fname
(),
'
a
'
)
as
data_file
:
with
h5py
.
File
(
self
.
get_checkpoint_0_fname
(),
'
a
'
)
as
data_file
:
nn
=
self
.
parameters
[
'
nparticles
'
]
nn
=
self
.
parameters
[
'
nparticles
'
]
if
not
'
tracers{0}
'
.
format
(
species
)
in
data_file
.
keys
():
data_file
.
create_group
(
'
tracers{0}
'
.
format
(
species
))
data_file
.
create_group
(
'
tracers{0}/rhs
'
.
format
(
species
))
data_file
.
create_group
(
'
tracers{0}/state
'
.
format
(
species
))
data_file
[
'
tracers{0}/rhs
'
.
format
(
species
)].
create_dataset
(
data_file
[
'
tracers{0}/rhs
'
.
format
(
species
)].
create_dataset
(
'
0
'
,
'
0
'
,
shape
=
(
shape
=
(
(
self
.
parameters
[
'
tracers{0}_integration_steps
'
.
format
(
species
)],)
+
(
self
.
parameters
[
'
tracers{0}_integration_steps
'
.
format
(
species
)],)
+
(
nn
,
ncomponents
,)),
(
nn
,
ncomponents
,)),
dtype
=
np
.
float
)
dtype
=
np
.
float
)
dset
=
data_file
[
'
tracers{0}/state
'
.
format
(
s
)].
create_dataset
(
dset
=
data_file
[
'
tracers{0}/state
'
.
format
(
s
pecies
)].
create_dataset
(
'
0
'
,
'
0
'
,
shape
=
(
nn
,
ncomponents
,),
shape
=
(
nn
,
ncomponents
,),
dtype
=
np
.
float
)
dtype
=
np
.
float
)
...
@@ -958,12 +962,6 @@ class DNS(_code):
...
@@ -958,12 +962,6 @@ class DNS(_code):
self
,
self
,
opt
=
None
):
opt
=
None
):
if
self
.
parameters
[
'
nparticles
'
]
>
0
:
if
self
.
parameters
[
'
nparticles
'
]
>
0
:
with
h5py
.
File
(
self
.
get_checkpoint_0_fname
(),
'
a
'
)
as
ofile
:
s
=
0
if
not
'
tracers{0}
'
.
format
(
s
)
in
ofile
.
keys
():
ofile
.
create_group
(
'
tracers{0}
'
.
format
(
s
))
ofile
.
create_group
(
'
tracers{0}/rhs
'
.
format
(
s
))
ofile
.
create_group
(
'
tracers{0}/state
'
.
format
(
s
))
self
.
generate_tracer_state
(
self
.
generate_tracer_state
(
species
=
0
,
species
=
0
,
rseed
=
opt
.
particle_rand_seed
)
rseed
=
opt
.
particle_rand_seed
)
...
...
This diff is collapsed.
Click to expand it.
bfps/__main__.py
+
1
−
1
View file @
96e9436e
...
@@ -33,7 +33,7 @@ from .PP import PP
...
@@ -33,7 +33,7 @@ from .PP import PP
from
.TEST
import
TEST
from
.TEST
import
TEST
def
main
():
def
main
():
parser
=
argparse
.
ArgumentParser
(
prog
=
'
bfps
'
)
parser
=
argparse
.
ArgumentParser
(
prog
=
'
bfps
'
,
conflict_handler
=
'
resolve
'
)
parser
.
add_argument
(
parser
.
add_argument
(
'
-v
'
,
'
--version
'
,
'
-v
'
,
'
--version
'
,
action
=
'
version
'
,
action
=
'
version
'
,
...
...
This diff is collapsed.
Click to expand it.
bfps/test/test_bfps_NSVEparticles.py
+
25
−
0
View file @
96e9436e
#! /usr/bin/env python
#! /usr/bin/env python
#######################################################################
# #
# Copyright 2019 Max Planck Institute #
# for Dynamics and Self-Organization #
# #
# This file is part of bfps. #
# #
# bfps is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published #
# by the Free Software Foundation, either version 3 of the License, #
# or (at your option) any later version. #
# #
# bfps is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with bfps. If not, see <http://www.gnu.org/licenses/> #
# #
# Contact: Cristian.Lalescu@ds.mpg.de #
# #
#######################################################################
import
os
import
os
import
numpy
as
np
import
numpy
as
np
...
...
This diff is collapsed.
Click to expand it.
bfps/test/test_particle_clouds.py
+
32
−
5
View file @
96e9436e
...
@@ -33,15 +33,22 @@ import sys
...
@@ -33,15 +33,22 @@ import sys
import
bfps
import
bfps
from
bfps
import
DNS
from
bfps
import
DNS
def
main
():
def
main
():
nclouds
=
4
nclouds
=
10
nparticles_per_cloud
=
3
nparticles_per_cloud
=
1000
nparticles
=
nclouds
*
nparticles_per_cloud
nparticles
=
nclouds
*
nparticles_per_cloud
niterations
=
32
niterations
=
32
c
=
DNS
()
c
=
DNS
()
c
.
dns_type
=
'
NSVEparticles
'
c
.
parameters
[
'
nparticles
'
]
=
nparticles
c
.
parameters
[
'
tracers1_integration_steps
'
]
=
4
c
.
generate_tracer_state
(
rseed
=
2
,
species
=
1
)
del
c
.
parameters
[
'
nparticles
'
]
del
c
.
parameters
[
'
tracers1_integration_steps
'
]
ic_file
=
h5py
.
File
(
c
.
get_checkpoint_0_fname
(),
'
a
'
)
ic_file
=
h5py
.
File
(
c
.
get_checkpoint_0_fname
(),
'
a
'
)
ic_file
[
'
tracers0/state/0
'
]
=
np
.
random
.
random
(
(
nclouds
,
nparticles_per_cloud
,
3
)
)
ic_file
[
'
tracers0/state/0
'
]
=
ic_file
[
'
tracers1/state/0
'
].
value
.
reshape
(
nclouds
,
nparticles_per_cloud
,
3
)
ic_file
[
'
tracers0/rhs/0
'
]
=
np
.
zeros
((
2
,
nclouds
,
nparticles_per_cloud
,
3
)
)
ic_file
[
'
tracers0/rhs/0
'
]
=
ic_file
[
'
tracers1/rhs/0
'
].
value
.
reshape
(
4
,
nclouds
,
nparticles_per_cloud
,
3
)
ic_file
.
close
()
ic_file
.
close
()
c
.
launch
(
c
.
launch
(
[
'
NSVEparticles
'
,
[
'
NSVEparticles
'
,
...
@@ -57,8 +64,28 @@ def main():
...
@@ -57,8 +64,28 @@ def main():
'
--niter_out
'
,
'
{0}
'
.
format
(
niterations
),
'
--niter_out
'
,
'
{0}
'
.
format
(
niterations
),
'
--niter_stat
'
,
'
1
'
,
'
--niter_stat
'
,
'
1
'
,
'
--nparticles
'
,
'
{0}
'
.
format
(
nparticles
),
'
--nparticles
'
,
'
{0}
'
.
format
(
nparticles
),
'
--
tracers0_integration_step
s
'
,
'
2
'
,
'
--
njob
s
'
,
'
2
'
,
'
--wd
'
,
'
./
'
])
'
--wd
'
,
'
./
'
])
f0
=
h5py
.
File
(
os
.
path
.
join
(
os
.
path
.
join
(
bfps
.
lib_dir
,
'
test
'
),
'
B32p1e4_checkpoint_0.h5
'
),
'
r
'
)
f1
=
h5py
.
File
(
c
.
get_checkpoint_0_fname
(),
'
r
'
)
for
iteration
in
[
0
,
32
,
64
]:
field0
=
f0
[
'
vorticity/complex/{0}
'
.
format
(
iteration
)].
value
field1
=
f1
[
'
vorticity/complex/{0}
'
.
format
(
iteration
)].
value
field_error
=
np
.
max
(
np
.
abs
(
field0
-
field1
))
x0
=
f0
[
'
tracers0/state/{0}
'
.
format
(
iteration
)].
value
x1
=
f1
[
'
tracers0/state/{0}
'
.
format
(
iteration
)].
value
.
reshape
(
x0
.
shape
)
traj_error
=
np
.
max
(
np
.
abs
(
x0
-
x1
))
y0
=
f0
[
'
tracers0/rhs/{0}
'
.
format
(
iteration
)].
value
y1
=
f1
[
'
tracers0/rhs/{0}
'
.
format
(
iteration
)].
value
.
reshape
(
y0
.
shape
)
rhs_error
=
np
.
max
(
np
.
abs
(
y0
-
y1
))
assert
(
field_error
<
1e-5
)
assert
(
traj_error
<
1e-5
)
assert
(
rhs_error
<
1e-5
)
print
(
'
SUCCESS! Basic test passed.
'
)
return
None
return
None
if
__name__
==
'
__main__
'
:
if
__name__
==
'
__main__
'
:
...
...
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