c file name: daylen.for real function daylen(dlat,idoy) c + + + PURPOSE + + + c This function calculates the time of sunrise for any simulation c site based on the global position of the site, and day of the c year. The inputs for the function are day of the year, latitude c of the site, and longitude of the site. c DATE: 03/10/92 (SUN.FOR) c MODIFIED: 12/10/93 c + + + KEYWORDS + + + c sunrise c + + + ARGUMENT DECLARATIONS + + + integer idoy real dlat real dlong c + + + ARGUMENT DEFINITIONS + + + c idoy - Day of year c dlat - Latitude of the site, degrees c + + + LOCAL VARAIBLES + + + real b, dec, h, coshr c + + + LOCAL DEFINITIONS + + + c dec - declination (degrees) c h - Hour angle c coshr - Cosine of hour angle at sunrise c + + + COMMON BLOCKS + + + *$noereference include 'p1const.inc' *$reference c + + + END SPECIFICATIONS + + + c Calculate declinatrion angle (dec) b= (360.0/365.0)*(idoy-81.25) !h-55 dec= 23.5*sin(b*pi/180.0) !h-58 c Calculate the cosine of hour angle (h) at sunrise coshr = -1.0*sin(dlat*pi/180.0)/cos(dlat*pi/180.)* !h-57 & sin(dec*pi/180.)/cos(dec*pi/180.) c Calculate the hour angle of sunrise (h) h= pi/2 - atan(coshr/(sqrt(1-coshr*coshr))) !h-56 h= h*180/pi c Calculate the length of the day daylen= 2.0*h/15.0 return end