IAP GITLAB
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
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
Package Registry
Model registry
Operate
Environments
Terraform modules
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
Pranav Sampathkumar
corsika
Commits
34eb3794
Commit
34eb3794
authored
4 years ago
by
André Schmidt
Committed by
ralfulrich
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Added Magnetic Field
parent
2ca45c6d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Framework/Cascade/Cascade.h
+17
-12
17 additions, 12 deletions
Framework/Cascade/Cascade.h
with
17 additions
and
12 deletions
Framework/Cascade/Cascade.h
+
17
−
12
View file @
34eb3794
...
...
@@ -33,6 +33,9 @@
#include
<cmath>
#include
<limits>
#include
<boost/type_index.hpp>
using
boost
::
typeindex
::
type_id_with_cvr
;
/**
* The cascade namespace assembles all objects needed to simulate full particles cascades.
*/
...
...
@@ -225,7 +228,7 @@ namespace corsika::cascade {
// take minimum of geometry, interaction, decay for next step
auto
const
min_distance
=
std
::
min
({
distance_interact
,
distance_decay
/*
, distance_max, geomMaxLength
*/
});
std
::
min
({
distance_interact
,
distance_decay
,
distance_max
,
geomMaxLength
});
C8LOG_DEBUG
(
"transport particle by : {} m"
,
min_distance
/
1
_m
);
...
...
@@ -233,19 +236,21 @@ namespace corsika::cascade {
// std::visit(setup::ParticleUpdate<Particle>{vParticle}, step);
vParticle
.
SetPosition
(
step
.
PositionFromArclength
(
min_distance
));
// .... also update time, momentum, direction, ...
// magneticfield/u have wrong units, not sure if corsika::stack is right
auto
magneticfield
=
corsika
::
stack
::
MomentumVector
(
fEnvironment
.
GetCoordinateSystem
(),
{
0
_eV
,
50e-06
_eV
,
0
_eV
});
//Euler algorithm to change momentum of the particle
int
charge
;
if
(
corsika
::
particles
::
IsNucleus
(
vParticle
.
GetPID
()))
{
charge
=
vParticle
.
GetNuclearZ
();
}
else
{
charge
=
corsika
::
particles
::
GetChargeNumber
(
vParticle
.
GetPID
());
}
geometry
::
Vector
<
SpeedType
::
dimension_type
>
const
velocity
=
vParticle
.
GetMomentum
()
/
vParticle
.
GetEnergy
()
*
corsika
::
units
::
constants
::
c
;
geometry
::
Vector
<
SpeedType
::
dimension
_type
>
const
u
=
velocity
*
1
_m
/
(
velocity
.
GetNorm
()
*
1
_s
)
+
velocity
.
cross
(
m
agnetic
f
ield
)
*
corsika
::
particles
::
GetChargeNumber
(
vParticle
.
GetP
ID
())
*
vParticle
.
GetMomentum
()
/
vParticle
.
GetEnergy
()
*
corsika
::
units
::
constants
::
c
;
geometry
::
Vector
<
dimension
less_d
>
const
u
=
velocity
/
velocity
.
GetNorm
()
+
velocity
.
cross
(
fEnvironment
.
GetM
agnetic
F
ield
(
vParticle
.
GetP
osition
())
)
*
charge
*
min_distance
*
corsika
::
units
::
constants
::
cSquared
/
(
vParticle
.
GetEnergy
()
*
velocity
.
GetNorm
()
*
velocity
.
GetNorm
()
*
1
_m
);
vParticle
.
SetMomentum
(
u
*
1
_s
/
1
_m
*
vParticle
.
GetMomentum
().
GetNorm
());
// std::cout << " Test: " << magneticfield.GetComponents() << std::endl;
// std::cout << " Test: " << vParticle.GetMomentum().cross(magneticfield).GetComponents() << std::endl;
(
vParticle
.
GetEnergy
()
*
velocity
.
GetNorm
()
*
velocity
.
GetNorm
());
vParticle
.
SetMomentum
(
u
*
vParticle
.
GetMomentum
().
GetNorm
());
vParticle
.
SetTime
(
vParticle
.
GetTime
()
+
min_distance
/
units
::
constants
::
c
);
step
.
LimitEndTo
(
min_distance
);
...
...
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