VR-Vantage 3.0 API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
atm_common.h
Go to the documentation of this file.
1 /* © 1998 JRM Technologies, Inc.*/
2 
3 #ifndef _JRMLIBRARY_ATM_COMMON_H
4 #define _JRMLIBRARY_ATM_COMMON_H
5 
6 #include "JRMlibraryDLLstub.h"
7 #include "JRMDefines.h"
8 #include "JRMlibrary.h"
9 
10 #ifdef __cplusplus
11 extern "C"
12 {
13 #endif
14 
15 
16 
17  //--------------Grabbed #defines and put them in JRMDefines.h-------------//
18 
19 
20  /* -------------------- BASIC ATMOSPHERICS ------------------------------ */
21 
22  typedef struct
23  {
24  int Model; // [int enum] Model atmosphere : TROPICAL_ATMOSPHERE = 1, MIDLAT_SUMMER, MIDLAT_WINTER, SUBARC_SUMMER, SUBARC_WINTER,US_STANDARD_1976,USER_SPEC
25  int Haze; // [int enum] Haze : -1=no aerosol attenuation, but possibly cloud (if ICLD>0). 0=no cloud or aerosol atten,1=rural vis=23km,2=rural vis=5km,3=navy maritime,4=maritime,5=urban,6=tropospheric,7=user-def(cards2Dx),8=fog1(0.2km),9=fog2(0.5km),10=desert
26  int Season; // [int enum] Season : 0=use summer for models 0,1,2,4,6,7. 1=use summer, 2=use winter
27  int Clouds; // [int enum] Cloud Model : 0=none,1=cumulus,2=altostratus,3=stratus,4=stratocumulus,5=nimbostratus,6=stratus_drizzle,7=nimbostratus_light,8=nimbostratus_moderate,9=cumulus_heavy,10=cumulus_extreme,18=standard_cirrus,19=subvisual_cirrus
28  double Vis; // Visibility [km]. (If met_proc_mode>=1, Vis=0 uses default set by Haze)
29  double Va; // Current wind speed [m/s] (Navy Maritime or desert models only -- Haze=3 or 10)
30  double Ave_Va; // 24hr ave wind speed [m/s] (Navy Maritime or desert models only -- Haze=3 or 10)
31  double WindDir; // [deg] Direction from which wind is blowing (East of North).
32  double RainRate; // [mm/hr] Rain rate at surface. If <1mm/hr and Clouds=6->10, it is overridden by value associated with these clouds. When no clouds, rain rate used to 6km. See MODCARD.ICLD in SSModRadStruct.h for default rain rates associated with different cloud values.
33  double Train; // [degC] rain temperature
34  double relative_humidity; // [ratio 0-1] humidity
35  double Tbackground; // [degK] general ground temperature for background calcs
36  double Tamax, Tamin; // [degC] Max and min diurnal air temperature at terrain surface
37  double Ta; // [degC] Air temperature at ground
38  double Pressure; // [mb] Air pressure at surface. If >0, this overrides 1st-layer pressure given by default model profiles 1-6.
39  double urban_suburban_light_level; // [W] Man-made light flux
40  double urban_suburban_proximity; // [km] Distance from source of above
41  double trans1km; // [unitless 0-1] Ave. transmission over 1km
42  } ATM_DEFAULT;
43 
44 
45  typedef struct
46  {
47  double speed0; // [m/s] average wind speed at ground (usually lower than speed1)
48  double direction_dev0; // [deg] standard deviation of wind direction at ground (usually higher than dev1)
49  double speed1; // [m/s] average wind speed at reference altitude1 (usually higher than speed0)
50  double direction_dev1; // [deg] standard deviation of wind direction at reference altitude1 (usually lower than dev0)
51  double altitude1; // [m] Reference altitude (usually high)
52  double ref_direction1; // [deg] Average direction from which wind is blowing (East of North) at reference altitude1.
53  double speed_dropoff; // [unitless >= 0] Exponent N in formula speed[alt] = speed1 + (speed0-speed1) * exp( - N * alt/altitude1 )
54  double turb_dropoff; // [unitless >= 0] Exponent N in formula dir_dev[alt] = dir_dev1 + (dir_dev0-dir_dev1) * exp( - N * alt/altitude1 )
55  } WIND_VELOCITY_PROFILE; // Wind Velocity Profile
56 
57 
58  typedef enum
60  CLOUD_TYPE;
61 
62 
63  typedef struct
64  {
65  double E_radius; // [km] Model Earth Radius for Atmospherics
67  long nlayers; // [unitless int] Number of wavelengths and atmospheric layers in ATMCOEF array
68  double altlo,althi; // [km] Lower and Upper bounds of modeled atmosphere
69  double *alt; // [km] lower boundary altitude of each layer, assumed >=0 and ordered from lowest to highest.
70  } ATMINFO;
71 
72  typedef struct
73  {
74  double extcoef; // Total (scat+absorb) Extinction coefficient in [m-1]
75  double intense; // Path radiance coefficient in [W/m2/sr/um/m]
76  double scatcoef[NUM_SCAT_COEFS];// Scattering Function Legendre Coefficients [sr-1 m-1] = dsigma/(domega dvol)
77  double realindex; // Real part of Index of Refraction [unitless]
78  } ATMCOEF;
79 
80 
81  typedef struct
82  {
83  double alt; // Geodetic Altitude [m]
84  double airtemp; // Dry-bulb Temp [deg K]
85  double pressure; // Total Atmospheric Pressure [mb]
86  double relhum; // Relative Humidity [%]
87  double windnorth, windeast; // Wind vector velocity North and East components [m/s]
88  double Cloud_Water; // Mixing Ratio [kg/kg]... assumed to be w.r.t. total mass
89  double Ice_Crystal; // Mixing Ratio [kg/kg]... assumed to be w.r.t. total mass
90  double Rain_Drop; // Mixing Ratio [kg/kg]... assumed to be w.r.t. total mass
91  double Snow_Flake; // Mixing Ratio [kg/kg]... assumed to be w.r.t. total mass
92  double Precip_Rate; // Vertical precipitation mass flux [kg/m2/s]
93  double Cloud_Amount; // Percent of cell volume which is cloud [%]
94  CLOUD_TYPE Cloud_Type; // 0=None, 1=Cirrus, 2=Cirrocumulus, 3=Cirrostratus, 4=Altocumulus, 5=Altostratus, 6=Nimbostratus, 7=Stratocumulus, 8=Stratus, 9=Cumulus, 10=Cumulonimbus, 11=Not_Visible
95  ATMCOEF* coef; // Array of extinction & scattering coefficients
96  } ATM_STATE;
97 
98  typedef struct
99  {
100  double startradius; // [m] distance from symmetry axis. Meaningless for attachment to ENVIRONMENTAL_INFLUENCE_MAP structure.
101  double Temperature; // [degK] atmospheric temperature
102  double Total_Pressure; // [mb] Total atmospheric pressure (essentially N2 plus consitituents below)
103  double H2O; // [mb] Partial pressure for this species.
104  double CO2; // [mb] Partial pressure for this species.
105  double O3; // [mb] Partial pressure for this species.
106  double N2O; // [mb] Partial pressure for this species.
107  double CO; // [mb] Partial pressure for this species.
108  double CH4; // [mb] Partial pressure for this species.
109  double O2; // [mb] Partial pressure for this species.
110  double NO; // [mb] Partial pressure for this species.
111  double SO2; // [mb] Partial pressure for this species.
112  double NO2; // [mb] Partial pressure for this species.
113  double NH3; // [mb] Partial pressure for this species.
114  double HNO3; // [mb] Partial pressure for this species.
115  double CCl3F; // [mb] Partial pressure for this species.
116  double CCl2F2; // [mb] Partial pressure for this species.
117  double CClF3; // [mb] Partial pressure for this species.
118  double CF4; // [mb] Partial pressure for this species.
119  double CHClF2; // [mb] Partial pressure for this species.
120  double C2Cl3F3; // [mb] Partial pressure for this species.
121  double C2Cl2F4; // [mb] Partial pressure for this species.
122  double C2ClF5; // [mb] Partial pressure for this species.
123  double ClONO2; // [mb] Partial pressure for this species.
124  double HNO4; // [mb] Partial pressure for this species.
125  double CHCl2F; // [mb] Partial pressure for this species.
126  double CCl; // [mb] Partial pressure for this species.
127  double N2O5; // [mb] Partial pressure for this species.
128  ATMCOEF *atmcoef; // extinction & radiance info for this voxel, per wavelength bin.
129  } ATM_VOL_PROPS; // Physical properties of a given atmospheric volume.
130 
131 
132  typedef struct
133  {
134  double Accumulated_Precipitation; // [kg/m2]
135  double Precipitation_Rate; // [kg/m2/s]
136  double Pressure; // [mb] at zero geodetic altitude, not Model_Terrain_Geodetic_Altitude
137  double Ground_Temperature; // [deg K]
138  double Wind_Gust_Speed; // [m/s]
139  double Visibility; // [m]
141  } SURFACE;
142 
143  typedef struct
144  {
145  double lat1,lon1; // (lat,lon) angles [deg] of column corner #1
146  double lat2,lon2; // (lat,lon) angles [deg] of column corner #2
147  SURFACE srf; // Surface data
148  long nlayers; // Number of layers
149  ATM_STATE* lay; // Array of ATM_STATEs
150  } ATM_COLUMN;
151 
152 
153  // Alayer() Finds layer index corresponding to nearest alt value below h. Assumes alt increases with index.
154  JRMLIBRARY_API long Alayer(double h, long nlayers, double *alt);
155  JRMLIBRARY_API long InfLayer(double h, ATMINFO inf);
156  JRMLIBRARY_API long layer(double h, double altlo, double delta);
157 
158 
159  /* ---------------------- ATM PROPERTY SUBS --------------------------- */
160 
161  JRMLIBRARY_API double WaterVaporSaturationPressure(double Temp);
162  // Temp in [degR], output in [PSIA]
163  // From ASHRAE 1985 Fundamentals Handbook, chapter 6, equations 3-4.
164 
165  JRMLIBRARY_API double real_ref_index(double pdry, double pwet, double T, double k);
166  // Returns Sellmeier Model of real part of index of refraction.
167  // pdry = dry atmospheric pressure in kPa
168  // pwet = H2O atmospheric pressure in kPa
169  // T = Temperature in Kelvin
170  // k is wavenumber in cm-1
171 
172  JRMLIBRARY_API double degK2degR(double degK);
173 
174  JRMLIBRARY_API int DryScatFunc(double alt, double lam, double *scatcoef);
175  // DryScatFunc returns scattering function Legendre coefficients ([sr-1 m-1], but must normalize to data).
176 
177  JRMLIBRARY_API double scatalbedo(double realindex, double lambda, double rainrate, double absorb);
178  // scatalbedo : returns single particle scattering albedo per meter
179  // realindex [unitless] real part of refractive index
180  // lambda [microns] wavelength
181  // rainrate [mm/hr]
182  // absorb [km-1] absorption coefficient
183 
184  JRMLIBRARY_API int HenGreen(double p, double c, double* g);
185  // p = phase function [unitless]
186  // c = cosine of scattering angle
187  // Returns Henyey-Greenstein parameter g.
188 
189  JRMLIBRARY_API double PhaseFunction(double g, double theta); // [sr-1]
190  // returns Henyey-Greenstein Phase function (normalized to 4PI)
191 
192  JRMLIBRARY_API double IntegratedPhaseFunction( double g, double lowerBound, double upperBound );
193 
194  JRMLIBRARY_API double RayleighPhaseFunction(double theta, double depolarization); // [sr-1]
195  // theta [rad]
196 
197  JRMLIBRARY_API double MiePhaseFunction(double g, double theta); // [sr-1]
198  // theta [rad]
199 
200  JRMLIBRARY_API double ModifiedPhaseFunction(double g, double theta, double alpha); // [sr-1]
201 
202  JRMLIBRARY_API double IntegratedModifiedPhaseFunction(double g, double alpha, double lowerBound, double upperBound);
203 
204  JRMLIBRARY_API double DiurnalAirtempFactor(double TairC, double TminC, double TmaxC, double humratio);
205 
206  JRMLIBRARY_API double DewPoint2PartialPressure(double DewPoint_degK);
207  // Dewpoint [degK] to partial pressure [mb]
208 
209  JRMLIBRARY_API double H2OMassDensity2PartialPressure(double MassDensity_gpm3, double Temp_degK);
210  // H2O Mass Density [g/m3] to partial pressure [mb]
211 
212  JRMLIBRARY_API double H2OMassMixingRatio2PartialPressure(double MixingRatio_gpKg, double TotalPres_mb);
213  // H2O Mass Mixing Ratio [g/Kg] to partial pressure [mb]
214 
215  JRMLIBRARY_API double NumberDensity2PartialPressure(double NumberDensity_Npcm3, double Temp_degK);
216  // Molecular Number Density [#/cm3] to partial pressure [mb]
217 
218  JRMLIBRARY_API double VolumeMixingRatio2PartialPressure(double MixingRatio_ppmv, double TotalPres_mb);
219  // Volume Mixing Ratio [ppmv] to partial pressure [mb]
220 
221  JRMLIBRARY_API double H2OPartialPressure2MassDensity(double PartialPressure_mb, double Temp_degK);
222  // H2O partial pressure [mb] to mass density [g/m3]
223 
224  JRMLIBRARY_API double H2OPartialPressure2MassMixingRatio(double PartialPressure_mb, double TotalPres_mb);
225  // H2O partial pressure [mb] to mass mixing ratio [g/Kg]
226 
227  JRMLIBRARY_API double PartialPressure2NumberDensity(double PartialPressure_mb, double Temp_degK);
228  // Partial pressure [mb] to Molecular Number Density [#/cm3]
229 
230  JRMLIBRARY_API double PartialPressure2VolumeMixingRatio(double PartialPressure_mb, double TotalPres_mb);
231  // Partial pressure [mb] to Volume Mixing Ratio [ppmv]
232 
233  JRMLIBRARY_API double AirMassDensity(double AirPressure_mb, double AirTemperature_degK);
234  // Uses ideal gas law to give air density [kg/m3] as function of air pressure [mb] and temperature [degK].
235 
236  JRMLIBRARY_API double ConvertToTotalPressure(double value, char code);
237  // Converts input value to total pressure [mb], given MODCARD code for value input units type.
238 
239  JRMLIBRARY_API double ConvertToDegreesKelvin(double value, char code);
240  // Converts input value to degK given MODCARD code for input units type.
241 
242  JRMLIBRARY_API double ConvertToPartialPressure(double value, double TotalPres_mb, double degK, char code);
243  // Wrapper routine around conversions to partial pressure [mb], given MODCARD code for value input units type.
244 
245 
246 
247 #ifdef __cplusplus
248 }
249 #endif
250 
251 #endif // _JRMLIBRARY_ATM_COMMON_H


Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)