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
98c3eb2f
Commit
98c3eb2f
authored
Aug 14, 2017
by
Cristian Lalescu
Browse files
make the DNS class more general
parent
32e6ba50
Pipeline
#16528
passed with stage
in 6 minutes and 14 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
bfps/DNS.py
View file @
98c3eb2f
...
...
@@ -78,7 +78,8 @@ class DNS(_code):
self
.
C_field_dtype
=
'double'
self
.
fluid_precision
=
'double'
return
None
def
write_src
(
self
):
def
write_src
(
self
):
self
.
version_message
=
(
'/***********************************************************************
\n
'
+
'* this code automatically generated by bfps
\n
'
+
...
...
@@ -623,7 +624,8 @@ class DNS(_code):
return
None
def
prepare_launch
(
self
,
args
=
[]):
args
=
[],
extra_parameters
=
None
):
"""Set up reasonable parameters.
With the default Lundgren forcing applied in the band [2, 4],
...
...
@@ -657,6 +659,10 @@ class DNS(_code):
if
self
.
dns_type
in
[
'NSVEparticles'
,
'NSVEparticles_no_output'
]:
for
k
in
self
.
NSVEp_extra_parameters
.
keys
():
self
.
parameters
[
k
]
=
self
.
NSVEp_extra_parameters
[
k
]
if
type
(
extra_parameters
)
!=
type
(
None
):
if
self
.
dns_type
in
extra_parameters
.
keys
():
for
k
in
extra_parameters
[
self
.
dns_type
].
keys
():
self
.
parameters
[
k
]
=
extra_parameters
[
self
.
dns_type
][
k
]
self
.
parameters
[
'nu'
]
=
(
opt
.
kMeta
*
2
/
opt
.
n
)
**
(
4.
/
3
)
self
.
parameters
[
'dt'
]
=
(
opt
.
dtfactor
/
opt
.
n
)
# custom famplitude for 288 and 576
...
...
@@ -837,12 +843,10 @@ class DNS(_code):
for
kz
in
range
(
src_file
[
src_dset_name
].
shape
[
0
]):
dst_file
[
dst_dset_name
][
kz
]
=
src_file
[
src_dset_name
][
kz
]
else
:
print
(
'aloha'
)
min_shape
=
(
min
(
dst_shape
[
0
],
src_file
[
src_dset_name
].
shape
[
0
]),
min
(
dst_shape
[
1
],
src_file
[
src_dset_name
].
shape
[
1
]),
min
(
dst_shape
[
2
],
src_file
[
src_dset_name
].
shape
[
2
]),
3
)
print
(
self
.
ctype
)
dst_file
.
create_dataset
(
dst_dset_name
,
shape
=
dst_shape
,
...
...
@@ -852,6 +856,18 @@ class DNS(_code):
dst_file
[
dst_dset_name
][
kz
,:
min_shape
[
1
],
:
min_shape
[
2
]]
=
\
src_file
[
src_dset_name
][
kz
,
:
min_shape
[
1
],
:
min_shape
[
2
]]
return
None
def
generate_particle_data
(
self
,
opt
=
None
):
if
self
.
parameters
[
'nparticles'
]
>
0
:
self
.
generate_tracer_state
(
species
=
0
,
rseed
=
opt
.
particle_rand_seed
)
if
not
os
.
path
.
exists
(
self
.
get_particle_file_name
()):
with
h5py
.
File
(
self
.
get_particle_file_name
(),
'w'
)
as
particle_file
:
particle_file
.
create_group
(
'tracers0/velocity'
)
particle_file
.
create_group
(
'tracers0/acceleration'
)
return
None
def
launch_jobs
(
self
,
opt
=
None
,
...
...
@@ -911,14 +927,7 @@ class DNS(_code):
self
.
write_par
(
particle_ic
=
None
)
if
self
.
dns_type
in
[
'NSVEparticles'
,
'NSVEparticles_no_output'
]:
if
self
.
parameters
[
'nparticles'
]
>
0
:
self
.
generate_tracer_state
(
species
=
0
,
rseed
=
opt
.
particle_rand_seed
)
if
not
os
.
path
.
exists
(
self
.
get_particle_file_name
()):
with
h5py
.
File
(
self
.
get_particle_file_name
(),
'w'
)
as
particle_file
:
particle_file
.
create_group
(
'tracers0/velocity'
)
particle_file
.
create_group
(
'tracers0/acceleration'
)
self
.
generate_particle_data
(
opt
=
opt
)
self
.
run
(
nb_processes
=
opt
.
nb_processes
,
nb_threads_per_process
=
opt
.
nb_threads_per_process
,
...
...
bfps/cpp/full_code/NSVEparticles.cpp
View file @
98c3eb2f
...
...
@@ -58,9 +58,9 @@ int NSVEparticles<rnumber>::write_checkpoint(void)
template
<
typename
rnumber
>
int
NSVEparticles
<
rnumber
>::
finalize
(
void
)
{
this
->
NSVE
<
rnumber
>::
finalize
();
this
->
ps
.
release
();
delete
this
->
particles_output_writer_mpi
;
this
->
NSVE
<
rnumber
>::
finalize
();
return
EXIT_SUCCESS
;
}
...
...
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