Index: palm/trunk/SOURCE/urban_surface_mod.f90
===================================================================
--- palm/trunk/SOURCE/urban_surface_mod.f90	(revision 3435)
+++ palm/trunk/SOURCE/urban_surface_mod.f90	(revision 3449)
@@ -28,4 +28,10 @@
 ! -----------------
 ! $Id$
+! Bugfix: Fix average arrays allocations in usm_average_3d_data (J.Resler)
+! Bugfix: Fix reading wall temperatures (J.Resler)
+! Bugfix: Fix treating of outputs for wall temperature and sky view factors (J.Resler)
+!
+! 
+! 3435 2018-10-26 18:25:44Z gronemeier
 ! Bugfix: allocate gamma_w_green_sat until nzt_wall+1
 ! 
@@ -411,5 +417,5 @@
     
     USE plant_canopy_model_mod,                                                &
-        ONLY:  pc_heating_rate, pc_transpiration_rate
+        ONLY:  pc_heating_rate, pc_transpiration_rate, pc_latent_rate
     
     USE radiation_model_mod,                                                   &
@@ -1845,7 +1851,9 @@
                 CASE ( 'usm_rad_net' )
 !--                 array of complete radiation balance
-                    IF ( l == -1 .AND. .NOT.  ALLOCATED(surf_usm_h%rad_net_av) )  THEN
-                        ALLOCATE( surf_usm_h%rad_net_av(1:surf_usm_h%ns) )
-                        surf_usm_h%rad_net_av = 0.0_wp
+                    IF ( l == -1 ) THEN
+                        IF ( .NOT.  ALLOCATED(surf_usm_h%rad_net_av) )  THEN
+                            ALLOCATE( surf_usm_h%rad_net_av(1:surf_usm_h%ns) )
+                            surf_usm_h%rad_net_av = 0.0_wp
+                        ENDIF
                     ELSE
                         IF ( .NOT.  ALLOCATED(surf_usm_v(l)%rad_net_av) )  THEN
@@ -1968,7 +1976,9 @@
                 CASE ( 'usm_rad_hf' )
 !--                 array of heat flux from radiation for surfaces after i-th reflection
-                    IF ( l == -1 .AND. .NOT.  ALLOCATED(surf_usm_h%surfhf_av) )  THEN
-                        ALLOCATE( surf_usm_h%surfhf_av(1:surf_usm_h%ns) )
-                        surf_usm_h%surfhf_av = 0.0_wp
+                    IF ( l == -1 ) THEN
+                        IF ( .NOT.  ALLOCATED(surf_usm_h%surfhf_av) )  THEN
+                           ALLOCATE( surf_usm_h%surfhf_av(1:surf_usm_h%ns) )
+                           surf_usm_h%surfhf_av = 0.0_wp
+                        ENDIF
                     ELSE
                        IF ( .NOT.  ALLOCATED(surf_usm_v(l)%surfhf_av) )  THEN
@@ -1981,7 +1991,9 @@
 !--                 array of sensible heat flux from surfaces
 !--                 land surfaces
-                    IF ( l == -1 .AND. .NOT.  ALLOCATED(surf_usm_h%wshf_eb_av) )  THEN
-                        ALLOCATE( surf_usm_h%wshf_eb_av(1:surf_usm_h%ns) )
-                        surf_usm_h%wshf_eb_av = 0.0_wp
+                    IF ( l == -1 ) THEN
+                       IF ( .NOT.  ALLOCATED(surf_usm_h%wshf_eb_av) )  THEN
+                          ALLOCATE( surf_usm_h%wshf_eb_av(1:surf_usm_h%ns) )
+                          surf_usm_h%wshf_eb_av = 0.0_wp
+                       ENDIF
                     ELSE
                        IF ( .NOT.  ALLOCATED(surf_usm_v(l)%wshf_eb_av) )  THEN
@@ -2036,7 +2048,9 @@
                 CASE ( 'usm_wghf' )
 !--                 array of heat flux from ground (wall, roof, land)
