Commit 946d44c1 authored by Niklas Schnierstein's avatar Niklas Schnierstein Committed by Cristian Lalescu
Browse files

introduced wavenumber multiplication in spectrum calc

parent d4f77830
......@@ -684,7 +684,8 @@ void kspace<be, dt>::cospectrum(
const rnumber(* __restrict b)[2],
const hid_t group,
const std::string dset_name,
const hsize_t toffset)
const hsize_t toffset,
const double wavenumber_exp)
{
TIMEZONE("field::cospectrum2");
shared_array<double> spec_local_thread(this->nshells*ncomp(fc)*ncomp(fc),[&](double* spec_local){
......@@ -704,7 +705,8 @@ void kspace<be, dt>::cospectrum(
int tmp_int = int(sqrt(k2) / this->dk)*ncomp(fc)*ncomp(fc);
for (hsize_t i=0; i<ncomp(fc); i++)
for (hsize_t j=0; j<ncomp(fc); j++){
spec_local[tmp_int + i*ncomp(fc)+j] += nxmodes * (
spec_local[tmp_int + i*ncomp(fc)+j] += pow(k2,wavenumber_exp/2.)*
nxmodes * (
(a[ncomp(fc)*cindex + i][0] * b[ncomp(fc)*cindex + j][0]) +
(a[ncomp(fc)*cindex + i][1] * b[ncomp(fc)*cindex + j][1]));
}
......@@ -762,7 +764,8 @@ void kspace<be, dt>::cospectrum(
const rnumber(* __restrict a)[2],
const hid_t group,
const std::string dset_name,
const hsize_t toffset)
const hsize_t toffset,
const double wavenumber_exp)
{
TIMEZONE("field::cospectrum1");
shared_array<double> spec_local_thread(this->nshells*ncomp(fc)*ncomp(fc),[&](double* spec_local){
......@@ -782,7 +785,8 @@ void kspace<be, dt>::cospectrum(
int tmp_int = int(sqrt(k2) / this->dk)*ncomp(fc)*ncomp(fc);
for (hsize_t i=0; i<ncomp(fc); i++)
for (hsize_t j=0; j<ncomp(fc); j++){
spec_local[tmp_int + i*ncomp(fc)+j] += nxmodes * (
spec_local[tmp_int + i*ncomp(fc)+j] += pow(k2, wavenumber_exp/2.)*
nxmodes * (
(a[ncomp(fc)*cindex + i][0] * a[ncomp(fc)*cindex + j][0]) +
(a[ncomp(fc)*cindex + i][1] * a[ncomp(fc)*cindex + j][1]));
}
......@@ -1007,136 +1011,160 @@ template void kspace<FFTW, TWO_THIRDS>::cospectrum<float, ONE>(
const typename fftw_interface<float>::complex *__restrict__ b,
const hid_t group,
const std::string dset_name,
const hsize_t toffset);
const hsize_t toffset,
const double wavenumber_exp);
template void kspace<FFTW, TWO_THIRDS>::cospectrum<float, THREE>(
const typename fftw_interface<float>::complex *__restrict__ a,
const typename fftw_interface<float>::complex *__restrict__ b,
const hid_t group,
const std::string dset_name,
const hsize_t toffset);
const hsize_t toffset,
const double wavenumber_exp);
template void kspace<FFTW, TWO_THIRDS>::cospectrum<float, THREExTHREE>(
const typename fftw_interface<float>::complex *__restrict__ a,
const typename fftw_interface<float>::complex *__restrict__ b,
const hid_t group,
const std::string dset_name,
const hsize_t toffset);
const hsize_t toffset,
const double wavenumber_exp);
template void kspace<FFTW, TWO_THIRDS>::cospectrum<double, ONE>(
const typename fftw_interface<double>::complex *__restrict__ a,
const typename fftw_interface<double>::complex *__restrict__ b,
const hid_t group,
const std::string dset_name,
const hsize_t toffset);
const hsize_t toffset,
const double wavenumber_exp);
template void kspace<FFTW, TWO_THIRDS>::cospectrum<double, THREE>(
const typename fftw_interface<double>::complex *__restrict__ a,
const typename fftw_interface<double>::complex *__restrict__ b,
const hid_t group,
const std::string dset_name,
const hsize_t toffset);
const hsize_t toffset,
const double wavenumber_exp);
template void kspace<FFTW, TWO_THIRDS>::cospectrum<double, THREExTHREE>(
const typename fftw_interface<double>::complex *__restrict__ a,
const typename fftw_interface<double>::complex *__restrict__ b,
const hid_t group,
const std::string dset_name,
const hsize_t toffset);
const hsize_t toffset,
const double wavenumber_exp);
template void kspace<FFTW, SMOOTH>::cospectrum<float, ONE>(
const typename fftw_interface<float>::complex *__restrict__ a,
const typename fftw_interface<float>::complex *__restrict__ b,
const hid_t group,
const std::string dset_name,
const hsize_t toffset);
const hsize_t toffset,
const double wavenumber_exp);
template void kspace<FFTW, SMOOTH>::cospectrum<float, THREE>(
const typename fftw_interface<float>::complex *__restrict__ a,
const typename fftw_interface<float>::complex *__restrict__ b,
const hid_t group,
const std::string dset_name,
const hsize_t toffset);
const hsize_t toffset,
const double wavenumber_exp);
template void kspace<FFTW, SMOOTH>::cospectrum<float, THREExTHREE>(
const typename fftw_interface<float>::complex *__restrict__ a,
const typename fftw_interface<float>::complex *__restrict__ b,
const hid_t group,
const std::string dset_name,
const hsize_t toffset);
const hsize_t toffset,
const double wavenumber_exp);
template void kspace<FFTW, SMOOTH>::cospectrum<double, ONE>(
const typename fftw_interface<double>::complex *__restrict__ a,
const typename fftw_interface<double>::complex *__restrict__ b,
const hid_t group,
const std::string dset_name,
const hsize_t toffset);
const hsize_t toffset,
const double wavenumber_exp);
template void kspace<FFTW, SMOOTH>::cospectrum<double, THREE>(
const typename fftw_interface<double>::complex *__restrict__ a,
const typename fftw_interface<double>::complex *__restrict__ b,
const hid_t group,
const std::string dset_name,
const hsize_t toffset);
const hsize_t toffset,
const double wavenumber_exp);
template void kspace<FFTW, SMOOTH>::cospectrum<double, THREExTHREE>(
const typename fftw_interface<double>::complex *__restrict__ a,
const typename fftw_interface<double>::complex *__restrict__ b,
const hid_t group,
const std::string dset_name,
const hsize_t toffset);
const hsize_t toffset,
const double wavenumber_exp);
template void kspace<FFTW, TWO_THIRDS>::cospectrum<float, ONE>(
const typename fftw_interface<float>::complex *__restrict__ a,
const hid_t group,
const std::string dset_name,
const hsize_t toffset);
const hsize_t toffset,
const double wavenumber_exp);
template void kspace<FFTW, TWO_THIRDS>::cospectrum<float, THREE>(
const typename fftw_interface<float>::complex *__restrict__ a,
const hid_t group,
const std::string dset_name,
const hsize_t toffset);
const hsize_t toffset,
const double wavenumber_exp);
template void kspace<FFTW, TWO_THIRDS>::cospectrum<float, THREExTHREE>(
const typename fftw_interface<float>::complex *__restrict__ a,
const hid_t group,
const std::string dset_name,
const hsize_t toffset);
const hsize_t toffset,
const double wavenumber_exp);
template void kspace<FFTW, TWO_THIRDS>::cospectrum<double, ONE>(
const typename fftw_interface<double>::complex *__restrict__ a,
const hid_t group,
const std::string dset_name,
const hsize_t toffset);
const hsize_t toffset,
const double wavenumber_exp);
template void kspace<FFTW, TWO_THIRDS>::cospectrum<double, THREE>(
const typename fftw_interface<double>::complex *__restrict__ a,
const hid_t group,
const std::string dset_name,
const hsize_t toffset);
const hsize_t toffset,
const double wavenumber_exp);
template void kspace<FFTW, TWO_THIRDS>::cospectrum<double, THREExTHREE>(
const typename fftw_interface<double>::complex *__restrict__ a,
const hid_t group,
const std::string dset_name,
const hsize_t toffset);
const hsize_t toffset,
const double wavenumber_exp);
template void kspace<FFTW, SMOOTH>::cospectrum<float, ONE>(
const typename fftw_interface<float>::complex *__restrict__ a,
const hid_t group,
const std::string dset_name,
const hsize_t toffset);
const hsize_t toffset,
const double wavenumber_exp);
template void kspace<FFTW, SMOOTH>::cospectrum<float, THREE>(
const typename fftw_interface<float>::complex *__restrict__ a,
const hid_t group,
const std::string dset_name,
const hsize_t toffset);
const hsize_t toffset,
const double wavenumber_exp);
template void kspace<FFTW, SMOOTH>::cospectrum<float, THREExTHREE>(
const typename fftw_interface<float>::complex *__restrict__ a,
const hid_t group,
const std::string dset_name,
const hsize_t toffset);
const hsize_t toffset,
const double wavenumber_exp);
template void kspace<FFTW, SMOOTH>::cospectrum<double, ONE>(
const typename fftw_interface<double>::complex *__restrict__ a,
const hid_t group,
const std::string dset_name,
const hsize_t toffset);
const hsize_t toffset,
const double wavenumber_exp);
template void kspace<FFTW, SMOOTH>::cospectrum<double, THREE>(
const typename fftw_interface<double>::complex *__restrict__ a,
const hid_t group,
const std::string dset_name,
const hsize_t toffset);
const hsize_t toffset,
const double wavenumber_exp);
template void kspace<FFTW, SMOOTH>::cospectrum<double, THREExTHREE>(
const typename fftw_interface<double>::complex *__restrict__ a,
const hid_t group,
const std::string dset_name,
const hsize_t toffset);
const hsize_t toffset,
const double wavenumber_exp);
template double kspace<FFTW, TWO_THIRDS>::L2norm<float, ONE>(
const typename fftw_interface<float>::complex *__restrict__ a);
......
......@@ -129,7 +129,8 @@ class kspace
const rnumber(* __restrict__ b)[2],
const hid_t group,
const std::string dset_name,
const hsize_t toffset);
const hsize_t toffset,
const double wavenumber_exp = 0);
template <typename rnumber,
field_components fc>
......@@ -137,7 +138,8 @@ class kspace
const rnumber(* __restrict__ a)[2],
const hid_t group,
const std::string dset_name,
const hsize_t toffset);
const hsize_t toffset,
const double wavenumber_exp = 0);
template <typename rnumber,
field_components fc>
......
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