1
0
Fork 0
mirror of https://github.com/cosmo-sims/MUSIC.git synced 2024-09-18 15:53:45 +02:00

fixed some inconsistencies with fourier vs. real-space derefinement and convolution margins

This commit is contained in:
Oliver Hahn 2024-02-23 22:22:35 +01:00
parent 493436954f
commit a424e07a5e
4 changed files with 8 additions and 8 deletions

View file

@ -331,11 +331,11 @@ void GenerateDensityHierarchy(config_file &cf, const cosmology::calculator* cc,
unsigned levelmin = cf.get_value_safe<unsigned>("setup", "levelmin_TF", levelminPoisson);
unsigned levelmax = cf.get_value<unsigned>("setup", "levelmax");
unsigned margin = cf.get_value_safe<unsigned>("setup", "convolution_margin", 8);
unsigned margin = cf.get_value_safe<unsigned>("setup", "convolution_margin", 4);
bool fix = cf.get_value_safe<bool>("setup","fix_mode_amplitude",false);
bool flip = cf.get_value_safe<bool>("setup","flip_mode_amplitude",false);
bool fourier_splicing = true; //cf.get_value_safe<bool>("setup","fourier_splicing",true);
bool fourier_splicing = cf.get_value_safe<bool>("setup","fourier_splicing",true);
if( fix && levelmin != levelmax ){
music::wlog.Print("You have chosen mode fixing for a zoom. This is not well tested,\n please proceed at your own risk...");
@ -521,12 +521,11 @@ void normalize_levelmin_density(grid_hierarchy &delta)
}
void coarsen_density(const refinement_hierarchy &rh, GridHierarchy<real_t> &u, bool kspace)
void coarsen_density(const refinement_hierarchy &rh, GridHierarchy<real_t> &u, bool bfourier_coarsening )
{
const unsigned levelmin_TF = u.levelmin();
const bool benforce_coarse = !kspace;
if (kspace)
if (bfourier_coarsening)
{
for (int i = levelmin_TF; i >= (int)rh.levelmin(); --i)
fft_coarsen(*(u.get_grid(i)), *(u.get_grid(i - 1)));
@ -547,7 +546,7 @@ void coarsen_density(const refinement_hierarchy &rh, GridHierarchy<real_t> &u, b
rh.size(i, 0), rh.size(i, 1), rh.size(i, 2), benforce_coarse);
}
}
if( !benforce_coarse ){
if( !fourier_coarsening ){
normalize_levelmin_density( u );
}
}

View file

@ -27,6 +27,6 @@ void GenerateDensityUnigrid(config_file &cf, const cosmology::calculator*, tf_ty
void normalize_density(grid_hierarchy &delta);
void coarsen_density(const refinement_hierarchy &rh, GridHierarchy<real_t> &u, bool kspace);
void coarsen_density(const refinement_hierarchy &rh, GridHierarchy<real_t> &u, bool bfourier_coarsening );
#endif

View file

@ -589,6 +589,7 @@ int main(int argc, const char *argv[])
poisson_plugin *the_poisson_solver = the_poisson_plugin_creator->create(cf);
// .. this parameter needs to be read after the random module is initialised as it will be overwritten by it
// .. e.g. PANPHASIA wants false, while MUSIC RNG wants true
const bool use_fourier_coarsening = cf.get_value_safe<bool>("setup", "fourier_splicing", true);
//---------------------------------------------------------------------------------

View file

@ -1317,7 +1317,7 @@ public:
preserve_dims_ = cf_.get_value_safe<bool>("setup", "preserve_dims", false);
equal_extent_ = cf_.get_value_safe<bool>("setup", "force_equal_extent", false);
blocking_factor_ = cf.get_value_safe<unsigned>("setup", "blocking_factor", 0);
margin_ = cf.get_value_safe<int>("setup", "convolution_margin", 32);
margin_ = cf.get_value_safe<int>("setup", "convolution_margin", 4);
bool bnoshift = cf_.get_value_safe<bool>("setup", "no_shift", false);
bool force_shift = cf_.get_value_safe<bool>("setup", "force_shift", false);