-                    IF ( l == -1 .AND. .NOT.  ALLOCATED(surf_usm_h%wghf_eb_av) )  THEN
-                        ALLOCATE( surf_usm_h%wghf_eb_av(1:surf_usm_h%ns) )
-                        surf_usm_h%wghf_eb_av = 0.0_wp
+                    IF ( l == -1 ) THEN
+                       IF ( .NOT.  ALLOCATED(surf_usm_h%wghf_eb_av) )  THEN
+                           ALLOCATE( surf_usm_h%wghf_eb_av(1:surf_usm_h%ns) )
+                           surf_usm_h%wghf_eb_av = 0.0_wp
+                       ENDIF
                     ELSE
                        IF ( .NOT.  ALLOCATED(surf_usm_v(l)%wghf_eb_av) )  THEN
@@ -2048,7 +2062,9 @@
                 CASE ( 'usm_wghf_window' )
 !--                 array of heat flux from window ground (wall, roof, land)
-                    IF ( l == -1 .AND. .NOT.  ALLOCATED(surf_usm_h%wghf_eb_window_av) )  THEN
-                        ALLOCATE( surf_usm_h%wghf_eb_window_av(1:surf_usm_h%ns) )
-                        surf_usm_h%wghf_eb_window_av = 0.0_wp
+                    IF ( l == -1 ) THEN
+                       IF ( .NOT.  ALLOCATED(surf_usm_h%wghf_eb_window_av) )  THEN
+                           ALLOCATE( surf_usm_h%wghf_eb_window_av(1:surf_usm_h%ns) )
+                           surf_usm_h%wghf_eb_window_av = 0.0_wp
+                       ENDIF
                     ELSE
                        IF ( .NOT.  ALLOCATED(surf_usm_v(l)%wghf_eb_window_av) )  THEN
@@ -2060,7 +2076,9 @@
                 CASE ( 'usm_wghf_green' )
 !--                 array of heat flux from green ground (wall, roof, land)
-                    IF ( l == -1 .AND. .NOT.  ALLOCATED(surf_usm_h%wghf_eb_green_av) )  THEN
-                        ALLOCATE( surf_usm_h%wghf_eb_green_av(1:surf_usm_h%ns) )
-                        surf_usm_h%wghf_eb_green_av = 0.0_wp
+                    IF ( l == -1 ) THEN
+                       IF ( .NOT.  ALLOCATED(surf_usm_h%wghf_eb_green_av) )  THEN
+                           ALLOCATE( surf_usm_h%wghf_eb_green_av(1:surf_usm_h%ns) )
+                           surf_usm_h%wghf_eb_green_av = 0.0_wp
+                       ENDIF
                     ELSE
                        IF ( .NOT.  ALLOCATED(surf_usm_v(l)%wghf_eb_green_av) )  THEN
@@ -2072,7 +2090,9 @@
                 CASE ( 'usm_iwghf' )
 !--                 array of heat flux from indoor ground (wall, roof, land)
-                    IF ( l == -1 .AND. .NOT.  ALLOCATED(surf_usm_h%iwghf_eb_av) )  THEN
-                        ALLOCATE( surf_usm_h%iwghf_eb_av(1:surf_usm_h%ns) )
-                        surf_usm_h%iwghf_eb_av = 0.0_wp
+                    IF ( l == -1 ) THEN
+                       IF ( .NOT.  ALLOCATED(surf_usm_h%iwghf_eb_av) )  THEN
+                           ALLOCATE( surf_usm_h%iwghf_eb_av(1:surf_usm_h%ns) )
+                           surf_usm_h%iwghf_eb_av = 0.0_wp
+                       ENDIF
                     ELSE
                        IF ( .NOT.  ALLOCATED(surf_usm_v(l)%iwghf_eb_av) )  THEN
@@ -2084,7 +2104,9 @@
                 CASE ( 'usm_iwghf_window' )
 !--                 array of heat flux from indoor window ground (wall, roof, land)
-                    IF ( l == -1 .AND. .NOT.  ALLOCATED(surf_usm_h%iwghf_eb_window_av) )  THEN
-                        ALLOCATE( surf_usm_h%iwghf_eb_window_av(1:surf_usm_h%ns) )
-                        surf_usm_h%iwghf_eb_window_av = 0.0_wp
+                    IF ( l == -1 ) THEN
+                       IF ( .NOT.  ALLOCATED(surf_usm_h%iwghf_eb_window_av) )  THEN
+                           ALLOCATE( surf_usm_h%iwghf_eb_window_av(1:surf_usm_h%ns) )
+                           surf_usm_h%iwghf_eb_window_av = 0.0_wp
+                       ENDIF
                     ELSE
                        IF ( .NOT.  ALLOCATED(surf_usm_v(l)%iwghf_eb_window_av) )  THEN
