IAP GITLAB

Skip to content
Snippets Groups Projects
Commit 7d860692 authored by Maximilian Reininghaus's avatar Maximilian Reininghaus :vulcan:
Browse files

some cleanup

parent 8d4f9f61
No related branches found
No related tags found
1 merge request!99sliding planar atmosphere
...@@ -50,16 +50,15 @@ namespace corsika::environment { ...@@ -50,16 +50,15 @@ namespace corsika::environment {
*/ */
// clang-format on // clang-format on
units::si::GrammageType IntegratedGrammage( units::si::GrammageType IntegratedGrammage(
geometry::Trajectory<geometry::Line> const& line, geometry::Trajectory<geometry::Line> const& line, units::si::LengthType to,
units::si::LengthType pTo,
geometry::Vector<units::si::dimensionless_d> const& axis) const { geometry::Vector<units::si::dimensionless_d> const& axis) const {
auto const vDotA = line.NormalizedDirection().dot(axis).magnitude(); auto const vDotA = line.NormalizedDirection().dot(axis).magnitude();
auto const rhoStart = GetImplementation().GetMassDensity(line.GetR0()); auto const rhoStart = GetImplementation().GetMassDensity(line.GetR0());
if (vDotA == 0) { if (vDotA == 0) {
return pTo * rhoStart; return to * rhoStart;
} else { } else {
return rhoStart * (fLambda / vDotA) * (exp(vDotA * pTo * fInvLambda) - 1); return rhoStart * (fLambda / vDotA) * (exp(vDotA * to * fInvLambda) - 1);
} }
} }
...@@ -83,15 +82,15 @@ namespace corsika::environment { ...@@ -83,15 +82,15 @@ namespace corsika::environment {
// clang-format on // clang-format on
units::si::LengthType ArclengthFromGrammage( units::si::LengthType ArclengthFromGrammage(
geometry::Trajectory<corsika::geometry::Line> const& line, geometry::Trajectory<corsika::geometry::Line> const& line,
units::si::GrammageType pGrammage, units::si::GrammageType grammage,
geometry::Vector<units::si::dimensionless_d> const& axis) const { geometry::Vector<units::si::dimensionless_d> const& axis) const {
auto const vDotA = line.NormalizedDirection().dot(axis).magnitude(); auto const vDotA = line.NormalizedDirection().dot(axis).magnitude();
auto const rhoStart = GetImplementation().GetMassDensity(line.GetR0()); auto const rhoStart = GetImplementation().GetMassDensity(line.GetR0());
if (vDotA == 0) { if (vDotA == 0) {
return pGrammage / rhoStart; return grammage / rhoStart;
} else { } else {
auto const logArg = pGrammage * fInvLambda * vDotA / rhoStart + 1; auto const logArg = grammage * fInvLambda * vDotA / rhoStart + 1;
if (logArg > 0) { if (logArg > 0) {
return fLambda / vDotA * log(logArg); return fLambda / vDotA * log(logArg);
} else { } else {
......
/*
* (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu
*
* See file AUTHORS for a list of contributors.
*
* This software is distributed under the terms of the GNU General Public
* Licence version 3 (GPL Version 3). See file LICENSE for a full version of
* the license.
*/
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include <corsika/units/PhysicalUnits.h> #include <corsika/units/PhysicalUnits.h>
namespace corsika::environment { namespace corsika::environment {
//clang-format off //clang-format off
/** /**
* flat exponential density distribution with * flat exponential density distribution with
...@@ -48,23 +48,22 @@ namespace corsika::environment { ...@@ -48,23 +48,22 @@ namespace corsika::environment {
, fAxis(axis) , fAxis(axis)
, fNuclComp(nuclComp) {} , fNuclComp(nuclComp) {}
corsika::units::si::MassDensityType GetMassDensity( units::si::MassDensityType GetMassDensity(geometry::Point const& p) const override {
corsika::geometry::Point const& p) const override {
return Base::fRho0 * exp(Base::fInvLambda * (p - Base::fP0).dot(fAxis)); return Base::fRho0 * exp(Base::fInvLambda * (p - Base::fP0).dot(fAxis));
} }
NuclearComposition const& GetNuclearComposition() const override { return fNuclComp; } NuclearComposition const& GetNuclearComposition() const override { return fNuclComp; }
corsika::units::si::GrammageType IntegratedGrammage( units::si::GrammageType IntegratedGrammage(
corsika::geometry::Trajectory<corsika::geometry::Line> const& line, geometry::Trajectory<geometry::Line> const& line,
corsika::units::si::LengthType pTo) const override { units::si::LengthType to) const override {
return Base::IntegratedGrammage(line, pTo, fAxis); return Base::IntegratedGrammage(line, to, fAxis);
} }
corsika::units::si::LengthType ArclengthFromGrammage( units::si::LengthType ArclengthFromGrammage(
corsika::geometry::Trajectory<corsika::geometry::Line> const& line, geometry::Trajectory<geometry::Line> const& line,
corsika::units::si::GrammageType pGrammage) const override { units::si::GrammageType grammage) const override {
return Base::ArclengthFromGrammage(line, pGrammage, fAxis); return Base::ArclengthFromGrammage(line, grammage, fAxis);
} }
}; };
} // namespace corsika::environment } // namespace corsika::environment
......
...@@ -45,26 +45,25 @@ namespace corsika::environment { ...@@ -45,26 +45,25 @@ namespace corsika::environment {
: Base(p0, rho, lambda) : Base(p0, rho, lambda)
, fNuclComp(nuclComp) {} , fNuclComp(nuclComp) {}
corsika::units::si::MassDensityType GetMassDensity( units::si::MassDensityType GetMassDensity(geometry::Point const& p) const override {
corsika::geometry::Point const& p) const override {
auto const height = (p - Base::fP0).norm(); auto const height = (p - Base::fP0).norm();
return Base::fRho0 * exp(Base::fInvLambda * height); return Base::fRho0 * exp(Base::fInvLambda * height);
} }
NuclearComposition const& GetNuclearComposition() const override { return fNuclComp; } NuclearComposition const& GetNuclearComposition() const override { return fNuclComp; }
corsika::units::si::GrammageType IntegratedGrammage( units::si::GrammageType IntegratedGrammage(
corsika::geometry::Trajectory<corsika::geometry::Line> const& line, geometry::Trajectory<geometry::Line> const& line,
corsika::units::si::LengthType pTo) const override { units::si::LengthType to) const override {
auto const axis = (line.GetR0() - Base::fP0).normalized(); auto const axis = (line.GetR0() - Base::fP0).normalized();
return Base::IntegratedGrammage(line, pTo, axis); return Base::IntegratedGrammage(line, to, axis);
} }
corsika::units::si::LengthType ArclengthFromGrammage( units::si::LengthType ArclengthFromGrammage(
corsika::geometry::Trajectory<corsika::geometry::Line> const& line, geometry::Trajectory<geometry::Line> const& line,
corsika::units::si::GrammageType pGrammage) const override { units::si::GrammageType grammage) const override {
auto const axis = (line.GetR0() - Base::fP0).normalized(); auto const axis = (line.GetR0() - Base::fP0).normalized();
return Base::ArclengthFromGrammage(line, pGrammage, axis); return Base::ArclengthFromGrammage(line, grammage, axis);
} }
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment