-
Notifications
You must be signed in to change notification settings - Fork 23
/
CanopyResistance.c
executable file
·84 lines (69 loc) · 2.3 KB
/
CanopyResistance.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
/*
* SUMMARY: CanopyResistance.c - Calculate canopy resistance
* USAGE: Part of DHSVM
*
* AUTHOR: Bart Nijssen
* ORG: University of Washington, Department of Civil Engineering
* E-MAIL: nijssen@u.washington.edu
* ORIG-DATE: Apr-96
* DESCRIPTION: Calculate canopy resistance
* DESCRIP-END.
* FUNCTIONS: CanopyResistance()
* COMMENTS:
* $Id: CanopyResistance.c,v 1.4 2003/07/01 21:26:11 olivier Exp $
*/
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include "settings.h"
#include "massenergy.h"
#include "constants.h"
/*****************************************************************************
CanopyResistance()
*****************************************************************************/
float CanopyResistance(float LAI, float RsMin, float RsMax, float Rpc,
float VpdThres, float MoistThres, float WP,
float TSoil, float SoilMoisture, float Vpd, float Rp)
{
float MoistFactor; /* multiplier for resistance due to soil
moisture feed-back */
float Resistance; /* Canopy resistance (s/m) */
float RpFactor; /* multiplier for resistance due to light
level feed-back */
float TFactor; /* multiplier for resistance due to soil
temperaure feed-back */
float VpdFactor; /* multiplier for resistance due to vapor
pressure deficit feed-back */
if (TSoil <= 0) {
Resistance = DHSVM_HUGE;
return Resistance;
}
/* for OBS */
TFactor = 1.0 / (0.176 + 0.0770 * TSoil - 0.0018 * TSoil * TSoil);
/* for OJP */
/* TFactor = 1.0/(.0705 * TSoil - 0.0013 * pow(TSoil, (double) 2.0)); */
if (TFactor <= 0) {
Resistance = DHSVM_HUGE;
return Resistance;
}
/* equation 14, Wigmosta et al [1994] */
if (Vpd >= VpdThres) {
Resistance = DHSVM_HUGE;
return Resistance;
}
else
VpdFactor = 1.0 / (1 - Vpd / VpdThres);
/* equation 15, Wigmosta et al [1994 */
RpFactor = 1.0 / ((RsMin / RsMax + Rp / Rpc) / (1 + Rp / Rpc));
/* equation 16, Wigmosta et al [1994] */
if (SoilMoisture <= WP) {
Resistance = DHSVM_HUGE;
return Resistance;
}
else if (SoilMoisture < MoistThres)
MoistFactor = (MoistThres - WP) / (SoilMoisture - WP);
else
MoistFactor = 1.0;
Resistance = TFactor * VpdFactor * RpFactor * MoistFactor * RsMin / LAI;
return Resistance;
}