Skip to content

Commit f9029de

Browse files
authored
Merge pull request #513 from alexkorochkin/master
Add KST24 coherent Galactic magnetic field model
2 parents 5e8b1cb + 5d31ba9 commit f9029de

File tree

5 files changed

+532
-0
lines changed

5 files changed

+532
-0
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,7 @@ add_library(crpropa SHARED
402402
src/magneticField/turbulentField/SimpleGridTurbulence.cpp
403403
src/magneticField/TF17Field.cpp
404404
src/magneticField/UF23Field.cpp
405+
src/magneticField/KST24Field.cpp
405406
src/magneticField/CMZField.cpp
406407
src/advectionField/AdvectionField.cpp
407408
src/massDistribution/ConstantDensity.cpp

include/CRPropa.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
#include "crpropa/magneticField/QuimbyMagneticField.h"
6666
#include "crpropa/magneticField/TF17Field.h"
6767
#include "crpropa/magneticField/UF23Field.h"
68+
#include "crpropa/magneticField/KST24Field.h"
6869
#include "crpropa/magneticField/CMZField.h"
6970
#include "crpropa/magneticField/turbulentField/GridTurbulence.h"
7071
#include "crpropa/magneticField/turbulentField/HelicalGridTurbulence.h"
Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
#ifndef _KST24_GMF_H_
2+
#define _KST24_GMF_H_
3+
4+
#include <vector>
5+
#include "crpropa/magneticField/MagneticField.h"
6+
7+
namespace crpropa {
8+
9+
/*
10+
The C++ implementation of the GMF model KST24 (A.Korochkin, D.Semikoz, P.Tinyakov 2024)
11+
The model was presented in arXiv:2407.02148 and published in A&A
12+
If you use the model, please cite A&A, 693, A284 (2025)
13+
14+
In KST24 GMF model the position of the Solar System is at {-8.2 kpc, 0, 0}
15+
The Galactic Center is at {0, 0, 0}
16+
z-axis points to the North pole
17+
*/
18+
19+
20+
class KST24Field : public MagneticField
21+
{
22+
private:
23+
double north_tor_B_gauss;
24+
double north_tor_zmin_kpc;
25+
double north_tor_zmax_kpc;
26+
double north_tor_rmin_kpc;
27+
double north_tor_rmax_kpc;
28+
29+
double south_tor_B_gauss;
30+
double south_tor_zmin_kpc;
31+
double south_tor_zmax_kpc;
32+
double south_tor_rmin_kpc;
33+
double south_tor_rmax_kpc;
34+
35+
double Xfield_B_gauss;
36+
double Xfield_rmin_kpc;
37+
double Xfield_rmax_kpc;
38+
double Xfield_theta_deg;
39+
double Xfield_theta_rad;
40+
41+
double LB_B_gauss;
42+
double LB_lB_deg;
43+
double LB_bB_deg;
44+
double LB_rmin_kpc;
45+
double LB_dr_kpc;
46+
double LB_x0_kpc;
47+
double LB_y0_kpc;
48+
double LB_z0_kpc;
49+
double LB_Bdir_x;
50+
double LB_Bdir_y;
51+
double LB_Bdir_z;
52+
53+
double ScutumArm_B_gauss;
54+
double ScutumArm_pitch_deg;
55+
double ScutumArm_phi0_deg;
56+
double ScutumArm_x_shift_kpc;
57+
double ScutumArm_y_shift_kpc;
58+
double ScutumArm_arc_radius1_kpc;
59+
double ScutumArm_arc_radius2_kpc;
60+
double ScutumArm_arc_eps;
61+
double ScutumArm_arc_div_deg;
62+
double ScutumArm_rmin_kpc;
63+
double ScutumArm_rmax_kpc;
64+
double ScutumArm_zmin_kpc;
65+
double ScutumArm_zmax_kpc;
66+
67+
double CarinaSagittariusArm_B_gauss;
68+
double CarinaSagittariusArm_pitch_deg;
69+
double CarinaSagittariusArm_phi0_deg;
70+
double CarinaSagittariusArm_x_shift_kpc;
71+
double CarinaSagittariusArm_y_shift_kpc;
72+
double CarinaSagittariusArm_arc_radius1_kpc;
73+
double CarinaSagittariusArm_arc_radius2_kpc;
74+
double CarinaSagittariusArm_arc_eps;
75+
double CarinaSagittariusArm_arc_div_deg;
76+
double CarinaSagittariusArm_rmin_kpc;
77+
double CarinaSagittariusArm_rmax_kpc;
78+
double CarinaSagittariusArm_zmin_kpc;
79+
double CarinaSagittariusArm_zmax_kpc;
80+
81+
double LocalArm_B_gauss;
82+
double LocalArm_pitch_deg;
83+
double LocalArm_phi0_deg;
84+
double LocalArm_x_shift_kpc;
85+
double LocalArm_y_shift_kpc;
86+
double LocalArm_arc_radius1_kpc;
87+
double LocalArm_arc_radius2_kpc;
88+
double LocalArm_arc_eps;
89+
double LocalArm_arc_div_deg;
90+
double LocalArm_rmin_kpc;
91+
double LocalArm_rmax_kpc;
92+
double LocalArm_zmin_kpc;
93+
double LocalArm_zmax_kpc;
94+
95+
double PerseusArm1_B_gauss;
96+
double PerseusArm1_pitch_deg;
97+
double PerseusArm1_phi0_deg;
98+
double PerseusArm1_x_shift_kpc;
99+
double PerseusArm1_y_shift_kpc;
100+
double PerseusArm1_arc_radius1_kpc;
101+
double PerseusArm1_arc_radius2_kpc;
102+
double PerseusArm1_arc_eps;
103+
double PerseusArm1_arc_div_deg;
104+
double PerseusArm1_rmin_kpc;
105+
double PerseusArm1_rmax_kpc;
106+
double PerseusArm1_zmin_kpc;
107+
double PerseusArm1_zmax_kpc;
108+
109+
double PerseusArm2_B_gauss;
110+
double PerseusArm2_pitch_deg;
111+
double PerseusArm2_phi0_deg;
112+
double PerseusArm2_x_shift_kpc;
113+
double PerseusArm2_y_shift_kpc;
114+
double PerseusArm2_arc_radius1_kpc;
115+
double PerseusArm2_arc_radius2_kpc;
116+
double PerseusArm2_arc_eps;
117+
double PerseusArm2_arc_div_deg;
118+
double PerseusArm2_rmin_kpc;
119+
double PerseusArm2_rmax_kpc;
120+
double PerseusArm2_zmin_kpc;
121+
double PerseusArm2_zmax_kpc;
122+
123+
public:
124+
Vector3d getField(const Vector3d& pos) const;
125+
KST24Field();
126+
127+
Vector3d get_toroidal(const Vector3d pos_kpc, const double tor_B_gauss,
128+
const double tor_zmin_kpc, const double tor_zmax_kpc,
129+
const double tor_rmin_kpc, const double tor_rmax_kpc) const;
130+
131+
Vector3d get_Xfield(const Vector3d pos_kpc, const double Xfield_B_gauss,
132+
const double Xfield_rmin_kpc, const double Xfield_rmax_kpc,
133+
const double Xfield_theta_rad) const;
134+
135+
bool is_LB(const Vector3d pos_kpc, const double LB_rmin_kpc, const double LB_dr_kpc,
136+
const double LB_x0_kpc, const double LB_y0_kpc, const double LB_z0_kpc) const;
137+
138+
Vector3d get_LB(const Vector3d pos_kpc, const double LB_B_gauss,
139+
const double LB_lB_deg, const double LB_bB_deg,
140+
const double LB_rmin_kpc, const double LB_dr_kpc,
141+
const double LB_x0_kpc, const double LB_y0_kpc, const double LB_z0_kpc) const;
142+
143+
Vector3d get_logspiral(const Vector3d pos_kpc, const double B_gauss,
144+
const double pitch_deg, const double phi0_deg,
145+
const double x_shift_kpc, const double y_shift_kpc,
146+
const double arc_radius1_kpc, const double arc_radius2_kpc,
147+
const double arc_eps , const double arc_div_deg,
148+
const double rmin_kpc, const double rmax_kpc,
149+
const double zmin_kpc, const double zmax_kpc) const;
150+
};
151+
152+
}// namespace crpropa
153+
154+
#endif /* _KST24_GMF_H_ */

python/2_headers.i

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,7 @@
346346
%include "crpropa/magneticField/PT11Field.h"
347347
%include "crpropa/magneticField/TF17Field.h"
348348
%include "crpropa/magneticField/UF23Field.h"
349+
%include "crpropa/magneticField/KST24Field.h"
349350
%include "crpropa/magneticField/ArchimedeanSpiralField.h"
350351
%include "crpropa/magneticField/CMZField.h"
351352
%include "crpropa/magneticField/turbulentField/TurbulentField.h"

0 commit comments

Comments
 (0)