ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_IBSEBSolar.H File Reference

Sun position, clear-sky shortwave, and the ray cast that decides whether a building face is in shadow. More...

#include <AMReX_REAL.H>
#include <AMReX_GpuQualifiers.H>
#include <AMReX_Algorithm.H>
#include <AMReX_Array4.H>
#include <limits>
#include <ERF_NumericalConstants.H>
#include <cmath>
Include dependency graph for ERF_IBSEBSolar.H:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ibseb::RayMap
 

Namespaces

 ibseb
 

Enumerations

enum  ibseb::RayHit : int { ibseb::RAY_SKY = 0 , ibseb::RAY_GROUND = 1 , ibseb::RAY_BUILDING = 2 }
 What a ray from a face ends on. More...
 

Functions

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real ibseb::spencer_day_angle (amrex::Real day_of_year)
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real ibseb::day_of_year_at (amrex::Real day0, amrex::Real t_utc_s)
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real ibseb::solar_declination (amrex::Real day_of_year)
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real ibseb::equation_of_time (amrex::Real day_of_year)
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real ibseb::solar_hour_angle (amrex::Real time_utc_s, amrex::Real longitude_deg, amrex::Real day_of_year)
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real ibseb::orbital_hour_angle (double calday, amrex::Real longitude_rad)
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real ibseb::solar_zenith (amrex::Real latitude_deg, amrex::Real decl, amrex::Real hour_angle)
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real ibseb::solar_azimuth (amrex::Real latitude_deg, amrex::Real decl, amrex::Real hour_angle, amrex::Real zenith)
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real ibseb::earth_sun_distance_factor (amrex::Real day_of_year)
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void ibseb::sun_vector (amrex::Real zenith, amrex::Real azimuth, amrex::Real &sx, amrex::Real &sy, amrex::Real &sz)
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real ibseb::clear_sky_dni (amrex::Real cos_zenith, amrex::Real S0, amrex::Real tau, amrex::Real distance_factor)
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real ibseb::clear_sky_diffuse_h (amrex::Real cos_zenith, amrex::Real S0, amrex::Real tau, amrex::Real distance_factor, amrex::Real k_d)
 
int ibseb::ray_halo_cells (amrex::Real height, amrex::Real dx, amrex::Real sz_min)
 
amrex::Real ibseb::hemisphere_min_sz (int n_az, int n_el)
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real ibseb::hemisphere_ray_weight (int n_az, int n_el) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool ibseb::ray_blocked_walk (amrex::Real x0, amrex::Real y0, amrex::Real z0, amrex::Real sx, amrex::Real sy, amrex::Real sz, const RayMap &m, bool windowed, int oi, int oj)
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool ibseb::ray_blocked (amrex::Real x0, amrex::Real y0, amrex::Real z0, amrex::Real sx, amrex::Real sy, amrex::Real sz, const RayMap &m)
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool ibseb::ray_blocked_near (int ci0, int cj0, amrex::Real sx, amrex::Real sy, amrex::Real sz, const RayMap &m, int ci_ref, int cj_ref)
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int ibseb::ray_hit_landing (amrex::Real x0, amrex::Real y0, amrex::Real z0, amrex::Real sx, amrex::Real sy, amrex::Real sz, const RayMap &m, bool &landed, int &li, int &lj)
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int ibseb::ray_hit (amrex::Real x0, amrex::Real y0, amrex::Real z0, amrex::Real sx, amrex::Real sy, amrex::Real sz, const RayMap &m)
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void ibseb::hemisphere_direction (int dir, int nsign, int ia, int ie, int n_az, int n_el, amrex::Real &sx, amrex::Real &sy, amrex::Real &sz)
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool ibseb::landing_kept (int di, int dj, const RayMap &m) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE unsigned int ibseb::pack_landing (int di, int dj) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void ibseb::unpack_landing (unsigned int w, int &di, int &dj) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE unsigned int ibseb::ray_landing_word (amrex::Real x0, amrex::Real y0, amrex::Real z0, amrex::Real sx, amrex::Real sy, amrex::Real sz, const RayMap &m, int ci_f, int cj_f)
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool ibseb::ground_view_beam_up (amrex::Real sz, amrex::Real beam_ground) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real ibseb::ground_view_lit (int ci_f, int cj_f, int n_far, const unsigned int *land, const int *rays, int n_land, amrex::Real inv, amrex::Real sx, amrex::Real sy, amrex::Real sz, const RayMap &m)
 

Variables

constexpr int ibseb::landing_offset_max = 32767
 
constexpr unsigned int ibseb::landing_none = 0U
 The ray does not end on the ground. More...
 
constexpr unsigned int ibseb::landing_far = 1U
 The ray ends on the far field's open ground. More...
 

Detailed Description

Sun position, clear-sky shortwave, and the ray cast that decides whether a building face is in shadow.

The solar geometry (Spencer's declination and equation of time, the hour angle from UTC and the site longitude, the zenith, the clockwise-from-north azimuth, the Earth-Sun distance) is kept here: the radiation models use the CESM orbital formulation of ERF_OrbCosZenith.H, which gives no azimuth and has no equation of time; orbital_hour_angle() turns its calendar day into the hour angle these functions take, for erf.ibseb.sun_mode = two_stream. The clear-sky formulas follow Bird (1984) as used by the SLUCM branch. The ray cast is new here.

Sun vector convention. ibseb_sun_vector() returns the unit vector from a surface toward the sun, with azimuth measured clockwise from north: east is +x, north is +y, so s = (sin z sin a, sin z cos a, cos z) with z the zenith angle and a the azimuth. A face with outward normal n receives direct beam only when n . s > 0.

References: Spencer (1971); Duffie and Beckman (1991); Iqbal (1983); Bird and Hulstrom (1981).