Index: palm/trunk/SOURCE/urban_surface_mod.f90
===================================================================
--- palm/trunk/SOURCE/urban_surface_mod.f90	(revision 4392)
+++ palm/trunk/SOURCE/urban_surface_mod.f90	(revision 4441)
@@ -23,5 +23,6 @@
 ! Current revisions:
 ! ------------------
-! 
+! Change order of dimension in surface arrays %frac, %emissivity and %albedo 
+! to allow for better vectorization in the radiation interactions.
 ! 
 ! Former revisions:
@@ -800,10 +801,10 @@
 !--     Allocate albedo_type and albedo. Each surface element
 !--     has 3 values, 0: wall fraction, 1: green fraction, 2: window fraction.
-        ALLOCATE ( surf_usm_h%albedo_type(0:2,1:surf_usm_h%ns) )
-        ALLOCATE ( surf_usm_h%albedo(0:2,1:surf_usm_h%ns)      )
+        ALLOCATE ( surf_usm_h%albedo_type(1:surf_usm_h%ns,0:2) )
+        ALLOCATE ( surf_usm_h%albedo(1:surf_usm_h%ns,0:2)      )
         surf_usm_h%albedo_type = albedo_type
         DO  l = 0, 3
-           ALLOCATE ( surf_usm_v(l)%albedo_type(0:2,1:surf_usm_v(l)%ns) )
-           ALLOCATE ( surf_usm_v(l)%albedo(0:2,1:surf_usm_v(l)%ns)      )
+           ALLOCATE ( surf_usm_v(l)%albedo_type(1:surf_usm_v(l)%ns,0:2) )
+           ALLOCATE ( surf_usm_v(l)%albedo(1:surf_usm_v(l)%ns,0:2)      )
            surf_usm_v(l)%albedo_type = albedo_type
         ENDDO       
@@ -837,8 +838,8 @@
 !--      Allocate arrays for relative surface fraction. 
 !--      0 - wall fraction, 1 - green fraction, 2 - window fraction
-         ALLOCATE ( surf_usm_h%frac(0:2,1:surf_usm_h%ns) )
+         ALLOCATE ( surf_usm_h%frac(1:surf_usm_h%ns,0:2) )
          surf_usm_h%frac = 0.0_wp
          DO  l = 0, 3
-            ALLOCATE ( surf_usm_v(l)%frac(0:2,1:surf_usm_v(l)%ns) )
+            ALLOCATE ( surf_usm_v(l)%frac(1:surf_usm_v(l)%ns,0:2) )
             surf_usm_v(l)%frac = 0.0_wp
          ENDDO
@@ -855,5 +856,5 @@
         ALLOCATE ( surf_usm_h%transmissivity(1:surf_usm_h%ns)     )
         ALLOCATE ( surf_usm_h%lai(1:surf_usm_h%ns)                )
-        ALLOCATE ( surf_usm_h%emissivity(0:2,1:surf_usm_h%ns)     )
+        ALLOCATE ( surf_usm_h%emissivity(1:surf_usm_h%ns,0:2)     )
         ALLOCATE ( surf_usm_h%r_a(1:surf_usm_h%ns)                )
         ALLOCATE ( surf_usm_h%r_a_green(1:surf_usm_h%ns)          )
@@ -873,5 +874,5 @@
            ALLOCATE ( surf_usm_v(l)%transmissivity(1:surf_usm_v(l)%ns)     )
            ALLOCATE ( surf_usm_v(l)%lai(1:surf_usm_v(l)%ns)                )
-           ALLOCATE ( surf_usm_v(l)%emissivity(0:2,1:surf_usm_v(l)%ns)     )
+           ALLOCATE ( surf_usm_v(l)%emissivity(1:surf_usm_v(l)%ns,0:2)     )
            ALLOCATE ( surf_usm_v(l)%r_a(1:surf_usm_v(l)%ns)                )
            ALLOCATE ( surf_usm_v(l)%r_a_green(1:surf_usm_v(l)%ns)          )
@@ -3616,7 +3617,7 @@
 !
 !--        Initialize relatvie wall- (0), green- (1) and window (2) fractions
-           surf_usm_h%frac(ind_veg_wall,m)  = building_pars(ind_wall_frac_r,building_type)   
-           surf_usm_h%frac(ind_pav_green,m) = building_pars(ind_green_frac_r,building_type)  
-           surf_usm_h%frac(ind_wat_win,m)   = building_pars(ind_win_frac_r,building_type)  
+           surf_usm_h%frac(m,ind_veg_wall)  = building_pars(ind_wall_frac_r,building_type)   
+           surf_usm_h%frac(m,ind_pav_green) = building_pars(ind_green_frac_r,building_type)  
+           surf_usm_h%frac(m,ind_wat_win)   = building_pars(ind_win_frac_r,building_type)  
            surf_usm_h%lai(m)                = building_pars(ind_lai_r,building_type)  
 
@@ -3650,7 +3651,7 @@
 !
 !--        emissivity of wall-, green- and window fraction 
-           surf_usm_h%emissivity(ind_veg_wall,m)  = building_pars(ind_emis_wall_r,building_type)
-           surf_usm_h%emissivity(ind_pav_green,m) = building_pars(ind_emis_green_r,building_type)
-           surf_usm_h%emissivity(ind_wat_win,m)   = building_pars(ind_emis_win_r,building_type)
+           surf_usm_h%emissivity(m,ind_veg_wall)  = building_pars(ind_emis_wall_r,building_type)
+           surf_usm_h%emissivity(m,ind_pav_green) = building_pars(ind_emis_green_r,building_type)
+           surf_usm_h%emissivity(m,ind_wat_win)   = building_pars(ind_emis_win_r,building_type)
 
            surf_usm_h%transmissivity(m)      = building_pars(ind_trans_r,building_type)
@@ -3661,7 +3662,7 @@
 !
 !--        albedo type for wall fraction, green fraction, window fraction
-           surf_usm_h%albedo_type(ind_veg_wall,m)  = INT( building_pars(ind_alb_wall_r,building_type)  )
-           surf_usm_h%albedo_type(ind_pav_green,m) = INT( building_pars(ind_alb_green_r,building_type) )
-           surf_usm_h%albedo_type(ind_wat_win,m)   = INT( building_pars(ind_alb_win_r,building_type)   )
+           surf_usm_h%albedo_type(m,ind_veg_wall)  = INT( building_pars(ind_alb_wall_r,building_type)  )
+           surf_usm_h%albedo_type(m,ind_pav_green) = INT( building_pars(ind_alb_green_r,building_type) )
+           surf_usm_h%albedo_type(m,ind_wat_win)   = INT( building_pars(ind_alb_win_r,building_type)   )
 
            surf_usm_h%zw(nzb_wall,m)         = building_pars(ind_thick_1_wall_r,building_type)
@@ -3774,7 +3775,7 @@
 !
 !--           Initialize relatvie wall- (0), green- (1) and window (2) fractions
-              surf_usm_v(l)%frac(ind_veg_wall,m)   = building_pars(ind_wall_frac,building_type)   
-              surf_usm_v(l)%frac(ind_pav_green,m)  = building_pars(ind_green_frac_w,building_type) 
-              surf_usm_v(l)%frac(ind_wat_win,m)    = building_pars(ind_win_frac,building_type)  
+              surf_usm_v(l)%frac(m,ind_veg_wall)   = building_pars(ind_wall_frac,building_type)   
+              surf_usm_v(l)%frac(m,ind_pav_green)  = building_pars(ind_green_frac_w,building_type) 
+              surf_usm_v(l)%frac(m,ind_wat_win)    = building_pars(ind_win_frac,building_type)  
               surf_usm_v(l)%lai(m)                 = building_pars(ind_lai_w,building_type)  
 
@@ -3813,7 +3814,7 @@
 !
 !--           emissivity of wall-, green- and window fraction 
-              surf_usm_v(l)%emissivity(ind_veg_wall,m)  = building_pars(ind_emis_wall,building_type)
-              surf_usm_v(l)%emissivity(ind_pav_green,m) = building_pars(ind_emis_green,building_type)
-              surf_usm_v(l)%emissivity(ind_wat_win,m)   = building_pars(ind_emis_win,building_type)
+              surf_usm_v(l)%emissivity(m,ind_veg_wall)  = building_pars(ind_emis_wall,building_type)
+              surf_usm_v(l)%emissivity(m,ind_pav_green) = building_pars(ind_emis_green,building_type)
+              surf_usm_v(l)%emissivity(m,ind_wat_win)   = building_pars(ind_emis_win,building_type)
 
               surf_usm_v(l)%transmissivity(m)      = building_pars(ind_trans,building_type)
