Index: palm/trunk/SOURCE/check_parameters.f90
===================================================================
--- palm/trunk/SOURCE/check_parameters.f90	(revision 2764)
+++ palm/trunk/SOURCE/check_parameters.f90	(revision 2765)
@@ -25,4 +25,8 @@
 ! -----------------
 ! $Id$
+! Renamed simulation_time_since_reference to 
+! time_to_be_simulated_from_reference_point
+! 
+! 2746 2018-01-15 12:06:04Z suehring
 ! Move flag plant canopy to modules
 ! 
@@ -666,5 +670,5 @@
     REAL(wp)    ::  gradient                         !<
     REAL(wp)    ::  remote = 0.0_wp                  !<
-    REAL(wp)    ::  simulation_time_since_reference  !<
+    REAL(wp)    ::  time_to_be_simulated_from_reference_point  !<
 
 
@@ -774,9 +778,9 @@
        ENDIF
 
-       simulation_time_since_reference = end_time - coupling_start_time
+       time_to_be_simulated_from_reference_point = end_time-coupling_start_time
 
        IF  ( myid == 0 ) THEN
-          CALL MPI_SEND( simulation_time_since_reference, 1, MPI_REAL, target_id, &
-                         14, comm_inter, ierr )
+          CALL MPI_SEND( time_to_be_simulated_from_reference_point, 1,         &
+                         MPI_REAL, target_id, 14, comm_inter, ierr )
           CALL MPI_RECV( remote, 1, MPI_REAL, target_id, 14, comm_inter,       &
                          status, ierr )
@@ -784,9 +788,10 @@
        CALL MPI_BCAST( remote, 1, MPI_REAL, 0, comm2d, ierr)
 
-       IF ( simulation_time_since_reference /= remote )  THEN
+       IF ( time_to_be_simulated_from_reference_point /= remote )  THEN
           WRITE( message_string, * ) 'coupling mode "', TRIM( coupling_mode ), &
-                 '": simulation_time_since_reference = ',                      &
-                 simulation_time_since_reference, '& is not equal to ',        &
-                 'simulation_time_since_reference_remote = ', remote
+                 '": time_to_be_simulated_from_reference_point = ',            &
+                 time_to_be_simulated_from_reference_point, '& is not equal ', &
+                 'to time_to_be_simulated_from_reference_point_remote = ',     &
+                 remote
           CALL message( 'check_parameters', 'PA0008', 1, 2, 0, 6, 0 )
        ENDIF
Index: palm/trunk/SOURCE/land_surface_model_mod.f90
===================================================================
--- palm/trunk/SOURCE/land_surface_model_mod.f90	(revision 2764)
+++ palm/trunk/SOURCE/land_surface_model_mod.f90	(revision 2765)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Major bugfix in calculation of f_shf for vertical surfaces
+! 
+! 2735 2018-01-11 12:01:27Z suehring
 ! output of r_a moved from land-surface to consider also urban-type surfaces
 ! 
@@ -1770,8 +1773,29 @@
 !        ENDIF
 !
-!--    Calculate aerodynamical resistance. For horizontal and vertical 
-!--    surfaces MOST is applied. Moreover, for vertical surfaces, resistance
-!--    can be obtain via parameterization of Mason (2000) / 
-!--    Krayenhoff and Voogt (2006).
+!--     Calculation of r_a for vertical surfaces
+!--
+!--     heat transfer coefficient for forced convection along vertical walls
+!--     follows formulation in TUF3d model (Krayenhoff & Voogt, 2006)
+!--            
+!--       H = httc (Tsfc - Tair)
+!--       httc = rw * (11.8 + 4.2 * Ueff) - 4.0
+!--            
+!--             rw: wall patch roughness relative to 1.0 for concrete
+!--             Ueff: effective wind speed
+!--             - 4.0 is a reduction of Rowley et al (1930) formulation based on
+!--             Cole and Sturrock (1977)
+!--           
+!--             Ucan: Canyon wind speed
+!--             wstar: convective velocity
+!--             Qs: surface heat flux
+!--             zH: height of the convective layer
+!--             wstar = (g/Tcan*Qs*zH)**(1./3.)
+                
+!--    Effective velocity components must always 
+!--    be defined at scalar grid point. The wall normal component is 
+!--    obtained by simple linear interpolation. ( An alternative would
+!--    be an logarithmic interpolation. )
+!--    A roughness lenght of 0.001 is assumed for concrete (the inverse,
+!--    1000 is used in the nominator for scaling)
 !--    To do: detailed investigation which approach gives more reliable results!
 !--    Please note, in case of very small friction velocity, e.g. in little 
@@ -1782,10 +1806,11 @@
                              ( surf%ts(m) * surf%us(m) + 1.0E-20_wp ) )
        ELSE
