Magnetic Fields

group MagneticFields

Magnetic field models.

Functions

void crpropa::initHelicalTurbulence(ref_ptr< Grid3f > grid, double Brms, double lMin, double lMax, double alpha = -11/3., int seed = 0, double H = 0)

Same as the simple turbulent field but with helicity.

Parameters
  • H: Helicity

double crpropa::turbulentCorrelationLength(double lMin, double lMax, double alpha = -11/3.)

Analytically calculate the correlation length of the simple model turbulent field

void crpropa::initTurbulence(ref_ptr< Grid3f > grid, double Brms, double lMin, double lMax, double alpha = -11/3., int seed = 0)

Create a random initialization of a turbulent field.

Parameters
  • lMin: Minimum wavelength of the turbulence
  • lMax: Maximum wavelength of the turbulence
  • alpha: Power law index of <B^2(k)> ~ k^alpha (alpha = -11/3 corresponds to a Kolmogorov spectrum)
  • Brms: RMS field strength
  • seed: Random seed

class AMRMagneticField : public MagneticField
#include <AMRMagneticField.h>

Wrapper for saga::MagneticField.

class MagneticField : public Referenced
#include <MagneticField.h>

Abstract base class for magnetic fields.

Subclassed by AMRMagneticField, ArchimedeanSpiralField, JF12Field, LogarithmicSpiralField, MagneticDipoleField, MagneticFieldEvolution, MagneticFieldGrid, MagneticFieldList, ModulatedMagneticFieldGrid, PeriodicMagneticField, PT11Field, QuimbyMagneticField, RenormalizeMagneticField, TF17Field, TorroidalHaloField, TurbulentField, UniformMagneticField

class PeriodicMagneticField : public MagneticField
#include <MagneticField.h>

Magnetic field decorator implementing periodic fields.

class MagneticFieldList : public MagneticField
#include <MagneticField.h>

Magnetic field decorator implementing a superposition of fields.

class MagneticFieldEvolution : public MagneticField
#include <MagneticField.h>

Magnetic field decorator implementing an evolution of type (1+z)^m.

class UniformMagneticField : public MagneticField
#include <MagneticField.h>

Magnetic field with one B-field vector.

class MagneticDipoleField : public MagneticField
#include <MagneticField.h>

Magnetic dipole field defined by the magnetic moment and the ‘core’ radius.

class RenormalizeMagneticField : public MagneticField
#include <MagneticField.h>

Renormalize strength of a given field by expression in which B is the strength variable.

class MagneticFieldGrid : public MagneticField
#include <MagneticFieldGrid.h>

Magnetic field on a periodic (or reflective), cartesian grid with trilinear interpolation.

This class wraps a Grid3f to serve as a MagneticField.

class ModulatedMagneticFieldGrid : public MagneticField
#include <MagneticFieldGrid.h>

Modulated magnetic field on a periodic grid.

This class wraps a Grid3f to serve as a MagneticField. The field is modulated on-the-fly with a Grid1f. The Grid3f and Grid1f do not need to share the same origin, spacing or size.

class GridTurbulence : public TurbulentField
#include <GridTurbulence.h>

Turbulent grid-based magnetic field with a general energy spectrum.

Subclassed by SimpleGridTurbulence

class HelicalGridTurbulence : public SimpleGridTurbulence
#include <HelicalGridTurbulence.h>

Turbulent grid-based magnetic field with a simple power-law spectrum.

class PlaneWaveTurbulence : public TurbulentField
#include <PlaneWaveTurbulence.h>

Interpolation-free turbulent magnetic field based on the GJ99 and TD13 papers.

Overview

This class provides a turbulent magnetic field that is generated as described by (Giacalone and Jokipii, 1999) and (Tautz and Dosch, 2013). Instead of using an inverse Fourier transform to generate the field on a grid which then needs to be interpolated to obtain in-between values this method only generates the wave modes making up the turbulent magnetic field ahead of time. At run time, when the field’s value at a particular position is required, these plane waves are then evaluated analytically at that position. This guarantees that the resulting field is completely free of divergence, reproduces the mean field strength accurately, and does not suffer from other interpolation-induced problems. The disadvantage is that the number of wave modes is drastically smaller when compared with initTurbulence, which might have physical ramifications on the particles propagating through the field. Furthermore, depending on the exact setting, the implementation is somewhat slower (see Schlegel et al. for details).

Using the SIMD optimization

In order to mitigate some of the performance impact that is inherent in this method of field generation, an optimized version utilizing data-level parallelism through SIMD instructions is provided. More specifically, this implementation uses the AVX extension to the x86 instruction set. In order to use this optimized version, three conditions need to be met:

  1. The USE_SIMD option should be explicitly enabled in CMake. Currently, this sets GCC flags that tell the compiler to allow SIMD instructions.
  2. One also should enable the FAST_WAVES option to tell the compiler that you specifically want it to include the SIMD version of PlaneWaveTurbulence.
  3. Finally, the CPU that will actually run the code needs to support the required extensions: AVX and everything below. These extensions are relatively common, but there may still be processors in use that do not support them.

class SimpleTurbulenceSpectrum : public TurbulenceSpectrum
#include <SimpleGridTurbulence.h>

Defines the energy spectrum of simple power-law turbulence.

class SimpleGridTurbulence : public GridTurbulence
#include <SimpleGridTurbulence.h>

Turbulent grid-based magnetic field with a simple power-law spectrum.

Subclassed by HelicalGridTurbulence

class TurbulenceSpectrum : public Referenced
#include <TurbulentField.h>

Defines the energy spectrum of turbulence.

Subclassed by SimpleTurbulenceSpectrum

class TurbulentField : public MagneticField
#include <TurbulentField.h>

An abstract base class for different models of turbulent magnetic fields.

This module provides common methods for all turbulent (synthetic) magnetic fields. Does not actually implement any turbulent field.

Subclassed by GridTurbulence, PlaneWaveTurbulence