@@ -3823,7 +3824,7 @@
               surf_usm_v(l)%z0q(m)                 = building_pars(ind_z0qh,building_type)
 
-              surf_usm_v(l)%albedo_type(ind_veg_wall,m)  = INT( building_pars(ind_alb_wall,building_type) )
-              surf_usm_v(l)%albedo_type(ind_pav_green,m) = INT( building_pars(ind_alb_green,building_type) )
-              surf_usm_v(l)%albedo_type(ind_wat_win,m)   = INT( building_pars(ind_alb_win,building_type) )
+              surf_usm_v(l)%albedo_type(m,ind_veg_wall)  = INT( building_pars(ind_alb_wall,building_type) )
+              surf_usm_v(l)%albedo_type(m,ind_pav_green) = INT( building_pars(ind_alb_green,building_type) )
+              surf_usm_v(l)%albedo_type(m,ind_wat_win)   = INT( building_pars(ind_alb_win,building_type) )
 
               surf_usm_v(l)%zw(nzb_wall,m)         = building_pars(ind_thick_1,building_type)
@@ -3880,7 +3881,7 @@
 !
 !--              Initialize relatvie wall- (0), green- (1) and window (2) fractions
-                 surf_usm_h%frac(ind_veg_wall,m)  = building_pars(ind_wall_frac_r,st)   
-                 surf_usm_h%frac(ind_pav_green,m) = building_pars(ind_green_frac_r,st)  
-                 surf_usm_h%frac(ind_wat_win,m)   = building_pars(ind_win_frac_r,st)  
+                 surf_usm_h%frac(m,ind_veg_wall)  = building_pars(ind_wall_frac_r,st)   
+                 surf_usm_h%frac(m,ind_pav_green) = building_pars(ind_green_frac_r,st)  
+                 surf_usm_h%frac(m,ind_wat_win)   = building_pars(ind_win_frac_r,st)  
                  surf_usm_h%lai(m)                = building_pars(ind_lai_r,st)  
 
@@ -3916,7 +3917,7 @@
 !
 !--              emissivity of wall-, green- and window fraction 
-                 surf_usm_h%emissivity(ind_veg_wall,m)  = building_pars(ind_emis_wall_r,st)
-                 surf_usm_h%emissivity(ind_pav_green,m) = building_pars(ind_emis_green_r,st)
-                 surf_usm_h%emissivity(ind_wat_win,m)   = building_pars(ind_emis_win_r,st)
+                 surf_usm_h%emissivity(m,ind_veg_wall)  = building_pars(ind_emis_wall_r,st)
+                 surf_usm_h%emissivity(m,ind_pav_green) = building_pars(ind_emis_green_r,st)
+                 surf_usm_h%emissivity(m,ind_wat_win)   = building_pars(ind_emis_win_r,st)
 
                  surf_usm_h%transmissivity(m)      = building_pars(ind_trans_r,st)
@@ -3927,7 +3928,7 @@
 !
 !--              albedo type for wall fraction, green fraction, window fraction
-                 surf_usm_h%albedo_type(ind_veg_wall,m)  = INT( building_pars(ind_alb_wall_r,st) )
-                 surf_usm_h%albedo_type(ind_pav_green,m) = INT( building_pars(ind_alb_green_r,st) )
-                 surf_usm_h%albedo_type(ind_wat_win,m)   = INT( building_pars(ind_alb_win_r,st) )
+                 surf_usm_h%albedo_type(m,ind_veg_wall)  = INT( building_pars(ind_alb_wall_r,st) )
+                 surf_usm_h%albedo_type(m,ind_pav_green) = INT( building_pars(ind_alb_green_r,st) )
+                 surf_usm_h%albedo_type(m,ind_wat_win)   = INT( building_pars(ind_alb_win_r,st) )
 
                  surf_usm_h%zw(nzb_wall,m)         = building_pars(ind_thick_1_wall_r,st)
@@ -4047,7 +4048,7 @@
 !
 !--                 Initialize relatvie wall- (0), green- (1) and window (2) fractions
-                    surf_usm_v(l)%frac(ind_veg_wall,m)  = building_pars(ind_wall_frac,st)   
-                    surf_usm_v(l)%frac(ind_pav_green,m) = building_pars(ind_green_frac_w,st)  
-                    surf_usm_v(l)%frac(ind_wat_win,m)   = building_pars(ind_win_frac,st)   
+                    surf_usm_v(l)%frac(m,ind_veg_wall)  = building_pars(ind_wall_frac,st)   
+                    surf_usm_v(l)%frac(m,ind_pav_green) = building_pars(ind_green_frac_w,st)  
+                    surf_usm_v(l)%frac(m,ind_wat_win)   = building_pars(ind_win_frac,st)   
                     surf_usm_v(l)%lai(m)                = building_pars(ind_lai_w,st)  
 
@@ -4086,7 +4087,7 @@
 !
 !--                 emissivity of wall-, green- and window fraction 
-                    surf_usm_v(l)%emissivity(ind_veg_wall,m)  = building_pars(ind_emis_wall,st)
-                    surf_usm_v(l)%emissivity(ind_pav_green,m) = building_pars(ind_emis_green,st)
-                    surf_usm_v(l)%emissivity(ind_wat_win,m)   = building_pars(ind_emis_win,st)
+                    surf_usm_v(l)%emissivity(m,ind_veg_wall)  = building_pars(ind_emis_wall,st)
+                    surf_usm_v(l)%emissivity(m,ind_pav_green) = building_pars(ind_emis_green,st)
+                    surf_usm_v(l)%emissivity(m,ind_wat_win)   = building_pars(ind_emis_win,st)
 
                     surf_usm_v(l)%transmissivity(m)      = building_pars(ind_trans,st)
@@ -4096,7 +4097,7 @@
                     surf_usm_v(l)%z0q(m)                 = building_pars(ind_z0qh,st)
 
-                    surf_usm_v(l)%albedo_type(ind_veg_wall,m)  = INT( building_pars(ind_alb_wall,st) )
-                    surf_usm_v(l)%albedo_type(ind_pav_green,m) = INT( building_pars(ind_alb_green,st) )
-                    surf_usm_v(l)%albedo_type(ind_wat_win,m)   = INT( building_pars(ind_alb_win,st) )
+                    surf_usm_v(l)%albedo_type(m,ind_veg_wall)  = INT( building_pars(ind_alb_wall,st) )
+                    surf_usm_v(l)%albedo_type(m,ind_pav_green) = INT( building_pars(ind_alb_green,st) )
+                    surf_usm_v(l)%albedo_type(m,ind_wat_win)   = INT( building_pars(ind_alb_win,st) )
 
                     surf_usm_v(l)%zw(nzb_wall,m)         = building_pars(ind_thick_1,st)
@@ -4193,15 +4194,15 @@
               IF ( building_pars_f%pars_xy(ind_wall_frac,j,i) /=               &
                    building_pars_f%fill )                                      &
-                 surf_usm_h%frac(ind_veg_wall,m)  =                            &
+                 surf_usm_h%frac(m,ind_veg_wall)  =                            &
                                     building_pars_f%pars_xy(ind_wall_frac,j,i)   
                  
               IF ( building_pars_f%pars_xy(ind_green_frac_r,j,i) /=            &          
                    building_pars_f%fill )                                      & 
-                 surf_usm_h%frac(ind_pav_green,m) =                            &
+                 surf_usm_h%frac(m,ind_pav_green) =                            &
                                     building_pars_f%pars_xy(ind_green_frac_r,j,i) 
                  
               IF ( building_pars_f%pars_xy(ind_win_frac,j,i) /=                &
                    building_pars_f%fill )                                      & 
-                 surf_usm_h%frac(ind_wat_win,m)   =                            &
+                 surf_usm_h%frac(m,ind_wat_win)   =                            &
                                     building_pars_f%pars_xy(ind_win_frac,j,i)
  
@@ -4325,15 +4326,15 @@
               IF ( building_pars_f%pars_xy(ind_emis_wall,j,i) /=               &   
                    building_pars_f%fill )                                      &
-                 surf_usm_h%emissivity(ind_veg_wall,m)  =                      &
+                 surf_usm_h%emissivity(m,ind_veg_wall)  =                      &
                                     building_pars_f%pars_xy(ind_emis_wall,j,i)
                  
               IF ( building_pars_f%pars_xy(ind_emis_green,j,i) /=              &            
                    building_pars_f%fill )                                      &