@@ -2093,10 +2115,12 @@
                        ENDIF
                     ENDIF
-                    
+
                 CASE ( 'usm_t_surf_wall' )
 !--                 surface temperature for surfaces
-                    IF ( l == -1 .AND. .NOT.  ALLOCATED(surf_usm_h%t_surf_wall_av) )  THEN
-                        ALLOCATE( surf_usm_h%t_surf_wall_av(1:surf_usm_h%ns) )
-                        surf_usm_h%t_surf_wall_av = 0.0_wp
+                    IF ( l == -1 ) THEN
+                       IF ( .NOT.  ALLOCATED(surf_usm_h%t_surf_wall_av) )  THEN
+                           ALLOCATE( surf_usm_h%t_surf_wall_av(1:surf_usm_h%ns) )
+                           surf_usm_h%t_surf_wall_av = 0.0_wp
+                       ENDIF
                     ELSE
                        IF ( .NOT.  ALLOCATED(surf_usm_v(l)%t_surf_wall_av) )  THEN
@@ -2108,7 +2132,9 @@
                 CASE ( 'usm_t_surf_window' )
 !--                 surface temperature for window surfaces
-                    IF ( l == -1 .AND. .NOT.  ALLOCATED(surf_usm_h%t_surf_window_av) )  THEN
-                        ALLOCATE( surf_usm_h%t_surf_window_av(1:surf_usm_h%ns) )
-                        surf_usm_h%t_surf_window_av = 0.0_wp
+                    IF ( l == -1 ) THEN
+                       IF ( .NOT.  ALLOCATED(surf_usm_h%t_surf_window_av) )  THEN
+                           ALLOCATE( surf_usm_h%t_surf_window_av(1:surf_usm_h%ns) )
+                           surf_usm_h%t_surf_window_av = 0.0_wp
+                       ENDIF
                     ELSE
                        IF ( .NOT.  ALLOCATED(surf_usm_v(l)%t_surf_window_av) )  THEN
@@ -2120,7 +2146,9 @@
                 CASE ( 'usm_t_surf_green' )
 !--                 surface temperature for green surfaces
-                    IF ( l == -1 .AND. .NOT.  ALLOCATED(surf_usm_h%t_surf_green_av) )  THEN
-                        ALLOCATE( surf_usm_h%t_surf_green_av(1:surf_usm_h%ns) )
-                        surf_usm_h%t_surf_green_av = 0.0_wp
+                    IF ( l == -1 ) THEN
+                       IF ( .NOT.  ALLOCATED(surf_usm_h%t_surf_green_av) )  THEN
+                           ALLOCATE( surf_usm_h%t_surf_green_av(1:surf_usm_h%ns) )
+                           surf_usm_h%t_surf_green_av = 0.0_wp
+                       ENDIF
                     ELSE
                        IF ( .NOT.  ALLOCATED(surf_usm_v(l)%t_surf_green_av) )  THEN
@@ -2132,7 +2160,9 @@
                 CASE ( 'usm_t_surf_10cm' )
 !--                 near surface temperature for whole surfaces
-                    IF ( l == -1 .AND. .NOT.  ALLOCATED(surf_usm_h%t_surf_10cm_av) )  THEN
-                        ALLOCATE( surf_usm_h%t_surf_10cm_av(1:surf_usm_h%ns) )
-                        surf_usm_h%t_surf_10cm_av = 0.0_wp
+                    IF ( l == -1 ) THEN
+                       IF ( .NOT.  ALLOCATED(surf_usm_h%t_surf_10cm_av) )  THEN
+                           ALLOCATE( surf_usm_h%t_surf_10cm_av(1:surf_usm_h%ns) )
+                           surf_usm_h%t_surf_10cm_av = 0.0_wp
+                       ENDIF
                     ELSE
                        IF ( .NOT.  ALLOCATED(surf_usm_v(l)%t_surf_10cm_av) )  THEN
@@ -2144,7 +2174,9 @@
                 CASE ( 'usm_t_wall' )
 !--                 wall temperature for iwl layer of walls and land
