Index: palm/trunk/SOURCE/radiation_model_mod.f90
===================================================================
--- palm/trunk/SOURCE/radiation_model_mod.f90	(revision 2944)
+++ palm/trunk/SOURCE/radiation_model_mod.f90	(revision 2963)
@@ -28,4 +28,9 @@
 ! -----------------
 ! $Id$
+! - Introduce index for vegetation/wall, pavement/green-wall and water/window 
+!   surfaces, for clearer access of surface fraction, albedo, emissivity, etc. .
+! - Minor bugfix in initialization of albedo for window surfaces
+! 
+! 2944 2018-04-03 16:20:18Z suehring
 ! Fixed bad commit
 ! 
@@ -361,4 +366,5 @@
     USE surface_mod,                                                           &
         ONLY:  get_topography_top_index, get_topography_top_index_ji,          &
+               ind_pav_green, ind_veg_wall, ind_wat_win,                       &
                surf_lsm_h, surf_lsm_v, surf_type, surf_usm_h, surf_usm_v
 
@@ -1524,48 +1530,48 @@
 !--       Only if albedo_type is non-zero
           DO  m = 1, surf_lsm_h%ns
-             IF ( surf_lsm_h%albedo_type(0,m) /= 0 )                           &
-                surf_lsm_h%albedo(0,m) =                                       &
-                                      albedo_pars(2,surf_lsm_h%albedo_type(0,m))
-             IF ( surf_lsm_h%albedo_type(1,m) /= 0 )                           &
-                surf_lsm_h%albedo(1,m) =                                       &
-                                      albedo_pars(2,surf_lsm_h%albedo_type(1,m))
-             IF ( surf_lsm_h%albedo_type(2,m) /= 0 )                           &
-                surf_lsm_h%albedo(2,m) =                                       &
-                                      albedo_pars(2,surf_lsm_h%albedo_type(2,m))
+             IF ( surf_lsm_h%albedo_type(ind_veg_wall,m) /= 0 )                &
+                surf_lsm_h%albedo(ind_veg_wall,m) =                            &
+                           albedo_pars(2,surf_lsm_h%albedo_type(ind_veg_wall,m))
+             IF ( surf_lsm_h%albedo_type(ind_pav_green,m) /= 0 )               &
+                surf_lsm_h%albedo(ind_pav_green,m) =                           &
+                           albedo_pars(2,surf_lsm_h%albedo_type(ind_pav_green,m))
+             IF ( surf_lsm_h%albedo_type(ind_wat_win,m) /= 0 )                 &
+                surf_lsm_h%albedo(ind_wat_win,m) =                             &
+                           albedo_pars(2,surf_lsm_h%albedo_type(ind_wat_win,m))
           ENDDO
           DO  m = 1, surf_usm_h%ns
-             IF ( surf_usm_h%albedo_type(0,m) /= 0 )                           &
-                surf_usm_h%albedo(0,m) =                                       &
-                                      albedo_pars(2,surf_usm_h%albedo_type(0,m))
-             IF ( surf_usm_h%albedo_type(1,m) /= 0 )                           &
-                surf_usm_h%albedo(1,m) =                                       &
-                                      albedo_pars(2,surf_usm_h%albedo_type(1,m))
-             IF ( surf_usm_h%albedo_type(2,m) /= 0 )                           &
-                surf_usm_h%albedo(2,m) =                                       &
-                                      albedo_pars(2,surf_usm_h%albedo_type(2,m))
+             IF ( surf_usm_h%albedo_type(ind_veg_wall,m) /= 0 )                &
+                surf_usm_h%albedo(ind_veg_wall,m) =                            &
+                           albedo_pars(2,surf_usm_h%albedo_type(ind_veg_wall,m))
+             IF ( surf_usm_h%albedo_type(ind_pav_green,m) /= 0 )               &
+                surf_usm_h%albedo(ind_pav_green,m) =                           &
+                           albedo_pars(2,surf_usm_h%albedo_type(ind_pav_green,m))
+             IF ( surf_usm_h%albedo_type(ind_wat_win,m) /= 0 )                 &
+                surf_usm_h%albedo(ind_wat_win,m) =                             &
+                           albedo_pars(2,surf_usm_h%albedo_type(ind_wat_win,m))
           ENDDO
 
           DO  l = 0, 3
              DO  m = 1, surf_lsm_v(l)%ns
-                IF ( surf_lsm_v(l)%albedo_type(0,m) /= 0 )                     &
-                   surf_lsm_v(l)%albedo(0,m) =                                 &
-                                   albedo_pars(2,surf_lsm_v(l)%albedo_type(0,m))
-                IF ( surf_lsm_v(l)%albedo_type(1,m) /= 0 )                     &
-                   surf_lsm_v(l)%albedo(1,m) =                                 &
-                                   albedo_pars(2,surf_lsm_v(l)%albedo_type(1,m))
-                IF ( surf_lsm_v(l)%albedo_type(2,m) /= 0 )                     &
-                   surf_lsm_v(l)%albedo(2,m) =                                 &
-                                   albedo_pars(2,surf_lsm_v(l)%albedo_type(2,m))
+                IF ( surf_lsm_v(l)%albedo_type(ind_veg_wall,m) /= 0 )          &
+                   surf_lsm_v(l)%albedo(ind_veg_wall,m) =                      &
+                        albedo_pars(2,surf_lsm_v(l)%albedo_type(ind_veg_wall,m))
+                IF ( surf_lsm_v(l)%albedo_type(ind_pav_green,m) /= 0 )         &
+                   surf_lsm_v(l)%albedo(ind_pav_green,m) =                     &
+                        albedo_pars(2,surf_lsm_v(l)%albedo_type(ind_pav_green,m))
+                IF ( surf_lsm_v(l)%albedo_type(ind_wat_win,m) /= 0 )           &
+                   surf_lsm_v(l)%albedo(ind_wat_win,m) =                       &
+                        albedo_pars(2,surf_lsm_v(l)%albedo_type(ind_wat_win,m))
              ENDDO
              DO  m = 1, surf_usm_v(l)%ns
-                IF ( surf_usm_v(l)%albedo_type(0,m) /= 0 )                     &
-                   surf_usm_v(l)%albedo(0,m) =                                 &
-                                   albedo_pars(2,surf_usm_v(l)%albedo_type(0,m))
-                IF ( surf_usm_v(l)%albedo_type(1,m) /= 0 )                     &
-                   surf_usm_v(l)%albedo(1,m) =                                 &
-                                   albedo_pars(2,surf_usm_v(l)%albedo_type(1,m))
-                IF ( surf_usm_v(l)%albedo_type(2,m) /= 0 )                     &
-                   surf_usm_v(l)%albedo(2,m) =                                 &
-                                   albedo_pars(2,surf_usm_v(l)%albedo_type(2,m))
+                IF ( surf_usm_v(l)%albedo_type(ind_veg_wall,m) /= 0 )          &
+                   surf_usm_v(l)%albedo(ind_veg_wall,m) =                      &
+                        albedo_pars(2,surf_usm_v(l)%albedo_type(ind_veg_wall,m))
+                IF ( surf_usm_v(l)%albedo_type(ind_pav_green,m) /= 0 )         &
+                   surf_usm_v(l)%albedo(ind_pav_green,m) =                     &
+                        albedo_pars(2,surf_usm_v(l)%albedo_type(ind_pav_green,m))
+                IF ( surf_usm_v(l)%albedo_type(ind_wat_win,m) /= 0 )           &
+                   surf_usm_v(l)%albedo(ind_wat_win,m) =                       &
+                        albedo_pars(2,surf_usm_v(l)%albedo_type(ind_wat_win,m))
              ENDDO
           ENDDO
@@ -1582,10 +1588,10 @@
                 j = surf_lsm_h%j(m)
                 IF ( albedo_pars_f%pars_xy(0,j,i) /= albedo_pars_f%fill )  THEN
