Commit e3fea0e8 authored by Pierre Augier's avatar Pierre Augier
Browse files

compute_spectrum_kzkhomega 2d boosted

parent 7617e7a30226
...@@ -10,8 +10,6 @@ Provides: ...@@ -10,8 +10,6 @@ Provides:
""" """
from math import pi
import numpy as np import numpy as np
from fluidsim.base.output.spatiotemporal_spectra import ( from fluidsim.base.output.spatiotemporal_spectra import (
...@@ -22,13 +20,13 @@ from fluidsim.base.output.spatiotemporal_spectra import ( ...@@ -22,13 +20,13 @@ from fluidsim.base.output.spatiotemporal_spectra import (
from transonic import boost, Array, Type from transonic import boost, Array, Type
A3 = Array[Type(np.float32, np.float64), "3d", "C"] A3 = Array[Type(np.float32, np.float64), "3d", "C"]
A3f64 = Array[np.float64, "3d", "C"] A2 = Array[np.float64, "2d", "C"]
A1 = "float[:]" A1 = "float[:]"
# @boost @boost
def compute_spectrum_kzkhomega( def compute_spectrum_kzkhomega(
field_k0k1omega: A3, khs: A1, kzs: A1, KX: A3f64, KZ: A3f64, KH: A3f64 field_k0k1omega: A3, khs: A1, kzs: A1, KX: A2, KZ: A2, KH: A2
): ):
"""Compute the kz-kh-omega spectrum.""" """Compute the kz-kh-omega spectrum."""
deltakh = khs[1] deltakh = khs[1]
...@@ -37,9 +35,7 @@ def compute_spectrum_kzkhomega( ...@@ -37,9 +35,7 @@ def compute_spectrum_kzkhomega(
nkh = len(khs) nkh = len(khs)
nkz = len(kzs) nkz = len(kzs)
nk0, nk1, nomega = field_k0k1omega.shape nk0, nk1, nomega = field_k0k1omega.shape
spectrum_kzkhomega = np.zeros( spectrum_kzkhomega = np.zeros((nkz, nkh, nomega), dtype=field_k0k1omega.dtype)
(nkz, nkh, nomega), dtype=field_k0k1omega.dtype
)
for ik0 in range(nk0): for ik0 in range(nk0):
for ik1 in range(nk1): for ik1 in range(nk1):
...@@ -64,9 +60,7 @@ def compute_spectrum_kzkhomega( ...@@ -64,9 +60,7 @@ def compute_spectrum_kzkhomega(
else: else:
coef_share = (kappa - khs[ikh]) / deltakh coef_share = (kappa - khs[ikh]) / deltakh
for i, value in enumerate(values): for i, value in enumerate(values):
spectrum_kzkhomega[ikz, ikh, i] += ( spectrum_kzkhomega[ikz, ikh, i] += (1 - coef_share) * value
1 - coef_share
) * value
spectrum_kzkhomega[ikz, ikh + 1, i] += coef_share * value spectrum_kzkhomega[ikz, ikh + 1, i] += coef_share * value
# get one-sided spectrum in the omega dimension # get one-sided spectrum in the omega dimension
......
...@@ -13,7 +13,6 @@ Provides: ...@@ -13,7 +13,6 @@ Provides:
from math import pi from math import pi
import numpy as np import numpy as np
import h5py
from fluidsim.base.output.spatiotemporal_spectra import ( from fluidsim.base.output.spatiotemporal_spectra import (
SpatioTemporalSpectra3D, SpatioTemporalSpectra3D,
......
...@@ -134,6 +134,7 @@ def transonize(): ...@@ -134,6 +134,7 @@ def transonize():
"fluidsim/util/mini_oper_modif_resol.py", "fluidsim/util/mini_oper_modif_resol.py",
"fluidsim/base/output/spatiotemporal_spectra.py", "fluidsim/base/output/spatiotemporal_spectra.py",
"fluidsim/solvers/ns3d/output/spatiotemporal_spectra.py", "fluidsim/solvers/ns3d/output/spatiotemporal_spectra.py",
"fluidsim/solvers/ns2d/output/spatiotemporal_spectra.py",
] ]
make_backend_files([here / path for path in paths], backend=TRANSONIC_BACKEND) make_backend_files([here / path for path in paths], backend=TRANSONIC_BACKEND)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment