Index: palm/trunk/SOURCE/radiation_model_mod.f90
===================================================================
--- palm/trunk/SOURCE/radiation_model_mod.f90	(revision 2001)
+++ palm/trunk/SOURCE/radiation_model_mod.f90	(revision 2007)
@@ -20,5 +20,8 @@
 ! Current revisions:
 ! -----------------
-! 
+! Added calculation of solar directional vector for new urban surface 
+! model,
+! accounted for urban_surface model in radiation_check_parameters,
+! correction of comments for zenith angle.
 ! 
 ! Former revisions:
@@ -114,5 +117,5 @@
  
     USE arrays_3d,                                                             &
-        ONLY:  dzw, hyp, pt, q, ql, zw
+        ONLY:  dzw, hyp, pt, q, ql, zu, zw
 
     USE cloud_parameters,                                                      &
@@ -199,5 +202,6 @@
                 radiation = .FALSE.,                  & !< flag parameter indicating whether the radiation model is used
                 sun_up    = .TRUE.,                   & !< flag parameter indicating whether the sun is up or down
-                sw_radiation = .TRUE.                   !< flag parameter indicing whether shortwave radiation shall be calculated
+                sw_radiation = .TRUE.,                 & !< flag parameter indicing whether shortwave radiation shall be calculated
+                sun_direction = .FALSE.                 !< flag parameter indicing whether solar direction shall be calculated
 
 
@@ -227,5 +231,7 @@
                 time_utc_init = 43200.0_wp         !< UTC time at model start (noon)
 
-    REAL(wp), DIMENSION(0:0) ::  zenith        !< solar zenith angle
+    REAL(wp), DIMENSION(0:0) ::  zenith,         & !< cosine of solar zenith angle
+                                 sun_dir_lat,    & !< solar directional vector in latitudes
+                                 sun_dir_lon       !< solar directional vector in longitudes
 
     REAL(wp), DIMENSION(:,:), ALLOCATABLE :: &
@@ -468,6 +474,8 @@
            rad_lw_cs_hr, rad_lw_cs_hr_av, rad_lw_hr, rad_lw_hr_av, rad_sw_in,  &
            rad_sw_in_av, rad_sw_out, rad_sw_out_av, rad_sw_cs_hr,              &
-           rad_sw_cs_hr_av, rad_sw_hr, rad_sw_hr_av,                           &
-           skip_time_do_radiation, time_radiation, unscheduled_radiation_calls
+           rad_sw_cs_hr_av, rad_sw_hr, rad_sw_hr_av, sigma_sb,                 &
+           skip_time_do_radiation, time_radiation, unscheduled_radiation_calls,&
+           zenith, calc_zenith, sun_direction, sun_dir_lat, sun_dir_lon,       &
+           day_init, time_utc_init
 
 
@@ -761,4 +769,7 @@
     
        IMPLICIT NONE
+       
+       LOGICAL ::  urban_surface_af = .FALSE.  !< auxiliary flag used for parameter check
+
 
        IF ( radiation_scheme /= 'constant'   .AND.                             &
@@ -805,5 +816,13 @@
        ENDIF
 
-       IF ( topography /= 'flat' )  THEN
+!
+!--    The following paramter check is temporarily extended by the urban_surface
+!--    flag, until a better solution comes up to omit this check in case of
+!--    urban surface model is used.
+!--    Routine get_usm_info provides the value for the urban_surface flag,
+!--    because the value cannot be retrieved via USE due to circular dependencies
+!--    between modules radiation_model_mod and urban_surface_mod.
+       CALL get_usm_info( urban_surface_af )
+       IF ( topography /= 'flat'  .AND.  .NOT.  urban_surface_af )  THEN
           message_string = 'radiation scheme cannot be used ' //               & 
                            'in combination with  topography /= "flat"'
@@ -1565,8 +1584,18 @@
 
 !
-!--    Calculate zenith angle
+!--    Calculate cosine of solar zenith angle
        zenith(0) = SIN(lat) * SIN(declination) + COS(lat) * COS(declination)      &
                                             * COS(hour_angle)
        zenith(0) = MAX(0.0_wp,zenith(0))
+
+!
+!--    Calculate solar directional vector
+       IF ( sun_direction )  THEN
+!--       Direction in longitudes equals to sin(solar_azimuth) * sin(zenith)
+          sun_dir_lon(0) = -SIN(hour_angle) * COS(declination)
+!--       Direction in latitues equals to cos(solar_azimuth) * sin(zenith)
+          sun_dir_lat(0) = SIN(declination) * COS(lat) - COS(hour_angle) &
+                              * COS(declination) * SIN(lat)
+       ENDIF
 
 !
