Msise00Drag.hpp

Go to the documentation of this file.
00001 #pragma ident "$Id: Msise00Drag.hpp 3140 2012-06-18 15:03:02Z susancummins $"
00002 
00008 #ifndef   GPSTK_MSISE00_DRAG_HPP
00009 #define   GPSTK_MSISE00_DRAG_HPP
00010 
00011 
00012 //============================================================================
00013 //
00014 //  This file is part of GPSTk, the GPS Toolkit.
00015 //
00016 //  The GPSTk is free software; you can redistribute it and/or modify
00017 //  it under the terms of the GNU Lesser General Public License as published
00018 //  by the Free Software Foundation; either version 2.1 of the License, or
00019 //  any later version.
00020 //
00021 //  The GPSTk is distributed in the hope that it will be useful,
00022 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00023 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00024 //  GNU Lesser General Public License for more details.
00025 //
00026 //  You should have received a copy of the GNU Lesser General Public
00027 //  License along with GPSTk; if not, write to the Free Software Foundation,
00028 //  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
00029 //
00030 //  Wei Yan - Chinese Academy of Sciences . 2009, 2010
00031 //
00032 //============================================================================
00033 
00034 
00035 #include "AtmosphericDrag.hpp"
00036 
00037 namespace gpstk
00038 {
00039 
00042 
00055    class Msise00Drag : public AtmosphericDrag
00056    {
00057    public:
00058 
00060       Msise00Drag()
00061          : ap_opt(16),     // daily ap 14.918648166
00062            f107_opt(92.5)   // daily f107
00063       { }
00064       
00065 
00067       virtual ~Msise00Drag(){}
00068 
00069 
00070       void test();
00071 
00079       virtual double computeDensity(UTCTime utc, 
00080                                     EarthBody& rb, 
00081                                     Vector<double> r, 
00082                                     Vector<double> v);
00083 
00084    protected:
00085 
00086       double ap_opt;// = 15;         // daily ap
00087       double f107_opt;// = 150;      // daily F107
00088 
00089          /*   
00090           *   Switches: to turn on and off particular variations use these switches.
00091           *   0 is off, 1 is on, and 2 is main effects off but cross terms on.
00092           *
00093           *   Standard values are 0 for switch 0 and 1 for switches 1 to 23. The 
00094           *   array "switches" needs to be set accordingly by the calling program. 
00095           *   The arrays sw and swc are set internally.
00096           *
00097           *   switches[i]:
00098           *    i - explanation
00099           *   -----------------
00100           *    0 - output in centimeters instead of meters
00101           *    1 - F10.7 effect on mean
00102           *    2 - time independent
00103           *    3 - symmetrical annual
00104           *    4 - symmetrical semiannual
00105           *    5 - asymmetrical annual
00106           *    6 - asymmetrical semiannual
00107           *    7 - diurnal
00108           *    8 - semidiurnal
00109           *    9 - daily ap [when this is set to -1 (!) the pointer
00110           *                  ap_a in struct nrlmsise_input must
00111           *                  point to a struct ap_array]
00112           *   10 - all UT/long effects
00113           *   11 - longitudinal
00114           *   12 - UT and mixed UT/long
00115           *   13 - mixed AP/UT/LONG
00116           *   14 - terdiurnal
00117           *   15 - departures from diffusive equilibrium
00118           *   16 - all TINF var
00119           *   17 - all TLB var
00120           *   18 - all TN1 var
00121           *   19 - all S var
00122           *   20 - all TN2 var
00123           *   21 - all NLB var
00124           *   22 - all TN3 var
00125           *   23 - turbo scale height var
00126           */
00127       struct nrlmsise_flags 
00128       {
00129          int switches[24];
00130          double sw[24];
00131          double swc[24];
00132       };
00133 
00134 
00135          /* Array containing the following magnetic values:
00136           *   0 : daily AP
00137           *   1 : 3 hr AP index for current time
00138           *   2 : 3 hr AP index for 3 hrs before current time
00139           *   3 : 3 hr AP index for 6 hrs before current time
00140           *   4 : 3 hr AP index for 9 hrs before current time
00141           *   5 : Average of eight 3 hr AP indicies from 12 to 33 hrs 
00142           *           prior to current time
00143           *   6 : Average of eight 3 hr AP indicies from 36 to 57 hrs 
00144           *           prior to current time 
00145           */
00146       struct ap_array 
00147       {
00148          double a[7];   
00149       };
00150 
00151 
00152          /*
00153           *   NOTES ON INPUT VARIABLES: 
00154           *      UT, Local Time, and Longitude are used independently in the
00155           *      model and are not of equal importance for every situation.  
00156           *      For the most physically realistic calculation these three
00157           *      variables should be consistent (lst=sec/3600 + g_long/15).
00158           *      The Equation of Time departures from the above formula
00159           *      for apparent local time can be included if available but
00160           *      are of minor importance.
00161           *
00162           *      f107 and f107A values used to generate the model correspond
00163           *      to the 10.7 cm radio flux at the actual distance of the Earth
00164           *      from the Sun rather than the radio flux at 1 AU. The following
00165           *      site provides both classes of values:
00166           *      ftp://ftp.ngdc.noaa.gov/STP/SOLAR_DATA/SOLAR_RADIO/FLUX/
00167           *
00168           *      f107, f107A, and ap effects are neither large nor well
00169           *      established below 80 km and these parameters should be set to
00170           *      150., 150., and 4. respectively.
00171           */
00172       struct nrlmsise_input
00173       {
00174          int year;               
00175          int doy;                
00176          double sec;             
00177          double alt;             
00178          double g_lat;           
00179          double g_long;          
00180          double lst;             
00181          double f107A;           
00182          double f107;            
00183          double ap;              
00184          struct ap_array *ap_a;  
00185       };
00186 
00187          /* 
00188           *   OUTPUT VARIABLES:
00189           *      d[0] - HE NUMBER DENSITY(CM-3)
00190           *      d[1] - O NUMBER DENSITY(CM-3)
00191           *      d[2] - N2 NUMBER DENSITY(CM-3)
00192           *      d[3] - O2 NUMBER DENSITY(CM-3)
00193           *      d[4] - AR NUMBER DENSITY(CM-3)                       
00194           *      d[5] - TOTAL MASS DENSITY(GM/CM3) [includes d[8] in td7d]
00195           *      d[6] - H NUMBER DENSITY(CM-3)
00196           *      d[7] - N NUMBER DENSITY(CM-3)
00197           *      d[8] - Anomalous oxygen NUMBER DENSITY(CM-3)
00198           *      t[0] - EXOSPHERIC TEMPERATURE
00199           *      t[1] - TEMPERATURE AT ALT
00200           * 
00201           *
00202           *      O, H, and N are set to zero below 72.5 km
00203           *
00204           *      t[0], Exospheric temperature, is set to global average for
00205           *      altitudes below 120 km. The 120 km gradient is left at global
00206           *      average value for altitudes below 72 km.
00207           *
00208           *      d[5], TOTAL MASS DENSITY, is NOT the same for subroutines GTD7 
00209           *      and GTD7D
00210           *
00211           *        SUBROUTINE GTD7 -- d[5] is the sum of the mass densities of the
00212           *        species labeled by indices 0-4 and 6-7 in output variable d.
00213           *        This includes He, O, N2, O2, Ar, H, and N but does NOT include
00214           *        anomalous oxygen (species index 8).
00215           *
00216           *        SUBROUTINE GTD7D -- d[5] is the "effective total mass density
00217           *        for drag" and is the sum of the mass densities of all species
00218           *        in this model, INCLUDING anomalous oxygen.
00219           */
00220       struct nrlmsise_output 
00221       {
00222          double d[9];   
00223          double t[2];   
00224       };
00225 
00227       void gtd7 (struct nrlmsise_input *input, 
00228                  struct nrlmsise_flags *flags,
00229                  struct nrlmsise_output *output);
00230 
00231 
00236       void gtd7d(struct nrlmsise_input *input,
00237                  struct nrlmsise_flags *flags,
00238                  struct nrlmsise_output *output);
00239 
00240 
00242       void gts7 (struct nrlmsise_input *input,
00243                  struct nrlmsise_flags *flags,
00244                  struct nrlmsise_output *output);
00245 
00246 
00247 
00249       void ghp7 (struct nrlmsise_input *input,
00250                  struct nrlmsise_flags *flags,
00251                  struct nrlmsise_output *output,
00252                  double press);
00253 
00254    private:
00255 
00256       // local functions
00257       // we don't care about what it do, just call it
00258 
00259       void tselec(struct nrlmsise_flags *flags);
00260 
00261       void glatf(double lat, double *gv, double *reff);
00262       
00263       double ccor(double alt, double r, double h1, double zh);
00264       
00265       double ccor2(double alt, double r, double h1, double zh, double h2);
00266       
00267       double scalh(double alt, double xm, double temp);
00268       
00269       double dnet (double dd, double dm, double zhm, double xmm, double xm);
00270       
00271       void splini (double *xa, double *ya, double *y2a, int n, double x, double *y);
00272       
00273       void splint (double *xa, double *ya, double *y2a, int n, double x, double *y);
00274       
00275       void spline (double *x, double *y, int n, double yp1, double ypn, double *y2);
00276       
00277       double zeta(double zz, double zl);
00278       
00279       double densm (double alt, double d0, double xm, double *tz, int mn3, 
00280                     double *zn3, double *tn3, double *tgn3, int mn2, 
00281                     double *zn2, double *tn2, double *tgn2);
00282       
00283       double densu (double alt, double dlb, double tinf, double tlb, double xm, 
00284                     double alpha, double *tz, double zlb, double s2, int mn1, 
00285                     double *zn1, double *tn1, double *tgn1);
00286       
00287       double g0(double a, double *p);
00288       
00289       double sumex(double ex);
00290       
00291       double sg0(double ex, double *p, double *ap);
00292       
00293       double globe7(double *p, struct nrlmsise_input *input, 
00294                     struct nrlmsise_flags *flags);
00295       
00296       double glob7s(double *p, struct nrlmsise_input *input, 
00297                     struct nrlmsise_flags *flags);
00298 
00299 
00300    private:
00301 
00302       // POWER7
00303       static double pt[150];
00304       static double pd[9][150];
00305       static double ps[150];
00306       static double pdl[2][25];
00307       static double ptl[4][100];
00308       static double pma[10][100];
00309       static double sam[100];
00310 
00311       // LOWER7 
00312       static double ptm[10];
00313       static double pdm[8][10];
00314       static double pavgm[10];
00315 
00316       // PARMB 
00317       static double gsurf;
00318       static double re;
00319 
00320       // GTS3C 
00321       static double dd;
00322 
00323       // DMIX 
00324       static double dm04, dm16, dm28, dm32, dm40, dm01, dm14;
00325 
00326       // MESO7 
00327       static double meso_tn1[5];
00328       static double meso_tn2[4];
00329       static double meso_tn3[5];
00330       static double meso_tgn1[2];
00331       static double meso_tgn2[2];
00332       static double meso_tgn3[2];
00333 
00334       // LPOLY 
00335       static double dfa;
00336       static double plg[4][9];
00337       static double ctloc, stloc;
00338       static double c2tloc, s2tloc;
00339       static double s3tloc, c3tloc;
00340       static double apdf, apt[4];
00341 
00342    }; // End of class 'Msise00Drag'
00343 
00344       // @}
00345 
00346 }  // End of namespace 'gpstk'
00347 
00348 #endif      // GPSTK_MSISE00_DRAG_HPP
00349 

Generated on Sun May 26 03:31:07 2013 for GPS ToolKit Software Library by  doxygen 1.3.9.1