26 real (c_double),
intent(in) :: domega_s
29 dn = 24_c_double /
pi * domega_s
79 real (c_double),
intent(in) :: dlatitude
80 real (c_double),
intent(in) :: ddelta
81 real (c_double),
intent(in) :: domega_s
82 real (c_double),
intent(in) :: ddsubr
85 real (c_double) :: dra
86 real (c_double) :: dparta, dpartb
87 real (c_double),
parameter :: dgsc = 0.0820_c_double
89 dparta = domega_s * sin( dlatitude ) * sin( ddelta )
90 dpartb = cos( dlatitude ) * cos( ddelta ) * sin( domega_s )
92 dra = 24_c_double * 60_c_double * dgsc * ddsubr * ( dparta + dpartb ) /
pi
114 real(c_double),
intent(in) :: drs
115 real(c_double),
intent(in) :: dalbedo
118 real(c_double) :: drns
120 drns = (1_c_double - dalbedo) * drs
140 integer (c_int),
intent(in) :: idayofyear
141 integer (c_int),
intent(in) :: inumdaysinyear
142 real (c_double) :: ddelta
144 ddelta = 0.409_c_double &
145 * sin( (
twopi * real(idayofyear, c_double) / real(inumdaysinyear, c_double) ) &
169 integer (c_int),
intent(in) :: idayofyear
170 integer (c_int),
intent(in) :: inumdaysinyear
171 real (c_double) :: ddelta
174 real (c_double) :: dgamma
178 ddelta = 0.006918_c_double &
179 - 0.399912_c_double * cos( dgamma ) &
180 + 0.070257_c_double * sin( dgamma ) &
181 - 0.006758_c_double * cos( 2.0_c_double * dgamma ) &
182 + 0.000907_c_double * sin( 2.0_c_double * dgamma ) &
183 - 0.002697_c_double * cos( 3.0_c_double * dgamma ) &
184 + 0.00148_c_double * sin( 3.0_c_double * dgamma )
217 integer (c_int),
intent(in) :: idayofyear
218 integer (c_int),
intent(in) :: inumdaysinyear
219 real (c_double) :: ddsubr
221 ddsubr = 1.0_c_double + 0.033_c_double &
222 * cos(
twopi * real( idayofyear, c_double ) &
223 / real( inumdaysinyear, c_double ) )
247 real (c_double),
intent(in) :: dlatitude
248 real (c_double),
intent(in) :: ddelta
249 real (c_double) :: domega_s
251 domega_s = acos( - tan(dlatitude) * tan(ddelta) )
276 real (c_double),
intent(in) :: dra
277 real (c_float),
intent(in) :: ftmin
278 real (c_float),
intent(in) :: ftmax
279 real (c_double) :: drs
282 real (c_double),
parameter :: dkrs = 0.175
283 real (c_double) :: tmink
284 real (c_double) :: tmaxk
286 tmink =
c_to_k(real(ftmin, c_double))
287 tmaxk =
c_to_k(real(ftmax, c_double))
289 drs = dkrs * sqrt( tmaxk - tmink ) * dra
309 real (c_float),
intent(in) :: ftmax
310 real (c_float),
intent(in) :: ftmin
311 real (c_float) :: fpsun
314 real (c_float),
parameter :: fkrs = 0.175
316 fpsun = ( 2_c_float * fkrs * sqrt( ftmax - ftmin ) ) - 0.5_c_float
318 if ( fpsun < 0_c_float )
then
320 elseif ( fpsun > 1.0_c_float )
then
323 fpsun = fpsun * 100_c_float
351 real (c_double),
intent(in) :: dra
352 real (c_double),
intent(in),
optional :: das
353 real (c_double),
intent(in),
optional :: dbs
354 real (c_double) :: drso
357 real (c_double) :: das_l
358 real (c_double) :: dbs_l
361 if (
present( das ) )
then
364 das_l = 0.25_c_double
368 if (
present( dbs ) )
then
374 drso = (das_l + dbs_l * dra)
399 real (c_double),
intent(in) :: dra
400 real (c_float),
intent(in) :: felevation
401 real (c_double) :: drso
403 drso = ( 0.75_c_double + 1.0e-5_c_double * felevation ) * dra
430 real (c_double),
intent(in) :: dra
431 real (c_double),
intent(in) :: das
432 real (c_double),
intent(in) :: dbs
433 real (c_double),
intent(in) :: fpctsun
434 real (c_double) :: drs
436 drs = ( das + (dbs * fpctsun / 100_c_double ) ) * dra
461 real(c_float),
intent(in) :: ftmin
462 real(c_float),
intent(in) :: ftmax
463 real(c_double),
intent(in) :: drs
464 real(c_double),
intent(in) :: drso
465 real(c_double) :: drnl
468 real(c_double) :: dtavg_k
469 real(c_double) :: dtavg_4
470 real (c_double) :: d_ea
471 real (c_double) :: dcloudfrac
472 real (c_double),
parameter :: dsigma = 4.903e-9_c_double
474 dtavg_k =
c_to_k((real(ftmin, c_double) + real(ftmax, c_double) ) / 2.0_c_double )
476 dtavg_4 = dtavg_k * dtavg_k * dtavg_k * dtavg_k * dsigma
479 dcloudfrac = min( drs / drso, 1.0_c_double )
481 drnl = dtavg_4 * ( 0.34_c_double - 0.14_c_double * sqrt( d_ea ) ) &
482 * ( 1.35_c_double * dcloudfrac - 0.35_c_double )
505 integer (c_int),
intent(in) :: idayofyear
506 integer (c_int),
intent(in) :: inumdaysinyear
507 real (c_double) :: dgamma
509 dgamma =
twopi * ( real(idayofyear, c_double) - 1.0_c_double ) / real(inumdaysinyear, c_double)
524 real (c_double),
intent(in) :: dtheta_z
525 real (c_double) :: dalpha
527 call assert( dtheta_z >= 0.0_c_double .and. dtheta_z <=
halfpi, &
528 "Internal programming error: solar zenith angle must be in radians and in the range 0 to pi/2", &
559 real (c_double),
intent(in) :: dlatitude
560 real (c_double),
intent(in) :: ddelta
561 real (c_double),
intent(in),
optional :: domega
564 real (c_double) :: dtheta_z
565 real (c_double) :: domega_l
567 if (
present( domega ) )
then
570 domega_l = 0.0_c_double
574 "Internal programming error: Latitude must be expressed in RADIANS and range from -pi/2 to pi/2", &
578 dtheta_z = acos( sin(dlatitude) * sin(ddelta) + cos(dlatitude) * cos(ddelta) * cos(domega_l ) )
599 real (c_double),
intent(in) :: ralpha
600 real (c_double),
intent(in) :: rlatitude
601 real (c_double),
intent(in) :: rdelta
602 real (c_double) :: rpsi
605 real (c_double) :: rtempval
607 rtempval = ( sin( ralpha ) * sin( rlatitude ) - sin( rdelta ) ) &
608 / ( cos( ralpha ) * cos( rlatitude ) )
611 if ( abs( rtempval ) > 1.0_c_double ) rtempval = sign( 1.0_c_double, rtempval )
613 rpsi = acos( rtempval )
This module contains physical constants and convenience functions aimed at performing unit conversion...
real(c_double), parameter, public twopi
real(c_double), parameter, public pi
real(c_double), parameter, public halfpi
elemental real(c_double) function dewpoint_vapor_pressure__e_a(ftmin)
real(c_double) function azimuth_angle__psi(ralpha, rlatitude, rdelta)
Calculate solar azimuth angle.
elemental real(c_double) function solar_declination_simple__delta(idayofyear, inumdaysinyear)
Calculate the solar declination for a given day of the year.
real(c_double) function solar_radiation_hargreaves__rs(dra, ftmin, ftmax)
Calculate shortwave solar radiation.
elemental real(c_double) function solar_declination__delta(idayofyear, inumdaysinyear)
Calculate the solar declination for a given day of the year.
elemental real(c_float) function estimate_percent_of_possible_sunshine__psun(ftmax, ftmin)
Estimate percent of possible sunshine.
real(c_float) earth_sun_dist_dr
real(c_double) function net_shortwave_radiation__rns(drs, dalbedo)
Calculate net shortwave radiation.
real(c_double) function solar_altitude__alpha(dtheta_z)
Calculate the solar altitude given the zenith angle.
real(c_double) function clear_sky_solar_radiation__rso(dra, das, dbs)
Calculate clear sky solar radiation.
real(c_double) function daylight_hours(domega_s)
Calculate the number of daylight hours at a location.
real(c_double) function clear_sky_solar_radiation_noab__rso(dra, felevation)
Calculate the clear sky solar radiation.
elemental real(c_double) function day_angle__gamma(idayofyear, inumdaysinyear)
Calculate the day angle in RADIANS.
elemental real(c_double) function relative_earth_sun_distance__d_r(idayofyear, inumdaysinyear)
Calculate the inverse relative Earth-Sun distance for a given day of the year.
elemental real(c_double) function sunrise_sunset_angle__omega_s(dlatitude, ddelta)
Calculate sunrise/sunset angle, in RADIANS.
elemental real(c_double) function extraterrestrial_radiation__ra(dlatitude, ddelta, domega_s, ddsubr)
Calculate extraterrestrial radiation given latitude and time of year.
elemental real(c_double) function net_longwave_radiation__rnl(ftmin, ftmax, drs, drso)
Calculate net longwave radiation flux.
elemental real(c_double) function solar_radiation__rs(dra, das, dbs, fpctsun)
Calculate solar radiation by means of the Angstrom formula.
real(c_float) solar_declination_delta
real(c_double) function zenith_angle__theta_z(dlatitude, ddelta, domega)
Calculate solar zenith angle given latitude, declination, and (optionally) hour angle.