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
04164a42
Commit
04164a42
authored
6 years ago
by
Maximilian Reininghaus
Browse files
Options
Downloads
Patches
Plain Diff
fixed build & test
parent
7bbfe4c7
No related branches found
No related tags found
1 merge request
!67
Resolve "Add support for inhomogeneus density"
Pipeline
#279
passed
6 years ago
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Environment/LinearIntegrator.h
+5
-6
5 additions, 6 deletions
Environment/LinearIntegrator.h
Environment/testEnvironment.cc
+14
-4
14 additions, 4 deletions
Environment/testEnvironment.cc
with
19 additions
and
10 deletions
Environment/LinearIntegrator.h
+
5
−
6
View file @
04164a42
...
...
@@ -24,10 +24,9 @@ namespace corsika::environment {
auto
IntegrateGrammage
(
corsika
::
geometry
::
Trajectory
<
corsika
::
geometry
::
Line
>
const
&
line
,
corsika
::
units
::
si
::
LengthType
length
)
const
{
auto
const
c0
=
GetImplementation
().
fRho
(
line
.
GetPosition
(
0
));
auto
const
c1
=
GetImplementation
().
fRho
.
Derivative
<
1
>
(
line
.
GetPosition
(
0
),
line
.
NormalizedDirection
());
auto
const
c0
=
GetImplementation
().
EvaluateAt
(
line
.
GetPosition
(
0
));
auto
const
c1
=
GetImplementation
().
fRho
.
FirstDerivative
(
line
.
GetPosition
(
0
),
line
.
NormalizedDirection
());
return
(
c0
+
0.5
*
c1
*
length
)
*
length
;
}
...
...
@@ -35,8 +34,8 @@ namespace corsika::environment {
corsika
::
geometry
::
Trajectory
<
corsika
::
geometry
::
Line
>
const
&
line
,
corsika
::
units
::
si
::
GrammageType
grammage
)
const
{
auto
const
c0
=
GetImplementation
().
fRho
(
line
.
GetPosition
(
0
));
auto
const
c1
=
GetImplementation
().
fRho
.
Derivative
<
1
>
(
line
.
GetPosition
(
0
),
line
.
NormalizedDirection
());
auto
const
c1
=
GetImplementation
().
fRho
.
First
Derivative
(
line
.
GetPosition
(
0
),
line
.
NormalizedDirection
());
return
(
1
-
0.5
*
grammage
*
c1
/
(
c0
*
c0
))
*
grammage
/
c0
;
}
...
...
This diff is collapsed.
Click to expand it.
Environment/testEnvironment.cc
+
14
−
4
View file @
04164a42
...
...
@@ -47,6 +47,10 @@ struct Exponential {
return
v
.
GetComponents
()[
0
]
*
(
*
this
)(
p
)
/
corsika
::
units
::
si
::
detail
::
static_pow
<
N
>
(
1
_m
);
}
auto
FirstDerivative
(
Point
const
&
p
,
Vector
<
dimensionless_d
>
const
&
v
)
const
{
return
Derivative
<
1
>
(
p
,
v
);
}
};
TEST_CASE
(
"DensityFunction"
)
{
...
...
@@ -57,7 +61,7 @@ TEST_CASE("DensityFunction") {
Vector
direction
(
cs
,
QuantityVector
<
dimensionless_d
>
(
1
,
0
,
0
));
Line
line
(
origin
,
Vector
<
SpeedType
::
dimension_type
>
(
cs
,
{
20
0
_m
/
second
,
0
_m
/
second
,
0
_m
/
second
}));
cs
,
{
20
_m
/
second
,
0
_m
/
second
,
0
_m
/
second
}));
auto
const
tEnd
=
5
_s
;
Trajectory
<
Line
>
const
trajectory
(
line
,
tEnd
);
...
...
@@ -69,7 +73,13 @@ TEST_CASE("DensityFunction") {
DensityFunction
const
rho
(
e
);
REQUIRE
(
rho
.
EvaluateAt
(
origin
)
==
e
(
origin
));
auto
const
exactGrammage
=
[](
auto
x
)
{
return
rho0
*
exp
(
x
/
1
_m
);
};
REQUIRE
(
rho
.
IntegrateGrammage
(
trajectory
,
5
_cm
)
/
exactGrammage
(
5
_cm
)
==
Approx
(
1
).
epsilon
(
1e-2
));
auto
const
exactGrammage
=
[](
auto
l
)
{
return
1
_m
*
rho0
*
(
exp
(
l
/
1
_m
)
-
1
);
};
auto
const
exactLength
=
[](
auto
X
)
{
return
1
_m
*
log
(
1
+
X
/
(
rho0
*
1
_m
));
};
auto
constexpr
l
=
15
_cm
;
CHECK
(
rho
.
IntegrateGrammage
(
trajectory
,
l
)
/
exactGrammage
(
l
)
==
Approx
(
1
).
epsilon
(
1e-2
));
CHECK
(
rho
.
ArclengthFromGrammage
(
trajectory
,
exactGrammage
(
l
))
/
exactLength
(
exactGrammage
(
l
))
==
Approx
(
1
).
epsilon
(
1e-2
));
}
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