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
c14be9dc
Commit
c14be9dc
authored
5 years ago
by
Cristian Lalescu
Browse files
Options
Downloads
Plain Diff
Merge branch 'bugfix/particle_distribution' into develop
parents
407d3044
415b6b89
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Pipeline
#64807
passed
5 years ago
Stage: build
Changes
2
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
TurTLE/test/test_particle_clouds.py
+59
-9
59 additions, 9 deletions
TurTLE/test/test_particle_clouds.py
cpp/particles/particles_distr_mpi.hpp
+40
-31
40 additions, 31 deletions
cpp/particles/particles_distr_mpi.hpp
with
99 additions
and
40 deletions
TurTLE/test/test_particle_clouds.py
+
59
−
9
View file @
c14be9dc
...
...
@@ -33,22 +33,22 @@ import sys
import
TurTLE
from
TurTLE
import
DNS
def
main
():
def
basic_test
():
nclouds
=
10
nparticles_per_cloud
=
1000
nparticles
=
nclouds
*
nparticles_per_cloud
niterations
=
32
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
'
]
c
.
simname
=
'
basic_cloud_test
'
f0
=
h5py
.
File
(
os
.
path
.
join
(
os
.
path
.
join
(
TurTLE
.
lib_dir
,
'
test
'
),
'
B32p1e4_checkpoint_0.h5
'
),
'
r
'
)
ic_file
=
h5py
.
File
(
c
.
get_checkpoint_0_fname
(),
'
a
'
)
ic_file
[
'
tracers0/state/0
'
]
=
ic_file
[
'
tracers
1
/state/0
'
][...].
reshape
(
nclouds
,
nparticles_per_cloud
,
3
)
ic_file
[
'
tracers0/rhs/0
'
]
=
ic_file
[
'
tracers
1
/rhs/0
'
][...].
reshape
(
4
,
nclouds
,
nparticles_per_cloud
,
3
)
ic_file
[
'
tracers0/state/0
'
]
=
f0
[
'
tracers
0
/state/0
'
][...].
reshape
(
nclouds
,
nparticles_per_cloud
,
3
)
ic_file
[
'
tracers0/rhs/0
'
]
=
f0
[
'
tracers
0
/rhs/0
'
][...].
reshape
(
4
,
nclouds
,
nparticles_per_cloud
,
3
)
ic_file
.
close
()
c
.
launch
(
[
'
NSVEparticles
'
,
...
...
@@ -57,12 +57,14 @@ def main():
'
--forcing_type
'
,
'
linear
'
,
'
--src-wd
'
,
TurTLE
.
lib_dir
+
'
/test
'
,
'
--src-iteration
'
,
'
0
'
,
'
--simname
'
,
c
.
simname
,
'
--np
'
,
'
4
'
,
'
--ntpp
'
,
'
1
'
,
'
--fftw_plan_rigor
'
,
'
FFTW_PATIENT
'
,
'
--niter_todo
'
,
'
{0}
'
.
format
(
niterations
),
'
--niter_out
'
,
'
{0}
'
.
format
(
niterations
),
'
--niter_stat
'
,
'
1
'
,
'
--checkpoints_per_file
'
,
'
{0}
'
.
format
(
3
),
'
--nparticles
'
,
'
{0}
'
.
format
(
nparticles
),
'
--njobs
'
,
'
2
'
,
'
--wd
'
,
'
./
'
])
...
...
@@ -79,6 +81,7 @@ def main():
x0
=
f0
[
'
tracers0/state/{0}
'
.
format
(
iteration
)][...]
x1
=
f1
[
'
tracers0/state/{0}
'
.
format
(
iteration
)][...].
reshape
(
x0
.
shape
)
traj_error
=
np
.
max
(
np
.
abs
(
x0
-
x1
))
print
(
traj_error
)
y0
=
f0
[
'
tracers0/rhs/{0}
'
.
format
(
iteration
)][...]
y1
=
f1
[
'
tracers0/rhs/{0}
'
.
format
(
iteration
)][...].
reshape
(
y0
.
shape
)
rhs_error
=
np
.
max
(
np
.
abs
(
y0
-
y1
))
...
...
@@ -88,6 +91,53 @@ def main():
print
(
'
SUCCESS! Basic test passed.
'
)
return
None
def
nasty_test
():
nclouds
=
10
nparticles_per_cloud
=
1000000
nparticles
=
nclouds
*
nparticles_per_cloud
niterations
=
8
c
=
DNS
()
c
.
dns_type
=
'
NSVEparticles
'
c
.
simname
=
'
nasty_cloud_test
'
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
[
'
tracers0/state/0
'
]
=
ic_file
[
'
tracers1/state/0
'
][...].
reshape
(
nclouds
,
nparticles_per_cloud
,
3
)
ic_file
[
'
tracers0/rhs/0
'
]
=
ic_file
[
'
tracers1/rhs/0
'
][...].
reshape
(
4
,
nclouds
,
nparticles_per_cloud
,
3
)
# put all particles in single z cell
ic_file
[
'
tracers0/state/0
'
][...,
2
]
=
0.0001
# put one cloud on another process
ic_file
[
'
tracers0/state/0
'
][
1
,
:,
2
]
=
np
.
pi
+
0.0001
ic_file
.
close
()
c
.
launch
(
[
'
NSVEparticles
'
,
'
-n
'
,
'
8
'
,
'
--src-simname
'
,
'
B32p1e4
'
,
'
--simname
'
,
c
.
simname
,
'
--forcing_type
'
,
'
linear
'
,
'
--src-wd
'
,
TurTLE
.
lib_dir
+
'
/test
'
,
'
--src-iteration
'
,
'
0
'
,
'
--np
'
,
'
4
'
,
'
--ntpp
'
,
'
2
'
,
'
--fftw_plan_rigor
'
,
'
FFTW_PATIENT
'
,
'
--niter_todo
'
,
'
{0}
'
.
format
(
niterations
),
'
--niter_out
'
,
'
{0}
'
.
format
(
niterations
),
'
--niter_stat
'
,
'
1
'
,
'
--nparticles
'
,
'
{0}
'
.
format
(
nparticles
),
'
--njobs
'
,
'
1
'
,
'
--wd
'
,
'
./
'
])
print
(
'
SUCCESS! Nasty test passed.
'
)
return
None
def
main
():
basic_test
()
nasty_test
()
return
None
if
__name__
==
'
__main__
'
:
main
()
This diff is collapsed.
Click to expand it.
cpp/particles/particles_distr_mpi.hpp
+
40
−
31
View file @
c14be9dc
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