IAP GITLAB

Skip to content
Snippets Groups Projects
Commit 94876c82 authored by Nikos Karastathis's avatar Nikos Karastathis :ocean:
Browse files

preliminary tests for flat earth propagator

parent a29e1a50
No related branches found
No related tags found
1 merge request!503Flat earth propagator
......@@ -1226,4 +1226,69 @@ TEST_CASE("Propagators") {
} // END: SECTION("Straight Propagator w/ Exponential Refractive Index")
SECTION("Flat Earth Propagator w/ Uniform Refractive Index") {
// create a suitable environment
using IModelInterface =
IRefractiveIndexModel<IMediumPropertyModel<IMagneticFieldModel<IMediumModel>>>;
using AtmModel = UniformRefractiveIndex<
MediumPropertyModel<UniformMagneticField<HomogeneousMedium<IModelInterface>>>>;
using EnvType = Environment<AtmModel>;
EnvType env;
CoordinateSystemPtr const& rootCS = env.getCoordinateSystem();
// get the center point
Point const center{rootCS, 0_m, 0_m, 0_m};
// a refractive index for the vacuum
const double ri_{1};
// the constant density
const auto density{19.2_g / cube(1_cm)};
// the composition we use for the homogeneous medium
NuclearComposition const Composition({Code::Nitrogen}, {1.});
// create magnetic field vector
Vector B1(rootCS, 0_T, 0_T, 0.3809_T);
// create a Sphere for the medium
auto Medium = EnvType::createNode<Sphere>(center, 1_km);
// set the environment properties
auto const props = Medium->setModelProperties<AtmModel>(ri_, Medium::AirDry1Atm, B1,
density, Composition);
// bind things together
env.getUniverse()->addChild(std::move(Medium));
// get some points
Point const upperBoundary_(rootCS, {0_m, 0_m, 1_km});
Point const p0(rootCS, {0_m, 0_m, 0_m});
Point const p10(rootCS, {0_m, 0_m, 10_m});
// get a unit vector
Vector<dimensionless_d> const v1(rootCS, {0, 0, 1});
Vector<dimensionless_d> const v2(rootCS, {0, 0, -1});
// get a geometrical path of points
Path const P1({p0, p10});
LengthType const step_{1_m};
// construct a Straight Propagator given the uniform refractive index environment
FlatEarthPropagator const SP(env, upperBoundary_, p0, step_);
// store the outcome of the Propagate method to paths_
auto const paths_ = SP.propagate(p0, p10, 1_m);
// perform checks to paths_ components
for (auto const& path : paths_) {
CHECK((path.propagation_time_ / 1_s) -
(((p10 - p0).getNorm() / constants::c) / 1_s) ==
Approx(0));
CHECK(path.average_refractive_index_ == Approx(1));
CHECK(path.refractive_index_source_ == Approx(1));
CHECK(path.refractive_index_destination_ == Approx(1));
CHECK(path.emit_.getComponents() == v1.getComponents());
CHECK(path.receive_.getComponents() == v2.getComponents());
CHECK(path.R_distance_ == 10_m);
CHECK(std::equal(
P1.begin(), P1.end(), path.begin(),
[](Point const& a, Point const& b) { return (a - b).getNorm() / 1_m < 1e-5; }));
}
} // END: SECTION("Flat Earth Propagator w/ Uniform Refractive Index")
} // END: TEST_CASE("Propagators")
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