Index: palm/trunk/SOURCE/urban_surface_mod.f90
===================================================================
--- palm/trunk/SOURCE/urban_surface_mod.f90	(revision 3987)
+++ palm/trunk/SOURCE/urban_surface_mod.f90	(revision 3993)
@@ -28,4 +28,8 @@
 ! -----------------
 ! $Id$
+! In order to avoid confusion with global control parameter, rename the 
+! USM-internal flag spinup into during_spinup.
+! 
+! 3987 2019-05-22 09:52:13Z kanani
 ! Introduce alternative switch for debug output during timestepping
 ! 
@@ -498,5 +502,5 @@
                timestep_scheme, tsc, coupling_char, io_blocks, io_group,       &
                message_string, time_since_reference_point, surface_pressure,   &
-               pt_surface, large_scale_forcing, lsf_surf, spinup,              &
+               pt_surface, large_scale_forcing, lsf_surf,                      &
                spinup_pt_mean, spinup_time, time_do3d, dt_do3d,                &
                average_count_3d, varnamelength, urban_surface, dz
@@ -5256,5 +5260,5 @@
 !> possible timestep.
 !------------------------------------------------------------------------------!
-    SUBROUTINE usm_material_heat_model( spinup )
+    SUBROUTINE usm_material_heat_model( during_spinup )
 
 
@@ -5267,9 +5271,10 @@
         REAL(wp), DIMENSION(nzb_wall:nzt_wall) :: wall_mod
 
-        LOGICAL      :: spinup  !< if true, no calculation of window temperatures
+        LOGICAL      :: during_spinup  !< if true, no calculation of window temperatures
 
 
         IF ( debug_output_timestep )  THEN
-           WRITE( debug_string, * ) 'usm_material_heat_model | spinup: ', spinup
+           WRITE( debug_string, * ) 'usm_material_heat_model | during_spinup: ',&
+                                     during_spinup
            CALL debug_message( debug_string, 'start' )
         ENDIF
@@ -5277,5 +5282,5 @@
         !$OMP PARALLEL PRIVATE (m, i, j, k, kw, wtend, wintend, win_absorp, wall_mod)
         wall_mod=1.0_wp
-        IF (usm_wall_mod .AND. spinup) THEN
+        IF ( usm_wall_mod  .AND.  during_spinup )  THEN
            DO  kw=nzb_wall,nzb_wall+1
                wall_mod(kw)=0.1_wp
@@ -5356,5 +5361,5 @@
 !
 !-- during spinup the tempeature inside window layers is not calculated to make larger timesteps possible
-           IF ( .NOT. spinup) THEN
+           IF ( .NOT. during_spinup ) THEN
               win_absorp = -log(surf_usm_h%transmissivity(m)) / surf_usm_h%zw_window(nzt_wall,m)
 !
@@ -5444,5 +5449,5 @@
            ENDIF
 
-           IF (.NOT. spinup) THEN
+           IF ( .NOT. during_spinup )  THEN
 !
 !--           calculate t_window tendencies for the next Runge-Kutta step
@@ -5537,5 +5542,5 @@
                                  * surf_usm_v(l)%tt_wall_m(nzb_wall:nzt_wall,m) )   
 
-              IF (.NOT. spinup) THEN
+              IF ( .NOT. during_spinup )  THEN
                  win_absorp = -log(surf_usm_v(l)%transmissivity(m)) / surf_usm_v(l)%zw_window(nzt_wall,m)
 !
@@ -5624,5 +5629,5 @@
 
 
-              IF (.NOT. spinup) THEN
+              IF ( .NOT. during_spinup )  THEN
 !
 !--              calculate t_window tendencies for the next Runge-Kutta step
@@ -5648,5 +5653,6 @@
 
         IF ( debug_output_timestep )  THEN
-           WRITE( debug_string, * ) 'usm_material_heat_model | spinup: ', spinup
+           WRITE( debug_string, * ) 'usm_material_heat_model | during_spinup: ',&
+                                    during_spinup
            CALL debug_message( debug_string, 'end' )
         ENDIF
@@ -7651,5 +7657,5 @@
 !> maximum possible timstep
 !------------------------------------------------------------------------------!
