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

added low-pass filtering of coarse fields

This commit is contained in:
Oliver Hahn 2024-02-26 10:19:53 +08:00
parent 41459bd425
commit bfbb00ae71

View file

@ -27,6 +27,7 @@
#define DEF_RAN_CUBE_SIZE 32 #define DEF_RAN_CUBE_SIZE 32
/* interpolate upwards in the hierarchy */
template <typename m1, typename m2> template <typename m1, typename m2>
void fft_coarsen(m1 &v, m2 &V) void fft_coarsen(m1 &v, m2 &V)
{ {
@ -84,13 +85,14 @@ void fft_coarsen(m1 &v, m2 &V)
val_fine *= val_phas * fftnorm / 8.0; val_fine *= val_phas * fftnorm / 8.0;
if( i!=(int)nxF/2 && j!=(int)nyF/2 && k!=(int)nzF/2 ){ double blend_coarse_x = Meyer_scaling_function(kx, nxF / 2);
RE(ccoarse[qc]) = val_fine.real(); double blend_coarse_y = Meyer_scaling_function(ky, nyF / 2);
IM(ccoarse[qc]) = val_fine.imag(); double blend_coarse_z = Meyer_scaling_function(kz, nzF / 2);
}else{
RE(ccoarse[qc]) = 0.0;//val_fine.real(); double blend_coarse = blend_coarse_x*blend_coarse_y*blend_coarse_z;
IM(ccoarse[qc]) = 0.0;//val_fine.imag();
} RE(ccoarse[qc]) = val_fine.real() * blend_coarse;
IM(ccoarse[qc]) = val_fine.imag() * blend_coarse;
} }
delete[] rfine; delete[] rfine;
@ -112,6 +114,7 @@ void fft_coarsen(m1 &v, m2 &V)
FFTW_API(destroy_plan)(ipc); FFTW_API(destroy_plan)(ipc);
} }
/* interpolate downwards in the hierarchy */
template <typename m1, typename m2> template <typename m1, typename m2>
void fft_interpolate(m1 &V, m2 &v, int margin, bool from_basegrid = false) void fft_interpolate(m1 &V, m2 &v, int margin, bool from_basegrid = false)
{ {