Everglades Landscape Model (ELM) Home Page
Main Page | Data Structures | Directories | File List | Data Fields | Globals

watmgmt.h

Go to the documentation of this file.
00001 
00012 /* General notes on revisions to this source file. 
00013        Jan 2005 v2.3.3: documentation upgrade 
00014                 - Re-organized, clarified scopes, Doxygen tags added 
00015        May 2006 v2.5.1: added edgeMann parameter to struct Chan
00016         
00017 */
00018 #ifndef WATMGM_H
00019 #define WATMGM_H
00020 
00021 #include "globals.h"
00022 
00023 #define STEP(x) ( ((x)>=0) ? 1.0 : 0.0 )
00024 #define MAX_H_STRUCT 180        
00026 #define LEFT 1
00027 #define RIGHT -1
00028 
00029 #define NONE 0
00030 #define EAST 1
00031 #define SOUTH 2
00032 #define ALL 3
00033 
00034 FILE *schedFile;                        
00035 FILE *ChanInFile;                       
00036 FILE *CanalOutFile;             
00037 FILE *CanalOutFile_P;           
00038 FILE *CanalOutFile_S;           
00039 FILE *WstructOutFile;           
00040 FILE *WstructOutFile_P;         
00041 FILE *WstructOutFile_S;         
00042 FILE *canDebugFile;             
00043 FILE *CanalCellInteractDebug; 
00044 FILE *F_struct_wat;                     
00045 FILE *F_struct_TP;                      
00046 FILE *F_struct_TS;                      
00048 int CHo;                                                
00049 int CHANNEL_MAX_ITER;           
00050 int UTM_EOrigin, UTM_NOrigin;   
00051 int printchan = 0;                              
00052 int N_c_iter = 0;               
00053 int num_cell = 0;               
00054 int C_Mark = 0;                 
00056 float C_F;                              
00057 float F_ERROR;                  
00058 float MINDEPTH;                 
00060 int num_chan;                   
00061 int num_struct_hist;    
00062 int numTPser;                   
00063 int numTSser;                   
00065 float *MCopen;           
00066 char modelFileName[300]; 
00069 struct Chan_reach
00070 {
00071  float x0,y0,x1,y1;                  
00072  struct Chan_reach *next_reach;      
00073 };  
00074 
00076 struct Chan                 
00077 {
00078   int number;           
00079   int levee;            
00080   int roil;                     
00081   int roir;                 
00082   float depth;              
00083   float width;              
00084   float cond;               
00085   double N;                     
00086   double P;                     
00087   double S;                     
00088   double N_con;             
00089   double P_con;             
00090   double S_con;             
00091   float wat_depth;          
00093   float ic_N_con;           
00094   float ic_P_con;           
00095   float ic_S_con;           
00096   float ic_depth;           
00097   float edgeMann;           
00099   float length;             
00100   float area;               
00101   float elev_start;         
00102   float elev_end;           
00103   float elev_drop;          
00104   float elev_slope;         
00105   float minVol;             
00106   float seg_len;            
00107   float SW_flow_coef;       
00108   float SPG_flow_coef;      
00109   int   num_of_cells;       
00110   int   basin;              
00111   int parent;               
00112   int family;               
00113   double sumHistOut;        
00114   double sumHistIn;         
00115   double sumRuleOut;        
00116   double sumRuleIn;         
00117   struct Chan_reach *reaches;    
00118   struct Cells *cells;           
00119   struct Chan *next_in_list;     
00120 };
00121 struct Chan **Chan_list;
00122   
00123 
00125 struct Cells                     
00126 {
00127  int x;                          
00128  int y;                          
00129  int ind;                        
00130  float length;                   
00131  float reachElev;                        
00132  float reachDistDown;                    
00133  struct Cells *next_cell;        
00134 };
00135 struct Cells *cell_last;
00136 struct Cells *cell;
00137  
00138 
00140 struct Structure                
00141 { 
00142  int flag;                      
00143  int histID;                    
00144  int aggID;                     
00145  char S_nam[20];                
00146  int str_cell_i;                        
00147  int str_cell_j;                        
00148  int canal_fr;                  
00149  int canal_to;                  
00150  int cell_i_fr;                 
00151  int cell_j_fr;                 
00152  int cell_i_to;                 
00153  int cell_j_to;                 
00154  float HW_stage;                
00155  float TW_stage;                
00156  struct Schedule *HW_graph;     
00157  struct Schedule *TW_graph;     
00158  int cell_i_HW;                 
00159  int cell_j_HW;                 
00160  int cell_i_TW;                 
00161  int cell_j_TW;                 
00162  float w_coef;                  
00163  double flow;                   
00164  int TPser;                     
00165  int TNser;                     
00166  int TSser;                     
00167  float TP;                      
00168  float TN;                      
00169  float TS;                      
00170  double conc_P;                 
00171  double conc_N;                 
00172  double conc_S;                 
00173  double SumFlow;                
00174  double Sum_P;                  
00175  double Sum_N;                  
00176  double Sum_S;                  
00177  int multiOut;                  
00178  struct Structure *next_in_list; 
00179 };
00180 struct Structure *struct_first;
00181 struct Structure *structs;
00182 
00184 struct Schedule
00185 {
00186  int num_point;                  
00187  struct Points *graph_points;
00188 };
00189  
00191 struct Points
00192 {
00193  float time;             
00194  float value;            
00195 }; 
00196 
00198 struct HistData
00199 {
00200      char S_nam[20];       
00201      float *arrayWat;           
00202      float *arrayP;                     
00203      float *arrayN;                     
00204      float *arrayS;                     
00205      int aggID;            
00206      int aggCnt;           
00207      int flag;                          
00208 };
00209 struct HistData Hist_data[MAX_H_STRUCT]; 
00212 void CanalReInit();
00213 void Canal_Network_Init(float baseDatum, float *elev ); 
00214 void Run_Canal_Network(float *SWH, float *ElevMap, float *MC, 
00215                        float *GWV, float *poros, float *GWcond, 
00216                        double *NA, double *PA, double *SA, 
00217                        double *GNA, double *GPA, double *GSA,
00218                        float *Unsat, float *sp_yield);  
00219 void ReadStructures(char* name, float BASE_DATUM );
00220 void Channel_configure(float *ElevMap, struct Chan *channel_first );
00221 void getCanalElev (int chan_n);
00222 void FluxChannel(int chan_n, float *SWH, float *ElevMap, float *MC, 
00223                  float *GWH, float *poros, float *GWcond, double *NA, 
00224                  double *PA, double *SA, double *GNA, double *GPA, 
00225                  double *GSA, float *Unsat, float *sp_yield);      
00226 void Flows_in_Structures(float *SWH, float *Elev, float *MC, 
00227                          double *NA, double *PA, double *SA ); 
00228 
00229 float f_Manning(float delta, float SWater, float SW_coef );
00230 float f_Ground(float dh, float height, float GW_coef, float l_Length );
00231 float GetGraph(struct Schedule *graph, float x );
00232 
00233 struct Chan *ReadChanStruct(char* filename );
00234 struct Cells *MarkCell(int x, int y, int index, float length, 
00235                        struct Cells *cell, int ch_number, int levee, 
00236                        int xm, int ym, int c_num, int *marked, float distTot );
00237 struct Schedule *Read_schedule(char *sched_name, char *filename, float BASE_DATUM );
00238 
00239 int Wrdcmp(char *s, char *t );
00240 float UTM2kmx(double UTM );
00241 float UTM2kmy(double UTM );
00242 
00243 
00244 /* externs */
00245 
00246 /* from driver_utilities.h */
00247 extern char *ModelPath, *OutputPath, *ProjName;
00248 extern char modelName[20], modelVers[10];
00249 
00250 extern double julday(int mon, int day, int year, int h, int mi, double se);
00251 extern void init_pvar(VOIDP Map, UCHAR* mask, unsigned char Mtype,float iv);
00252 extern VOIDP nalloc(unsigned mem_size, const char var_name[]);
00253 extern char *Scip(char *s, char SYM );
00254 extern int isInteger(char *target_str);
00255 extern int isFloat(char *target_str); 
00256 extern float FMOD( float x, float y); 
00257 extern int Round(float x);
00258 
00259 /* from generic_driver.h */
00260 extern char SimAlt[20], SimModif[20];        
00261 extern double Jdate_init, Jdate_end;  
00262 extern int PORnumday;
00263 extern float can_Intvl;
00264 extern int canPrint;
00265 
00266 /* from unitmod.h */
00267 extern unsigned char *HAB;
00268 extern int *basn;
00269 extern float GP_DetentZ, GP_MinCheck, GP_SLRise;
00270 extern float  GP_mannDepthPow, GP_mannHeadPow, GP_calibGWat;
00271 
00272 /* from fluxes.h */
00273 extern float Flux_SWcells(int i0,int i1,int j0,int j1,
00274                           float *SWater,float *Elevation,float *MC);
00275 extern void Flux_SWstuff(int i0,int i1,int j0,int j1, float Flux,
00276                          float *SURFACE_WAT, double *STUF1, double *STUF2, double *STUF3);
00277 
00278 /* from budgstats.h */
00279 extern int numBasn;
00280 extern basnDef **basn_list;
00281 extern basnDef *basins;
00282 
00283 /* from budgstats_birvars.h */
00284 extern double *TOT_VOL_CAN;         /* total canal volume, units = m^3 */
00285 
00286 /* basin-based, horiz inputs to canal and cells, units = m^3 */
00287 extern double *VOL_IN_STR, *VOL_IN_OVL, *VOL_IN_SPG, *VOL_IN_GW;
00288 extern double *VOL_OUT_STR, *VOL_OUT_OVL, *VOL_OUT_SPG, *VOL_OUT_GW;
00289 
00290 extern double *TOT_P_CAN;          /* total canal P, units = kg */
00291 
00292 /* basin-based, horiz inputs to canal and cells, units = kg */
00293 extern double *P_IN_STR, *P_IN_OVL, *P_IN_SPG, *P_IN_GW;
00294 extern double *P_OUT_STR, *P_OUT_OVL, *P_OUT_SPG, *P_OUT_GW;
00295 
00296 extern double *TOT_S_CAN;          /* total canal S, units = kg */
00297 
00298 /* basin-based, horiz inputs to canal and cells, units = kg */
00299 extern double *S_IN_STR, *S_IN_OVL, *S_IN_SPG, *S_IN_GW;
00300 extern double *S_OUT_STR, *S_OUT_OVL, *S_OUT_SPG, *S_OUT_GW;
00301 
00302 #endif /* WATMGM_H */

Generated on Thu Jul 6 11:17:58 2006 for ELM source code by  doxygen 1.3.9.1