OpenSWMM Engine  6.0.0-alpha.1
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.1)
Loading...
Searching...
No Matches
Climate.hpp
Go to the documentation of this file.
1
20#ifndef OPENSWMM_CLIMATE_HPP
21#define OPENSWMM_CLIMATE_HPP
22
23namespace openswmm {
24
25struct SimulationContext;
26
27namespace climate {
28
29// ============================================================================
30// Constants
31// ============================================================================
32
33constexpr double MM_PER_INCH = 25.40;
34
35// ============================================================================
36// Evaporation method
37// ============================================================================
38
39enum class EvapMethod : int {
40 CONSTANT = 0,
41 MONTHLY = 1,
42 TIMESERIES = 2,
43 TEMPERATURE = 3,
44 PAN = 4
45};
46
47// ============================================================================
48// Daily climate state (scalar — broadcast to all subcatchments)
49// ============================================================================
50
52 double temperature = 70.0;
53 double temp_range = 0.0;
54 double evap_rate = 0.0;
55 double wind_speed = 0.0;
56 double humidity = 50.0;
57
58 // Derived values
59 double gamma = 0.0;
60 double ea = 0.0;
61
62 // Hargreaves parameters
63 double latitude = 0.0;
64
65 // Monthly evaporation table (for MONTHLY method)
66 double monthly_evap[12] = {};
67
68 // Monthly adjustment factors
69 double adjust_evap[12] = {1,1,1,1,1,1,1,1,1,1,1,1};
70 double adjust_temp[12] = {0,0,0,0,0,0,0,0,0,0,0,0};
71 double adjust_rain[12] = {1,1,1,1,1,1,1,1,1,1,1,1};
72
74
75 // Monthly adjustment for infiltration capacity (scales f0/fmin/Ks)
76 // @see Legacy: InfilFactor (set from hydcon adjustment pattern)
77 double infil_factor = 1.0;
78
79 // Recovery factor for infiltration models
80 // @see Legacy: Evap.recoveryFactor (set from recovery adjustment pattern)
81 double recovery_factor = 1.0;
82};
83
84// ============================================================================
85// Functions
86// ============================================================================
87
97double hargreaves(double latitude, int day_of_year, double t_avg, double t_range);
98
106void updateDailyClimate(ClimateState& state, int day_of_year, int month);
107
120void batchDistributeEvap(double evap_rate, const double* ponded_depth,
121 double* evap_out, int n, double dt);
122
123} // namespace climate
124} // namespace openswmm
125
126#endif // OPENSWMM_CLIMATE_HPP
void updateDailyClimate(ClimateState &state, int day_of_year, int month)
Update daily climate state.
Definition Climate.cpp:59
constexpr double MM_PER_INCH
Definition Climate.hpp:33
EvapMethod
Definition Climate.hpp:39
@ TEMPERATURE
Hargreaves method.
void batchDistributeEvap(double evap_rate, const double *ponded_depth, double *evap_out, int n, double dt)
Batch distribute evaporation to all subcatchments.
Definition Climate.cpp:96
double hargreaves(double latitude, int day_of_year, double t_avg, double t_range)
Compute Hargreaves evapotranspiration.
Definition Climate.cpp:21
Definition Controls.cpp:24
Definition Climate.hpp:51
double ea
Saturation vapor pressure.
Definition Climate.hpp:60
double latitude
Latitude (degrees)
Definition Climate.hpp:63
double recovery_factor
Definition Climate.hpp:81
double infil_factor
Definition Climate.hpp:77
double adjust_evap[12]
Definition Climate.hpp:69
EvapMethod evap_method
Definition Climate.hpp:73
double monthly_evap[12]
Definition Climate.hpp:66
double humidity
Relative humidity (%)
Definition Climate.hpp:56
double wind_speed
Wind speed (mph)
Definition Climate.hpp:55
double temp_range
Daily temperature range (deg F)
Definition Climate.hpp:53
double gamma
Psychrometric constant.
Definition Climate.hpp:59
double adjust_temp[12]
Definition Climate.hpp:70
double evap_rate
Evaporation rate (ft/sec)
Definition Climate.hpp:54
double adjust_rain[12]
Definition Climate.hpp:71
double temperature
Air temperature (deg F)
Definition Climate.hpp:52