-                   IF ( surf_lsm_h%albedo_type(0,m) == 0 )                     &
-                      surf_lsm_h%albedo(0,m) = albedo_pars_f%pars_xy(0,j,i)
-                   IF ( surf_lsm_h%albedo_type(1,m) == 0 )                     &
-                      surf_lsm_h%albedo(1,m) = albedo_pars_f%pars_xy(0,j,i)
-                   IF ( surf_lsm_h%albedo_type(2,m) == 0 )                     &
-                      surf_lsm_h%albedo(2,m) = albedo_pars_f%pars_xy(0,j,i)
+                   IF ( surf_lsm_h%albedo_type(ind_veg_wall,m) == 0 )          &
+                      surf_lsm_h%albedo(ind_veg_wall,m) = albedo_pars_f%pars_xy(0,j,i)
+                   IF ( surf_lsm_h%albedo_type(ind_pav_green,m) == 0 )         &
+                      surf_lsm_h%albedo(ind_pav_green,m) = albedo_pars_f%pars_xy(0,j,i)
+                   IF ( surf_lsm_h%albedo_type(ind_wat_win,m) == 0 )           &
+                      surf_lsm_h%albedo(ind_wat_win,m) = albedo_pars_f%pars_xy(0,j,i)
                 ENDIF
              ENDDO
@@ -1594,10 +1600,10 @@
                 j = surf_usm_h%j(m)
                 IF ( albedo_pars_f%pars_xy(0,j,i) /= albedo_pars_f%fill )  THEN
-                   IF ( surf_usm_h%albedo_type(0,m) == 0 )                     &
-                      surf_usm_h%albedo(0,m) = albedo_pars_f%pars_xy(0,j,i)
-                   IF ( surf_usm_h%albedo_type(1,m) == 0 )                     &
-                      surf_usm_h%albedo(1,m) = albedo_pars_f%pars_xy(0,j,i)
-                   IF ( surf_usm_h%albedo_type(2,m) == 0 )                     &
-                      surf_usm_h%albedo(2,m) = albedo_pars_f%pars_xy(0,j,i)
+                   IF ( surf_usm_h%albedo_type(ind_veg_wall,m) == 0 )          &
+                      surf_usm_h%albedo(ind_veg_wall,m) = albedo_pars_f%pars_xy(0,j,i)
+                   IF ( surf_usm_h%albedo_type(ind_pav_green,m) == 0 )         &
+                      surf_usm_h%albedo(ind_pav_green,m) = albedo_pars_f%pars_xy(0,j,i)
+                   IF ( surf_usm_h%albedo_type(ind_wat_win,m) == 0 )           &
+                      surf_usm_h%albedo(ind_wat_win,m) = albedo_pars_f%pars_xy(0,j,i)
                 ENDIF
              ENDDO 
@@ -1612,10 +1618,10 @@
                    j = surf_lsm_v(l)%j(m) + joff
                    IF ( albedo_pars_f%pars_xy(0,j,i) /= albedo_pars_f%fill )  THEN
-                      IF ( surf_lsm_v(l)%albedo_type(0,m) == 0 )               &
-                         surf_lsm_v(l)%albedo(1,m) = albedo_pars_f%pars_xy(0,j,i)
-                      IF ( surf_lsm_v(l)%albedo_type(1,m) == 0 )               &
-                         surf_lsm_v(l)%albedo(1,m) = albedo_pars_f%pars_xy(0,j,i)
-                      IF ( surf_lsm_v(l)%albedo_type(2,m) == 0 )               &
-                         surf_lsm_v(l)%albedo(2,m) = albedo_pars_f%pars_xy(0,j,i)
+                      IF ( surf_lsm_v(l)%albedo_type(ind_veg_wall,m) == 0 )    &
+                         surf_lsm_v(l)%albedo(ind_veg_wall,m) = albedo_pars_f%pars_xy(0,j,i)
+                      IF ( surf_lsm_v(l)%albedo_type(ind_pav_green,m) == 0 )   &
+                         surf_lsm_v(l)%albedo(ind_pav_green,m) = albedo_pars_f%pars_xy(0,j,i)
+                      IF ( surf_lsm_v(l)%albedo_type(ind_wat_win,m) == 0 )     &
+                         surf_lsm_v(l)%albedo(ind_wat_win,m) = albedo_pars_f%pars_xy(0,j,i)
                    ENDIF
                 ENDDO
@@ -1627,10 +1633,10 @@
                    j = surf_usm_h%j(m) + joff
                    IF ( albedo_pars_f%pars_xy(0,j,i) /= albedo_pars_f%fill )  THEN
