forked from jhamman/DHSVM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MaxRoadInfiltration.c
executable file
·47 lines (41 loc) · 1.25 KB
/
MaxRoadInfiltration.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
/*
* SUMMARY: MaxRoadInfiltration.c - Calculate area averaged road infiltration
* rate
* USAGE: Part of DHSVM
*
* AUTHOR: Bart Nijssen
* E-MAIL: [email protected]
* ORIG-DATE:
* DESCRIPTION: This subroutine calculates an area averaged maximum
* infiltration rate for the roads in a grid cell.
* DESCRIP-END.
* FUNCTIONS: MaxRoadInfiltration()
* COMMENTS:
* $Id: MaxRoadInfiltration.c,v 1.4 2003/07/01 21:26:21 olivier Exp $
*/
#include <assert.h>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include "settings.h"
#include "data.h"
#include "DHSVMChannel.h"
#include "functions.h"
/*****************************************************************************
Function name: MaxRoadInfiltration()
*****************************************************************************/
float MaxRoadInfiltration(ChannelMapPtr **map, int col, int row)
{
ChannelMapPtr cell = map[col][row];
float area;
float infiltration = 0.0;
float tot_area = 0.;
while (cell != NULL) {
area = cell->length * cell->cut_width;
infiltration += area * cell->channel->class2->infiltration;
tot_area += area;
cell = cell->next;
}
infiltration /= tot_area;
return infiltration;
}