00001 00027 #ifndef WindSpd_H 00028 #define WindSpd_H 00029 00030 #include <stdlib.h> 00031 #include <math.h> 00032 00033 #include "Units.h" 00034 #include "NLIBRand.h" 00035 #include "FireProp.h" 00036 #include "ChHashTable.h" 00037 #include "KeyVal.h" 00038 #include "DblTwoDArray.h" 00039 #include "FStreamIO.h" 00040 #include "Err.h" 00041 00042 /* 00043 ********************************************************* 00044 * DEFINES, ENUMS 00045 ********************************************************* 00046 */ 00047 00048 #ifndef DOXYGEN_SHOULD_SKIP_THIS 00049 00050 /* used in tokenizing wind azimuth files */ 00051 #define WIND_SPD_WSP_COMMENT_CHAR ("#") 00052 #define WIND_SPD_SEP_CHARS (" =,;\t") 00053 00054 /* returns corresponding field index in WSP file */ 00055 #define WIND_SPD_YR_WSP_TBL_INDEX (0) 00056 #define WIND_SPD_MO_WSP_TBL_INDEX (1) 00057 #define WIND_SPD_DY_WSP_TBL_INDEX (2) 00058 00059 /* value of NO DATA used in WSP files */ 00060 #define WIND_SPD_WSP_NO_DATA_VALUE (-1) 00061 00062 /* keyword indicating units of windspeed stored in .swp */ 00063 #define WIND_SPD_WSP_KEYWORD_UNITS ("UNITS") 00064 #define WIND_SPD_WSP_KEYWORD_MILEPHR ("MILEPHR") 00065 #define WIND_SPD_WSP_KEYWORD_KMPHR ("KMPHR") 00066 00067 /* min and max values used to retrieve uniform random number */ 00068 #define WIND_SPD_RANDU_MIN_MPS (0.0) 00069 #define WIND_SPD_RANDU_MAX_MPS (10.0) 00070 00071 #endif /* DOXYGEN_SHOULD_SKIP_THIS */ 00072 00076 #define WIND_SPD_RAWS_REF_HGT_METERS (UNITS_FT_TO_M(20.0)) 00077 00078 /* 00079 ********************************************************* 00080 * STRUCTS, TYPEDEFS 00081 ********************************************************* 00082 */ 00083 00084 /* 00085 ********************************************************* 00086 * MACROS 00087 ********************************************************* 00088 */ 00089 00090 #ifndef DOXYGEN_SHOULD_SKIP_THIS 00091 00092 /* takes an hour 0-23 and returns corresponding field index in WSP file */ 00093 #define WIND_SPD_HR_TO_WSP_TBL_INDEX(hour) ((hour) + 3) 00094 00095 /* 00096 * Given a windspeed at reference height, returns windspeed at midflame. 00097 * 00098 * Given a windspeed argument assumed to be taken at a reference height (usu. 20 feet, height of RAWS- 00099 * Remote Automated Weather Station) above the fuel bed, reduces the windspeed using a logarithmic 00100 * profile according to a value typical of what is experienced halfway between the top of the fuel bed 00101 * and the top of the flame above the fuel bed. The formula used approximates a log profile and is 00102 * described in (Albini and Baughman, 1979). Rather than explicitly specify a value for flame height 00103 * and fuel bed height (the former is usually unavailable until after a prediction for the rate of spread 00104 * has been made), windspeed in nonforested areas (chaparral and grass fuels) is reduced from 20 ft 00105 * to a height of 2 * the fuel bed height. This procedure is described and used in 00106 * (Finney, 1998). An alternative approach to explicitly calculating the midflame windspeed is to 00107 * apply a windspeed adjustment factor (WAF) which corrects the windspeed observed at a height of 20 ft. 00108 * above the vegetation to that experienced at midflame. A table of suggested WAF factors for each NFFL 00109 * fuel model appears in Rothermel (1983). 00110 * 00111 * An example: a windspeed of 10 m/s taken at 6.09 m above the fuel bed of height 1.8288 m is reduced 00112 * to 3.6 m/s at midflame height using the macro below. For comparison, Rothermel's (1986) suggested 00113 * WAF for NFFL 4 (same height as our example) is 0.6 (current standard practice in the field is to use 0.5). 00114 * 00115 * WindSpeed At 6.09m (m/s) Fuel Bed Height (m) Midflame Windspeed (m/s) 00116 * 10.0 1.8288 3.6408 00117 * 10.0 0.9144 2.9879 00118 * 10.0 0.3048 2.2840 00119 * 10.0 0.1524 1.9787 00120 * 00121 * Finney, 1998 has superficially different equation <below> 00122 * wsmps / log(((20 + (1.18*(2*fbedhgtm))) / (0.43*(2*fbedhgtm)))) 00123 * Produced identical values as implementation used here. The log function as referenced here is the 00124 * the natural logarithm (ln) because in the ANSI C library the natural log function is named log. 00125 * 00126 * Arguments: 00127 * wsmps- value of windspeed in meters/sec at reference height above fuel bed 00128 * refhgtm- reference height above fuel bed windspeed has been measured at, in meters 00129 * fbedhgt- height of the fuel bed, in meters 00130 * 00131 * Returns: 00132 * Windspeed corrected to midflame height, in meters/sec 00133 */ 00134 #define WIND_SPD_REF_HGT_TO_MIDFLAME(wsmps, refhgtm, fbedhgtm) (ConvertWindSpeedAtRefHgtToArbitraryHgt(wsmps, refhgtm, (2 *(fbedhgtm)))) 00135 00136 #endif /* DOXYGEN_SHOULD_SKIP_THIS */ 00137 00138 /* 00139 ********************************************************* 00140 * PUBLIC FUNCTIONS 00141 ********************************************************* 00142 */ 00143 00168 int GetWindSpeedMpsFIXEDFromProps(ChHashTable * proptbl, double fbedhgtm, int month, int day, int hour, 00169 unsigned int row, unsigned int col, double * wspmps); 00170 00195 int GetWindSpeedMpsRANDUFromProps(ChHashTable * proptbl, double fbedhgtm, int month, int day, int hour, 00196 unsigned int row, unsigned int col, double * wspmps); 00197 00222 int GetWindSpeedMpsRANDHFromProps(ChHashTable * proptbl, double fbedhgtm, int month, int day, int hour, 00223 unsigned int row, unsigned int col, double * wspmps); 00224 00249 int GetWindSpeedMpsSPATIALFromProps(ChHashTable * proptbl, double fbedhgtm, int month, int day, int hour, 00250 unsigned int row, unsigned int col, double * wspmps); 00269 double ConvertWindSpeedAtRefHgtToArbitraryHgt(double wsmps, double refhgtm, double hgtm); 00270 00271 int ConvertWindSpeedUnitsToMps(DblTwoDArray * wsp_tbl, const char * units); 00272 00273 #endif WindSpd_H /* end of WindSpd.h */