-                      IF ( surf_usm_v(l)%albedo_type(0,m) == 0 )               &
-                         surf_usm_v(l)%albedo(1,m) = albedo_pars_f%pars_xy(0,j,i)
-                      IF ( surf_usm_v(l)%albedo_type(1,m) == 0 )               &
-                         surf_usm_v(l)%albedo(1,m) = albedo_pars_f%pars_xy(0,j,i)
-                      IF ( surf_usm_v(l)%albedo_type(2,m) == 0 )               &
-                         surf_lsm_v(l)%albedo(2,m) = albedo_pars_f%pars_xy(0,j,i)
+                      IF ( surf_usm_v(l)%albedo_type(ind_veg_wall,m) == 0 )    &
+                         surf_usm_v(l)%albedo(ind_veg_wall,m) = albedo_pars_f%pars_xy(0,j,i)
+                      IF ( surf_usm_v(l)%albedo_type(ind_pav_green,m) == 0 )   &
+                         surf_usm_v(l)%albedo(ind_pav_green,m) = albedo_pars_f%pars_xy(0,j,i)
+                      IF ( surf_usm_v(l)%albedo_type(ind_wat_win,m) == 0 )     &
+                         surf_lsm_v(l)%albedo(ind_wat_win,m) = albedo_pars_f%pars_xy(0,j,i)
                    ENDIF
                 ENDDO
@@ -2288,12 +2294,18 @@
 !--                calculated fluxes below are not actually used as they are 
 !--                overwritten in radiation_interaction.
-                   surf%rad_sw_out(m) = ( surf%frac(0,m) * surf%albedo(0,m)    &
-                                        + surf%frac(1,m) * surf%albedo(1,m)    &
-                                        + surf%frac(2,m) * surf%albedo(2,m) )  &
+                   surf%rad_sw_out(m) = ( surf%frac(ind_veg_wall,m)  *         &
+                                          surf%albedo(ind_veg_wall,m)          &
+                                        + surf%frac(ind_pav_green,m) *         &
+                                          surf%albedo(ind_pav_green,m)         &
+                                        + surf%frac(ind_wat_win,m)   *         &
+                                          surf%albedo(ind_wat_win,m) )         &
                                         * surf%rad_sw_in(m)
 
