From 6d4aa3c4f9babde483b4e51a7855873c392d18b0 Mon Sep 17 00:00:00 2001 From: Oliver Hahn Date: Wed, 7 Jun 2023 15:02:15 +0200 Subject: [PATCH] add error when grid size is not even for nLPT>1, added some more verbosity --- src/ic_generator.cc | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/ic_generator.cc b/src/ic_generator.cc index 6f941f0..c243f6c 100644 --- a/src/ic_generator.cc +++ b/src/ic_generator.cc @@ -108,6 +108,20 @@ int run( config_file& the_config ) //! order of the LPT approximation const int LPTorder = the_config.get_value_safe("setup","LPTorder",100); + #if defined(USE_CONVOLVER_ORSZAG) + //! check if grid size is even for Orszag convolver + if( (ngrid%2 != 0) && (LPTorder>1) ){ + music::elog << "ERROR: Orszag convolver for LPTorder>1 requires even grid size!" << std::endl; + throw std::runtime_error("Orszag convolver for LPTorder>1 requires even grid size!"); + return 0; + } + #else + //! warn if Orszag convolver is not used + if( LPTorder>1 ){ + music::wlog << "WARNING: LPTorder>1 requires USE_CONVOLVER_ORSZAG to be enabled to avoid aliased results!" << std::endl; + } + #endif + //-------------------------------------------------------------------------------------------------------- //! initialice particles on a bcc or fcc lattice instead of a standard sc lattice (doubles and quadruples the number of particles) std::string lattice_str = the_config.get_value_safe("setup","ParticleLoad","sc"); @@ -119,17 +133,23 @@ int run( config_file& the_config ) : ((lattice_str=="masked")? particle::lattice_masked : particle::lattice_sc))))); + music::ilog << "Using " << lattice_str << " lattice for particle load." << std::endl; + //-------------------------------------------------------------------------------------------------------- //! apply fixing of the complex mode amplitude following Angulo & Pontzen (2016) [https://arxiv.org/abs/1603.05253] const bool bDoFixing = the_config.get_value_safe("setup", "DoFixing", false); + music::ilog << "Fixing of complex mode amplitudes is " << (bDoFixing?"enabled":"disabled") << std::endl; + const bool bDoInversion = the_config.get_value_safe("setup", "DoInversion", false); - + music::ilog << "Inversion of the phase field is " << (bDoInversion?"enabled":"disabled") << std::endl; //-------------------------------------------------------------------------------------------------------- //! do baryon ICs? const bool bDoBaryons = the_config.get_value_safe("setup", "DoBaryons", false ); + music::ilog << "Baryon ICs are " << (bDoBaryons?"enabled":"disabled") << std::endl; //! enable also back-scaled decaying relative velocity mode? only first order! const bool bDoLinearBCcorr = the_config.get_value_safe("setup", "DoBaryonVrel", false); + music::ilog << "Baryon linear relative velocity mode is " << (bDoLinearBCcorr?"enabled":"disabled") << std::endl; // compute mass fractions std::map< cosmo_species, double > Omega; if( bDoBaryons ){