OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
SolarRadiation.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2//
3// Copyright 2026 Caleb Buahin
4//
5// Licensed under the Apache License, Version 2.0 (the "License");
6// you may not use this file except in compliance with the License.
7// You may obtain a copy of the License at
8//
9// http://www.apache.org/licenses/LICENSE-2.0
10//
11// Unless required by applicable law or agreed to in writing, software
12// distributed under the License is distributed on an "AS IS" BASIS,
13// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14// See the License for the specific language governing permissions and
15// limitations under the License.
16
83
84#ifndef OPENSWMM_ENGINE_TRANSPORT_SOLAR_RADIATION_HPP
85#define OPENSWMM_ENGINE_TRANSPORT_SOLAR_RADIATION_HPP
86
87namespace openswmm {
89struct SolarConfig;
90struct CloudConfig;
91}
92
94
96inline constexpr double kSolarConstant = 1367.0;
97
99inline constexpr double kStdPressureMb = 1013.25;
100
110 double declination_deg = 0.0;
111 double eq_time_min = 0.0;
112 double hour_angle_deg = 0.0;
113 double zenith_deg = 90.0;
114 double cos_zenith = 0.0;
115 double elevation_deg = 0.0;
117 double eccentricity = 1.0;
118};
119
132SolarPosition solarPosition(int day_of_year, double hour_local, double lat_deg,
133 double lon_deg, double tz_hours) noexcept;
134
138double airMass(double zenith_deg) noexcept;
139
141double pressureFromElevation(double elevation_m) noexcept;
142
151double birdClearSkyGHI(const SolarPosition& pos, double pressure_mb,
152 const SolarConfig& cfg) noexcept;
153
161double cloudShortwaveFactor(double cloud_fraction, double k, double n) noexcept;
162
171double cloudLongwaveFactor(double cloud_fraction, double k_lw) noexcept;
172
189void updateSolarForcing(SimulationContext& ctx) noexcept;
190
191} // namespace openswmm::transport::heat
192
193#endif // OPENSWMM_ENGINE_TRANSPORT_SOLAR_RADIATION_HPP
Definition BedExchange.cpp:37
double pressureFromElevation(double elevation_m) noexcept
Station pressure [mb] from elevation [m], standard atmosphere.
Definition SolarRadiation.cpp:135
SolarPosition solarPosition(int day_of_year, double hour_local, double lat_deg, double lon_deg, double tz_hours) noexcept
Sun position by the Spencer (1971) / NOAA formulation.
Definition SolarRadiation.cpp:56
double birdClearSkyGHI(const SolarPosition &pos, double pressure_mb, const SolarConfig &cfg) noexcept
Bird & Hulstrom clear-sky global horizontal irradiance [W/m²].
Definition SolarRadiation.cpp:140
void updateSolarForcing(SimulationContext &ctx) noexcept
Resolve Jin and C for this step into ctx.heat_state.
Definition SolarRadiation.cpp:236
double cloudShortwaveFactor(double cloud_fraction, double k, double n) noexcept
Cloud attenuation of shortwave, 1 − k·C^n (Kasten–Czeplak).
Definition SolarRadiation.cpp:213
double airMass(double zenith_deg) noexcept
Definition SolarRadiation.cpp:123
constexpr double kStdPressureMb
Sea-level standard pressure, millibars — Bird's pressure reference.
Definition SolarRadiation.hpp:99
constexpr double kSolarConstant
Solar constant, W/m² (Bird & Hulstrom 1981; WMO 1982).
Definition SolarRadiation.hpp:96
double cloudLongwaveFactor(double cloud_fraction, double k_lw) noexcept
Cloud enhancement of atmospheric emissivity, 1 + k_lw·C² (Bolz).
Definition SolarRadiation.cpp:222
Definition NodeCoupling.cpp:16
[CLOUD_COVER] — one fraction driving two modules (H6a, D-H6a-2).
Definition HeatData.hpp:223
Central, reentrant simulation context.
Definition SimulationContext.hpp:353
[SOLAR_RADIATION] — site geometry and Bird atmosphere (H6a).
Definition HeatData.hpp:174
Sun geometry at one instant. The SPA swap point's return type.
Definition SolarRadiation.hpp:109
double zenith_deg
Solar zenith angle.
Definition SolarRadiation.hpp:113
double declination_deg
Solar declination, +N.
Definition SolarRadiation.hpp:110
double elevation_deg
Definition SolarRadiation.hpp:115
double hour_angle_deg
Solar hour angle, 0 at solar noon.
Definition SolarRadiation.hpp:112
double cos_zenith
Clamped at 0 below the horizon.
Definition SolarRadiation.hpp:114
double eccentricity
Earth–sun distance correction E0 = (r0/r)², dimensionless.
Definition SolarRadiation.hpp:117
double eq_time_min
Equation of time, minutes.
Definition SolarRadiation.hpp:111