1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4 Description: MSIS-00 Atmosphere
8 ------------- Copyright (C) 2003 David P. Culp (davidculp2@comcast.net) ------
10 This program is free software; you can redistribute it and/or modify it under
11 the terms of the GNU Lesser General Public License as published by the Free Software
12 Foundation; either version 2 of the License, or (at your option) any later
15 This program is distributed in the hope that it will be useful, but WITHOUT
16 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
20 You should have received a copy of the GNU Lesser General Public License along with
21 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
22 Place - Suite 330, Boston, MA 02111-1307, USA.
24 Further information about the GNU Lesser General Public License can also be found on
25 the world wide web at http://www.gnu.org.
28 --------------------------------------------------------------------------------
30 01/11/04 DPC Derive from FGAtmosphere
32 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
34 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
39 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
41 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
43 #include "models/FGAtmosphere.h"
44 #include "FGFDMExec.h"
46 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
48 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
50 #define ID_MSIS "$Id: FGMSIS.h,v 1.7 2010/02/25 05:21:36 jberndt Exp $"
52 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
54 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
58 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
60 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
62 /** Models the MSIS-00 atmosphere.
63 This is a wrapper for the NRL-MSIS-00 model 2001:
65 This C++ format model wraps the NRLMSISE-00 C source code package - release
68 The NRLMSISE-00 model was developed by Mike Picone, Alan Hedin, and
69 Doug Drob. They also wrote a NRLMSISE-00 distribution package in
70 FORTRAN which is available at
71 http://uap-www.nrl.navy.mil/models_web/msis/msis_home.htm
73 Dominik Brodowski implemented and maintains this C version. You can
74 reach him at devel@brodo.de. See the file "DOCUMENTATION" for details,
75 and check http://www.brodo.de/english/pub/nrlmsise/index.html for
76 updated releases of this package.
78 @version $Id: FGMSIS.h,v 1.7 2010/02/25 05:21:36 jberndt Exp $
81 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
83 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
85 struct nrlmsise_flags {
95 struct nrlmsise_input {
96 int year; /* year, currently ignored */
97 int doy; /* day of year */
98 double sec; /* seconds in day (UT) */
99 double alt; /* altitude in kilometers */
100 double g_lat; /* geodetic latitude */
101 double g_long; /* geodetic longitude */
102 double lst; /* local apparent solar time (hours), see note below */
103 double f107A; /* 81 day average of F10.7 flux (centered on DOY) */
104 double f107; /* daily F10.7 flux for previous day */
105 double ap; /* magnetic index(daily) */
106 struct ap_array *ap_a; /* see above */
109 struct nrlmsise_output {
110 double d[9]; /* densities */
111 double t[2]; /* temperatures */
115 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
117 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
119 class MSIS : public FGAtmosphere
127 /** Runs the MSIS-00 atmosphere model; called by the Executive
128 @return false if no error */
131 bool InitModel(void);
133 /// Does nothing. External control is not allowed.
134 void UseExternal(void);
138 void Calculate(int day, // day of year (1 to 366)
139 double sec, // seconds in day (0.0 to 86400.0)
140 double alt, // altitude, feet
141 double lat, // geodetic latitude, degrees
142 double lon // geodetic longitude, degrees
145 void Debug(int from);
147 nrlmsise_flags flags;
148 nrlmsise_input input;
149 nrlmsise_output output;
160 double dm04, dm16, dm28, dm32, dm40, dm01, dm14;
174 double c2tloc, s2tloc;
175 double s3tloc, c3tloc;
178 void tselec(struct nrlmsise_flags *flags);
179 void glatf(double lat, double *gv, double *reff);
180 double ccor(double alt, double r, double h1, double zh);
181 double ccor2(double alt, double r, double h1, double zh, double h2);
182 double scalh(double alt, double xm, double temp);
183 double dnet(double dd, double dm, double zhm, double xmm, double xm);
184 void splini(double *xa, double *ya, double *y2a, int n, double x, double *y);
185 void splint(double *xa, double *ya, double *y2a, int n, double x, double *y);
186 void spline(double *x, double *y, int n, double yp1, double ypn, double *y2);
187 double zeta(double zz, double zl);
188 double densm(double alt, double d0, double xm, double *tz, int mn3, double *zn3,
189 double *tn3, double *tgn3, int mn2, double *zn2, double *tn2,
191 double densu(double alt, double dlb, double tinf, double tlb, double xm,
192 double alpha, double *tz, double zlb, double s2, int mn1,
193 double *zn1, double *tn1, double *tgn1);
194 double g0(double a, double *p);
195 double sumex(double ex);
196 double sg0(double ex, double *p, double *ap);
197 double globe7(double *p, nrlmsise_input *input, nrlmsise_flags *flags);
198 double glob7s(double *p, nrlmsise_input *input, nrlmsise_flags *flags);
199 void gtd7(nrlmsise_input *input, nrlmsise_flags *flags, nrlmsise_output *output);
200 void gtd7d(nrlmsise_input *input, nrlmsise_flags *flags, nrlmsise_output *output);
201 void ghp7(nrlmsise_input *input, nrlmsise_flags *flags, nrlmsise_output *output, double press);
202 void gts7(nrlmsise_input *input, nrlmsise_flags *flags, nrlmsise_output *output);
206 } // namespace JSBSim
208 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%