forked from kettner/hydrotrend
-
Notifications
You must be signed in to change notification settings - Fork 1
/
hydrocalqsnew.c
61 lines (55 loc) · 1.87 KB
/
hydrocalqsnew.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
/*-------------------------------------------------------------------------------------------
* hydrocalqsnew.c
*
* Author: Albert Kettner, March 2006
*
* Subroutine to compensate for the difference between long term suspended sediment load (ART, QRT)
* and the sum of the daily suspended sediment load.
*
* Variable Def.Location Type Units Usage
* -------- ------------ ---- ----- -----
* err various int - error flag, halts program
* p various int - counter for the outlets
* Qsgrandtotaloutlettot Hydrocalqsnew.c double kg/s total Qs of all outlets
*
*-------------------------------------------------------------------------------------------*/
#include <stdio.h>
#include "hydroparams.h"
#include "hydrotimeser.h"
#include "hydroclimate.h"
#include "hydroinout.h"
/*----------------------
* Start main program
*----------------------*/
int
hydrocalqsnew (void)
{
/*-------------------
* Local Variables
*-------------------*/
int err, p;
double Qsgrandtotaloutlettot;
/*------------------------
* Initialize variables
*------------------------*/
err = 0;
Qsgrandtotaloutlettot = 0.0;
/*--------------------------------------------------
* Calculate mean Qs and calculate the difference
* between mean Qs and (Qsbar+ glacier part).
*--------------------------------------------------*/
if (Qsglacierbar[ep] > 0.0)
{
Qsmean[ep] = Qspsigrandtotal[ep] / (nyears[ep] * daysiy * dTOs);
Qsbarnew[ep] =
((1.0 - sedfilter[ep]) * (Qsbartot[ep] +
(fractionglaciersediment[ep] *
Qsglacierbar[ep]))) / Qsmean[ep];
}
else
{
Qsmean[ep] = Qsgrandtotal[ep] / (nyears[ep] * daysiy * dTOs);
Qsbarnew[ep] = ((1.0 - sedfilter[ep]) * (Qsbartot[ep])) / Qsmean[ep];
}
return (err);
} /* end of Hydrocalqsnew */