-                    IF ( l == -1 .AND. .NOT.  ALLOCATED(surf_usm_h%t_wall_av) )  THEN
-                        ALLOCATE( surf_usm_h%t_wall_av(nzb_wall:nzt_wall,1:surf_usm_h%ns) )
-                        surf_usm_h%t_wall_av = 0.0_wp
+                    IF ( l == -1 ) THEN
+                       IF ( .NOT.  ALLOCATED(surf_usm_h%t_wall_av) )  THEN
+                           ALLOCATE( surf_usm_h%t_wall_av(nzb_wall:nzt_wall,1:surf_usm_h%ns) )
+                           surf_usm_h%t_wall_av = 0.0_wp
+                       ENDIF
                     ELSE
                        IF ( .NOT.  ALLOCATED(surf_usm_v(l)%t_wall_av) )  THEN
@@ -2156,7 +2188,9 @@
                 CASE ( 'usm_t_window' )
 !--                 window temperature for iwl layer of walls and land
-                    IF ( l == -1 .AND. .NOT.  ALLOCATED(surf_usm_h%t_window_av) )  THEN
-                        ALLOCATE( surf_usm_h%t_window_av(nzb_wall:nzt_wall,1:surf_usm_h%ns) )
-                        surf_usm_h%t_window_av = 0.0_wp
+                    IF ( l == -1 ) THEN
+                       IF ( .NOT.  ALLOCATED(surf_usm_h%t_window_av) )  THEN
+                           ALLOCATE( surf_usm_h%t_window_av(nzb_wall:nzt_wall,1:surf_usm_h%ns) )
+                           surf_usm_h%t_window_av = 0.0_wp
+                       ENDIF
                     ELSE
                        IF ( .NOT.  ALLOCATED(surf_usm_v(l)%t_window_av) )  THEN
@@ -2168,7 +2202,9 @@
                 CASE ( 'usm_t_green' )
 !--                 green temperature for iwl layer of walls and land
-                    IF ( l == -1 .AND. .NOT.  ALLOCATED(surf_usm_h%t_green_av) )  THEN
-                        ALLOCATE( surf_usm_h%t_green_av(nzb_wall:nzt_wall,1:surf_usm_h%ns) )
-                        surf_usm_h%t_green_av = 0.0_wp
+                    IF ( l == -1 ) THEN
+                       IF ( .NOT.  ALLOCATED(surf_usm_h%t_green_av) )  THEN
+                           ALLOCATE( surf_usm_h%t_green_av(nzb_wall:nzt_wall,1:surf_usm_h%ns) )
+                           surf_usm_h%t_green_av = 0.0_wp
+                       ENDIF
                     ELSE
                        IF ( .NOT.  ALLOCATED(surf_usm_v(l)%t_green_av) )  THEN
@@ -3091,7 +3127,8 @@
         CHARACTER(LEN=*),INTENT(OUT)   ::  unit       !<
 
-        INTEGER(iwp)                                  :: i,j          !< index
+        INTEGER(iwp)                                  :: i,j,l        !< index
+        CHARACTER(LEN=2)                              :: ls
         CHARACTER(LEN=varnamelength)                  :: var          !< TRIM(variable)
-        INTEGER(iwp), PARAMETER                       :: nl1 = 32     !< number of directional usm variables
+        INTEGER(iwp), PARAMETER                       :: nl1 = 31     !< number of directional usm variables
         CHARACTER(LEN=varnamelength), DIMENSION(nl1)  :: varlist1 = & !< list of directional usm variables
                   (/'usm_rad_net                   ', &
@@ -3119,18 +3156,15 @@
                     'usm_surfalb                   ', &
                     'usm_surfemis                  ', &
-                    'usm_t_surf                    ', &
+                    'usm_t_surf_wall               ', &
                     'usm_t_surf_window             ', &
                     'usm_t_surf_green              ', &
                     'usm_t_green                   ', &
                     'usm_t_surf_10cm               ', &
-                    'usm_t_wall                    ', &
-                    'usm_t_window                  ', &
-                    'usm_t_green                   '/)
-
-        INTEGER(iwp), PARAMETER                       :: nl2 = 9      !< number of other variables
+                    'usm_skyvf                     ', &
+                    'usm_skyvft                    '/)
+
+        INTEGER(iwp), PARAMETER                       :: nl2 = 7      !< number of other variables
         CHARACTER(LEN=varnamelength), DIMENSION(nl2)  :: varlist2 = & !< list of other usm variables