-                 surf_usm_h%emissivity(ind_pav_green,m) =                      &
+                 surf_usm_h%emissivity(m,ind_pav_green) =                      &
                                      building_pars_f%pars_xy(ind_emis_green,j,i)
                  
               IF ( building_pars_f%pars_xy(ind_emis_win,j,i) /=                & 
                    building_pars_f%fill )                                      &
-                 surf_usm_h%emissivity(ind_wat_win,m)   =                      &
+                 surf_usm_h%emissivity(m,ind_wat_win)   =                      &
                                      building_pars_f%pars_xy(ind_emis_win,j,i)
                  
@@ -4356,14 +4357,14 @@
               IF ( building_pars_f%pars_xy(ind_alb_wall_agfl,j,i) /=           &          
                    building_pars_f%fill )                                      & 
-                 surf_usm_h%albedo_type(ind_veg_wall,m)  =                     &
+                 surf_usm_h%albedo_type(m,ind_veg_wall)  =                     &
                                  building_pars_f%pars_xy(ind_alb_wall_agfl,j,i)
                  
               IF ( building_pars_f%pars_xy(ind_alb_green_agfl,j,i) /=          &           
                    building_pars_f%fill )                                      &
-                 surf_usm_h%albedo_type(ind_pav_green,m) =                     &
+                 surf_usm_h%albedo_type(m,ind_pav_green) =                     &
                                 building_pars_f%pars_xy(ind_alb_green_agfl,j,i)
               IF ( building_pars_f%pars_xy(ind_alb_win_agfl,j,i) /=            &          
                    building_pars_f%fill )                                      &
-                 surf_usm_h%albedo_type(ind_wat_win,m)   =                     &
+                 surf_usm_h%albedo_type(m,ind_wat_win)   =                     &
                                    building_pars_f%pars_xy(ind_alb_win_agfl,j,i)
 
@@ -4481,15 +4482,15 @@
                     IF ( building_pars_f%pars_xy(ind_wall_frac,j,i) /=         &
                          building_pars_f%fill )                                &
-                       surf_usm_v(l)%frac(ind_veg_wall,m)  =                   &
+                       surf_usm_v(l)%frac(m,ind_veg_wall)  =                   &
                                           building_pars_f%pars_xy(ind_wall_frac,j,i)   
                        
                     IF ( building_pars_f%pars_xy(ind_green_frac_w,j,i) /=      &          
                          building_pars_f%fill )                                & 
-                       surf_usm_v(l)%frac(ind_pav_green,m) =                   &
+                       surf_usm_v(l)%frac(m,ind_pav_green) =                   &
                                   building_pars_f%pars_xy(ind_green_frac_w,j,i) 
                        
                     IF ( building_pars_f%pars_xy(ind_win_frac,j,i) /=          &
                          building_pars_f%fill )                                & 
-                       surf_usm_v(l)%frac(ind_wat_win,m)   =                   &
+                       surf_usm_v(l)%frac(m,ind_wat_win)   =                   &
                                        building_pars_f%pars_xy(ind_win_frac,j,i)
                     
@@ -4614,15 +4615,15 @@
                     IF ( building_pars_f%pars_xy(ind_emis_wall,j,i) /=         &   
                          building_pars_f%fill )                                &
-                       surf_usm_v(l)%emissivity(ind_veg_wall,m)  =             &
+                       surf_usm_v(l)%emissivity(m,ind_veg_wall)  =             &
                                       building_pars_f%pars_xy(ind_emis_wall,j,i)
                        
                     IF ( building_pars_f%pars_xy(ind_emis_green,j,i) /=        &            
                          building_pars_f%fill )                                &
-                       surf_usm_v(l)%emissivity(ind_pav_green,m) =             &
+                       surf_usm_v(l)%emissivity(m,ind_pav_green) =             &
                                       building_pars_f%pars_xy(ind_emis_green,j,i)
                        
                     IF ( building_pars_f%pars_xy(ind_emis_win,j,i) /=          & 
                          building_pars_f%fill )                                &
-                       surf_usm_v(l)%emissivity(ind_wat_win,m)   =             &
+                       surf_usm_v(l)%emissivity(m,ind_wat_win)   =             &
                                       building_pars_f%pars_xy(ind_emis_win,j,i)
                        
@@ -4647,14 +4648,14 @@
                     IF ( building_pars_f%pars_xy(ind_alb_wall_agfl,j,i) /=     &          
                          building_pars_f%fill )                                & 
-                       surf_usm_v(l)%albedo_type(ind_veg_wall,m)  =            &
+                       surf_usm_v(l)%albedo_type(m,ind_veg_wall)  =            &
                                  building_pars_f%pars_xy(ind_alb_wall_agfl,j,i)
                        
                     IF ( building_pars_f%pars_xy(ind_alb_green_agfl,j,i) /=    &           
                          building_pars_f%fill )                                &
-                       surf_usm_v(l)%albedo_type(ind_pav_green,m) =            &
+                       surf_usm_v(l)%albedo_type(m,ind_pav_green) =            &
                                  building_pars_f%pars_xy(ind_alb_green_agfl,j,i)
                     IF ( building_pars_f%pars_xy(ind_alb_win_agfl,j,i) /=      &          
                          building_pars_f%fill )                                &
-                       surf_usm_v(l)%albedo_type(ind_wat_win,m)   =            &
+                       surf_usm_v(l)%albedo_type(m,ind_wat_win)   =            &
                                    building_pars_f%pars_xy(ind_alb_win_agfl,j,i)
                     
@@ -4730,15 +4731,15 @@
                     IF ( building_surface_pars_f%pars(ind_s_wall_frac,is) /=                     &
                          building_surface_pars_f%fill )                                          &
-                       surf_usm_h%frac(ind_veg_wall,m) =                                         &
+                       surf_usm_h%frac(m,ind_veg_wall) =                                         &
                                 building_surface_pars_f%pars(ind_s_wall_frac,is)
 
                     IF ( building_surface_pars_f%pars(ind_s_green_frac_w,is) /=                  &
                          building_surface_pars_f%fill )                                          &
-                       surf_usm_h%frac(ind_pav_green,m) =                                        &
+                       surf_usm_h%frac(m,ind_pav_green) =                                        &
                                 building_surface_pars_f%pars(ind_s_green_frac_w,is)
 
                     IF ( building_surface_pars_f%pars(ind_s_green_frac_r,is) /=                  &
                          building_surface_pars_f%fill )                                          &
-                       surf_usm_h%frac(ind_pav_green,m) =                                        &
+                       surf_usm_h%frac(m,ind_pav_green) =                                        &
                                 building_surface_pars_f%pars(ind_s_green_frac_r,is)
                                 !TODO clarify: why should _w and _r be on the same surface?
@@ -4746,5 +4747,5 @@
                     IF ( building_surface_pars_f%pars(ind_s_win_frac,is) /=                      &
                          building_surface_pars_f%fill )                                          &
-                       surf_usm_h%frac(ind_wat_win,m) =                                          &
+                       surf_usm_h%frac(m,ind_wat_win) =                                          &
                                 building_surface_pars_f%pars(ind_s_win_frac,is)
 
@@ -4826,15 +4827,15 @@
                     IF ( building_surface_pars_f%pars(ind_s_emis_wall,is) /=                     &
                          building_surface_pars_f%fill )                                          &
-                       surf_usm_h%emissivity(ind_veg_wall,m) =                                   &
+                       surf_usm_h%emissivity(m,ind_veg_wall) =                                   &
                                 building_surface_pars_f%pars(ind_s_emis_wall,is)
 
                     IF ( building_surface_pars_f%pars(ind_s_emis_green,is) /=                    &
                          building_surface_pars_f%fill )                                          &
-                       surf_usm_h%emissivity(ind_pav_green,m) =                                  &
+                       surf_usm_h%emissivity(m,ind_pav_green) =                                  &
                                 building_surface_pars_f%pars(ind_s_emis_green,is)
 
                     IF ( building_surface_pars_f%pars(ind_s_emis_win,is) /=                      &
                          building_surface_pars_f%fill )                                          &
-                       surf_usm_h%emissivity(ind_wat_win,m) =                                    &
+                       surf_usm_h%emissivity(m,ind_wat_win) =                                    &
                                 building_surface_pars_f%pars(ind_s_emis_win,is)
 