-    SUBROUTINE usm_surface_energy_balance( spinup )
+    SUBROUTINE usm_surface_energy_balance( during_spinup )
 
 
@@ -7662,5 +7668,5 @@
         INTEGER(iwp) ::  k_off     !< offset to determine index of surface element, seen from atmospheric grid point, for z
 
-        LOGICAL                               :: spinup             !true during spinup
+        LOGICAL                               :: during_spinup      !< flag indicating soil/wall spinup phase
         
         REAL(wp)                              :: frac_win           !< window fraction, used to restore original values during spinup
@@ -7711,5 +7717,6 @@
 
         IF ( debug_output_timestep )  THEN
-           WRITE( debug_string, * ) 'usm_surface_energy_balance | spinup: ', spinup
+           WRITE( debug_string, * ) 'usm_surface_energy_balance | during_spinup: ',&
+                                    during_spinup
            CALL debug_message( debug_string, 'start' )
         ENDIF
@@ -7735,5 +7742,5 @@
 !--       at the end of the loop.
 !--       Note, this is a temporary fix and need to be removed later.  
-           IF ( spinup )  THEN
+           IF ( during_spinup )  THEN
               frac_win   = surf_usm_h%frac(ind_wat_win,m)
               frac_wall  = surf_usm_h%frac(ind_veg_wall,m)
@@ -7927,5 +7934,5 @@
                                        f_shf * surf_usm_h%pt1(m) +             &
                                        lambda_surface * t_wall_h(nzb_wall,m)
-           IF ( ( .NOT. spinup ) .AND. (surf_usm_h%frac(ind_wat_win,m) > 0.0_wp ) ) THEN
+           IF ( ( .NOT. during_spinup ) .AND. (surf_usm_h%frac(ind_wat_win,m) > 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)  &
@@ -7953,5 +7960,5 @@
                              sigma_sb * t_surf_wall_h(m) ** 3                  &
                            + lambda_surface + f_shf / exner(k)
-           IF ( ( .NOT. spinup ) .AND. ( surf_usm_h%frac(ind_wat_win,m) > 0.0_wp ) ) THEN
+           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) *     &
                                 sigma_sb * t_surf_window_h(m) ** 3                &
@@ -7973,5 +7980,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. spinup).AND.(surf_usm_h%frac(ind_wat_win,m) > 0.0_wp)) THEN
+           IF (( .NOT. during_spinup ) .AND. (surf_usm_h%frac(ind_wat_win,m) > 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) ) /        & 
@@ -8187,5 +8194,5 @@
 !--        During spinup green and window fraction are set to zero. Here, the original
 !--        values are restored.
-           IF ( spinup )  THEN
+           IF ( during_spinup )  THEN
               surf_usm_h%frac(ind_wat_win,m)   = frac_win
               surf_usm_h%frac(ind_veg_wall,m)  = frac_wall
@@ -8203,5 +8210,5 @@
 !--           at the end of the loop.
 !--           Note, this is a temporary fix and need to be removed later. 
-              IF ( spinup )  THEN
+              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)
@@ -8366,5 +8373,5 @@
                                       f_shf * surf_usm_v(l)%pt1(m) +            &
                                       lambda_surface * t_wall_v(l)%t(nzb_wall,m)
-              IF ( ( .NOT. 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(ind_wat_win,m) > 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
@@ -8396,5 +8403,5 @@
                                  t_surf_wall_v(l)%t(m) ** 3                             &
                                + lambda_surface + f_shf / exner(k)  
-              IF ( ( .NOT. 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(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 *       &
                                    t_surf_window_v(l)%t(m) ** 3                         &
@@ -8416,5 +8423,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. 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(ind_wat_win,m) > 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) ) / & 
@@ -8584,5 +8591,5 @@
 !--           During spinup green and window fraction are set to zero. Here, the original
 !--           values are restored.
-              IF ( spinup )  THEN
+              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
@@ -8757,5 +8764,6 @@
 
         IF ( debug_output_timestep )  THEN
-           WRITE( debug_string, * ) 'usm_surface_energy_balance | spinup: ', spinup
+           WRITE( debug_string, * ) 'usm_surface_energy_balance | during_spinup: ',&
+                                    during_spinup
            CALL debug_message( debug_string, 'end' )
         ENDIF
