source: JEM-EUSO/esaf_lal/tags/v1_r0/esaf/packages/common/atmosphere/include/MSISEtool.hh @ 117

Last change on this file since 117 was 117, checked in by moretto, 11 years ago

ESAF version compilable on mac OS

File size: 9.7 KB
Line 
1// ESAF : Euso Simulation and Analysis Framework
2// $Id: MSISEtool.hh 1003 2004-09-13 21:46:13Z thea $
3// S. Moreggia created 18 November 2003
4
5// nrlmsise-00 C code adapted for C++ structure
6// Usefull commentaries written by nrlmsise-00 people have been kept
7
8#ifndef __MSISETOOL_H__
9#define __MSISETOOL_H__
10
11#include "Rtypes.h"
12
13/*******************************************************************************
14 *
15 * MSISEtool : class description
16 *
17 * Source MSISE C-code interfaced with esaf as a C++ structure
18 *
19 ******************************************************************************/
20
21
22
23// nrlmsise-00 commentaries
24/* -------------------------------------------------------------------- */
25/* ---------  N R L M S I S E - 0 0    M O D E L    2 0 0 1  ---------- */
26/* -------------------------------------------------------------------- */
27
28/* This file is part of the NRLMSISE-00  C source code package - release
29 * 20020503
30 *
31 * The NRLMSISE-00 model was developed by Mike Picone, Alan Hedin, and
32 * Doug Drob. They also wrote a NRLMSISE-00 distribution package in
33 * FORTRAN which is available at
34 * http://uap-www.nrl.navy.mil/models_web/msis/msis_home.htm
35 *
36 * Dominik Brodowski implemented and maintains this C version. You can
37 * reach him at devel@brodo.de. See the file "DOCUMENTATION" for details,
38 * and check http://www.brodo.de/english/pub/nrlmsise/index.html for
39 * updated releases of this package.
40 */
41
42
43
44/* ------------------------------------------------------------------- */
45/* ------------------------------- INPUT ----------------------------- */
46/* ------------------------------------------------------------------- */
47
48struct nrlmsise_flags {
49        int switches[24];
50        double sw[24];
51        double swc[24];
52};
53/*   
54 *   Switches: to turn on and off particular variations use these switches.
55 *   0 is off, 1 is on, and 2 is main effects off but cross terms on.
56 *
57 *   Standard values are 0 for switch 0 and 1 for switches 1 to 23. The
58 *   array "switches" needs to be set accordingly by the calling program.
59 *   The arrays sw and swc are set internally.
60 *
61 *   switches[i]:
62 *    i - explanation
63 *   -----------------
64 *    0 - output in centimeters instead of meters
65 *    1 - F10.7 effect on mean
66 *    2 - time independent
67 *    3 - symmetrical annual
68 *    4 - symmetrical semiannual
69 *    5 - asymmetrical annual
70 *    6 - asymmetrical semiannual
71 *    7 - diurnal
72 *    8 - semidiurnal
73 *    9 - daily ap [when this is set to -1 (!) the pointer
74 *                  ap_a in struct nrlmsise_input must
75 *                  point to a struct ap_array]
76 *   10 - all UT/long effects
77 *   11 - longitudinal
78 *   12 - UT and mixed UT/long
79 *   13 - mixed AP/UT/LONG
80 *   14 - terdiurnal
81 *   15 - departures from diffusive equilibrium
82 *   16 - all TINF var
83 *   17 - all TLB var
84 *   18 - all TN1 var
85 *   19 - all S var
86 *   20 - all TN2 var
87 *   21 - all NLB var
88 *   22 - all TN3 var
89 *   23 - turbo scale height var
90 */
91
92struct ap_array {
93        double a[7];   
94};
95/* Array containing the following magnetic values:
96 *   0 : daily AP
97 *   1 : 3 hr AP index for current time
98 *   2 : 3 hr AP index for 3 hrs before current time
99 *   3 : 3 hr AP index for 6 hrs before current time
100 *   4 : 3 hr AP index for 9 hrs before current time
101 *   5 : Average of eight 3 hr AP indicies from 12 to 33 hrs
102 *           prior to current time
103 *   6 : Average of eight 3 hr AP indicies from 36 to 57 hrs
104 *           prior to current time
105 */
106
107
108struct nrlmsise_input {
109        int year;      /* year, currently ignored */
110        int doy;       /* day of year */
111        double sec;    /* seconds in day (UT) */
112        double alt;    /* altitude in kilometes */
113        double g_lat;  /* geodetic latitude */
114        double g_long; /* geodetic longitude */
115        double lst;    /* local apparent solar time (hours), see note below */
116        double f107A;  /* 81 day average of F10.7 flux (centered on doy) */
117        double f107;   /* daily F10.7 flux for previous day */
118        double ap;     /* magnetic index(daily) */
119        struct ap_array *ap_a; /* see above */
120};
121/*
122 *   NOTES ON INPUT VARIABLES:
123 *      UT, Local Time, and Longitude are used independently in the
124 *      model and are not of equal importance for every situation. 
125 *      For the most physically realistic calculation these three
126 *      variables should be consistent (lst=sec/3600 + g_long/15).
127 *      The Equation of Time departures from the above formula
128 *      for apparent local time can be included if available but
129 *      are of minor importance.
130 *
131 *      f107 and f107A values used to generate the model correspond
132 *      to the 10.7 cm radio flux at the actual distance of the Earth
133 *      from the Sun rather than the radio flux at 1 AU. The following
134 *      site provides both classes of values:
135 *      ftp://ftp.ngdc.noaa.gov/STP/SOLAR_DATA/SOLAR_RADIO/FLUX/
136 *
137 *      f107, f107A, and ap effects are neither large nor well
138 *      established below 80 km and these parameters should be set to
139 *      150., 150., and 4. respectively.
140 */
141
142
143
144/* ------------------------------------------------------------------- */
145/* ------------------------------ OUTPUT ----------------------------- */
146/* ------------------------------------------------------------------- */
147
148struct nrlmsise_output {
149        double d[9];   /* densities */
150        double t[2];   /* temperatures */
151};
152/*
153 *   OUTPUT VARIABLES:
154 *      d[0] - HE NUMBER DENSITY(CM-3)
155 *      d[1] - O NUMBER DENSITY(CM-3)
156 *      d[2] - N2 NUMBER DENSITY(CM-3)
157 *      d[3] - O2 NUMBER DENSITY(CM-3)
158 *      d[4] - AR NUMBER DENSITY(CM-3)                       
159 *      d[5] - TOTAL MASS DENSITY(GM/CM3) [includes d[8] in td7d]
160 *      d[6] - H NUMBER DENSITY(CM-3)
161 *      d[7] - N NUMBER DENSITY(CM-3)
162 *      d[8] - Anomalous oxygen NUMBER DENSITY(CM-3)
163 *      t[0] - EXOSPHERIC TEMPERATURE
164 *      t[1] - TEMPERATURE AT ALT
165 *
166 *
167 *      O, H, and N are set to zero below 72.5 km
168 *
169 *      t[0], Exospheric temperature, is set to global average for
170 *      altitudes below 120 km. The 120 km gradient is left at global
171 *      average value for altitudes below 72 km.
172 *
173 *      d[5], TOTAL MASS DENSITY, is NOT the same for subroutines GTD7
174 *      and GTD7D
175 *
176 *        SUBROUTINE GTD7 -- d[5] is the sum of the mass densities of the
177 *        species labeled by indices 0-4 and 6-7 in output variable d.
178 *        This includes He, O, N2, O2, Ar, H, and N but does NOT include
179 *        anomalous oxygen (species index 8).
180 *
181 *        SUBROUTINE GTD7D -- d[5] is the "effective total mass density
182 *        for drag" and is the sum of the mass densities of all species
183 *        in this model, INCLUDING anomalous oxygen.
184 */
185
186/**************************************************************************/
187/**************************************************************************/
188/**************************************************************************/
189/**************************************************************************/
190
191
192class MSISEtool {
193
194public :
195
196    MSISEtool();
197    virtual ~MSISEtool() {}
198   
199      // Neutral Atmosphere Empircial Model from the surface to lower
200      // exosphere.
201    void gtd7(struct nrlmsise_input *input, 
202           struct nrlmsise_flags *flags, 
203           struct nrlmsise_output *output);
204
205      // This subroutine provides Effective Total Mass Density for output
206      // d[5] which includes contributions from "anomalous oxygen" which can
207      // affect satellite drag above 500 km. See the section "output" for
208      // additional details.
209    void gtd7d(struct nrlmsise_input *input, 
210           struct nrlmsise_flags *flags, 
211           struct nrlmsise_output *output);
212
213      // Thermospheric portion of NRLMSISE_00
214    void gts7(struct nrlmsise_input *input, 
215           struct nrlmsise_flags *flags, 
216           struct nrlmsise_output *output);
217
218      // To specify outputs at a pressure level (press) rather than at
219      // an altitude.
220    void ghp7(struct nrlmsise_input *input, 
221           struct nrlmsise_flags *flags, 
222           struct nrlmsise_output *output, 
223           double press);
224
225    void test_gtd7();
226
227private :
228   
229    // Initiate tables of msise data
230    void InitData();
231   
232    // Tables of msise data
233    /* POWER7 */
234    double pt[150];
235    double pd[9][150];
236    double ps[150];
237    double pdl[2][25];
238    double ptl[4][100];
239    double pma[10][100];
240    double sam[100];
241    /* LOWER7 */
242    double ptm[10];
243    double pdm[8][10];
244    double pavgm[10];
245
246    // Internal methods used by msise
247    void tselec(struct nrlmsise_flags *flags);
248    void glatf(double lat, double *gv, double *reff);
249    double ccor(double alt, double r, double h1, double zh);
250    double ccor2(double alt, double r, double h1, double zh, double h2);
251    double scalh(double alt, double xm, double temp);
252    double dnet(double dd, double dm, double zhm, double xmm, double xm);
253    void splini(double *xa, double *ya, double *y2a, int n, double x, double *y);
254    void splint(double *xa, double *ya, double *y2a, int n, double x, double *y);
255    void spline(double *x, double *y, int n, double yp1, double ypn, double *y2);
256    double zeta(double zz, double zl);
257    double densm(double alt, double d0, double xm, double *tz, int mn3,
258                  double *zn3, double *tn3, double *tgn3, int mn2, double *zn2,
259                  double *tn2, double *tgn2);
260    double densu (double alt, double dlb, double tinf, double tlb, double xm,
261                  double alpha, double *tz, double zlb, double s2, int mn1,
262                  double *zn1, double *tn1, double *tgn1);
263    double g0(double a, double *p);
264    double sumex(double ex);
265    double sg0(double ex, double *p, double *ap);
266    double globe7(double *p, struct nrlmsise_input *input,
267                  struct nrlmsise_flags *flags);
268    double glob7s(double *p, struct nrlmsise_input *input,
269                  struct nrlmsise_flags *flags);
270
271    ClassDef(MSISEtool,0)
272};
273#endif /*__MSISETOOL_HH__*/
Note: See TracBrowser for help on using the repository browser.