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

Go to the documentation of this file.
00001 /*
00002  *  HydroClimate.h
00003  *
00004  *  Contains predicted monthly and annual climate
00005  *  and discharge values and total annual values.
00006  *  Variable descriptions are included at the end.
00007  *
00008  *  Author:        M.D. Morehead  (June-July 1998)
00009  *  Author2:       S.D. Peckham   (Jan 2002)
00010  *  Author3:       A.J. Kettner   (August 2002)(april 2003)
00011  */
00012 
00013 #include <stdio.h>
00014 #include <math.h>
00015 #include <ctype.h>
00016 #include <time.h>
00017         
00018 #define nmonth          12
00019 #define maxepoche       110     /* also defined in HydroInOut.h and in HydroParams.h */
00020 #define Tmaxstd         3.0
00021 #define Pmaxstd         3.0
00022 #define maxshoulder     50      /* same as wrapday in HydroTimeSeries.h */
00023 
00024 /*----------------------------------------------------
00025  *  Numerical Recipes utilities (nrutil) array types
00026  -----------------------------------------------------*/
00027 void       nrerror(char []);
00028 float     **matrix( long, long, long, long);
00029 double   **dmatrix( long, long, long, long);
00030 float  ***f3tensor( long, long, long, long, long, long);
00031 double ***d3tensor( long, long, long, long, long, long);
00032 void   free_matrix(   float **, long, long, long, long);
00033 void  free_dmatrix(  double **, long, long, long, long);
00034 void free_f3tensor(  float ***, long, long, long, long, long, long);
00035 void free_d3tensor( double ***, long, long, long, long, long, long);
00036 
00037 int     nelevbins, shouldern;
00038 
00039 double  Eiceannual, Enivalannual, ELAchange[maxepoche];
00040 double  ELAstart[maxepoche], Ewetannual;
00041 double  glacierarea, glacierelev, lapserate[maxepoche], MEtotal;
00042 double  Minput, Moutput, MQprevious, MQnext, Pannual;
00043 double  Pchange[maxepoche], Pmassbal[maxepoche], Pexponent[maxepoche];
00044 double  Pmonth[nmonth];
00045 double  Pnominal[nmonth][maxepoche], Pnomstd[nmonth][maxepoche];
00046 double  Prange[maxepoche];
00047 double  Pstart[maxepoche], Pstd[maxepoche];
00048 double  Qbedannual, *Qbedannualoutlet,Qgrandtotal[maxepoche], ***Qgrandtotaloutlet, Qpeak, *Qpeakevents,*Qpeakperoutlet,**Qpeakperoutletall, Qtotal, **Qtotaloutlet, *Qtotaloutletannual, ***Qbar,Qbartotal[maxepoche], Qpeakall[maxepoche], **Qpeakallevents;
00049 double Qsgrandtotal[maxepoche],Qsgrandtotaldelta[maxepoche],**Qsgrandtotaloutlet,**Csgrandtotaloutlet, Qsbarnew[maxepoche], Qsbarnew2[maxepoche], Qsannual, *Qsannualoutlet,*Csannualoutlet, Qsbartot[maxepoche], Qsbar[maxepoche], Qsmean[maxepoche], **Coutlettotal;
00050 double baseflowtot[maxepoche], Csannual, Csgrandtotal[maxepoche];
00051 double  shoulderright[maxshoulder], shoulderleft, shouldermain;
00052 double  Snowremains;
00053 double  Tannual, Tchange[maxepoche];
00054 double  **Televday, Tmonth[nmonth], Tnominal[nmonth][maxepoche];
00055 double  Tnomstd[nmonth][maxepoche], Tstart[maxepoche], Tstd[maxepoche];
00056 double **Qpeakfloodtemp;
00057 
00058 /*
00059  * Variable             Def.Location    Type    Units   Usage
00060  * --------             ------------    ----    -----   -----
00061  *
00062  * ***baseflow          HydroClimate.h  dbl     m^3/s   Lower limit of discharge for the river, at least this amount will always occur
00063  * d3tensor()           HydroClimate.h  dbl     -       allocate a 3D double matrix, from Numerical Recipes
00064  * dayendm[12]          HydroClimate.h  int     -       ending year day of each month
00065  * dayends[4]           HydroClimate.h  int     -       ending year day of each season
00066  * daysim[12]           HydroClimate.h  int     -       number of days in each month
00067  * daysis[4]            HydroClimate.h  int     -       number of days in each season
00068  * daystrm[12]          HydroClimate.h  int     -       starting year day of each month
00069  * daystrs[4]           HydroClimate.h  int     -       starting year day of each season
00070  * dmatrix()            HydroClimate.h  dbl     -       allocate a 2D double matrix, from Numerical Recipes
00071  * Eiceannual           HydroClimate.h  dbl     m^3/a   Total annual evaporation from nival and ice
00072  * Enivalannual         HydroClimate.h  dbl     m^3/a   Total annual evaporation from nival and ice
00073  * ELAchange[]          HydroClimate.h  dbl     degC/a  ELA change/year for an epoch
00074  * ELAstart[]           HydroClimate.h  dbl     m       Starting Glacial Equilibrium Line Altitude (ELA) for an epoch
00075  * Ewetannual           HydroClimate.h  dbl     m^3     Total annual evaporation from rain and groundwater
00076  * f3tensor()           HydroClimate.h  float   -       allocate a 3D float matrix, from Numerical Recipes
00077  * free_dmatrix         HydroClimate.h  void    -       free a 2D double matrix, from Numerical Recipes
00078  * free_matrix          HydroClimate.h  void    -       free a 2D float matrix, from Numerical Recipes
00079  * free_d3tensor        HydroClimate.h  void    -       free a 3D double matrix, from Numerical Recipes
00080  * free_f3tensor        HydroClimate.h  void    -       free a 3D float matrix, from Numerical Recipes
00081  * glacierelev          HydroClimate.h  dbl     m       minimum elevation of the glacier
00082  * glacierarea          HydroClimate.h  dbl     m^2     modeled glacier area for each year
00083  * lapserate[]          HydroClimate.h  dbl     degC/km Temperature lapse rate for an epoch
00084  * matrix()             HydroClimate.h  float   -       allocate a 2D float matrix, from Numerical Recipes
00085  * maxepoch             HydroClimate.h  define  -       maximum number of epochs
00086  * maxshoulder          HydroClimate.h  define  -       maximum number of shoulder days
00087  * Tmaxstd              HydroClimate.h  define  -       maximum STD for annual T climate values
00088  * Pmaxstd              HydroClimate.h  define  -       maximum STD for annual P climate values
00089  * MEtotal              HydroClimate.h  dbl     m^3/a   total evaporation
00090  * Minput               HydroClimate.h  dbl     m^3     total mass input
00091  * Moutput              HydroClimate.h  double  m^3     total mass output
00092  * MQnext               HydroClimate.h  double  m^3/a   carryover to the next year
00093  * MQprevious           HydroClimate.h  double  m^3/a   carryover from the previous year
00094  * nelevbins            HydroClimate.h  int     #       number of calculated elevation bins
00095  * nmonth               HydroClimate.h  define  -       number of months/year
00096  * nrerror()            HydroClimate.h  void    -       standard error handler, from Numerical Recipes
00097  * Pannual              HydroClimate.h  double  m/y     Actual total rainfall for a year
00098  * Pchange[]            HydroClimate.h  double  m/y     Precipitation change/year for an epoch
00099  * Pmassbal[]           HydroClimate.h  double  m       Rain mass balance Coefficient
00100  * Pexponent[]          HydroClimate.h  double  m       Rainfall distribution exponent
00101  * Pmonth[]             HydroClimate.h  double  m       Actual monthly total rainfall
00102  * Pnominal[][]         HydroClimate.h  double  m       Nominal monthly rainfall
00103  * Pnomstd[][]          HydroClimate.h  double  m       STD of the monthly total rainfall
00104  * Prange[]             HydroClimate.h  double  -       Rainfall distribution range
00105  * Pstart[]             HydroClimate.h  double  m/a     Total annual Precipitation start value for an epoch
00106  * Pstd[]               HydroClimate.h  double  m       Standard Deviation of the annual Precipitation
00107  * Qbedannual           HydroClimate.h  double  kg/a    Total bedload/year
00108  * Qgrandtotal          HydroClimate.h  double  m^3     Total Runoff in the model run
00109  * Qpeak                HydroClimate.h  double  m^3/s   Peak flood occuring in a year
00110  * Qsgrandtotal[ep]     HydroClimate.h  double  kg      Total suspended load/ep run
00111  * Qsannual             HydroClimate.h  double  kg/a    Total suspended load/year
00112  * Qtotal               HydroClimate.h  double  m^3/a   Total Runoff in a year
00113  * shoulderright[]      HydroClimate.h  double  %       shoulder array for days following an event
00114  * shoulderleft         HydroClimate.h  double  %       shoulder value for the day preceeding an event
00115  * shouldermain         HydroClimate.h  double  %       shoulder value for the main event
00116  * shouldern            HydroClimate.h  int     -       actual number of shoulder days
00117  * Snowremains          HydroTimeser.h  double  m^3     snow remaining at end of summer (Aug 31)
00118  * Tannual              HydroClimate.h  double  degC    Actual mean Temperature for a year
00119  * Tchange[]            HydroClimate.h  double  degC/y  Temperature change/year for an epoch
00120  * Televday[][]         HydroClimate.h  double  degC    Daily Temp. at each elevation bin
00121  * Tmonth[]             HydroClimate.h  double  degC    Actual monthly mean Temperature
00122  * Tnominal[][]         HydroClimate.h  double  degC    Nominal monthly mean Temperature
00123  * Tnomstd[][]          HydroClimate.h  double  degC    STD of the monthly mean Temperature
00124  * Tstd[]               HydroClimate.h  double  degC    Standard Deviation of the annual Temperature
00125  * Tstart[]             HydroClimate.h  double  degC    Mean annual Temperature start value for an epoch
00126  *
00127  */
00128 

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