SUEWS API Site
Documentation of SUEWS source code
Functions/Subroutines
modsolarcalc Module Reference

Functions/Subroutines

real(kind(1d0)) function min_zenith (lat, doy)
 
real(kind(1d0)) function local_apparent_time (lng, dectime)
 
subroutine solar_angles (lat, lng, timezone, dectime, decl, zenith, azimuth)
 
subroutine solar_times (lat, lng, timezone, dectime, sunrise, sunset, snoon)
 
real(kind(1d0)) function kdown_surface (doy, zenith)
 
real(kind(1d0)) function transmissivity_cd (p, td, g, zenith)
 
real(kind(1d0)) function solar_esdist (doy)
 

Function/Subroutine Documentation

◆ kdown_surface()

real(kind(1d0)) function modsolarcalc::kdown_surface ( integer doy,
real(kind(1d0)) zenith )

Definition at line 344 of file suews_phys_estm.f95.

345 ! Calculates ground level solar irradiance clear sky
346 ! assuming transmissivity = 1
347 ! let it report zero if zenith >= 90
348 REAL(KIND(1D0)) :: zenith, Isurf
349 INTEGER :: doy
350 REAL(KIND(1D0)) :: Rmean, Rse, cosZ, Itoa
351
352 rmean = 149.6 !Stull 1998
353 rse = solar_esdist(doy)
354 IF (zenith < pi/2.) THEN
355 cosz = cos(zenith)
356 itoa = 1370*(rmean/rse)**2 !top of the atmosphere
357 isurf = itoa*cosz !ground level solar irradiance in W/m2
358 ELSE
359 isurf = 0.
360 END IF
361

References mathconstants::pi, and solar_esdist().

Here is the call graph for this function:

◆ local_apparent_time()

real(kind(1d0)) function modsolarcalc::local_apparent_time ( real(kind(1d0)) lng,
real(kind(1d0)) dectime )

Definition at line 275 of file suews_phys_estm.f95.

276 !Oke, 1989, equation of time elsewhere
277 REAL(KIND(1D0)) :: lng, dectime, la_time
278 REAL(KIND(1D0)) :: gamma, eqtime, lmst
279
280 lmst = dectime - 4.*lng/60./1440.
281 gamma = 2.*pi/365.*(lmst - 1.)
282 eqtime = 229.18*(7.5e-5 + 1.868e-3*cos(gamma) - 0.032077*sin(gamma)&
283 & - 0.014615*cos(2.*gamma) - 0.040849*sin(2.*gamma))
284 la_time = lmst + eqtime/1440.

References mathconstants::pi.

◆ min_zenith()

real(kind(1d0)) function modsolarcalc::min_zenith ( real(kind(1d0)) lat,
integer doy )

Definition at line 261 of file suews_phys_estm.f95.

262 !returns max zenith
263 !returns zenith in radians for lat, lng in degrees
264 REAL(KIND(1D0)) :: lat, dectime, zmin
265 REAL(KIND(1D0)) :: latr, decl
266 INTEGER :: doy
267 dectime = float(doy)
268 latr = lat*dtr
269 decl = 0.409*cos(2*pi*(dectime - 173)/365.25)
270 zmin = pi/2.-asin(sin(latr)*sin(decl) - cos(latr)*cos(decl)*(-1))

References mathconstants::dtr, and mathconstants::pi.

◆ solar_angles()

subroutine modsolarcalc::solar_angles ( real, intent(in) lat,
real, intent(in) lng,
real, intent(in) timezone,
real, intent(in) dectime,
real(kind(1d0)), intent(out) decl,
real(kind(1d0)), intent(out) zenith,
real(kind(1d0)), intent(out) azimuth )

Definition at line 288 of file suews_phys_estm.f95.

289
290 REAL, INTENT(in) :: lat, lng, timezone, dectime
291 INTEGER :: doy, hour, mn
292 REAL(KIND(1D0)), INTENT(out) :: decl, zenith, azimuth
293 REAL(KIND(1D0)) :: ha, latr, eqtime, tst, &
294 time_offset, gamma !!!!!FO!!!!! lngr, phi, theta
295
296 latr = lat*pi/180.
297 doy = floor(dectime)
298 hour = floor((dectime - doy)*24.)
299 mn = floor((dectime - doy - hour/24.)*60.) !!!Check this
300
301 gamma = 2.*pi/365.25463*(doy - 1.+(hour - 12.)/24.)
302 eqtime = 229.18*(7.5e-5 + 1.868e-3*cos(gamma) - 0.032077*sin(gamma)&
303 & - 0.014615*cos(2.*gamma) - 0.040849*sin(2.*gamma))
304 decl = 6.918e-3 - 0.399912*cos(gamma) + 0.070257*sin(gamma)&
305 & - 0.006758*cos(2.*gamma) + 9.07e-4*sin(2.*gamma) - 2.697e-3*cos(3.*gamma)&
306 & + 1.48e-3*sin(3.*gamma)
307 time_offset = eqtime - 4.*lng + 60.*timezone
308 tst = hour*60.+mn + time_offset
309 ha = (tst/4.) - 180.
310 ha = ha*pi/180.
311
312 zenith = acos(sin(latr)*sin(decl) + cos(latr)*cos(decl)*cos(ha))
313 azimuth = pi + acos((sin(latr)*cos(zenith) - sin(decl))/(cos(latr)*sin(zenith)))
314
315 RETURN