-          surf%r_a(m) = 1.0_wp / ( 11.8_wp + 4.2_wp *                          &
+          surf%r_a(m) = rho_cp / ( surf%z0(m) * 1000.0_wp                      &
+                        * ( 11.8_wp + 4.2_wp *                                 &
                         SQRT( MAX( ( ( u(k,j,i) + u(k,j,i+1) ) * 0.5_wp )**2 + &
                                    ( ( v(k,j,i) + v(k,j+1,i) ) * 0.5_wp )**2 + &
                                    ( ( w(k,j,i) + w(k-1,j,i) ) * 0.5_wp )**2,  &
                               0.01_wp ) )                                      &
-                                 )
+                           )  - 4.0_wp  ) 
        ENDIF
 !
Index: palm/trunk/SOURCE/modules.f90
===================================================================
--- palm/trunk/SOURCE/modules.f90	(revision 2764)
+++ palm/trunk/SOURCE/modules.f90	(revision 2765)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Set initial value for time_since_reference_point
+! 
+! 2746 2018-01-15 12:06:04Z suehring
 ! +plant_canopy
 ! 
@@ -1451,5 +1454,5 @@
     REAL(wp) ::  time_restart = 9999999.9_wp                   !< time at which run shall be terminated and restarted
     REAL(wp) ::  time_run_control = 0.0_wp                     !< time since last RUN_CONTROL output
-    REAL(wp) ::  time_since_reference_point                    !< time after atmosphere-ocean coupling has been activated, or time after spinup phase of LSM has been finished
+    REAL(wp) ::  time_since_reference_point = 0.0_wp           !< time after atmosphere-ocean coupling has been activated, or time after spinup phase of LSM has been finished
     REAL(wp) ::  top_heatflux = 9999999.9_wp                   !< namelist parameter
     REAL(wp) ::  top_momentumflux_u = 9999999.9_wp             !< namelist parameter
Index: palm/trunk/SOURCE/urban_surface_mod.f90
===================================================================
--- palm/trunk/SOURCE/urban_surface_mod.f90	(revision 2764)
+++ palm/trunk/SOURCE/urban_surface_mod.f90	(revision 2765)
@@ -26,4 +26,8 @@
 ! -----------------
 ! $Id$
+! Major bugfix in calculation of f_shf. Adjustment of roughness lengths in
+! building_pars
+! 
+! 2750 2018-01-15 16:26:51Z knoop
 ! Move flag plant canopy to modules
 ! 
@@ -388,5 +392,5 @@
         1000000.0_wp, 1000000.0_wp, 1000000.0_wp, 0.3_wp, 0.3_wp, 0.3_wp,      & !parameter 6-11
         296.15_wp, 293.15_wp, 0.9_wp, 0.9_wp, 0.01_wp, 0.99_wp,                & !parameter 12-17
-        0.01_wp, 0.001_wp, 4.0_wp,                                             & !parameter 18-20
+        0.001_wp, 0.0001_wp, 4.0_wp,                                             & !parameter 18-20
         1.0_wp, 0.0_wp, 0.0_wp, 0.0_wp, 3.0_wp,                                & !parameter 21-25
         1000000.0_wp, 1000000.0_wp, 1000000.0_wp,                              & !parameter 26-28                     
@@ -399,5 +403,5 @@
         1000000.0_wp, 1000000.0_wp, 1000000.0_wp, 0.3_wp, 0.3_wp, 0.3_wp,      & !parameter 6-11
         296.15_wp, 293.15_wp, 0.9_wp, 0.9_wp, 0.01_wp, 0.99_wp,                & !parameter 12-17
-        0.01_wp, 0.001_wp, 4.0_wp,                                             & !parameter 18-20
+        0.001_wp, 0.0001_wp, 4.0_wp,                                             & !parameter 18-20
         1.0_wp, 0.0_wp, 0.0_wp, 0.0_wp, 3.0_wp,                                & !parameter 21-25
         1000000.0_wp, 1000000.0_wp, 1000000.0_wp,                              & !parameter 26-28                     
@@ -410,5 +414,5 @@
         1000000.0_wp, 1000000.0_wp, 1000000.0_wp, 0.3_wp, 0.3_wp, 0.3_wp,      & !parameter 6-11
         296.15_wp, 293.15_wp, 0.9_wp, 0.9_wp, 0.01_wp, 0.99_wp,                & !parameter 12-17
-        0.01_wp, 0.001_wp, 4.0_wp,                                             & !parameter 18-20
+        0.001_wp, 0.0001_wp, 4.0_wp,                                             & !parameter 18-20
         1.0_wp, 0.0_wp, 0.0_wp, 0.0_wp, 3.0_wp,                                & !parameter 21-25
         1000000.0_wp, 1000000.0_wp, 1000000.0_wp,                              & !parameter 26-28                     
