Class UF26Field

Inheritance Relationships

Base Type

Class Documentation

class UF26Field : public MagneticField

UF26 model of the random Galactic magnetic field.

Implements the two random-field models of UF26, expDisk and ringDisk (Table 2 of M. Unger and G.R. Farrar, arXiv:2608.21293). The coherent field of the same authors is available as UF23Field.

The models describe the rms strength b(x) of the isotropic random field, i.e. <|B|^2> = b^2, where the average is over a volume large compared to the coherence length of the field. Each Cartesian component therefore has an rms of b/sqrt(3). The rms strength is given by getTurbulentStrength().

As for the turbulent component of JF12Field, a realization of the field is obtained by scaling a turbulent grid with B_rms = 1 to the local rms strength, B(x) = b(x) * B_grid(x). The grid is created with randomTurbulent() or set with setTurbulentGrid(). The paper does not determine the coherence length; randomTurbulent() uses Lc = 30 pc by default, the value used for the deflection estimates in the paper. The scaling breaks div B = 0 at the level of Lc divided by the scale of variation of b (>~ 1 kpc).

Usage together with the coherent UF23 field, e.g. for backtracking or lens production (Python):

B = MagneticFieldList()
B.addField(UF23Field(UF23Field.base))
B26 = UF26Field(UF26Field.expDisk)
B26.randomTurbulent(seed)  # or randomTurbulent(seed, Lc), default Lc = 30 pc
B.addField(B26)

For a different spectrum, create the grid e.g. with SimpleGridTurbulence (Brms = 1) and pass it with setTurbulentGrid().

Assumes a galactocentric coordinate system with the Galactic center at the origin, the x-axis pointing in the opposite direction of the Sun, and the z-axis pointing towards Galactic North. The Sun is at a distance of 8.178 kpc from the Galactic center.

Public Types

enum ModelType

models of Table 2 of the UF26 paper

Values:

enumerator expDisk
enumerator ringDisk

Public Functions

UF26Field(const ModelType mt)

constructor

Parameters:

mt – model type (expDisk or ringDisk)

UF26Field() = delete

no default constructor

void randomTurbulent(int seed = 0, double lc = 30 * parsec)

create and set a random realization of the turbulent grid

Kolmogorov spectrum with B_rms = 1 and lMax/lMin = 34 on a periodic grid of 256^3 points (200 MB) with a spacing of lMin/2. The length scales follow from the coherence length: for Lc = 30 pc, lMin = 4.0 pc, lMax = 136 pc and the box size is 512 pc. Lc = 60 pc corresponds to the grid of JF12Field::randomTurbulent().

Parameters:
  • seed – random seed, 0: random realization

  • lc – coherence length of the turbulence

void setTurbulentGrid(ref_ptr<Grid3f> grid)

Set a turbulent grid

Parameters:

grid – vector grid containing a random field of Brms = 1

ref_ptr<Grid3f> getTurbulentGrid()
bool isUsingTurbulentField() const

true if a turbulent grid is set

double getTurbulentStrength(const Vector3d &pos) const

rms strength b of the random field (Eqs. 12 and 15 in quadrature)

Vector3d getTurbulentField(const Vector3d &pos) const

realization of the random field, b(pos) * B_grid(pos)

Throws:

std::runtime_error – if no turbulent grid is set

virtual Vector3d getField(const Vector3d &pos) const

same as getTurbulentField()

ModelType getModelType() const
std::string getModelName() const
inline virtual Vector3d getField(const Vector3d &position, double z) const