IAP GITLAB
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
corsika
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Air Shower Physics
corsika
Commits
eff809e1
Commit
eff809e1
authored
3 years ago
by
André Schmidt
Committed by
ralfulrich
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
interpolation between epochs
parent
2eca797f
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
corsika/detail/media/GeomagneticModel.inl
+10
-0
10 additions, 0 deletions
corsika/detail/media/GeomagneticModel.inl
tests/media/testMagneticField.cpp
+9
-9
9 additions, 9 deletions
tests/media/testMagneticField.cpp
with
19 additions
and
9 deletions
corsika/detail/media/GeomagneticModel.inl
+
10
−
0
View file @
eff809e1
...
@@ -95,11 +95,16 @@ namespace corsika {
...
@@ -95,11 +95,16 @@ namespace corsika {
int
iYear
=
int
(
year
);
int
iYear
=
int
(
year
);
int
iEpoch
=
0
;
int
iEpoch
=
0
;
int
next_Epoch
=
0
;
for
(
auto
parIt
=
parameters_
.
rbegin
();
parIt
!=
parameters_
.
rend
();
++
parIt
)
{
for
(
auto
parIt
=
parameters_
.
rbegin
();
parIt
!=
parameters_
.
rend
();
++
parIt
)
{
if
(
parIt
->
first
<=
iYear
)
{
if
(
parIt
->
first
<=
iYear
)
{
iEpoch
=
parIt
->
first
;
iEpoch
=
parIt
->
first
;
break
;
break
;
}
}
if
(
parIt
->
first
>=
iYear
)
{
next_Epoch
=
parIt
->
first
;
break
;
}
}
}
double
epoch
=
double
(
iEpoch
);
double
epoch
=
double
(
iEpoch
);
CORSIKA_LOG_DEBUG
(
"Found Epoch {} for year {}"
,
iEpoch
,
year
);
CORSIKA_LOG_DEBUG
(
"Found Epoch {} for year {}"
,
iEpoch
,
year
);
...
@@ -142,6 +147,11 @@ namespace corsika {
...
@@ -142,6 +147,11 @@ namespace corsika {
// Time interpolation
// Time interpolation
p
.
g
=
p
.
g
+
(
year
-
epoch
)
*
p
.
dg
;
p
.
g
=
p
.
g
+
(
year
-
epoch
)
*
p
.
dg
;
p
.
h
=
p
.
h
+
(
year
-
epoch
)
*
p
.
dh
;
p
.
h
=
p
.
h
+
(
year
-
epoch
)
*
p
.
dh
;
if
(
next_Epoch
!=
0
)
{
ParameterLine
next_p
=
parameters_
[
next_Epoch
][
j
];
p
.
g
=
p
.
g
+
(
next_p
.
g
-
p
.
g
)
*
(
year
-
epoch
)
/
(
next_Epoch
-
epoch
);
p
.
h
=
p
.
h
+
(
next_p
.
h
-
p
.
h
)
*
(
year
-
epoch
)
/
(
next_Epoch
-
epoch
);
}
legendre
=
pow
(
-
1
,
p
.
m
)
*
std
::
assoc_legendre
(
p
.
n
,
p
.
m
,
sin
(
lat_sph
));
legendre
=
pow
(
-
1
,
p
.
m
)
*
std
::
assoc_legendre
(
p
.
n
,
p
.
m
,
sin
(
lat_sph
));
next_legendre
=
pow
(
-
1
,
p
.
m
)
*
std
::
assoc_legendre
(
p
.
n
+
1
,
p
.
m
,
sin
(
lat_sph
));
next_legendre
=
pow
(
-
1
,
p
.
m
)
*
std
::
assoc_legendre
(
p
.
n
+
1
,
p
.
m
,
sin
(
lat_sph
));
...
...
This diff is collapsed.
Click to expand it.
tests/media/testMagneticField.cpp
+
9
−
9
View file @
eff809e1
...
@@ -99,21 +99,21 @@ TEST_CASE("UniformMagneticField w/ Homogeneous Medium") {
...
@@ -99,21 +99,21 @@ TEST_CASE("UniformMagneticField w/ Homogeneous Medium") {
// create earth magnetic field vector
// create earth magnetic field vector
MagneticFieldVector
Earth_B_1
=
igrf
.
getField
(
2022.5
,
100
_km
,
-
80
,
-
120
);
MagneticFieldVector
Earth_B_1
=
igrf
.
getField
(
2022.5
,
100
_km
,
-
80
,
-
120
);
MagneticFieldVector
Earth_B_2
=
igrf
.
getField
(
1935
,
10
_km
,
80
,
120
);
MagneticFieldVector
Earth_B_2
=
igrf
.
getField
(
193
7.
5
,
10
_km
,
80
,
120
);
MagneticFieldVector
Earth_B_3
=
igrf
.
getField
(
1990
,
50
_km
,
80
,
0
);
MagneticFieldVector
Earth_B_3
=
igrf
.
getField
(
1990
,
50
_km
,
80
,
0
);
MagneticFieldVector
Earth_B_4
=
igrf
.
getField
(
201
0
,
0
_km
,
0
,
-
120
);
MagneticFieldVector
Earth_B_4
=
igrf
.
getField
(
201
2
,
0
_km
,
0
,
-
120
);
CHECK
(
Earth_B_1
.
getX
(
gCS
)
/
1
_nT
==
Approx
(
5821
).
margin
(
0.5
));
CHECK
(
Earth_B_1
.
getX
(
gCS
)
/
1
_nT
==
Approx
(
5821
).
margin
(
0.5
));
CHECK
(
Earth_B_1
.
getY
(
gCS
)
/
1
_nT
==
Approx
(
-
14796
).
margin
(
0.5
));
CHECK
(
Earth_B_1
.
getY
(
gCS
)
/
1
_nT
==
Approx
(
-
14796
).
margin
(
0.5
));
CHECK
(
Earth_B_1
.
getZ
(
gCS
)
/
1
_nT
==
Approx
(
49776
).
margin
(
0.5
));
CHECK
(
Earth_B_1
.
getZ
(
gCS
)
/
1
_nT
==
Approx
(
4977
5
6
).
margin
(
0.5
));
CHECK
(
Earth_B_2
.
getX
(
gCS
)
/
1
_nT
==
Approx
(
3014
).
margin
(
0.5
));
CHECK
(
Earth_B_2
.
getX
(
gCS
)
/
1
_nT
==
Approx
(
2957
).
margin
(
0.5
));
CHECK
(
Earth_B_2
.
getY
(
gCS
)
/
1
_nT
==
Approx
(
-
10
72
).
margin
(
0.5
));
CHECK
(
Earth_B_2
.
getY
(
gCS
)
/
1
_nT
==
Approx
(
-
10
14
).
margin
(
0.5
));
CHECK
(
Earth_B_2
.
getZ
(
gCS
)
/
1
_nT
==
Approx
(
-
57
594
).
margin
(
0.5
));
CHECK
(
Earth_B_2
.
getZ
(
gCS
)
/
1
_nT
==
Approx
(
-
57
610
).
margin
(
0.5
));
CHECK
(
Earth_B_3
.
getX
(
gCS
)
/
1
_nT
==
Approx
(
6545
).
margin
(
0.5
));
CHECK
(
Earth_B_3
.
getX
(
gCS
)
/
1
_nT
==
Approx
(
6545
).
margin
(
0.5
));
CHECK
(
Earth_B_3
.
getY
(
gCS
)
/
1
_nT
==
Approx
(
1473
).
margin
(
0.5
));
CHECK
(
Earth_B_3
.
getY
(
gCS
)
/
1
_nT
==
Approx
(
1473
).
margin
(
0.5
));
CHECK
(
Earth_B_3
.
getZ
(
gCS
)
/
1
_nT
==
Approx
(
-
52884
).
margin
(
0.5
));
CHECK
(
Earth_B_3
.
getZ
(
gCS
)
/
1
_nT
==
Approx
(
-
52884
).
margin
(
0.5
));
CHECK
(
Earth_B_4
.
getX
(
gCS
)
/
1
_nT
==
Approx
(
30
137
).
margin
(
0.5
));
CHECK
(
Earth_B_4
.
getX
(
gCS
)
/
1
_nT
==
Approx
(
30
052
).
margin
(
0.5
));
CHECK
(
Earth_B_4
.
getY
(
gCS
)
/
1
_nT
==
Approx
(
-
4
805
).
margin
(
0.5
));
CHECK
(
Earth_B_4
.
getY
(
gCS
)
/
1
_nT
==
Approx
(
-
4
738
).
margin
(
0.5
));
CHECK
(
Earth_B_4
.
getZ
(
gCS
)
/
1
_nT
==
Approx
(
-
51
61
).
margin
(
0.5
));
CHECK
(
Earth_B_4
.
getZ
(
gCS
)
/
1
_nT
==
Approx
(
-
51
90
).
margin
(
0.5
));
}
}
}
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment