1#ifndef M1D_MOD_WATERCYCLE_OSU_H
2#define M1D_MOD_WATERCYCLE_OSU_H
4#include "watercyclemodule.h"
15class WaterCycleOSU :
public WaterCycleModule {
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())
32 this->setName(
"WaterCycleOSU");
33 capmois =
new double[LConf::slPotplus1];
34 wiltmois =
new double[LConf::slPotplus1];
35 mois =
new double[LConf::slPotplus1];
36 sks =
new double[LConf::slPotplus1];
37 d_sl =
new double[LConf::slPotplus1];
38 b_sl =
new double[LConf::slPotplus1];
39 btmp_sl =
new double[LConf::slPotplus1];
61 double tempK_ts,temp_lK_ts;
62 double h_slCum,h_flCum,h_slSum;
109 ModelCore & modelCore_;
115 AirChemistry
const & ac_;
116 MicroClimate
const & mc_;
117 SoilChemistry
const & sc_;
119 Physiology
const & ph_;
120 VegStructure
const & vs_;
123 static const int EDREF;
124 static const int INREF;
125 static const int IITERMAX;
126 static const double SWATMAX;
127 static const double FRUNOFF;
128 static const double MCOEFF_S;
129 static const double KDTREF;
130 static const double KREF;
131 static const double TREF;
132 static const double CZR;
133 static const double CZS;
134 static const double HR;
135 static const double HS;
136 static const double DTMIN0;
141 inline double Max(
double x,
double y){
142 return (x > y) ? x : y;
145 inline double Min(
double x,
double y){
146 return (x > y) ? y : x;
152 (
double surf_water,
double *mois_sl,
double *b_sl);
154 double CalcCanEvaTrans
155 (
double tempVirPot,
double omegavs,
156 double omegav,
double vps);
159 double HydCon(
int sl,
double*mois);
162 double HydConVanGenuchten(
int sl,
double fH2O);
165 double SoilWatDif(
int sl);
169 (
int sl,
double fH2O,
double &k,
double &fwat);
172 inline double MassMixRatWatVap(
double psfc,
double vp) {
173 return (0.622 * vp / (0.1 * psfc - vp));
177 inline double SlopeSatWatVapPre(
double temp,
double vps){
178 return (4098.0 * vps / Sqr(temp - 35.85));
182 inline double SlopSatSpeHum(
double psfc,
double temp,
double vps){
183 return (0.622 * psfc * SlopeSatWatVapPre(temp,vps) / Sqr((psfc - 0.378 * vps)));
187 double CalcCanEva(
double leaf_water);
193 inline double Sqr(
double x){
197 inline double Power(
double x,
double y){
208 inline double Abs(
double x){
209 return ( x < 0.0) ? -x : x;