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
84f85357
Commit
84f85357
authored
4 years ago
by
Nikos Karastathis
Browse files
Options
Downloads
Patches
Plain Diff
added ZHS-like approximation to CoREAS + general updates
parent
84550617
No related branches found
No related tags found
1 merge request
!329
Radio interface
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
corsika/modules/radio/CoREAS.hpp
+103
-20
103 additions, 20 deletions
corsika/modules/radio/CoREAS.hpp
with
103 additions
and
20 deletions
corsika/modules/radio/CoREAS.hpp
+
103
−
20
View file @
84f85357
...
@@ -11,6 +11,7 @@
...
@@ -11,6 +11,7 @@
#include
<corsika/modules/radio/propagators/StraightPropagator.hpp>
#include
<corsika/modules/radio/propagators/StraightPropagator.hpp>
#include
<corsika/framework/geometry/QuantityVector.hpp>
#include
<corsika/framework/geometry/QuantityVector.hpp>
#include
<corsika/framework/core/PhysicalUnits.hpp>
#include
<corsika/framework/core/PhysicalUnits.hpp>
#include
<cmath>
namespace
corsika
{
namespace
corsika
{
...
@@ -49,6 +50,9 @@ namespace corsika {
...
@@ -49,6 +50,9 @@ namespace corsika {
template
<
typename
Particle
,
typename
Track
>
template
<
typename
Particle
,
typename
Track
>
ProcessReturn
simulate
(
Particle
&
particle
,
Track
const
&
track
)
const
{
ProcessReturn
simulate
(
Particle
&
particle
,
Track
const
&
track
)
const
{
// set threshold for application of ZHS-like approximation
const
double
approxThreshold_
{
1.0e-3
};
//get global simulation time for that track. (This is my best guess for now)
//get global simulation time for that track. (This is my best guess for now)
auto
startTime_
{
particle
.
getTime
()
auto
startTime_
{
particle
.
getTime
()
-
track
.
getDuration
()};
// time at start point of track.
-
track
.
getDuration
()};
// time at start point of track.
...
@@ -57,6 +61,10 @@ namespace corsika {
...
@@ -57,6 +61,10 @@ namespace corsika {
// beta is defined as velocity / speed of light
// beta is defined as velocity / speed of light
auto
startBeta_
{
track
.
getVelocity
(
0
)
/
constants
::
c
};
auto
startBeta_
{
track
.
getVelocity
(
0
)
/
constants
::
c
};
auto
endBeta_
{
track
.
getVelocity
(
1
)
/
constants
::
c
};
auto
endBeta_
{
track
.
getVelocity
(
1
)
/
constants
::
c
};
//TODO: check if they are different!!! They shouldn't!!!
// auto startBeta_ {(track.getPosition(0) / (particle.getTime()
// - track.getDuration()) ) / constants::c};
// auto endBeta_ {(track.getPosition(1) / particle.getTime() ) / constants::c};
// calculate gamma factor using beta (the proper way would be with energy over mass)
// calculate gamma factor using beta (the proper way would be with energy over mass)
auto
startGamma_
{
1.
/
sqrt
(
1.
-
(
startBeta_
*
startBeta_
))};
auto
startGamma_
{
1.
/
sqrt
(
1.
-
(
startBeta_
*
startBeta_
))};
...
@@ -72,44 +80,119 @@ namespace corsika {
...
@@ -72,44 +80,119 @@ namespace corsika {
// we loop over each antenna in the collection
// we loop over each antenna in the collection
for
(
auto
&
antenna
:
detector_
.
getAntennas
())
{
for
(
auto
&
antenna
:
detector_
.
getAntennas
())
{
ElectricFieldVector
EV1_
{
0
_V
/
0
_m
};
ElectricFieldVector
EV2_
{
0
_V
/
0
_m
};
ElectricFieldVector
EV3_
{
0
_V
/
0
_m
};
auto
startPointReceiveTime_
{
0
_ns
};
auto
endPointReceiveTime_
{
0
_ns
};
// get the Path (path1) from the start "endpoint" to the antenna.
// get the Path (path1) from the start "endpoint" to the antenna.
// This is a SignalPathCollection
// This is a SignalPathCollection
auto
paths1
{
this
->
propagator_
.
propagate
(
startPoint_
,
antenna
.
getLocation
())};
auto
paths1
{
this
->
propagator_
.
propagate
(
startPoint_
,
antenna
.
getLocation
())};
auto
R1_
{(
startPoint_
-
antenna
.
getLocation
()).
getNorm
()};
// now loop over the paths that we got above
// set postDoppler to approximate threshold in advance and check after loop
// if we need to perform ZHS-like approximation
auto
preDoppler_
{
approxThreshold_
};
// now loop over the paths for startpoint that we got above
for
(
auto
const
&
path
:
paths1
)
{
for
(
auto
const
&
path
:
paths1
)
{
auto
startPointReceiveTime_
{
path
.
total_time_
+
startTime_
};
// might do it on the fly
// CoREAS calculation -> get ElectricFieldVector1
preDoppler_
=
1.
-
path
.
average_refractive_index_
*
ElectricFieldVector
EV1_
{(
charge_
/
constants
::
c
)
*
startBeta_
*
path
.
emit_
;
path
.
receive_
.
cross
(
path
.
receive_
.
cross
(
startBeta_
))
/
(
R1_
*
(
1
-
path
.
average_refractivity_
*
startBeta_
*
path
.
receive_
))};
// pass it to the antenna
if
(
preDoppler_
>
approxThreshold_
)
{
antenna
.
receive
(
startPointReceiveTime_
,
path
.
receive_
,
EV1_
);
startPointReceiveTime_
=
path
.
total_time_
+
startTime_
;
// might do it on the fly
}
// END: loop over paths
// CoREAS calculation -> get ElectricFieldVector1
EV1_
=
(
charge_
/
constants
::
c
)
*
path
.
receive_
.
cross
(
path
.
receive_
.
cross
(
startBeta_
))
/
(
path
.
R_distance_
*
preDoppler_
);
// pass it to the antenna
antenna
.
receive
(
startPointReceiveTime_
,
path
.
receive_
,
EV1_
);
}
else
{
continue
;
}
// END preDoppler check
}
// END: loop over paths for startpoint
// get the Path (path2) from the end "endpoint" to the antenna.
// get the Path (path2) from the end "endpoint" to the antenna.
// This is a SignalPathCollection
// This is a SignalPathCollection
auto
paths2
{
this
->
propagator_
.
propagate
(
endPoint_
,
antenna
.
getLocation
())};
auto
paths2
{
this
->
propagator_
.
propagate
(
endPoint_
,
antenna
.
getLocation
())};
auto
R2_
{(
endPoint_
-
antenna
.
getLocation
()).
getNorm
()};
// set postDoppler to approximate threshold in advance and check after loop
// if we need to perform ZHS-like approximation
auto
postDoppler_
{
approxThreshold_
};
// now loop over the paths for endpoint that we got above
for
(
auto
const
&
path
:
paths2
)
{
for
(
auto
const
&
path
:
paths2
)
{
auto
endPointReceiveTime_
{
path
.
total_time
+
endTime_
};
// might do it on the fly
postDoppler_
=
1.
-
path
.
average_refractive_index_
*
endBeta_
*
path
.
emit_
;
//CoREAS calculation -> get ElectricFieldVector2
if
(
preDoppler_
>
approxThreshold_
)
{
ElectricFieldVector
EV2_
{(
charge_
/
constants
::
c
)
*
auto
endPointReceiveTime_
=
path
.
total_time
+
endTime_
;
// might do it on the fly
path
.
receive_
.
cross
(
path
.
receive_
.
cross
(
endBeta_
))
/
(
R2_
*
(
1
-
path
.
average_refractivity_
*
//CoREAS calculation -> get ElectricFieldVector2
endBeta_
*
path
.
receive_
))};
EV2_
=
(
charge_
/
constants
::
c
)
*
path
.
receive_
.
cross
(
path
.
receive_
.
cross
(
endBeta_
))
/
(
path
.
R_distance_
*
postDoppler_
);
// pass it to the antenna
// pass it to the antenna
antenna
.
receive
(
endPointReceiveTime_
,
path
.
receive_
,
EV2_
);
antenna
.
receive
(
endPointReceiveTime_
,
path
.
receive_
,
EV2_
);
}
else
{
}
// END: loop over paths
continue
;
}
// END postDoppler check
}
// END: loop over paths for endpoint
// perform ZHS-like calculation close to Cherenkov angle
if
(
fabs
(
preDoppler_
)
<=
approxThreshold_
||
fabs
(
postDoppler_
)
<=
approxThreshold_
)
{
// get global simulation time for the middle point of that track. (This is my best guess for now)
auto
midTime_
{
particle
.
getTime
()
-
(
track
.
getDuration
()
/
2
)};
// beta is defined as velocity / speed of light
auto
midBeta_
{
track
.
getVelocity
(
0.5
)
/
constants
::
c
};
// auto midBeta_ {(track.getPosition(0.5) / (particle.getTime()
// - (track.getDuration() / 2) ) / constants::c};
// calculate gamma factor using beta (the proper way would be with energy over mass)
// auto midGamma_ {1. / sqrt(1. - (midBeta_ * midBeta_))};
// get start and end position of the track
auto
midPoint_
{
track
.
getPosition
(
0.5
)};
// get the Path (path3) from the middle "endpoint" to the antenna.
// This is a SignalPathCollection
auto
paths3
{
this
->
propagator_
.
propagate
(
midPoint_
,
antenna
.
getLocation
())};
// now loop over the paths for endpoint that we got above
for
(
auto
const
&
path
:
paths3
)
{
midDoppler_
=
1.
-
path
.
average_refractive_index_
*
midBeta_
*
path
.
emit_
;
auto
const
midPointReceiveTime_
{
path
.
total_time_
+
midTime_
};
// might do it on the fly
// CoREAS calculation -> get ElectricFieldVector3 for "midPoint"
EV3_
=
(
charge_
/
constants
::
c
)
*
path
.
receive_
.
cross
(
path
.
receive_
.
cross
(
midBeta_
))
/
(
path
.
R_distance_
*
midDoppler_
);
// pass it to the antenna but first check if "start" or "end" are double counted!!!
if
(
fabs
(
preDoppler_
)
>
approxThreshold_
&&
fabs
(
postDoppler_
)
<=
approxThreshold_
)
{
antenna
.
receive
(
startPointReceiveTime_
,
path
.
receive_
,
-
EV1_
);
antenna
.
receive
(
midPointReceiveTime_
,
path
.
receive_
,
EV3_
);
}
else
if
(
fabs
(
preDoppler_
)
<=
approxThreshold_
&&
fabs
(
postDoppler_
)
>
approxThreshold_
)
{
antenna
.
receive
(
endPointReceiveTime_
,
path
.
receive_
,
-
EV2_
);
antenna
.
receive
(
midPointReceiveTime_
,
path
.
receive_
,
EV3_
);
}
else
{
antenna
.
receive
(
midPointReceiveTime_
,
path
.
receive_
,
EV3_
);
}
// end deleting double-counted values
}
}
// end of ZHS-like approximation
}
// END: loop over antennas
}
// END: loop over antennas
}
}
...
...
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