Skip to content

Commit

Permalink
Merge pull request #319 from JulienDoerner/CMZMagField
Browse files Browse the repository at this point in the history
Magnetic Field for CMZ
  • Loading branch information
lukasmerten committed Jul 12, 2021
2 parents 50e03f0 + b8eb582 commit e262971
Show file tree
Hide file tree
Showing 8 changed files with 463 additions and 4 deletions.
1 change: 0 additions & 1 deletion .gitignore
Expand Up @@ -26,4 +26,3 @@ cmake/CMakeFiles/
*.dat
*.ipynb_checkpoints
*.idea

1 change: 1 addition & 0 deletions CMakeLists.txt
Expand Up @@ -419,6 +419,7 @@ add_library(crpropa SHARED
src/magneticField/turbulentField/PlaneWaveTurbulence.cpp
src/magneticField/turbulentField/SimpleGridTurbulence.cpp
src/magneticField/TF17Field.cpp
src/magneticField/CMZField.cpp
src/advectionField/AdvectionField.cpp
src/massDistribution/ConstantDensity.cpp
src/massDistribution/Cordes.cpp
Expand Down
1 change: 1 addition & 0 deletions include/CRPropa.h
Expand Up @@ -64,6 +64,7 @@
#include "crpropa/magneticField/PT11Field.h"
#include "crpropa/magneticField/QuimbyMagneticField.h"
#include "crpropa/magneticField/TF17Field.h"
#include "crpropa/magneticField/CMZField.h"
#include "crpropa/magneticField/turbulentField/GridTurbulence.h"
#include "crpropa/magneticField/turbulentField/HelicalGridTurbulence.h"
#include "crpropa/magneticField/turbulentField/PlaneWaveTurbulence.h"
Expand Down
72 changes: 72 additions & 0 deletions include/crpropa/magneticField/CMZField.h
@@ -0,0 +1,72 @@
#ifndef CRPROPA_CMZFIELD_H
#define CRPROPA_CMZFIELD_H

#include "crpropa/magneticField/MagneticField.h"
#include "crpropa/Grid.h"
#include "kiss/logger.h"
#include "crpropa/Common.h"

namespace crpropa {

/**
* @class CMZField
* @brief Magnetic Field Model in the Galactic Center from M. Guenduez et al.
*
* Poloidal Model (Model C) is taken from Katia Ferriere and Philippe Terral 2014 "Analytical models of X-shape magnetic fields in galactic halos" [arXiv:1312.1974]
* Azimuthal Model is taken from M.Guenduez, J.B. Tjus, K.Ferriere, R.-J. Dettmar (2019) [arXiv:1906.05211]
*/

class CMZField: public MagneticField {
protected:
bool useMCField;
bool useICField;
bool useNTFField;
bool useRadioArc;

/** Transform observational parameter a1 in model parameter a. Used for the poloidal model*/
double getA(double a1) const;
/** Transform observational parameter a2 in model parameter L. Used for the poloidal model*/
double getL(double a2) const;

public:
CMZField();

bool getUseMCField() const;
bool getUseICField() const;
bool getUseNTFField() const;
bool getUseRadioArc() const;

void setUseMCField(bool use);
void setUseICField(bool use);
void setUseNTFField(bool use);
void setUseRadioArc(bool use);

/** Magnetic field in the poloidal model. Used für inter-cloud(IC), non-thermal-filaments(NTF) and for the RadioArc.
@param position position in galactic coordinates with Eart at (-8.5kpc, 0,0)
@param mid midpoint of the object
@param B1 normalized magnetic field strength
@param a fitting parameter for the radial scale height
@param L fitting parameter for the z scale height
@return magnetic field vector */
Vector3d BPol(const Vector3d& position,const Vector3d& mid, double B1, double a, double L) const;

/** Magnetic field in the azimuthal model. Used for molecular clouds (MC)
@param position position in galactic coordinates with Eart at (-8.5kpc, 0,0)
@param mid midpoint of the object
@param B1 normalized magnetic field strength
@param eta ratio between radial and azimuthal component
@param R Radius of the cloud
@return magnetic field vector*/
Vector3d BAz(const Vector3d& position, const Vector3d& mid, double B1, double eta, double R) const;

Vector3d getMCField(const Vector3d& pos) const;
Vector3d getICField(const Vector3d& pos) const;
Vector3d getNTFField(const Vector3d& pos) const;
Vector3d getRadioArcField(const Vector3d& pos) const;

Vector3d getField(const Vector3d& pos) const;
};

} // namespace crpropa

#endif // CRPROPA_CMZFIELD_H
1 change: 1 addition & 0 deletions python/2_headers.i
Expand Up @@ -448,6 +448,7 @@ using namespace crpropa; // for usage of namespace in header files, necessary
%include "crpropa/magneticField/PT11Field.h"
%include "crpropa/magneticField/TF17Field.h"
%include "crpropa/magneticField/ArchimedeanSpiralField.h"
%include "crpropa/magneticField/CMZField.h"
%include "crpropa/magneticField/turbulentField/TurbulentField.h"
%include "crpropa/magneticField/turbulentField/GridTurbulence.h"
%include "crpropa/magneticField/turbulentField/SimpleGridTurbulence.h"
Expand Down

0 comments on commit e262971

Please sign in to comment.