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 <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.

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::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::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)
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real ibseb::column_top (const int *col_top, int ci, int cj, int i0, int j0, int bw, int bh, amrex::Real z_ground, amrex::Real dz)
 
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 int *col_top, int nx, int ny, int i0, int j0, int bw, int bh, amrex::Real x_lo, amrex::Real y_lo, amrex::Real dx, amrex::Real dy, amrex::Real dz, bool per_x, bool per_y, amrex::Real z_ground, amrex::Real z_max, amrex::Real max_path)
 
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 int *col_top, int nx, int ny, int i0, int j0, int bw, int bh, amrex::Real x_lo, amrex::Real y_lo, amrex::Real dx, amrex::Real dy, amrex::Real dz, bool per_x, bool per_y, amrex::Real z_ground, amrex::Real z_max, amrex::Real max_path)
 
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)
 

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. 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).