@@ -432,5 +436,5 @@
         1000000.0_wp, 1000000.0_wp, 1000000.0_wp, 0.3_wp, 0.3_wp, 0.3_wp,      & !parameter 6-11
         296.15_wp, 293.15_wp, 0.9_wp, 0.9_wp, 0.01_wp, 0.99_wp,                & !parameter 12-17
-        0.01_wp, 0.001_wp, 4.0_wp,                                             & !parameter 18-20
+        0.001_wp, 0.0001_wp, 4.0_wp,                                             & !parameter 18-20
         1.0_wp, 0.0_wp, 0.0_wp, 0.0_wp, 3.0_wp,                                & !parameter 21-25
         1000000.0_wp, 1000000.0_wp, 1000000.0_wp,                              & !parameter 26-28                     
@@ -443,5 +447,5 @@
         1000000.0_wp, 1000000.0_wp, 1000000.0_wp, 0.3_wp, 0.3_wp, 0.3_wp,      & !parameter 6-11
         296.15_wp, 293.15_wp, 0.9_wp, 0.9_wp, 0.01_wp, 0.99_wp,                & !parameter 12-17
-        0.01_wp, 0.001_wp, 4.0_wp,                                             & !parameter 18-20
+        0.001_wp, 0.0001_wp, 4.0_wp,                                             & !parameter 18-20
         1.0_wp, 0.0_wp, 0.0_wp, 0.0_wp, 3.0_wp,                                & !parameter 21-25
         1000000.0_wp, 1000000.0_wp, 1000000.0_wp,                              & !parameter 26-28                     
@@ -6749,5 +6753,4 @@
         INTEGER(iwp)                          :: i, j, k, l, d, m   !< running indices
         
-        REAL(wp)                              :: u1,v1,w1           !< near wall u,v,w
         REAL(wp)                              :: stend              !< surface tendency
         REAL(wp)                              :: stend_window       !< surface tendency
@@ -6766,8 +6769,4 @@
         REAL(wp)                              :: lambda_surface_window !< current value of lambda_surface (heat conductivity between air and window)
         REAL(wp)                              :: lambda_surface_green  !< current value of lambda_surface (heat conductivity between air and greeb wall)
-        REAL(wp)                              :: Ueff               !< effective wind speed for calculation of heat transfer coefficients
-        REAL(wp)                              :: httc               !< heat transfer coefficient
-        REAL(wp)                              :: httc_window        !< heat transfer coefficient window
-        REAL(wp)                              :: httc_green         !< heat transfer coefficient green wall
         REAL(wp), DIMENSION(nzub:nzut)        :: exn                !< value of the Exner function in layers
         
@@ -7044,16 +7043,19 @@
 !--          obtained by simple linear interpolation. ( An alternative would
 !--          be an logarithmic interpolation. )
-#if ! defined( __nopointer )
-             u1 = ( u(k,j,i) + u(k,j,i+1) ) * 0.5_wp
-             v1 = ( v(k,j,i) + v(k,j+1,i) ) * 0.5_wp
-             w1 = ( w(k,j,i) + w(k-1,j,i) ) * 0.5_wp
-#endif
-                
-             Ueff   = SQRT( u1**2 + v1**2 + w1**2 )
-             httc   = surf_usm_v(l)%z0(m) *                                    &
-                       ( 11.8_wp + 4.2_wp * Ueff ) - 4.0_wp
-             f_shf         = httc
-             f_shf_window  = httc
-             f_shf_green   = httc
+!--          A roughness lenght of 0.001 is assumed for concrete (the inverse,
+!--          1000 is used in the nominator for scaling)
+             surf_usm_v(l)%r_a(m) = rho_cp / ( surf_usm_v(l)%z0(m) * 1000.0_wp &
+                        * ( 11.8_wp + 4.2_wp *                                 &
+                        SQRT( MAX( ( ( u(k,j,i) + u(k,j,i+1) ) * 0.5_wp )**2 + &
+                                   ( ( v(k,j,i) + v(k,j+1,i) ) * 0.5_wp )**2 + &
+                                   ( ( w(k,j,i) + w(k-1,j,i) ) * 0.5_wp )**2,  &
+                              0.01_wp ) )                                      &
+                           )  - 4.0_wp  ) 
+
+             f_shf         = rho_cp / surf_usm_v(l)%r_a(m)
+             f_shf_window  = rho_cp / surf_usm_v(l)%r_a(m)
+             f_shf_green   = rho_cp / surf_usm_v(l)%r_a(m)
+
+
 
 !--          add LW up so that it can be removed in prognostic equation