-                   surf%rad_lw_out(m) = ( surf%frac(0,m) * surf%emissivity(0,m)&
-                                        + surf%frac(1,m) * surf%emissivity(1,m)&
-                                        + surf%frac(2,m) * surf%emissivity(2,m)&
+                   surf%rad_lw_out(m) = ( surf%frac(ind_veg_wall,m)  *         &
+                                          surf%emissivity(ind_veg_wall,m)      &
+                                        + surf%frac(ind_pav_green,m) *         &
+                                          surf%emissivity(ind_pav_green,m)     &
+                                        + surf%frac(ind_wat_win,m)   *         &
+                                          surf%emissivity(ind_wat_win,m)       &
                                         )                                      &
                                         * sigma_sb                             &
@@ -2301,7 +2313,10 @@
 
                    surf%rad_lw_out_change_0(m) =                               &
-                                      ( surf%frac(0,m) * surf%emissivity(0,m)  &
-                                      + surf%frac(1,m) * surf%emissivity(1,m)  &
-                                      + surf%frac(2,m) * surf%emissivity(2,m)  &
+                                      ( surf%frac(ind_veg_wall,m)  *           &
+                                        surf%emissivity(ind_veg_wall,m)        &
+                                      + surf%frac(ind_pav_green,m) *           &
+                                        surf%emissivity(ind_pav_green,m)       &
+                                      + surf%frac(ind_wat_win,m)   *           &
+                                        surf%emissivity(ind_wat_win,m)         &
                                       ) * 3.0_wp * sigma_sb                    &
                                       * ( surf%pt_surface(m) * exn )** 3
@@ -2474,7 +2489,10 @@
 !
 !--                Weighted average according to surface fraction. 
-                   surf%rad_lw_out(m) = ( surf%frac(0,m) * surf%emissivity(0,m)&
-                                        + surf%frac(1,m) * surf%emissivity(1,m)&
-                                        + surf%frac(2,m) * surf%emissivity(2,m)&
+                   surf%rad_lw_out(m) = ( surf%frac(ind_veg_wall,m)  *         &
+                                          surf%emissivity(ind_veg_wall,m)      &
+                                        + surf%frac(ind_pav_green,m) *         &
+                                          surf%emissivity(ind_pav_green,m)     &
+                                        + surf%frac(ind_wat_win,m)   *         &
+                                          surf%emissivity(ind_wat_win,m)       &
                                         )                                      &
                                       * sigma_sb                               &
@@ -2484,12 +2502,18 @@
                                        + surf%rad_lw_out(m) )                  &
                                        / ( 1.0_wp -                            &
-                                          ( surf%frac(0,m) * surf%albedo(0,m) +&
-                                            surf%frac(1,m) * surf%albedo(1,m) +&
-                                            surf%frac(1,m) * surf%albedo(1,m) )&
+                                          ( surf%frac(ind_veg_wall,m)  *       &
+                                            surf%albedo(ind_veg_wall,m)        &
+                                         +  surf%frac(ind_pav_green,m) *       &
+                                            surf%albedo(ind_pav_green,m)       &
+                                         +  surf%frac(ind_wat_win,m)   *       &
+                                            surf%albedo(ind_wat_win,m) )       &
                                          )
 
-                   surf%rad_sw_out(m) = ( surf%frac(0,m) * surf%albedo(0,m)    &
-                                        + surf%frac(1,m) * surf%albedo(1,m)    &
-                                        + surf%frac(2,m) * surf%albedo(2,m) )  &
+                   surf%rad_sw_out(m) = ( surf%frac(ind_veg_wall,m)  *         &
+                                          surf%albedo(ind_veg_wall,m)          &
+                                        + surf%frac(ind_pav_green,m) *         &
+                                          surf%albedo(ind_pav_green,m)         &
+                                        + surf%frac(ind_wat_win,m)   *         &
+                                          surf%albedo(ind_wat_win,m) )         &
                                       * surf%rad_sw_in(m)
 
@@ -3099,15 +3123,21 @@
 !--             surfaces. 
                 DO  m = surf_lsm_h%start_index(j,i), surf_lsm_h%end_index(j,i)
-                   rrtm_emis = surf_lsm_h%frac(0,m) * surf_lsm_h%emissivity(0,m) +&
-                               surf_lsm_h%frac(1,m) * surf_lsm_h%emissivity(1,m) +& 
-                               surf_lsm_h%frac(2,m) * surf_lsm_h%emissivity(2,m)
-                   rrtm_tsfc = pt(surf_lsm_h%k(m)+surf_lsm_h%koff,j,i) *          &
+                   rrtm_emis = surf_lsm_h%frac(ind_veg_wall,m)  *              &
+                               surf_lsm_h%emissivity(ind_veg_wall,m)  +        &
+                               surf_lsm_h%frac(ind_pav_green,m) *              &
+                               surf_lsm_h%emissivity(ind_pav_green,m) +        & 
+                               surf_lsm_h%frac(ind_wat_win,m)   *              &
+                               surf_lsm_h%emissivity(ind_wat_win,m)
+                   rrtm_tsfc = pt(surf_lsm_h%k(m)+surf_lsm_h%koff,j,i) *       &
                                        (surface_pressure / 1000.0_wp )**0.286_wp
                 ENDDO             
                 DO  m = surf_usm_h%start_index(j,i), surf_usm_h%end_index(j,i)
-                   rrtm_emis = surf_usm_h%frac(0,m) * surf_usm_h%emissivity(0,m) +&
-                               surf_usm_h%frac(1,m) * surf_usm_h%emissivity(1,m) +& 
-                               surf_usm_h%frac(2,m) * surf_usm_h%emissivity(2,m)
-                   rrtm_tsfc = pt(surf_usm_h%k(m)+surf_usm_h%koff,j,i) *          &
+                   rrtm_emis = surf_usm_h%frac(ind_veg_wall,m)  *              &
+                               surf_usm_h%emissivity(ind_veg_wall,m)  +        &
+                               surf_usm_h%frac(ind_pav_green,m) *              &
+                               surf_usm_h%emissivity(ind_pav_green,m) +        & 
+                               surf_usm_h%frac(ind_wat_win,m)   *              &
+                               surf_usm_h%emissivity(ind_wat_win,m)
+                   rrtm_tsfc = pt(surf_usm_h%k(m)+surf_usm_h%koff,j,i) *       &
                                        (surface_pressure / 1000.0_wp )**0.286_wp
                 ENDDO
