runPIHM/pihm/ihm.h

Go to the documentation of this file.
00001 #ifndef IHM_H
00002 #define IHM_H
00003 /*******************************************************************************
00004  * File        : ihm.h                                                         *
00005  * Function    : define data structure and grobal variable                     *
00006  * Programmer  : Yizhong Qu @ Pennsylvania State Univeristy                    *
00007  * Version     : May, 2004 (1.0)                                               * 
00008  *-----------------------------------------------------------------------------*
00009  *                                                                             *
00010  * This is a object oriented model. In this file, all the data structures and  *
00011  * global variables are defined. To avoid using real globle variables, this    *
00012  * header file and pointers are passed.                                        *
00013  *                                                                             *
00014  * This code is free for users with research purpose only, if appropriate      *
00015  * citation is refered. However, there is no warranty in any format for this   *
00016  * product.                                                                    *
00017  *                                                                             *
00018  * For questions or comments, please contact the authors of the reference.     *
00019  * One who want to use it for other consideration may also contact Dr.Duffy    *
00020  * at cxd11@psu.edu.                                                           *    
00021  *******************************************************************************/
00022 
00023 #include "sundials_types.h"
00024 #include "nvector_serial.h"
00025 #include <stdio.h>
00026 
00027 
00028 /* Define Global Type */
00029 //float Tsteps;
00030 
00031 typedef struct element_type 
00032 {
00033   int index;  
00034   int node[3];        /* anti-clock-wise */
00035   int nabr[3];        /* neighbor i shares edge i (0: on boundary) */
00036     
00037   realtype edge[3];   /* edge i is from node i to node i+1 */
00038   realtype area;      /* area of element */
00039   
00040   realtype x;         /* x of centroid */
00041   realtype y;         /* y of centroid */
00042   realtype zmin;      /* z_min of centroid */
00043   realtype zmax;      /* z_max of centroid */
00044   realtype NodeZmin;   /* Z_min of any of the three nodes */
00045   realtype NodeZmax;   /* Z_max of any of the three nodes */
00046   realtype NodeDist;   /* Distance between Z_max and Z_min nodes */
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;           /* soil type */
00067   int LC;             /* Land Cover type  */
00068   int IC;             /* initial condition type */
00069   int BC;             /* boundary type. 0:natural bc (no flow); 1:Dirichlet BC; 2:Nuemann BC */
00070   int prep;           /* precipatation (forcing) type */
00071   int temp;           /* tempurature (forcing) type   */
00072   int humidity;       /* humidity type */
00073   int WindVel;        /* wind velocity type  */
00074   int Rn;             /* net radiation input */
00075   int G;              /* radiation into ground */
00076   int pressure;       /* pressure type */
00077   int source;         /* source (well) type */
00078   
00079 } element;
00080 
00081 typedef struct nodes_type
00082 {
00083   int index; 
00084      
00085   realtype x;          /* x coordinate */
00086   realtype y;          /* y coordinate */
00087   realtype zmin;       /* z bed rock elevation */
00088   realtype zmax;       /* z surface elevation  */
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;           /* index */
00107   
00108   realtype Ksat;       /* saturated soil conductivity */
00109   realtype SitaS;      /* soil porosity */
00110   realtype SitaR;      /* soil moisture residual */
00111   realtype Alpha;      /* soil curve parameter 1 */
00112   realtype Beta;       /* soil curve parameter 2 */
00113   realtype Sf;         /* surface slope of friction */
00114   realtype RzD;        /* rootZone Depth*/
00115   
00116   int Macropore;       /* 1: macropore; 0: regular soil */
00117   realtype base;       /* base value */
00118   realtype gama;       /* amplifier factor */
00119   
00120   int Inf;             /* index of infiltration capacity type */
00121   
00122 } soils;
00123 
00124 typedef struct lc_type
00125 {
00126   int index;           /* index */
00127 
00128   realtype LAImax;     /* max LAI */
00129   realtype VegFrac;    /* Canopy Fracn */
00130   realtype Albedo;     /* Albedo */
00131   realtype Rs_ref;     /* reference stomaral resistance */
00132   realtype Rmin;       /* Minimum stomatal resistance */
00133   realtype Rough;      /* surface roughness factor  */
00134 } LC;
00135 
00136 typedef struct river_segment_type
00137 {
00138   int index;
00139   
00140   realtype x;          /* x of river segment */
00141   realtype y;  
00142   realtype zmin;       /* bed elevation  */
00143   realtype zmax;       /* bank elevation */
00144   realtype depth;      /* max depth */
00145   realtype Length;
00146   realtype Rough;
00147   
00148   int FromNode;
00149   int ToNode;
00150   int down;            /* down stream segment */
00151   int LeftEle;
00152   int RightEle;
00153   int shape;           /* shape type    */
00154   int material;        /* material type */
00155   int IC;              /* IC type */
00156   int BC;              /* BC type */
00157   int reservoir;
00158   
00159 } river_segment;
00160 
00161 typedef struct river_shape_type
00162 {
00163   int index;           
00164   realtype width;      /* assume rectangular shape */
00165   realtype depth;      /* depth */
00166   realtype bed;        /* bed elevation */
00167   int interpOrd;       /* Interpolation order for river shape: Order =1 (rectangle), 2(triangle), 3(quadratic) and 4(cubic)*/
00168   realtype coeff;              /* Coefficient c in D = c*B/2 */
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; /* interpolation counter */
00194   realtype **TS;     /* 2D time series data */
00195   
00196 } TSD;
00197 
00198 typedef struct model_data_structure          /* Model_data definition */
00199 {
00200   int UnsatMode;               /* Unsat Mode */
00201   int SurfMode;                /* Surface Overland Mode */
00202   int RivMode;                 /* River Routing Mode */
00203     
00204   int NumEle;                  /* Number of Elements */
00205   int NumNode;                 /* Number of Nodes    */
00206   int NumRiv;                  /* Number of Rivere Segments */
00207   
00208   int NumPrep;                 /* Number of Precipatation   */
00209   int NumTemp;                 /* Number of Temperature     */
00210   int NumHumidity;             /* Number of Humidity        */
00211   int NumWindVel;              /* Number of Wind Velocity   */
00212   int NumRn;                   /* Number of Net Radiation   */
00213   int NumG;                    /* Number of Ground Heat     */
00214   int NumP;                    /* Number of Pressure        */
00215   int NumSource;               /* Number of Source          */
00216   
00217   int NumSoil;                 /* Number of Soils           */
00218   int NumRes;                  /* Number of Reservoir       */
00219   int NumInc;                  /* Number of Infiltration Capacity  */
00220   int NumLC;                   /* Number of Land Cover Index Data */
00221   
00222   int NumMeltF;                /* NumMeltF = 1 */
00223   
00224   int Num1BC;                  /* Number of Dirichlet BC    */
00225   int Num2BC;                  /* Number of Numann BC       */
00226   int NumEleIC;                /* Number of Element Initial Condtion */
00227   
00228   int NumRivShape;             /* Number of River Shape     */
00229   int NumRivMaterial;          /* Number of River Bank Material */
00230   int NumRivIC;                /* Number of River Initial Condition  */
00231   int NumRivBC;                /* Number of River Boundary Condition */
00232   
00233   element *Ele;                /* Store Element Information  */
00234   nodes *Node;                 /* Store Node Information     */
00235   element_IC *Ele_IC;          /* Store Element Initial Condtion */
00236   soils *Soil;                 /* Store Soil Information     */
00237   LC *LandC;                   /* Store Land Cover Information */
00238   
00239   river_segment *Riv;          /* Store River Segment Information */
00240   river_shape *Riv_Shape;      /* Store River Shape Information   */
00241   river_material *Riv_Mat;     /* Store River Bank Material Information */
00242   river_IC *Riv_IC;            /* Store River Initial Condition   */
00243 
00244   TSD *TSD_Inc;                /* Infiltration Capacity Time Series Data */
00245   TSD *TSD_LAI;                /* Leaves Area Index Time Series Data     */
00246   TSD *TSD_DH;                 /* Zero plane Displacement Height */  
00247   realtype *SIFactor;          /* SIFactor is used to calculate SIMax from LAI */
00248 
00249   TSD  *TSD_MeltF;             /* Monthly Varying Melt Factor for Temperature Index model */  
00250 
00251   TSD *TSD_EleBC;              /* Element Boundary Condition Time Series Data  */
00252   TSD *TSD_Riv;                /* River Related Time Series Data  */
00253   TSD *TSD_Prep;               /* RainFall Time Series Data       */
00254   TSD *TSD_Temp;               /* Temperature Time Series Data    */
00255   TSD *TSD_Humidity;           /* Humidity Time Series Data       */
00256   TSD *TSD_WindVel;            /* Wind Velocity Time Series Data  */
00257   TSD *TSD_Rn;                 /* Net Radiation Time Series Data  */
00258   TSD *TSD_G;                  /* Radiation into Ground Time Series Data */
00259   TSD *TSD_Pressure;           /* Pressure Time Series data       */
00260   TSD *TSD_Source;             /* Source (well) Time Series data  */
00261 
00262   realtype **FluxSurf;     /* Overland Flux   */
00263   realtype **FluxSub;      /* Subsurface Flux */
00264   realtype **FluxRiv;      /* River Segement Flux */
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

Generated on Sun Aug 5 17:33:59 2007 for PIHMgis by  doxygen 1.5.2