SNOWPACK 3.7.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
25
26#include <string>
27#include <fstream>
28
78class Canopy {
79
80 public:
81 Canopy(const SnowpackConfig& i_cfg);
82
83 static void DumpCanopyHeader(std::ofstream &fout);
84 static void DumpCanopyUnits(std::ofstream &fout);
85 static void DumpCanopyData(std::ofstream &fout, const CanopyData *Cdata,
86 const SurfaceFluxes *Sdata, const double cos_sl);
87 bool runCanopyModel(CurrentMeteo &Mdata, SnowStation &Xdata,
88 const double& roughness_length, const double& height_of_wind_val,
89 const bool& adjust_VW_height=true);
90 static void writeTimeSeriesAdd2LCanopy(std::ofstream &fout, const CanopyData *Cdata);
91 //static const double can_alb_dry, can_alb_wet, can_alb_snow, krnt_lai; //public constants
92
93 private:
94 static double get_f1(const double& ris);
95
96 static double RootFraction(const double& zupper, const double& zlower, const double rootdepth);
97
98 void SoilWaterUptake(const size_t& SoilNode, const double& transpiration,
99 ElementData* EMS, const double wp_fraction,
100 const double rootdepth, const double h_wilt) const;
101
102 static double get_f4(const double& tempC);
103
104 static double get_f2f4(const size_t& SoilNode, ElementData* EMS,
105 const double wp_fraction,const double rootdepth);
106
107 static double get_f3(const double& vpd, const double f3_gd);
108
109 double IntCapacity(const CurrentMeteo& Mdata, const SnowStation& Xdata,
110 const bool& force_rain=false) const;
111
112 static double IntUnload(const double& capacity, const double& storage);
113
114 static double IntRate(const double& capacity, const double& storage, const double& prec,
115 const double& direct, const double interception_timecoef);
116
117 static double CanopyAlbedo(const double& tair, const double& wetfrac, const SnowStation& Xdata);
118
119 static double TotalAlbedo(double CanAlb, double sigf, double SurfAlb, double DirectThroughfall,
120 double CanopyClosureDirect, double RadFracDirect, double sigfdirect);
121
122 static double CanopyShadeSoilCover(const double& HEIGHT, const double& COVER, const double& ELEV, const double& can_diameter);
123
124 static double CanopyWetFraction(const double& capacity, const double& storage);
125
126 static double CanopyTransmissivity(const double& lai, const double& elev, const double krnt_lai);
127
128 void LineariseNetRadiation(const CurrentMeteo& Mdata,const CanopyData& Cdata, const SnowStation& Xdata,
129 double& iswrac, double& rsnet, double& ilwrac, double& r0,double& r1,
130 const double& canopyalb, double& CanopyClosureDirect, double& RadFracDirect,
131 const double& sigfdirect, double& r1p) const;
132
133 void LineariseNetRadiation2L(const CurrentMeteo& Mdata, const CanopyData& Cdata, const SnowStation& Xdata,
134 double& iswrac, double& rsnet, double& ilwrac, double& r0,double& r1, double& r2,
135 double& rt0, double& rt1, double& rt2, const double& canopyalb, double& CanopyClosureDirect, double& RadFracDirect,
136 const double& sigfdirect, const double& sigftrunkdirect, double& r1p, double& r2p) const;
137
138 static void LineariseSensibleHeatFlux(const double& ch_canopy, const double& tair, double& h0, double& h1, double scalingfactor);
139
140 static double DSaturationPressureDT(const double& L, const double& T);
141
142 static void LineariseLatentHeatFlux(const double& ce_canopy, const double& tc_old, const double& vpair,
143 double& le0, double& le1, double scalingfactor);
144
145 static void CalculateHeatMass(const double& height, const double& BasalArea, double& lai ,double& HMLeaves,
146 double& HMTrunks, const double biomass_density, const double biomass_heat_capacity);
147
148 void LineariseConductiveHeatFlux(const double& tc_old, const double& HM, double& HM0, double& HM1, const double& DT, const double& scalingfactor) const;
149
150 static void CanopyEnergyBalance(const double& h0, const double& h1, const double& le0,
151 const double& le1, const double& HM0, const double& HM1,
152 const double& ce_canopy,
153 const double& ce_condensation,
154 double& r0, double& r1, double& TCANOPY, double& RNCANOPY,
155 double& HCANOPY, double& LECANOPY);
156
157 static void CanopyEnergyBalance2L(double& h0, double& h1, double& le0,
158 double& le1, double& HM0, double& HM1, double& TT0, double& TT1,
159 const double& ce_canopy,
160 const double& ce_condensation,
161 double& r0, double& r1, double& r2, double& TCANOPY, double& Ttrunk, double& RNCANOPY,
162 double& HCANOPY, double& LECANOPY);
163
164 static void CanopyEvaporationComponents(const double& ce_canopy,
165 const double& ce_transpiration, double& LECANOPY,
166 const double& ta, const double& I, const double DT,
167 double& CanopyEvaporation,
168 double& INTEVAP, double& TRANSPIRATION,
169 double& RNCANOPY, double& HCANOPY,double& TCANOPY,
170 const double& r0, const double& r1, const double& h0, const double& h1,
171 double& LECANOPYCORR,
172 const double& wetfraction, const double& HM0, const double& HM1);
173
174 static void CanopyEvaporationComponents2L(const double& ce_canopy,
175 const double& ce_transpiration, double& LECANOPY,
176 const double& ta, const double& I, const double DT,
177 double& CanopyEvaporation,
178 double& INTEVAP, double& TRANSPIRATION,
179 double& RNCANOPY, double& HCANOPY,double& TCANOPY, double& Ttrunk,
180 const double& TT0, const double& TT1,
181 const double& r0, const double& r1, const double& r2, const double& h0, const double& h1,
182 double& LECANOPYCORR,
183 const double& wetfraction,
184 const double& HM0, const double& HM1);
185
186 static double get_psim(const double& xi);
187
188 static double get_psih(const double& xi);
189
190 static double RichardsonToAeta(double za, double TempAir, double DiffTemp, double Windspeed, double zom, double zoh, int maxitt);
191
192 void CanopyTurbulentExchange(const CurrentMeteo& Mdata, const double& refheight, const double& zomg,
193 const double& wetfraction, SnowStation& Xdata, double& ch_canopy,
194 double& ce_canopy, double& ce_transpiration,
195 double& ce_interception, double& ce_condensation) const;
196
197 void CanopyRadiationOutput(SnowStation& Xdata, const CurrentMeteo& Mdata, double ac,
198 double &iswrac, double &rswrac,
199 double &iswrbc, double &rswrbc, double &ilwrac,
200 double &rlwrac, double &ilwrbc, double &rlwrbc,
201 double CanopyClosureDirect, double RadFracDirect, double sigfdirect, double sigftrunkdirect) const;
202
203 std::string hn_density, hn_density_parameterization, variant, watertransportmodel_soil;
204 double hn_density_fixedValue, calculation_step_length;
205 bool useSoilLayers;
206 // variables for canopy heat mass and 2-layer canopy
207 bool CanopyHeatMass;
208 bool Twolayercanopy, Twolayercanopy_user;
209 bool canopytransmission;
210 bool forestfloor_alb;
211};
212
213#endif
Canopy data used as a pointer in the SnowStation structure.
Definition: DataClasses.h:437
Computes interception of precipitation and radiation, and reduction of windspeed in a canopy layer ab...
Definition: Canopy.h:78
static void DumpCanopyHeader(std::ofstream &fout)
Write header for 28 canopy parameters to Outfile, columns 65-92.
Definition: Canopy.cc:40
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:1575
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:122
Canopy(const SnowpackConfig &i_cfg)
Definition: Canopy.cc:177
static void DumpCanopyUnits(std::ofstream &fout)
Write units for 28 canopy parameters to Outfile, columns 65-92.
Definition: Canopy.cc:90
static void writeTimeSeriesAdd2LCanopy(std::ofstream &fout, const CanopyData *Cdata)
Definition: Canopy.cc:165
CurrentMeteo is the class of interpolated meteo data for the current calculation time step It contai...
Definition: DataClasses.h:83
ELEMENT DATA used as a pointer in the SnowStation structure NOTE on M below: this is the mass of an e...
Definition: DataClasses.h:285
Definition: DataClasses.h:604
Definition: SnowpackConfig.h:28
Definition: DataClasses.h:733