LandscapeDNDC 1.37.0
osu.h
1#ifndef M1D_MOD_WATERCYCLE_OSU_H
2#define M1D_MOD_WATERCYCLE_OSU_H
3
4#include "watercyclemodule.h"
5
6using std::string;
7
8
9
10/* WaterCycleOSU
11 * The class WaterCycleOSU contains all Methods and data from the WaterCycleOSU.
12 *
13 *
14*/
15class WaterCycleOSU : public WaterCycleModule {
16 public:
17
19 WaterCycleOSU(ModelCore & modelCore, unsigned int timeInterval) : WaterCycleModule(modelCore, timeInterval),
20 modelCore_(modelCore),
21 time_(modelCore.getLandscape().getTime()),
22 si_(modelCore.getInput().getSite()),
23 sipar_(modelCore.getInput().getParameter().getSitePar()),
24 sppar_(modelCore.getInput().getParameter().getSpeciesPar()),
25 ac_(modelCore.getSubstates().getAc()),
26 mc_(modelCore.getSubstates().getMc()),
27 sc_(modelCore.getSubstates().getSc()),
28 wc_(const_cast<WaterCycle &>(modelCore.getSubstates().getWc())),
29 ph_(modelCore.getSubstates().getPh()),
30 vs_(modelCore.getSubstates().getVs())
31 {
32 this->setName("WaterCycleOSU");
33 capmois = new double[LConf::slPotplus1]; // maximum water content per soil pore space (m m-3ps)
34 wiltmois = new double[LConf::slPotplus1]; // minimum water content per soil pore space (m m-3ps)
35 mois = new double[LConf::slPotplus1]; // relative water content
36 sks = new double[LConf::slPotplus1]; // saturated water conductivity (m s-1)
37 d_sl = new double[LConf::slPotplus1]; // depth
38 b_sl = new double[LConf::slPotplus1]; // proportion of the app. first meter soil
39 btmp_sl = new double[LConf::slPotplus1]; // proportion of the app. first meter soil
40 }
41
42 ~WaterCycleOSU() {
43 delete[]capmois; // maximum water content per soil pore space (m m-3ps)
44 delete[]wiltmois; // minimum water content per soil pore space (m m-3ps)
45 delete[]mois; // relative water content
46 delete[]sks; // saturated water conductivity (m s-1)
47 delete[]d_sl; // depth
48 delete[]b_sl; // proportion of the app. first meter soil
49 delete[]btmp_sl; // proportion of the app. first meter soil
50 }
51
52 void solve() {
53 this->run_();
54 }
55
56
57 private:
58 // internal variables
59 double lv_ts; // latent heat of evaporation [MJ.kg-1]
60 double vps,hum_ts; // vapor pressure deficit and relative humidity
61 double tempK_ts,temp_lK_ts;
62 double h_slCum,h_flCum,h_slSum; // cumulative soil and canopy thickness
63 double lai; // total leaf area index
64 double alb; // relative fraction of incoming radiation that is reflected
65 double rdepth; // root depth [m]
66 double leaf_water; // water at the foliage surface [mm]
67 double surf_water; // surface water in liquid state [mm]
68 double snow_water; // surface water in solid state (snow) [mm]
69 double dthmeteodata; // time step driving meteo data in hours
70 double dtmin; // model time step in minutes
71 double dts; // model time step in seconds
72 double tsread; // calculations per time step
73 double flai_vt; // fraction of ecosystem-leaf area of a vegetation type
74
75 double ALPHA; // Van Genuchten parameter (from http://eusoils.jrc.it/ESDB_Archive/ESDBv2/esdb/Hypres/Hypres_param.doc)
76 double M; // Van Genuchten parameter
77 double ST; // saturated soil water tension [m] (all values according to Chen and Dudhia 2001)
78 double B; // hydraulic conductivity parameter (all values according to Chen and Dudhia 2001)
79
80 double RGL; // threshold value for radiation response (W m-2)
81 double Z0M; // roughness length (m)
82 double RCMAX; // maximum canopy resistance (s m-1)
83 double INTCEPTMAX; // interception capacity of foliage (mm m-2)
84 double RCMIN; // minimum canopy resistance (s m-1)
85 double HEIGHT; // total canopy height (m)
86
87 // TIME LOOP SOLVING DIFFERENTIAL EQUATION FOR HEAT AND MOISTURE
88 double fns;
89 double ftsi;
90 double prec_tsi; // precipitation (mm per module timestep)
91 double evacep_tsi;
92 double evasoil_tsi;
93 double evasurf_tsi;
94 double transp_tsi;
95 double through_tsi;
96 double percol_tsi;
97 double runoff_tsi;
98 double etotal_ts;
99 double potEvapo_day; // potential evaporation (mm day-1)
100
101 double *capmois; // maximum water content per soil pore space (m m-3ps)
102 double *wiltmois; // minimum water content per soil pore space (m m-3ps)
103 double *mois; // relative water content
104 double *sks; // saturated water conductivity (m s-1)
105 double *d_sl; // depth
106 double *b_sl; // proportion of the app. first meter soil
107 double *btmp_sl; // proportion of the app. first meter soil
108
109 ModelCore & modelCore_;
110 Timer & time_;
111 Site & si_;
112 SitePar & sipar_;
113 SpeciesPar & sppar_;
114
115 AirChemistry const & ac_;
116 MicroClimate const & mc_;
117 SoilChemistry const & sc_;
118 WaterCycle & wc_;
119 Physiology const & ph_;
120 VegStructure const & vs_;
121
122 // declaration of module specific parameters
123 static const int EDREF; // maximum soil evaporation depth (mm), Mertens and Cabelguenne 1974 (Cabelguenne and Debaeke 1998)
124 static const int INREF; // maximum infiltration depth (mm)
125 static const int IITERMAX; // iteration step for foliage evaporation
126 static const double SWATMAX; // maximum water at the soil surface [mm] (Leriche et al. 2001 for Lampto Savannas: 22)
127 static const double FRUNOFF; // fraction of surface water that goes into runoff [s-1]
128 static const double MCOEFF_S; // snow melt coefficient (mm s-1 oC-1): Semadeni-Davies (2-3 mm K-1 day-1): 0.0025; Cienciala et al. 1998: 0.0015; Zhang et al. 2002: 0.007 (probably after Running & Goughlan 1988
129 static const double KDTREF; // adjustment parameter (Chen et Dudhia 2001)
130 static const double KREF; // reference hydraulic conductivity [m s-1] (Chen et Dudhia 2001)
131 static const double TREF; // reference temperature for stomatal responses
132 static const double CZR; // BROOK90 assumption
133 static const double CZS; // BROOK90 assumption
134 static const double HR; // BROOK90 assumption
135 static const double HS; // BROOK90 assumption
136 static const double DTMIN0; // internal model time step in minutes (should depend on soil layer depth)
137
138 // Main function
139 void SolvMois();
140
141 inline double Max(double x, double y){
142 return (x > y) ? x : y;
143 }
144
145 inline double Min(double x, double y){
146 return (x > y) ? y : x;
147 }
148
149
150 // Maximum infiltration [mmd-1] Chen et Dudhia 2001 eq 35c
151 double CalcMaxInf
152 (double surf_water,double *mois_sl,double *b_sl);
153
154 double CalcCanEvaTrans
155 (double tempVirPot,double omegavs,
156 double omegav,double vps);
157
158 // hydraulic conductivity [m.s-1] after Clapp Hornberger 1978 (also Cosby et al. 1984, cit. in Chen and Dudhia 2001)
159 double HydCon(int sl,double*mois);
160
161 // hydraulic conductivity [m.s-1] after Van Genuchten 1976
162 double HydConVanGenuchten(int sl, double fH2O);
163
164 // soil water diffusivity conductivity / derivee de moisture par rapport a la tension
165 double SoilWatDif(int sl);
166
167 // soil water diffusivity conductivity / derivee de moisture par rapport a la tension after Van Genuchten 1976
168 void VanGenuchten
169 (int sl, double fH2O,double &k,double &fwat);
170
171 // Mass mixing ratio of water vapor
172 inline double MassMixRatWatVap(double psfc,double vp) {
173 return (0.622 * vp / (0.1 * psfc - vp));
174 }
175
176 // slope of saturated water vapor pressure
177 inline double SlopeSatWatVapPre(double temp,double vps){
178 return (4098.0 * vps / Sqr(temp - 35.85));
179 }
180
181 // slope of saturated specific humidity K-1
182 inline double SlopSatSpeHum(double psfc,double temp,double vps){
183 return (0.622 * psfc * SlopeSatWatVapPre(temp,vps) / Sqr((psfc - 0.378 * vps)));
184 }
185
186 // calculation of wet canopy evaporation [mm.d-1]
187 double CalcCanEva(double leaf_water);
188
189 /*----------------------------------------------
190 mathematical functions
191 ----------------------------------------------*/
192
193 inline double Sqr(double x){
194 return (x * x);
195 }
196
197 inline double Power(double x,double y){
198 double pow;
199
200 if (x <= 0.0)
201 pow = 0.0;
202 else
203 pow = exp(y*log(x));
204
205 return (pow);
206 }
207
208 inline double Abs(double x){
209 return ( x < 0.0) ? -x : x;
210 }
211
212 void run_();
213};
214
215#endif // M1D_MOD_WATERCYCLE_OSU_H
216