The BioCro C++ Library
leaf_evapotranspiration_check.h
Go to the documentation of this file.
1#ifndef LEAF_EVAPOTRANSPIRATION_CHECK_H
2#define LEAF_EVAPOTRANSPIRATION_CHECK_H
3
4#include "../framework/module.h"
5#include "../framework/state_map.h"
6#include "water_and_air_properties.h" // for TempToCp, dry_air_density, etc
8
9namespace standardBML
10{
21class leaf_evapotranspiration_check : public direct_module
22{
23 public:
24 leaf_evapotranspiration_check(state_map const& input_quantities, state_map* output_quantities)
25 : direct_module{},
26
27 // Get pointers to input quantities
28 absorbed_shortwave{get_input(input_quantities, "absorbed_shortwave")},
29 atmospheric_pressure{get_input(input_quantities, "atmospheric_pressure")},
30 canopy_height{get_input(input_quantities, "canopy_height")},
31 Gs{get_input(input_quantities, "Gs")},
32 leaf_temperature{get_input(input_quantities, "leaf_temperature")},
33 leafwidth{get_input(input_quantities, "leafwidth")},
34 min_gbw_canopy{get_input(input_quantities, "min_gbw_canopy")},
35 rh{get_input(input_quantities, "rh")},
36 temp{get_input(input_quantities, "temp")},
37 wind_speed_height{get_input(input_quantities, "wind_speed_height")},
38 windspeed{get_input(input_quantities, "windspeed")},
39
40 // Get pointers to output quantities
41 leaf_temp_check_op{get_op(output_quantities, "leaf_temp_check")}
42 {
43 }
44 static string_vector get_inputs();
45 static string_vector get_outputs();
46 static std::string get_name() { return "leaf_evapotranspiration_check"; }
47
48 private:
49 // Pointers to input quantities
50 double const& absorbed_shortwave;
51 double const& atmospheric_pressure;
52 double const& canopy_height;
53 double const& Gs;
54 double const& leaf_temperature;
55 double const& leafwidth;
56 double const& min_gbw_canopy;
57 double const& rh;
58 double const& temp;
59 double const& wind_speed_height;
60 double const& windspeed;
61
62 // Pointers to output quantities
63 double* leaf_temp_check_op;
64
65 // Main operation
66 void do_operation() const;
67};
68
70{
71 return {
72 "absorbed_shortwave", // J / m^2 / s
73 "atmospheric_pressure", // Pa
74 "canopy_height", // m
75 "Gs", // mol / m^2 / s
76 "leaf_temperature", // degrees C
77 "leafwidth", // m
78 "min_gbw_canopy", // m / s
79 "rh", // dimensionless from Pa / Pa
80 "temp", // degrees C
81 "wind_speed_height", // m
82 "windspeed" // m / s
83 };
84}
85
87{
88 return {
89 "leaf_temp_check" // degrees C
90 };
91}
92
93void leaf_evapotranspiration_check::do_operation() const
94{
95 // Get absorbed longwave radiation
96 double const absorbed_longwave =
97 1.0 * physical_constants::stefan_boltzmann *
98 pow(conversion_constants::celsius_to_kelvin + temp, 4); // J / m^2 / s
99
100 // Get canopy boundary layer conductance to water vapor
101 double const gbw_canopy = canopy_boundary_layer_conductance_thornley(
102 canopy_height,
103 windspeed,
104 min_gbw_canopy,
105 wind_speed_height); // m / s
106
107 // Set some constants
108 double constexpr epsilon_s = 1.0; // dimensionless
109
110 // Get water vapor and air properties based on the air temperature
111 double const c_p = TempToCp(temp); // J / kg / K
112 double const lambda = water_latent_heat_of_vaporization_henderson(temp); // J / kg
113 double const p_w_sat_air = saturation_vapor_pressure(temp); // Pa
114 double const rho_ta = dry_air_density(temp, atmospheric_pressure); // kg / m^3
115 double const s = TempToSFS(temp); // kg / m^3 / K
116
117 // Get the pyschrometric parameter
118 double const gamma = rho_ta * c_p / lambda; // kg / m^3 / K
119
120 // Get vapor density in the ambient air.
121 double const p_w_air = p_w_sat_air * rh; // Pa
122
123 double const rho_w_air =
124 vapor_density_from_pressure(rho_ta, atmospheric_pressure, p_w_air); // kg / m^3
125
126 // Get vapor density deficit
127 double const rho_w_sat =
128 vapor_density_from_pressure(rho_ta, atmospheric_pressure, p_w_sat_air); // kg / m^3
129
130 double const Delta_rho = rho_w_sat - rho_w_air; // kg / m^3
131
132 // Get total absorbed light energy (longwave and shortwave)
133 double const J_a = absorbed_shortwave + absorbed_longwave; // J / m^2 / s
134
135 // Get the temperature difference
136 double const leaf_temp_check = check_leaf_temp(
137 atmospheric_pressure,
138 temp,
139 Delta_rho,
140 epsilon_s,
141 gamma,
142 gbw_canopy,
143 J_a,
144 lambda,
145 leaf_temperature,
146 leafwidth,
147 s,
148 Gs,
149 windspeed);
150
151 update(leaf_temp_check_op, leaf_temp_check);
152}
153
154} // namespace standardBML
155#endif
double canopy_boundary_layer_conductance_thornley(double CanopyHeight, double WindSpeed, double minimum_gbw, double WindSpeedHeight)
Calculates the conductance for water vapor flow from the canopy across its boundary layer using a mod...
Uses check_leaf_temp() to calculate a temperature difference.
leaf_evapotranspiration_check(state_map const &input_quantities, state_map *output_quantities)
double check_leaf_temp(double const air_pressure, double const air_temperature, double const Delta_rho, double const epsilon_s, double const gamma, double const gbw_canopy, double const J_a, double const lambda, double const leaf_temperature, double const leaf_width, double const s, double const stomatal_conductance, double const wind_speed)
Calculates a difference in leaf temperature; this function will return zero only if leaf temperature ...
This is the standard BioCro module library; it includes the essential modules used in typical BioCro ...
Definition: aba_decay.h:8
double TempToSFS(double air_temperature)
Determine the derivative of saturation water vapor density with respect to temperature at a particula...
double saturation_vapor_pressure(double air_temperature)
Determine saturation water vapor pressure (Pa) from air temperature (degrees C) using the Arden Buck ...
double TempToCp(double air_temperature)
Determine the specific heat capacity of dry air at constant pressure (c_p) at a particular value of a...
double dry_air_density(const double air_temperature, const double air_pressure)
Calculate the density of dry air from temperature and pressure using the ideal gas law.
double vapor_density_from_pressure(double density_of_dry_air, double total_pressure, double vapor_pressure)
Use Equation 14.5a from Thornley & Johnson (1990) to calculate water vapor density from water vapor p...
double water_latent_heat_of_vaporization_henderson(double temperature)
Determine the latent heat of vaporization of water from its temperature.