1.3.49
 
Loading...
Searching...
No Matches
EnergyBalanceModel.h
Go to the documentation of this file.
1
16#ifndef ENERGYBALANCEMODEL
17#define ENERGYBALANCEMODEL
18
19#include "Context.h"
20
21// -- constants -- //
22
24constexpr float cp_air_mol = 29.25f;
26constexpr float lambda_mol = 44000.f;
28constexpr float von_Karman_constant = 0.41f;
30constexpr float R = 8.314462618f;
31
32inline float esat_Pa(float T_K) {
33 float Tc = T_K - 273.15f;
34 // This is Clausius-Clapeyron equation (See Campbell and Norman pp. 41 Eq. 3.8). Note that temperature must be in Kelvin, and result is in Pascals
35 return 611.0f * expf(17.502f * Tc / (Tc + 240.97f));
36}
37
39
41public:
43
47
49
52 static int selfTest(int argc = 0, char **argv = nullptr);
53
55 void enableMessages();
56
58 void disableMessages();
59
61 void run();
62
64
67 void run(float dt);
68
70
73 void run(const std::vector<uint> &UUIDs);
74
76
80 void run(const std::vector<uint> &UUIDs, float dt);
81
83
86 void addRadiationBand(const char *band);
87
89
92 void addRadiationBand(const std::vector<std::string> &bands);
93
95
101
103
108 void enableAirEnergyBalance(float canopy_height_m, float reference_height_m);
109
111
115 void evaluateAirEnergyBalance(float dt_sec, float time_advance_sec);
116
118
123 void evaluateAirEnergyBalance(const std::vector<uint> &UUIDs, float dt_sec, float time_advance_sec);
124
126
129 void optionalOutputPrimitiveData(const char *label);
130
132 void printDefaultValueReport() const;
133
135
138 void printDefaultValueReport(const std::vector<uint> &UUIDs) const;
139
140private:
141 void evaluateSurfaceEnergyBalance(const std::vector<uint> &UUIDs, float dt);
142
144 helios::Context *context;
145
147 float temperature_default;
148
150 float wind_speed_default;
151
153 float air_temperature_default;
154
156 float air_humidity_default;
157
159 float pressure_default;
160
162 float gS_default;
163
165 float heatcapacity_default;
166
168 float Qother_default;
169
171 float surface_humidity_default;
172
173 bool air_energy_balance_enabled;
174
176 helios::vec3 canopy_dimensions;
177
178 float canopy_height_m;
179 float reference_height_m;
180
182 bool message_flag;
183
185 std::vector<std::string> radiation_bands;
186
188 std::vector<std::string> output_prim_data;
189};
190
191#endif