Class JF12Field

Inheritance Relationships

Base Type

Derived Types

Class Documentation

class JF12Field : public MagneticField

JF12Field galactic magnetic field model.

Implements the JF2012 magnetic field model, consisting of a large-scale regular and random (striated) field and a small-scale random (turbulent) field. See: Jansson 2012a, ApJ. 757, A New Model of the Galactic Magnetic Field Jansson 2012b, arXiv:1210.7820, The Galactic Magnetic Field

All three components may individually turned on and off. Currently only best fit values of the field paramaters are implemented and cannot be changed.

The field is defined in the usual 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 regular field components (disk, toroidal halo and polodial halo field) may be turned on and off individually.

Subclassed by JF12FieldSolenoidal, PlanckJF12bField

Public Functions

JF12Field()
void randomStriated(int seed = 0)
void randomTurbulent(int seed = 0)
void setStriatedGrid(ref_ptr<Grid1f> grid)

Set a striated grid and activate the striated field component

Parameters:

grid – scalar grid containing random +1/-1 values, 100 parsec grid spacing

void setTurbulentGrid(ref_ptr<Grid3f> grid)

Set a turbulent grid and activate the turbulent field component

Parameters:

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

ref_ptr<Grid1f> getStriatedGrid()
ref_ptr<Grid3f> getTurbulentGrid()
void setUseRegularField(bool use)
virtual void setUseStriatedField(bool use)
virtual void setUseTurbulentField(bool use)
void setUseDiskField(bool use)
void setUseToroidalHaloField(bool use)
void setUseXField(bool use)
bool isUsingRegularField()
bool isUsingStriatedField()
bool isUsingTurbulentField()
bool isUsingDiskField()
bool isUsingToroidalHaloField()
bool isUsingXField()
double logisticFunction(const double &x, const double &x0, const double &w) const
Vector3d getRegularField(const Vector3d &pos) const
virtual Vector3d getDiskField(const double &r, const double &z, const double &phi, const double &sinPhi, const double &cosPhi) const
Vector3d getToroidalHaloField(const double &r, const double &z, const double &sinPhi, const double &cosPhi) const
virtual Vector3d getXField(const double &r, const double &z, const double &sinPhi, const double &cosPhi) const
Vector3d getStriatedField(const Vector3d &pos) const
double getTurbulentStrength(const Vector3d &pos) const
Vector3d getTurbulentField(const Vector3d &pos) const
virtual Vector3d getField(const Vector3d &pos) const
inline virtual Vector3d getField(const Vector3d &position, double z) const
inline size_t addReference() const
inline size_t removeReference() const
inline int removeReferenceNoDelete() const
inline size_t getReferenceCount() const

Protected Attributes

bool useRegularField
bool useStriatedField
bool useTurbulentField
bool useDiskField
bool useToroidalHaloField
bool useXField
double rArms[8]
double pitch
double sinPitch
double cosPitch
double tanPitch
double cotPitch
double tan90MinusPitch
double bDisk[11]
double bRing
double hDisk
double wDisk
double bNorth
double bSouth
double rNorth
double rSouth
double wHalo
double z0
double bX
double thetaX0
double sinThetaX0
double cosThetaX0
double tanThetaX0
double cotThetaX0
double rXc
double rX
double sqrtbeta
ref_ptr<Grid1f> striatedGrid
ref_ptr<Grid3f> turbulentGrid
double bDiskTurb[8]
double bDiskTurb5
double zDiskTurb
double bHaloTurb
double rHaloTurb
double zHaloTurb
mutable size_t _referenceCount