Line data Source code
1 : #ifndef CRPROPA_HELICALGRIDTURBULENCE_H 2 : #define CRPROPA_HELICALGRIDTURBULENCE_H 3 : 4 : #ifdef CRPROPA_HAVE_FFTW3F 5 : 6 : #include "crpropa/Grid.h" 7 : #include "crpropa/magneticField/turbulentField/SimpleGridTurbulence.h" 8 : 9 : #include "kiss/logger.h" 10 : #include "kiss/string.h" 11 : 12 : namespace crpropa { 13 : /** 14 : * \addtogroup MagneticFields 15 : * @{ 16 : */ 17 : 18 : /** 19 : @class HelicalGridTurbulence 20 : @brief Turbulent grid-based magnetic field with a simple power-law spectrum 21 : */ 22 : class HelicalGridTurbulence : public SimpleGridTurbulence { 23 : private: 24 : double H; 25 : 26 : public: 27 : /** 28 : Create a random initialization of a turbulent field. 29 : @param spectrum TurbulenceSpectrum instance to define the spectrum of 30 : turbulence 31 : @param gridProp GridProperties instance to define the underlying grid 32 : @param H Helicity 33 : @param seed Random seed 34 : */ 35 : HelicalGridTurbulence(const SimpleTurbulenceSpectrum &spectrum, 36 : const GridProperties &gridProp, double H, 37 : unsigned int seed = 0); 38 : 39 : static void initTurbulence(ref_ptr<Grid3f> grid, double Brms, double lMin, 40 : double lMax, double alpha, int seed, double H); 41 : }; 42 : 43 : // Compatibility with old functions from GridTurbulence: 44 : 45 : /** 46 : Create a random initialization of a turbulent field including helicity 47 : @param grid grid on which the turbulence is calculated 48 : @param Brms RMS field strength 49 : @param lMin Minimum wavelength of the turbulence 50 : @param lMax Maximum wavelength of the turbulence 51 : @param alpha Power law index of <B^2(k)> ~ k^alpha (alpha = -11/3 corresponds 52 : to a Kolmogorov spectrum) 53 : @param seed Random seed 54 : @param H Helicity 55 : */ 56 0 : void initHelicalTurbulence(ref_ptr<Grid3f> grid, double Brms, double lMin, 57 : double lMax, double alpha = -11 / 3., int seed = 0, 58 : double H = 0) { 59 0 : KISS_LOG_WARNING 60 : << "initTurbulence is deprecated and will be removed in the future. " 61 0 : "Replace it with a more appropriate turbulent field model instance."; 62 0 : HelicalGridTurbulence::initTurbulence(grid, Brms, lMin, lMax, alpha, seed, 63 : H); 64 0 : } 65 : 66 : /** @}*/ 67 : } // namespace crpropa 68 : 69 : #endif // CRPROPA_HAVE_FFTW3F 70 : 71 : #endif // CRPROPA_HELICALGRIDTURBULENCE_H