00001 #ifndef IHM_H
00002 #define IHM_H
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 #include "sundials_types.h"
00024 #include "nvector_serial.h"
00025 #include <stdio.h>
00026 
00027 
00028 
00029 
00030 
00031 typedef struct element_type 
00032 {
00033   int index;  
00034   int node[3];        
00035   int nabr[3];        
00036     
00037   realtype edge[3];   
00038   realtype area;      
00039   
00040   realtype x;         
00041   realtype y;         
00042   realtype zmin;      
00043   realtype zmax;      
00044   realtype NodeZmin;   
00045   realtype NodeZmax;   
00046   realtype NodeDist;   
00047   
00048   realtype Ksat;
00049   realtype Porosity;
00050   realtype Alpha;
00051   realtype Beta;
00052   realtype Sf;
00053   realtype RzD;
00054 
00055 
00056   realtype LAImax;     
00057   realtype VegFrac;    
00058   realtype Albedo;     
00059   realtype Rs_ref;     
00060   realtype Rmin;       
00061   realtype Rough;      
00062   
00063   realtype windH;
00064   
00065     
00066   int soil;           
00067   int LC;             
00068   int IC;             
00069   int BC;             
00070   int prep;           
00071   int temp;           
00072   int humidity;       
00073   int WindVel;        
00074   int Rn;             
00075   int G;              
00076   int pressure;       
00077   int source;         
00078   
00079 } element;
00080 
00081 typedef struct nodes_type
00082 {
00083   int index; 
00084      
00085   realtype x;          
00086   realtype y;          
00087   realtype zmin;       
00088   realtype zmax;       
00089   
00090 } nodes;
00091 
00092 typedef struct element_IC_type
00093 {
00094   int index;
00095   
00096   realtype interception;
00097   realtype snow;
00098   realtype surf;
00099   realtype unsat;
00100   realtype sat;
00101   
00102 } element_IC;
00103 
00104 typedef struct soils_type
00105 {
00106   int index;           
00107   
00108   realtype Ksat;       
00109   realtype SitaS;      
00110   realtype SitaR;      
00111   realtype Alpha;      
00112   realtype Beta;       
00113   realtype Sf;         
00114   realtype RzD;        
00115   
00116   int Macropore;       
00117   realtype base;       
00118   realtype gama;       
00119   
00120   int Inf;             
00121   
00122 } soils;
00123 
00124 typedef struct lc_type
00125 {
00126   int index;           
00127 
00128   realtype LAImax;     
00129   realtype VegFrac;    
00130   realtype Albedo;     
00131   realtype Rs_ref;     
00132   realtype Rmin;       
00133   realtype Rough;      
00134 } LC;
00135 
00136 typedef struct river_segment_type
00137 {
00138   int index;
00139   
00140   realtype x;          
00141   realtype y;  
00142   realtype zmin;       
00143   realtype zmax;       
00144   realtype depth;      
00145   realtype Length;
00146   realtype Rough;
00147   
00148   int FromNode;
00149   int ToNode;
00150   int down;            
00151   int LeftEle;
00152   int RightEle;
00153   int shape;           
00154   int material;        
00155   int IC;              
00156   int BC;              
00157   int reservoir;
00158   
00159 } river_segment;
00160 
00161 typedef struct river_shape_type
00162 {
00163   int index;           
00164   realtype width;      
00165   realtype depth;      
00166   realtype bed;        
00167   int interpOrd;       
00168   realtype coeff;              
00169   
00170 } river_shape;
00171 
00172 typedef struct river_material_type
00173 {
00174   int index;
00175   realtype Rough;
00176   realtype Sf;
00177   realtype Cwr;
00178   
00179 } river_material;
00180 
00181 typedef struct river_IC_type
00182 {
00183   int index;
00184   realtype value;
00185   
00186 } river_IC;
00187 
00188 typedef struct TSD_type
00189 {
00190   char name[5];
00191   int index;
00192   int length;
00193   int iCounter; 
00194   realtype **TS;     
00195   
00196 } TSD;
00197 
00198 typedef struct model_data_structure          
00199 {
00200   int UnsatMode;               
00201   int SurfMode;                
00202   int RivMode;                 
00203     
00204   int NumEle;                  
00205   int NumNode;                 
00206   int NumRiv;                  
00207   
00208   int NumPrep;                 
00209   int NumTemp;                 
00210   int NumHumidity;             
00211   int NumWindVel;              
00212   int NumRn;                   
00213   int NumG;                    
00214   int NumP;                    
00215   int NumSource;               
00216   
00217   int NumSoil;                 
00218   int NumRes;                  
00219   int NumInc;                  
00220   int NumLC;                   
00221   
00222   int NumMeltF;                
00223   
00224   int Num1BC;                  
00225   int Num2BC;                  
00226   int NumEleIC;                
00227   
00228   int NumRivShape;             
00229   int NumRivMaterial;          
00230   int NumRivIC;                
00231   int NumRivBC;                
00232   
00233   element *Ele;                
00234   nodes *Node;                 
00235   element_IC *Ele_IC;          
00236   soils *Soil;                 
00237   LC *LandC;                   
00238   
00239   river_segment *Riv;          
00240   river_shape *Riv_Shape;      
00241   river_material *Riv_Mat;     
00242   river_IC *Riv_IC;            
00243 
00244   TSD *TSD_Inc;                
00245   TSD *TSD_LAI;                
00246   TSD *TSD_DH;                   
00247   realtype *SIFactor;          
00248 
00249   TSD  *TSD_MeltF;               
00250 
00251   TSD *TSD_EleBC;              
00252   TSD *TSD_Riv;                
00253   TSD *TSD_Prep;               
00254   TSD *TSD_Temp;               
00255   TSD *TSD_Humidity;           
00256   TSD *TSD_WindVel;            
00257   TSD *TSD_Rn;                 
00258   TSD *TSD_G;                  
00259   TSD *TSD_Pressure;           
00260   TSD *TSD_Source;             
00261 
00262   realtype **FluxSurf;     
00263   realtype **FluxSub;      
00264   realtype **FluxRiv;      
00265 
00266   realtype *ElePrep;
00267   realtype *Ele2IS;
00268   realtype *EleNetPrep;
00269   realtype *EleVic;
00270   realtype *Recharge;
00271   realtype *EleSnow;
00272   realtype *EleIS;
00273   realtype *EleISmax;
00274   realtype *EleTF;
00275   realtype **EleET;
00276   realtype Q; 
00277   
00278 } *Model_Data;
00279 
00280 typedef struct control_data_structure
00281 {
00282   int Verbose;
00283   int Debug;
00284   
00285   int Solver;
00286   int NumSteps;
00287   
00288   int res_out;
00289   int flux_out;
00290   int q_out;
00291   int etis_out;
00292   
00293   int int_type;
00294   
00295   realtype abstol;
00296   realtype reltol;
00297   realtype InitStep;
00298   realtype MaxStep;
00299   realtype ETStep;
00300   
00301   int GSType, MaxK;
00302   realtype delt;
00303   
00304   realtype StartTime;
00305   realtype EndTime;
00306   
00307   
00308   int outtype;
00309   realtype a;
00310   realtype b;
00311   
00312   realtype *Tout;  
00313   
00314 } Control_Data;
00315 
00316 
00317 void PrintModelData(Model_Data);
00318 void PrintEle(Model_Data);
00319 void PrintEleAtt(Model_Data);
00320 void PrintNode(Model_Data);
00321 void PrintSoil(Model_Data);
00322 void PrintLC(Model_Data);
00323 void PrintTS(TSD *, int);
00324 void PrintRiv(Model_Data);
00325 void PrintForcing(Model_Data);
00326 void PrintDY(Model_Data, N_Vector, N_Vector);
00327 void PrintY(Model_Data, N_Vector, realtype);
00328 void FPrintYheader(FILE *, Model_Data);
00329 void FPrintY(Model_Data, N_Vector, realtype, FILE *);
00330 void FPrintFlux(Model_Data, realtype, FILE *);
00331 void FPrintETISheader(FILE *, Model_Data);
00332 void FPrintETIS(Model_Data, realtype, FILE *);
00333 void FPrintQ(Model_Data, realtype, FILE *);
00334 void PrintVerbose(int, realtype, long int iopt[], realtype ropt[]);
00335 void PrintFarewell(Control_Data, long int iopt[], realtype ropt[], realtype, realtype);
00336 void PrintFinalStats(long int iopt[], realtype ropt[]);
00337 void FPrintFarewell(Control_Data, FILE *, long int iopt[], realtype ropt[], realtype, realtype);
00338 void FPrintFinalStats(FILE *, long int iopt[], realtype ropt[]);
00339 
00340 #endif