@@ -4877,15 +4878,15 @@
                        IF ( building_surface_pars_f%pars(ind_s_wall_frac,is) /=                &
                             building_surface_pars_f%fill )                                     &
-                          surf_usm_v(l)%frac(ind_veg_wall,m) =                                 &
+                          surf_usm_v(l)%frac(m,ind_veg_wall) =                                 &
                                    building_surface_pars_f%pars(ind_s_wall_frac,is)
 
                        IF ( building_surface_pars_f%pars(ind_s_green_frac_w,is) /=             &
                             building_surface_pars_f%fill )                                     &
-                          surf_usm_v(l)%frac(ind_pav_green,m) =                                &
+                          surf_usm_v(l)%frac(m,ind_pav_green) =                                &
                                    building_surface_pars_f%pars(ind_s_green_frac_w,is)
 
                        IF ( building_surface_pars_f%pars(ind_s_green_frac_r,is) /=             &
                             building_surface_pars_f%fill )                                     &
-                          surf_usm_v(l)%frac(ind_pav_green,m) =                                &
+                          surf_usm_v(l)%frac(m,ind_pav_green) =                                &
                                    building_surface_pars_f%pars(ind_s_green_frac_r,is)
                                    !TODO clarify: why should _w and _r be on the same surface?
@@ -4893,5 +4894,5 @@
                        IF ( building_surface_pars_f%pars(ind_s_win_frac,is) /=                 &
                             building_surface_pars_f%fill )                                     &
-                          surf_usm_v(l)%frac(ind_wat_win,m) =                                  &
+                          surf_usm_v(l)%frac(m,ind_wat_win) =                                  &
                                    building_surface_pars_f%pars(ind_s_win_frac,is)
 
@@ -4973,15 +4974,15 @@
                        IF ( building_surface_pars_f%pars(ind_s_emis_wall,is) /=      &
                             building_surface_pars_f%fill )                           &
-                          surf_usm_v(l)%emissivity(ind_veg_wall,m) =                 &
+                          surf_usm_v(l)%emissivity(m,ind_veg_wall) =                 &
                                    building_surface_pars_f%pars(ind_s_emis_wall,is)
 
                        IF ( building_surface_pars_f%pars(ind_s_emis_green,is) /=     &
                             building_surface_pars_f%fill )                           &
-                          surf_usm_v(l)%emissivity(ind_pav_green,m) =                &
+                          surf_usm_v(l)%emissivity(m,ind_pav_green) =                &
                                    building_surface_pars_f%pars(ind_s_emis_green,is)
 
                        IF ( building_surface_pars_f%pars(ind_s_emis_win,is) /=       &
                             building_surface_pars_f%fill )                           &
-                          surf_usm_v(l)%emissivity(ind_wat_win,m) =                  &
+                          surf_usm_v(l)%emissivity(m,ind_wat_win) =                  &
                                    building_surface_pars_f%pars(ind_s_emis_win,is)
 
@@ -5015,5 +5016,5 @@
         relative_fractions_corrected = .FALSE.
         DO  m = 1, surf_usm_h%ns
-           sum_frac = SUM( surf_usm_h%frac(:,m) )
+           sum_frac = SUM( surf_usm_h%frac(m,:) )
            IF ( sum_frac /= 1.0_wp )  THEN
               relative_fractions_corrected = .TRUE.
@@ -5023,12 +5024,12 @@
 !--           driver creation. 
               IF ( sum_frac /= 0.0_wp )  THEN
-                 surf_usm_h%frac(:,m) = surf_usm_h%frac(:,m) / sum_frac
+                 surf_usm_h%frac(m,:) = surf_usm_h%frac(m,:) / sum_frac
 !
 !--           In case all relative fractions are erroneously set to zero,
 !--           set wall fraction to 1.
               ELSE
-                 surf_usm_h%frac(ind_veg_wall,m)  = 1.0_wp
-                 surf_usm_h%frac(ind_wat_win,m)   = 0.0_wp
-                 surf_usm_h%frac(ind_pav_green,m) = 0.0_wp
+                 surf_usm_h%frac(m,ind_veg_wall)  = 1.0_wp
+                 surf_usm_h%frac(m,ind_wat_win)   = 0.0_wp
+                 surf_usm_h%frac(m,ind_pav_green) = 0.0_wp
               ENDIF
            ENDIF
@@ -5051,5 +5052,5 @@
         DO  l = 0, 3
            DO  m = 1, surf_usm_v(l)%ns
-              sum_frac = SUM( surf_usm_v(l)%frac(:,m) )
+              sum_frac = SUM( surf_usm_v(l)%frac(m,:) )
               IF ( sum_frac /= 1.0_wp )  THEN
                  relative_fractions_corrected = .TRUE.
@@ -5057,12 +5058,12 @@
 !--              Normalize relative fractions to 1.
                  IF ( sum_frac /= 0.0_wp )  THEN
-                    surf_usm_v(l)%frac(:,m) = surf_usm_v(l)%frac(:,m) / sum_frac
+                    surf_usm_v(l)%frac(m,:) = surf_usm_v(l)%frac(m,:) / sum_frac
 !
 !--              In case all relative fractions are erroneously set to zero,
 !--              set wall fraction to 1.
                  ELSE
-                    surf_usm_v(l)%frac(ind_veg_wall,m)  = 1.0_wp
-                    surf_usm_v(l)%frac(ind_wat_win,m)   = 0.0_wp
-                    surf_usm_v(l)%frac(ind_pav_green,m) = 0.0_wp
+                    surf_usm_v(l)%frac(m,ind_veg_wall)  = 1.0_wp
+                    surf_usm_v(l)%frac(m,ind_wat_win)   = 0.0_wp
+                    surf_usm_v(l)%frac(m,ind_pav_green) = 0.0_wp
                  ENDIF
               ENDIF
@@ -5367,11 +5368,11 @@
                                          - t_wall_h(nzb_wall,m) ) *                &
                                          surf_usm_h%ddz_wall(nzb_wall+1,m)         &
-                                       + surf_usm_h%frac(ind_veg_wall,m)           &
-                                         / (surf_usm_h%frac(ind_veg_wall,m)        &
-                                           + surf_usm_h%frac(ind_pav_green,m) )    &
+                                       + surf_usm_h%frac(m,ind_veg_wall)           &
+                                         / (surf_usm_h%frac(m,ind_veg_wall)        &
+                                           + surf_usm_h%frac(m,ind_pav_green) )    &
                                          * surf_usm_h%wghf_eb(m)                   &
-                                       - surf_usm_h%frac(ind_pav_green,m)          &
-                                          / (surf_usm_h%frac(ind_veg_wall,m)       &
-                                            + surf_usm_h%frac(ind_pav_green,m) )   &
+                                       - surf_usm_h%frac(m,ind_pav_green)          &
+                                          / (surf_usm_h%frac(m,ind_veg_wall)       &
+                                            + surf_usm_h%frac(m,ind_pav_green) )   &
                                          * ( surf_usm_h%lambda_h_green(nzt_wall,m)* wall_mod(nzt_wall) &
                                            * surf_usm_h%ddz_green(nzt_wall,m)      &
@@ -5550,11 +5551,11 @@
                                         - t_wall_v(l)%t(nzb_wall,m) ) *              &
                                         surf_usm_v(l)%ddz_wall(nzb_wall+1,m)         &
-                                      + surf_usm_v(l)%frac(ind_veg_wall,m)           &
-                                        / (surf_usm_v(l)%frac(ind_veg_wall,m)        &
-                                          + surf_usm_v(l)%frac(ind_pav_green,m) )    &
+                                      + surf_usm_v(l)%frac(m,ind_veg_wall)           &
+                                        / (surf_usm_v(l)%frac(m,ind_veg_wall)        &
+                                          + surf_usm_v(l)%frac(m,ind_pav_green) )    &
                                         * surf_usm_v(l)%wghf_eb(m)                   &
