ARTS 2.5.11 (git: 725533f0)
igrf13.cc
Go to the documentation of this file.
1#include <algorithm>
2
3#include "arts_conversions.h"
4#include "arts_omp.h"
5#include "igrf13.h"
6#include "legendre.h"
7#include "matpack_constexpr.h"
8
30namespace IGRF {
32constexpr matpack::matpack_constant_data<Numeric, 14, 14> g2020{
33 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
34 0.0, 0.0, 0.0, 0.0, 0.0, -29404.8, -1450.9, 0.0, 0.0,
35 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
36 0.0, -2499.6, 2982.0, 1677.0, 0.0, 0.0, 0.0, 0.0, 0.0,
37 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1363.2, -2381.2, 1236.2,
38 525.7, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
39 0.0, 0.0, 903.0, 809.5, 86.3, -309.4, 48.0, 0.0, 0.0,
40 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -234.3, 363.2,
41 187.8, -140.7, -151.2, 13.5, 0.0, 0.0, 0.0, 0.0, 0.0,
42 0.0, 0.0, 0.0, 66.0, 65.5, 72.9, -121.5, -36.2, 13.5,
43 -64.7, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 80.6,
44 -76.7, -8.2, 56.5, 15.8, 6.4, -7.2, 9.8, 0.0, 0.0,
45 0.0, 0.0, 0.0, 0.0, 23.7, 9.7, -17.6, -0.5, -21.1,
46 15.3, 13.7, -16.5, -0.3, 0.0, 0.0, 0.0, 0.0, 0.0,
47 5.0, 8.4, 2.9, -1.5, -1.1, -13.2, 1.1, 8.8, -9.3,
48 -11.9, 0.0, 0.0, 0.0, 0.0, -1.9, -6.2, -0.1, 1.7,
49 -0.9, 0.7, -0.9, 1.9, 1.4, -2.4, -3.8, 0.0, 0.0,
50 0.0, 3.0, -1.4, -2.5, 2.3, -0.9, 0.3, -0.7, -0.1,
51 1.4, -0.6, 0.2, 3.1, 0.0, 0.0, -2.0, -0.1, 0.5,
52 1.3, -1.2, 0.7, 0.3, 0.5, -0.3, -0.5, 0.1, -1.1,
53 -0.3, 0.0, 0.1, -0.9, 0.5, 0.7, -0.3, 0.8, 0.0,
54 0.8, 0.0, 0.4, 0.1, 0.5, -0.5, -0.4,
55};
56
58constexpr matpack::matpack_constant_data<Numeric, 14, 14> h2020{
59 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
60 0.0, 0.0, 0.0, 0.0, 0.0, 4652.5, 0.0, 0.0, 0.0, 0.0,
61 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -2991.6,
62 -734.6, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
63 0.0, 0.0, 0.0, -82.1, 241.9, -543.4, 0.0, 0.0, 0.0, 0.0,
64 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 281.9, -158.4, 199.7,
65 -349.7, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
66 0.0, 47.7, 208.3, -121.2, 32.3, 98.9, 0.0, 0.0, 0.0, 0.0,
67 0.0, 0.0, 0.0, 0.0, 0.0, -19.1, 25.1, 52.8, -64.5, 8.9,
68 68.1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -51.5,
69 -16.9, 2.2, 23.5, -2.2, -27.2, -1.8, 0.0, 0.0, 0.0, 0.0,
70 0.0, 0.0, 0.0, 8.4, -15.3, 12.8, -11.7, 14.9, 3.6, -6.9,
71 2.8, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -23.4, 11.0, 9.8,
72 -5.1, -6.3, 7.8, 0.4, -1.4, 9.6, 0.0, 0.0, 0.0, 0.0,
73 0.0, 3.4, -0.2, 3.6, 4.8, -8.6, -0.1, -4.3, -3.4, -0.1,
74 -8.8, 0.0, 0.0, 0.0, 0.0, 0.0, 2.5, -0.6, -0.4, 0.6,
75 -0.2, -1.7, -1.6, -3.0, -2.0, -2.6, 0.0, 0.0, 0.0, -1.2,
76 0.5, 1.4, -1.8, 0.1, 0.8, -0.2, 0.6, 0.2, -0.9, 0.0,
77 0.5, 0.0, 0.0, -0.9, 0.6, 1.4, -0.4, -1.3, -0.1, 0.3,
78 -0.1, 0.5, 0.5, -0.4, -0.4, -0.6,
79};
80
82constexpr matpack::matpack_constant_data<Numeric, 14, 14> g2015{
83 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
84 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -29441.46, -1501.77,
85 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
86 0.0, 0.0, 0.0, 0.0, -2445.88, 3012.2, 1676.35, 0.0,
87 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
88 0.0, 0.0, 1350.33, -2352.26, 1225.85, 581.69, 0.0, 0.0,
89 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
90 907.42, 813.68, 120.49, -334.85, 70.38, 0.0, 0.0, 0.0,
91 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -232.91, 360.14,
92 192.35, -140.94, -157.4, 4.3, 0.0, 0.0, 0.0, 0.0,
93 0.0, 0.0, 0.0, 0.0, 69.55, 67.57, 72.79, -129.85,
94 -28.93, 13.14, -70.85, 0.0, 0.0, 0.0, 0.0, 0.0,
95 0.0, 0.0, 81.29, -75.99, -6.79, 51.82, 15.07, 9.32,
96 -2.88, 6.61, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
97 23.98, 8.89, -16.78, -3.16, -20.56, 13.33, 11.76, -15.98,
98 -2.02, 0.0, 0.0, 0.0, 0.0, 0.0, 5.33, 8.83,
99 3.02, -3.22, 0.67, -13.2, -0.1, 8.68, -9.06, -10.54,
100 0.0, 0.0, 0.0, 0.0, -2.01, -6.26, 0.17, 0.55,
101 -0.55, 1.7, -0.67, 2.13, 2.33, -1.8, -3.59, 0.0,
102 0.0, 0.0, 3.0, -1.4, -2.3, 2.08, -0.79, 0.58,
103 -0.7, 0.14, 1.7, -0.22, 0.44, 3.49, 0.0, 0.0,
104 -2.09, -0.16, 0.46, 1.23, -0.89, 0.85, 0.1, 0.54,
105 -0.37, -0.43, 0.22, -0.94, -0.03, 0.0, -0.02, -0.92,
106 0.42, 0.63, -0.42, 0.96, -0.19, 0.81, -0.13, 0.38,
107 0.08, 0.46, -0.35, -0.36,
108};
109
111constexpr matpack::matpack_constant_data<Numeric, 14, 14> h2015{
112 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
113 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 4795.99,
114 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
115 0.0, 0.0, 0.0, 0.0, 0.0, -2845.41, -642.17, 0.0,
116 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
117 0.0, 0.0, 0.0, -115.29, 245.04, -538.7, 0.0, 0.0,
118 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
119 0.0, 283.54, -188.43, 180.95, -329.23, 0.0, 0.0, 0.0,
120 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 46.98,
121 196.98, -119.14, 15.98, 100.12, 0.0, 0.0, 0.0, 0.0,
122 0.0, 0.0, 0.0, 0.0, 0.0, -20.61, 33.3, 58.74,
123 -66.64, 7.35, 62.41, 0.0, 0.0, 0.0, 0.0, 0.0,
124 0.0, 0.0, 0.0, -54.27, -19.53, 5.59, 24.45, 3.27,
125 -27.5, -2.32, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
126 0.0, 10.04, -18.26, 13.18, -14.6, 16.16, 5.69, -9.1,
127 2.26, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -21.77,
128 10.76, 11.74, -6.74, -6.88, 7.79, 1.04, -3.89, 8.44,
129 0.0, 0.0, 0.0, 0.0, 0.0, 3.28, -0.4, 4.55,
130 4.4, -7.92, -0.61, -4.16, -2.85, -1.12, -8.72, 0.0,
131 0.0, 0.0, 0.0, 0.0, 2.11, -0.6, -1.05, 0.76,
132 -0.2, -2.12, -1.44, -2.57, -2.01, -2.34, 0.0, 0.0,
133 0.0, -1.08, 0.37, 1.75, -2.19, 0.27, 0.72, -0.09,
134 0.29, 0.23, -0.89, -0.16, 0.72, 0.0, 0.0, -0.88,
135 0.49, 1.56, -0.5, -1.24, -0.1, 0.42, -0.04, 0.48,
136 0.48, -0.3, -0.43, -0.71,
137};
138
140constexpr matpack::matpack_constant_data<Numeric, 14, 14> g2010{
141 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
142 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -29496.57, -1586.42,
143 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
144 0.0, 0.0, 0.0, 0.0, -2396.06, 3026.34, 1668.17, 0.0,
145 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
146 0.0, 0.0, 1339.85, -2326.54, 1232.1, 633.73, 0.0, 0.0,
147 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
148 912.66, 808.97, 166.58, -356.83, 89.4, 0.0, 0.0, 0.0,
149 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -230.87, 357.29,
150 200.26, -141.05, -163.17, -8.03, 0.0, 0.0, 0.0, 0.0,
151 0.0, 0.0, 0.0, 0.0, 72.78, 68.69, 75.92, -141.4,
152 -22.83, 13.1, -78.09, 0.0, 0.0, 0.0, 0.0, 0.0,
153 0.0, 0.0, 80.44, -75.0, -4.55, 45.24, 14.0, 10.46,
154 1.64, 4.92, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
155 24.41, 8.21, -14.5, -5.59, -19.34, 11.61, 10.85, -14.05,
156 -3.54, 0.0, 0.0, 0.0, 0.0, 0.0, 5.5, 9.45,
157 3.45, -5.27, 3.13, -12.38, -0.76, 8.43, -8.42, -10.08,
158 0.0, 0.0, 0.0, 0.0, -1.94, -6.24, 0.89, -1.07,
159 -0.16, 2.45, -0.33, 2.13, 3.09, -1.03, -2.8, 0.0,
160 0.0, 0.0, 3.05, -1.48, -2.03, 1.65, -0.51, 0.54,
161 -0.79, 0.37, 1.79, 0.12, 0.75, 3.75, 0.0, 0.0,
162 -2.12, -0.21, 0.3, 1.04, -0.63, 0.95, -0.11, 0.52,
163 -0.39, -0.37, 0.21, -0.77, 0.04, 0.0, -0.09, -0.89,
164 0.31, 0.42, -0.45, 1.08, -0.31, 0.78, -0.18, 0.38,
165 0.02, 0.42, -0.26, -0.26,
166};
167
169constexpr matpack::matpack_constant_data<Numeric, 14, 14> h2010{
170 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
171 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 4944.26,
172 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
173 0.0, 0.0, 0.0, 0.0, 0.0, -2708.54, -575.73, 0.0,
174 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
175 0.0, 0.0, 0.0, -160.4, 251.75, -537.03, 0.0, 0.0,
176 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
177 0.0, 286.48, -211.03, 164.46, -309.72, 0.0, 0.0, 0.0,
178 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 44.58,
179 189.01, -118.06, -0.01, 101.04, 0.0, 0.0, 0.0, 0.0,
180 0.0, 0.0, 0.0, 0.0, 0.0, -20.9, 44.18, 61.54,
181 -66.26, 3.02, 55.4, 0.0, 0.0, 0.0, 0.0, 0.0,
182 0.0, 0.0, 0.0, -57.8, -21.2, 6.54, 24.96, 7.03,
183 -27.61, -3.28, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
184 0.0, 10.84, -20.03, 11.83, -17.41, 16.71, 6.96, -10.74,
185 1.64, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -20.54,
186 11.51, 12.75, -7.14, -7.42, 7.97, 2.14, -6.08, 7.01,
187 0.0, 0.0, 0.0, 0.0, 0.0, 2.73, -0.1, 4.71,
188 4.44, -7.22, -0.96, -3.95, -1.99, -1.97, -8.31, 0.0,
189 0.0, 0.0, 0.0, 0.13, 1.67, -0.66, -1.76, 0.85,
190 -0.39, -2.51, -1.27, -2.11, -1.94, -1.86, 0.0, 0.0,
191 0.0, -0.87, 0.27, 2.13, -2.49, 0.49, 0.59, 0.0,
192 0.13, 0.27, -0.86, -0.23, 0.87, 0.0, 0.0, -0.87,
193 0.3, 1.66, -0.59, -1.14, -0.07, 0.54, 0.1, 0.49,
194 0.44, -0.25, -0.53, -0.79,
195};
196
198constexpr matpack::matpack_constant_data<Numeric, 14, 14> g2005{
199 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
200 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -29554.63, -1669.05,
201 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
202 0.0, 0.0, 0.0, 0.0, -2337.24, 3047.69, 1657.76, 0.0,
203 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
204 0.0, 0.0, 1336.3, -2305.83, 1246.39, 672.51, 0.0, 0.0,
205 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
206 920.55, 797.96, 210.65, -379.86, 100.0, 0.0, 0.0, 0.0,
207 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -227.0, 354.41,
208 208.95, -136.54, -168.05, -13.55, 0.0, 0.0, 0.0, 0.0,
209 0.0, 0.0, 0.0, 0.0, 73.6, 69.56, 76.74, -151.34,
210 -14.58, 14.58, -86.36, 0.0, 0.0, 0.0, 0.0, 0.0,
211 0.0, 0.0, 79.88, -74.46, -1.65, 38.73, 12.3, 9.37,
212 5.42, 1.94, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
213 24.8, 7.62, -11.73, -6.88, -18.11, 10.17, 9.36, -11.25,
214 -4.87, 0.0, 0.0, 0.0, 0.0, 0.0, 5.58, 9.76,
215 3.58, -6.94, 5.01, -10.76, -1.25, 8.76, -6.66, -9.22,
216 0.0, 0.0, 0.0, 0.0, -2.17, -6.12, 1.42, -2.35,
217 -0.15, 3.06, 0.29, 2.06, 3.77, -0.21, -2.09, 0.0,
218 0.0, 0.0, 2.95, -1.6, -1.88, 1.44, -0.31, 0.29,
219 -0.79, 0.53, 1.8, 0.16, 0.96, 3.99, 0.0, 0.0,
220 -2.15, -0.29, 0.21, 0.89, -0.38, 0.96, -0.3, 0.46,
221 -0.35, -0.36, 0.08, -0.49, -0.08, 0.0, -0.16, -0.88,
222 0.3, 0.28, -0.43, 1.18, -0.37, 0.75, -0.26, 0.35,
223 -0.05, 0.41, -0.1, -0.18,
224};
225
227constexpr matpack::matpack_constant_data<Numeric, 14, 14> h2005{
228 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
229 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 5077.99,
230 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
231 0.0, 0.0, 0.0, 0.0, 0.0, -2594.5, -515.43, 0.0,
232 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
233 0.0, 0.0, 0.0, -198.86, 269.72, -524.72, 0.0, 0.0,
234 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
235 0.0, 282.07, -225.23, 145.15, -305.36, 0.0, 0.0, 0.0,
236 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 42.72,
237 180.25, -123.45, -19.57, 103.85, 0.0, 0.0, 0.0, 0.0,
238 0.0, 0.0, 0.0, 0.0, 0.0, -20.33, 54.75, 63.63,
239 -63.53, 0.24, 50.94, 0.0, 0.0, 0.0, 0.0, 0.0,
240 0.0, 0.0, 0.0, -61.14, -22.57, 6.82, 25.35, 10.93,
241 -26.32, -4.64, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
242 0.0, 11.2, -20.88, 9.83, -19.71, 16.22, 7.61, -12.76,
243 -0.06, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -20.11,
244 12.69, 12.67, -6.72, -8.16, 8.1, 2.92, -7.73, 6.01,
245 0.0, 0.0, 0.0, 0.0, 0.0, 2.19, 0.1, 4.46,
246 4.76, -6.58, -1.01, -3.47, -0.86, -2.31, -7.93, 0.0,
247 0.0, 0.0, 0.0, 0.26, 1.44, -0.77, -2.27, 0.9,
248 -0.58, -2.69, -1.08, -1.58, -1.9, -1.39, 0.0, 0.0,
249 0.0, -0.55, 0.23, 2.38, -2.63, 0.61, 0.4, 0.01,
250 0.02, 0.28, -0.87, -0.34, 0.88, 0.0, 0.0, -0.76,
251 0.33, 1.72, -0.54, -1.07, -0.04, 0.63, 0.21, 0.53,
252 0.38, -0.22, -0.57, -0.82,
253};
254
256constexpr matpack::matpack_constant_data<Numeric, 14, 14> g2000{
257 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
258 0.0, 0.0, 0.0, 0.0, 0.0, -29619.4, -1728.2, 0.0, 0.0,
259 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
260 0.0, -2267.7, 3068.4, 1670.9, 0.0, 0.0, 0.0, 0.0, 0.0,
261 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1339.6, -2288.0, 1252.1,
262 714.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
263 0.0, 0.0, 932.3, 786.8, 250.0, -403.0, 111.3, 0.0, 0.0,
264 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -218.8, 351.4,
265 222.3, -130.4, -168.6, -12.9, 0.0, 0.0, 0.0, 0.0, 0.0,
266 0.0, 0.0, 0.0, 72.3, 68.2, 74.2, -160.9, -5.9, 16.9,
267 -90.4, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 79.0,
268 -74.0, 0.0, 33.3, 9.1, 6.9, 7.3, -1.2, 0.0, 0.0,
269 0.0, 0.0, 0.0, 0.0, 24.4, 6.6, -9.2, -7.9, -16.6,
270 9.1, 7.0, -7.9, -7.0, 0.0, 0.0, 0.0, 0.0, 0.0,
271 5.0, 9.4, 3.0, -8.4, 6.3, -8.9, -1.5, 9.3, -4.3,
272 -8.2, 0.0, 0.0, 0.0, 0.0, -2.6, -6.0, 1.7, -3.1,
273 -0.5, 3.7, 1.0, 2.0, 4.2, 0.3, -1.1, 0.0, 0.0,
274 0.0, 2.7, -1.7, -1.9, 1.5, -0.1, 0.1, -0.7, 0.7,
275 1.7, 0.1, 1.2, 4.0, 0.0, 0.0, -2.2, -0.3, 0.2,
276 0.9, -0.2, 0.9, -0.5, 0.3, -0.3, -0.4, -0.1, -0.2,
277 -0.4, 0.0, -0.2, -0.9, 0.3, 0.1, -0.4, 1.3, -0.4,
278 0.7, -0.4, 0.3, -0.1, 0.4, 0.0, 0.1,
279};
280
282constexpr matpack::matpack_constant_data<Numeric, 14, 14> h2000{
283 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
284 0.0, 0.0, 0.0, 0.0, 0.0, 5186.1, 0.0, 0.0, 0.0, 0.0,
285 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -2481.6,
286 -458.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
287 0.0, 0.0, 0.0, -227.6, 293.4, -491.1, 0.0, 0.0, 0.0, 0.0,
288 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 272.6, -231.9, 119.8,
289 -303.8, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
290 0.0, 43.8, 171.9, -133.1, -39.3, 106.3, 0.0, 0.0, 0.0, 0.0,
291 0.0, 0.0, 0.0, 0.0, 0.0, -17.4, 63.7, 65.1, -61.2, 0.7,
292 43.8, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -64.6,
293 -24.2, 6.2, 24.0, 14.8, -25.4, -5.8, 0.0, 0.0, 0.0, 0.0,
294 0.0, 0.0, 0.0, 11.9, -21.5, 8.5, -21.5, 15.5, 8.9, -14.9,
295 -2.1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -19.7, 13.4, 12.5,
296 -6.2, -8.4, 8.4, 3.8, -8.2, 4.8, 0.0, 0.0, 0.0, 0.0,
297 0.0, 1.7, 0.0, 4.0, 4.9, -5.9, -1.2, -2.9, 0.2, -2.2,
298 -7.4, 0.0, 0.0, 0.0, 0.0, 0.1, 1.3, -0.9, -2.6, 0.9,
299 -0.7, -2.8, -0.9, -1.2, -1.9, -0.9, 0.0, 0.0, 0.0, -0.4,
300 0.3, 2.5, -2.6, 0.7, 0.3, 0.0, 0.0, 0.3, -0.9, -0.4,
301 0.8, 0.0, 0.0, -0.9, 0.2, 1.8, -0.4, -1.0, -0.1, 0.7,
302 0.3, 0.6, 0.3, -0.2, -0.5, -0.9,
303};
304
306constexpr Numeric r0{6371.2e3};
307
317Numeric radius(const Numeric h, const Numeric lat, const Numeric lon,
318 const Numeric a, const Numeric e) ARTS_NOEXCEPT {
319 using Conversion::cosd;
320 using Conversion::sind;
321 using Math::pow2;
322 using std::sqrt;
323
324 ARTS_ASSERT(e >= 0 and e < 1)
325
326 const Numeric N = a / sqrt(1 - pow2(e * sind(lat)));
327
328 return std::hypot((N + h) * cosd(lon) * cosd(lat),
329 (N + h) * sind(lon) * cosd(lat),
330 (N * (1 - pow2(e)) + h) * sind(lat));
331}
332
345void compute_impl(MagneticField &out, const Matrix &g, const Matrix &h,
346 const Tensor3 &z_field, const Vector &lat_grid,
347 const Vector &lon_grid, const Vector &ell,
348 const Numeric scale) ARTS_NOEXCEPT {
349 // Constant sizes
350 const Index nz = z_field.npages();
351 const Index nlat = z_field.nrows();
352 const Index nlon = z_field.ncols();
353
354#pragma omp parallel for if (!arts_omp_in_parallel())
355 for (Index ilat = 0; ilat < nlat; ilat++) {
356 const Numeric lat = lat_grid[ilat];
357
358 Vector r(nlon * nz);
359 for (Index ilon = 0; ilon < nlon; ilon++) {
360 for (Index iz = 0; iz < nz; iz++) {
361 r[ilon + nlon * iz] = radius(z_field(iz, ilat, ilon), lat,
362 lon_grid[ilon], ell[0], ell[1]);
363 }
364 }
365
366 const auto f = Legendre::schmidt_fieldcalc(g, h, r0, r, lat, lon_grid);
367 for (Index iz = 0; iz < nz; iz++) {
368 for (Index ilon = 0; ilon < nlon; ilon++) {
369 const auto &flz{f(ilon, ilon + nlon * iz)};
370 out.u(iz, ilat, ilon) += scale * flz.E;
371 out.v(iz, ilat, ilon) -= scale * flz.S;
372 out.w(iz, ilat, ilon) += scale * flz.U;
373 }
374 }
375 }
376}
377
378MagneticField compute(const Tensor3 &z_field, const Vector &lat_grid,
379 const Vector &lon_grid, const Time &time,
380 const Vector &ell) {
381 // Constant sizes
382 const Index nz = z_field.npages();
383 const Index nlat = z_field.nrows();
384 const Index nlon = z_field.ncols();
385
386 // Constant times
387 static const Time y2020("2020-01-01 00:00:00");
388 static const Time y2015("2015-01-01 00:00:00");
389 static const Time y2010("2010-01-01 00:00:00");
390 static const Time y2005("2005-01-01 00:00:00");
391 static const Time y2000("2000-01-01 00:00:00");
392
393 // Output
394 MagneticField out(nz, nlat, nlon); // Inits to zeroes
395
396 // Select the correct time
397 if (time >= y2020) {
398 compute_impl(out, Matrix(g2020), Matrix(h2020), z_field, lat_grid, lon_grid,
399 ell, 1.0);
400 } else if (time >= y2015) {
401 const Numeric scale = (time.Seconds() - y2015.Seconds()) /
402 (y2020.Seconds() - y2015.Seconds());
403 ARTS_ASSERT(scale >= 0 and scale < 1)
404
405 compute_impl(out, Matrix(g2020), Matrix(h2020), z_field, lat_grid, lon_grid,
406 ell, scale);
407 compute_impl(out, Matrix(g2015), Matrix(h2015), z_field, lat_grid, lon_grid,
408 ell, 1.0 - scale);
409 } else if (time >= y2010) {
410 const Numeric scale = (time.Seconds() - y2010.Seconds()) /
411 (y2015.Seconds() - y2010.Seconds());
412 ARTS_ASSERT(scale >= 0 and scale < 1)
413
414 compute_impl(out, Matrix(g2015), Matrix(h2015), z_field, lat_grid, lon_grid,
415 ell, scale);
416 compute_impl(out, Matrix(g2010), Matrix(h2010), z_field, lat_grid, lon_grid,
417 ell, 1.0 - scale);
418 } else if (time >= y2005) {
419 const Numeric scale = (time.Seconds() - y2005.Seconds()) /
420 (y2010.Seconds() - y2005.Seconds());
421 ARTS_ASSERT(scale >= 0 and scale < 1)
422
423 compute_impl(out, Matrix(g2010), Matrix(h2010), z_field, lat_grid, lon_grid,
424 ell, scale);
425 compute_impl(out, Matrix(g2005), Matrix(h2005), z_field, lat_grid, lon_grid,
426 ell, 1.0 - scale);
427 } else if (time >= y2000) {
428 const Numeric scale = (time.Seconds() - y2000.Seconds()) /
429 (y2005.Seconds() - y2000.Seconds());
430 ARTS_ASSERT(scale >= 0 and scale < 1)
431
432 compute_impl(out, Matrix(g2005), Matrix(h2005), z_field, lat_grid, lon_grid,
433 ell, scale);
434 compute_impl(out, Matrix(g2000), Matrix(h2000), z_field, lat_grid, lon_grid,
435 ell, 1.0 - scale);
436 } else {
437 compute_impl(out, Matrix(g2000), Matrix(h2000), z_field, lat_grid, lon_grid,
438 ell, 1.0);
439 }
440
441 // Conversion from nano-Tesla to Tesla
442 out.u *= 1e-9;
443 out.v *= 1e-9;
444 out.w *= 1e-9;
445
446 return out;
447}
448} // namespace IGRF
Common ARTS conversions.
Header file for helper functions for OpenMP.
#define ARTS_NOEXCEPT
Definition debug.h:83
#define ARTS_ASSERT(condition,...)
Definition debug.h:86
auto sind(auto x) noexcept
Returns the sine of the deg2rad of the input.
auto cosd(auto x) noexcept
Returns the cosine of the deg2rad of the input.
International Geomagnetic Reference Field version 13.
Definition igrf13.cc:30
constexpr matpack::matpack_constant_data< Numeric, 14, 14 > g2020
g-coefficients for 2020 (14x14 matrix)
Definition igrf13.cc:32
constexpr matpack::matpack_constant_data< Numeric, 14, 14 > h2015
h-coefficients for 2015 (14x14 matrix)
Definition igrf13.cc:111
constexpr matpack::matpack_constant_data< Numeric, 14, 14 > g2010
g-coefficients for 2010 (14x14 matrix)
Definition igrf13.cc:140
constexpr matpack::matpack_constant_data< Numeric, 14, 14 > h2010
h-coefficients for 2010 (14x14 matrix)
Definition igrf13.cc:169
constexpr matpack::matpack_constant_data< Numeric, 14, 14 > g2015
g-coefficients for 2015 (14x14 matrix)
Definition igrf13.cc:82
MagneticField compute(const Tensor3 &z_field, const Vector &lat_grid, const Vector &lon_grid, const Time &time, const Vector &ell)
Computes the magnetic field based on IGRF13 coefficients.
Definition igrf13.cc:378
constexpr matpack::matpack_constant_data< Numeric, 14, 14 > g2000
g-coefficients for 2000 (14x14 matrix)
Definition igrf13.cc:256
constexpr matpack::matpack_constant_data< Numeric, 14, 14 > h2000
h-coefficients for 2000 (14x14 matrix)
Definition igrf13.cc:282
void compute_impl(MagneticField &out, const Matrix &g, const Matrix &h, const Tensor3 &z_field, const Vector &lat_grid, const Vector &lon_grid, const Vector &ell, const Numeric scale) ARTS_NOEXCEPT
Perform all computations on pre-allocated local data.
Definition igrf13.cc:345
Numeric radius(const Numeric h, const Numeric lat, const Numeric lon, const Numeric a, const Numeric e) ARTS_NOEXCEPT
Get the radius from ellipsoidal coordinates.
Definition igrf13.cc:317
constexpr matpack::matpack_constant_data< Numeric, 14, 14 > g2005
g-coefficients for 2005 (14x14 matrix)
Definition igrf13.cc:198
constexpr matpack::matpack_constant_data< Numeric, 14, 14 > h2020
h-coefficients for 2020 (14x14 matrix)
Definition igrf13.cc:58
constexpr Numeric r0
The reference radius in IGRF13.
Definition igrf13.cc:306
constexpr matpack::matpack_constant_data< Numeric, 14, 14 > h2005
h-coefficients for 2005 (14x14 matrix)
Definition igrf13.cc:227
SphericalField schmidt_fieldcalc(const Matrix &g, const Matrix &h, const Numeric r0, const Numeric r, const Numeric lat, const Numeric lon) ARTS_NOEXCEPT
Computes the spherical field.
Definition legendre.cc:104
constexpr auto pow2(auto x) noexcept
power of two
Magnetic field for the east (u), north (v), and up (w) components as the ENU-coordinate system.
Definition igrf13.h:9
Class to handle time in ARTS.
Definition artstime.h:25
Numeric Seconds() const
Definition artstime.h:104
#define a