-                  (/'usm_skyvf                     ', &
-                    'usm_skyvft                    ', &
-                    'usm_svf                       ', &
+                  (/'usm_svf                       ', &
                     'usm_dif                       ', &
                     'usm_rad_pc_inlw               ', &
@@ -3139,4 +3173,10 @@
                     'usm_rad_pc_inswdif            ', &
                     'usm_rad_pc_inswref            '/)
+
+        INTEGER(iwp), PARAMETER                       :: nl3 = 3      !< number of directional layer usm variables
+        CHARACTER(LEN=varnamelength), DIMENSION(nl3)  :: varlist3 = & !< list of directional layer usm variables
+                  (/'usm_t_wall                    ', &
+                    'usm_t_window                  ', &
+                    'usm_t_green                   '/)
 
         INTEGER(iwp), PARAMETER                       :: nd = 5     !< number of directions
@@ -3158,4 +3198,18 @@
                  EXIT
               ENDIF
+              IF ( lfound ) EXIT
+           ENDDO
+        ENDDO
+        IF ( lfound ) GOTO 10
+!       directional layer variables
+        DO i = 1, nl3
+           DO j = 1, nd
+              DO l = nzb_wall, nzt_wall
+                 WRITE(ls,'(A1,I1)') '_',l
+                 IF ( TRIM(var) == TRIM(varlist3(i))//TRIM(ls)//TRIM(dirname(j)) ) THEN
+                    lfound = .TRUE.
+                    EXIT
+                 ENDIF
+              ENDDO
               IF ( lfound ) EXIT
            ENDDO
@@ -4503,5 +4557,5 @@
              var(1:9) == 'usm_qsws_'  .OR.  var(1:13) == 'usm_qsws_veg_'  .OR.              &
              var(1:13) == 'usm_qsws_liq_' .OR.                                              &
-             var(1:10) == 'usm_t_surf_wall'  .OR.  var(1:10) == 'usm_t_wall'  .OR.          &
+             var(1:15) == 'usm_t_surf_wall'  .OR.  var(1:10) == 'usm_t_wall'  .OR.          &
              var(1:17) == 'usm_t_surf_window'  .OR.  var(1:12) == 'usm_t_window'  .OR.      &
              var(1:16) == 'usm_t_surf_green'  .OR. var(1:11) == 'usm_t_green' .OR.          &
@@ -5910,25 +5964,4 @@
         ENDIF
 
-        IF ( plant_canopy )  THEN
-            
-            IF ( .NOT.  ALLOCATED( pc_heating_rate) )  THEN
-!--             then pc_heating_rate is allocated in init_plant_canopy
-!--             in case of cthf /= 0 => we need to allocate it for our use here
-                ALLOCATE( pc_heating_rate(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
-
-                pc_heating_rate = 0.0_wp
-
-            ENDIF
-
-            IF ( .NOT.  ALLOCATED( pc_transpiration_rate) )  THEN
-!--             then pc_heating_rate is allocated in init_plant_canopy
-!--             in case of cthf /= 0 => we need to allocate it for our use here
-                ALLOCATE( pc_transpiration_rate(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
-
-                pc_transpiration_rate = 0.0_wp
-
-
-            ENDIF
-        ENDIF
 !
 !--    Check for consistent initialization.
@@ -6092,11 +6125,10 @@
                ENDDO
             ENDDO
-        ELSE
-!--         If specified, replace constant wall temperatures with fully 3D values from file
-            IF ( read_wall_temp_3d )  CALL usm_read_wall_temperature()
-!
         ENDIF
-        
-!--    
+
+!--     If specified, replace constant wall temperatures with fully 3D values from file
+        IF ( read_wall_temp_3d )  CALL usm_read_wall_temperature()
+
+!--
 !--     Possibly DO user-defined actions (e.g. define heterogeneous wall surface)
         CALL user_init_urban_surface
@@ -8870,19 +8902,25 @@
 !> x, y, d, z coordinates
 !------------------------------------------------------------------------------!
-    PURE FUNCTION advance_surface(isurfl_start, isurfl_stop, x, y, z, d) &
-            result(isurfl)
-
-        INTEGER(iwp), INTENT(in)                :: isurfl_start, isurfl_stop
+    PURE FUNCTION find_surface( x, y, z, d ) result(isurfl)
+
         INTEGER(iwp), INTENT(in)                :: x, y, z, d
-        INTEGER(iwp)                            :: isx, isy, isz, isd
         INTEGER(iwp)                            :: isurfl
-
-        DO isurfl = isurfl_start, isurfl_stop
-            isx = surfl(ix, isurfl)
-            isy = surfl(iy, isurfl)
-            isz = surfl(iz, isurfl)
-            isd = surfl(id, isurfl)
-            IF ( isx==x .and. isy==y .and. isz==z .and. isd==d )  RETURN
-        ENDDO
+        INTEGER(iwp)                            :: isx, isy, isz
+
+        IF ( d == 0 ) THEN
+           DO  isurfl = 1, surf_usm_h%ns
+              isx = surf_usm_h%i(isurfl)
+              isy = surf_usm_h%j(isurfl)
+              isz = surf_usm_h%k(isurfl)
+              IF ( isx==x .and. isy==y .and. isz==z )  RETURN
+           ENDDO
+        ELSE
+           DO  isurfl = 1, surf_usm_v(d-1)%ns
+              isx = surf_usm_v(d-1)%i(isurfl)
+              isy = surf_usm_v(d-1)%j(isurfl)
+              isz = surf_usm_v(d-1)%k(isurfl)
+              IF ( isx==x .and. isy==y .and. isz==z )  RETURN
+           ENDDO
+        ENDIF
 
 !--     coordinate not found
@@ -8927,5 +8965,5 @@
                         nys <= j .and. j <= nyn)  THEN  !< local processor
 !--                     identify surface id
-                        isurfl = advance_surface(isurfl+1, nsurfl, i, j, k, d)
+                        isurfl = find_surface( i, j, k, d )
                         IF ( isurfl == -1 )  THEN
                             WRITE(message_string, '(a,4i5,a,i5,a)') 'Coordinates (xyzd) ', i, j, k, d, &
@@ -8939,7 +8977,11 @@
                            t_surf_wall_h(isurfl) = rtsurf
                            t_wall_h(:,isurfl) = rtwall(:)
+                           t_window_h(:,isurfl) = rtwall(:)
+                           t_green_h(:,isurfl) = rtwall(:)
                         ELSE
                            t_surf_wall_v(d-1)%t(isurfl) = rtsurf
                            t_wall_v(d-1)%t(:,isurfl) = rtwall(:)
+                           t_window_v(d-1)%t(:,isurfl) = rtwall(:)
+                           t_green_v(d-1)%t(:,isurfl) = rtwall(:)
                         ENDIF
                     ENDIF
@@ -9663,14 +9705,4 @@
                                           surf_usm_v(l)%rad_lw_out(m)
 
-if ((abs(t_surf_wall_v(l)%t(m)-276.).gt.100.).or.(abs(t_surf_window_v(l)%t(m)-276.).gt.300.) &
-.or.(abs(t_surf_green_v(l)%t(m)-276.).gt.100)) then
-print*, "tsurfvvvv",m,t_surf_wall_v(l)%t(m),t_surf_window_v(l)%t(m),t_surf_green_v(l)%t(m)
-print*, "params", surf_usm_v(l)%emissivity(ind_veg_wall,m),lambda_surface, t_wall_v(l)%t(nzb_wall:nzt_wall,m), &
-                  surf_usm_v(l)%emissivity(ind_wat_win,m),lambda_surface_window,t_window_v(l)%t(nzb_wall:nzt_wall,m),t_green_v(l)%t(nzb_wall:nzt_wall,m)
-print*, "dicken",surf_usm_v(l)%zw(nzb_wall:nzt_wall,m),surf_usm_v(l)%zw_window(nzb_wall:nzt_wall,m),surf_usm_v(l)%zw_green(nzb_wall:nzt_wall,m)
-print*, "c",surf_usm_v(l)%c_surface_window(m),surf_usm_v(l)%c_surface(m)
-!if ((abs(t_surf_v(l)%t(m)-276.).gt.10.).or.(abs(t_surf_window_v(l)%t(m)-276.).gt.10.)) then
-stop
-endif
 !--           numerator of the prognostic equation
               coef_1 = surf_usm_v(l)%rad_net_l(m) +                            & ! coef +1 corresponds to -lwout included in calculation of radnet_l
