OpenSWMM Engine  6.0.0-alpha.1
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.1)
Loading...
Searching...
No Matches
openswmm::climate Namespace Reference

Classes

class  ClimateFileReader
 
struct  ClimateState
 
struct  DailyClimateRecord
 
struct  MovingAvg7
 

Enumerations

enum class  EvapMethod : int {
  CONSTANT = 0 ,
  MONTHLY = 1 ,
  TIMESERIES = 2 ,
  TEMPERATURE = 3 ,
  PAN = 4
}
 
enum class  ClimateFileFormat {
  UNKNOWN ,
  USER_PREPARED ,
  GHCND ,
  TD3200 ,
  DLY0204
}
 
enum  ClimateVar {
  TMIN = 0 ,
  TMAX = 1 ,
  EVAP = 2 ,
  WIND = 3
}
 Climate variable indices (matching legacy ClimateVarType) More...
 
enum  WindFieldType {
  WDMV = 0 ,
  AWND = 1
}
 Wind field type in GHCND. More...
 
enum  TempUnits {
  DEG_C10 = 0 ,
  DEG_C = 1 ,
  DEG_F = 2
}
 Temperature unit encoding in GHCND. More...
 

Functions

double hargreaves (double latitude, int day_of_year, double t_avg, double t_range)
 Compute Hargreaves evapotranspiration.
 
void updateDailyClimate (ClimateState &state, int day_of_year, int month)
 Update daily climate state.
 
void batchDistributeEvap (double evap_rate, const double *ponded_depth, double *evap_out, int n, double dt)
 Batch distribute evaporation to all subcatchments.
 
void updateTempTimes (ClimateState &state, int doy)
 Update sunrise/sunset parameters for sub-daily temperature interpolation.
 
double getSubdailyTemp (const ClimateState &state, double hour)
 Compute sub-daily temperature using a three-zone sinusoidal model.
 

Variables

constexpr double MM_PER_INCH = 25.40
 

Enumeration Type Documentation

◆ ClimateFileFormat

Enumerator
UNKNOWN 
USER_PREPARED 

StationID YYYY MM DD TMAX TMIN EVAP WIND.

GHCND 

NCDC Global Historical Climatology Network Daily.

TD3200 

NCDC TD3200 (NWS cooperative observer)

DLY0204 

Canadian DLY02/DLY04.

◆ ClimateVar

Climate variable indices (matching legacy ClimateVarType)

Enumerator
TMIN 
TMAX 
EVAP 
WIND 

◆ EvapMethod

enum class openswmm::climate::EvapMethod : int
strong
Enumerator
CONSTANT 
MONTHLY 
TIMESERIES 
TEMPERATURE 

Hargreaves method.

PAN 

◆ TempUnits

Temperature unit encoding in GHCND.

Enumerator
DEG_C10 
DEG_C 
DEG_F 

◆ WindFieldType

Wind field type in GHCND.

Enumerator
WDMV 
AWND 

Function Documentation

◆ batchDistributeEvap()

void openswmm::climate::batchDistributeEvap ( double  evap_rate,
const double *  ponded_depth,
double *  evap_out,
int  n,
double  dt 
)

Batch distribute evaporation to all subcatchments.

evap_out[i] = min(evap_rate, ponded_depth[i] / dt) This is a vectorisable clamp operation.

Parameters
evap_rateScalar evap rate (ft/sec).
ponded_depth[in] Per-subcatchment ponded depth (ft).
evap_out[out] Per-subcatchment actual evap rate (ft/sec).
nNumber of subcatchments.
dtTimestep (seconds).

◆ getSubdailyTemp()

double openswmm::climate::getSubdailyTemp ( const ClimateState state,
double  hour 
)

Compute sub-daily temperature using a three-zone sinusoidal model.

Matches legacy setTemp() in climate.c. Zones: (1) before sunrise — sinusoid from prev_tmax toward tmin; (2) sunrise to sunset-3 — sinusoid peaking at tmax; (3) after sunset-3 — sinusoid decaying from tmax. Requires updateTempTimes() to have been called for the current day.

Parameters
stateClimate state (uses tmin_daily, tmax_daily, prev_tmax, hrsr, hrss, hrday, dhrdy, dydif).
hourHour of day (0.0–24.0).
Returns
Air temperature (deg F).
See also
Legacy: setTemp() in climate.c

◆ hargreaves()

double openswmm::climate::hargreaves ( double  latitude,
int  day_of_year,
double  t_avg,
double  t_range 
)

Compute Hargreaves evapotranspiration.

Parameters
latitudeLatitude (degrees).
day_of_yearDay of year (1-365).
t_avgAverage temperature (deg F).
t_rangeTemperature range (deg F).
Returns
Evaporation rate (in/day for US, mm/day for SI).
Here is the caller graph for this function:

◆ updateDailyClimate()

void openswmm::climate::updateDailyClimate ( ClimateState state,
int  day_of_year,
int  month 
)

Update daily climate state.

Parameters
state[in/out] Climate state.
day_of_yearDay of year.
monthMonth (0-11).
Here is the call graph for this function:

◆ updateTempTimes()

void openswmm::climate::updateTempTimes ( ClimateState state,
int  doy 
)

Update sunrise/sunset parameters for sub-daily temperature interpolation.

Matches legacy updateTempTimes() in climate.c. Computes hrsr, hrss, hrday, dhrdy, dydif from latitude and day-of-year. Must be called once per day before calling getSubdailyTemp().

Parameters
state[in/out] Climate state (uses latitude, dtlong; writes hrsr etc.)
doyDay of year (1-365).

Variable Documentation

◆ MM_PER_INCH

constexpr double openswmm::climate::MM_PER_INCH = 25.40
constexpr