1
0
Fork 0
mirror of https://github.com/cosmo-sims/monofonIC.git synced 2024-09-19 17:03:45 +02:00

Bug fix: Nyquist modes set to zero for case where the mode power would otherwise be set to the mean power, instead of NaN

This commit is contained in:
Adrian Jenkins 2021-06-17 14:47:31 +01:00
parent ef8cc6d863
commit af2c77fcd8

View file

@ -441,13 +441,15 @@ int m;
ky = (iy > nfft_dim/2) ? iy-nfft_dim : iy; ky = (iy > nfft_dim/2) ? iy-nfft_dim : iy;
kz = (iz > nfft_dim/2) ? iz-nfft_dim : iz; kz = (iz > nfft_dim/2) ? iz-nfft_dim : iz;
ksquared = kx*kx + ky*ky + kz*kz; ksquared = kx*kx + ky*ky + kz*kz;
if ( (kx!=nfft_dim/2)&&(ky!=nfft_dim/2)&&(kz!=nfft_dim/2)){ //Omit Nyquist modes
if ((ksquared<=descriptor_kk_limit)&&(ksquared!=0)){ if ((ksquared<=descriptor_kk_limit)&&(ksquared!=0)){
index1 = ix*N0_fourier_grid*(N0_fourier_grid/2+1) + iy*(N0_fourier_grid/2+1) + iz; index1 = ix*N0_fourier_grid*(N0_fourier_grid/2+1) + iy*(N0_fourier_grid/2+1) + iz;
weight = cabs(return_field[index1]); weight = cabs(return_field[index1]);
return_field[index1] /= weight; return_field[index1] /= weight;
}; };
}; };
};
}; };
//printf("Reached here 12!\n"); //printf("Reached here 12!\n");