Any one having a problem trying to fix this?
I keep on getting 'rsunz' is used but never set in line 388.
Same with 'rsuna'.
--- In HydroLightUsers@yahoogroups.com, "Curtis Mobley"
<curtis.mobley@...> wrote:
>
> Hello HydroLight users,
>
> Marcos Montes and Joe Rhea of the U.S. Naval Research Lab recently
> noted that the solar azimuthal angle computed by HydroLight when you
> enter the date, time, and location is incorrect. This does NOT affect
> HydroLight's computations, since only the zenith angle (which is
> correct) is used to determine the sky radiance. (Indeed, the sun's
> azimuthal angle is set to zero by H after it is computed within the
> RADTRAN subroutine "sunang".) However, the incorrect azimuthal angle
> is in the printout and therefore should be correct, even if it is not
> used in computations.
>
> To correct this bug:
>
> 1) go to file qasky.f in the maincode directory
> 2) go to subroutine sunang in that file
> 3) replace (or comment out) these four lines of code:
>
> sintmp = sin(abs(rha))*cos(rsdec)/sin(rsunz)
> rsuna = asin(sintmp)
> if(ylat .gt. sdec) rsuna = 180.0 / rad - rsuna
> if(xha .gt. 0.) rsuna = 360.0/rad - rsuna
>
> with these three lines of code:
>
> sna=cos(rsdec)*sin(rha)
> csa=sin(rlat)*cos(rha)*cos(rsdec)-sin(rsdec)*cos(rlat)
> rsuna=(atan2(sna,csa)+4.0*atan(1.0))
>
> The computed sun azimuth angle will then be correct.
>
> As a test case, if you use (in the H GUI)
> day=164
> GMT=12.0
> longitude=-80.100
> latitude=26.020
>
> the printout should show
> sun zenith angle = 71.57 deg
> sun azimuth angle = 72.60 deg
>
> (The old, incorrect azimuth was 107.40 deg.)
>
> Many thanks to Joe and Marcos for finding this bug and for giving me
> code that works. This is what I had in mind when I set up this users'
> forum.
>
> Cheers,
>
> Curt
>