References mathconstants::pi.

◆ solar_esdist()

real(kind(1d0)) function modsolarcalc::solar_esdist ( integer doy)

Definition at line 457 of file suews_phys_estm.f95.

458 !from Stull, 1998
459 INTEGER :: doy
460 REAL(KIND(1D0)) :: Rse
461 REAL(KIND(1D0)) :: MA, nu, e, a
462
463 e = 0.0167
464 a = 146.457
465
466 ma = 2.*pi*(doy - 3)/365.25463 !Mean anomaly
467 nu = ma + 0.0333988*sin(ma) + .0003486*sin(2.*ma) + 5e-6*sin(3.*ma) !true anomaly
468 rse = a*(1 - e*e)/(1 + e*cos(nu))
469

References mathconstants::pi.

Referenced by kdown_surface().

Here is the caller graph for this function:

◆ solar_times()

subroutine modsolarcalc::solar_times ( real(kind(1d0)), intent(in) lat,
real(kind(1d0)), intent(in) lng,
real(kind(1d0)), intent(in) timezone,
real(kind(1d0)), intent(in) dectime,
real(kind(1d0)), intent(out) sunrise,
real(kind(1d0)), intent(out) sunset,
real(kind(1d0)), intent(out) snoon )

Definition at line 319 of file suews_phys_estm.f95.

320 ! for sunrise and sunset ha = ha(zenith=90)
321 ! timezone is offset to GMT e.g. -5 for EST
322
323 REAL(KIND(1D0)), INTENT(in) :: lat, lng, timezone, dectime
324 INTEGER :: doy
325 REAL(KIND(1D0)), INTENT(out) :: sunrise, sunset, snoon
326 REAL(KIND(1D0)) :: ha, latr, eqtime, gamma, zenith, decl
327 latr = lat*dtr
328 zenith = 90.833*dtr
329 doy = floor(dectime)
330 gamma = 2.*pi/365.*(float(doy) - 0.5) !fractional year
331 eqtime = 229.18*(7.5e-5 + 1.868e-3*cos(gamma) - 0.032077*sin(gamma)&
332 & - 0.014615*cos(2.*gamma) - 0.040849*sin(2.*gamma))
333 decl = 6.918e-3 - 0.399912*cos(gamma) + 0.070257*sin(gamma)&
334 & - 0.006758*cos(2.*gamma) + 9.07e-4*sin(2.*gamma) - 2.697e-3*cos(3.*gamma)&
335 & + 1.48e-3*sin(3.*gamma)
336 ha = acos(cos(zenith)/(cos(latr)*cos(decl)) - tan(latr)*tan(decl))
337 ha = ha*rtd
338 sunrise = (720.-4.*(lng - ha) - eqtime)/60.-timezone
339 sunset = (720.-4.*(lng + ha) - eqtime)/60.-timezone
340 snoon = (720.-4.*lng - eqtime)/60.-timezone
341 RETURN

References mathconstants::dtr, mathconstants::pi, and mathconstants::rtd.

◆ transmissivity_cd()

real(kind(1d0)) function modsolarcalc::transmissivity_cd ( real(kind(1d0)) p,
real(kind(1d0)) td,
real(kind(1d0)) g,
real(kind(1d0)) zenith )

Definition at line 380 of file suews_phys_estm.f95.

381 ! bulk atmospheric transmissivity (Crawford and Duchon, 1999)
382 ! P = pressure (hPa)
383 ! Td = dewpoint (C)
384 ! G parameter is empirical value from Smith 1966 (JAM)
385 ! zenith in radians
386
387 ! integer ::doy !!!!!FO!!!!!
388 REAL(KIND(1D0)) :: P, Td, zenith, G, trans
389 REAL(KIND(1D0)) :: m, TrTpg, u, Tw, Ta, cosZ
390 REAL(KIND(1D0)) :: Tdf
391
392 IF (zenith > 80.*dtr) THEN
393 cosz = cos(80.*dtr)
394 ELSE
395 cosz = cos(zenith)
396 END IF
397 tdf = td*1.8 + 32. !celsius to fahrenheit
398 ! Transmission coefficients
399 m = 35*cosz/sqrt(1224.*cosz*cosz + 1) !optical air mass at p=1013 mb
400 trtpg = 1.021 - 0.084*sqrt(m*(0.000949*p + 0.051)) !first two trans coeff
401 u = exp(0.113 - log(g + 1) + 0.0393*tdf) !precipitable water
402 tw = 1 - 0.077*(u*m)**0.3 !vapor transmission coe3ff.
403 ta = 0.935**m !4th trans coeff
404 trans = trtpg*tw*ta !bulk atmospherics transmissivity

References mathconstants::dtr.