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
ee55481f
Commit
ee55481f
authored
4 years ago
by
Maximilian Reininghaus
Committed by
Ralf Ulrich
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
only density parameters as arugments to LayeredSphericalAtmosphereBuilder::addXYZLayer
parent
5c9290c7
No related branches found
No related tags found
1 merge request
!265
Add medium type, as new property (air, water, rock...)
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Documentation/Examples/vertical_EAS.cc
+14
-16
14 additions, 16 deletions
Documentation/Examples/vertical_EAS.cc
Environment/LayeredSphericalAtmosphereBuilder.h
+41
-24
41 additions, 24 deletions
Environment/LayeredSphericalAtmosphereBuilder.h
with
55 additions
and
40 deletions
Documentation/Examples/vertical_EAS.cc
+
14
−
16
View file @
ee55481f
...
@@ -78,6 +78,13 @@ void registerRandomStreams(const int seed) {
...
@@ -78,6 +78,13 @@ void registerRandomStreams(const int seed) {
template
<
typename
T
>
template
<
typename
T
>
using
MEnv
=
environment
::
MediumPropertyModel
<
environment
::
UniformMagneticField
<
T
>>
;
using
MEnv
=
environment
::
MediumPropertyModel
<
environment
::
UniformMagneticField
<
T
>>
;
template
<
typename
...
TArgs
>
auto
make_builder
(
geometry
::
Point
const
&
center
,
TArgs
...
args
)
{
return
environment
::
LayeredSphericalAtmosphereBuilder
<
setup
::
EnvironmentInterface
,
MEnv
,
TArgs
...
>
{
args
...,
center
,
units
::
constants
::
EarthRadius
::
Mean
};
}
int
main
(
int
argc
,
char
**
argv
)
{
int
main
(
int
argc
,
char
**
argv
)
{
logging
::
SetLevel
(
logging
::
level
::
info
);
logging
::
SetLevel
(
logging
::
level
::
info
);
...
@@ -101,26 +108,17 @@ int main(int argc, char** argv) {
...
@@ -101,26 +108,17 @@ int main(int argc, char** argv) {
EnvType
env
;
EnvType
env
;
const
CoordinateSystem
&
rootCS
=
env
.
GetCoordinateSystem
();
const
CoordinateSystem
&
rootCS
=
env
.
GetCoordinateSystem
();
Point
const
center
{
rootCS
,
0
_m
,
0
_m
,
0
_m
};
Point
const
center
{
rootCS
,
0
_m
,
0
_m
,
0
_m
};
environment
::
LayeredSphericalAtmosphereBuilder
<
setup
::
EnvironmentInterface
,
MEnv
>
auto
builder
=
make_builder
(
center
,
environment
::
Medium
::
AirDry1Atm
,
builder
{
center
}
;
geometry
::
Vector
{
rootCS
,
0
_T
,
0
_T
,
1
_T
})
;
builder
.
setNuclearComposition
(
builder
.
setNuclearComposition
(
{{
particles
::
Code
::
Nitrogen
,
particles
::
Code
::
Oxygen
},
{{
particles
::
Code
::
Nitrogen
,
particles
::
Code
::
Oxygen
},
{
0.7847
f
,
1.
f
-
0.7847
f
}});
// values taken from AIRES manual, Ar removed for now
{
0.7847
f
,
1.
f
-
0.7847
f
}});
// values taken from AIRES manual, Ar removed for now
builder
.
addExponentialLayer
(
1222.6562
_g
/
(
1
_cm
*
1
_cm
),
994186.38
_cm
,
4
_km
,
builder
.
addExponentialLayer
(
1222.6562
_g
/
(
1
_cm
*
1
_cm
),
994186.38
_cm
,
4
_km
);
environment
::
Medium
::
AirDry1Atm
,
builder
.
addExponentialLayer
(
1144.9069
_g
/
(
1
_cm
*
1
_cm
),
878153.55
_cm
,
10
_km
);
geometry
::
Vector
(
rootCS
,
0
_T
,
0
_T
,
1
_T
));
builder
.
addExponentialLayer
(
1305.5948
_g
/
(
1
_cm
*
1
_cm
),
636143.04
_cm
,
40
_km
);
builder
.
addExponentialLayer
(
1144.9069
_g
/
(
1
_cm
*
1
_cm
),
878153.55
_cm
,
10
_km
,
builder
.
addExponentialLayer
(
540.1778
_g
/
(
1
_cm
*
1
_cm
),
772170.16
_cm
,
100
_km
);
environment
::
Medium
::
AirDry1Atm
,
builder
.
addLinearLayer
(
1e9
_cm
,
112.8
_km
);
geometry
::
Vector
(
rootCS
,
0
_T
,
0
_T
,
1
_T
));
builder
.
addExponentialLayer
(
1305.5948
_g
/
(
1
_cm
*
1
_cm
),
636143.04
_cm
,
40
_km
,
environment
::
Medium
::
AirDry1Atm
,
geometry
::
Vector
(
rootCS
,
0
_T
,
0
_T
,
1
_T
));
builder
.
addExponentialLayer
(
540.1778
_g
/
(
1
_cm
*
1
_cm
),
772170.16
_cm
,
100
_km
,
environment
::
Medium
::
AirDry1Atm
,
geometry
::
Vector
(
rootCS
,
0
_T
,
0
_T
,
1
_T
));
builder
.
addLinearLayer
(
1e9
_cm
,
112.8
_km
,
environment
::
Medium
::
AirDry1Atm
,
geometry
::
Vector
(
rootCS
,
0
_T
,
0
_T
,
1
_T
));
builder
.
assemble
(
env
);
builder
.
assemble
(
env
);
// setup particle stack, and add primary particle
// setup particle stack, and add primary particle
...
...
This diff is collapsed.
Click to expand it.
Environment/LayeredSphericalAtmosphereBuilder.h
+
41
−
24
View file @
ee55481f
...
@@ -18,8 +18,10 @@
...
@@ -18,8 +18,10 @@
#include
<corsika/units/PhysicalConstants.h>
#include
<corsika/units/PhysicalConstants.h>
#include
<corsika/units/PhysicalUnits.h>
#include
<corsika/units/PhysicalUnits.h>
#include
<functional>
#include
<memory>
#include
<memory>
#include
<stack>
#include
<stack>
#include
<tuple>
#include
<type_traits>
#include
<type_traits>
namespace
corsika
::
environment
{
namespace
corsika
::
environment
{
...
@@ -52,12 +54,14 @@ namespace corsika::environment {
...
@@ -52,12 +54,14 @@ namespace corsika::environment {
}
// namespace detail
}
// namespace detail
template
<
typename
TMediumInterface
=
environment
::
IMediumModel
,
template
<
typename
TMediumInterface
=
environment
::
IMediumModel
,
template
<
typename
>
typename
TMediumModelExtra
=
detail
::
NoExtraModel
>
template
<
typename
>
typename
TMediumModelExtra
=
detail
::
NoExtraModel
,
typename
...
TModelArgs
>
class
LayeredSphericalAtmosphereBuilder
{
class
LayeredSphericalAtmosphereBuilder
{
std
::
unique_ptr
<
NuclearComposition
>
composition_
;
std
::
unique_ptr
<
NuclearComposition
>
composition_
;
geometry
::
Point
center_
;
geometry
::
Point
center_
;
units
::
si
::
LengthType
previousRadius_
{
units
::
si
::
LengthType
::
zero
()};
units
::
si
::
LengthType
previousRadius_
{
units
::
si
::
LengthType
::
zero
()};
units
::
si
::
LengthType
earthRadius_
;
units
::
si
::
LengthType
earthRadius_
;
std
::
tuple
<
TModelArgs
...
>
const
additionalModelArgs_
;
std
::
stack
<
typename
VolumeTreeNode
<
TMediumInterface
>::
VTNUPtr
>
std
::
stack
<
typename
VolumeTreeNode
<
TMediumInterface
>::
VTNUPtr
>
layers_
;
// innermost layer first
layers_
;
// innermost layer first
...
@@ -76,18 +80,18 @@ namespace corsika::environment {
...
@@ -76,18 +80,18 @@ namespace corsika::environment {
public
:
public
:
LayeredSphericalAtmosphereBuilder
(
LayeredSphericalAtmosphereBuilder
(
corsika
::
geometry
::
Point
center
,
TModelArgs
...
args
,
corsika
::
geometry
::
Point
center
,
units
::
si
::
LengthType
earthRadius
=
units
::
constants
::
EarthRadius
::
Mean
)
units
::
si
::
LengthType
earthRadius
=
units
::
constants
::
EarthRadius
::
Mean
)
:
center_
(
center
)
:
center_
(
center
)
,
earthRadius_
(
earthRadius
)
{}
,
earthRadius_
(
earthRadius
)
,
additionalModelArgs_
{
args
...}
{}
void
setNuclearComposition
(
NuclearComposition
composition
)
{
void
setNuclearComposition
(
NuclearComposition
composition
)
{
composition_
=
std
::
make_unique
<
NuclearComposition
>
(
composition
);
composition_
=
std
::
make_unique
<
NuclearComposition
>
(
composition
);
}
}
template
<
typename
...
TArgs
>
void
addExponentialLayer
(
units
::
si
::
GrammageType
b
,
units
::
si
::
LengthType
c
,
void
addExponentialLayer
(
units
::
si
::
GrammageType
b
,
units
::
si
::
LengthType
c
,
units
::
si
::
LengthType
upperBoundary
,
TArgs
&&
...
args
)
{
units
::
si
::
LengthType
upperBoundary
)
{
using
namespace
units
::
si
;
using
namespace
units
::
si
;
auto
const
radius
=
earthRadius_
+
upperBoundary
;
auto
const
radius
=
earthRadius_
+
upperBoundary
;
...
@@ -100,43 +104,56 @@ namespace corsika::environment {
...
@@ -100,43 +104,56 @@ namespace corsika::environment {
auto
const
rho0
=
b
/
c
;
auto
const
rho0
=
b
/
c
;
std
::
cout
<<
"rho0 = "
<<
rho0
<<
", c = "
<<
c
<<
std
::
endl
;
std
::
cout
<<
"rho0 = "
<<
rho0
<<
", c = "
<<
c
<<
std
::
endl
;
if
constexpr
(
detail
::
has_extra_models
<
TMediumModelExtra
>::
value
)
if
constexpr
(
detail
::
has_extra_models
<
TMediumModelExtra
>::
value
)
{
node
->
template
SetModelProperties
<
// helper lambda in which the last 5 arguments to make_shared<...> are bound
TMediumModelExtra
<
environment
::
SlidingPlanarExponential
<
TMediumInterface
>
>>
(
auto
lastBound
=
[
&
](
auto
...
argPack
)
{
args
...,
center_
,
rho0
,
-
c
,
*
composition_
,
earthRadius_
);
return
std
::
make_shared
<
else
TMediumModelExtra
<
environment
::
SlidingPlanarExponential
<
TMediumInterface
>>>
(
node
->
template
SetModelProperties
<
argPack
...,
center_
,
rho0
,
-
c
,
*
composition_
,
earthRadius_
);
environment
::
SlidingPlanarExponential
<
TMediumInterface
>
>
(
};
// now unpack the additional arguments
auto
model
=
std
::
apply
(
lastBound
,
additionalModelArgs_
);
node
->
SetModelProperties
(
std
::
move
(
model
));
}
else
{
node
->
template
SetModelProperties
<
SlidingPlanarExponential
<
TMediumInterface
>
>
(
center_
,
rho0
,
-
c
,
*
composition_
,
earthRadius_
);
center_
,
rho0
,
-
c
,
*
composition_
,
earthRadius_
);
}
layers_
.
push
(
std
::
move
(
node
));
layers_
.
push
(
std
::
move
(
node
));
}
}
template
<
typename
...
TArgs
>
void
addLinearLayer
(
units
::
si
::
LengthType
c
,
units
::
si
::
LengthType
upperBoundary
)
{
void
addLinearLayer
(
units
::
si
::
LengthType
c
,
units
::
si
::
LengthType
upperBoundary
,
TArgs
&&
...
args
)
{
using
namespace
units
::
si
;
using
namespace
units
::
si
;
auto
const
radius
=
earthRadius_
+
upperBoundary
;
auto
const
radius
=
earthRadius_
+
upperBoundary
;
checkRadius
(
radius
);
checkRadius
(
radius
);
previousRadius_
=
radius
;
previousRadius_
=
radius
;
auto
node
=
std
::
make_unique
<
VolumeTreeNode
<
TMediumInterface
>>
(
std
::
make_unique
<
geometry
::
Sphere
>
(
center_
,
radius
));
units
::
si
::
GrammageType
constexpr
b
=
1
*
1
_g
/
(
1
_cm
*
1
_cm
);
units
::
si
::
GrammageType
constexpr
b
=
1
*
1
_g
/
(
1
_cm
*
1
_cm
);
auto
const
rho0
=
b
/
c
;
auto
const
rho0
=
b
/
c
;
std
::
cout
<<
"rho0 = "
<<
rho0
;
std
::
cout
<<
"rho0 = "
<<
rho0
;
auto
node
=
std
::
make_unique
<
VolumeTreeNode
<
TMediumInterface
>>
(
if
constexpr
(
detail
::
has_extra_models
<
TMediumModelExtra
>::
value
)
{
std
::
make_unique
<
geometry
::
Sphere
>
(
center_
,
radius
));
// helper lambda in which the last 2 arguments to make_shared<...> are bound
auto
lastBound
=
[
&
](
auto
...
argPack
)
{
return
std
::
make_shared
<
TMediumModelExtra
<
environment
::
HomogeneousMedium
<
TMediumInterface
>>>
(
argPack
...,
rho0
,
*
composition_
);
};
if
constexpr
(
detail
::
has_extra_models
<
TMediumModelExtra
>::
value
)
// now unpack the additional arguments
node
->
template
SetModelProperties
<
auto
model
=
std
::
apply
(
lastBound
,
additionalModelArgs_
);
TMediumModelExtra
<
environment
::
HomogeneousMedium
<
TMediumInterface
>
>>
(
args
...,
rho0
,
*
composition_
);
node
->
SetModelProperties
(
std
::
move
(
model
)
);
else
}
else
{
node
->
template
SetModelProperties
<
node
->
template
SetModelProperties
<
environment
::
HomogeneousMedium
<
TMediumInterface
>
>
(
args
...,
rho0
,
environment
::
HomogeneousMedium
<
TMediumInterface
>
>
(
rho0
,
*
composition_
);
*
composition_
);
}
layers_
.
push
(
std
::
move
(
node
));
layers_
.
push
(
std
::
move
(
node
));
}
}
...
...
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