-                                      - surf_usm_v(l)%frac(ind_pav_green,m)          &
-                                        / (surf_usm_v(l)%frac(ind_veg_wall,m)        &
-                                          + surf_usm_v(l)%frac(ind_pav_green,m) )    &
+                                      - surf_usm_v(l)%frac(m,ind_pav_green)          &
+                                        / (surf_usm_v(l)%frac(m,ind_veg_wall)        &
+                                          + surf_usm_v(l)%frac(m,ind_pav_green) )    &
                                         * ( surf_usm_v(l)%lambda_h_green(nzt_wall,m)* wall_mod(nzt_wall) &
                                           * surf_usm_v(l)%ddz_green(nzt_wall,m)      &
@@ -5768,5 +5769,5 @@
         !$OMP DO SCHEDULE (STATIC)
         DO  m = 1, surf_usm_h%ns
-           IF (surf_usm_h%frac(ind_pav_green,m) > 0.0_wp) THEN
+           IF (surf_usm_h%frac(m,ind_pav_green) > 0.0_wp) THEN
 !
 !--           Obtain indices
@@ -6020,5 +6021,5 @@
            DO  m = 1, surf_usm_v(l)%ns
 
-              IF (surf_usm_v(l)%frac(ind_pav_green,m) > 0.0_wp) THEN
+              IF (surf_usm_v(l)%frac(m,ind_pav_green) > 0.0_wp) THEN
 !
 !-- no substrate layer for green walls / only groundbase green walls (ivy i.e.) -> green layers get same
@@ -7271,5 +7272,5 @@
               ENDIF
 
-              surf_usm_h%albedo(:,m)    = -1.0_wp
+              surf_usm_h%albedo(m,:)    = -1.0_wp
               surf_usm_h%thickness_wall(m) = -1.0_wp
               surf_usm_h%thickness_green(m) = -1.0_wp
@@ -7288,5 +7289,5 @@
               ENDIF
               surf_usm_h%surface_types(m) = usm_par(5,jw,iw)
-              surf_usm_h%albedo(:,m)   = usm_val(1,jw,iw)
+              surf_usm_h%albedo(m,:)   = usm_val(1,jw,iw)
               surf_usm_h%transmissivity(m)    = 0.0_wp
            ENDIF
@@ -7328,10 +7329,10 @@
 !
 !--        Albedo
-           IF ( surf_usm_h%albedo(ind_veg_wall,m) < 0.0_wp )  THEN
-              surf_usm_h%albedo(:,m) = surface_params(ialbedo,ip)
+           IF ( surf_usm_h%albedo(m,ind_veg_wall) < 0.0_wp )  THEN
+              surf_usm_h%albedo(m,:) = surface_params(ialbedo,ip)
            ENDIF
 !
 !--        Albedo type is 0 (custom), others are replaced later
-           surf_usm_h%albedo_type(:,m) = 0
+           surf_usm_h%albedo_type(m,:) = 0
 !
 !--        Transmissivity
@@ -7341,5 +7342,5 @@
 !
 !--        emissivity of the wall
-           surf_usm_h%emissivity(:,m) = surface_params(iemiss,ip)
+           surf_usm_h%emissivity(m,:) = surface_params(iemiss,ip)
 !            
 !--        heat conductivity Î»S between air and wall ( W mâ2 Kâ1 )
@@ -7425,5 +7426,5 @@
                      surf_usm_v(l)%surface_types(m) = roof_category   !< default category for wall surface in roof zone
                  END IF
-                 surf_usm_v(l)%albedo(:,m)         = -1.0_wp
+                 surf_usm_v(l)%albedo(m,:)         = -1.0_wp
                  surf_usm_v(l)%thickness_wall(m)   = -1.0_wp
                  surf_usm_v(l)%thickness_window(m) = -1.0_wp
@@ -7436,5 +7437,5 @@
                      surf_usm_v(l)%surface_types(m)  = pedestrian_category   !< default category for wall surface in
                                                                              !<pedestrian zone
-                     surf_usm_v(l)%albedo(:,m)         = -1.0_wp
+                     surf_usm_v(l)%albedo(m,:)         = -1.0_wp
                      surf_usm_v(l)%thickness_wall(m)   = -1.0_wp
                      surf_usm_v(l)%thickness_window(m) = -1.0_wp
@@ -7443,5 +7444,5 @@
                  ELSE
                      surf_usm_v(l)%surface_types(m)    = usm_par(ii+1,jw,iw)
-                     surf_usm_v(l)%albedo(:,m)         = usm_val(ij,jw,iw)
+                     surf_usm_v(l)%albedo(m,:)         = usm_val(ij,jw,iw)
                      surf_usm_v(l)%thickness_wall(m)   = usm_val(ij+1,jw,iw)
                      surf_usm_v(l)%thickness_window(m) = usm_val(ij+1,jw,iw)
@@ -7454,5 +7455,5 @@
                  IF ( usm_par(ii+3,jw,iw) == 0 )  THEN
                      surf_usm_v(l)%surface_types(m)    = wall_category         !< default category for wall surface
-                     surf_usm_v(l)%albedo(:,m)         = -1.0_wp
+                     surf_usm_v(l)%albedo(m,:)         = -1.0_wp
                      surf_usm_v(l)%thickness_wall(m)   = -1.0_wp
                      surf_usm_v(l)%thickness_window(m) = -1.0_wp
@@ -7461,5 +7462,5 @@
                  ELSE
                      surf_usm_v(l)%surface_types(m)    = usm_par(ii+3,jw,iw)
-                     surf_usm_v(l)%albedo(:,m)         = usm_val(ij+2,jw,iw)
+                     surf_usm_v(l)%albedo(m,:)         = usm_val(ij+2,jw,iw)
                      surf_usm_v(l)%thickness_wall(m)   = usm_val(ij+3,jw,iw)
                      surf_usm_v(l)%thickness_window(m) = usm_val(ij+3,jw,iw)
@@ -7472,5 +7473,5 @@
                  IF ( usm_par(ii+5,jw,iw) == 0 )  THEN
                      surf_usm_v(l)%surface_types(m)    = roof_category         !< default category for roof surface
-                     surf_usm_v(l)%albedo(:,m)         = -1.0_wp
+                     surf_usm_v(l)%albedo(m,:)         = -1.0_wp
                      surf_usm_v(l)%thickness_wall(m)   = -1.0_wp
                      surf_usm_v(l)%thickness_window(m) = -1.0_wp
@@ -7479,5 +7480,5 @@
                  ELSE
                      surf_usm_v(l)%surface_types(m)    = usm_par(ii+5,jw,iw)
-                     surf_usm_v(l)%albedo(:,m)         = usm_val(ij+4,jw,iw)
+                     surf_usm_v(l)%albedo(m,:)         = usm_val(ij+4,jw,iw)
                      surf_usm_v(l)%thickness_wall(m)   = usm_val(ij+5,jw,iw)
                      surf_usm_v(l)%thickness_window(m) = usm_val(ij+5,jw,iw)
@@ -7501,5 +7502,5 @@
                      surf_usm_v(l)%surface_types(m) = roof_category   !< default category for wall surface in roof zone
                  END IF
-                 surf_usm_v(l)%albedo(:,m)         = -1.0_wp
+                 surf_usm_v(l)%albedo(m,:)         = -1.0_wp
                  surf_usm_v(l)%thickness_wall(m)   = -1.0_wp
                  surf_usm_v(l)%thickness_window(m) = -1.0_wp
@@ -7541,9 +7542,9 @@
 !
 !--           Albedo
-              IF ( surf_usm_v(l)%albedo(ind_veg_wall,m) < 0.0_wp )  THEN
-                 surf_usm_v(l)%albedo(:,m) = surface_params(ialbedo,ip)
+              IF ( surf_usm_v(l)%albedo(m,ind_veg_wall) < 0.0_wp )  THEN
+                 surf_usm_v(l)%albedo(m,:) = surface_params(ialbedo,ip)
               ENDIF
 !--           Albedo type is 0 (custom), others are replaced later
-              surf_usm_v(l)%albedo_type(:,m) = 0
+              surf_usm_v(l)%albedo_type(m,:) = 0
 !--           Transmissivity of the windows
               IF ( surf_usm_v(l)%transmissivity(m) < 0.0_wp )  THEN
@@ -7833,10 +7834,10 @@
 !--       Note, this is a temporary fix and need to be removed later.  
            IF ( during_spinup )  THEN
-              frac_win   = surf_usm_h%frac(ind_wat_win,m)
-              frac_wall  = surf_usm_h%frac(ind_veg_wall,m)
-              frac_green = surf_usm_h%frac(ind_pav_green,m)
-              surf_usm_h%frac(ind_wat_win,m)   = 0.0_wp
-              surf_usm_h%frac(ind_veg_wall,m)  = 1.0_wp
-              surf_usm_h%frac(ind_pav_green,m) = 0.0_wp
+              frac_win   = surf_usm_h%frac(m,ind_wat_win)
+              frac_wall  = surf_usm_h%frac(m,ind_veg_wall)
+              frac_green = surf_usm_h%frac(m,ind_pav_green)
+              surf_usm_h%frac(m,ind_wat_win)   = 0.0_wp
+              surf_usm_h%frac(m,ind_veg_wall)  = 1.0_wp
+              surf_usm_h%frac(m,ind_pav_green) = 0.0_wp
            ENDIF
 !
@@ -7869,5 +7870,5 @@
            rho_cp  = c_p * hyp(k) / ( r_d * surf_usm_h%pt1(m) * exner(k) )
 
-           IF ( surf_usm_h%frac(ind_pav_green,m) > 0.0_wp )  THEN
+           IF ( surf_usm_h%frac(m,ind_pav_green) > 0.0_wp )  THEN
 !
 !--           Calculate frequently used parameters
@@ -7921,5 +7922,5 @@
         
 
-           IF ( surf_usm_h%frac(ind_pav_green,m) > 0.0_wp ) THEN
+           IF ( surf_usm_h%frac(m,ind_pav_green) > 0.0_wp ) THEN
 !--           Adapted from LSM:
 !--           Second step: calculate canopy resistance r_canopy
@@ -8021,18 +8022,18 @@
 !--     is used
            coef_1 = surf_usm_h%rad_net_l(m) +                                  & 
-                 ( 3.0_wp + 1.0_wp ) * surf_usm_h%emissivity(ind_veg_wall,m) * &
+                 ( 3.0_wp + 1.0_wp ) * surf_usm_h%emissivity(m,ind_veg_wall) * &
                                        sigma_sb * t_surf_wall_h(m) ** 4 +      &  
                                        f_shf * surf_usm_h%pt1(m) +             &
                                        lambda_surface * t_wall_h(nzb_wall,m)
-           IF ( ( .NOT. during_spinup ) .AND. (surf_usm_h%frac(ind_wat_win,m) > 0.0_wp ) ) THEN
+           IF ( ( .NOT. during_spinup ) .AND. (surf_usm_h%frac(m,ind_wat_win) > 0.0_wp ) ) THEN
               coef_window_1 = surf_usm_h%rad_net_l(m) +                           & 
-                      ( 3.0_wp + 1.0_wp ) * surf_usm_h%emissivity(ind_wat_win,m)  &
+                      ( 3.0_wp + 1.0_wp ) * surf_usm_h%emissivity(m,ind_wat_win)  &
                                           * sigma_sb * t_surf_window_h(m) ** 4 +  &  
                                           f_shf_window * surf_usm_h%pt1(m) +      &
                                           lambda_surface_window * t_window_h(nzb_wall,m)
            ENDIF                 
-           IF ( ( humidity ) .AND. ( surf_usm_h%frac(ind_pav_green,m) > 0.0_wp ) )  THEN
+           IF ( ( humidity ) .AND. ( surf_usm_h%frac(m,ind_pav_green) > 0.0_wp ) )  THEN
                     coef_green_1 = surf_usm_h%rad_net_l(m) +                                 & 
-                   ( 3.0_wp + 1.0_wp ) * surf_usm_h%emissivity(ind_pav_green,m) * sigma_sb * &
+                   ( 3.0_wp + 1.0_wp ) * surf_usm_h%emissivity(m,ind_pav_green) * sigma_sb * &
                                        t_surf_green_h(m) ** 4 +                  &  
                                           f_shf_green * surf_usm_h%pt1(m) + f_qsws * ( qv1 - q_s    &
@@ -8041,5 +8042,5 @@
            ELSE
            coef_green_1 = surf_usm_h%rad_net_l(m) +                            & 
-                 ( 3.0_wp + 1.0_wp ) * surf_usm_h%emissivity(ind_pav_green,m) *&
+                 ( 3.0_wp + 1.0_wp ) * surf_usm_h%emissivity(m,ind_pav_green) *&
                                        sigma_sb * t_surf_green_h(m) ** 4 +     &  
                                        f_shf_green * surf_usm_h%pt1(m) +       &
@@ -8048,18 +8049,18 @@
 !
 !--        denominator of the prognostic equation
-           coef_2 = 4.0_wp * surf_usm_h%emissivity(ind_veg_wall,m) *           &
+           coef_2 = 4.0_wp * surf_usm_h%emissivity(m,ind_veg_wall) *           &
                              sigma_sb * t_surf_wall_h(m) ** 3                  &
                            + lambda_surface + f_shf / exner(k)
-           IF ( ( .NOT. during_spinup ) .AND. ( surf_usm_h%frac(ind_wat_win,m) > 0.0_wp ) ) THEN
-              coef_window_2 = 4.0_wp * surf_usm_h%emissivity(ind_wat_win,m) *     &
+           IF ( ( .NOT. during_spinup ) .AND. ( surf_usm_h%frac(m,ind_wat_win) > 0.0_wp ) ) THEN
+              coef_window_2 = 4.0_wp * surf_usm_h%emissivity(m,ind_wat_win) *     &
                                 sigma_sb * t_surf_window_h(m) ** 3                &
                               + lambda_surface_window + f_shf_window / exner(k)
            ENDIF
-           IF ( ( humidity ) .AND. ( surf_usm_h%frac(ind_pav_green,m) > 0.0_wp ) )  THEN
-              coef_green_2 = 4.0_wp * surf_usm_h%emissivity(ind_pav_green,m) * sigma_sb *    &
+           IF ( ( humidity ) .AND. ( surf_usm_h%frac(m,ind_pav_green) > 0.0_wp ) )  THEN
+              coef_green_2 = 4.0_wp * surf_usm_h%emissivity(m,ind_pav_green) * sigma_sb *    &
                                 t_surf_green_h(m) ** 3 + f_qsws * dq_s_dt                    &
                               + lambda_surface_green + f_shf_green / exner(k)
            ELSE
-           coef_green_2 = 4.0_wp * surf_usm_h%emissivity(ind_pav_green,m) * sigma_sb *    &
+           coef_green_2 = 4.0_wp * surf_usm_h%emissivity(m,ind_pav_green) * sigma_sb *    &
                              t_surf_green_h(m) ** 3                                       &
                            + lambda_surface_green + f_shf_green / exner(k)
@@ -8071,5 +8072,5 @@
                              surf_usm_h%c_surface(m) * t_surf_wall_h(m) ) /        & 
                            ( surf_usm_h%c_surface(m) + coef_2 * dt_3d * tsc(2) ) 
-           IF (( .NOT. during_spinup ) .AND. (surf_usm_h%frac(ind_wat_win,m) > 0.0_wp)) THEN
+           IF (( .NOT. during_spinup ) .AND. (surf_usm_h%frac(m,ind_wat_win) > 0.0_wp)) THEN
               t_surf_window_h_p(m) = ( coef_window_1 * dt_3d * tsc(2) +                        &
                                 surf_usm_h%c_surface_window(m) * t_surf_window_h(m) ) /        & 
@@ -8093,7 +8094,7 @@
 !--        store also vpt_surface, which is, due to the lack of moisture on roofs simply
 !--        assumed to be the surface temperature.
-           surf_usm_h%pt_surface(m) = ( surf_usm_h%frac(ind_veg_wall,m) * t_surf_wall_h_p(m)   &
-                               + surf_usm_h%frac(ind_wat_win,m) * t_surf_window_h_p(m)         &
-                               + surf_usm_h%frac(ind_pav_green,m) * t_surf_green_h_p(m) )      &
+           surf_usm_h%pt_surface(m) = ( surf_usm_h%frac(m,ind_veg_wall) * t_surf_wall_h_p(m)   &
+                               + surf_usm_h%frac(m,ind_wat_win) * t_surf_window_h_p(m)         &
+                               + surf_usm_h%frac(m,ind_pav_green) * t_surf_green_h_p(m) )      &
                                / exner(k)
                                
@@ -8138,12 +8139,12 @@
 !--        rad_net_l is never used!
            surf_usm_h%rad_net_l(m) = surf_usm_h%rad_net_l(m) +                           &
-                                     surf_usm_h%frac(ind_veg_wall,m) *                   &
-                                     sigma_sb * surf_usm_h%emissivity(ind_veg_wall,m) *  &
+                                     surf_usm_h%frac(m,ind_veg_wall) *                   &
+                                     sigma_sb * surf_usm_h%emissivity(m,ind_veg_wall) *  &
                                      ( t_surf_wall_h_p(m)**4 - t_surf_wall_h(m)**4 )     &
-                                    + surf_usm_h%frac(ind_wat_win,m) *                   &
-                                     sigma_sb * surf_usm_h%emissivity(ind_wat_win,m) *   &
+                                    + surf_usm_h%frac(m,ind_wat_win) *                   &
+                                     sigma_sb * surf_usm_h%emissivity(m,ind_wat_win) *   &
                                      ( t_surf_window_h_p(m)**4 - t_surf_window_h(m)**4 ) &
-                                    + surf_usm_h%frac(ind_pav_green,m) *                 &
-                                     sigma_sb * surf_usm_h%emissivity(ind_pav_green,m) * &
+                                    + surf_usm_h%frac(m,ind_pav_green) *                 &
+                                     sigma_sb * surf_usm_h%emissivity(m,ind_pav_green) * &
                                      ( t_surf_green_h_p(m)**4 - t_surf_green_h(m)**4 )
 
@@ -8158,9 +8159,9 @@
 !--        ground/wall/roof surface heat flux
            surf_usm_h%wshf_eb(m)   = - f_shf  * ( surf_usm_h%pt1(m) - t_surf_wall_h_p(m) / exner(k) ) *          &
-                                       surf_usm_h%frac(ind_veg_wall,m)         &
+                                       surf_usm_h%frac(m,ind_veg_wall)         &
                                      - f_shf_window  * ( surf_usm_h%pt1(m) - t_surf_window_h_p(m) / exner(k) ) * &
-                                       surf_usm_h%frac(ind_wat_win,m)          &
+                                       surf_usm_h%frac(m,ind_wat_win)          &
                                      - f_shf_green  * ( surf_usm_h%pt1(m) - t_surf_green_h_p(m) / exner(k) ) *   &
-                                       surf_usm_h%frac(ind_pav_green,m)
+                                       surf_usm_h%frac(m,ind_pav_green)
 !           
 !--        store kinematic surface heat fluxes for utilization in other processes
@@ -8175,5 +8176,5 @@
       
 
-           IF (surf_usm_h%frac(ind_pav_green,m) > 0.0_wp) THEN
+           IF (surf_usm_h%frac(m,ind_pav_green) > 0.0_wp) THEN
               
            
@@ -8221,5 +8222,5 @@
                     IF ( m_liq_usm_h%var_usm_1d(m) /= m_liq_max )  THEN
                        surf_usm_h%qsws_liq(m) = surf_usm_h%qsws_liq(m)                &
-                                        + surf_usm_h%frac(ind_pav_green,m) * prr(k+k_off,j+j_off,i+i_off)&
+                                        + surf_usm_h%frac(m,ind_pav_green) * prr(k+k_off,j+j_off,i+i_off)&
                                         * hyrho(k+k_off)                              &
                                         * 0.001_wp * rho_l * l_v
@@ -8286,7 +8287,7 @@
 !--        values are restored.
            IF ( during_spinup )  THEN
-              surf_usm_h%frac(ind_wat_win,m)   = frac_win
-              surf_usm_h%frac(ind_veg_wall,m)  = frac_wall
-              surf_usm_h%frac(ind_pav_green,m) = frac_green
+              surf_usm_h%frac(m,ind_wat_win)   = frac_win
+              surf_usm_h%frac(m,ind_veg_wall)  = frac_wall
+              surf_usm_h%frac(m,ind_pav_green) = frac_green
            ENDIF
  
@@ -8302,10 +8303,10 @@
 !--           Note, this is a temporary fix and need to be removed later. 
               IF ( during_spinup )  THEN
-                 frac_win   = surf_usm_v(l)%frac(ind_wat_win,m)
-                 frac_wall  = surf_usm_v(l)%frac(ind_veg_wall,m)
-                 frac_green = surf_usm_v(l)%frac(ind_pav_green,m)
-                 surf_usm_v(l)%frac(ind_wat_win,m)   = 0.0_wp
-                 surf_usm_v(l)%frac(ind_veg_wall,m)  = 1.0_wp
-                 surf_usm_v(l)%frac(ind_pav_green,m) = 0.0_wp
+                 frac_win   = surf_usm_v(l)%frac(m,ind_wat_win)
+                 frac_wall  = surf_usm_v(l)%frac(m,ind_veg_wall)
+                 frac_green = surf_usm_v(l)%frac(m,ind_pav_green)
+                 surf_usm_v(l)%frac(m,ind_wat_win)   = 0.0_wp
+                 surf_usm_v(l)%frac(m,ind_veg_wall)  = 1.0_wp
+                 surf_usm_v(l)%frac(m,ind_pav_green) = 0.0_wp
               ENDIF
 !
@@ -8331,10 +8332,10 @@
               ENDIF
 !
-!--          calculate rho * c_p coefficient at wall layer
+!--           calculate rho * c_p coefficient at wall layer
               rho_cp  = c_p * hyp(k) / ( r_d * surf_usm_v(l)%pt1(m) * exner(k) )
               
-              IF (surf_usm_v(l)%frac(1,m) > 0.0_wp )  THEN
-!
-!--            Calculate frequently used parameters
+              IF (surf_usm_v(l)%frac(m,ind_pav_green) > 0.0_wp )  THEN
+!
+!--              Calculate frequently used parameters
                  rho_lv    = rho_cp / c_p * l_v
                  drho_l_lv = 1.0_wp / (rho_l * l_v)
@@ -8382,5 +8383,5 @@
  
 
-              IF ( surf_usm_v(l)%frac(ind_pav_green,m) > 0.0_wp ) THEN
+              IF ( surf_usm_v(l)%frac(m,ind_pav_green) > 0.0_wp ) THEN
 !
 !--             Adapted from LSM:
@@ -8460,20 +8461,20 @@
               coef_1 = surf_usm_v(l)%rad_net_l(m) +                             & ! coef +1 corresponds to -lwout
                                                                                   ! included in calculation of radnet_l
-              ( 3.0_wp + 1.0_wp ) * surf_usm_v(l)%emissivity(ind_veg_wall,m) *  &
+              ( 3.0_wp + 1.0_wp ) * surf_usm_v(l)%emissivity(m,ind_veg_wall) *  &
                                       sigma_sb *  t_surf_wall_v(l)%t(m) ** 4 +  &  
                                       f_shf * surf_usm_v(l)%pt1(m) +            &
                                       lambda_surface * t_wall_v(l)%t(nzb_wall,m)
-              IF ( ( .NOT. during_spinup ) .AND. ( surf_usm_v(l)%frac(ind_wat_win,m) > 0.0_wp ) ) THEN
+              IF ( ( .NOT. during_spinup ) .AND. ( surf_usm_v(l)%frac(m,ind_wat_win) > 0.0_wp ) ) THEN
                  coef_window_1 = surf_usm_v(l)%rad_net_l(m) +                   & ! coef +1 corresponds to -lwout
                                                                                   ! included in calculation of radnet_l
-                ( 3.0_wp + 1.0_wp ) * surf_usm_v(l)%emissivity(ind_wat_win,m) * &
+                ( 3.0_wp + 1.0_wp ) * surf_usm_v(l)%emissivity(m,ind_wat_win) * &
                                       sigma_sb * t_surf_window_v(l)%t(m) ** 4 + &  
                                       f_shf * surf_usm_v(l)%pt1(m) +            &
                                       lambda_surface_window * t_window_v(l)%t(nzb_wall,m)
               ENDIF
-              IF ( ( humidity ) .AND. ( surf_usm_v(l)%frac(ind_pav_green,m) > 0.0_wp ) )  THEN
+              IF ( ( humidity ) .AND. ( surf_usm_v(l)%frac(m,ind_pav_green) > 0.0_wp ) )  THEN
                  coef_green_1 = surf_usm_v(l)%rad_net_l(m) +                      & ! coef +1 corresponds to -lwout
                                                                                     ! included in calculation of radnet_l
-                 ( 3.0_wp + 1.0_wp ) * surf_usm_v(l)%emissivity(ind_pav_green,m) * sigma_sb *  &
+                 ( 3.0_wp + 1.0_wp ) * surf_usm_v(l)%emissivity(m,ind_pav_green) * sigma_sb *  &
                                       t_surf_green_v(l)%t(m) ** 4 +               &  
                                       f_shf * surf_usm_v(l)%pt1(m) +     f_qsws * ( qv1 - q_s  &
@@ -8483,5 +8484,5 @@
                 coef_green_1 = surf_usm_v(l)%rad_net_l(m) +                       & ! coef +1 corresponds to -lwout included
                                                                                     ! in calculation of radnet_l
-                ( 3.0_wp + 1.0_wp ) * surf_usm_v(l)%emissivity(ind_pav_green,m) * sigma_sb *  &
+                ( 3.0_wp + 1.0_wp ) * surf_usm_v(l)%emissivity(m,ind_pav_green) * sigma_sb *  &
                                       t_surf_green_v(l)%t(m) ** 4 +               &  
                                       f_shf * surf_usm_v(l)%pt1(m) +              &
@@ -8491,18 +8492,18 @@
 !
 !--           denominator of the prognostic equation
-              coef_2 = 4.0_wp * surf_usm_v(l)%emissivity(ind_veg_wall,m) * sigma_sb *   &
+              coef_2 = 4.0_wp * surf_usm_v(l)%emissivity(m,ind_veg_wall) * sigma_sb *   &
                                  t_surf_wall_v(l)%t(m) ** 3                             &
                                + lambda_surface + f_shf / exner(k)  
-              IF ( ( .NOT. during_spinup ) .AND. ( surf_usm_v(l)%frac(ind_wat_win,m) > 0.0_wp ) ) THEN             
-                 coef_window_2 = 4.0_wp * surf_usm_v(l)%emissivity(ind_wat_win,m) * sigma_sb *       &
+              IF ( ( .NOT. during_spinup ) .AND. ( surf_usm_v(l)%frac(m,ind_wat_win) > 0.0_wp ) ) THEN             
+                 coef_window_2 = 4.0_wp * surf_usm_v(l)%emissivity(m,ind_wat_win) * sigma_sb *       &
                                    t_surf_window_v(l)%t(m) ** 3                         &
                                  + lambda_surface_window + f_shf / exner(k)
               ENDIF
-              IF ( ( humidity ) .AND. ( surf_usm_v(l)%frac(ind_pav_green,m) > 0.0_wp ) )  THEN
-                  coef_green_2 = 4.0_wp * surf_usm_v(l)%emissivity(ind_pav_green,m) * sigma_sb *     &
+              IF ( ( humidity ) .AND. ( surf_usm_v(l)%frac(m,ind_pav_green) > 0.0_wp ) )  THEN
+                  coef_green_2 = 4.0_wp * surf_usm_v(l)%emissivity(m,ind_pav_green) * sigma_sb *     &
                                    t_surf_green_v(l)%t(m) ** 3  + f_qsws * dq_s_dt      &
                                  + lambda_surface_green + f_shf / exner(k)
               ELSE
-                 coef_green_2 = 4.0_wp * surf_usm_v(l)%emissivity(ind_pav_green,m) * sigma_sb *      &
+                 coef_green_2 = 4.0_wp * surf_usm_v(l)%emissivity(m,ind_pav_green) * sigma_sb *      &
                                    t_surf_green_v(l)%t(m) ** 3                          &
                                  + lambda_surface_green + f_shf / exner(k)
@@ -8514,5 +8515,5 @@
                              surf_usm_v(l)%c_surface(m) * t_surf_wall_v(l)%t(m) ) / & 
                              ( surf_usm_v(l)%c_surface(m) + coef_2 * dt_3d * tsc(2) ) 
-              IF ( ( .NOT. during_spinup ) .AND. ( surf_usm_v(l)%frac(ind_wat_win,m) > 0.0_wp ) ) THEN
+              IF ( ( .NOT. during_spinup ) .AND. ( surf_usm_v(l)%frac(m,ind_wat_win) > 0.0_wp ) ) THEN
                  t_surf_window_v_p(l)%t(m) = ( coef_window_1 * dt_3d * tsc(2) +                 &
                                 surf_usm_v(l)%c_surface_window(m) * t_surf_window_v(l)%t(m) ) / & 
@@ -8534,7 +8535,7 @@
 !--           store also vpt_surface, which is, due to the lack of moisture on roofs simply
 !--           assumed to be the surface temperature.     
-              surf_usm_v(l)%pt_surface(m) =  ( surf_usm_v(l)%frac(ind_veg_wall,m) * t_surf_wall_v_p(l)%t(m)  &
-                                      + surf_usm_v(l)%frac(ind_wat_win,m) * t_surf_window_v_p(l)%t(m)        &
-                                      + surf_usm_v(l)%frac(ind_pav_green,m) * t_surf_green_v_p(l)%t(m) )     &
+              surf_usm_v(l)%pt_surface(m) =  ( surf_usm_v(l)%frac(m,ind_veg_wall) * t_surf_wall_v_p(l)%t(m)  &
+                                      + surf_usm_v(l)%frac(m,ind_wat_win) * t_surf_window_v_p(l)%t(m)        &
+                                      + surf_usm_v(l)%frac(m,ind_pav_green) * t_surf_green_v_p(l)%t(m) )     &
                                       / exner(k)
                                        
@@ -8582,15 +8583,15 @@
 !--           calculate fluxes
 !--           prognostic rad_net_l is used just for output!           
-              surf_usm_v(l)%rad_net_l(m) = surf_usm_v(l)%frac(ind_veg_wall,m) *                      &
+              surf_usm_v(l)%rad_net_l(m) = surf_usm_v(l)%frac(m,ind_veg_wall) *                      &
                                            ( surf_usm_v(l)%rad_net_l(m) +                            &
                                            3.0_wp * sigma_sb *                                       &
                                            t_surf_wall_v(l)%t(m)**4 - 4.0_wp * sigma_sb *            &
                                            t_surf_wall_v(l)%t(m)**3 * t_surf_wall_v_p(l)%t(m) )      &
-                                         + surf_usm_v(l)%frac(ind_wat_win,m) *                       &
+                                         + surf_usm_v(l)%frac(m,ind_wat_win) *                       &
                                            ( surf_usm_v(l)%rad_net_l(m) +                            &
                                            3.0_wp * sigma_sb *                                       &
                                            t_surf_window_v(l)%t(m)**4 - 4.0_wp * sigma_sb *          &
                                            t_surf_window_v(l)%t(m)**3 * t_surf_window_v_p(l)%t(m) )  &
-                                         + surf_usm_v(l)%frac(ind_pav_green,m) *                     &
+                                         + surf_usm_v(l)%frac(m,ind_pav_green) *                     &
                                            ( surf_usm_v(l)%rad_net_l(m) +                            &
                                            3.0_wp * sigma_sb *                                       &
@@ -8609,9 +8610,9 @@
               surf_usm_v(l)%wshf_eb(m)   =                                     &
                  - f_shf  * ( surf_usm_v(l)%pt1(m) -                           &
-                 t_surf_wall_v_p(l)%t(m) / exner(k) ) * surf_usm_v(l)%frac(ind_veg_wall,m)       &
+                 t_surf_wall_v_p(l)%t(m) / exner(k) ) * surf_usm_v(l)%frac(m,ind_veg_wall)       &
                  - f_shf_window  * ( surf_usm_v(l)%pt1(m) -                    &
-                 t_surf_window_v_p(l)%t(m) / exner(k) ) * surf_usm_v(l)%frac(ind_wat_win,m)&
+                 t_surf_window_v_p(l)%t(m) / exner(k) ) * surf_usm_v(l)%frac(m,ind_wat_win)&
                  - f_shf_green  * ( surf_usm_v(l)%pt1(m) -                     &
-                 t_surf_green_v_p(l)%t(m) / exner(k) ) * surf_usm_v(l)%frac(ind_pav_green,m)
+                 t_surf_green_v_p(l)%t(m) / exner(k) ) * surf_usm_v(l)%frac(m,ind_pav_green)
 
 !           
@@ -8627,5 +8628,5 @@
               ENDIF              
 
-              IF ( surf_usm_v(l)%frac(ind_pav_green,m) > 0.0_wp ) THEN
+              IF ( surf_usm_v(l)%frac(m,ind_pav_green) > 0.0_wp ) THEN
  
 
@@ -8683,7 +8684,7 @@
 !--           values are restored.
               IF ( during_spinup )  THEN
-                 surf_usm_v(l)%frac(ind_wat_win,m)   = frac_win
-                 surf_usm_v(l)%frac(ind_veg_wall,m)  = frac_wall
-                 surf_usm_v(l)%frac(ind_pav_green,m) = frac_green
+                 surf_usm_v(l)%frac(m,ind_wat_win)   = frac_win
+                 surf_usm_v(l)%frac(m,ind_veg_wall)  = frac_wall
+                 surf_usm_v(l)%frac(m,ind_pav_green) = frac_green
               ENDIF
 
