/Users/huttone/Devel/sedflux-new/sedflux/trunk/ew/hydrotrend/hydroparams.h

Go to the documentation of this file.
00001 
00002 /*
00003  *  HydroParams.h
00004  *
00005  *  Define input parameters and common constants
00006  *
00007  *  Author:    M.D. Morehead (June 1998)
00008  *  Author2:   S.D. Peckham  (Sep 2001)
00009  *  Author3:   A.J. Kettner  (August - October 2002)
00010  *
00011  */
00012 
00013 #include <stdio.h>
00014 #include <math.h>
00015 #include <ctype.h>
00016 #include <time.h>
00017 
00018 /*----------------------
00019  *  Physical Constants
00020  *----------------------*/
00021 #define rho_water (1000.0)              /* density of water (kg/m^3) */
00022 #define rho_sed (2670.0)                /* density of sediment (quartz) (kg/m^3) */
00023 
00024 /*--------------------------
00025  *  Mathematical Constants
00026  *--------------------------*/
00027 #define PI      (3.1415926535)
00028 
00029 /*------------------------
00030  *  Conversion Constants
00031  *------------------------*/
00032 #define dTOs    (86400.0)               /* days to seconds (# s/day) = 60.*60.*24. */
00033 #define degTOr  (1.745329252e-2)        /* 2.0*PI/360.0 convert degrees to radians */
00034 
00035 /*--------------------
00036  *  Global Constants
00037  *--------------------*/
00038 #define FLAflag (9999)          /* used in FLAindex, indicates no freezing T's on a given day */
00039 #define TMLEN (100)             /* length of the time stamp */
00040 #define DAYSINYEAR (365)
00041 
00042 /*--------------------
00043  *  Global Functions
00044  *--------------------*/
00045 #define sq(a)   ((a)*(a))
00046 #define mn(a,b) ((a)<(b)?(a):(b))
00047 #define mx(a,b) ((a)>(b)?(a):(b))
00048 #define rnd(a)  ((fmod(a,1.0)>(0.5)?((double)((int)(a)+1)):((double)((int)(a)))))
00049 
00050 /*-------------------
00051  *  Time Parameters
00052  *-------------------*/
00053 #define         maxepoch (110)          /* max number of epochs to run */
00054 int             nepochs, ep;
00055 int             yr, total_yr;
00056 int             nyears[maxepoch], syear[maxepoch];
00057 int             tblstart[maxepoch], tblend[maxepoch];
00058 char            timestep[2];
00059 
00060 /*---------------------------------
00061  *  Sediment Transport Parameters
00062  *---------------------------------*/
00063 #define maxgrn  (10)                            /* maximum number of grain sizes */
00064 int             ngrain;                                         /* number of grain sizes */
00065 double          grainpct[maxgrn][maxepoch];     /* % of each grain size, HARDWIRED */
00066 
00067 /*--------------------
00068  *  Event Parameters
00069  *--------------------*/ 
00070 int             eventcounter;                                                           /* keeps track of the events per epoch */
00071 long            *numberday;                                                                     /* parameter to store temperatly which day of the year the event occured */
00072 int             eventsperyear;                                                          /* number of events that occur per year */
00073 int             eventsnr[maxepoch];
00074 double          floodvalue[maxepoch];
00075 int             floodcounter;
00076 int             eventnrflag;                                                            /* indicates is number of events is given or is Qpeak which triggers events is given */
00077 
00078 /*--------------------
00079  *  Delta Parameters
00080  *--------------------*/
00081 int             noutlet;                                                                        /* number of outlets */
00082 int             minnoutlet;                                                                     /* min number of outlets in a range */
00083 int             maxnoutlet;                                                                     /* max number of outlets in a range */
00084 double  ***outletpct;                                                           /* % of each outlet, HARDWIRED */
00085 double  sedfilter[maxepoch];                                            /* filter variable for the delta outlets */
00086 double  totpercentageQ[maxepoch];
00087 double          **outletpcttotevents;                                           /* total average percentages per outlet */
00088 int             *nroutlets;
00089 int             outletmodelflag;                                                        /* 1 if delta, 0 for no delta (no multiple outlets) */
00090 int             nooutletpctflag;                                                        /* indicator if Q fractions are given by user or not */
00091 int             noutletflag;
00092 int             steadyoutletpctflag;                                            /* indicator if Q fractions has to be kept the same or change per event */
00093 double          **outletpctdummy;
00094 
00095 /*----------------------------
00096  *  Sediment Load Parameters
00097  *----------------------------*/
00098 double threshbed[maxepoch];
00099 #define alphabed  (0.9)
00100 #define trneff (0.1)
00101 #define anglerep (32.21)
00102 double *C;
00103 
00104 /*------------------------
00105  *  Hydraulic Parameters
00106  *------------------------*/
00107 double  depcof[maxepoch],       deppow[maxepoch];   /* d = (c * Q^f) */
00108 double  velcof[maxepoch],       velpow[maxepoch];   /* v = (k * Q^m)  */
00109 double  widcof[maxepoch],       widpow[maxepoch];   /* w = (a * Q^b) */
00110 double  avgvel[maxepoch];                     /* Avg. river vel. (m/s) */
00111 double  rslope[maxepoch];                     /* Riverbed avg. slope (deg)*/
00112 
00113 /*----------------------
00114  *  Terrain Parameters
00115  *----------------------*/
00116 double elevbinsize;
00117 int     nhypts[maxepoch];                       /* size of hypsometry array per epoch */
00118 double  *areabins;
00119 double  *elevbins;
00120 double  hypspow[maxepoch];
00121 double  **hypsarea;
00122 double  **hypselev;
00123 double  basinlength[maxepoch];   /* River basin length (meters) */
00124 double  maxalt[maxepoch];                /* Now computed in hydroreadhypsom.c  */
00125 double  totalarea[maxepoch];     /* Now computed in hydroreadhypsom.c  */
00126 double  basin_relief[maxepoch];  /****  REPLACE maxalt ??  ****/
00127 double  basin_area[maxepoch];    /****  REPLACE totalarea ?? ****/
00128 
00129 /*---------------------------------
00130  *  General Hydrologic Parameters
00131  *---------------------------------*/
00132 int     *distbins;                              /* days to discharge a bin */
00133 int     exceedflood;                    /* flag for whether maxflood exceeded */
00134 int     floodtry;
00135 double  maxflood;                               /* theoretical max flood size */
00136 double  Rvol[maxepoch];                 /* storage capacity of lake/reservoir */
00137 double Ralt[maxepoch];                  /* alitude of the lake/reservoir */
00138 double  Rarea[maxepoch];                /* drainage area above the reservoir */
00139 double TE[maxepoch];                    /* Trapping efficiency */
00140 double TEsubbasin[maxepoch];
00141 char    Rparamcheck[maxepoch];  /* indicator if alt. or drainage area is used as input */       
00142 double  alphac[maxepoch];    /*  OBSOLETE ?? */
00143 double  betac[maxepoch];     /*  OBSOLETE ?? */
00144 double  rhosed[maxepoch];    /***  HARDWIRE  ***/
00145 double  rhowater[maxepoch];  /***  HARDWIRE  ***/
00146 
00147 /*------------------------
00148  *  Rainfall Parameters
00149  *------------------------*/
00150 double  alphag[maxepoch];       /***  HARDWIRE  ***/
00151 double  betag[maxepoch];        /***  HARDWIRE  ***/
00152 double  pcr[maxepoch];          /***  HARDWIRE  ***/
00153 double  pmax[maxepoch];         /***  HARDWIRE  ***/
00154 double  MPrain;
00155 
00156 /*--------------------------
00157  *  Groundwater Parameters
00158  *--------------------------*/
00159 double  Ko[maxepoch];                         /* sat. hydr. cond. (mm/day) */
00160 double  alphass[maxepoch];
00161 double  betass[maxepoch];
00162 double  gwinitial;                                        /* initial GW storage (m^3) */
00163 double  gwlast;
00164 double  gwmin[maxepoch], gwmax[maxepoch];     /* min/max storage (m^3) */
00165 double  percentgw[maxepoch];                      /* % of snow/ice melt to GW */
00166 double  alphagwe[maxepoch];                       /* evaporation coeff */
00167 double  betagwe[maxepoch];                        /* evaporation exponent */
00168 
00169 /*-----------------------------
00170  *  Snowmelt/Nival Parameters
00171  *-----------------------------*/
00172 double  dryevap[maxepoch];
00173 double  Meltrate[maxepoch];                     /***  HARDWIRE ***/
00174 double lapserate[maxepoch];
00175 double  Msnowstart, Msnowend;
00176 double  MPnival;
00177 
00178 /*---------------------------
00179  *  Glacier Melt Parameters
00180  *---------------------------*/
00181 int     ELAindex;
00182 double  bigg, smallg, lastarea, initiallastarea;
00183 double  ela, lastela, initiallastela;
00184 double  Gmass;
00185 double  MPglacial;
00186 double bethaexpo, bethaglacier;
00187 
00188 /*----------------------------
00189  *  Random Number Parameters
00190  *----------------------------*/
00191 #define         maxran  2200
00192 #define         INIT_RAN_NUM_SEED (850)
00193 int             nran;
00194 double          *ranarray;
00195 double rmin, rmax;
00196 
00197 /*--------------------------
00198  *  Mass Check Parameters
00199  *--------------------------*/
00200 #define masscheck (1e-5)                /* mass balance check (%) */
00201 double  maxerr;
00202 double  totalmass;
00203 
00204 /*-------------------------
00205  *  Geographic Parameters
00206  *-------------------------*/
00207 double lat, lon;
00208 double alpha3, alpha4, alpha5;
00209 double alpha6, alpha7, alpha8;
00210 double k1,k2;
00211 int Qsbarformulaflag[maxepoch];
00212 
00213 /*-----------------------
00214  *  Rainfile parameters
00215  *-----------------------*/
00216 int raindatafile;
00217   
00218 /*---------------------------------------------
00219  *  Parameters to set Qsbarnew for each epoch
00220  *---------------------------------------------*/
00221 int setstartmeanQandQs; /* loop counter for each epoch (count to 3) */
00222 
00223 /*-------------------------------------------------
00224  *  Variables to set ASCII write option ON or OFF
00225  *-------------------------------------------------*/
00226 #define MAXCHAR (5)
00227 #define ON "ON"
00228 #define OFF "OFF"
00229 char asciioutput[MAXCHAR];
00230 
00231 /*---------------------------------------------------------
00232  *  Set the file name and directory parameters + security
00233  *---------------------------------------------------------*/
00234 #define DUMMY "HYDRO"
00235 char startname[80];
00236 char directory[100];
00237 char chrdump[80];
00238 char commandlinearg[2][20];
00239 int webflag;
00240 int globalparflag;
00241 int lapserateflag, velpowflag, widpowflag;
00242 
00243 double  *Qgrandtotaltotoutlet, Qgrandtotaltot, **Qdummy, **Qgrandtotalperepoch;
00244 double  Qsgrandtotaltot, *Qsgrandtotaltotoutlet, Qpeakmax, TEtot, yeartot;
00245 double Qsoutletdummy;
00246 double **Qsbartotoutlet;
00247 

Generated on Fri Jan 4 18:04:14 2008 for sedflux by  doxygen 1.5.2