forked from kettner/hydrotrend
-
Notifications
You must be signed in to change notification settings - Fork 1
/
hydroparams.h
279 lines (249 loc) · 10.1 KB
/
hydroparams.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
/*-------------------------------------------------------------------------------------------
* hydroparams.h
*
* Author: Albert Kettner, March 2006
*
* Define input parameters and common constants
*
* Variable Def.Location Type Units Usage
* -------- ------------ ---- ----- -----
*
*-------------------------------------------------------------------------------------------*/
#if !defined( HYDROPARAMS_H )
#define HYDROPARAMS_H
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <ctype.h>
#include <time.h>
/*--------------------------
* Mathematical Constants
*--------------------------*/
#define PI (3.1415926535)
/*------------------------
* Conversion Constants
*------------------------*/
#define dTOs (86400.0) /* days to seconds (# s/day) = 60.*60.*24. */
#define degTOr (1.745329252e-2) /* 2.0*PI/360.0 convert degrees to radians */
#define yTOs (31536000.0) /* years to seconds (# s/year) = 60.*60.*24.*365. */
/*--------------------
* Global Constants
*--------------------*/
#define FLAflag (9999) /* used in FLAindex, indicates no freezing T's on a given day */
#define DAYSINYEAR (365)
/*--------------------
* Global Functions
*--------------------*/
#define sq(a) ((a)*(a))
#define mn(a,b) ((a)<(b)?(a):(b))
#define mx(a,b) ((a)>(b)?(a):(b))
#define rnd(a) ((fmod(a,1.0)>(0.5)?((double)((int)(a)+1)):((double)((int)(a)))))
/*-------------------
* Time Parameters
*-------------------*/
extern int ep, nepochs;
extern int yr, total_yr;
extern int *nyears, *syear;
extern char timestep[2];
/*---------------------------------
* Sediment Transport Parameters
*---------------------------------*/
#define maxgrn (10) /* maximum number of grain sizes */
extern int ngrain; /* number of grain sizes */
extern double **grainpct; /* % of each grain size */
/*--------------------
* Event Parameters
*--------------------*/
extern int eventcounter; /* keeps track of the events per epoch */
extern long *numberday; /* parameter to store temperatly which day of the year the event occured */
extern int eventsperyear; /* number of events that occur per year */
extern int *eventsnr;
extern double *floodvalue;
extern int floodcounter;
extern int eventnrflag; /* indicates is number of events is given or is Qpeak which triggers events is given */
/*--------------------
* Delta Parameters
*--------------------*/
extern int noutlet; /* number of outlets */
extern int minnoutlet; /* min number of outlets in a range */
extern int maxnoutlet; /* max number of outlets in a range */
extern double ***outletpct; /* % of each outlet, HARDWIRED */
extern double *sedfilter; /* filter variable for the delta outlets */
extern double **outletpcttotevents; /* total average percentages per outlet */
extern int *nroutlets;
extern int outletmodelflag; /* 1 if delta, 0 for no delta (no multiple outlets) */
extern int nooutletpctflag; /* indicator if Q fractions are given by user or not */
extern int noutletflag;
extern int steadyoutletpctflag; /* indicator if Q fractions has to be kept the same or change per event */
extern double **outletpctdummy;
/*----------------------------
* Sediment Load Parameters
*----------------------------*/
#define trneff (0.1)
#define anglerep (32.21)
extern double *alphabed;
extern double *C;
extern int annualhyperpycnalflag;
extern double Qshyperpycnal;
extern double hyperpycnalvalue;
extern double Cspeak;
extern double Qspeak;
/*------------------------
* Hydraulic Parameters
*------------------------*/
extern double *depcof, *deppow; /* d = (c * Q^f) */
extern double *velcof, *velpow; /* v = (k * Q^m) */
extern double *widcof, *widpow; /* w = (a * Q^b) */
extern double *avgvel; /* Avg. river vel. (m/s) */
extern double *rslope; /* Riverbed avg. slope (deg) */
/*----------------------
* Terrain Parameters
*----------------------*/
extern double elevbinsize;
extern int *nhypts; /* size of hypsometry array per epoch */
extern double *areabins;
extern double *elevbins;
extern double **hypsarea;
extern double **hypselev;
extern double *basinlength; /* River basin length (meters) */
extern double *maxalt; /* Now computed in hydroreadhypsom.c */
extern double *totalarea; /* Now computed in hydroreadhypsom.c */
/*-------------------------
* Earthquake Parameters
*-------------------------*/
extern int *earthquakedatafile; /* flag to indicate if there are earthquake files*/
extern int *quakeeventcounter;
extern int **quakeeventyear; /*read in from file*/
extern int start_decay_year;
extern int end_decay_year;
extern double max_quake_erosion; /*the maximum erosion multiply factor value, a constant */
extern double quakethresholdenergy; /*threshold, below quake will not be taken into account*/
extern double quakethresholdenergy_max; /* max mag earthquake we are taking into account*/
extern double quakedampingfactor; /* */
extern double **quakeeventenergy; /*read in from file*/
extern double **quakeeventdistance; /*read in from file*/
extern double **quakeeventduration; /*read in from file*/
/*---------------------------------
* General Hydrologic Parameters
*---------------------------------*/
extern int *distbins; /* days to discharge a bin */
extern int exceedflood; /* flag for whether maxflood exceeded */
extern int floodtry;
extern double maxflood; /* theoretical max flood size */
extern double *Rvol; /* storage capacity of lake/reservoir */
extern double *Ralt; /* alitude of the lake/reservoir */
extern double *Rarea; /* drainage area above the reservoir */
extern double *TE; /* Trapping efficiency */
extern double *TEsubbasin;
extern char *Rparamcheck; /* indicator if alt. or drainage area is used as input */
extern double alphac; /* OBSOLETE ?? */
extern double betac; /* OBSOLETE ?? */
extern double rhosed; /*** HARDWIRE ***/
extern double rhowater; /*** HARDWIRE ***/
/*------------------------
* Rainfall Parameters
*------------------------*/
extern double *alphag; /*** experimental added to the input file ***/
extern double *betag; /*** experimental added to the input file ***/
extern double pcr; /*** HARDWIRE ***/
extern double pmax; /*** HARDWIRE ***/
extern double MPrain;
/*--------------------------
* Groundwater Parameters
*--------------------------*/
extern double *Ko; /* sat. hydr. cond. (mm/day) */
extern double *alphass;
extern double *betass;
extern double gwinitial; /* initial GW storage (m^3) */
extern double gwlast;
extern double *gwmin, *gwmax; /* min/max storage (m^3) */
extern double percentgw; /* % of snow/ice melt to GW */
extern double *alphagwe; /* evaporation coeff */
extern double *betagwe; /* evaporation exponent */
extern int evaporationdatafile;
/*-----------------------------
* Snowmelt/Nival Parameters
*-----------------------------*/
extern double *dryevap;
extern double Meltrate;
extern double Msnowstart, Msnowend;
extern double MPnival;
/*---------------------------
* Glacier Melt Parameters
*---------------------------*/
extern int ELAindex;
extern double bigg, smallg, lastarea, initiallastarea;
extern double ela, lastela, initiallastela;
extern double Gmass;
extern double MPglacial;
extern double bethaexpo, bethaglacier;
extern double initialVolumelast, Volumeglacierarea;
extern double glacierareakmreset, glacierareakmpotential;
/*----------------------------
* Random Number Parameters
*----------------------------*/
#define maxran 2200
#define INIT_RAN_NUM_SEED (850)
extern int nran;
extern double *ranarray;
extern double rmin, rmax;
/*-------------------------------------
* Random Number Parameters sediment
*-------------------------------------*/
extern double *ranarraysediment;
extern int nransediment;
/*--------------------------
* Mass Check Parameters
*--------------------------*/
#define masscheck (1e-5) /* mass balance check (%) SHOULD BE 1e-5 */
extern double maxerr;
extern double totalmass;
/*-------------------------
* Geographic Parameters
*-------------------------*/
extern double lat, lon;
extern double alpha3, alpha4, alpha5;
extern double alpha6, alpha7, alpha8;
extern double alpha9, alpha10, alpha11;
extern double k1, k2;
extern int *Qsbarformulaflag;
/*-----------------------
* Rainfile parameters
*-----------------------*/
extern int raindatafile;
/*------------------------
* Lithology parameters
*------------------------*/
extern double *lithology;
/*----------------------------
* Anthropogenic parameters
*----------------------------*/
extern double *anthro;
/*---------------------------------------------
* Parameters to set Qsbarnew for each epoch
*---------------------------------------------*/
extern int setstartmeanQandQs; /* loop counter for each epoch (count to 3) */
/*-------------------------------------------------
* Variables to set ASCII write option ON or OFF
*-------------------------------------------------*/
#define MAXCHAR (5)
#define ON "ON"
#define OFF "OFF"
extern char asciioutput[MAXCHAR];
/*---------------------------------------------------------
* Set the file name and directory parameters + security
*---------------------------------------------------------*/
#define DUMMY "HYDRO"
#define verbosearg "VERBOSE"
extern char startname[80];
extern char directory[100];
extern char chrdump[80];
extern char commandlinearg[2][2048];
extern int globalparflag;
extern int lapserateflag;
extern int verbose;
extern double *Qgrandtotaltotoutlet, Qgrandtotaltot, **Qdummy, **Qgrandtotalperepoch;
extern double Qsgrandtotaltot, *Qsgrandtotaltotoutlet, Qpeakmax, TEtot;
extern double Qsoutletdummy;
extern double **Qsbartotoutlet;
#endif /* */