From 2dc06e42d4a2e55473e6a7d01b10ad52ed99f8f9 Mon Sep 17 00:00:00 2001 From: Remy Prechelt <prechelt@hawaii.edu> Date: Tue, 30 Jun 2020 09:12:09 -1000 Subject: [PATCH] Add additional density checks for homogeneous medium. --- Environment/IRefractiveIndexModel.h | 2 +- Environment/UniformRefractiveIndex.h | 2 +- Environment/testEnvironment.cc | 37 +++++++++++++++++++++------- 3 files changed, 30 insertions(+), 11 deletions(-) diff --git a/Environment/IRefractiveIndexModel.h b/Environment/IRefractiveIndexModel.h index ed8944e67..30e4cf9a5 100644 --- a/Environment/IRefractiveIndexModel.h +++ b/Environment/IRefractiveIndexModel.h @@ -1,5 +1,5 @@ /* - * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu + * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. * diff --git a/Environment/UniformRefractiveIndex.h b/Environment/UniformRefractiveIndex.h index a64f07c4f..962d4aa99 100644 --- a/Environment/UniformRefractiveIndex.h +++ b/Environment/UniformRefractiveIndex.h @@ -1,5 +1,5 @@ /* - * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu + * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. * diff --git a/Environment/testEnvironment.cc b/Environment/testEnvironment.cc index b30e5ffd4..5b29811d0 100644 --- a/Environment/testEnvironment.cc +++ b/Environment/testEnvironment.cc @@ -253,7 +253,11 @@ TEST_CASE("UniformMagneticField w/ Homogeneous Medium") { // the constant density const auto density{19.2_g / cube(1_cm)}; + // the constant density + const auto density{19.2_g / cube(1_cm)}; + // create our atmospheric model +<<<<<<< HEAD <<<<<<< HEAD AtmModel medium(B0, density, protonComposition); @@ -292,6 +296,9 @@ TEST_CASE("UniformMagneticField w/ Homogeneous Medium") { REQUIRE((medium.ArclengthFromGrammage(trajectory, density * 5_m) / 5_m) == Approx(1)); ======= AtmModel medium(n, 19.2_g / cube(1_cm), protonComposition); +======= + AtmModel medium(n, density, protonComposition); +>>>>>>> a61a703... Add additional density checks for homogeneous medium. // and require that it is constant REQUIRE(n == medium.GetRefractiveIndex(Point(gCS, -10_m, 4_m, 35_km))); @@ -310,6 +317,7 @@ TEST_CASE("UniformMagneticField w/ Homogeneous Medium") { REQUIRE(n2 == medium.GetRefractiveIndex(Point(gCS, +210_m, 0_m, 7_km))); REQUIRE(n2 == medium.GetRefractiveIndex(Point(gCS, 0_m, 0_m, 0_km))); REQUIRE(n2 == medium.GetRefractiveIndex(Point(gCS, 100_km, 400_km, 350_km))); +<<<<<<< HEAD >>>>>>> 12a0be6... Add test for SetRefractiveIndex } @@ -332,16 +340,18 @@ TEST_CASE("UniformRefractiveIndex w/ FlatExponential") { // the refractive index we want returned everywhere RefractiveIndexType n = 1.000327__; +======= +>>>>>>> a61a703... Add additional density checks for homogeneous medium. - // create our atmospheric model - AtmModel medium(n, gOrigin, axis, rho0, lambda, protonComposition); + // check the density and nuclear composition + REQUIRE(density == medium.GetMassDensity(Point(gCS, 0_m, 0_m, 0_m))); + medium.GetNuclearComposition(); - // check that the returned refractive index is correct - REQUIRE(n == medium.GetRefractiveIndex(Point(gCS, -10_m, 4_m, 35_km))); - REQUIRE(n == medium.GetRefractiveIndex(Point(gCS, +210_m, 0_m, 7_km))); - REQUIRE(n == medium.GetRefractiveIndex(Point(gCS, 0_m, 0_m, 0_km))); - REQUIRE(n == medium.GetRefractiveIndex(Point(gCS, 100_km, 400_km, 350_km))); + // create a line of length 1 m + Line const line(gOrigin, Vector<SpeedType::dimension_type>( + gCS, {1_m / second, 0_m / second, 0_m / second})); +<<<<<<< HEAD <<<<<<< HEAD // the refractive index we want returned everywhere RefractiveIndexType n = 1.1234__; @@ -375,14 +385,23 @@ TEST_CASE("UniformRefractiveIndex w/ FlatExponential") { ======= // a new refractive index RefractiveIndexType n2 = 1.123456__; +======= + // the end time of our line + auto const tEnd = 1_s; +>>>>>>> a61a703... Add additional density checks for homogeneous medium. - // update the refractive index of this atmospheric model - medium.SetRefractiveIndex(n2); + // and the associated trajectory + Trajectory<Line> const trajectory(line, tEnd); +<<<<<<< HEAD // check that the returned refractive index is correct REQUIRE(n2 == medium.GetRefractiveIndex(Point(gCS, -10_m, 4_m, 35_km))); REQUIRE(n2 == medium.GetRefractiveIndex(Point(gCS, +210_m, 0_m, 7_km))); REQUIRE(n2 == medium.GetRefractiveIndex(Point(gCS, 0_m, 0_m, 0_km))); REQUIRE(n2 == medium.GetRefractiveIndex(Point(gCS, 100_km, 400_km, 350_km))); >>>>>>> 12a0be6... Add test for SetRefractiveIndex +======= + // and check the integrated grammage + REQUIRE((medium.IntegratedGrammage(trajectory, 3_m) / (density * 3_m)) == Approx(1)); +>>>>>>> a61a703... Add additional density checks for homogeneous medium. } -- GitLab