-
Notifications
You must be signed in to change notification settings - Fork 6
/
hydrosetparams.c
272 lines (244 loc) · 9.71 KB
/
hydrosetparams.c
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
/*-------------------------------------------------------------------------------------------
* HydroSetParams.c
*
* Author: Albert Kettner, March 2006
*
* In hydroreadinput.c, units are converted as follows:
* Multiply totalarea by 1e6. (km^2 -> m^2)
* Multiply basinlength by 1000. (km -> m)
* Divide Ko by 1000. (mm/day -> m/day)
* Divide Lapse rate by 1000. (mm/day -> m/day)
* Some others are done by this routine.
*
* Variable Def.Location Type Units Usage
* -------- ------------ ---- ----- -----
*
*-------------------------------------------------------------------------------------------*/
#include "hydroparams.h"
#include "hydroclimate.h"
/*-------------------
* Time Parameters
*-------------------*/
int ep, nepochs;
int yr, total_yr;
int *nyears, *syear;
char timestep[2];
/*---------------------------------
* Sediment Transport Parameters
*---------------------------------*/
int ngrain; /* number of grain sizes */
double **grainpct; /* % of each grain size */
/*--------------------
* Event Parameters
*--------------------*/
int eventcounter; /* keeps track of the events per epoch */
long *numberday; /* parameter to store temperatly which day of the year the event occured */
int eventsperyear; /* number of events that occur per year */
int *eventsnr;
double *floodvalue;
int floodcounter;
int eventnrflag; /* indicates is number of events is given or is Qpeak which triggers events is given */
/*--------------------
* Delta Parameters
*--------------------*/
int noutlet; /* number of outlets */
int minnoutlet; /* min number of outlets in a range */
int maxnoutlet; /* max number of outlets in a range */
double ***outletpct; /* % of each outlet, HARDWIRED */
double *sedfilter; /* filter variable for the delta outlets */
double **outletpcttotevents; /* total average percentages per outlet */
int *nroutlets;
int outletmodelflag; /* 1 if delta, 0 for no delta (no multiple outlets) */
int nooutletpctflag; /* indicator if Q fractions are given by user or not */
int noutletflag;
int steadyoutletpctflag; /* indicator if Q fractions has to be kept the same or change per event */
double **outletpctdummy;
/*----------------------------
* Sediment Load Parameters
*----------------------------*/
double *alphabed;
double *C;
int annualhyperpycnalflag;
double Qshyperpycnal;
double hyperpycnalvalue;
double Cspeak;
double Qspeak;
/*------------------------
* Hydraulic Parameters
*------------------------*/
double *depcof, *deppow; /* d = (c * Q^f) */
double *velcof, *velpow; /* v = (k * Q^m) */
double *widcof, *widpow; /* w = (a * Q^b) */
double *avgvel; /* Avg. river vel. (m/s) */
double *rslope; /* Riverbed avg. slope (deg) */
/*----------------------
* Terrain Parameters
*----------------------*/
double elevbinsize;
int *nhypts; /* size of hypsometry array per epoch */
double *areabins;
double *elevbins;
double **hypsarea;
double **hypselev;
double *basinlength; /* River basin length (meters) */
double *maxalt; /* Now computed in hydroreadhypsom.c */
double *totalarea; /* Now computed in hydroreadhypsom.c */
/*-------------------------
* Earthquake Parameters
*-------------------------*/
int *earthquakedatafile; /* flag to indicate if there are earthquake files*/
int *quakeeventcounter;
int **quakeeventyear; /*read in from file*/
int start_decay_year;
int end_decay_year;
double max_quake_erosion; /* maximum erosion factor that can occur, set below*/
double quakethresholdenergy; /* below this threshold quake will not be taken into account, set below)*/
double quakethresholdenergy_max; /* max mag earthquake we are taking into account*/
double quakedampingfactor; /* */
double **quakeeventenergy; /*read in from file*/
double **quakeeventdistance; /*read in from file*/
double **quakeeventduration; /*read in from file*/
/*---------------------------------
* General Hydrologic Parameters
*---------------------------------*/
int *distbins; /* days to discharge a bin */
int exceedflood; /* flag for whether maxflood exceeded */
int floodtry;
double maxflood; /* theoretical max flood size */
double *Rvol; /* storage capacity of lake/reservoir */
double *Ralt; /* alitude of the lake/reservoir */
double *Rarea; /* drainage area above the reservoir */
double *TE; /* Trapping efficiency */
double *TEsubbasin;
char *Rparamcheck; /* indicator if alt. or drainage area is used as input */
double alphac; /* OBSOLETE ?? */
double betac; /* OBSOLETE ?? */
double rhosed; /*** HARDWIRE ***/
double rhowater; /*** HARDWIRE ***/
/*------------------------
* Rainfall Parameters
*------------------------*/
double *alphag; /*** experimental added to the input file ***/
double *betag; /*** experimental added to the input file ***/
double pcr; /*** HARDWIRE ***/
double pmax; /*** HARDWIRE ***/
double MPrain;
/*--------------------------
* Groundwater Parameters
*--------------------------*/
double *Ko; /* sat. hydr. cond. (mm/day) */
double *alphass;
double *betass;
double gwinitial; /* initial GW storage (m^3) */
double gwlast;
double *gwmin, *gwmax; /* min/max storage (m^3) */
double percentgw; /* % of snow/ice melt to GW */
double *alphagwe; /* evaporation coeff */
double *betagwe; /* evaporation exponent */
int evaporationdatafile;
/*-----------------------------
* Snowmelt/Nival Parameters
*-----------------------------*/
double *dryevap;
double Meltrate;
double Msnowstart, Msnowend;
double MPnival;
/*---------------------------
* Glacier Melt Parameters
*---------------------------*/
int ELAindex;
double bigg, smallg, lastarea, initiallastarea;
double ela, lastela, initiallastela;
double Gmass;
double MPglacial;
double bethaexpo, bethaglacier;
double initialVolumelast, Volumeglacierarea;
double glacierareakmreset, glacierareakmpotential;
/*----------------------------
* Random Number Parameters
*----------------------------*/
int nran;
double *ranarray;
double rmin, rmax;
/*-------------------------------------
* Random Number Parameters sediment
*-------------------------------------*/
double *ranarraysediment;
int nransediment;
/*--------------------------
* Mass Check Parameters
*--------------------------*/
double maxerr;
double totalmass;
/*-------------------------
* Geographic Parameters
*-------------------------*/
double lat, lon;
double alpha3, alpha4, alpha5;
double alpha6, alpha7, alpha8;
double alpha9, alpha10, alpha11;
double k1, k2;
int *Qsbarformulaflag;
/*-----------------------
* Rainfile parameters
*-----------------------*/
int raindatafile;
/*------------------------
* Lithology parameters
*------------------------*/
double *lithology;
/*----------------------------
* Anthropogenic parameters
*----------------------------*/
double *anthro;
/*---------------------------------------------
* Parameters to set Qsbarnew for each epoch
*---------------------------------------------*/
int setstartmeanQandQs; /* loop counter for each epoch (count to 3) */
/*-------------------------------------------------
* Variables to set ASCII write option ON or OFF
*-------------------------------------------------*/
char asciioutput[MAXCHAR];
/*---------------------------------------------------------
* Set the file name and directory parameters + security
*---------------------------------------------------------*/
char startname[80];
char directory[100];
char chrdump[80];
char commandlinearg[2][2048];
int globalparflag;
int lapserateflag;
int verbose;
double *Qgrandtotaltotoutlet, Qgrandtotaltot, **Qdummy, **Qgrandtotalperepoch;
double Qsgrandtotaltot, *Qsgrandtotaltotoutlet, Qpeakmax, TEtot;
double Qsoutletdummy;
double **Qsbartotoutlet;
/*---------------------------
* Start of HydroSetParams
*---------------------------*/
void
hydrosetparams ()
{
/*---------------------------------------
* Hardwired Parameters for all Epochs
*---------------------------------------*/
rhowater = 1000.0;
rhosed = 2670.0;
alphac = 0.98; /* saturation excess coeff */
betac = 1.00; /* saturation excess exponent */
// alphag = -0.0001; /* groundwater precip offset (m/day) */
// betag = 0.85; /* groundwater precip slope */
// alphagwe = 0.0020; /* groundwater evap coeff (m/day)*/
// betagwe = 1.0; /* groundwater evap exponent */
pmax = 0.400; /* precip need to reach max cond. (m/day) */
Meltrate = 0.003; /* (m/degC) */
percentgw = 0.15; /* percent of nival&ice as groundwater */
pcr = 0.010; /* crit. precip for infilt. excess (m/day) */
bethaexpo = 1.38; /* volume-surface area exponent glaciers */
bethaglacier = 31.11716; /* volume-surface area multiplier glaciers */
hyperpycnalvalue = 40.0; /* (in kg/m3) rough value; above this value and river will go hyperpycnal */
quakethresholdenergy = 6.0; /* Below this value, quake will not be taken into account*/
quakethresholdenergy_max = 9.0; /* above this value, quake will same as 9.0 */
quakedampingfactor = 80.0; /* If the distance is larger than x km, than the earth quake doesn't have any impact anymore */
return;
} /* end of HydroSetParams */