SNOWPACK  SNOWPACK-3.6.0
Canopy.h
Go to the documentation of this file.
1 /*
2  * SNOWPACK stand-alone
3  *
4  * Copyright WSL Institute for Snow and Avalanche Research SLF, DAVOS, SWITZERLAND
5 */
6 /* This file is part of Snowpack.
7  Snowpack is free software: you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation, either version 3 of the License, or
10  (at your option) any later version.
11 
12  Snowpack is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with Snowpack. If not, see <http://www.gnu.org/licenses/>.
19 */
20 
21 #ifndef CANOPY_H
22 #define CANOPY_H
23 
24 #include <snowpack/DataClasses.h>
25 
26 #include <string>
27 #include <fstream>
28 
78 class Canopy {
79 
80  public:
81  Canopy(const SnowpackConfig& i_cfg);
82 
83  static void DumpCanopyData(std::ofstream &fout, const CanopyData *Cdata, const SurfaceFluxes *Sdata, const double cos_sl);
84  bool runCanopyModel(CurrentMeteo &Mdata, SnowStation &Xdata, const double& roughness_length,
85  const double& height_of_wind_val, const bool& adjust_VW_height=true);
86  static void writeTimeSeriesAdd2LCanopy(std::ofstream &fout, const CanopyData *Cdata);
87  static const double can_alb_dry, can_alb_wet, can_alb_snow, krnt_lai; //public constants
88 
89  private:
90  static double get_f1(const double& ris);
91  static double RootFraction(const double& zupper, const double& zlower);
92  void SoilWaterUptake(const size_t& SoilNode, const double& transpiration, ElementData* EMS) const;
93  static double get_f4(const double& tempC);
94  static double get_f2f4(const size_t& SoilNode, ElementData* EMS);
95  static double get_f3(const double& vpd);
96  double IntCapacity(const CurrentMeteo& Mdata, const SnowStation& Xdata, const bool& force_rain=false) const;
97  static double IntUnload(const double& capacity, const double& storage);
98  static double IntRate(const double& capacity, const double& storage, const double& prec,
99  const double& direct);
100 
101  static double CanopyAlbedo(const double& tair, const double& wetfrac);
102  static double TotalAlbedo(double CanAlb, double sigf, double SurfAlb, double DirectThroughfall,
103  double CanopyClosureDirect, double RadFracDirect, double sigfdirect);
104 
105  static double CanopyShadeSoilCover(const double& HEIGHT, const double& COVER, const double& ELEV);
106  static double CanopyWetFraction(const double& capacity, const double& storage);
107  static double CanopyTransmissivity(const double& lai, const double& elev);
108 
109  void LineariseNetRadiation(const CurrentMeteo& Mdata,const CanopyData& Cdata, const SnowStation& Xdata,
110  double& iswrac, double& rsnet, double& ilwrac, double& r0,double& r1,
111  const double& canopyalb, double& CanopyClosureDirect, double& RadFracDirect,
112  const double& sigfdirect, double& r1p) const;
113  void LineariseNetRadiation2L(const CurrentMeteo& Mdata, const CanopyData& Cdata, const SnowStation& Xdata,
114  double& iswrac, double& rsnet, double& ilwrac, double& r0,double& r1, double& r2,
115  double& rt0, double& rt1, double& rt2, const double& canopyalb, double& CanopyClosureDirect, double& RadFracDirect,
116  const double& sigfdirect, const double& sigftrunkdirect, double& r1p, double& r2p) const;
117  static void LineariseSensibleHeatFlux(const double& ch_canopy, const double& tair, double& h0, double& h1, double scalingfactor);
118 
119  static double DSaturationPressureDT(const double& L, const double& T);
120  static void LineariseLatentHeatFlux(const double& ce_canopy, const double& tc_old, const double& vpair,
121  double& le0, double& le1, double scalingfactor);
122  static void CalculateHeatMass(const double& height, const double& BasalArea, double& lai ,double& HMLeaves, double& HMTrunks);
123 
124  void LineariseConductiveHeatFlux(const double& tc_old, const double& HM, double& HM0, double& HM1, const double& DT, const double& scalingfactor) const;
125 
126  static void CanopyEnergyBalance(const double& h0, const double& h1, const double& le0,
127  const double& le1, const double& HM0, const double& HM1,
128  const double& ce_canopy,
129  const double& ce_condensation,
130  double& r0, double& r1, double& TCANOPY, double& RNCANOPY,
131  double& HCANOPY, double& LECANOPY);
132 
133  static void CanopyEnergyBalance2L(double& h0, double& h1, double& le0,
134  double& le1, double& HM0, double& HM1, double& TT0, double& TT1,
135  const double& ce_canopy,
136  const double& ce_condensation,
137  double& r0, double& r1, double& r2, double& TCANOPY, double& Ttrunk, double& RNCANOPY,
138  double& HCANOPY, double& LECANOPY);
139 
140  static void CanopyEvaporationComponents(const double& ce_canopy,
141  const double& ce_transpiration, double& LECANOPY,
142  const double& ta, const double& I, const double DT,
143  double& CanopyEvaporation,
144  double& INTEVAP, double& TRANSPIRATION,
145  double& RNCANOPY, double& HCANOPY,double& TCANOPY,
146  const double& r0, const double& r1, const double& h0, const double& h1,
147  double& LECANOPYCORR,
148  const double& wetfraction, const double& HM0, const double& HM1);
149 
150  static void CanopyEvaporationComponents2L(const double& ce_canopy,
151  const double& ce_transpiration, double& LECANOPY,
152  const double& ta, const double& I, const double DT,
153  double& CanopyEvaporation,
154  double& INTEVAP, double& TRANSPIRATION,
155  double& RNCANOPY, double& HCANOPY,double& TCANOPY, double& Ttrunk,
156  const double& TT0, const double& TT1,
157  const double& r0, const double& r1, const double& r2, const double& h0, const double& h1,
158  double& LECANOPYCORR,
159  const double& wetfraction,
160  const double& HM0, const double& HM1);
161  static double get_psim(const double& xi);
162  static double get_psih(const double& xi);
163  static double RichardsonToAeta(double za, double TempAir, double DiffTemp, double Windspeed, double zom, double zoh, int maxitt);
164 
165  void CanopyTurbulentExchange(const CurrentMeteo& Mdata, const double& refheight, const double& zomg,
166  const double& wetfraction, SnowStation& Xdata, double& ch_canopy,
167  double& ce_canopy, double& ce_transpiration,
168  double& ce_interception, double& ce_condensation) const;
169 
170  void CanopyRadiationOutput(SnowStation& Xdata, const CurrentMeteo& Mdata, double ac,
171  double &iswrac, double &rswrac,
172  double &iswrbc, double &rswrbc, double &ilwrac,
173  double &rlwrac, double &ilwrbc, double &rlwrbc,
174  double CanopyClosureDirect, double RadFracDirect, double sigfdirect, double sigftrunkdirect) const;
175 
176  static const double int_cap_snow, int_cap_rain, interception_timecoef;
177  static const bool canopy_stabilitycorrection;
178  static const double can_diameter, roughmom_to_canopyheight_ratio, displ_to_canopyheight_ratio, raincrease_snow;
179  static const double canopytemp_maxchange_perhour, roughheat_to_roughmom_ratio, can_ch0, can_rs_mult, rsmin;
180  static const double f3_gd, rootdepth, wp_fraction;
181 
182  std::string hn_density, hn_density_parameterization, variant, watertransportmodel_soil;
183  double hn_density_fixedValue, calculation_step_length;
184  bool useSoilLayers;
185  // variables for canopy heat mass and 2-layer canopy
186  bool CanopyHeatMass;
187  bool Twolayercanopy, Twolayercanopy_user;
188  bool canopytransmission;
189  bool forestfloor_alb;
190  static const double biomass_heat_capacity, biomass_density, lai_frac_top_default, trunk_frac_height, trunkalb, et;
191 };
192 
193 #endif
Canopy data used as a pointer in the SnowStation structureINSTANTANEOUS VARIABLESCanopy "state" varia...
Definition: DataClasses.h:379
Definition: SnowpackConfig.h:28
ELEMENT DATA used as a pointer in the SnowStation structure NOTE on M below: this is the mass of an e...
Definition: DataClasses.h:251
Computes interception of precipitation and radiation, and reduction of windspeed in a canopy layer ab...
Definition: Canopy.h:78
static const double can_alb_wet
Definition: Canopy.h:87
Definition: DataClasses.h:589
static const double can_alb_dry
RADIATION BALANCE.
Definition: Canopy.h:87
CurrentMeteo is the class of interpolated meteo data for the current calculation time step It contai...
Definition: DataClasses.h:81
static const double krnt_lai
Definition: Canopy.h:87
static void DumpCanopyData(std::ofstream &fout, const CanopyData *Cdata, const SurfaceFluxes *Sdata, const double cos_sl)
Dump 28 canopy parameters to Outfile, columns 65-92.
Definition: Canopy.cc:123
static void writeTimeSeriesAdd2LCanopy(std::ofstream &fout, const CanopyData *Cdata)
Definition: Canopy.cc:165
Canopy(const SnowpackConfig &i_cfg)
Definition: Canopy.cc:177
Station data including all information on snowpack layers (elements and nodes) and on canopy This is...
Definition: DataClasses.h:468
static const double can_alb_snow
Definition: Canopy.h:87
bool runCanopyModel(CurrentMeteo &Mdata, SnowStation &Xdata, const double &roughness_length, const double &height_of_wind_val, const bool &adjust_VW_height=true)
MAIN CANOPY FUNCTION CALLED BY Meteo.c This routine computes interception of precipitation and radiat...
Definition: Canopy.cc:1559