Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
fluiddyn
fluidsim
Commits
e695f10ffb6d
Commit
6c77c0f1
authored
Mar 01, 2021
by
Jason Reneuve
Browse files
doc example + fix bugs
parent
1770455a6120
Changes
2
Show whitespace changes
Inline
Side-by-side
doc/examples/simul_ns3dstrat_waves.py
View file @
e695f10f
...
...
@@ -103,13 +103,17 @@ params.output.periods_save.spect_energy_budg = 1.0
params
.
output
.
spectra
.
kzkh_periodicity
=
1
params
.
output
.
periods_save
.
temporal_spectra
=
0.1
params
.
output
.
periods_save
.
temporal_spectra
=
period_N
/
4
params
.
output
.
temporal_spectra
.
probes_deltax
=
1
params
.
output
.
temporal_spectra
.
probes_deltay
=
1
params
.
output
.
temporal_spectra
.
probes_deltaz
=
0.5
params
.
output
.
temporal_spectra
.
probes_region
=
(
1
,
11
,
1
,
11
,
0
,
2
)
params
.
output
.
temporal_spectra
.
file_max_size
=
0.1
params
.
output
.
periods_save
.
spatiotemporal_spectra
=
period_N
/
4
params
.
output
.
spatiotemporal_spectra
.
probes_region
=
(
8
,
8
,
2
)
params
.
output
.
spatiotemporal_spectra
.
file_max_size
=
0.1
sim
=
Simul
(
params
)
sim
.
time_stepping
.
start
()
...
...
fluidsim/base/output/spatiotemporal_spectra.py
View file @
e695f10f
...
...
@@ -336,7 +336,9 @@ class SpatiotemporalSpectra(SpecificOutput):
times
.
append
(
times_file
[
cond_times
])
times
=
np
.
concatenate
(
times
)
print
(
f
"tmin=
{
times
.
min
():
8.6
g
}
, tmax=
{
times
.
max
():
8.6
g
}
"
)
print
(
f
"tmin=
{
times
.
min
():
8.6
g
}
, tmax=
{
times
.
max
():
8.6
g
}
, nit=
{
times
.
size
}
"
)
# get sequential shape of Fourier space
ikxmax
,
ikymax
,
ikzmax
=
region
...
...
@@ -367,12 +369,15 @@ class SpatiotemporalSpectra(SpecificOutput):
continue
with
h5py
.
File
(
path_file
,
"r"
)
as
file
:
# check if the file contains the time we're looking for
tmin_file
,
tmax_file
=
file
[
"times"
][[
0
,
-
1
]]
# add [:] in case file contains only one time
# or else : h5py TypeError!
tmin_file
,
tmax_file
=
file
[
"times"
][:][[
0
,
-
1
]]
if
(
time
<
tmin_file
)
or
(
time
>
tmax_file
):
continue
# time index
it
=
np
.
where
(
file
[
"times"
][:]
==
time
)[
0
]
# time indices
it
=
np
.
where
(
times
==
time
)[
0
]
it_file
=
np
.
where
(
file
[
"times"
][:]
==
time
)[
0
]
# k_adim_loc = global probes indices!
ik0
=
file
[
"probes_k0adim_loc"
][:]
...
...
@@ -383,7 +388,7 @@ class SpatiotemporalSpectra(SpecificOutput):
for
key
in
self
.
keys_fields
:
skey
=
f
"spect_
{
key
}
_loc"
series
[
skey
][
ik0
,
ik1
,
ik2
,
it
]
=
file
[
skey
][
:,
it
:,
it
_file
].
transpose
()
# stop opening files when we've reached the right one
...
...
Write
Preview
Markdown
is supported
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