# NRLMSISE-00 Atmospheric Model is now available in SatelliteToolbox.jl

**URL:** <https://discourse.julialang.org/t/nrlmsise-00-atmospheric-model-is-now-available-in-satellitetoolbox-jl/11667>\
**Category:** Astro/Space\
**Created:** [June 14, 2018, 1:06am UTC](https://discourse.julialang.org/t/nrlmsise-00-atmospheric-model-is-now-available-in-satellitetoolbox-jl/11667 "2018-06-14T01:06:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ronis\_BR](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ronis_br/32/50999_2.png) [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Post date:** [June 14, 2018, 1:06am UTC](https://discourse.julialang.org/t/nrlmsise-00-atmospheric-model-is-now-available-in-satellitetoolbox-jl/11667/1 "2018-06-14T01:06:18Z")

</div>

Hi guys!

The `master` branch of [SatelliteToolbox.jl](https://github.com/SatelliteToolbox/SatelliteToolbox.jl) has now the atmospheric model [NRLMSISE-00](https://ccmc.gsfc.nasa.gov/modelweb/atmos/nrlmsise00.html). I need this because it will be integrated into the numerical orbit propagator that I am coding. However, since I am no expert in this area, the codification was almost “blind”. The values seems accurate (I have to add the tests…), but if anyone can test, I will appreciate!

It has the usual functions of NRLMSISE-00 `gtd7` and `gtd7d` with possibilities to select flags to enable/disable computations, but most of the time people can use the API function `nrlmsise00`, which takes care about the internal configuration.

The density can be computed as follows:

```julia-repl
out = nrlmsise00(DatetoJD(2016, 6, 14, 00, 46, 19), # Julian Day
                 700, # Altitude [m]
                 -22*pi/180, # Latitude [rad]
                 -45*pi/180, # Longitude [rad]
                 83.7, # 81 day average F10.7 flux
                 102.5, # Daily F10.7 for previous day
                 15; # Magnetic index (daily)
                 output_si = false # Output in cm^-3 and g/cm^-3
    )
SatelliteToolbox.NRLMSISE00_Output{Float64}
  den_N: Float64 0.0
  den_N2: Float64 1.7911798343113382e19
  den_O: Float64 0.0
  den_aO: Float64 0.0
  den_O2: Float64 4.805198141507027e18
  den_H: Float64 0.0
  den_He: Float64 1.2020106337709783e14
  den_Ar: Float64 2.1425197588115072e17
  den_Total: Float64 0.0011020196415983325
  T_exo: Float64 1027.3184649
  T_alt: Float64 292.3967045943127
  flags: Dict{Symbol,Bool}

```

Here is how the results compare the the online version of MSIS:

| Value | SatelliteToolbox.jl | Online NRLMSISE-00 |
| --- | --- | --- |
| Density O | 0.0 | 0.0 |
| Density N2 | 1.7911798343113382e19 | 1.792E+19 |
| Density O2 | 4.805198141507027e18 | 4.806E+18 |
| Density He | 1.2020106337709783e14 | 1.202E+14 |
| Density Ar | 2.1425197588115072e17 | 2.143E+17 |
| Density H | 0.0 | 0.0 |
| Density N | 0.0 | 0.0 |
| Density Anom. O | 0.0 | 0.0 |
| Total Density | 0.0011020196415983325 | 1.102E-03 |
| Neutral Temperature | 292.3967045943127 | 292.4 |
| Exospheric Temperature | 1027.3184649 | 1027 |

So, it seems to be working OK for some cases. However, additional tests are required.

Next steps in SatelliteToolbox.jl are:

- Tag a new version with the modifications…
- Learn how to use [JPLEphemeris](https://github.com/JuliaAstrodynamics/JPLEphemeris.jl) package to compute the planets position so that the acceleration can be added into the numerical orbit propagator.
- Test different integrators from DifferentialEquations.jl to select the most appropriate for the numerical orbit propagation.
- Starts coding the numerical orbit propagator.

---

<div class="post-metadata">

**Author:** ![Ronis\_BR](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ronis_br/32/50999_2.png) [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Post date:** [June 15, 2018, 7:22pm UTC](https://discourse.julialang.org/t/nrlmsise-00-atmospheric-model-is-now-available-in-satellitetoolbox-jl/11667/2 "2018-06-15T19:22:33Z")

</div>

Now we have the tests! I took the default test set and add two different scenarios from the online algorithm.

However, I am having a little problem, not sure if anyone here can help me. The online version of MSIS takes the following data for AP index:

```julia
ap(00-03 hours prior used)
ap(03-06 hours prior used)
ap(06-09 hours prior used)
ap(09-12 hours prior used)
ap(12-33 hours prior used)
ap(33-59 hours prior used)

```

Whereas the NRLMSISE-00 FORTRAN algorithm takes the following:

```julia
C (1) DAILY AP
C (2) 3 HR AP INDEX FOR CURRENT TIME
C (3) 3 HR AP INDEX FOR 3 HRS BEFORE CURRENT TIME
C (4) 3 HR AP INDEX FOR 6 HRS BEFORE CURRENT TIME
C (5) 3 HR AP INDEX FOR 9 HRS BEFORE CURRENT TIME
C (6) AVERAGE OF EIGHT 3 HR AP INDICIES FROM 12 TO 33 HRS PRIOR
C TO CURRENT TIME
C (7) AVERAGE OF EIGHT 3 HR AP INDICIES FROM 36 TO 57 HRS PRIOR
C TO CURRENT TIME

```

Maybe this was causing the minor difference I am seeing between the implemented model and the online version. Notice that if I run the online version using only the daily AP, then the tests are equal up to the precision of the online test.

---

<div class="post-metadata">

**Author:** ![hpoit](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hpoit/32/245_2.png) [@hpoit](https://discourse.julialang.org/u/hpoit)\
**Post date:** [June 16, 2018, 1:36am UTC](https://discourse.julialang.org/t/nrlmsise-00-atmospheric-model-is-now-available-in-satellitetoolbox-jl/11667/3 "2018-06-16T01:36:39Z")

</div>

@helgee would you know anything about this?
