IAP GITLAB

Skip to content

Add helper functions to create US standard atmosphere.

Remy Prechelt requested to merge rprechelt-us-standard into master

One of the standard atmosphere models is the US Standard Atmosphere - this is what is implemented in AIRES, and was copied by hand into the vertical_EAS example without the name (shown below) and has since been copied into almost every other example (lots of code duplication). This MR implements a helper function that can be used US Standard atmospheres quickly.

It also implements an implements_mixin utility that can be used to check whether TEnvironmentInterface satisfies one of the media mixins (i.e. refractivity, magnetic fields, etc.) - I didn't see any existing check for this but let me know if I missed it. This is used to optionally add the US Standard refractivity if the interface calls for a refractive index.

This code turns the following code that is used in every example:

auto builder = make_layered_spherical_atmosphere_builder<
      setup::EnvironmentInterface, MyExtraEnv>::create(center,
                                                       constants::EarthRadius::Mean,
                                                       Medium::AirDry1Atm,
                                                       Vector{rootCS, 0_T, 50_uT, 0_T});
  builder.setNuclearComposition(
      {{Code::Nitrogen, Code::Oxygen},
       {0.7847f, 1.f - 0.7847f}}); // 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(1144.9069_g / (1_cm * 1_cm), 878153.55_cm, 10_km);
  builder.addExponentialLayer(1305.5948_g / (1_cm * 1_cm), 636143.04_cm, 40_km);
  builder.addExponentialLayer(540.1778_g / (1_cm * 1_cm), 772170.16_cm, 100_km);
  builder.addLinearLayer(1e9_cm, 112.8_km);
  builder.assemble(env);

into

  create_us_standard_atmosphere<setup::EnvironmentInterface, MyExtraEnv>(
      env, center, constants::EarthRadius::Mean, Medium::AirDry1Atm,
      MagneticFieldVector{rootCS, 0_T, 50_uT, 0_T});

This is still a WIP and all comments are welcome for improvements and alternative ways to approach this.

Edited by Ralf Ulrich

Merge request reports

Loading