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
TurTLE
TurTLE
Commits
c14be9dc
Commit
c14be9dc
authored
Dec 02, 2019
by
Cristian Lalescu
Browse files
Merge branch 'bugfix/particle_distribution' into develop
parents
407d3044
415b6b89
Pipeline
#64807
passed with stage
in 4 minutes and 46 seconds
Changes
2
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
TurTLE/test/test_particle_clouds.py
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
()
cpp/particles/particles_distr_mpi.hpp
View file @
c14be9dc
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
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