Go to the source code of this file.
|
| void | leachdly (double wfluxout[], int numlyrs, double nitrate[], double critflow, double frlechd[], double stream[], double basef, double stormf, double *inorglch) |
| |
| void leachdly |
( |
double |
wfluxout[], |
|
|
int |
numlyrs, |
|
|
double |
nitrate[], |
|
|
double |
critflow, |
|
|
double |
frlechd[], |
|
|
double |
stream[], |
|
|
double |
basef, |
|
|
double |
stormf, |
|
|
double * |
inorglch |
|
) |
| |
74 for(lyr=0; lyr < numlyrs; lyr++) {
80 if ((wfluxout[lyr] > 0.0) && (nitrate[lyr] > 1.0E-10)) {
81 linten =
min(1.0 - (critflow - wfluxout[lyr]) / critflow, 1.0);
82 linten =
max(linten, 0.0);
83 amtlea[lyr] = (frlechd[iel]) * nitrate[lyr] * linten;
86 if (lyr == numlyrs-1) {
87 strm_N = amtlea[lyr] * stormf;
89 if (amtlea[lyr] < nitrate[lyr]) {
90 nitrate[lyr] = nitrate[lyr] - amtlea[lyr];
91 nitrate[nxt] = nitrate[nxt] + (amtlea[lyr] - strm_N);
99 if (nitrate[nxt] >= 1.0E-10) {
100 base_N = nitrate[nxt] * basef;
101 nitrate[nxt] = nitrate[nxt] - base_N;
107 stream[iel+1] = stream[iel+1] + (strm_N + base_N);
108 *inorglch = strm_N + base_N;
#define min(a, b)
Definition: diffusiv.c:66
#define max(a, b)
Definition: diffusiv.c:67
#define MAXLYR
Definition: swconst.h:8