Index: palm/trunk/SOURCE/Makefile
===================================================================
--- palm/trunk/SOURCE/Makefile	(revision 1686)
+++ palm/trunk/SOURCE/Makefile	(revision 1691)
@@ -13,5 +13,5 @@
 # PALM. If not, see <http://www.gnu.org/licenses/>.
 #
-# Copyright 1997-2014  Leibniz Universitaet Hannover
+# Copyright 1997-2015  Leibniz Universitaet Hannover
 #--------------------------------------------------------------------------------#
 #
@@ -20,5 +20,6 @@
 # Current revisions:
 # ------------------
-# 
+# Replaced prandtl_fluxes with surface_layer_fluxes. Added radiation_model to 
+# prognostic_equations
 # 
 # Former revisions:
@@ -239,5 +240,5 @@
 	mod_particle_attributes.f90 netcdf.f90 nudging.f90 package_parin.f90 \
 	palm.f90 parin.f90 plant_canopy_model.f90 poisfft.f90 poismg.f90 \
-	poismg_fast.f90 prandtl_fluxes.f90 pres.f90 print_1d.f90 production_e.f90 \
+	poismg_fast.f90 pres.f90 print_1d.f90 production_e.f90 \
 	prognostic_equations.f90 progress_bar.f90 radiation_model.f90 \
 	random_function.f90 random_gauss.f90 random_generator_parallel.f90 \
@@ -245,5 +246,5 @@
 	set_slicer_attributes_dvrp.f90 singleton.f90 sor.f90 \
 	subsidence.f90 sum_up_3d_data.f90 \
-	surface_coupler.f90 swap_timelevel.f90 temperton_fft.f90 \
+	surface_coupler.f90 surface_layer_fluxes.f90 swap_timelevel.f90 temperton_fft.f90 \
 	time_integration.f90 time_to_string.f90 timestep.f90 \
 	timestep_scheme_steering.f90 transpose.f90 tridia_solver.f90 \
@@ -356,5 +357,5 @@
 init_3d_model.o: modules.o cpulog.o mod_kinds.o random_function.o advec_ws.o\
 	land_surface_model.o ls_forcing.o lpm_init.o plant_canopy_model.o\
-        radiation_model.o random_generator_parallel.o
+	radiation_model.o random_generator_parallel.o surface_layer_fluxes.o
 init_advec.o: modules.o mod_kinds.o
 init_cloud_physics.o: modules.o mod_kinds.o
@@ -421,5 +422,4 @@
 poismg.o: modules.o cpulog.o mod_kinds.o
 poismg_fast.o: modules.o cpulog.o mod_kinds.o
-prandtl_fluxes.o: modules.o mod_kinds.o
 pres.o: modules.o cpulog.o mod_kinds.o poisfft.o poismg_fast.o
 print_1d.o: modules.o cpulog.o mod_kinds.o
@@ -430,5 +430,6 @@
 	cpulog.o diffusion_e.o diffusion_s.o diffusion_u.o diffusion_v.o diffusion_w.o \
 	eqn_state_seawater.o impact_of_latent_heat.o mod_kinds.o microphysics.o \
-	nudging.o plant_canopy_model.o production_e.o subsidence.o user_actions.o
+	nudging.o plant_canopy_model.o production_e.o radiation_model.o \
+	subsidence.o user_actions.o
 progress_bar.o: modules.o mod_kinds.o
 radiation_model.o : modules.o mod_particle_attributes.o
@@ -446,6 +447,7 @@
 subsidence.o: modules.o mod_kinds.o
 sum_up_3d_data.o: modules.o cpulog.o mod_kinds.o land_surface_model.o\
-                  radiation_model.o
+                  radiation_model.o 
 surface_coupler.o: modules.o cpulog.o mod_kinds.o
+surface_layer_fluxes.o: modules.o mod_kinds.o land_surface_model.o
 swap_timelevel.o: modules.o cpulog.o mod_kinds.o land_surface_model.o
 temperton_fft.o: modules.o mod_kinds.o
@@ -454,5 +456,5 @@
 	ls_forcing.o mod_kinds.o nudging.o production_e.o \
 	prognostic_equations.o progress_bar.o radiation_model.o \
-	user_actions.o
+	 user_actions.o surface_layer_fluxes.o
 time_to_string.o: mod_kinds.o
 timestep.o: modules.o cpulog.o mod_kinds.o
@@ -492,3 +494,3 @@
                    radiation_model.o random_function.o\
                    random_generator_parallel.o
-write_var_list.o: modules.o mod_kinds.o plant_canopy_model.o
+write_var_list.o: modules.o mod_kinds.o plant_canopy_model.o 
Index: palm/trunk/SOURCE/advec_s_bc.f90
===================================================================
--- palm/trunk/SOURCE/advec_s_bc.f90	(revision 1686)
+++ palm/trunk/SOURCE/advec_s_bc.f90	(revision 1691)
@@ -14,10 +14,10 @@
 ! PALM. If not, see <http://www.gnu.org/licenses/>.
 !
-! Copyright 1997-2014 Leibniz Universitaet Hannover
+! Copyright 1997-2015 Leibniz Universitaet Hannover
 !--------------------------------------------------------------------------------!
 !
 ! Current revisions:
 ! -----------------
-! 
+! Formatting corrections
 ! 
 ! Former revisions:
@@ -464,5 +464,5 @@
                 IF ( sw(k,i+1) == 1.0_wp )  THEN
                    snenn = sk_p(k,j,i) - sk_p(k,j,i+2)
-                   IF ( ABS( snenn ) .LT. 1E-9_wp )  snenn = 1E-9_wp
+                   IF ( ABS( snenn ) < 1E-9_wp )  snenn = 1E-9_wp
                    sterm = ( sk_p(k,j,i+1) - sk_p(k,j,i+2) ) / snenn
                    sterm = MIN( sterm, 0.9999_wp )
@@ -760,5 +760,5 @@
                 IF ( sw(k,j+1) == 1.0_wp )  THEN
                    snenn = sk_p(k,j,i) - sk_p(k,j+2,i)
-                   IF ( ABS( snenn ) .LT. 1E-9_wp )  snenn = 1E-9_wp
+                   IF ( ABS( snenn ) < 1E-9_wp )  snenn = 1E-9_wp
                    sterm = ( sk_p(k,j+1,i) - sk_p(k,j+2,i) ) / snenn
                    sterm = MIN( sterm, 0.9999_wp )
@@ -1209,5 +1209,5 @@
                 IF ( sw(k+1,j) == 1.0_wp )  THEN
                    snenn = sk_p(k,j,i) - sk_p(k+2,j,i)
-                   IF ( ABS( snenn ) .LT. 1E-9_wp )  snenn = 1E-9_wp
+                   IF ( ABS( snenn ) < 1E-9_wp )  snenn = 1E-9_wp
                    sterm = ( sk_p(k+1,j,i) - sk_p(k+2,j,i) ) / snenn
                    sterm = MIN( sterm, 0.9999_wp )
Index: palm/trunk/SOURCE/average_3d_data.f90
===================================================================
--- palm/trunk/SOURCE/average_3d_data.f90	(revision 1686)
+++ palm/trunk/SOURCE/average_3d_data.f90	(revision 1691)
@@ -14,10 +14,10 @@
 ! PALM. If not, see <http://www.gnu.org/licenses/>.
 !
-! Copyright 1997-2014 Leibniz Universitaet Hannover
+! Copyright 1997-2015 Leibniz Universitaet Hannover
 !--------------------------------------------------------------------------------!
 !
 ! Current revisions:
 ! -----------------
-! 
+! Added output of Obukhov length and radiative heating rates for RRTMG. 
 ! 
 ! Former revisions:
@@ -96,6 +96,9 @@
     USE radiation_model_mod,                                                   &
         ONLY:  rad_net, rad_net_av, rad_lw_in, rad_lw_in_av, rad_lw_out,       &
-               rad_lw_out_av, rad_sw_in, rad_sw_in_av, rad_sw_out,             &
-               rad_sw_out_av
+               rad_lw_out_av, rad_lw_cs_hr, rad_lw_cs_hr_av, rad_lw_hr,        &
+               rad_lw_hr_av, rad_sw_in, rad_sw_in_av, rad_sw_out,              &
+               rad_sw_out_av, rad_sw_cs_hr, rad_sw_cs_hr_av, rad_sw_hr,        &
+               rad_sw_hr_av
+
 
     IMPLICIT NONE
@@ -213,4 +216,11 @@
              ENDDO
 
+         CASE ( 'ol*' )
+             DO  i = nxlg, nxrg
+                DO  j = nysg, nyng
+                   ol_av(j,i) = ol_av(j,i) / REAL( average_count_3d, KIND=wp )
+                ENDDO
+             ENDDO
+
           CASE ( 'p' )
              DO  i = nxlg, nxrg
@@ -383,4 +393,22 @@
              ENDDO
 
+          CASE ( 'rad_lw_cs_hr' )
+             DO  i = nxlg, nxrg
+                DO  j = nysg, nyng
+                   DO  k = nzb, nzt+1
+                      rad_lw_cs_hr_av(k,j,i) = rad_lw_cs_hr_av(k,j,i) / REAL( average_count_3d, KIND=wp )
+                   ENDDO
+                ENDDO
+             ENDDO
+
+          CASE ( 'rad_lw_hr' )
+             DO  i = nxlg, nxrg
+                DO  j = nysg, nyng
+                   DO  k = nzb, nzt+1
+                      rad_lw_hr_av(k,j,i) = rad_lw_hr_av(k,j,i) / REAL( average_count_3d, KIND=wp )
+                   ENDDO
+                ENDDO
+             ENDDO
+
           CASE ( 'rad_sw_in' )
              DO  i = nxlg, nxrg
@@ -397,4 +425,22 @@
                    DO  k = nzb, nzt+1
                       rad_sw_out_av(k,j,i) = rad_sw_out_av(k,j,i) / REAL( average_count_3d, KIND=wp )
+                   ENDDO
+                ENDDO
+             ENDDO
+
+          CASE ( 'rad_sw_cs_hr' )
+             DO  i = nxlg, nxrg
+                DO  j = nysg, nyng
+                   DO  k = nzb, nzt+1
+                      rad_sw_cs_hr_av(k,j,i) = rad_sw_cs_hr_av(k,j,i) / REAL( average_count_3d, KIND=wp )
+                   ENDDO
+                ENDDO
+             ENDDO
+
+          CASE ( 'rad_sw_hr' )
+             DO  i = nxlg, nxrg
+                DO  j = nysg, nyng
+                   DO  k = nzb, nzt+1
+                      rad_sw_hr_av(k,j,i) = rad_sw_hr_av(k,j,i) / REAL( average_count_3d, KIND=wp )
                    ENDDO
                 ENDDO
Index: palm/trunk/SOURCE/check_parameters.f90
===================================================================
--- palm/trunk/SOURCE/check_parameters.f90	(revision 1686)
+++ palm/trunk/SOURCE/check_parameters.f90	(revision 1691)
@@ -14,10 +14,11 @@
 ! PALM. If not, see <http://www.gnu.org/licenses/>.
 !
-! Copyright 1997-2014 Leibniz Universitaet Hannover
+! Copyright 1997-2015 Leibniz Universitaet Hannover
 !--------------------------------------------------------------------------------!
 !
 ! Current revisions:
 ! -----------------
-! 
+! Added output of Obukhov length (ol) and radiative heating rates for RRTMG. 
+! Added checks for use of radiation / lsm with topography.
 ! 
 ! Former revisions:
@@ -307,4 +308,5 @@
     USE transpose_indices
 
+
     IMPLICIT NONE
 
@@ -650,6 +652,6 @@
           WRITE( action, '(A)' )  'cloud_droplets = .TRUE.'
        ENDIF
-       IF ( .NOT. prandtl_layer )  THEN
-          WRITE( action, '(A)' )  'prandtl_layer = .FALSE.'
+       IF ( .NOT. constant_flux_layer )  THEN
+          WRITE( action, '(A)' )  'constant_flux_layer = .FALSE.'
        ENDIF
        IF ( action /= ' ' )  THEN
@@ -1007,8 +1009,14 @@
        ENDIF
 
-       IF ( .NOT. prandtl_layer )  THEN
+       IF ( .NOT. constant_flux_layer )  THEN
           message_string = 'lsm requires '//                                   &
-                           'prandtl_layer = .T.'
+                           'constant_flux_layer = .T.'
           CALL message( 'check_parameters', 'PA0400', 1, 2, 0, 6, 0 )
+       ENDIF
+
+       IF ( topography /= 'flat' )  THEN
+          message_string = 'lsm cannot be used ' //  & 
+                           'in combination with  topography /= "flat"'
+          CALL message( 'check_parameters', 'PA0415', 1, 2, 0, 6, 0 )
        ENDIF
 
@@ -1196,7 +1204,10 @@
           CALL message( 'check_parameters', 'PA0411', 1, 2, 0, 6, 0 )
        ENDIF
-
-    ENDIF
-
+       IF ( topography /= 'flat' )  THEN
+          message_string = 'radiation scheme cannot be used ' //  & 
+                           'in combination with  topography /= "flat"'
+          CALL message( 'check_parameters', 'PA0414', 1, 2, 0, 6, 0 )
+       ENDIF
+    ENDIF
 
     IF ( .NOT. ( loop_optimization == 'cache'  .OR.                            &
@@ -1729,5 +1740,5 @@
 !-- In case of using a prandtl-layer, calculated (or prescribed) surface
 !-- fluxes have to be used in the diffusion-terms
-    IF ( prandtl_layer )  use_surface_fluxes = .TRUE.
+    IF ( constant_flux_layer )  use_surface_fluxes = .TRUE.
 
 !
@@ -1796,5 +1807,5 @@
     ELSEIF ( bc_e_b == '(u*)**2+neumann' )  THEN
        ibc_e_b = 2
-       IF ( .NOT. prandtl_layer )  THEN
+       IF ( .NOT. constant_flux_layer )  THEN
           bc_e_b = 'neumann'
           ibc_e_b = 1
@@ -2003,5 +2014,5 @@
        IF ( surface_waterflux == 9999999.9_wp  )  THEN
           constant_waterflux = .FALSE.
-          IF ( large_scale_forcing )  THEN
+          IF ( large_scale_forcing .OR. land_surface )  THEN
              IF ( ibc_q_b == 0 )  THEN
                 constant_waterflux = .FALSE.
@@ -2045,7 +2056,8 @@
     ELSEIF ( bc_uv_b == 'neumann' )  THEN
        ibc_uv_b = 1
-       IF ( prandtl_layer )  THEN
+       IF ( constant_flux_layer )  THEN
           message_string = 'boundary condition: bc_uv_b = "' // &
-               TRIM( bc_uv_b ) // '" is not allowed with prandtl_layer = .TRUE.'
+               TRIM( bc_uv_b ) // '" is not allowed with constant_flux_layer'  &
+               // ' = .TRUE.'
           CALL message( 'check_parameters', 'PA0075', 1, 2, 0, 6, 0 )
        ENDIF
@@ -2356,5 +2368,5 @@
              dopr_unit(i)  = 'm2/s2'
              hom(:,2,12,:) = SPREAD( zw, 2, statistic_regions+1 )
-             IF ( prandtl_layer )  hom(nzb,2,12,:) = zu(1)
+             IF ( constant_flux_layer )  hom(nzb,2,12,:) = zu(1)
 
           CASE ( 'w*u*' )
@@ -2367,5 +2379,5 @@
              dopr_unit(i)  = 'm2/s2'
              hom(:,2,14,:) = SPREAD( zw, 2, statistic_regions+1 )
-             IF ( prandtl_layer )  hom(nzb,2,14,:) = zu(1)
+             IF ( constant_flux_layer )  hom(nzb,2,14,:) = zu(1)
 
           CASE ( 'w*v*' )
@@ -2393,5 +2405,5 @@
              dopr_unit(i)  = 'm2/s2'
              hom(:,2,19,:) = SPREAD( zw, 2, statistic_regions+1 )
-             IF ( prandtl_layer )  hom(nzb,2,19,:) = zu(1)
+             IF ( constant_flux_layer )  hom(nzb,2,19,:) = zu(1)
 
           CASE ( 'wv' )
@@ -2399,5 +2411,5 @@
              dopr_unit(i)  = 'm2/s2'
              hom(:,2,20,:) = SPREAD( zw, 2, statistic_regions+1 )
-             IF ( prandtl_layer )  hom(nzb,2,20,:) = zu(1)
+             IF ( constant_flux_layer )  hom(nzb,2,20,:) = zu(1)
 
           CASE ( 'w*pt*BC' )
@@ -3153,4 +3165,56 @@
              ENDIF
 
+          CASE ( 'rad_lw_cs_hr' )
+             IF ( (.NOT. radiation) .OR. radiation_scheme /= 'rrtmg' )  THEN
+                message_string = 'data_output_pr = ' //                        &
+                                 TRIM( data_output_pr(i) ) // ' is not ava' // &
+                                 'lable for radiation = .FALSE. or ' //        &
+                                 'radiation_scheme /= "rrtmg"'
+                CALL message( 'check_parameters', 'PA0413', 1, 2, 0, 6, 0 )
+             ELSE
+                dopr_index(i) = 106
+                dopr_unit(i)  = 'K/h'
+                hom(:,2,106,:)  = SPREAD( zu, 2, statistic_regions+1 )
+             ENDIF
+
+          CASE ( 'rad_lw_hr' )
+             IF ( (.NOT. radiation) .OR. radiation_scheme /= 'rrtmg' )  THEN
+                message_string = 'data_output_pr = ' //                        &
+                                 TRIM( data_output_pr(i) ) // ' is not ava' // &
+                                 'lable for radiation = .FALSE. or ' //        &
+                                 'radiation_scheme /= "rrtmg"'
+                CALL message( 'check_parameters', 'PA0413', 1, 2, 0, 6, 0 )
+             ELSE
+                dopr_index(i) = 107
+                dopr_unit(i)  = 'K/h'
+                hom(:,2,107,:)  = SPREAD( zu, 2, statistic_regions+1 )
+             ENDIF
+
+          CASE ( 'rad_sw_cs_hr' )
+             IF ( (.NOT. radiation) .OR. radiation_scheme /= 'rrtmg' )  THEN
+                message_string = 'data_output_pr = ' //                        &
+                                 TRIM( data_output_pr(i) ) // ' is not ava' // &
+                                 'lable for radiation = .FALSE. or ' //        &
+                                 'radiation_scheme /= "rrtmg"'
+                CALL message( 'check_parameters', 'PA0413', 1, 2, 0, 6, 0 )
+             ELSE
+                dopr_index(i) = 108
+                dopr_unit(i)  = 'K/h'
+                hom(:,2,108,:)  = SPREAD( zu, 2, statistic_regions+1 )
+             ENDIF
+
+          CASE ( 'rad_sw_hr' )
+             IF ( (.NOT. radiation) .OR. radiation_scheme /= 'rrtmg' )  THEN
+                message_string = 'data_output_pr = ' //                        &
+                                 TRIM( data_output_pr(i) ) // ' is not ava' // &
+                                 'lable for radiation = .FALSE. or ' //        &
+                                 'radiation_scheme /= "rrtmg"'
+                CALL message( 'check_parameters', 'PA0413', 1, 2, 0, 6, 0 )
+             ELSE
+                dopr_index(i) = 109
+                dopr_unit(i)  = 'K/h'
+                hom(:,2,109,:)  = SPREAD( zu, 2, statistic_regions+1 )
+             ENDIF
+
           CASE DEFAULT
 
@@ -3351,8 +3415,8 @@
              unit = 'kg/kg'
 
-
-          CASE ( 'rad_lw_in', 'rad_lw_out', 'rad_sw_in', 'rad_sw_out' )
+          CASE ( 'rad_lw_in', 'rad_lw_out', 'rad_lw_cs_hr', 'rad_lw_hr',       &
+                 'rad_sw_in', 'rad_sw_out', 'rad_sw_cs_hr', 'rad_sw_hr' )
              IF ( .NOT. radiation .OR. radiation_scheme /= 'rrtmg' )  THEN
-                message_string = '"output of "' // TRIM( var ) // '" requi' //  &
+                message_string = '"output of "' // TRIM( var ) // '" requi' // &
                                  'res radiation = .TRUE. and ' //              &
                                  'radiation_scheme = "rrtmg"'
@@ -3395,5 +3459,5 @@
 
           CASE ( 'c_liq*', 'c_soil*', 'c_veg*', 'ghf_eb*', 'lai*', 'lwp*',     &
-                 'm_liq_eb*', 'pra*', 'prr*', 'qsws*', 'qsws_eb*',             &
+                 'm_liq_eb*', 'ol*', 'pra*', 'prr*', 'qsws*', 'qsws_eb*',      &
                  'qsws_liq_eb*', 'qsws_soil_eb*', 'qsws_veg_eb*', 'rad_net*',  &
                  'rrtm_aldif*', 'rrtm_aldir*', 'rrtm_asdif*', 'rrtm_asdir*',   &
@@ -3514,5 +3578,7 @@
              IF ( TRIM( var ) == 'ghf_eb*')  unit = 'W/m2'
              IF ( TRIM( var ) == 'lai*'   )  unit = 'none'
-             IF ( TRIM( var ) == 'lwp*'   )  unit = 'kg/kg*m'
+             IF ( TRIM( var ) == 'lwp*'   )  unit = 'kg/m2'
+             IF ( TRIM( var ) == 'm_liq_eb*'     )  unit = 'm'
+             IF ( TRIM( var ) == 'ol*'   )   unit = 'm'
              IF ( TRIM( var ) == 'pra*'   )  unit = 'mm'
              IF ( TRIM( var ) == 'prr*'   )  unit = 'mm/s'
@@ -3788,7 +3854,7 @@
           constant_diffusion = .TRUE.
 
-          IF ( prandtl_layer )  THEN
-             message_string = 'prandtl_layer is not allowed with fixed ' //    &
-                              'value of km'
+          IF ( constant_flux_layer )  THEN
+             message_string = 'constant_flux_layer is not allowed with fixed ' &
+                              // 'value of km'
              CALL message( 'check_parameters', 'PA0123', 1, 2, 0, 6, 0 )
           ENDIF
@@ -3816,8 +3882,8 @@
 
 !
-!-- Check value range for rif
-    IF ( rif_min >= rif_max )  THEN
-       WRITE( message_string, * )  'rif_min = ', rif_min, ' must be less ',    &
-                                   'than rif_max = ', rif_max
+!-- Check value range for zeta = z/L
+    IF ( zeta_min >= zeta_max )  THEN
+       WRITE( message_string, * )  'zeta_min = ', zeta_min, ' must be less ',  &
+                                   'than zeta_max = ', zeta_max
        CALL message( 'check_parameters', 'PA0125', 1, 2, 0, 6, 0 )
     ENDIF
@@ -4235,4 +4301,14 @@
 
 !
+!-- Check for valid setting of most_method
+    IF ( TRIM( most_method ) /= 'circular'  .AND.                              &
+         TRIM( most_method ) /= 'newton'  .AND.                                &
+         TRIM( most_method ) /= 'lookup' )  THEN
+       message_string = 'most_method = "' // TRIM( most_method ) //      &
+                        '" is unknown'
+       CALL message( 'check_parameters', 'PA0416', 1, 2, 0, 6, 0 )
+    ENDIF
+
+!
 !-- Check &userpar parameters
     CALL user_check_parameters
Index: palm/trunk/SOURCE/data_output_2d.f90
===================================================================
--- palm/trunk/SOURCE/data_output_2d.f90	(revision 1686)
+++ palm/trunk/SOURCE/data_output_2d.f90	(revision 1691)
@@ -14,10 +14,11 @@
 ! PALM. If not, see <http://www.gnu.org/licenses/>.
 !
-! Copyright 1997-2014 Leibniz Universitaet Hannover
+! Copyright 1997-2015 Leibniz Universitaet Hannover
 !--------------------------------------------------------------------------------!
 !
 ! Current revisions:
 ! -----------------
-! 
+! Added output of Obukhov length (ol) and radiative heating rates  for RRTMG. 
+! Formatting corrections.
 ! 
 ! Former revisions:
@@ -112,5 +113,5 @@
 
     USE arrays_3d,                                                             &
-        ONLY:  dzw, e, nr, p, pt, q, qc, ql, ql_c, ql_v, ql_vp, qr, qsws,      &
+        ONLY:  dzw, e, nr, ol, p, pt, q, qc, ql, ql_c, ql_v, ql_vp, qr, qsws,  &
                rho, sa, shf, tend, ts, u, us, v, vpt, w, z0, z0h, zu, zw
         
@@ -162,6 +163,8 @@
     USE radiation_model_mod,                                                   &
         ONLY:  rad_net, rad_net_av, rad_sw_in, rad_sw_in_av, rad_sw_out,       &
-               rad_sw_out_av, rad_lw_in, rad_lw_in_av, rad_lw_out,             &
-               rad_lw_out_av 
+               rad_sw_out_av, rad_sw_cs_hr, rad_sw_cs_hr_av, rad_sw_hr,        &
+               rad_sw_hr_av, rad_lw_in, rad_lw_in_av, rad_lw_out,              &
+               rad_lw_out_av, rad_lw_cs_hr, rad_lw_cs_hr_av, rad_lw_hr,        &
+               rad_lw_hr_av
 
     IMPLICIT NONE
@@ -543,4 +546,22 @@
                 IF ( mode == 'xy' )  level_z = zu
 
+             CASE ( 'ol*_xy' )        ! 2d-array
+                IF ( av == 0 ) THEN
+                   DO  i = nxlg, nxrg
+                      DO  j = nysg, nyng
+                         local_pf(i,j,nzb+1) = ol(j,i)
+                      ENDDO
+                   ENDDO
+                ELSE
+                   DO  i = nxlg, nxrg
+                      DO  j = nysg, nyng
+                         local_pf(i,j,nzb+1) = ol_av(j,i)
+                      ENDDO
+                   ENDDO
+                ENDIF
+                resorted = .TRUE.
+                two_d = .TRUE.
+                level_z(nzb+1) = zu(nzb+1)
+
              CASE ( 'p_xy', 'p_xz', 'p_yz' )
                 IF ( av == 0 )  THEN
@@ -937,4 +958,18 @@
                 ENDIF
 
+             CASE ( 'rad_lw_cs_hr_xy', 'rad_lw_cs_hr_xz', 'rad_lw_cs_hr_yz' )
+                IF ( av == 0 )  THEN
+                   to_be_resorted => rad_lw_cs_hr
+                ELSE
+                   to_be_resorted => rad_lw_cs_hr_av
+                ENDIF
+
+             CASE ( 'rad_lw_hr_xy', 'rad_lw_hr_xz', 'rad_lw_hr_yz' )
+                IF ( av == 0 )  THEN
+                   to_be_resorted => rad_lw_hr
+                ELSE
+                   to_be_resorted => rad_lw_hr_av
+                ENDIF
+
              CASE ( 'rad_sw_in_xy', 'rad_sw_in_xz', 'rad_sw_in_yz' )
                 IF ( av == 0 )  THEN
@@ -949,4 +984,18 @@
                 ELSE
                    to_be_resorted => rad_sw_out_av
+                ENDIF
+
+             CASE ( 'rad_sw_cs_hr_xy', 'rad_sw_cs_hr_xz', 'rad_sw_cs_hr_yz' )
+                IF ( av == 0 )  THEN
+                   to_be_resorted => rad_sw_cs_hr
+                ELSE
+                   to_be_resorted => rad_sw_cs_hr_av
+                ENDIF
+
+             CASE ( 'rad_sw_hr_xy', 'rad_sw_hr_xz', 'rad_sw_hr_yz' )
+                IF ( av == 0 )  THEN
+                   to_be_resorted => rad_sw_hr
+                ELSE
+                   to_be_resorted => rad_sw_hr_av
                 ENDIF
 
@@ -1227,5 +1276,5 @@
 !--                Exit the loop for layers beyond the data output domain
 !--                (used for soil model)
-                   IF ( layer_xy .GT. nzt_do )  THEN 
+                   IF ( layer_xy > nzt_do )  THEN 
                       EXIT loop1
                    ENDIF
Index: palm/trunk/SOURCE/data_output_3d.f90
===================================================================
--- palm/trunk/SOURCE/data_output_3d.f90	(revision 1686)
+++ palm/trunk/SOURCE/data_output_3d.f90	(revision 1691)
@@ -14,10 +14,10 @@
 ! PALM. If not, see <http://www.gnu.org/licenses/>.
 !
-! Copyright 1997-2014 Leibniz Universitaet Hannover
+! Copyright 1997-2015 Leibniz Universitaet Hannover
 !--------------------------------------------------------------------------------!
 !
 ! Current revisions:
 ! ------------------
-! 
+! Added output of radiative heating rates for RRTMG
 ! 
 ! Former revisions:
@@ -138,5 +138,7 @@
     USE radiation_model_mod,                                                   &
         ONLY:  rad_lw_in, rad_lw_in_av, rad_lw_out, rad_lw_out_av,             &
-               rad_sw_in, rad_sw_in_av, rad_sw_out, rad_sw_out_av
+               rad_lw_cs_hr, rad_lw_cs_hr_av, rad_lw_hr, rad_lw_hr_av,         &
+               rad_sw_in, rad_sw_in_av, rad_sw_out, rad_sw_out_av,             &
+               rad_sw_cs_hr, rad_sw_cs_hr_av, rad_sw_hr, rad_sw_hr_av
 
 
@@ -495,4 +497,18 @@
              ENDIF
 
+          CASE ( 'rad_sw_cs_hr' )
+             IF ( av == 0 )  THEN
+                to_be_resorted => rad_sw_cs_hr
+             ELSE
+                to_be_resorted => rad_sw_cs_hr_av
+             ENDIF
+
+          CASE ( 'rad_sw_hr' )
+             IF ( av == 0 )  THEN
+                to_be_resorted => rad_sw_hr
+             ELSE
+                to_be_resorted => rad_sw_hr_av
+             ENDIF
+
           CASE ( 'rad_lw_in' )
              IF ( av == 0 )  THEN
@@ -507,4 +523,18 @@
              ELSE
                 to_be_resorted => rad_lw_out_av
+             ENDIF
+
+          CASE ( 'rad_lw_cs_hr' )
+             IF ( av == 0 )  THEN
+                to_be_resorted => rad_lw_cs_hr
+             ELSE
+                to_be_resorted => rad_lw_cs_hr_av
+             ENDIF
+
+          CASE ( 'rad_lw_hr' )
+             IF ( av == 0 )  THEN
+                to_be_resorted => rad_lw_hr
+             ELSE
+                to_be_resorted => rad_lw_hr_av
              ENDIF
 
Index: palm/trunk/SOURCE/data_output_mask.f90
===================================================================
--- palm/trunk/SOURCE/data_output_mask.f90	(revision 1686)
+++ palm/trunk/SOURCE/data_output_mask.f90	(revision 1691)
@@ -14,10 +14,10 @@
 ! PALM. If not, see <http://www.gnu.org/licenses/>.
 !
-! Copyright 1997-2014 Leibniz Universitaet Hannover
+! Copyright 1997-2015 Leibniz Universitaet Hannover
 !--------------------------------------------------------------------------------!
 !
 ! Current revisions:
 ! -----------------
-! 
+! Added output of radiative heating rates for RRTMG
 ! 
 ! Former revisions:
@@ -119,5 +119,8 @@
     USE radiation_model_mod,                                                   &
         ONLY:  rad_lw_in, rad_lw_in_av, rad_lw_out, rad_lw_out_av,             &
-               rad_sw_in, rad_sw_in_av, rad_sw_out, rad_sw_out_av
+               rad_lw_cs_hr, rad_lw_cs_hr_av, rad_lw_hr, rad_lw_hr_av,         &
+               rad_sw_in, rad_sw_in_av, rad_sw_out, rad_sw_out_av,             &
+               rad_sw_cs_hr, rad_sw_cs_hr_av, rad_sw_hr, rad_sw_hr_av
+
 
     IMPLICIT NONE
@@ -405,4 +408,32 @@
              ENDIF
 
+          CASE ( 'rad_lw_in' )
+             IF ( av == 0 )  THEN
+                to_be_resorted => rad_lw_in
+             ELSE
+                to_be_resorted => rad_lw_in_av
+             ENDIF
+
+          CASE ( 'rad_lw_out' )
+             IF ( av == 0 )  THEN
+                to_be_resorted => rad_lw_out
+             ELSE
+                to_be_resorted => rad_lw_out_av
+             ENDIF
+
+          CASE ( 'rad_lw_cs_hr' )
+             IF ( av == 0 )  THEN
+                to_be_resorted => rad_lw_cs_hr
+             ELSE
+                to_be_resorted => rad_lw_cs_hr_av
+             ENDIF
+
+          CASE ( 'rad_lw_hr' )
+             IF ( av == 0 )  THEN
+                to_be_resorted => rad_lw_hr
+             ELSE
+                to_be_resorted => rad_lw_hr_av
+             ENDIF
+
           CASE ( 'rad_sw_in' )
              IF ( av == 0 )  THEN
@@ -419,16 +450,16 @@
              ENDIF
 
-          CASE ( 'rad_lw_in' )
-             IF ( av == 0 )  THEN
-                to_be_resorted => rad_lw_in
-             ELSE
-                to_be_resorted => rad_lw_in_av
-             ENDIF
-
-          CASE ( 'rad_lw_out' )
-             IF ( av == 0 )  THEN
-                to_be_resorted => rad_lw_out
-             ELSE
-                to_be_resorted => rad_lw_out_av
+          CASE ( 'rad_sw_cs_hr' )
+             IF ( av == 0 )  THEN
+                to_be_resorted => rad_sw_cs_hr
+             ELSE
+                to_be_resorted => rad_sw_cs_hr_av
+             ENDIF
+
+          CASE ( 'rad_sw_hr' )
+             IF ( av == 0 )  THEN
+                to_be_resorted => rad_sw_hr
+             ELSE
+                to_be_resorted => rad_sw_hr_av
              ENDIF
 
Index: palm/trunk/SOURCE/diffusion_s.f90
===================================================================
--- palm/trunk/SOURCE/diffusion_s.f90	(revision 1686)
+++ palm/trunk/SOURCE/diffusion_s.f90	(revision 1691)
@@ -14,10 +14,10 @@
 ! PALM. If not, see <http://www.gnu.org/licenses/>.
 !
-! Copyright 1997-2014 Leibniz Universitaet Hannover
+! Copyright 1997-2015 Leibniz Universitaet Hannover
 !--------------------------------------------------------------------------------!
 !
 ! Current revisions:
 ! ------------------
-! 
+! Formatting corrections.
 ! 
 ! Former revisions:
@@ -144,6 +144,6 @@
 !
 !--          Apply prescribed horizontal wall heatflux where necessary
-             IF ( ( wall_w_x(j,i) .NE. 0.0_wp ) .OR. ( wall_w_y(j,i) .NE. 0.0_wp ) ) &
-             THEN
+             IF ( ( wall_w_x(j,i) /= 0.0_wp ) .OR. ( wall_w_y(j,i) /= 0.0_wp ) &
+                )  THEN
                 DO  k = nzb_s_inner(j,i)+1, nzb_s_outer(j,i)
 
@@ -400,5 +400,5 @@
 !
 !--    Apply prescribed horizontal wall heatflux where necessary
-       IF ( ( wall_w_x(j,i) .NE. 0.0_wp ) .OR. ( wall_w_y(j,i) .NE. 0.0_wp ) )       &
+       IF ( ( wall_w_x(j,i) /= 0.0_wp ) .OR. ( wall_w_y(j,i) /= 0.0_wp ) )     &
        THEN
           DO  k = nzb_s_inner(j,i)+1, nzb_s_outer(j,i)
Index: palm/trunk/SOURCE/diffusion_u.f90
===================================================================
--- palm/trunk/SOURCE/diffusion_u.f90	(revision 1686)
+++ palm/trunk/SOURCE/diffusion_u.f90	(revision 1691)
@@ -14,10 +14,10 @@
 ! PALM. If not, see <http://www.gnu.org/licenses/>.
 !
-! Copyright 1997-2014 Leibniz Universitaet Hannover
+! Copyright 1997-2015 Leibniz Universitaet Hannover
 !--------------------------------------------------------------------------------!
 !
 ! Current revisions:
 ! -----------------
-! 
+! Formatting corrections.
 ! 
 ! Former revisions:
@@ -508,5 +508,5 @@
 !
 !--    Wall functions at the north and south walls, respectively
-       IF ( wall_u(j,i) .NE. 0.0_wp )  THEN
+       IF ( wall_u(j,i) /= 0.0_wp )  THEN
 
 !
Index: palm/trunk/SOURCE/flow_statistics.f90
===================================================================
--- palm/trunk/SOURCE/flow_statistics.f90	(revision 1686)
+++ palm/trunk/SOURCE/flow_statistics.f90	(revision 1691)
@@ -14,10 +14,11 @@
 ! PALM. If not, see <http://www.gnu.org/licenses/>.
 !
-! Copyright 1997-2014 Leibniz Universitaet Hannover
+! Copyright 1997-2015 Leibniz Universitaet Hannover
 !--------------------------------------------------------------------------------!
 !
 ! Current revisions:
 ! -----------------
-! 
+! Revised calculation of Obukhov length. Added output of radiative heating >
+! rates for RRTMG.
 ! 
 ! Former revisions:
@@ -161,8 +162,8 @@
 
     USE arrays_3d,                                                             &
-        ONLY:  ddzu, ddzw, e, hyp, km, kh, nr, p, prho, pt, q, qc, ql, qr, qs, &
-               qsws, qswst, rho, sa, saswsb, saswst, shf, td_lsa_lpt, td_lsa_q,&
-               td_sub_lpt, td_sub_q, time_vert, ts, tswst, u, ug, us, usws,    &
-               uswst, vsws, v, vg, vpt, vswst, w, w_subs, zw
+        ONLY:  ddzu, ddzw, e, hyp, km, kh, nr, ol, p, prho, pt, q, qc, ql, qr, &
+               qs, qsws, qswst, rho, sa, saswsb, saswst, shf, td_lsa_lpt,      &
+               td_lsa_q, td_sub_lpt, td_sub_q, time_vert, ts, tswst, u, ug, us,& 
+               usws, uswst, vsws, v, vg, vpt, vswst, w, w_subs, zw
         
     USE cloud_parameters,                                                      &
@@ -172,6 +173,6 @@
         ONLY:   average_count_pr, cloud_droplets, cloud_physics, do_sum,       &
                 dt_3d, g, humidity, icloud_scheme, kappa, large_scale_forcing, &
-                large_scale_subsidence, max_pr_user, message_string, ocean,    &
-                passive_scalar, precipitation, simulated_time,                 &
+                large_scale_subsidence, max_pr_user, message_string, neutral,  &
+                ocean, passive_scalar, precipitation, simulated_time,          &
                 use_subsidence_tendencies, use_surface_fluxes, use_top_fluxes, &
                 ws_scheme_mom, ws_scheme_sca
@@ -199,5 +200,6 @@
     USE radiation_model_mod,                                                   &
         ONLY:  dots_rad, radiation, radiation_scheme, rad_net,                 &
-               rad_lw_in, rad_lw_out, rad_sw_in, rad_sw_out
+               rad_lw_in, rad_lw_out, rad_lw_cs_hr, rad_lw_hr,                 &
+               rad_sw_in, rad_sw_out, rad_sw_cs_hr, rad_sw_hr
 
 #if defined ( __rrtmg )
@@ -207,4 +209,5 @@
   
     USE statistics
+
 
     IMPLICIT NONE
@@ -240,5 +243,5 @@
     CALL cpu_log( log_point(10), 'flow_statistics', 'start' )
 
-    !$acc update host( km, kh, e, pt, qs, qsws, rif, shf, ts, u, usws, v, vsws, w )
+    !$acc update host( km, kh, e, ol, pt, qs, qsws, shf, ts, u, usws, v, vsws, w )
 
 !
@@ -744,13 +747,19 @@
 !
 !--                   Formula does not work if ql(nzb) /= 0.0
-                      sums_l(nzb,51,tn) = sums_l(nzb,51,tn) + &   ! w"q" (w"qv")
-                                          qsws(j,i) * rmask(j,i,sr)
+                      sums_l(nzb,51,tn) = sums_l(nzb,51,tn) +                  & 
+                                          qsws(j,i) * rmask(j,i,sr) ! w"q" (w"qv")
                    ENDIF
                 ENDIF
                 IF ( passive_scalar )  THEN
-                   sums_l(nzb,48,tn) = sums_l(nzb,48,tn) + &
-                                       qsws(j,i) * rmask(j,i,sr)  ! w"q" (w"qv")
+                   sums_l(nzb,48,tn) = sums_l(nzb,48,tn) +                     &
+                                       qsws(j,i) * rmask(j,i,sr) ! w"q" (w"qv")
                 ENDIF
              ENDIF
+
+             IF ( .NOT. neutral )  THEN
+                sums_l(nzb,114,tn) = sums_l(nzb,114,tn) +                      &
+                                    ol(j,i)  * rmask(j,i,sr) ! L
+             ENDIF
+
 
              IF ( land_surface )  THEN
@@ -774,8 +783,8 @@
 #if defined ( __rrtmg )
                 IF ( radiation_scheme == 'rrtmg' )  THEN
-                   sums_l(nzb,106,tn)  = sums_l(nzb,106,tn)  + rrtm_aldif(0,j,i)
-                   sums_l(nzb,107,tn)  = sums_l(nzb,107,tn)  + rrtm_aldir(0,j,i)
-                   sums_l(nzb,108,tn)  = sums_l(nzb,108,tn)  + rrtm_asdif(0,j,i)
-                   sums_l(nzb,109,tn)  = sums_l(nzb,109,tn)  + rrtm_asdir(0,j,i)
+                   sums_l(nzb,110,tn)  = sums_l(nzb,110,tn)  + rrtm_aldif(0,j,i)
+                   sums_l(nzb,111,tn)  = sums_l(nzb,111,tn)  + rrtm_aldir(0,j,i)
+                   sums_l(nzb,112,tn)  = sums_l(nzb,112,tn)  + rrtm_asdif(0,j,i)
+                   sums_l(nzb,113,tn)  = sums_l(nzb,113,tn)  + rrtm_asdir(0,j,i)
                 ENDIF
 #endif
@@ -997,6 +1006,6 @@
 !--    First calculate the products, then the divergence.
 !--    Calculation is time consuming. Do it only, if profiles shall be plotted.
-       IF ( hom(nzb+1,2,55,0) /= 0.0_wp  .OR.  hom(nzb+1,2,68,0) /= 0.0_wp )  THEN
-
+       IF ( hom(nzb+1,2,55,0) /= 0.0_wp  .OR.  hom(nzb+1,2,68,0) /= 0.0_wp )   &
+       THEN
           sums_ll = 0.0_wp  ! local array
 
@@ -1037,6 +1046,6 @@
 !
 !--    Divergence of vertical flux of SGS TKE and the flux itself (69)
-       IF ( hom(nzb+1,2,57,0) /= 0.0_wp  .OR.  hom(nzb+1,2,69,0) /= 0.0_wp )  THEN
-
+       IF ( hom(nzb+1,2,57,0) /= 0.0_wp  .OR.  hom(nzb+1,2,69,0) /= 0.0_wp )   &
+       THEN
           !$OMP DO
           DO  i = nxl, nxr
@@ -1109,5 +1118,5 @@
 !--    Collect current large scale advection and subsidence tendencies for
 !--    data output
-       IF ( large_scale_forcing  .AND.  ( simulated_time .GT. 0.0_wp ) )  THEN
+       IF ( large_scale_forcing  .AND.  ( simulated_time > 0.0_wp ) )  THEN
 !
 !--       Interpolation in time of LSF_DATA 
@@ -1156,6 +1165,8 @@
              DO  j =  nys, nyn
                 DO  k = nzb_soil, nzt_soil
-                   sums_l(k,89,tn)  = sums_l(k,89,tn)  + t_soil(k,j,i) * rmask(j,i,sr)
-                   sums_l(k,91,tn)  = sums_l(k,91,tn)  + m_soil(k,j,i) * rmask(j,i,sr)
+                   sums_l(k,89,tn)  = sums_l(k,89,tn)  + t_soil(k,j,i)         &
+                                      * rmask(j,i,sr)
+                   sums_l(k,91,tn)  = sums_l(k,91,tn)  + m_soil(k,j,i)         &
+                                      * rmask(j,i,sr)
                 ENDDO
              ENDDO
@@ -1168,8 +1179,20 @@
              DO  j =  nys, nyn
                 DO  k = nzb_s_inner(j,i)+1, nzt+1
-                   sums_l(k,102,tn)  = sums_l(k,102,tn)  + rad_lw_in(k,j,i) * rmask(j,i,sr)
-                   sums_l(k,103,tn)  = sums_l(k,103,tn)  + rad_lw_out(k,j,i) * rmask(j,i,sr)
-                   sums_l(k,104,tn)  = sums_l(k,104,tn)  + rad_sw_in(k,j,i) * rmask(j,i,sr)
-                   sums_l(k,105,tn)  = sums_l(k,105,tn)  + rad_sw_out(k,j,i) * rmask(j,i,sr)
+                   sums_l(k,102,tn)  = sums_l(k,102,tn)  + rad_lw_in(k,j,i)    &
+                                       * rmask(j,i,sr)
+                   sums_l(k,103,tn)  = sums_l(k,103,tn)  + rad_lw_out(k,j,i)   &
+                                       * rmask(j,i,sr)
+                   sums_l(k,104,tn)  = sums_l(k,104,tn)  + rad_sw_in(k,j,i)    &
+                                       * rmask(j,i,sr)
+                   sums_l(k,105,tn)  = sums_l(k,105,tn)  + rad_sw_out(k,j,i)   &
+                                       * rmask(j,i,sr)
+                   sums_l(k,106,tn)  = sums_l(k,106,tn)  + rad_lw_cs_hr(k,j,i) &
+                                       * rmask(j,i,sr)
+                   sums_l(k,107,tn)  = sums_l(k,107,tn)  + rad_lw_hr(k,j,i)    &
+                                       * rmask(j,i,sr)
+                   sums_l(k,108,tn)  = sums_l(k,108,tn)  + rad_sw_cs_hr(k,j,i) &
+                                       * rmask(j,i,sr)
+                   sums_l(k,109,tn)  = sums_l(k,108,tn)  + rad_sw_hr(k,j,i)    &
+                                       * rmask(j,i,sr)
                 ENDDO
              ENDDO
@@ -1374,14 +1397,22 @@
           hom(:,1,105,sr) = sums(:,105)            ! rad_sw_out
 
+          IF ( radiation_scheme == 'rrtmg' )  THEN
+             hom(:,1,106,sr) = sums(:,106)            ! rad_lw_cs_hr
+             hom(:,1,107,sr) = sums(:,107)            ! rad_lw_hr
+             hom(:,1,108,sr) = sums(:,108)            ! rad_sw_cs_hr
+             hom(:,1,109,sr) = sums(:,109)            ! rad_sw_hr
+
 #if defined ( __rrtmg )
-          IF ( radiation_scheme == 'rrtmg' )  THEN
-             hom(:,1,106,sr) = sums(:,106)            ! rrtm_aldif
-             hom(:,1,107,sr) = sums(:,107)            ! rrtm_aldir
-             hom(:,1,108,sr) = sums(:,108)            ! rrtm_asdif
-             hom(:,1,109,sr) = sums(:,109)            ! rrtm_asdir
+             hom(:,1,110,sr) = sums(:,110)            ! rrtm_aldif
+             hom(:,1,111,sr) = sums(:,111)            ! rrtm_aldir
+             hom(:,1,112,sr) = sums(:,112)            ! rrtm_asdif
+             hom(:,1,113,sr) = sums(:,113)            ! rrtm_asdir
+#endif
           ENDIF
-#endif
-
-       ENDIF
+
+
+       ENDIF
+
+       hom(:,1,114,sr) = sums(:,114)            !: L
 
        hom(:,1,pr_palm-1,sr) = sums(:,pr_palm-1)
@@ -1520,8 +1551,14 @@
        ts_value(20,sr) = hom(nzb+2,1,pr_palm,sr)    ! v'w'    at k=0
        ts_value(21,sr) = hom(nzb,1,48,sr)           ! w"q"    at k=0
-
+ 
+!
+!--    Calculate obukhov length
        IF ( ts_value(5,sr) /= 0.0_wp )  THEN
-          ts_value(22,sr) = ts_value(4,sr)**2 / &
-                            ( kappa * g * ts_value(5,sr) / ts_value(18,sr) ) ! L
+!           IF ( most_method == 'circular' )  THEN
+!              ts_value(22,sr) = ts_value(4,sr)**2 /                             &
+!                           ( kappa * g * ts_value(5,sr) / ts_value(18,sr) ) 
+!           ELSE
+             ts_value(22,sr) = hom(nzb,1,114,sr)  
+!          ENDIF     
        ELSE
           ts_value(22,sr) = 10000.0_wp
@@ -1553,8 +1590,8 @@
 #if defined ( __rrtmg )
           IF ( radiation_scheme == 'rrtmg' )  THEN
-             ts_value(dots_rad+5,sr) = hom(nzb,1,106,sr)          ! rrtm_aldif
-             ts_value(dots_rad+6,sr) = hom(nzb,1,107,sr)          ! rrtm_aldir
-             ts_value(dots_rad+7,sr) = hom(nzb,1,108,sr)          ! rrtm_asdif
-             ts_value(dots_rad+8,sr) = hom(nzb,1,109,sr)          ! rrtm_asdir
+             ts_value(dots_rad+5,sr) = hom(nzb,1,110,sr)          ! rrtm_aldif
+             ts_value(dots_rad+6,sr) = hom(nzb,1,111,sr)          ! rrtm_aldir
+             ts_value(dots_rad+7,sr) = hom(nzb,1,112,sr)          ! rrtm_asdif
+             ts_value(dots_rad+8,sr) = hom(nzb,1,113,sr)          ! rrtm_asdir
           ENDIF
 #endif
@@ -1642,5 +1679,6 @@
 #if defined ( __rrtmg )
     USE radiation_model_mod,                                                   &
-        ONLY:  rrtm_aldif, rrtm_aldir, rrtm_asdif, rrtm_asdir
+        ONLY:  rrtm_aldif, rrtm_aldir, rrtm_asdif, rrtm_asdir, rad_lw_cs_hr,   &
+               rad_lw_hr,  rad_sw_cs_hr, rad_sw_hr
 #endif
 
@@ -3063,5 +3101,5 @@
 !--    Collect current large scale advection and subsidence tendencies for
 !--    data output
-       IF ( large_scale_forcing  .AND.  ( simulated_time .GT. 0.0_wp ) )  THEN
+       IF ( large_scale_forcing  .AND.  ( simulated_time > 0.0_wp ) )  THEN
 !
 !--       Interpolation in time of LSF_DATA 
@@ -3110,6 +3148,8 @@
              DO  j =  nys, nyn
                 DO  k = nzb_soil, nzt_soil
-                   sums_l(k,89,tn)  = sums_l(k,89,tn)  + t_soil(k,j,i) * rmask(j,i,sr)
-                   sums_l(k,91,tn)  = sums_l(k,91,tn)  + m_soil(k,j,i) * rmask(j,i,sr)
+                   sums_l(k,89,tn)  = sums_l(k,89,tn)  + t_soil(k,j,i)         &
+                                      * rmask(j,i,sr)
+                   sums_l(k,91,tn)  = sums_l(k,91,tn)  + m_soil(k,j,i)         &
+                                      * rmask(j,i,sr)
                 ENDDO
              ENDDO
@@ -3123,8 +3163,22 @@
              DO  j =  nys, nyn
                 DO  k = nzb_s_inner(j,i)+1, nzt+1
-                   sums_l(k,102,tn)  = sums_l(k,102,tn)  + rad_lw_in(k,j,i) * rmask(j,i,sr)
-                   sums_l(k,103,tn)  = sums_l(k,103,tn)  + rad_lw_out(k,j,i) * rmask(j,i,sr)
-                   sums_l(k,104,tn)  = sums_l(k,104,tn)  + rad_sw_in(k,j,i) * rmask(j,i,sr)
-                   sums_l(k,105,tn)  = sums_l(k,105,tn)  + rad_sw_out(k,j,i) * rmask(j,i,sr)
+                   sums_l(k,102,tn)  = sums_l(k,102,tn)  + rad_lw_in(k,j,i)    &
+                                       * rmask(j,i,sr)
+                   sums_l(k,103,tn)  = sums_l(k,103,tn)  + rad_lw_out(k,j,i)   &
+                                       * rmask(j,i,sr)
+                   sums_l(k,104,tn)  = sums_l(k,104,tn)  + rad_sw_in(k,j,i)    &
+                                       * rmask(j,i,sr)
+                   sums_l(k,105,tn)  = sums_l(k,105,tn)  + rad_sw_out(k,j,i)   &
+                                       * rmask(j,i,sr)
+#if defined ( __rrtmg )
+                   sums_l(k,106,tn)  = sums_l(k,106,tn)  + rad_lw_cs_hr(k,j,i) &
+                                       * rmask(j,i,sr)
+                   sums_l(k,107,tn)  = sums_l(k,107,tn)  + rad_lw_hr(k,j,i)    &
+                                       * rmask(j,i,sr)
+                   sums_l(k,108,tn)  = sums_l(k,108,tn)  + rad_sw_cs_hr(k,j,i) &
+                                       * rmask(j,i,sr)
+                   sums_l(k,109,tn)  = sums_l(k,109,tn)  + rad_sw_hr(k,j,i)    &
+                                       * rmask(j,i,sr)
+#endif
                 ENDDO
              ENDDO
@@ -3193,6 +3247,7 @@
           sums(k,70:80)           = sums(k,70:80)       / ngp_2dh_s_inner(k,sr)
           sums(k,81:88)           = sums(k,81:88)       / ngp_2dh(sr)
-          sums(k,89:105)           = sums(k,89:105)     / ngp_2dh(sr)
-          sums(k,106:pr_palm-2)    = sums(k,106:pr_palm-2)/ ngp_2dh_s_inner(k,sr)
+          sums(k,89:114)           = sums(k,89:114)     / ngp_2dh(sr)
+          sums(k,115:pr_palm-2)    = sums(k,115:pr_palm-2)/ ngp_2dh_s_inner(k,sr)
+
        ENDDO
 
@@ -3446,6 +3501,5 @@
 
        IF ( ts_value(5,sr) /= 0.0_wp )  THEN
-          ts_value(22,sr) = ts_value(4,sr)**2_wp / &
-                            ( kappa * g * ts_value(5,sr) / ts_value(18,sr) ) ! L
+          ts_value(22,sr) = hom(nzb,1,114,sr)
        ELSE
           ts_value(22,sr) = 10000.0_wp
Index: palm/trunk/SOURCE/header.f90
===================================================================
--- palm/trunk/SOURCE/header.f90	(revision 1686)
+++ palm/trunk/SOURCE/header.f90	(revision 1691)
@@ -14,10 +14,11 @@
 ! PALM. If not, see <http://www.gnu.org/licenses/>.
 !
-! Copyright 1997-2014 Leibniz Universitaet Hannover
+! Copyright 1997-2015 Leibniz Universitaet Hannover
 !--------------------------------------------------------------------------------!
 !
 ! Current revisions:
 ! -----------------
-! 
+! Renamed prandtl_layer to constant_flux_layer, renames rif_min/rif_max to
+! zeta_min/zeta_max.
 ! 
 ! Former revisions:
@@ -1118,8 +1119,8 @@
     ENDIF
 
-    IF ( prandtl_layer )  THEN
-       WRITE ( io, 305 )  (zu(1)-zu(0)), roughness_length, &
-                          z0h_factor*roughness_length, kappa, &
-                          rif_min, rif_max
+    IF ( constant_flux_layer )  THEN
+       WRITE ( io, 305 )  (zu(1)-zu(0)), roughness_length,                     &
+                          z0h_factor*roughness_length, kappa,                  &
+                          zeta_min, zeta_max
        IF ( .NOT. constant_heatflux )  WRITE ( io, 308 )
        IF ( humidity  .AND.  .NOT. constant_waterflux )  THEN
@@ -1131,5 +1132,5 @@
     ELSE
        IF ( INDEX(initializing_actions, 'set_1d-model_profiles') /= 0 )  THEN
-          WRITE ( io, 310 )  rif_min, rif_max
+          WRITE ( io, 310 )  zeta_min, zeta_max
        ENDIF
     ENDIF
Index: palm/trunk/SOURCE/init_1d_model.f90
===================================================================
--- palm/trunk/SOURCE/init_1d_model.f90	(revision 1686)
+++ palm/trunk/SOURCE/init_1d_model.f90	(revision 1691)
@@ -14,10 +14,10 @@
 ! PALM. If not, see <http://www.gnu.org/licenses/>.
 !
-! Copyright 1997-2014 Leibniz Universitaet Hannover
+! Copyright 1997-2015 Leibniz Universitaet Hannover
 !--------------------------------------------------------------------------------!
 !
 ! Current revisions:
 ! -----------------
-! 
+! Renamed prandtl_layer to constant_flux_layer. rif is replaced by ol and zeta.
 ! 
 ! Former revisions:
@@ -72,4 +72,6 @@
 !> of the wind profile is being computed.
 !> All subroutines required can be found within this file.
+!>
+!> @todo harmonize code with new surface_layer_fluxes module
 !------------------------------------------------------------------------------!
  SUBROUTINE init_1d_model
@@ -90,8 +92,7 @@
     
     USE control_parameters,                                                    &
-        ONLY:  constant_diffusion, f, humidity, kappa, km_constant,            &
-               mixing_length_1d, passive_scalar, prandtl_layer,                &
-               prandtl_number, roughness_length, simulated_time_chr,           &
-               z0h_factor
+        ONLY:  constant_diffusion, constant_flux_layer, f, humidity, kappa,    &
+               km_constant, mixing_length_1d, passive_scalar, prandtl_number,  &
+               roughness_length, simulated_time_chr, z0h_factor
 
     IMPLICIT NONE
@@ -166,5 +167,5 @@
 !
 !-- For u*, theta* and the momentum fluxes plausible values are set
-    IF ( prandtl_layer )  THEN
+    IF ( constant_flux_layer )  THEN
        us1d = 0.1_wp   ! without initial friction the flow would not change
     ELSE
@@ -213,9 +214,9 @@
         
     USE control_parameters,                                                    &
-        ONLY:  constant_diffusion, dissipation_1d, humidity,                   &
-               intermediate_timestep_count, intermediate_timestep_count_max,   &
-               f, g, ibc_e_b, kappa, mixing_length_1d, passive_scalar,         &
-               prandtl_layer, rif_max, rif_min, simulated_time_chr,            &
-               timestep_scheme, tsc
+        ONLY:  constant_diffusion, constant_flux_layer, dissipation_1d,        &
+               humidity, intermediate_timestep_count,                          &
+               intermediate_timestep_count_max, f, g, ibc_e_b, kappa,          &  
+               mixing_length_1d, passive_scalar,                               &
+               simulated_time_chr, timestep_scheme, tsc, zeta_max, zeta_min
                 
     USE indices,                                                               &
@@ -334,5 +335,5 @@
 !--       Finite differences of the momentum fluxes are computed using half the 
 !--       normal grid length (2.0*ddzw(k)) for the sake of enhanced accuracy 
-          IF ( prandtl_layer )  THEN
+          IF ( constant_flux_layer )  THEN
 
              k = nzb+1
@@ -465,5 +466,5 @@
 !
 !--          First compute the vertical fluxes in the Prandtl-layer
-             IF ( prandtl_layer )  THEN
+             IF ( constant_flux_layer )  THEN
 !
 !--             Compute theta* using Rif numbers of the previous time step
@@ -498,5 +499,5 @@
                 ENDIF
 
-             ENDIF    ! prandtl_layer
+             ENDIF    ! constant_flux_layer
 
 !
@@ -506,5 +507,5 @@
 !--          the rif-numbers of the previous time step are used.
 
-             IF ( prandtl_layer )  THEN
+             IF ( constant_flux_layer )  THEN
                 IF ( .NOT. humidity )  THEN
                    pt_0 = pt_init(nzb+1)
@@ -547,10 +548,10 @@
 !--          range. It is exceeded excessively for very small velocities
 !--          (u,v --> 0).
-             WHERE ( rif1d < rif_min )  rif1d = rif_min
-             WHERE ( rif1d > rif_max )  rif1d = rif_max
+             WHERE ( rif1d < zeta_min )  rif1d = zeta_min
+             WHERE ( rif1d > zeta_max )  rif1d = zeta_max
 
 !
 !--          Compute u* from the absolute velocity value
-             IF ( prandtl_layer )  THEN
+             IF ( constant_flux_layer )  THEN
                 uv_total = SQRT( u1d(nzb+1)**2 + v1d(nzb+1)**2 )
 
@@ -639,5 +640,5 @@
                 ENDIF             
 
-             ENDIF   !  prandtl_layer
+             ENDIF   !  constant_flux_layer
 
 !
@@ -673,5 +674,5 @@
 !--          computed via the adiabatic mixing length, for the unstability has
 !--          already been taken account of via the TKE (cf. also Diss.).
-             IF ( prandtl_layer )  THEN
+             IF ( constant_flux_layer )  THEN
                 IF ( rif1d(nzb+1) >= 0.0_wp )  THEN
                    km1d(nzb+1) = us1d * kappa * zu(nzb+1) /                    &
@@ -805,5 +806,5 @@
 
        uv_total = SQRT( u1d(nzb+1)**2 + v1d(nzb+1)**2 )
-       IF ( ABS( v1d(nzb+1) ) .LT. 1.0E-5_wp )  THEN
+       IF ( ABS( v1d(nzb+1) ) < 1.0E-5_wp )  THEN
           alpha = ACOS( SIGN( 1.0_wp , u1d(nzb+1) ) )
        ELSE
Index: palm/trunk/SOURCE/init_3d_model.f90
===================================================================
--- palm/trunk/SOURCE/init_3d_model.f90	(revision 1686)
+++ palm/trunk/SOURCE/init_3d_model.f90	(revision 1691)
@@ -14,10 +14,10 @@
 ! PALM. If not, see <http://www.gnu.org/licenses/>.
 !
-! Copyright 1997-2014 Leibniz Universitaet Hannover
+! Copyright 1997-2015 Leibniz Universitaet Hannover
 !--------------------------------------------------------------------------------!
 !
 ! Current revisions:
 ! ------------------
-! 
+! Call to init_surface_layer added. rif is replaced by ol and zeta.
 ! 
 ! Former revisions:
@@ -266,5 +266,8 @@
                sums_l_l, sums_up_fraction_l, sums_wsts_bc_l, ts_value,         &
                var_d, weight_pres, weight_substep 
-    
+ 
+    USE surface_layer_fluxes_mod,                                              &
+        ONLY:  init_surface_layer_fluxes
+   
     USE transpose_indices 
 
@@ -313,5 +316,5 @@
     ALLOCATE( ptdf_x(nxlg:nxrg), ptdf_y(nysg:nyng) )
 
-    ALLOCATE( rif(nysg:nyng,nxlg:nxrg), shf(nysg:nyng,nxlg:nxrg),     &
+    ALLOCATE( ol(nysg:nyng,nxlg:nxrg), shf(nysg:nyng,nxlg:nxrg),      &
               ts(nysg:nyng,nxlg:nxrg), tswst(nysg:nyng,nxlg:nxrg),    &
               us(nysg:nyng,nxlg:nxrg), usws(nysg:nyng,nxlg:nxrg),     &
@@ -714,6 +717,6 @@
              hom(:,1,25,:) = SPREAD( l1d, 2, statistic_regions+1 )
 
-             IF ( prandtl_layer )  THEN
-                rif  = rif1d(nzb+1)
+             IF ( constant_flux_layer )  THEN
+                ol   = ( zu(nzb+1) - zw(nzb) ) / rif1d(nzb+1)
                 ts   = 0.0_wp  ! could actually be computed more accurately in the
                                ! 1D model. Update when opportunity arises.
@@ -723,5 +726,5 @@
              ELSE
                 ts   = 0.0_wp  ! must be set, because used in
-                rif  = 0.0_wp  ! flowste
+                ol   = ( zu(nzb+1) - zw(nzb) ) / zeta_min  ! flowste
                 us   = 0.0_wp
                 usws = 0.0_wp
@@ -731,5 +734,5 @@
           ELSE
              e    = 0.0_wp  ! must be set, because used in
-             rif  = 0.0_wp  ! flowste
+             ol   = ( zu(nzb+1) - zw(nzb) ) / zeta_min  ! flowste
              ts   = 0.0_wp
              us   = 0.0_wp
@@ -886,5 +889,5 @@
              e    = 0.0_wp
           ENDIF
-          rif   = 0.0_wp
+          ol    = ( zu(nzb+1) - zw(nzb) ) / zeta_min
           ts    = 0.0_wp
           us    = 0.0_wp
@@ -1095,5 +1098,5 @@
 !
 !--    Initialize Prandtl layer quantities
-       IF ( prandtl_layer )  THEN
+       IF ( constant_flux_layer )  THEN
 
           z0 = roughness_length
@@ -1103,5 +1106,5 @@
 !
 !--          Surface temperature is prescribed. Here the heat flux cannot be
-!--          simply estimated, because therefore rif, u* and theta* would have
+!--          simply estimated, because therefore ol, u* and theta* would have
 !--          to be computed by iteration. This is why the heat flux is assumed
 !--          to be zero before the first time step. It approaches its correct
@@ -1624,4 +1627,13 @@
        CALL location_message( 'initializing land surface model', .FALSE. )
        CALL init_lsm
+       CALL location_message( 'finished', .TRUE. )
+    ENDIF
+
+!
+!-- Initialize surface layer (done after LSM as roughness length are required
+!-- for initialization
+    IF ( constant_flux_layer )  THEN
+       CALL location_message( 'initializing surface layer', .FALSE. )
+       CALL init_surface_layer_fluxes
        CALL location_message( 'finished', .TRUE. )
     ENDIF
Index: palm/trunk/SOURCE/init_cloud_physics.f90
===================================================================
--- palm/trunk/SOURCE/init_cloud_physics.f90	(revision 1686)
+++ palm/trunk/SOURCE/init_cloud_physics.f90	(revision 1691)
@@ -14,10 +14,10 @@
 ! PALM. If not, see <http://www.gnu.org/licenses/>.
 !
-! Copyright 1997-2014 Leibniz Universitaet Hannover
+! Copyright 1997-2015 Leibniz Universitaet Hannover
 !--------------------------------------------------------------------------------!
 !
 ! Current revisions:
 ! -----------------
-! 
+! Removed typo
 ! 
 ! Former revisions:
@@ -117,5 +117,5 @@
     dpirho_l = 1.0_wp / pirho_l
 !
-!-- constant fot the sedimentation of cloud water (2-moment cloud physics)
+!-- constant for the sedimentation of cloud water (2-moment cloud physics)
     sed_qc_const = k_st * ( 3.0_wp / ( 4.0_wp * pi * rho_l )                   &
                           )**( 2.0_wp / 3.0_wp ) *                             &
Index: palm/trunk/SOURCE/init_grid.f90
===================================================================
--- palm/trunk/SOURCE/init_grid.f90	(revision 1686)
+++ palm/trunk/SOURCE/init_grid.f90	(revision 1691)
@@ -14,10 +14,10 @@
 ! PALM. If not, see <http://www.gnu.org/licenses/>.
 !
-! Copyright 1997-2014 Leibniz Universitaet Hannover
+! Copyright 1997-2015 Leibniz Universitaet Hannover
 !--------------------------------------------------------------------------------!
 !
 ! Current revisions:
 ! -----------------
-! 
+! Renamed prandtl_layer to constant_flux_layer.
 ! 
 ! Former revisions:
@@ -144,12 +144,13 @@
                building_length_y, building_wall_left, building_wall_south,     &
                canyon_height, canyon_wall_left, canyon_wall_south,             &
-               canyon_width_x, canyon_width_y, coupling_char, dp_level_ind_b,  &
-               dz, dz_max, dz_stretch_factor, dz_stretch_level,                &
-               dz_stretch_level_index, ibc_uv_b, io_blocks, io_group,          &
-               inflow_l, inflow_n, inflow_r, inflow_s, masking_method,         &
-               maximum_grid_level, message_string, momentum_advec, ocean,      &
-               outflow_l, outflow_n, outflow_r, outflow_s, prandtl_layer,      &
-               psolver, scalar_advec, topography, topography_grid_convention,  &
-               use_surface_fluxes, use_top_fluxes, wall_adjustment_factor 
+               canyon_width_x, canyon_width_y, constant_flux_layer,            &
+               coupling_char, dp_level_ind_b, dz, dz_max, dz_stretch_factor,   &
+               dz_stretch_level, dz_stretch_level_index, ibc_uv_b, io_blocks,  &
+               io_group, inflow_l, inflow_n, inflow_r, inflow_s,               &
+               masking_method, maximum_grid_level, message_string,             &
+               momentum_advec, ocean, outflow_l, outflow_n, outflow_r,         &
+               outflow_s, psolver, scalar_advec, topography,                   &
+               topography_grid_convention, use_surface_fluxes, use_top_fluxes, &
+               wall_adjustment_factor 
         
     USE grid_variables,                                                        &
@@ -477,5 +478,5 @@
 !-- Define vertical gridpoint from (or to) which on the usual finite difference
 !-- form (which does not use surface fluxes) is applied 
-    IF ( prandtl_layer  .OR.  use_surface_fluxes )  THEN
+    IF ( constant_flux_layer  .OR.  use_surface_fluxes )  THEN
        nzb_diff = nzb + 2
     ELSE
@@ -955,5 +956,5 @@
 !-- the usual finite difference form (which does not use surface fluxes) is
 !-- applied 
-    IF ( prandtl_layer  .OR.  use_surface_fluxes )  THEN
+    IF ( constant_flux_layer  .OR.  use_surface_fluxes )  THEN
        nzb_diff_u         = nzb_u_inner + 2
        nzb_diff_v         = nzb_v_inner + 2
Index: palm/trunk/SOURCE/land_surface_model.f90
===================================================================
--- palm/trunk/SOURCE/land_surface_model.f90	(revision 1686)
+++ palm/trunk/SOURCE/land_surface_model.f90	(revision 1691)
@@ -14,10 +14,13 @@
 ! PALM. If not, see <http://www.gnu.org/licenses/>.
 !
-! Copyright 1997-2014 Leibniz Universitaet Hannover
+! Copyright 1997-2015 Leibniz Universitaet Hannover
 !--------------------------------------------------------------------------------!
 !
 ! Current revisions:
 ! -----------------
-! 
+! Added skip_time_do_lsm to allow for spin-ups without LSM. Various bugfixes:
+! Soil temperatures are now defined at the edges of the layers, calculation of
+! shb_eb corrected, prognostic equation for skin temperature corrected. Surface
+! fluxes are now directly transfered to atmosphere
 ! 
 ! Former revisions:
@@ -73,42 +76,51 @@
 !> DALES and UCLA-LES models.
 !>
-!> @todo Check dewfall parametrization for fog simulations.
-!> @todo Consider partial absorption of the net shortwave radiation by the surface layer.
-!> @todo Allow for water surfaces, check performance for bare soils.
-!> @todo Invert indices (running from -3 to 0. Currently: nzb_soil=0, nzt_soil=3)).
-!> @todo Implement surface runoff model (required when performing long-term LES with
-!>       considerable precipitation.
+!> @todo Consider partial absorption of the net shortwave radiation by the 
+!>       surface layer.
+!> @todo Allow for water surfaces
+!> @todo Invert indices (running from -3 to 0. Currently: nzb_soil=0, 
+!>       nzt_soil=3)).
+!> @todo Implement surface runoff model (required when performing long-term LES 
+!>       with considerable precipitation.
 !>
-!> @note  No time step criterion is required as long as the soil layers do not become
-!>        too thin.
+!> @note  No time step criterion is required as long as the soil layers do not 
+!>        become too thin.
 !------------------------------------------------------------------------------!
  MODULE land_surface_model_mod
  
-     USE arrays_3d,                                                            &
-         ONLY:  pt, pt_p, q_p, qsws, rif, shf, ts, us, z0, z0h
-
-     USE cloud_parameters,                                                     &
-         ONLY:  cp, l_d_r, l_v, precipitation_rate, rho_l, r_d, r_v
-
-     USE control_parameters,                                                   &
-         ONLY:  cloud_physics, dt_3d, humidity, intermediate_timestep_count,   &
-                initializing_actions, intermediate_timestep_count_max,         &
-                max_masks, precipitation, pt_surface, rho_surface,             &
-                roughness_length, surface_pressure, timestep_scheme, tsc,      &
-                z0h_factor, time_since_reference_point
-
-     USE indices,                                                              &
-         ONLY:  nbgp, nxlg, nxrg, nyng, nysg, nzb, nzb_s_inner 
-
-     USE kinds
+    USE arrays_3d,                                                             &
+        ONLY:  hyp, pt, pt_p, q, q_p, ql, qsws, rif, shf, ts, us, vpt, z0, z0h
+
+    USE cloud_parameters,                                                      &
+        ONLY:  cp, hyrho, l_d_cp, l_d_r, l_v, prr, pt_d_t, rho_l, r_d, r_v
+
+    USE control_parameters,                                                    &
+        ONLY:  cloud_physics, dt_3d, humidity, intermediate_timestep_count,    &
+               initializing_actions, intermediate_timestep_count_max,          &
+               max_masks, precipitation, pt_surface, rho_surface,              &
+               roughness_length, surface_pressure, timestep_scheme, tsc,       &
+               z0h_factor, time_since_reference_point
+
+    USE indices,                                                               &
+        ONLY:  nbgp, nxlg, nxrg, nyng, nysg, nzb, nzb_s_inner 
+
+    USE kinds
 
     USE netcdf_control,                                                        &
         ONLY:  dots_label, dots_num, dots_unit
 
-     USE radiation_model_mod,                                                  &
-         ONLY:  radiation_scheme, rad_net, rad_sw_in, sigma_sb
-
-     USE statistics,                                                           &
-         ONLY:  hom, statistic_regions
+    USE pegrid
+
+    USE radiation_model_mod,                                                   &
+        ONLY:  force_radiation_call, radiation_scheme, rad_net, rad_sw_in,     &
+               rad_lw_out, sigma_sb
+        
+#if defined ( __rrtmg )
+    USE radiation_model_mod,                                                   &
+        ONLY:  rrtm_lwuflx_dt, rrtm_idrv
+#endif
+
+    USE statistics,                                                            &
+        ONLY:  hom, statistic_regions
 
     IMPLICIT NONE
@@ -144,7 +156,8 @@
                     soil_type = 3    !< soil type, 0: user-defined, 1-6: generic (see list)
 
-    LOGICAL :: conserve_water_content = .TRUE., & !< open or closed bottom surface for the soil model
-               dewfall = .TRUE.,                & !< allow/inhibit dewfall
-               land_surface = .FALSE.             !< flag parameter indicating wheather the lsm is used
+    LOGICAL :: conserve_water_content = .TRUE.,  & !< open or closed bottom surface for the soil model
+               dewfall = .TRUE.,                 & !< allow/inhibit dewfall
+               force_radiation_call_l = .FALSE., & !< flag parameter for unscheduled radiation model calls
+               land_surface = .FALSE.              !< flag parameter indicating wheather the lsm is used
 
 !   value 9999999.9_wp -> generic available or user-defined value must be set
@@ -160,4 +173,5 @@
                 hydraulic_conductivity = 9999999.9_wp,  & !< NAMELIST gamma_w_sat
                 ke = 0.0_wp,                            & !< Kersten number
+                lambda_h_sat = 0.0_wp,                  & !< heat conductivity for saturated soil
                 lambda_surface_stable = 9999999.9_wp,   & !< NAMELIST lambda_surface_s
                 lambda_surface_unstable = 9999999.9_wp, & !< NAMELIST lambda_surface_u
@@ -174,15 +188,14 @@
                 rd_d_rv,                                & !< r_d / r_v
                 saturation_moisture = 9999999.9_wp,     & !< NAMELIST m_sat
+                skip_time_do_lsm = 0.0_wp,              & !< LSM is not called before this time
                 vegetation_coverage = 9999999.9_wp,     & !< NAMELIST c_veg
                 wilting_point = 9999999.9_wp,           & !< NAMELIST m_wilt
                 z0_eb  = 9999999.9_wp,                  & !< NAMELIST z0 (lsm_par)
-                z0h_eb = 9999999.9_wp                    !< NAMELIST z0h (lsm_par)
+                z0h_eb = 9999999.9_wp                     !< NAMELIST z0h (lsm_par)
 
     REAL(wp), DIMENSION(nzb_soil:nzt_soil) :: &
-              ddz_soil,                     & !< 1/dz_soil
-              ddz_soil_stag,                & !< 1/dz_soil_stag
-              dz_soil,                      & !< soil grid spacing (center-center)
-              dz_soil_stag,                 & !< soil grid spacing (edge-edge) 
-              root_extr = 0.0_wp,           & !< root extraction
+              ddz_soil_stag,                  & !< 1/dz_soil_stag
+              dz_soil_stag,                   & !< soil grid spacing (center-center)
+              root_extr = 0.0_wp,             & !< root extraction
               root_fraction = (/9999999.9_wp, 9999999.9_wp,    &
                                 9999999.9_wp, 9999999.9_wp /), & !< distribution of root surface area to the individual soil layers
@@ -191,6 +204,8 @@
 
     REAL(wp), DIMENSION(nzb_soil:nzt_soil+1) ::   &
-              soil_temperature = (/290.0_wp, 287.0_wp, 285.0_wp,  283.0_wp,    &
-                                   283.0_wp /) !< soil temperature (K)
+              soil_temperature = (/290.0_wp, 287.0_wp, 285.0_wp,  283.0_wp,    & !< soil temperature (K)
+                                   283.0_wp /),                                &                                   
+              ddz_soil,                                                        & !< 1/dz_soil
+              dz_soil                                                            !< soil grid spacing (edge-edge)
 
 #if defined( __nopointer )
@@ -218,5 +233,5 @@
 !
 !-- Energy balance variables                
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::                                   &
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE :: &
               alpha_vg,         & !< coef. of Van Genuchten
               c_liq,            & !< liquid water coverage (of vegetated area)
@@ -232,7 +247,6 @@
               lai,              & !< leaf area index
               lai_av,           & !< average of lai
-              lambda_h_sat,     & !< heat conductivity for dry soil
-              lambda_surface_s,    & !< coupling between surface and soil (depends on vegetation type)
-              lambda_surface_u,    & !< coupling between surface and soil (depends on vegetation type)
+              lambda_surface_s, & !< coupling between surface and soil (depends on vegetation type)
+              lambda_surface_u, & !< coupling between surface and soil (depends on vegetation type)
               l_vg,             & !< coef. of Van Genuchten
               m_fc,             & !< soil moisture at field capacity (m3/m3)
@@ -253,11 +267,12 @@
               r_a_av,           & !< avergae of r_a
               r_canopy,         & !< canopy resistance
-              r_soil,           & !< soil resitance
+              r_soil,           & !< soil resistance
               r_soil_min,       & !< minimum soil resistance
               r_s,              & !< total surface resistance (combination of r_soil and r_canopy)
-              r_s_av,           & !< avergae of r_s
+              r_s_av,           & !< average of r_s
               r_canopy_min,     & !< minimum canopy (stomatal) resistance
               shf_eb,           & !< surface flux of sensible heat
               shf_eb_av           !< average of shf_eb
+
 
     REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::                                 &
@@ -472,7 +487,8 @@
            lsm_swap_timelevel, l_vangenuchten, min_canopy_resistance,          &
            min_soil_resistance, n_vangenuchten, residual_moisture, rho_cp,     &
-           rho_lv, root_fraction, saturation_moisture, soil_moisture,          &
-           soil_temperature, soil_type, soil_type_name, vegetation_coverage,   &
-           veg_type, veg_type_name, wilting_point, z0_eb, z0h_eb
+           rho_lv, root_fraction, saturation_moisture, skip_time_do_lsm,       &
+           soil_moisture, soil_temperature, soil_type, soil_type_name,         &
+           vegetation_coverage, veg_type, veg_type_name, wilting_point, z0_eb, &
+           z0h_eb
 
 !
@@ -483,5 +499,4 @@
            zs
 
-
 !
 !-- Public 2D output variables
@@ -490,5 +505,4 @@
            qsws_soil_eb, qsws_soil_eb_av, qsws_veg_eb, qsws_veg_eb_av,         &
            r_a, r_a_av, r_s, r_s_av, shf_eb, shf_eb_av
-
 
 !
@@ -565,5 +579,4 @@
        ALLOCATE ( lai(nysg:nyng,nxlg:nxrg) )
        ALLOCATE ( l_vg(nysg:nyng,nxlg:nxrg) )
-       ALLOCATE ( lambda_h_sat(nysg:nyng,nxlg:nxrg) )
        ALLOCATE ( lambda_surface_u(nysg:nyng,nxlg:nxrg) )
        ALLOCATE ( lambda_surface_s(nysg:nyng,nxlg:nxrg) )
@@ -612,8 +625,10 @@
        INTEGER(iwp) ::  k !< running index
 
+       REAL(wp) :: pt_1   !< potential temperature at first grid level
+
 
 !
 !--    Calculate Exner function
-       exn       = ( surface_pressure / 1000.0_wp )**0.286_wp
+       exn = ( surface_pressure / 1000.0_wp )**0.286_wp
 
 
@@ -674,16 +689,17 @@
 !
 !--    Calculate grid spacings. Temperature and moisture are defined at
-!--    the center of the soil layers, whereas gradients/fluxes are defined
-!--    at the edges (_stag)
-       dz_soil_stag(nzb_soil) = zs(nzb_soil)
-
-       DO k = nzb_soil+1, nzt_soil
-          dz_soil_stag(k) = zs(k) - zs(k-1)
+!--    the edges of the soil layers (_stag), whereas gradients/fluxes are defined
+!--    at the centers
+       dz_soil(nzb_soil) = zs(nzb_soil)
+
+       DO  k = nzb_soil+1, nzt_soil
+          dz_soil(k) = zs(k) - zs(k-1)
        ENDDO
-
-       DO k = nzb_soil, nzt_soil-1
-          dz_soil(k) = 0.5 * (dz_soil_stag(k+1) + dz_soil_stag(k))
+       dz_soil(nzt_soil+1) = dz_soil(nzt_soil)
+
+       DO  k = nzb_soil, nzt_soil-1
+          dz_soil_stag(k) = 0.5_wp * (dz_soil(k+1) + dz_soil(k))
        ENDDO
-       dz_soil(nzt_soil) = dz_soil_stag(nzt_soil)
+       dz_soil_stag(nzt_soil) = dz_soil(nzt_soil)
 
        ddz_soil      = 1.0_wp / dz_soil
@@ -752,5 +768,5 @@
 !--       (make sure that the soil moisture does not drop below the permanent
 !--       wilting point) -> problems with devision by zero)
-          DO k = nzb_soil, nzt_soil
+          DO  k = nzb_soil, nzt_soil
              t_soil(k,:,:)    = soil_temperature(k)
              m_soil(k,:,:)    = MAX(soil_moisture(k),m_wilt(:,:))
@@ -761,5 +777,6 @@
 !
 !--       Calculate surface temperature
-          t_surface = pt_surface * exn
+          t_surface   = pt_surface * exn
+          t_surface_p = t_surface
 
 !
@@ -770,11 +787,16 @@
                 k = nzb_s_inner(j,i)
 
+                IF ( cloud_physics )  THEN
+                   pt_1 = pt(k+1,j,i) + l_d_cp * pt_d_t(k+1) * ql(k+1,j,i)
+                ELSE
+                   pt_1 = pt(k+1,j,i)
+                ENDIF
+
 !
 !--             Assure that r_a cannot be zero at model start
-                IF ( pt(k+1,j,i) == pt(k,j,i) )  pt(k+1,j,i) = pt(k+1,j,i)     &
-                                                 + 1.0E-10_wp
-
-                us(j,i) = 0.1_wp
-                ts(j,i) = (pt(k+1,j,i) - pt(k,j,i)) / r_a(j,i)
+                IF ( pt_1 == pt(k,j,i) )  pt_1 = pt_1 + 1.0E-10_wp
+
+                us(j,i)  = 0.1_wp
+                ts(j,i)  = (pt_1 - pt(k,j,i)) / r_a(j,i)
                 shf(j,i) = - us(j,i) * ts(j,i)
              ENDDO
@@ -794,13 +816,5 @@
        ENDIF
 
-!
-!--    Calculate saturation soil heat conductivity
-       lambda_h_sat(:,:) = lambda_h_sm ** (1.0_wp - m_sat(:,:)) *              &
-                           lambda_h_water ** m_sat(:,:)
-
-
-
-
-       DO k = nzb_soil, nzt_soil
+       DO  k = nzb_soil, nzt_soil
           root_fr(k,:,:) = root_fraction(k)
        ENDDO
@@ -838,5 +852,5 @@
 
           IF ( ANY( root_fraction == 9999999.9_wp ) )  THEN
-             DO k = nzb_soil, nzt_soil
+             DO  k = nzb_soil, nzt_soil
                 root_fr(k,:,:) = root_distribution(k,veg_type)
                 root_fraction(k) = root_distribution(k,veg_type)
@@ -886,28 +900,19 @@
 
 !
-!--    Calculate humidity at the surface
-       IF ( humidity )  THEN
-          CALL calc_q_surface
-       ENDIF
-
-
-
-!
 !--    Add timeseries for land surface model
-
-       dots_label(dots_num+1) = "ghf_eb"
-       dots_label(dots_num+2) = "shf_eb"
-       dots_label(dots_num+3) = "qsws_eb"
-       dots_label(dots_num+4) = "qsws_liq_eb"
-       dots_label(dots_num+5) = "qsws_soil_eb"
-       dots_label(dots_num+6) = "qsws_veg_eb"
-       dots_unit(dots_num+1:dots_num+6) = "W/m2"
-
-       dots_label(dots_num+7) = "r_a"
-       dots_label(dots_num+8) = "r_s"
-       dots_unit(dots_num+7:dots_num+8) = "s/m"
-
        dots_soil = dots_num + 1
        dots_num  = dots_num + 8
+
+       dots_label(dots_soil) = "ghf_eb"
+       dots_label(dots_soil+1) = "shf_eb"
+       dots_label(dots_soil+2) = "qsws_eb"
+       dots_label(dots_soil+3) = "qsws_liq_eb"
+       dots_label(dots_soil+4) = "qsws_soil_eb"
+       dots_label(dots_soil+5) = "qsws_veg_eb"
+       dots_label(dots_soil+6) = "r_a"
+       dots_label(dots_soil+7) = "r_s"
+
+       dots_unit(dots_soil:dots_soil+5) = "W/m2"
+       dots_unit(dots_soil+6:dots_soil+7) = "s/m"
 
        RETURN
@@ -921,9 +926,4 @@
 ! ------------
 !> Solver for the energy balance at the surface.
-!> @note Surface fluxes are calculated in the land surface model, but these are
-!>       not used in the atmospheric code. The fluxes are calculated afterwards in
-!>       prandtl_fluxes using the surface values of temperature and humidity as
-!>       provided by the land surface model. In this way, the fluxes in the land
-!>       surface model are not equal to the ones calculated in prandtl_fluxes
 !------------------------------------------------------------------------------!
     SUBROUTINE lsm_energy_balance
@@ -940,5 +940,4 @@
                    f3,          & !< resistance correction term 3
                    m_min,       & !< minimum soil moisture
-                   T_1,         & !< actual temperature at first grid point
                    e,           & !< water vapour pressure
                    e_s,         & !< water vapour saturation pressure
@@ -954,6 +953,7 @@
                    f_shf,       & !< factor for shf_eb
                    lambda_surface, & !< Current value of lambda_surface
-                   m_liq_eb_max   !< maxmimum value of the liq. water reservoir
-
+                   m_liq_eb_max,   & !< maxmimum value of the liq. water reservoir
+                   pt_1,        & !< potential temperature at first grid level
+                   qv_1           !< specific humidity at first grid level
 
 !
@@ -961,8 +961,6 @@
        exn = ( surface_pressure / 1000.0_wp )**0.286_wp
 
-       
-
-       DO i = nxlg, nxrg
-          DO j = nysg, nyng
+       DO  i = nxlg, nxrg
+          DO  j = nysg, nyng
              k = nzb_s_inner(j,i)
 
@@ -980,6 +978,13 @@
 !--          time step is used here. Note that this formulation is the
 !--          equivalent to the ECMWF formulation using drag coefficients
-             r_a(j,i) = (pt(k+1,j,i) - pt(k,j,i)) / (ts(j,i) * us(j,i) +       &
-                         1.0E-20_wp)
+             IF ( cloud_physics )  THEN
+                pt_1 = pt(k+1,j,i) + l_d_cp * pt_d_t(k+1) * ql(k+1,j,i)
+                qv_1 = q(k+1,j,i) - ql(k+1,j,i)
+             ELSE
+                pt_1 = pt(k+1,j,i)
+                qv_1 = q(k+1,j,i)
+             ENDIF
+
+             r_a(j,i) = (pt_1 - pt(k,j,i)) / (ts(j,i) * us(j,i) + 1.0E-20_wp)
 
 !
@@ -1002,12 +1007,12 @@
 !--          f2 = 0 for very dry soils
              m_total = 0.0_wp
-             DO ks = nzb_soil, nzt_soil
+             DO  ks = nzb_soil, nzt_soil
                  m_total = m_total + root_fr(ks,j,i)                           &
                            * MAX(m_soil(ks,j,i),m_wilt(j,i))
              ENDDO 
 
-             IF ( m_total .GT. m_wilt(j,i) .AND. m_total .LT. m_fc(j,i) )  THEN
+             IF ( m_total > m_wilt(j,i) .AND. m_total < m_fc(j,i) )  THEN
                 f2 = ( m_total - m_wilt(j,i) ) / (m_fc(j,i) - m_wilt(j,i) )
-             ELSEIF ( m_total .GE. m_fc(j,i) )  THEN
+             ELSEIF ( m_total >= m_fc(j,i) )  THEN
                 f2 = 1.0_wp
              ELSE
@@ -1025,5 +1030,5 @@
 !
 !--             Calculate vapour pressure
-                e  = q_p(k+1,j,i) * surface_pressure / 0.622_wp
+                e  = qv_1 * surface_pressure / 0.622_wp
                 f3 = EXP ( -g_d(j,i) * (e_s - e) )
              ELSE
@@ -1067,8 +1072,8 @@
 !--          In case of dewfall, set evapotranspiration to zero
 !--          All super-saturated water is then removed from the air
-             IF ( humidity .AND. dewfall .AND. q_s .LE. q_p(k+1,j,i) )  THEN
+             IF ( humidity .AND. q_s <= qv_1 )  THEN
                 r_canopy(j,i) = 0.0_wp
                 r_soil(j,i)   = 0.0_wp
-             ENDIF 
+             ENDIF
 
 !
@@ -1085,5 +1090,5 @@
 !--          If soil moisture is below wilting point, plants do no longer
 !--          transpirate.
-!              IF ( m_soil(k,j,i) .LT. m_wilt(j,i) )  THEN
+!              IF ( m_soil(k,j,i) < m_wilt(j,i) )  THEN
 !                 f_qsws_veg = 0.0_wp
 !              ENDIF
@@ -1094,5 +1099,5 @@
 !--          air.
              IF ( humidity )  THEN
-                IF ( q_s .LE. q_p(k+1,j,i) )  THEN
+                IF ( q_s <= qv_1 )  THEN
                    IF ( .NOT. dewfall )  THEN
                       f_qsws_veg  = 0.0_wp
@@ -1114,16 +1119,16 @@
              dq_s_dt = 0.622_wp * e_s_dt / surface_pressure
 
-             T_1 = pt_p(k+1,j,i) * exn
-
 !
 !--          Add LW up so that it can be removed in prognostic equation
-             rad_net_l(j,i) = rad_net(j,i) + sigma_sb * t_surface(j,i) ** 4
+             rad_net_l(j,i) = rad_net(j,i) + rad_lw_out(nzb,j,i)
+
 
              IF ( humidity )  THEN
-
+#if defined ( __rrtmg )
 !
 !--             Numerator of the prognostic equation
-                coef_1 = rad_net_l(j,i) + 3.0_wp * sigma_sb * t_surface(j,i) ** 4&
-                         + f_shf / exn * T_1 + f_qsws * ( q_p(k+1,j,i) - q_s   &
+                coef_1 = rad_net_l(j,i) + rrtm_lwuflx_dt(0,nzb)                &
+                         * t_surface(j,i) - rad_lw_out(nzb,j,i)                &
+                         + f_shf * pt_1 + f_qsws * ( qv_1 - q_s                &
                          + dq_s_dt * t_surface(j,i) ) + lambda_surface         &
                          * t_soil(nzb_soil,j,i)
@@ -1131,14 +1136,42 @@
 !
 !--             Denominator of the prognostic equation
-                coef_2 = 4.0_wp * sigma_sb * t_surface(j,i) ** 3 + f_qsws      &
-                         * dq_s_dt + lambda_surface + f_shf / exn
-
+                coef_2 = rrtm_lwuflx_dt(0,nzb) + f_qsws * dq_s_dt              &
+                         + lambda_surface + f_shf / exn
+#else
+
+!
+!--             Numerator of the prognostic equation
+                coef_1 = rad_net_l(j,i) + 3.0_wp * sigma_sb                    &
+                         * t_surface(j,i) ** 4                                 &
+                         + f_shf * pt_1 + f_qsws * ( qv_1                      &
+                         - q_s + dq_s_dt * t_surface(j,i) )                    &
+                         + lambda_surface * t_soil(nzb_soil,j,i)
+
+!
+!--                Denominator of the prognostic equation
+                   coef_2 = 4.0_wp * sigma_sb * t_surface(j,i) ** 3 + f_qsws   &
+                            * dq_s_dt + lambda_surface + f_shf / exn
+ 
+#endif
              ELSE
 
+#if defined ( __rrtmg )
 !
 !--             Numerator of the prognostic equation
-                coef_1 = rad_net_l(j,i) + 3.0_wp * sigma_sb * t_surface(j,i) ** 4&
-                         + f_shf / exn * T_1 + lambda_surface                  &
+                coef_1 = rad_net_l(j,i) + rrtm_lwuflx_dt(0,nzb)                &
+                         * t_surface(j,i) - rad_lw_out(nzb,j,i)                &
+                         + f_shf * pt_1  + lambda_surface                      &
                          * t_soil(nzb_soil,j,i)
+
+!
+!--             Denominator of the prognostic equation
+                coef_2 = rrtm_lwuflx_dt(0,nzb) + lambda_surface + f_shf / exn
+#else
+
+!
+!--             Numerator of the prognostic equation
+                coef_1 = rad_net_l(j,i) + 3.0_wp * sigma_sb                    &
+                          * t_surface(j,i) ** 4 + f_shf * pt_1                 &
+                          + lambda_surface * t_soil(nzb_soil,j,i)
 
 !
@@ -1146,6 +1179,7 @@
                 coef_2 = 4.0_wp * sigma_sb * t_surface(j,i) ** 3               &
                          + lambda_surface + f_shf / exn
-
-             ENDIF
+#endif
+             ENDIF
+
 
              tend = 0.0_wp
@@ -1159,56 +1193,87 @@
 !
 !--          Add RK3 term
-             t_surface_p(j,i) = t_surface_p(j,i) + dt_3d * tsc(3)              &
-                                * tt_surface_m(j,i)
-
-!
-!--          Calculate true tendency
-             tend = (t_surface_p(j,i) - t_surface(j,i) - dt_3d * tsc(3)        &
-                    * tt_surface_m(j,i)) / (dt_3d  * tsc(2))
-!
-!--          Calculate t_surface tendencies for the next Runge-Kutta step
-             IF ( timestep_scheme(1:5) == 'runge' )  THEN
-                IF ( intermediate_timestep_count == 1 )  THEN
-                   tt_surface_m(j,i) = tend
-                ELSEIF ( intermediate_timestep_count <                         &
-                         intermediate_timestep_count_max )  THEN
-                   tt_surface_m(j,i) = -9.5625_wp * tend + 5.3125_wp           &
-                                       * tt_surface_m(j,i)
+             IF ( c_surface /= 0.0_wp )  THEN
+
+                t_surface_p(j,i) = t_surface_p(j,i) + dt_3d * tsc(3)           &
+                                   * tt_surface_m(j,i)
+
+!
+!--             Calculate true tendency
+                tend = (t_surface_p(j,i) - t_surface(j,i) - dt_3d * tsc(3)     &
+                       * tt_surface_m(j,i)) / (dt_3d  * tsc(2))
+!
+!--             Calculate t_surface tendencies for the next Runge-Kutta step
+                IF ( timestep_scheme(1:5) == 'runge' )  THEN
+                   IF ( intermediate_timestep_count == 1 )  THEN
+                      tt_surface_m(j,i) = tend
+                   ELSEIF ( intermediate_timestep_count <                      &
+                            intermediate_timestep_count_max )  THEN
+                      tt_surface_m(j,i) = -9.5625_wp * tend + 5.3125_wp        &
+                                          * tt_surface_m(j,i)
+                   ENDIF
                 ENDIF
-             ENDIF
-
-             pt_p(k,j,i) = t_surface_p(j,i) / exn
+
+             ENDIF
+
+!
+!--          In case of fast changes in the skin temperature, it is required to
+!--          update the radiative fluxes in order to keep the solution stable
+             IF ( ABS( t_surface_p(j,i) - t_surface(j,i) ) > 0.2_wp )  THEN
+                force_radiation_call_l = .TRUE.
+             ENDIF
+
+             pt(k,j,i) = t_surface_p(j,i) / exn
+
 !
 !--          Calculate fluxes
-             rad_net_l(j,i)   = rad_net_l(j,i) + 3.0_wp * sigma_sb                 &
-                              * t_surface(j,i)**4 - 4.0_wp * sigma_sb          &
-                              * t_surface(j,i)**3 * t_surface_p(j,i)
+#if defined ( __rrtmg )
+             rad_net_l(j,i)   = rad_net_l(j,i) + rrtm_lwuflx_dt(0,nzb)         &
+                                * t_surface(j,i) - rad_lw_out(nzb,j,i)         &
+                                - rrtm_lwuflx_dt(0,nzb) * t_surface_p(j,i)
+
+             IF ( rrtm_idrv == 1 )  THEN
+                rad_net(j,i) = rad_net_l(j,i)
+                rad_lw_out(nzb,j,i) = rad_lw_out(nzb,j,i)                      &
+                                      + rrtm_lwuflx_dt(0,nzb)                  &
+                                      * ( t_surface_p(j,i) - t_surface(j,i) )
+             ENDIF
+#else
+             rad_net_l(j,i)   = rad_net_l(j,i) + 3.0_wp * sigma_sb             &
+                                * t_surface(j,i)**4 - 4.0_wp * sigma_sb        &
+                                * t_surface(j,i)**3 * t_surface_p(j,i)
+             rad_net(j,i) = rad_net_l(j,i)
+#endif
+
              ghf_eb(j,i)    = lambda_surface * (t_surface_p(j,i)               &
                               - t_soil(nzb_soil,j,i))
-             shf_eb(j,i)    = - f_shf  * ( pt_p(k+1,j,i) - pt_p(k,j,i) )
+
+             shf_eb(j,i)    = - f_shf * ( pt_1 - pt(k,j,i) )
+
+             shf(j,i) = shf_eb(j,i) / rho_cp
 
              IF ( humidity )  THEN
-                qsws_eb(j,i)  = - f_qsws    * ( q_p(k+1,j,i) - q_s + dq_s_dt   &
+                qsws_eb(j,i)  = - f_qsws    * ( qv_1 - q_s + dq_s_dt           &
                                 * t_surface(j,i) - dq_s_dt * t_surface_p(j,i) )
 
-                qsws_veg_eb(j,i)  = - f_qsws_veg  * ( q_p(k+1,j,i) - q_s       &
+                qsws(j,i) = qsws_eb(j,i) / rho_lv
+
+                qsws_veg_eb(j,i)  = - f_qsws_veg  * ( qv_1 - q_s               &
                                     + dq_s_dt * t_surface(j,i) - dq_s_dt       &
                                     * t_surface_p(j,i) )
 
-                qsws_soil_eb(j,i) = - f_qsws_soil * ( q_p(k+1,j,i) - q_s       &
+                qsws_soil_eb(j,i) = - f_qsws_soil * ( qv_1 - q_s               &
                                     + dq_s_dt * t_surface(j,i) - dq_s_dt       &
                                     * t_surface_p(j,i) )
 
-                qsws_liq_eb(j,i)  = - f_qsws_liq  * ( q_p(k+1,j,i) - q_s       &
+                qsws_liq_eb(j,i)  = - f_qsws_liq  * ( qv_1 - q_s               &
                                     + dq_s_dt * t_surface(j,i) - dq_s_dt       &
                                     * t_surface_p(j,i) )
              ENDIF
-
 !
 !--          Calculate the true surface resistance
-             IF ( qsws_eb(j,i) .EQ. 0.0_wp )  THEN
+             IF ( qsws_eb(j,i) == 0.0_wp )  THEN
                 r_s(j,i) = 1.0E10_wp
              ELSE
-                r_s(j,i) = - rho_lv * ( q_p(k+1,j,i) - q_s + dq_s_dt           &
+                r_s(j,i) = - rho_lv * ( qv_1 - q_s + dq_s_dt                   &
                            * t_surface(j,i) - dq_s_dt * t_surface_p(j,i) )     &
                            / qsws_eb(j,i) - r_a(j,i)
@@ -1228,11 +1293,11 @@
 !--                Add precipitation to liquid water reservoir, if possible.
 !--                Otherwise, add the water to bare soil fraction.
-                   IF ( m_liq_eb(j,i) .EQ. m_liq_eb_max )  THEN
+                   IF ( m_liq_eb(j,i) /= m_liq_eb_max )  THEN
                       qsws_liq_eb(j,i) = qsws_liq_eb(j,i)                      &
-                                       + c_veg(j,i) * precipitation_rate(j,i)  &
+                                       + c_veg(j,i) * prr(k,j,i) * hyrho(k)    &
                                        * 0.001_wp * rho_l * l_v
                    ELSE
                       qsws_soil_eb(j,i) = qsws_soil_eb(j,i)                    &
-                                        + c_veg(j,i) * precipitation_rate(j,i) &
+                                        + c_veg(j,i) * prr(k,j,i) * hyrho(k)   &
                                         * 0.001_wp * rho_l * l_v
                    ENDIF
@@ -1241,10 +1306,12 @@
 !--                coverage.
                    qsws_soil_eb(j,i) = qsws_soil_eb(j,i) * (1.0_wp             &
-                                       - c_veg(j,i)) * precipitation_rate(j,i) &
+                                       - c_veg(j,i)) * prr(k,j,i) * hyrho(k)   &
                                        * 0.001_wp * rho_l * l_v
                 ENDIF
+
 !
 !--             If the air is saturated, check the reservoir water level
-                IF ( q_s .LE. q_p(k+1,j,i))  THEN
+                IF ( qsws_eb(j,i) < 0.0_wp )  THEN
+
 !
 !--                Check if reservoir is full (avoid values > m_liq_eb_max)
@@ -1252,5 +1319,5 @@
 !--                case qsws_veg_eb is zero anyway (because c_liq = 1),       
 !--                so that tend is zero and no further check is needed
-                   IF ( m_liq_eb(j,i) .EQ. m_liq_eb_max )  THEN
+                   IF ( m_liq_eb(j,i) == m_liq_eb_max )  THEN
                       qsws_soil_eb(j,i) = qsws_soil_eb(j,i)                    &
                                            + qsws_liq_eb(j,i)
@@ -1262,5 +1329,5 @@
 !--                let the water enter the liquid water reservoir as dew on the
 !--                plant
-                   IF ( qsws_veg_eb(j,i) .LT. 0.0_wp )  THEN
+                   IF ( qsws_veg_eb(j,i) < 0.0_wp )  THEN
                       qsws_liq_eb(j,i) = qsws_liq_eb(j,i) + qsws_veg_eb(j,i)
                       qsws_veg_eb(j,i) = 0.0_wp
@@ -1301,4 +1368,21 @@
        ENDDO
 
+#if defined( __parallel )
+!
+!--    Make a logical OR for all processes. Force radiation call if at
+!--    least one processor
+       IF ( intermediate_timestep_count == intermediate_timestep_count_max-1 )&
+       THEN
+
+          IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
+          CALL MPI_ALLREDUCE( force_radiation_call_l, force_radiation_call,    &
+                              1, MPI_LOGICAL, MPI_LOR, comm2d, ierr )
+#else
+          force_radiation_call = force_radiation_call_l
+#endif
+          force_radiation_call_l = .FALSE.
+       ENDIF
+
+
     END SUBROUTINE lsm_energy_balance
 
@@ -1322,10 +1406,10 @@
 
        REAL(wp), DIMENSION(nzb_soil:nzt_soil) :: gamma_temp,  & !< temp. gamma
-                                               lambda_temp, & !< temp. lambda
-                                               tend           !< tendency
-
-       DO i = nxlg, nxrg    
-          DO j = nysg, nyng
-             DO k = nzb_soil, nzt_soil
+                                                 lambda_temp, & !< temp. lambda
+                                                 tend           !< tendency
+
+       DO  i = nxlg, nxrg
+          DO  j = nysg, nyng
+             DO  k = nzb_soil, nzt_soil
 !
 !--             Calculate volumetric heat capacity of the soil, taking into 
@@ -1335,8 +1419,12 @@
 
 !
-!--             Calculate soil heat conductivity at the center of the soil 
+!--             Calculate soil heat conductivity at the center of the soil
 !--             layers
+                lambda_h_sat = lambda_h_sm ** (1.0_wp - m_sat(j,i)) *          &
+                               lambda_h_water ** m_soil(k,j,i)
+
                 ke = 1.0_wp + LOG10(MAX(0.1_wp,m_soil(k,j,i) / m_sat(j,i)))
-                lambda_temp(k) = ke * (lambda_h_sat(j,i) + lambda_h_dry) +     &
+
+                lambda_temp(k) = ke * (lambda_h_sat - lambda_h_dry) +          &
                                  lambda_h_dry
 
@@ -1346,10 +1434,6 @@
 !--          Calculate soil heat conductivity (lambda_h) at the _stag level 
 !--          using linear interpolation
-             DO k = nzb_soil, nzt_soil-1
-                  
-                lambda_h(k,j,i) = lambda_temp(k) +                             &
-                                  ( lambda_temp(k+1) - lambda_temp(k) )        &
-                                  * 0.5 * dz_soil_stag(k) * ddz_soil(k+1)
-
+             DO  k = nzb_soil, nzt_soil-1
+                lambda_h(k,j,i) = ( lambda_temp(k+1) + lambda_temp(k) ) * 0.5_wp
              ENDDO
              lambda_h(nzt_soil,j,i) = lambda_temp(nzt_soil)
@@ -1358,17 +1442,20 @@
 !--          Prognostic equation for soil temperature t_soil
              tend(:) = 0.0_wp
-             tend(0) = (1.0_wp/rho_c_total(nzb_soil,j,i)) *                    &
+             tend(nzb_soil) = (1.0_wp/rho_c_total(nzb_soil,j,i)) *             &
                        ( lambda_h(nzb_soil,j,i) * ( t_soil(nzb_soil+1,j,i)     &
-                         - t_soil(nzb_soil,j,i) ) * ddz_soil(nzb_soil)         &
+                         - t_soil(nzb_soil,j,i) ) * ddz_soil(nzb_soil+1)       &
                          + ghf_eb(j,i) ) * ddz_soil_stag(nzb_soil)
 
-             DO  k = 1, nzt_soil
+
+
+
+             DO  k = nzb_soil+1, nzt_soil
                 tend(k) = (1.0_wp/rho_c_total(k,j,i))                          &
                           * (   lambda_h(k,j,i)                                &
                               * ( t_soil(k+1,j,i) - t_soil(k,j,i) )            &
-                              * ddz_soil(k)                                    &
+                              * ddz_soil(k+1)                                  &
                               - lambda_h(k-1,j,i)                              &
                               * ( t_soil(k,j,i) - t_soil(k-1,j,i) )            &
-                              * ddz_soil(k-1)                                  &
+                              * ddz_soil(k)                                    &
                             ) * ddz_soil_stag(k)
              ENDDO
@@ -1396,5 +1483,5 @@
 
 
-             DO k = nzb_soil, nzt_soil
+             DO  k = nzb_soil, nzt_soil
 
 !
@@ -1414,4 +1501,5 @@
                               / (n_vg(j,i)-1.0_wp)) - 1.0_wp                   &
                           )**(1.0_wp/n_vg(j,i)) / alpha_vg(j,i)
+
 
                    gamma_temp(k) = gamma_w_sat(j,i) * ( ( (1.0_wp +            &
@@ -1438,12 +1526,10 @@
 !--             using linear interpolation. To do: replace this with
 !--             ECMWF-IFS Eq. 8.81
-                DO k = nzb_soil, nzt_soil-1
+                DO  k = nzb_soil, nzt_soil-1
                      
-                   lambda_w(k,j,i) = lambda_temp(k) +                          &
-                                     ( lambda_temp(k+1) - lambda_temp(k) )     &
-                                     * 0.5_wp * dz_soil_stag(k) * ddz_soil(k+1)
-                   gamma_w(k,j,i)  = gamma_temp(k) +                           &
-                                     ( gamma_temp(k+1) - gamma_temp(k) )       &
-                                     * 0.5_wp * dz_soil_stag(k) * ddz_soil(k+1)                 
+                   lambda_w(k,j,i) = ( lambda_temp(k+1) + lambda_temp(k) )     &
+                                     * 0.5_wp
+                   gamma_w(k,j,i)  = ( gamma_temp(k+1) + gamma_temp(k) )       &
+                                     * 0.5_wp
 
                 ENDDO
@@ -1457,5 +1543,5 @@
                    gamma_w(nzt_soil,j,i) = 0.0_wp
                 ELSE
-                   gamma_w(nzt_soil,j,i) = lambda_temp(nzt_soil)
+                   gamma_w(nzt_soil,j,i) = gamma_temp(nzt_soil)
                 ENDIF     
 
@@ -1470,23 +1556,22 @@
 
 !
-!--             Calculate the root extraction (ECMWF 7.69, modified so that the
-!--             sum of root_extr = 1). The energy balance solver guarantees a 
-!--             positive transpiration, so that there is no need for an 
-!--             additional check.
-
-                m_total = 0.0_wp
-                DO k = nzb_soil, nzt_soil
-                    IF ( m_soil(k,j,i) .GT. m_wilt(j,i) )  THEN
+!--             Calculate the root extraction (ECMWF 7.69, the sum of root_extr
+!--             = 1). The energy balance solver guarantees a positive
+!--             transpiration, so that there is no need for an additional check.
+                DO  k = nzb_soil, nzt_soil
+                    IF ( m_soil(k,j,i) > m_wilt(j,i) )  THEN
                        m_total = m_total + root_fr(k,j,i) * m_soil(k,j,i)
                     ENDIF
                 ENDDO  
 
-                DO k = nzb_soil, nzt_soil 
-                   IF ( m_soil(k,j,i) .GT. m_wilt(j,i) )  THEN
-                      root_extr(k) = root_fr(k,j,i) * m_soil(k,j,i) / m_total
-                   ELSE
-                      root_extr(k) = 0.0_wp
-                   ENDIF
-                ENDDO
+                IF ( m_total > 0.0_wp )  THEN
+                   DO  k = nzb_soil, nzt_soil
+                      IF ( m_soil(k,j,i) > m_wilt(j,i) )  THEN
+                         root_extr(k) = root_fr(k,j,i) * m_soil(k,j,i) / m_total
+                      ELSE
+                         root_extr(k) = 0.0_wp
+                      ENDIF
+                   ENDDO
+                ENDIF
 
 !
@@ -1495,5 +1580,5 @@
                 tend(nzb_soil) = ( lambda_w(nzb_soil,j,i) * (                  &
                             m_soil(nzb_soil+1,j,i) - m_soil(nzb_soil,j,i) )    &
-                            * ddz_soil(nzb_soil) - gamma_w(nzb_soil,j,i) - (   &
+                            * ddz_soil(nzb_soil+1) - gamma_w(nzb_soil,j,i) - ( &
                             root_extr(nzb_soil) * qsws_veg_eb(j,i)             &
                             + qsws_soil_eb(j,i) ) * drho_l_lv )                &
@@ -1502,9 +1587,9 @@
                 DO  k = nzb_soil+1, nzt_soil-1
                    tend(k) = ( lambda_w(k,j,i) * ( m_soil(k+1,j,i)             &
-                               - m_soil(k,j,i) ) * ddz_soil(k) - gamma_w(k,j,i)&
-                               - lambda_w(k-1,j,i) * (m_soil(k,j,i) -          &
-                               m_soil(k-1,j,i)) * ddz_soil(k-1)                &
-                               + gamma_w(k-1,j,i) - (root_extr(k)              &
-                               * qsws_veg_eb(j,i) * drho_l_lv)                 &
+                             - m_soil(k,j,i) ) * ddz_soil(k+1) - gamma_w(k,j,i)&
+                             - lambda_w(k-1,j,i) * (m_soil(k,j,i) -            &
+                             m_soil(k-1,j,i)) * ddz_soil(k)                    &
+                             + gamma_w(k-1,j,i) - (root_extr(k)                &
+                             * qsws_veg_eb(j,i) * drho_l_lv)                   &
                              ) * ddz_soil_stag(k)
 
@@ -1514,5 +1599,5 @@
                                         * (m_soil(nzt_soil,j,i)                &
                                         - m_soil(nzt_soil-1,j,i))              &
-                                        * ddz_soil(nzt_soil-1)                 &
+                                        * ddz_soil(nzt_soil)                   &
                                         + gamma_w(nzt_soil-1,j,i) - (          &
                                           root_extr(nzt_soil)                  &
@@ -1573,13 +1658,12 @@
        REAL(wp) :: resistance    !< aerodynamic and soil resistance term
 
-       DO i = nxlg, nxrg    
-          DO j = nysg, nyng
+       DO  i = nxlg, nxrg    
+          DO  j = nysg, nyng
              k = nzb_s_inner(j,i)
 
 !
 !--          Calculate water vapour pressure at saturation
-             e_s = 0.01_wp * 610.78_wp * EXP( 17.269_wp * ( t_surface(j,i)     &
-                                              - 273.16_wp ) / ( t_surface(j,i) &
-                                              - 35.86_wp ) )
+             e_s = 0.01_wp * 610.78_wp * EXP( 17.269_wp * ( t_surface_p(j,i)   &
+                   - 273.16_wp ) / ( t_surface_p(j,i) - 35.86_wp ) )
 
 !
@@ -1587,11 +1671,19 @@
              q_s = 0.622_wp * e_s / surface_pressure
 
-
              resistance = r_a(j,i) / (r_a(j,i) + r_s(j,i))
 
 !
 !--          Calculate specific humidity at surface
-             q_p(k,j,i) = resistance * q_s + (1.0_wp - resistance)             &
-                          * q_p(k+1,j,i)
+             IF ( cloud_physics )  THEN
+                q(k,j,i) = resistance * q_s + (1.0_wp - resistance)            &
+                             * ( q(k+1,j,i) - ql(k+1,j,i) )
+             ELSE
+                q(k,j,i) = resistance * q_s + (1.0_wp - resistance)            &
+                             * q(k+1,j,i)
+             ENDIF
+
+!
+!--          Update virtual potential temperature
+             vpt(k,j,i) = pt(k,j,i) * ( 1.0_wp + 0.61_wp * q(k,j,i) )
 
           ENDDO
Index: palm/trunk/SOURCE/lpm_advec.f90
===================================================================
--- palm/trunk/SOURCE/lpm_advec.f90	(revision 1686)
+++ palm/trunk/SOURCE/lpm_advec.f90	(revision 1691)
@@ -14,10 +14,10 @@
 ! PALM. If not, see <http://www.gnu.org/licenses/>.
 !
-! Copyright 1997-2014 Leibniz Universitaet Hannover
+! Copyright 1997-2015 Leibniz Universitaet Hannover
 !--------------------------------------------------------------------------------!
 !
 ! Current revisions:
 ! ------------------
-!
+! Renamed prandtl_layer to constant_flux_layer.
 !
 ! Former revisions:
@@ -83,6 +83,6 @@
 
     USE control_parameters,                                                    &
-        ONLY:  atmos_ocean_sign, cloud_droplets, dt_3d, dt_3d_reached_l, dz,   &
-               g, kappa, molecular_viscosity, prandtl_layer, topography,       &
+        ONLY:  atmos_ocean_sign, cloud_droplets, constant_flux_layer, dt_3d,   &
+               dt_3d_reached_l, dz, g, kappa, molecular_viscosity, topography, &
                u_gtrans, v_gtrans, simulated_time
 
@@ -224,5 +224,5 @@
 !--       First, check if particle is located below first vertical grid level 
 !--       (Prandtl-layer height)
-          IF ( prandtl_layer  .AND.  particles(n)%z < z_p )  THEN
+          IF ( constant_flux_layer  .AND.  particles(n)%z < z_p )  THEN
 !
 !--          Resolved-scale horizontal particle velocity is zero below z0. 
@@ -294,5 +294,5 @@
        DO  n = start_index(nb), end_index(nb)
 
-          IF ( prandtl_layer  .AND.  particles(n)%z < z_p )  THEN
+          IF ( constant_flux_layer  .AND.  particles(n)%z < z_p )  THEN
 
              IF ( particles(n)%z < z0_av_global )  THEN
Index: palm/trunk/SOURCE/lpm_exchange_horiz.f90
===================================================================
--- palm/trunk/SOURCE/lpm_exchange_horiz.f90	(revision 1686)
+++ palm/trunk/SOURCE/lpm_exchange_horiz.f90	(revision 1691)
@@ -14,10 +14,10 @@
 ! PALM. If not, see <http://www.gnu.org/licenses/>.
 !
-! Copyright 1997-2014 Leibniz Universitaet Hannover
+! Copyright 1997-2015 Leibniz Universitaet Hannover
 !--------------------------------------------------------------------------------!
 !
 ! Current revisions:
 ! ------------------
-! 
+! Formatting corrections.
 !
 ! Former revisions:
@@ -1208,5 +1208,5 @@
              ENDDO
 
-             IF ( n_start .GE. 0 )  THEN
+             IF ( n_start >= 0 )  THEN
                 pack_done = .FALSE.
                 DO  n = n_start, np_old_cell
Index: palm/trunk/SOURCE/lpm_init.f90
===================================================================
--- palm/trunk/SOURCE/lpm_init.f90	(revision 1686)
+++ palm/trunk/SOURCE/lpm_init.f90	(revision 1691)
@@ -14,10 +14,10 @@
 ! PALM. If not, see <http://www.gnu.org/licenses/>.
 !
-! Copyright 1997-2014 Leibniz Universitaet Hannover
+! Copyright 1997-2015 Leibniz Universitaet Hannover
 !--------------------------------------------------------------------------------!
 !
 ! Current revisions:
 ! -----------------
-! 
+! Renamed prandtl_layer to constant_flux_layer.
 !
 ! Former revisions:
@@ -100,7 +100,7 @@
 
     USE control_parameters,                                                    &
-        ONLY:  cloud_droplets, current_timestep_number, dz,                    &
-               initializing_actions, message_string, netcdf_data_format,       &
-               ocean, prandtl_layer, simulated_time
+        ONLY:  cloud_droplets, constant_flux_layer, current_timestep_number,   &
+               dz, initializing_actions, message_string, netcdf_data_format,   &
+               ocean, simulated_time
 
     USE dvrp_variables,                                                        &
@@ -295,5 +295,5 @@
 !-- To obtain exact height levels of particles, linear interpolation is applied
 !-- (see lpm_advec.f90).
-    IF ( prandtl_layer )  THEN
+    IF ( constant_flux_layer )  THEN
        
        ALLOCATE ( log_z_z0(0:number_of_sublayers) ) 
Index: palm/trunk/SOURCE/microphysics.f90
===================================================================
--- palm/trunk/SOURCE/microphysics.f90	(revision 1686)
+++ palm/trunk/SOURCE/microphysics.f90	(revision 1691)
@@ -14,10 +14,11 @@
 ! PALM. If not, see <http://www.gnu.org/licenses/>.
 !
-! Copyright 1997-2014 Leibniz Universitaet Hannover
+! Copyright 1997-2015 Leibniz Universitaet Hannover
 !--------------------------------------------------------------------------------!
 !
 ! Current revisions:
 ! ------------------
-! 
+! Added new routine calc_precipitation_amount. The routine now allows to account
+! for precipitation due to sedimenation of cloud (fog) droplets
 ! 
 ! Former revisions:
@@ -130,4 +131,10 @@
     END INTERFACE sedimentation_rain
 
+    INTERFACE calc_precipitation_amount
+       MODULE PROCEDURE calc_precipitation_amount
+       MODULE PROCEDURE calc_precipitation_amount_ij
+    END INTERFACE calc_precipitation_amount
+
+
  CONTAINS
 
@@ -208,4 +215,8 @@
 
        IF ( drizzle )  CALL sedimentation_cloud
+
+       IF ( precipitation )  THEN
+          CALL calc_precipitation_amount
+       ENDIF
 
     END SUBROUTINE microphysics_control
@@ -726,5 +737,5 @@
 
        USE cloud_parameters,                                                   &
-           ONLY:  eps_sb, hyrho, l_d_cp, nc_const, pt_d_t, sed_qc_const
+           ONLY:  eps_sb, hyrho, l_d_cp, nc_const, prr, pt_d_t, sed_qc_const
 
        USE constants,                                                          &
@@ -732,5 +743,6 @@
 
        USE control_parameters,                                                 &
-           ONLY:  dt_do2d_xy, dt_micro, intermediate_timestep_count
+           ONLY:  call_microphysics_at_all_substeps, dt_micro,                 &
+                  intermediate_timestep_count, precipitation
 
        USE cpulog,                                                             &
@@ -741,5 +753,9 @@
 
        USE kinds
-       
+
+       USE statistics,                                                         &
+           ONLY:  weight_substep
+    
+
        IMPLICIT NONE
 
@@ -777,4 +793,15 @@
                                         pt_d_t(k) * dt_micro
 
+!
+!--             Compute the precipitation rate due to cloud (fog) droplets
+                IF ( precipitation )  THEN
+                   IF ( call_microphysics_at_all_substeps )  THEN
+                      prr(k,j,i) = prr(k,j,i) +  sed_qc(k) / hyrho(k)          &
+                                   * weight_substep(intermediate_timestep_count)
+                   ELSE
+                      prr(k,j,i) = prr(k,j,i) + sed_qc(k) / hyrho(k)
+                   ENDIF
+                ENDIF
+
              ENDDO
           ENDDO
@@ -799,13 +826,9 @@
        USE cloud_parameters,                                                   &
            ONLY:  a_term, b_term, c_term, cof, dpirho_l, eps_sb, hyrho,        &
-                  limiter_sedimentation, l_d_cp, precipitation_amount, prr,    &
-                  pt_d_t, stp
+                  limiter_sedimentation, l_d_cp, prr,  pt_d_t, stp
 
        USE control_parameters,                                                 &
-           ONLY:  call_microphysics_at_all_substeps, dt_do2d_xy, dt_micro,     &
-                  dt_3d, intermediate_timestep_count,                          &
-                  intermediate_timestep_count_max,                             &
-                  precipitation_amount_interval, time_do2d_xy
-
+           ONLY:  call_microphysics_at_all_substeps, dt_micro,                 &
+                  intermediate_timestep_count
        USE cpulog,                                                             &
            ONLY:  cpu_log, log_point_s
@@ -1005,8 +1028,8 @@
 !--             Compute the rain rate
                 IF ( call_microphysics_at_all_substeps )  THEN
-                   prr(k,j,i) = prr(k,j,i) + sed_qr(k) / hyrho(k) *            &
-                                weight_substep(intermediate_timestep_count)
+                   prr(k,j,i) = prr(k,j,i) + sed_qr(k) / hyrho(k)             &
+                                * weight_substep(intermediate_timestep_count)
                 ELSE
-                   prr(k,j,i) = sed_qr(k) / hyrho(k)
+                   prr(k,j,i) = prr(k,j,i) + sed_qr(k) / hyrho(k)
                 ENDIF
 
@@ -1015,21 +1038,53 @@
        ENDDO
 
-!
-!--    Precipitation amount
-       IF ( intermediate_timestep_count == intermediate_timestep_count_max     &
-            .AND.  ( dt_do2d_xy - time_do2d_xy ) <                             &
-                   precipitation_amount_interval )  THEN
+       CALL cpu_log( log_point_s(60), 'sed_rain', 'stop' )
+
+    END SUBROUTINE sedimentation_rain
+
+
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Computation of the precipitation amount due to gravitational settling of
+!> rain and cloud (fog) droplets
+!------------------------------------------------------------------------------!
+    SUBROUTINE calc_precipitation_amount
+
+       USE cloud_parameters,                                                   &
+           ONLY:  hyrho, precipitation_amount, prr
+
+       USE control_parameters,                                                 &
+           ONLY:  call_microphysics_at_all_substeps, dt_do2d_xy, dt_3d,        &
+                  intermediate_timestep_count, intermediate_timestep_count_max,&
+                  precipitation_amount_interval, time_do2d_xy
+
+       USE indices,                                                            &
+           ONLY:  nxl, nxr, nys, nyn, nzb_s_inner
+
+       USE kinds
+
+       IMPLICIT NONE
+
+       INTEGER(iwp) ::  i                          !:
+       INTEGER(iwp) ::  j                          !:
+
+
+       IF ( ( dt_do2d_xy - time_do2d_xy ) < precipitation_amount_interval .AND.&
+            ( .NOT. call_microphysics_at_all_substeps .OR.                     &
+            intermediate_timestep_count == intermediate_timestep_count_max ) ) &
+       THEN
+
           DO  i = nxl, nxr
              DO  j = nys, nyn
+
                 precipitation_amount(j,i) = precipitation_amount(j,i) +        &
                                             prr(nzb_s_inner(j,i)+1,j,i) *      &
                                             hyrho(nzb_s_inner(j,i)+1) * dt_3d
+
              ENDDO
           ENDDO
        ENDIF
 
-       CALL cpu_log( log_point_s(60), 'sed_rain', 'stop' )
-
-    END SUBROUTINE sedimentation_rain
+    END SUBROUTINE calc_precipitation_amount
 
 
@@ -1121,4 +1176,8 @@
 
        IF ( drizzle )  CALL sedimentation_cloud( i,j )
+
+       IF ( precipitation )  THEN
+          CALL calc_precipitation_amount( i,j )
+       ENDIF
 
 !
@@ -1591,5 +1650,5 @@
 
        USE cloud_parameters,                                                   &
-           ONLY:  eps_sb, hyrho, l_d_cp, pt_d_t, sed_qc_const
+           ONLY:  eps_sb, hyrho, l_d_cp, prr, pt_d_t, sed_qc_const
 
        USE constants,                                                          &
@@ -1597,5 +1656,6 @@
 
        USE control_parameters,                                                 &
-           ONLY:  dt_do2d_xy, dt_micro, intermediate_timestep_count
+           ONLY:  call_microphysics_at_all_substeps, dt_do2d_xy, dt_micro,     &
+                  intermediate_timestep_count, precipitation
 
        USE indices,                                                            &
@@ -1604,4 +1664,7 @@
        USE kinds
        
+       USE statistics,                                                         &
+           ONLY:  weight_substep
+
        IMPLICIT NONE
 
@@ -1632,4 +1695,15 @@
           pt_1d(k) = pt_1d(k) - ( sed_qc(k+1) - sed_qc(k) ) * ddzu(k+1) /      &
                                 hyrho(k) * l_d_cp * pt_d_t(k) * dt_micro
+
+!
+!--       Compute the precipitation rate of cloud (fog) droplets
+          IF ( precipitation )  THEN
+             IF ( call_microphysics_at_all_substeps )  THEN
+                prr(k,j,i) = prr(k,j,i) + sed_qc(k) / hyrho(k) *               &
+                             weight_substep(intermediate_timestep_count)
+             ELSE
+                prr(k,j,i) = prr(k,j,i) +  sed_qc(k) / hyrho(k)
+             ENDIF
+          ENDIF
 
        ENDDO
@@ -1837,17 +1911,47 @@
 !--       Compute the rain rate
           IF ( call_microphysics_at_all_substeps )  THEN
-             prr(k,j,i) = prr(k,j,i) + sed_qr(k) / hyrho(k) *                  &
-                          weight_substep(intermediate_timestep_count)
+             prr(k,j,i) = prr(k,j,i) + sed_qr(k) / hyrho(k)                    &
+                          * weight_substep(intermediate_timestep_count)
           ELSE
-             prr(k,j,i) = sed_qr(k) / hyrho(k)
+             prr(k,j,i) = prr(k,j,i) + sed_qr(k) / hyrho(k)
           ENDIF
 
        ENDDO
 
-!
-!--    Precipitation amount
-       IF ( intermediate_timestep_count == intermediate_timestep_count_max     &
-            .AND.  ( dt_do2d_xy - time_do2d_xy ) <                             &
-                   precipitation_amount_interval )  THEN
+    END SUBROUTINE sedimentation_rain_ij
+
+
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> This subroutine computes the precipitation amount due to gravitational
+!> settling of rain and cloud (fog) droplets
+!------------------------------------------------------------------------------!
+    SUBROUTINE calc_precipitation_amount_ij( i, j )
+
+       USE cloud_parameters,                                                   &
+           ONLY:  hyrho, precipitation_amount, prr
+
+       USE control_parameters,                                                 &
+           ONLY:  call_microphysics_at_all_substeps, dt_do2d_xy, dt_3d,        &
+                  intermediate_timestep_count, intermediate_timestep_count_max,&
+                  precipitation_amount_interval,         &
+                  time_do2d_xy
+
+       USE indices,                                                            &
+           ONLY:  nzb_s_inner
+
+       USE kinds
+
+       IMPLICIT NONE
+
+       INTEGER(iwp) ::  i                          !:
+       INTEGER(iwp) ::  j                          !:
+
+
+       IF ( ( dt_do2d_xy - time_do2d_xy ) < precipitation_amount_interval .AND.&
+            ( .NOT. call_microphysics_at_all_substeps .OR.                     &
+            intermediate_timestep_count == intermediate_timestep_count_max ) ) &
+       THEN
 
           precipitation_amount(j,i) = precipitation_amount(j,i) +              &
@@ -1856,7 +1960,6 @@
        ENDIF
 
-    END SUBROUTINE sedimentation_rain_ij
-
-    
+    END SUBROUTINE calc_precipitation_amount_ij
+
 !------------------------------------------------------------------------------!
 ! Description:
Index: palm/trunk/SOURCE/modules.f90
===================================================================
--- palm/trunk/SOURCE/modules.f90	(revision 1686)
+++ palm/trunk/SOURCE/modules.f90	(revision 1691)
@@ -14,10 +14,13 @@
 ! PALM. If not, see <http://www.gnu.org/licenses/>.
 !
-! Copyright 1997-2014 Leibniz Universitaet Hannover
+! Copyright 1997-2015 Leibniz Universitaet Hannover
 !--------------------------------------------------------------------------------!
 !
 ! Current revisions:
 ! ------------------
-! 
+! Renamed Obukhov length. Added ol, removed rif. Increased number of profiles 
+! (pr_palm). Changed default values for dissipation_1d to 'detering' and 
+! (mixing_length_1d to 'blackadar'. Added most_method. rif_min and rif_max
+! renamed to zeta_min and zeta_max and new values assigned.
 ! 
 ! Former revisions:
@@ -300,4 +303,14 @@
 !
 !
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Definition of all variables
+!>
+!> @todo Add description for each variable
+!------------------------------------------------------------------------------!
+
+
+!------------------------------------------------------------------------------!
 ! Description:
 ! ------------
@@ -338,5 +351,7 @@
           flux_s_e, flux_s_nr, flux_s_pt, flux_s_q, flux_s_qr, flux_s_sa,      &
           flux_s_u, flux_s_v, flux_s_w, f1_mg, f2_mg, f3_mg,                   &
-          mean_inflow_profiles, nrs, nrsws, nrswst, ptnudge, pt_slope_ref,     &
+          mean_inflow_profiles, nrs, nrsws, nrswst,                            &
+          ol,                                                                  & !< Obukhov length
+          ptnudge, pt_slope_ref,                                               &
           qnudge, qs, qsws, qswst, qswst_remote, qrs, qrsws, qrswst, rif,      &
           saswsb, saswst, shf, tnudge, td_lsa_lpt, td_lsa_q, td_sub_lpt,       &
@@ -390,7 +405,13 @@
     USE kinds
 
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  lwp_av, precipitation_rate_av,   &
-                                          qsws_av, shf_av,ts_av, us_av, z0_av, &
-                                          z0h_av
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  lwp_av,                & !> Avg. liquid water path
+                                              precipitation_rate_av, & !> Avg. of precipitation rate
+                                              ol_av,                 & !> Avg. of Obukhov length
+                                              qsws_av,               & !> Avg. of surface moisture flux
+                                              shf_av,                & !> Avg. of surface heat flux
+                                              ts_av,                 & !> Avg. of characteristic temperature scale
+                                              us_av,                 & !> Avg. of friction velocity
+                                              z0_av,                 & !> Avg. of roughness length for momentum
+                                              z0h_av                   !> Avg. of roughness length for heat and moisture
 
     REAL(wp), DIMENSION(:,:,:), ALLOCATABLE, TARGET ::                         &
@@ -541,5 +562,7 @@
     CHARACTER (LEN=2)    ::  coupling_char = ''
     CHARACTER (LEN=5)    ::  write_binary = 'false'
-    CHARACTER (LEN=8)    ::  run_date, run_time
+    CHARACTER (LEN=8)    ::  most_method = 'lookup', & !< NAMELIST parameter defining method to be used to calculate Okukhov length, 
+                             run_date,               & !< 
+                             run_time                  !< 
     CHARACTER (LEN=9)    ::  simulated_time_chr
     CHARACTER (LEN=11)   ::  topography_grid_convention = ' '
@@ -563,7 +586,7 @@
                              coupling_mode = 'uncoupled', &
                              coupling_mode_remote = 'uncoupled', &
-                             dissipation_1d = 'as_in_3d_model', &
+                             dissipation_1d = 'detering', &
                              fft_method = 'system-specific', &
-                             mixing_length_1d = 'as_in_3d_model', &
+                             mixing_length_1d = 'blackadar', &
                              random_generator = 'numerical-recipes', &
                              reference_state = 'initial_profile', &
@@ -653,4 +676,5 @@
                 cloud_top_radiation = .FALSE., &
                 conserve_volume_flow = .FALSE., constant_diffusion = .FALSE., &
+                constant_flux_layer = .TRUE., &
                 constant_heatflux = .TRUE., constant_top_heatflux = .TRUE., &
                 constant_top_momentumflux = .FALSE., &
@@ -679,5 +703,4 @@
                 outflow_l = .FALSE., outflow_n = .FALSE., outflow_r = .FALSE., &
                 outflow_s = .FALSE., passive_scalar = .FALSE., &
-                prandtl_layer = .TRUE., &
                 precipitation = .FALSE., &
                 random_heatflux = .FALSE., recycling_yshift = .FALSE.,&
@@ -745,5 +768,5 @@
                  recycling_width = 9999999.9_wp, residual_limit = 1.0E-4_wp, &
                  restart_time = 9999999.9_wp, rho_reference, rho_surface, &
-                 rif_max = 1.0_wp, rif_min = -5.0_wp, roughness_length = 0.1_wp, &
+                 roughness_length = 0.1_wp, &
                  sa_surface = 35.0_wp, &
                  simulated_time = 0.0_wp, simulated_time_at_begin, sin_alpha_surface, &
@@ -768,4 +791,6 @@
                  vg_surface = 0.0_wp, vpt_reference = 9999999.9_wp, &
                  v_bulk = 0.0_wp, v_gtrans = 0.0_wp, wall_adjustment_factor = 1.8_wp, &
+                 zeta_max = 20.0_wp,    & !< Maximum value of zeta = z/L
+                 zeta_min = -9990.0_wp, & !< Minimum value of zeta = z/L
                  z_max_do2d = -1.0_wp, z0h_factor = 1.0_wp
 
@@ -1149,5 +1174,5 @@
              'wpt          ', 'pt(0)        ', 'pt(zp)       ',                &
              'w"u"0        ', 'w"v"0        ', 'w"q"0        ',                &
-             'mo_L         ', 'q*           ',                                 &
+             'ol           ', 'q*           ',                                 &
              ( 'unknown      ', i9 = 1, dots_max-23 ) /)
 
@@ -1429,5 +1454,5 @@
 
     CHARACTER (LEN=40) ::  region(0:9)
-    INTEGER(iwp) ::  pr_palm = 120, statistic_regions = 0
+    INTEGER(iwp) ::  pr_palm = 130, statistic_regions = 0
     INTEGER(iwp) ::  u_max_ijk(3) = -1, v_max_ijk(3) = -1, w_max_ijk(3) = -1
     LOGICAL ::  flow_statistics_called = .FALSE.
Index: palm/trunk/SOURCE/netcdf.f90
===================================================================
--- palm/trunk/SOURCE/netcdf.f90	(revision 1686)
+++ palm/trunk/SOURCE/netcdf.f90	(revision 1691)
@@ -14,10 +14,11 @@
 ! PALM. If not, see <http://www.gnu.org/licenses/>.
 !
-! Copyright 1997-2014 Leibniz Universitaet Hannover
+! Copyright 1997-2015 Leibniz Universitaet Hannover
 !--------------------------------------------------------------------------------!
 !
 ! Current revisions:
 ! ------------------
-! 
+! Added output of radiative heating rates for RRTMG. Corrected output of 
+! radiative fluxes
 ! 
 ! Former revisions:
@@ -116,24 +117,26 @@
 #if defined( __netcdf )
 
-    USE arrays_3d,                                                              &
+    USE arrays_3d,                                                             &
         ONLY:  zu, zw
 
-    USE constants,                                                              &
+    USE constants,                                                             &
         ONLY:  pi
 
-    USE control_parameters,                                                     &
-        ONLY:  averaging_interval, averaging_interval_pr, averaging_interval_sp,&
-        data_output_pr,  domask,  dopr_n,dopr_time_count, dopts_time_count,     &
-        dots_time_count, dosp_time_count, do2d, do2d_xz_time_count, do3d,       &
-        do2d_yz_time_count, mask_size, do2d_xy_time_count, do3d_time_count,     &
-        domask_time_count, mask_i_global, mask_j_global,mask_k_global,          &
-        message_string, mid, netcdf_data_format, netcdf_precision, ntdim_2d_xy, &
-        ntdim_2d_xz, ntdim_2d_yz, ntdim_3d, nz_do3d, prt_time_count,            &
-        run_description_header, section, simulated_time, topography
-
-    USE grid_variables,                                                         &
+    USE control_parameters,                                                    &
+        ONLY:  averaging_interval, averaging_interval_pr,                      &
+               averaging_interval_sp, data_output_pr,  domask,  dopr_n,        &
+               dopr_time_count, dopts_time_count, dots_time_count,             &
+               dosp_time_count, do2d, do2d_xz_time_count, do3d,                &
+               do2d_yz_time_count, mask_size, do2d_xy_time_count,              &
+               do3d_time_count, domask_time_count, mask_i_global,              &
+               mask_j_global, mask_k_global, message_string, mid,              &
+               netcdf_data_format, netcdf_precision, ntdim_2d_xy,              &
+               ntdim_2d_xz, ntdim_2d_yz, ntdim_3d, nz_do3d, prt_time_count,    &
+              run_description_header, section, simulated_time, topography
+
+    USE grid_variables,                                                        &
         ONLY:  dx, dy, zu_s_inner, zw_w_inner
 
-    USE indices,                                                                &
+    USE indices,                                                               &
         ONLY:  nx, ny, nz ,nzb, nzt
 
@@ -150,17 +153,19 @@
     USE pegrid
 
-    USE particle_attributes,                                                    &
+    USE particle_attributes,                                                   &
         ONLY:  maximum_number_of_particles, number_of_particle_groups
 
-    USE profil_parameter,                                                       &
-        ONLY:  crmax, cross_profiles, dopr_index,profile_columns, profile_rows
-
-    USE radiation_model_mod,                                                    &
-        ONLY:  rad_lw_in, rad_lw_out, rad_sw_in, rad_sw_out
-
-    USE spectrum,                                                               &
+    USE profil_parameter,                                                      &
+        ONLY:  crmax, cross_profiles, dopr_index, profile_columns, profile_rows
+
+    USE radiation_model_mod,                                                   &
+        ONLY:  rad_lw_in, rad_lw_out, rad_lw_cs_hr, rad_lw_hr,                 &
+               rad_sw_in, rad_sw_out, rad_sw_cs_hr, rad_sw_hr
+
+
+    USE spectrum,                                                              &
         ONLY:  comp_spectra_level, data_output_sp, spectra_direction
 
-    USE statistics,                                                             &
+    USE statistics,                                                            &
         ONLY:  hom, statistic_regions
 
@@ -531,8 +536,8 @@
 !
 !--             Most variables are defined on the scalar grid
-                CASE ( 'e', 'lpt', 'nr', 'p', 'pc', 'pr', 'prr', 'pt', 'q',&
-                       'qc', 'ql', 'ql_c', 'ql_v', 'ql_vp', 'qr', 'qv',    &
-                       'rho', 's', 'sa', 'vpt', 'rad_lw_in', 'rad_lw_out', &
-                       'rad_sw_in', 'rad_sw_out' )
+                CASE ( 'e', 'lpt', 'nr', 'p', 'pc', 'pr', 'prr', 'pt', 'q',    &
+                       'qc', 'ql', 'ql_c', 'ql_v', 'ql_vp', 'qr', 'qv',        &
+                       'rad_lw_cs_hr', 'rad_lw_hr', 'rad_sw_cs_hr',            &
+                       'rad_sw_hr', 'rho', 's', 'sa', 'vpt'  )
 
                    grid_x = 'x'
@@ -555,5 +560,6 @@
 !
 !--             w grid
-                CASE ( 'w' )
+                CASE ( 'rad_lw_in', 'rad_lw_out', 'rad_sw_in', 'rad_sw_out',   &
+                       'w' )
 
                    grid_x = 'x'
@@ -562,5 +568,5 @@
 !
 !--             soil grid
-                CASE ( 't_soil', 'm_soil' )
+                CASE ( 'm_soil', 't_soil' )
 
                    grid_x = 'x'
@@ -1112,8 +1118,8 @@
 !
 !--             Most variables are defined on the scalar grid
-                CASE ( 'e', 'lpt', 'nr', 'p', 'pc', 'pr', 'prr', 'pt', 'q',   &
-                       'qc', 'ql', 'ql_c', 'ql_v', 'ql_vp', 'qr', 'qv', 'rho',&
-                       's', 'sa', 'vpt' , 'rad_lw_in', 'rad_lw_out',          &
-                       'rad_sw_in', 'rad_sw_out' )
+                CASE ( 'e', 'lpt', 'nr', 'p', 'pc', 'pr', 'prr', 'pt', 'q',    &
+                       'qc', 'ql', 'ql_c', 'ql_v', 'ql_vp', 'qr', 'qv', 'rho', &
+                       's', 'sa', 'vpt' , 'rad_lw_cs_hr', 'rad_lw_hr',         &
+                       'rad_sw_cs_hr', 'rad_sw_hr' )
 
                    grid_x = 'x'
@@ -1136,5 +1142,6 @@
 !
 !--             w grid
-                CASE ( 'w' )
+                CASE ( 'rad_lw_in', 'rad_lw_out', 'rad_sw_in', 'rad_sw_out',   &
+                       'w' )
 
                    grid_x = 'x'
@@ -1143,5 +1150,5 @@
 !
 !--             soil grid
-                CASE ( 't_soil', 'm_soil' )
+                CASE ( 'm_soil', 't_soil' )
 
                    grid_x = 'x'
@@ -1765,9 +1772,10 @@
 !
 !--                   Most variables are defined on the zu grid
-                      CASE ( 'e_xy', 'lpt_xy', 'nr_xy', 'p_xy', 'pc_xy', 'pr_xy',&
-                             'prr_xy', 'pt_xy', 'q_xy', 'qc_xy', 'ql_xy',        &
-                             'ql_c_xy', 'ql_v_xy', 'ql_vp_xy', 'qr_xy', 'qv_xy', &
-                             'rho_xy', 's_xy', 'sa_xy', 'vpt_xy', 'rad_lw_in_xy',&
-                             'rad_lw_out_xy', 'rad_sw_in_xy', 'rad_sw_out_xy' )
+                      CASE ( 'e_xy', 'lpt_xy', 'nr_xy', 'p_xy', 'pc_xy',       &
+                             'pr_xy', 'prr_xy', 'pt_xy', 'q_xy', 'qc_xy',      &
+                             'ql_xy', 'ql_c_xy', 'ql_v_xy', 'ql_vp_xy',        &
+                             'qr_xy', 'qv_xy', 'rad_lw_cs_hr_xy',              &
+                             'rad_lw_hr_xy', 'rad_sw_cs_hr_xy', 'rad_sw_hr_xy',& 
+                             'rho_xy', 's_xy', 'sa_xy', 'vpt_xy' )
 
                          grid_x = 'x'
@@ -1790,5 +1798,6 @@
 !
 !--                   w grid
-                      CASE ( 'w_xy' )
+                      CASE ( 'rad_lw_in_xy', 'rad_lw_out_xy', 'rad_sw_in_xy',  &
+                             'rad_sw_out_xy' , 'w_xy' )
 
                          grid_x = 'x'
@@ -1797,5 +1806,5 @@
 !
 !--                   soil grid
-                      CASE ( 't_soil_xy', 'm_soil_xy' )
+                      CASE ( 'm_soil_xy', 't_soil_xy' )
                          grid_x = 'x'
                          grid_y = 'y'
@@ -2452,6 +2461,7 @@
                           'prr_xz', 'pt_xz', 'q_xz', 'qc_xz', 'ql_xz',         &
                           'ql_c_xz', 'ql_v_xz', 'ql_vp_xz', 'qr_xz', 'qv_xz',  &
-                          'rho_xz', 's_xz', 'sa_xz', 'vpt_xz' , 'rad_lw_in_xz',&
-                             'rad_lw_out_xz', 'rad_sw_in_xz', 'rad_sw_out_xz' )
+                          'rad_lw_cs_hr_xz', 'rad_lw_hr_xz',                   &
+                          'rad_sw_cs_hr_xz', 'rad_sw_hr_xz''rho_xz', 's_xz',   &
+                          'sa_xz', 'vpt_xz' )
 
                       grid_x = 'x'
@@ -2474,5 +2484,6 @@
 !
 !--                w grid
-                   CASE ( 'w_xz' )
+                   CASE ( 'rad_lw_in_xz', 'rad_lw_out_xz', 'rad_sw_in_xz',     &
+                          'rad_sw_out_xz', 'w_xz' )
 
                       grid_x = 'x'
@@ -2482,5 +2493,5 @@
 !
 !--                soil grid
-                   CASE ( 't_soil_xz', 'm_soil_xz' )
+                   CASE ( 'm_soil_xz', 't_soil_xz' )
 
                       grid_x = 'x'
@@ -3126,9 +3137,10 @@
 !
 !--                Most variables are defined on the zu grid
-                   CASE ( 'e_yz', 'lpt_yz', 'nr_yz', 'p_yz', 'pc_yz', 'pr_yz',&
-                          'prr_yz', 'pt_yz', 'q_yz', 'qc_yz', 'ql_yz',        &
-                          'ql_c_yz', 'ql_v_yz', 'ql_vp_yz', 'qr_yz', 'qv_yz', &
-                          'rho_yz', 's_yz', 'sa_yz', 'vpt_yz', 'rad_lw_in_yz',&
-                             'rad_lw_out_yz', 'rad_sw_in_yz', 'rad_sw_out_yz' )
+                   CASE ( 'e_yz', 'lpt_yz', 'nr_yz', 'p_yz', 'pc_yz', 'pr_yz', &
+                          'prr_yz', 'pt_yz', 'q_yz', 'qc_yz', 'ql_yz',         &
+                          'ql_c_yz', 'ql_v_yz', 'ql_vp_yz', 'qr_yz', 'qv_yz',  &
+                          'rad_lw_cs_hr_yz', 'rad_lw_hr_yz',                   &
+                          'rad_sw_cs_hr_yz', 'rad_sw_hr_yz''rho_yz', 's_yz',   &
+                          'sa_yz', 'vpt_yz' )
 
                       grid_x = 'x'
@@ -3151,5 +3163,6 @@
 !
 !--                w grid
-                   CASE ( 'w_yz' )
+                   CASE ( 'rad_lw_in_yz', 'rad_lw_out_yz', 'rad_sw_in_yz',     &
+                          'rad_sw_out_yz', 'w_yz' )
 
                       grid_x = 'x'
@@ -3158,5 +3171,5 @@
 !
 !--                soil grid
-                   CASE ( 't_soil_yz', 'm_soil_yz' )
+                   CASE ( 'm_soil_yz', 't_soil_yz' )
 
                       grid_x = 'x'
Index: palm/trunk/SOURCE/package_parin.f90
===================================================================
--- palm/trunk/SOURCE/package_parin.f90	(revision 1686)
+++ palm/trunk/SOURCE/package_parin.f90	(revision 1691)
@@ -14,10 +14,10 @@
 ! PALM. If not, see <http://www.gnu.org/licenses/>.
 !
-! Copyright 1997-2014 Leibniz Universitaet Hannover
+! Copyright 1997-2015 Leibniz Universitaet Hannover
 !--------------------------------------------------------------------------------!
 !
 ! Current revisions:
 ! -----------------
-! 
+! Added skip_time_do_lsm, skip_time_do_radiation, and emissivity
 ! 
 ! Former revisions:
@@ -92,4 +92,7 @@
 !> This subroutine reads from the NAMELIST file variables controling model
 !> software packages which are used optionally in the run.
+!>
+!> @todo Perform all actions in the respective submodules and remove 
+!>       package_parin
 !------------------------------------------------------------------------------!
  SUBROUTINE package_parin
@@ -117,12 +120,12 @@
     USE land_surface_model_mod,                                                &
         ONLY: alpha_vangenuchten, c_surface, canopy_resistance_coefficient,    &
-              conserve_water_content, dewfall, f_shortwave_incoming,           &
-              hydraulic_conductivity, lambda_surface_stable,                   &
-              lambda_surface_unstable,                                         &
-              leaf_area_index, land_surface, l_vangenuchten,                   &
-              min_canopy_resistance, min_soil_resistance, field_capacity,      &
-              residual_moisture, saturation_moisture, wilting_point,           &
-              n_vangenuchten, root_fraction, soil_moisture, soil_temperature,  &
-              soil_type, vegetation_coverage, veg_type, z0_eb, z0h_eb, zs
+              conserve_water_content, dewfall, field_capacity,                 &
+              f_shortwave_incoming, hydraulic_conductivity,                    &
+              lambda_surface_stable, lambda_surface_unstable, leaf_area_index, &
+              land_surface, l_vangenuchten, min_canopy_resistance,             &
+              min_soil_resistance, n_vangenuchten, residual_moisture,          &
+              root_fraction, saturation_moisture, wilting_point,               &
+              skip_time_do_lsm, soil_moisture, soil_temperature, soil_type,    &
+              vegetation_coverage, veg_type, zs, z0_eb, z0h_eb
 
     USE kinds
@@ -152,7 +155,8 @@
     USE radiation_model_mod,                                                   &
         ONLY: albedo, albedo_type, albedo_lw_dif, albedo_lw_dir, albedo_sw_dif,&
-              albedo_sw_dir, day_init, constant_albedo, dt_radiation, lambda,  &
-              lw_radiation, net_radiation, radiation, radiation_scheme,        &
-              sw_radiation, time_utc_init
+              albedo_sw_dir, constant_albedo, day_init, dt_radiation,          &
+              emissivity, lambda, lw_radiation, net_radiation, radiation,      &
+              radiation_scheme, skip_time_do_radiation, sw_radiation,          &
+              time_utc_init
                 
 
@@ -200,6 +204,6 @@
                                   min_soil_resistance, n_vangenuchten,         &
                                   residual_moisture, root_fraction,            &
-                                  saturation_moisture, soil_moisture,          &
-                                  soil_temperature, soil_type,                 &
+                                  saturation_moisture, skip_time_do_lsm,       &
+                                  soil_moisture, soil_temperature, soil_type,  &
                                   vegetation_coverage, veg_type, wilting_point,& 
                                   zs, z0_eb, z0h_eb
@@ -234,5 +238,6 @@
                                   constant_albedo, day_init, dt_radiation,     &
                                   lambda, lw_radiation, net_radiation,         &
-                                  radiation_scheme, sw_radiation, time_utc_init 
+                                  radiation_scheme, skip_time_do_radiation,    &
+                                  sw_radiation, time_utc_init 
 
     NAMELIST /spectra_par/        averaging_interval_sp, comp_spectra_level,   &
Index: palm/trunk/SOURCE/parin.f90
===================================================================
--- palm/trunk/SOURCE/parin.f90	(revision 1686)
+++ palm/trunk/SOURCE/parin.f90	(revision 1691)
@@ -14,10 +14,10 @@
 ! PALM. If not, see <http://www.gnu.org/licenses/>.
 !
-! Copyright 1997-2014 Leibniz Universitaet Hannover
+! Copyright 1997-2015 Leibniz Universitaet Hannover
 !--------------------------------------------------------------------------------!
 !
 ! Current revisions:
 ! -----------------
-! 
+! Added parameter most_method. Renamed prandtl_layer to constant_flux_layer.
 ! 
 ! Former revisions:
@@ -185,5 +185,6 @@
                cloud_droplets, cloud_physics, cloud_scheme,                    &
                cloud_top_radiation, conserve_volume_flow,                      &
-               conserve_volume_flow_mode, coupling_start_time,                 &
+               conserve_volume_flow_mode, constant_flux_layer,                 &
+               coupling_start_time,                                            &
                create_disturbances, cycle_mg, data_output, data_output_masks,  &
                data_output_pr, data_output_2d_on_each_pe,                      &
@@ -210,8 +211,9 @@
                maximum_parallel_io_streams, max_pr_user, message_string,       &
                mg_cycles, mg_switch_to_pe0_level, mixing_length_1d,            &
-               momentum_advec, netcdf_data_format, netcdf_precision, neutral,  &
-               ngsrb, normalizing_region, nsor, nsor_ini, nudging, ocean,      &
+               momentum_advec, most_method, netcdf_data_format,                &
+               netcdf_precision, neutral, ngsrb, normalizing_region, nsor,     &
+               nsor_ini, nudging, ocean,                                       &
                omega, omega_sor, passive_scalar, phi, nz_do3d,                 &
-               prandtl_layer, prandtl_number, precipitation,                   &
+               prandtl_number, precipitation,                                  &
                precipitation_amount_interval, psolver, pt_damping_factor,      &
                pt_damping_width, pt_reference, pt_surface,                     &
@@ -224,5 +226,5 @@
                reference_state, residual_limit,                                &
                restart_time, return_addres, return_username,                   &
-               revision, rif_max, rif_min, roughness_length, runnr,            &
+               revision, roughness_length, runnr,                              &
                run_identifier, sa_surface, sa_vertical_gradient,               &
                sa_vertical_gradient_level, scalar_advec,                       &
@@ -246,5 +248,6 @@
                vg_vertical_gradient_level, v_bulk, v_profile,                  &
                wall_adjustment, wall_heatflux, wall_humidityflux,              &
-               wall_scalarflux, write_binary, z0h_factor, z_max_do2d
+               wall_scalarflux, write_binary, zeta_max, zeta_min, z0h_factor,  &
+               z_max_do2d
 
     USE cpulog,                                                                &
@@ -274,4 +277,5 @@
     USE statistics,                                                            &
         ONLY:  hom, hom_sum, pr_palm, region, statistic_regions
+
 
     IMPLICIT NONE
@@ -291,5 +295,6 @@
              cloud_physics, cloud_scheme, cloud_top_radiation,                 &
              collective_wait, conserve_volume_flow,                            &
-             conserve_volume_flow_mode, coupling_start_time,                   &
+             conserve_volume_flow_mode, constant_flux_layer,                   &
+             coupling_start_time,                                              &
              curvature_solution_effects, cycle_mg, damp_level_1d,              &
              dissipation_1d,                                                   &
@@ -306,7 +311,7 @@
              loop_optimization, masking_method, mg_cycles,                     &
              mg_switch_to_pe0_level, mixing_length_1d, momentum_advec,         &
-             nc_const, netcdf_precision, neutral, ngsrb,                       &
+             most_method, nc_const, netcdf_precision, neutral, ngsrb,          &
              nsor, nsor_ini, nudging, nx, ny, nz, ocean, omega, omega_sor,     &
-             passive_scalar, phi, prandtl_layer,                               &
+             passive_scalar, phi,                                              &
              prandtl_number, precipitation, psolver, pt_damping_factor,        &
              pt_damping_width, pt_reference, pt_surface,                       &
@@ -318,5 +323,5 @@
              recycling_width, recycling_yshift,                                &
              reference_state, residual_limit,                                  &
-             rif_max, rif_min, roughness_length, sa_surface,                   &
+             roughness_length, sa_surface,                                     &
              sa_vertical_gradient, sa_vertical_gradient_level, scalar_advec,   &
              scalar_rayleigh_damping,                                          &
@@ -335,5 +340,5 @@
              vg_vertical_gradient_level, v_bulk, v_profile, ventilation_effect,&
              wall_adjustment, wall_heatflux, wall_humidityflux,                &
-             wall_scalarflux, z0h_factor
+             wall_scalarflux, zeta_max, zeta_min, z0h_factor
       
     NAMELIST /d3par/  averaging_interval, averaging_interval_pr,               &
Index: palm/trunk/SOURCE/prandtl_fluxes.f90
===================================================================
--- palm/trunk/SOURCE/prandtl_fluxes.f90	(revision 1686)
+++ 	(revision )
@@ -1,548 +1,0 @@
-!> @file prandtl_fluxes.f90
-!--------------------------------------------------------------------------------!
-! This file is part of PALM.
-!
-! PALM is free software: you can redistribute it and/or modify it under the terms
-! of the GNU General Public License as published by the Free Software Foundation,
-! either version 3 of the License, or (at your option) any later version.
-!
-! PALM is distributed in the hope that it will be useful, but WITHOUT ANY
-! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-! A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
-!
-! You should have received a copy of the GNU General Public License along with
-! PALM. If not, see <http://www.gnu.org/licenses/>.
-!
-! Copyright 1997-2014 Leibniz Universitaet Hannover
-!--------------------------------------------------------------------------------!
-!
-! Current revisions:
-! -----------------
-! 
-! 
-! Former revisions:
-! -----------------
-! $Id$
-!
-! 1682 2015-10-07 23:56:08Z knoop
-! Code annotations made doxygen readable 
-! 
-! 1551 2015-03-03 14:18:16Z maronga
-! Removed land surface model part. The surface fluxes are now always calculated
-! within prandtl_fluxes, based on the given surface temperature/humidity (which 
-! is either provided by the land surface model, by large scale forcing data, or
-! directly prescribed by the user.
-! 
-! 1496 2014-12-02 17:25:50Z maronga
-! Adapted for land surface model
-! 
-! 1494 2014-11-21 17:14:03Z maronga
-! Bugfixes: qs is now calculated before calculation of Rif. Ccalculation of 
-! buoyancy flux in Rif corrected (added missing humidity term), allow use of 
-! topography for coupled runs (not tested)
-! 
-! 1361 2014-04-16 15:17:48Z hoffmann
-! Bugfix: calculation of turbulent fluxes of rain water content (qrsws) and rain 
-! drop concentration (nrsws) added
-! 
-! 1340 2014-03-25 19:45:13Z kanani
-! REAL constants defined as wp-kind
-!
-! 1320 2014-03-20 08:40:49Z raasch
-! ONLY-attribute added to USE-statements,
-! kind-parameters added to all INTEGER and REAL declaration statements,
-! kinds are defined in new module kinds,
-! old module precision_kind is removed,
-! revision history before 2012 removed,
-! comment fields (!:) to be used for variable explanations added to
-! all variable declaration statements
-!
-! 1276 2014-01-15 13:40:41Z heinze
-! Use LSF_DATA also in case of Dirichlet bottom boundary condition for scalars
-!
-! 1257 2013-11-08 15:18:40Z raasch
-! openACC "kernels do" replaced by "kernels loop", "loop independent" added
-!
-! 1036 2012-10-22 13:43:42Z raasch
-! code put under GPL (PALM 3.9)
-!
-! 1015 2012-09-27 09:23:24Z raasch
-! OpenACC statements added
-!
-! 978 2012-08-09 08:28:32Z fricke
-! roughness length for scalar quantities z0h added
-!
-! Revision 1.1  1998/01/23 10:06:06  raasch
-! Initial revision
-!
-!
-! Description:
-! ------------
-!> Diagnostic computation of vertical fluxes in the Prandtl layer from the
-!> values of the variables at grid point k=1
-!------------------------------------------------------------------------------!
- SUBROUTINE prandtl_fluxes
- 
-
-    USE arrays_3d,                                                             &
-        ONLY:  e, nr, nrs, nrsws, pt, q, qr, qrs, qrsws, qs, qsws, rif, shf,   &
-               ts, u, us, usws, v, vpt, vsws, zu, zw, z0, z0h
-
-    USE control_parameters,                                                    &
-        ONLY:  cloud_physics, constant_heatflux, constant_waterflux,           &
-               coupling_mode, g, humidity, ibc_e_b, icloud_scheme, kappa,      &
-               large_scale_forcing, lsf_surf, passive_scalar, precipitation,   &
-               pt_surface, q_surface, rif_max, rif_min, run_coupled,           &
-               surface_pressure
-
-    USE indices,                                                               &
-        ONLY:  nxl, nxlg, nxr, nxrg, nys, nysg, nyn, nyng, nzb_s_inner,        &
-               nzb_u_inner, nzb_v_inner
-
-    USE kinds
-
-    IMPLICIT NONE
-
-    INTEGER(iwp) ::  i            !<
-    INTEGER(iwp) ::  j            !<
-    INTEGER(iwp) ::  k            !<
-
-    LOGICAL      ::  coupled_run  !<
-
-    REAL(wp)     ::  a            !<
-    REAL(wp)     ::  b            !<
-    REAL(wp)     ::  e_q          !<
-    REAL(wp)     ::  rifm         !<
-    REAL(wp)     ::  uv_total     !<
-    REAL(wp)     ::  z_p          !<
-
-!
-!-- Data information for accelerators
-    !$acc data present( e, nrsws, nzb_u_inner, nzb_v_inner, nzb_s_inner, pt )  &
-    !$acc      present( q, qs, qsws, qrsws, rif, shf, ts, u, us, usws, v )     &
-    !$acc      present( vpt, vsws, zu, zw, z0, z0h )
-! 
-!-- Compute theta*
-    IF ( constant_heatflux )  THEN
-
-!
-!--    For a given heat flux in the Prandtl layer:
-!--    for u* use the value from the previous time step
-       !$OMP PARALLEL DO
-       !$acc kernels loop
-       DO  i = nxlg, nxrg
-          DO  j = nysg, nyng
-             ts(j,i) = -shf(j,i) / ( us(j,i) + 1E-30_wp )
-!
-!--          ts must be limited, because otherwise overflow may occur in case of
-!--          us=0 when computing rif further below
-             IF ( ts(j,i) < -1.05E5_wp )  ts(j,i) = -1.0E5_wp
-             IF ( ts(j,i) >   1.0E5_wp )  ts(j,i) =  1.0E5_wp
-          ENDDO
-       ENDDO
-
-    ELSE
-!
-!--    For a given surface temperature:
-!--    (the Richardson number is still the one from the previous time step) 
-       IF ( large_scale_forcing .AND. lsf_surf )  THEN
-          !$OMP PARALLEL DO
-          !$acc kernels loop
-          DO  i = nxlg, nxrg
-             DO  j = nysg, nyng
-                k = nzb_s_inner(j,i)
-                pt(k,j,i) = pt_surface
-             ENDDO
-          ENDDO
-       ENDIF
-
-       !$OMP PARALLEL DO PRIVATE( a, b, k, z_p )
-       !$acc kernels loop
-       DO  i = nxlg, nxrg
-          DO  j = nysg, nyng
-
-             k   = nzb_s_inner(j,i)
-             z_p = zu(k+1) - zw(k)
-
-             IF ( rif(j,i) >= 0.0_wp )  THEN
-!
-!--             Stable stratification
-                ts(j,i) = kappa * ( pt(k+1,j,i) - pt(k,j,i) ) / (           &
-                                  LOG( z_p / z0h(j,i) ) +                   &
-                                  5.0_wp * rif(j,i) * ( z_p - z0h(j,i) ) / z_p &
-                                                                )
-             ELSE
-!
-!--             Unstable stratification
-                a = SQRT( 1.0_wp - 16.0_wp * rif(j,i) )
-                b = SQRT( 1.0_wp - 16.0_wp * rif(j,i) * z0h(j,i) / z_p )
-
-                ts(j,i) = kappa * ( pt(k+1,j,i) - pt(k,j,i) ) /  (             &
-                          LOG( z_p / z0h(j,i) ) -                              &
-                          2.0_wp * LOG( ( 1.0_wp + a ) / ( 1.0_wp + b ) ) )
-             ENDIF
-
-          ENDDO
-       ENDDO
-    ENDIF
-
-!
-!-- If required compute q*
-    IF ( humidity  .OR.  passive_scalar )  THEN
-       IF ( constant_waterflux )  THEN
-!
-!--       For a given water flux in the Prandtl layer:
-          !$OMP PARALLEL DO
-          !$acc kernels loop
-          DO  i = nxlg, nxrg
-             DO  j = nysg, nyng
-                qs(j,i) = -qsws(j,i) / ( us(j,i) + 1E-30_wp )
-             ENDDO
-          ENDDO
-          
-       ELSE
-          coupled_run = ( coupling_mode == 'atmosphere_to_ocean' .AND. run_coupled )
-
-           IF ( large_scale_forcing .AND. lsf_surf )  THEN
-                !$OMP PARALLEL DO
-                !$acc kernels loop
-                 DO  i = nxlg, nxrg
-                    DO  j = nysg, nyng
-                       k = nzb_s_inner(j,i)
-                       q(k,j,i) = q_surface
-                    ENDDO
-                 ENDDO
-           ENDIF
-
-          !$OMP PARALLEL DO PRIVATE( a, b, k, z_p )
-          !$acc kernels loop independent
-          DO  i = nxlg, nxrg
-             !$acc loop independent
-             DO  j = nysg, nyng
-
-                k   = nzb_s_inner(j,i)
-                z_p = zu(k+1) - zw(k)
-
-!
-!--             Assume saturation for atmosphere coupled to ocean (but not
-!--             in case of precursor runs)
-                IF ( coupled_run )  THEN
-                   e_q = 6.1_wp * &
-                           EXP( 0.07_wp * ( MIN(pt(k,j,i),pt(k+1,j,i)) - 273.15_wp ) )
-                   q(k,j,i) = 0.622_wp * e_q / ( surface_pressure - e_q )
-                ENDIF
-                IF ( rif(j,i) >= 0.0_wp )  THEN
-!
-!--                Stable stratification
-                   qs(j,i) = kappa * ( q(k+1,j,i) - q(k,j,i) ) / (             &
-                                  LOG( z_p / z0h(j,i) ) +                      &
-                                  5.0_wp * rif(j,i) * ( z_p - z0h(j,i) ) / z_p &
-                                                                 )
-                ELSE
-!
-!--                Unstable stratification
-                   a = SQRT( 1.0_wp - 16.0_wp * rif(j,i) ) 
-                   b = SQRT( 1.0_wp - 16.0_wp * rif(j,i) * z0h(j,i) / z_p ) 
- 
-                   qs(j,i) = kappa * ( q(k+1,j,i) - q(k,j,i) ) /   (           &
-                             LOG( z_p / z0h(j,i) ) -                           &
-                              2.0_wp * LOG( (1.0_wp + a ) / ( 1.0_wp + b ) ) )
-                ENDIF
-
-             ENDDO
-          ENDDO
-       ENDIF
-    ENDIF
-
-!
-!-- Compute z_p/L (corresponds to the Richardson-flux number)
-    IF ( .NOT. humidity )  THEN
-       !$OMP PARALLEL DO PRIVATE( k, z_p )
-       !$acc kernels loop
-       DO  i = nxlg, nxrg
-          DO  j = nysg, nyng
-             k   = nzb_s_inner(j,i)
-             z_p = zu(k+1) - zw(k)
-             rif(j,i) = z_p * kappa * g * ts(j,i) / &
-                        ( pt(k+1,j,i) * ( us(j,i)**2 + 1E-30_wp ) )
-!
-!--          Limit the value range of the Richardson numbers.
-!--          This is necessary for very small velocities (u,v --> 0), because
-!--          the absolute value of rif can then become very large, which in
-!--          consequence would result in very large shear stresses and very
-!--          small momentum fluxes (both are generally unrealistic).
-             IF ( rif(j,i) < rif_min )  rif(j,i) = rif_min
-             IF ( rif(j,i) > rif_max )  rif(j,i) = rif_max
-          ENDDO
-       ENDDO
-    ELSE
-       !$OMP PARALLEL DO PRIVATE( k, z_p )
-       !$acc kernels loop
-       DO  i = nxlg, nxrg
-          DO  j = nysg, nyng
-             k   = nzb_s_inner(j,i)
-             z_p = zu(k+1) - zw(k)
-             rif(j,i) = z_p * kappa * g *                                      &
-                        ( ts(j,i) + 0.61_wp * pt(k+1,j,i) * qs(j,i) + 0.61_wp  &
-                          * q(k+1,j,i) * ts(j,i)) /                            &
-                        ( vpt(k+1,j,i) * ( us(j,i)**2 + 1E-30_wp ) )
-!
-!--          Limit the value range of the Richardson numbers.
-!--          This is necessary for very small velocities (u,v --> 0), because
-!--          the absolute value of rif can then become very large, which in
-!--          consequence would result in very large shear stresses and very
-!--          small momentum fluxes (both are generally unrealistic).
-             IF ( rif(j,i) < rif_min )  rif(j,i) = rif_min
-             IF ( rif(j,i) > rif_max )  rif(j,i) = rif_max
-          ENDDO
-       ENDDO       
-    ENDIF
-
-!
-!-- Compute u* at the scalars' grid points
-    !$OMP PARALLEL DO PRIVATE( a, b, k, uv_total, z_p )
-    !$acc kernels loop
-    DO  i = nxl, nxr
-       DO  j = nys, nyn
-
-          k   = nzb_s_inner(j,i)
-          z_p = zu(k+1) - zw(k)
-
-!
-!--       Compute the absolute value of the horizontal velocity 
-!--       (relative to the surface)
-          uv_total = SQRT( ( 0.5_wp * ( u(k+1,j,i) + u(k+1,j,i+1)              &
-                                      - u(k,j,i)   - u(k,j,i+1) ) )**2 +       &
-                           ( 0.5_wp * ( v(k+1,j,i) + v(k+1,j+1,i)              &
-                                      - v(k,j,i)   - v(k,j+1,i) ) )**2 )    
-
-
-          IF ( rif(j,i) >= 0.0_wp )  THEN
-!
-!--          Stable stratification
-             us(j,i) = kappa * uv_total / (                                    &
-                                  LOG( z_p / z0(j,i) ) +                       &
-                                  5.0_wp * rif(j,i) * ( z_p - z0(j,i) ) / z_p  &
-                                          )
-          ELSE
-!
-!--          Unstable stratification
-             a = SQRT( SQRT( 1.0_wp - 16.0_wp * rif(j,i) ) )
-             b = SQRT( SQRT( 1.0_wp - 16.0_wp * rif(j,i) / z_p * z0(j,i) ) )
-
-             us(j,i) = kappa * uv_total / (                                    &
-                       LOG( z_p / z0(j,i) ) -                                  &
-                       LOG( ( 1.0_wp + a )**2 * ( 1.0_wp + a**2 ) / (          &
-                            ( 1.0_wp + b )**2 * ( 1.0_wp + b**2 )   ) ) +      &
-                               2.0_wp * ( ATAN( a ) - ATAN( b ) )              &
-                                           )
-          ENDIF
-       ENDDO
-    ENDDO
-
-!
-!-- Values of us at ghost point locations are needed for the evaluation of usws 
-!-- and vsws.
-    !$acc update host( us )
-    CALL exchange_horiz_2d( us )
-    !$acc update device( us )
-
-!
-!-- Compute u'w' for the total model domain.
-!-- First compute the corresponding component of u* and square it.
-    !$OMP PARALLEL DO PRIVATE( a, b, k, rifm, z_p )
-    !$acc kernels loop
-    DO  i = nxl, nxr
-       DO  j = nys, nyn
-
-          k   = nzb_u_inner(j,i)
-          z_p = zu(k+1) - zw(k)
-
-!
-!--       Compute Richardson-flux number for this point
-          rifm = 0.5_wp * ( rif(j,i-1) + rif(j,i) )
-          IF ( rifm >= 0.0_wp )  THEN
-!
-!--          Stable stratification
-             usws(j,i) = kappa * ( u(k+1,j,i) - u(k,j,i) )/ (                  &
-                                     LOG( z_p / z0(j,i) ) +                    &
-                                     5.0_wp * rifm * ( z_p - z0(j,i) ) / z_p   &
-                                                            )
-          ELSE
-!
-!--          Unstable stratification
-             a = SQRT( SQRT( 1.0_wp - 16.0_wp * rifm ) )
-             b = SQRT( SQRT( 1.0_wp - 16.0_wp * rifm / z_p * z0(j,i) ) )
-
-             usws(j,i) = kappa * ( u(k+1,j,i) - u(k,j,i) ) / (                 &
-                         LOG( z_p / z0(j,i) ) -                                &
-                         LOG( (1.0_wp + a )**2 * ( 1.0_wp + a**2 ) / (         &
-                              (1.0_wp + b )**2 * ( 1.0_wp + b**2 )   ) ) +     &
-                                 2.0_wp * ( ATAN( a ) - ATAN( b ) )            &
-                                                 )
-          ENDIF
-          usws(j,i) = -usws(j,i) * 0.5_wp * ( us(j,i-1) + us(j,i) )
-       ENDDO
-    ENDDO
-
-!
-!-- Compute v'w' for the total model domain.
-!-- First compute the corresponding component of u* and square it.
-    !$OMP PARALLEL DO PRIVATE( a, b, k, rifm, z_p )
-    !$acc kernels loop
-    DO  i = nxl, nxr
-       DO  j = nys, nyn
-
-          k   = nzb_v_inner(j,i)
-          z_p = zu(k+1) - zw(k)
-
-!
-!--       Compute Richardson-flux number for this point
-          rifm = 0.5_wp * ( rif(j-1,i) + rif(j,i) )
-          IF ( rifm >= 0.0_wp )  THEN
-!
-!--          Stable stratification
-             vsws(j,i) = kappa * ( v(k+1,j,i) -  v(k,j,i) ) / (                &
-                                     LOG( z_p / z0(j,i) ) +                    &
-                                     5.0_wp * rifm * ( z_p - z0(j,i) ) / z_p   &
-                                                              )
-          ELSE
-!
-!--          Unstable stratification
-             a = SQRT( SQRT( 1.0_wp - 16.0_wp * rifm ) )
-             b = SQRT( SQRT( 1.0_wp - 16.0_wp * rifm / z_p * z0(j,i) ) )
-
-             vsws(j,i) = kappa * ( v(k+1,j,i) - v(k,j,i) ) / (                 &
-                         LOG( z_p / z0(j,i) ) -                                &
-                         LOG( (1.0_wp + a )**2 * ( 1.0_wp + a**2 ) / (         &
-                              (1.0_wp + b )**2 * ( 1.0_wp + b**2 )   ) ) +     &
-                                 2.0_wp * ( ATAN( a ) - ATAN( b ) )            &
-                                                 )
-          ENDIF
-          vsws(j,i) = -vsws(j,i) * 0.5_wp * ( us(j-1,i) + us(j,i) )
-       ENDDO
-    ENDDO
-
-!
-!-- If required compute qr* and nr*
-    IF ( cloud_physics .AND. icloud_scheme == 0 .AND. precipitation )  THEN
-
-       !$OMP PARALLEL DO PRIVATE( a, b, k, z_p )
-       !$acc kernels loop independent
-       DO  i = nxlg, nxrg
-          !$acc loop independent
-          DO  j = nysg, nyng
-
-             k   = nzb_s_inner(j,i)
-             z_p = zu(k+1) - zw(k)
-
-             IF ( rif(j,i) >= 0.0 )  THEN
-!
-!--             Stable stratification
-                qrs(j,i) = kappa * ( qr(k+1,j,i) - qr(k,j,i) ) / (             &
-                               LOG( z_p / z0h(j,i) ) +                         &
-                               5.0 * rif(j,i) * ( z_p - z0h(j,i) ) / z_p )
-                nrs(j,i) = kappa * ( nr(k+1,j,i) - nr(k,j,i) ) / (             &
-                               LOG( z_p / z0h(j,i) ) +                         &
-                               5.0 * rif(j,i) * ( z_p - z0h(j,i) ) / z_p )
-
-             ELSE
-!
-!--             Unstable stratification
-                a = SQRT( 1.0 - 16.0 * rif(j,i) ) 
-                b = SQRT( 1.0 - 16.0 * rif(j,i) * z0h(j,i) / z_p ) 
- 
-                qrs(j,i) = kappa * ( qr(k+1,j,i) - qr(k,j,i) ) /   (           &
-                          LOG( z_p / z0h(j,i) ) -                              &
-                          2.0 * LOG( (1.0 + a ) / ( 1.0 + b ) ) )
-                nrs(j,i) = kappa * ( nr(k+1,j,i) - nr(k,j,i) ) /   (           &
-                          LOG( z_p / z0h(j,i) ) -                              &
-                          2.0 * LOG( (1.0 + a ) / ( 1.0 + b ) ) )
-
-             ENDIF
-
-          ENDDO
-       ENDDO
-
-    ENDIF
-
-!
-!-- Exchange the boundaries for the momentum fluxes (only for sake of 
-!-- completeness)
-    !$acc update host( usws, vsws )
-    CALL exchange_horiz_2d( usws )
-    CALL exchange_horiz_2d( vsws )
-    !$acc update device( usws, vsws )
-    IF ( humidity  .OR.  passive_scalar )  THEN
-       !$acc update host( qsws )
-       CALL exchange_horiz_2d( qsws )
-       !$acc update device( qsws )
-       IF ( cloud_physics  .AND.  icloud_scheme == 0  .AND.  &
-            precipitation )  THEN
-          !$acc update host( qrsws, nrsws )
-          CALL exchange_horiz_2d( qrsws )
-          CALL exchange_horiz_2d( nrsws )
-          !$acc update device( qrsws, nrsws )
-       ENDIF
-    ENDIF
-
-!
-!-- Compute the vertical kinematic heat flux
-    IF ( .NOT. constant_heatflux  )  THEN
-       !$OMP PARALLEL DO
-       !$acc kernels loop independent
-       DO  i = nxlg, nxrg
-          !$acc loop independent
-          DO  j = nysg, nyng
-             shf(j,i) = -ts(j,i) * us(j,i)
-          ENDDO
-       ENDDO
-    ENDIF
-
-!
-!-- Compute the vertical water/scalar flux
-    IF ( .NOT. constant_waterflux .AND. ( humidity .OR. passive_scalar ) )  THEN
-       !$OMP PARALLEL DO
-       !$acc kernels loop independent
-       DO  i = nxlg, nxrg
-          !$acc loop independent
-          DO  j = nysg, nyng
-             qsws(j,i) = -qs(j,i) * us(j,i)
-          ENDDO
-       ENDDO
-    ENDIF
-
-!
-!-- Compute (turbulent) fluxes of rain water content and rain drop concentartion
-    IF ( cloud_physics  .AND.  icloud_scheme == 0  .AND.  precipitation )  THEN
-       !$OMP PARALLEL DO
-       !$acc kernels loop independent
-       DO  i = nxlg, nxrg
-          !$acc loop independent
-          DO  j = nysg, nyng
-             qrsws(j,i) = -qrs(j,i) * us(j,i)
-             nrsws(j,i) = -nrs(j,i) * us(j,i)
-          ENDDO
-       ENDDO
-    ENDIF
-
-!
-!-- Bottom boundary condition for the TKE
-    IF ( ibc_e_b == 2 )  THEN
-       !$OMP PARALLEL DO
-       !$acc kernels loop independent
-       DO  i = nxlg, nxrg
-          !$acc loop independent
-          DO  j = nysg, nyng
-             e(nzb_s_inner(j,i)+1,j,i) = ( us(j,i) / 0.1_wp )**2
-!
-!--          As a test: cm = 0.4
-!            e(nzb_s_inner(j,i)+1,j,i) = ( us(j,i) / 0.4_wp )**2
-             e(nzb_s_inner(j,i),j,i)   = e(nzb_s_inner(j,i)+1,j,i)
-          ENDDO
-       ENDDO
-    ENDIF
-
-    !$acc end data
-
- END SUBROUTINE prandtl_fluxes
Index: palm/trunk/SOURCE/production_e.f90
===================================================================
--- palm/trunk/SOURCE/production_e.f90	(revision 1686)
+++ palm/trunk/SOURCE/production_e.f90	(revision 1691)
@@ -14,10 +14,10 @@
 ! PALM. If not, see <http://www.gnu.org/licenses/>.
 !
-! Copyright 1997-2014 Leibniz Universitaet Hannover
+! Copyright 1997-2015 Leibniz Universitaet Hannover
 !--------------------------------------------------------------------------------!
 !
 ! Current revisions:
 ! -----------------
-! 
+! Renamed prandtl_layer to constant_flux_layer.
 ! 
 ! Former revisions:
@@ -78,5 +78,5 @@
 ! ------------
 !> Production terms (shear + buoyancy) of the TKE.
-!> @warning The case with prandtl_layer = F and use_surface_fluxes = T is
+!> @warning The case with constant_flux_layer = F and use_surface_fluxes = T is
 !>          not considered well!
 !------------------------------------------------------------------------------!
@@ -128,8 +128,8 @@
 
        USE control_parameters,                                                 &
-           ONLY:  cloud_droplets, cloud_physics, g, humidity, kappa, neutral,  &
-                  ocean, prandtl_layer, pt_reference, rho_reference,           &
-                  use_single_reference_value, use_surface_fluxes,              &
-                  use_top_fluxes
+           ONLY:  cloud_droplets, cloud_physics, constant_flux_layer, g,       &
+                  humidity, kappa, neutral, ocean, pt_reference,               &
+                  rho_reference, use_single_reference_value,                   &
+                  use_surface_fluxes, use_top_fluxes
 
        USE grid_variables,                                                     &
@@ -217,5 +217,5 @@
           ENDDO
 
-          IF ( prandtl_layer )  THEN
+          IF ( constant_flux_layer )  THEN
 
 !
@@ -734,8 +734,8 @@
 
        USE control_parameters,                                                 &
-           ONLY:  cloud_droplets, cloud_physics, g, humidity, kappa, neutral,  &
-                  ocean, prandtl_layer, pt_reference, rho_reference,           &
-                  topography, use_single_reference_value, use_surface_fluxes,  &
-                  use_top_fluxes
+           ONLY:  cloud_droplets, cloud_physics, constant_flux_layer, g,       &
+                  humidity, kappa, neutral, ocean, pt_reference,               &
+                  rho_reference, topography, use_single_reference_value,       &
+                  use_surface_fluxes, use_top_fluxes
 
        USE grid_variables,                                                     &
@@ -832,5 +832,5 @@
        ENDDO
 
-       IF ( prandtl_layer )  THEN
+       IF ( constant_flux_layer )  THEN
 
 !
@@ -1402,8 +1402,8 @@
 
        USE control_parameters,                                                 &
-           ONLY:  cloud_droplets, cloud_physics, g, humidity, kappa, neutral,  &
-                  ocean, prandtl_layer, pt_reference, rho_reference,           &
-                  use_single_reference_value, use_surface_fluxes,              &
-                  use_top_fluxes
+           ONLY:  cloud_droplets, cloud_physics, constant_flux_layer, g,       &
+                  humidity, kappa, neutral, ocean, pt_reference,               &
+                  rho_reference, use_single_reference_value,                   &
+                  use_surface_fluxes, use_top_fluxes
 
        USE grid_variables,                                                     &
@@ -1473,5 +1473,5 @@
        ENDDO
 
-       IF ( prandtl_layer )  THEN
+       IF ( constant_flux_layer )  THEN
 
           IF ( ( wall_e_x(j,i) /= 0.0_wp ) .OR. ( wall_e_y(j,i) /= 0.0_wp ) )  THEN
@@ -1924,5 +1924,5 @@
 
        USE control_parameters,                                                 &
-           ONLY:  kappa, prandtl_layer
+           ONLY:  constant_flux_layer, kappa
 
        USE indices,                                                            &
@@ -1937,5 +1937,5 @@
        INTEGER(iwp) ::  kv  !<
 
-       IF ( prandtl_layer )  THEN
+       IF ( constant_flux_layer )  THEN
 
           IF ( first_call )  THEN
Index: palm/trunk/SOURCE/prognostic_equations.f90
===================================================================
--- palm/trunk/SOURCE/prognostic_equations.f90	(revision 1686)
+++ palm/trunk/SOURCE/prognostic_equations.f90	(revision 1691)
@@ -14,10 +14,11 @@
 ! PALM. If not, see <http://www.gnu.org/licenses/>.
 !
-! Copyright 1997-2014 Leibniz Universitaet Hannover
+! Copyright 1997-2015 Leibniz Universitaet Hannover
 !--------------------------------------------------------------------------------!
 !
 ! Current revisions:
 ! ------------------
-! 
+! Added optional model spin-up without radiation / land surface model calls.
+! Formatting corrections.
 ! 
 ! Former revisions:
@@ -286,5 +287,6 @@
 
     USE radiation_model_mod,                                                   &
-        ONLY:  radiation, radiation_scheme, radiation_tendency
+        ONLY:  radiation, radiation_scheme, radiation_tendency,                &
+               skip_time_do_radiation
 
     USE statistics,                                                            &
@@ -410,5 +412,5 @@
 !
 !--          Nudging
-             IF ( nudging )  CALL nudge( i, j, simulated_time, 'u' ) 
+             IF ( nudging )  CALL nudge( i, j, simulated_time, 'u' )
 
              CALL user_actions( i, j, 'u-tendency' )
@@ -469,5 +471,5 @@
 !
 !--          Nudging
-             IF ( nudging )  CALL nudge( i, j, simulated_time, 'v' ) 
+             IF ( nudging )  CALL nudge( i, j, simulated_time, 'v' )
 
              CALL user_actions( i, j, 'v-tendency' )
@@ -610,5 +612,6 @@
 !
 !--          If required, add tendency due to radiative heating/cooling
-             IF ( radiation .AND. radiation_scheme == 'rrtmg' )  THEN
+             IF ( radiation .AND. radiation_scheme == 'rrtmg' .AND.            &
+                  simulated_time > skip_time_do_radiation )  THEN
                 CALL radiation_tendency ( i, j, tend )
              ENDIF
@@ -718,5 +721,5 @@
              ENDIF
              CALL diffusion_s( i, j, q, qsws, qswst, wall_qflux )
-     
+
 !
 !--          If required compute decrease of total water content due to
@@ -724,6 +727,7 @@
              IF ( cloud_physics  .AND.  icloud_scheme == 1  .AND.              &
                   precipitation )  THEN
-                CALL calc_precipitation( i, j )             
-             ENDIF
+                CALL calc_precipitation( i, j )
+             ENDIF
+
 !
 !--          Sink or source of scalar concentration due to canopy elements
@@ -1009,5 +1013,5 @@
 !
 !-- Nudging
-    IF ( nudging )  CALL nudge( simulated_time, 'u' ) 
+    IF ( nudging )  CALL nudge( simulated_time, 'u' )
 
     CALL user_actions( 'u-tendency' )
@@ -1085,5 +1089,5 @@
 !
 !-- Nudging
-    IF ( nudging )  CALL nudge( simulated_time, 'v' ) 
+    IF ( nudging )  CALL nudge( simulated_time, 'v' )
 
     CALL user_actions( 'v-tendency' )
@@ -1274,6 +1278,7 @@
 !
 !--    If required, add tendency due to radiative heating/cooling
-       IF ( radiation .AND. radiation_scheme == 'rrtmg' )  THEN
-          CALL radiation_tendency ( tend )
+       IF ( radiation .AND. radiation_scheme == 'rrtmg' .AND.                  &
+            simulated_time > skip_time_do_radiation )  THEN
+            CALL radiation_tendency ( tend )
        ENDIF
 
@@ -1859,5 +1864,5 @@
 !
 !-- Nudging
-    IF ( nudging )  CALL nudge( simulated_time, 'u' ) 
+    IF ( nudging )  CALL nudge( simulated_time, 'u' )
 
     CALL user_actions( 'u-tendency' )
@@ -1926,5 +1931,5 @@
 !
 !-- Nudging
-    IF ( nudging )  CALL nudge( simulated_time, 'v' ) 
+    IF ( nudging )  CALL nudge( simulated_time, 'v' )
 
     CALL user_actions( 'v-tendency' )
@@ -2096,4 +2101,9 @@
        ENDIF
 
+       IF ( radiation .AND. radiation_scheme == 'rrtmg' .AND.                  &
+            simulated_time > skip_time_do_radiation )  THEN
+            CALL radiation_tendency ( tend )
+       ENDIF
+
        CALL user_actions( 'pt-tendency' )
 
Index: palm/trunk/SOURCE/radiation_model.f90
===================================================================
--- palm/trunk/SOURCE/radiation_model.f90	(revision 1686)
+++ palm/trunk/SOURCE/radiation_model.f90	(revision 1691)
@@ -19,5 +19,7 @@
 ! Current revisions:
 ! -----------------
-! 
+! Added option for spin-up runs without radiation (skip_time_do_radiation). Bugfix
+! in calculation of pressure profiles. Bugfix in calculation of trace gas profiles.
+! Added output of radiative heating rates.
 ! 
 ! Former revisions:
@@ -61,5 +63,4 @@
 !> @todo Output of other rrtm arrays (such as volume mixing ratios)
 !> @todo Adapt for use with topography
-!> @todo Remove 3D dummy arrays (such as clear-sky output)
 !>
 !> @note Many variables have a leading dummy dimension (0:0) in order to
@@ -70,8 +71,8 @@
 
     USE arrays_3d,                                                             &
-        ONLY:  hyp, pt, q, ql, zw
+        ONLY:  dzw, hyp, pt, q, ql, zw
 
     USE cloud_parameters,                                                      &
-        ONLY:  cp, l_v, nc_const, rho_l, sigma_gc  
+        ONLY:  cp, l_d_cp, nc_const, rho_l, sigma_gc  
 
     USE constants,                                                             &
@@ -80,5 +81,5 @@
     USE control_parameters,                                                    &
         ONLY:  cloud_droplets, cloud_physics, g, initializing_actions,         &
-               large_scale_forcing, lsf_surf, phi, pt_surface,                 &
+               large_scale_forcing, lsf_surf, phi, pt_surface, rho_surface,    &
                surface_pressure, time_since_reference_point
 
@@ -153,33 +154,36 @@
 
 
-    LOGICAL ::  constant_albedo = .FALSE., & !< flag parameter indicating whether the albedo may change depending on zenith
-                lw_radiation = .TRUE.,     & !< flag parameter indicing whether longwave radiation shall be calculated
-                radiation = .FALSE.,       & !< flag parameter indicating whether the radiation model is used
-                sun_up    = .TRUE.,        & !< flag parameter indicating whether the sun is up or down
-                sw_radiation = .TRUE.        !< flag parameter indicing whether shortwave radiation shall be calculated
-
-    REAL(wp), PARAMETER :: sigma_sb       = 5.67E-8_wp, & !< Stefan-Boltzmann constant
-                           solar_constant = 1368.0_wp     !< solar constant at top of atmosphere
- 
-    REAL(wp) :: albedo = 9999999.9_wp,        & !< NAMELIST alpha
-                albedo_lw_dif = 9999999.9_wp, & !< NAMELIST aldif
-                albedo_lw_dir = 9999999.9_wp, & !< NAMELIST aldir
-                albedo_sw_dif = 9999999.9_wp, & !< NAMELIST asdif
-                albedo_sw_dir = 9999999.9_wp, & !< NAMELIST asdir
-                dt_radiation = 0.0_wp,        & !< radiation model timestep
-                emissivity = 0.95_wp,         & !< NAMELIST surface emissivity
-                exn,                          & !< Exner function
-                lon = 0.0_wp,                 & !< longitude in radians
-                lat = 0.0_wp,                 & !< latitude in radians
-                decl_1,                       & !< declination coef. 1
-                decl_2,                       & !< declination coef. 2
-                decl_3,                       & !< declination coef. 3
-                time_utc,                     & !< current time in UTC
-                time_utc_init = 43200.0_wp,   & !< UTC time at model start (noon)
-                lambda = 0.0_wp,              & !< longitude in degrees
-                net_radiation = 0.0_wp,       & !< net radiation at surface
-                time_radiation = 0.0_wp,      & !< time since last call of radiation code
-                sky_trans                       !< sky transmissivity
-
+    LOGICAL ::  constant_albedo = .FALSE.,       & !< flag parameter indicating whether the albedo may change depending on zenith
+                force_radiation_call = .FALSE.,  & !< flag parameter for unscheduled radiation calls
+                lw_radiation = .TRUE.,           & !< flag parameter indicing whether longwave radiation shall be calculated
+                radiation = .FALSE.,             & !< flag parameter indicating whether the radiation model is used
+                sun_up    = .TRUE.,              & !< flag parameter indicating whether the sun is up or down
+                sw_radiation = .TRUE.              !< flag parameter indicing whether shortwave radiation shall be calculated
+
+
+    REAL(wp), PARAMETER :: d_seconds_hour  = 0.000277777777778_wp,  & !< inverse of seconds per hour (1/3600)
+                           d_hours_day    = 0.0416666666667_wp,     & !< inverse of hours per day (1/24)
+                           sigma_sb       = 5.67037321E-8_wp,       & !< Stefan-Boltzmann constant
+                           solar_constant = 1368.0_wp                 !< solar constant at top of atmosphere
+
+    REAL(wp) :: albedo = 9999999.9_wp,           & !< NAMELIST alpha
+                albedo_lw_dif = 9999999.9_wp,    & !< NAMELIST aldif
+                albedo_lw_dir = 9999999.9_wp,    & !< NAMELIST aldir
+                albedo_sw_dif = 9999999.9_wp,    & !< NAMELIST asdif
+                albedo_sw_dir = 9999999.9_wp,    & !< NAMELIST asdir
+                decl_1,                          & !< declination coef. 1
+                decl_2,                          & !< declination coef. 2
+                decl_3,                          & !< declination coef. 3
+                dt_radiation = 0.0_wp,           & !< radiation model timestep
+                emissivity = 0.98_wp,            & !< NAMELIST surface emissivity
+                lambda = 0.0_wp,                 & !< longitude in degrees
+                lon = 0.0_wp,                    & !< longitude in radians
+                lat = 0.0_wp,                    & !< latitude in radians
+                net_radiation = 0.0_wp,          & !< net radiation at surface
+                skip_time_do_radiation = 0.0_wp, & !< Radiation model is not called before this time
+                sky_trans,                       & !< sky transmissivity
+                time_radiation = 0.0_wp,         & !< time since last call of radiation code
+                time_utc,                        & !< current time in UTC
+                time_utc_init = 43200.0_wp         !< UTC time at model start (noon)
 
     REAL(wp), DIMENSION(0:0) ::  zenith        !< solar zenith angle
@@ -213,12 +217,21 @@
 
     REAL(wp), DIMENSION(:,:,:), ALLOCATABLE, TARGET :: &
+                        rad_lw_cs_hr,                  & !< longwave clear sky radiation heating rate (K/s)
+                        rad_lw_cs_hr_av,               & !< average of rad_lw_cs_hr
+                        rad_lw_hr,                     & !< longwave radiation heating rate (K/s)
+                        rad_lw_hr_av,                  & !< average of rad_sw_hr
+                        rad_lw_in,                     & !< incoming longwave radiation (W/m2)
+                        rad_lw_in_av,                  & !< average of rad_lw_in
+                        rad_lw_out,                    & !< outgoing longwave radiation (W/m2)
+                        rad_lw_out_av,                 & !< average of rad_lw_out
+                        rad_sw_cs_hr,                  & !< shortwave clear sky radiation heating rate (K/s)
+                        rad_sw_cs_hr_av,               & !< average of rad_sw_cs_hr
+                        rad_sw_hr,                     & !< shortwave radiation heating rate (K/s)
+                        rad_sw_hr_av,                  & !< average of rad_sw_hr
                         rad_sw_in,                     & !< incoming shortwave radiation (W/m2)
                         rad_sw_in_av,                  & !< average of rad_sw_in
                         rad_sw_out,                    & !< outgoing shortwave radiation (W/m2)
-                        rad_sw_out_av,                 & !< average of rad_sw_out
-                        rad_lw_in,                     & !< incoming longwave radiation (W/m2)
-                        rad_lw_in_av,                  & !< average of rad_lw_in
-                        rad_lw_out,                    & !< outgoing longwave radiation (W/m2)
-                        rad_lw_out_av                    !< average of rad_lw_out
+                        rad_sw_out_av                    !< average of rad_sw_out
+
 
 !
@@ -244,9 +257,9 @@
                     rrtm_icld = 0,     & !< cloud flag (0: clear sky column, 1: cloudy column)
                     rrtm_iaer = 0,     & !< aerosol option flag (0: no aerosol layers, for lw only: 6 (requires setting of rrtm_sw_ecaer), 10: one or more aerosol layers (not implemented)
-                    rrtm_idrv = 0        !< longwave upward flux calculation option (0,1)
+                    rrtm_idrv = 1        !< longwave upward flux calculation option (0,1)
 
     LOGICAL :: snd_exists = .FALSE.      !< flag parameter to check whether a user-defined input files exists
 
-    REAL(wp), PARAMETER :: mol_weight_air_d_wv = 1.607793_wp !< molecular weight dry air / water vapor
+    REAL(wp), PARAMETER :: mol_mass_air_d_wv = 1.607793_wp !< molecular weight dry air / water vapor
 
     REAL(wp), DIMENSION(:), ALLOCATABLE :: hyp_snd,     & !< hypostatic pressure from sounding data (hPa)
@@ -255,40 +268,42 @@
                                            t_snd          !< actual temperature from sounding data (hPa)
 
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE :: aldif,         & !< longwave diffuse albedo solar angle of 60Â°
-                                             aldir,         & !< longwave direct albedo solar angle of 60Â°
-                                             asdif,         & !< shortwave diffuse albedo solar angle of 60Â°
-                                             asdir,         & !< shortwave direct albedo solar angle of 60Â°
-                                             rrtm_ccl4vmr,  & !< CCL4 volume mixing ratio (g/mol)
-                                             rrtm_cfc11vmr, & !< CFC11 volume mixing ratio (g/mol)
-                                             rrtm_cfc12vmr, & !< CFC12 volume mixing ratio (g/mol)
-                                             rrtm_cfc22vmr, & !< CFC22 volume mixing ratio (g/mol)
-                                             rrtm_ch4vmr,   & !< CH4 volume mixing ratio
-                                             rrtm_cicewp,   & !< in-cloud ice water path (g/mÂ²)
-                                             rrtm_cldfr,    & !< cloud fraction (0,1)
-                                             rrtm_cliqwp,   & !< in-cloud liquid water path (g/mÂ²)
-                                             rrtm_co2vmr,   & !< CO2 volume mixing ratio (g/mol)
-                                             rrtm_emis,     & !< surface emissivity (0-1)    
-                                             rrtm_h2ovmr,   & !< H2O volume mixing ratio
-                                             rrtm_n2ovmr,   & !< N2O volume mixing ratio
-                                             rrtm_o2vmr,    & !< O2 volume mixing ratio
-                                             rrtm_o3vmr,    & !< O3 volume mixing ratio
-                                             rrtm_play,     & !< pressure layers (hPa, zu-grid)
-                                             rrtm_plev,     & !< pressure layers (hPa, zw-grid)
-                                             rrtm_reice,    & !< cloud ice effective radius (microns)
-                                             rrtm_reliq,    & !< cloud water drop effective radius (microns)
-                                             rrtm_tlay,     & !< actual temperature (K, zu-grid)
-                                             rrtm_tlev,     & !< actual temperature (K, zw-grid)
-                                             rrtm_lwdflx,   & !< RRTM output of incoming longwave radiation flux (W/m2)
-                                             rrtm_lwuflx,   & !< RRTM output of outgoing longwave radiation flux (W/m2)
-                                             rrtm_lwhr,     & !< RRTM output of longwave radiation heating rate (K/d)
-                                             rrtm_lwuflxc,  & !< RRTM output of incoming clear sky longwave radiation flux (W/m2)
-                                             rrtm_lwdflxc,  & !< RRTM output of outgoing clear sky longwave radiation flux (W/m2) 
-                                             rrtm_lwhrc,    & !< RRTM output of incoming longwave clear sky radiation heating rate (K/d)
-                                             rrtm_swdflx,   & !< RRTM output of incoming shortwave radiation flux (W/m2)
-                                             rrtm_swuflx,   & !< RRTM output of outgoing shortwave radiation flux (W/m2)
-                                             rrtm_swhr,     & !< RRTM output of shortwave radiation heating rate (K/d)
-                                             rrtm_swuflxc,  & !< RRTM output of incoming clear sky shortwave radiation flux (W/m2)
-                                             rrtm_swdflxc,  & !< RRTM output of outgoing clear sky shortwave radiation flux (W/m2) 
-                                             rrtm_swhrc       !< RRTM output of incoming shortwave clear sky radiation heating rate (K/d) 
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE :: aldif,          & !< longwave diffuse albedo solar angle of 60Â°
+                                             aldir,          & !< longwave direct albedo solar angle of 60Â°
+                                             asdif,          & !< shortwave diffuse albedo solar angle of 60Â°
+                                             asdir,          & !< shortwave direct albedo solar angle of 60Â°
+                                             rrtm_ccl4vmr,   & !< CCL4 volume mixing ratio (g/mol)
+                                             rrtm_cfc11vmr,  & !< CFC11 volume mixing ratio (g/mol)
+                                             rrtm_cfc12vmr,  & !< CFC12 volume mixing ratio (g/mol)
+                                             rrtm_cfc22vmr,  & !< CFC22 volume mixing ratio (g/mol)
+                                             rrtm_ch4vmr,    & !< CH4 volume mixing ratio
+                                             rrtm_cicewp,    & !< in-cloud ice water path (g/mÂ²)
+                                             rrtm_cldfr,     & !< cloud fraction (0,1)
+                                             rrtm_cliqwp,    & !< in-cloud liquid water path (g/mÂ²)
+                                             rrtm_co2vmr,    & !< CO2 volume mixing ratio (g/mol)
+                                             rrtm_emis,      & !< surface emissivity (0-1)    
+                                             rrtm_h2ovmr,    & !< H2O volume mixing ratio
+                                             rrtm_n2ovmr,    & !< N2O volume mixing ratio
+                                             rrtm_o2vmr,     & !< O2 volume mixing ratio
+                                             rrtm_o3vmr,     & !< O3 volume mixing ratio
+                                             rrtm_play,      & !< pressure layers (hPa, zu-grid)
+                                             rrtm_plev,      & !< pressure layers (hPa, zw-grid)
+                                             rrtm_reice,     & !< cloud ice effective radius (microns)
+                                             rrtm_reliq,     & !< cloud water drop effective radius (microns)
+                                             rrtm_tlay,      & !< actual temperature (K, zu-grid)
+                                             rrtm_tlev,      & !< actual temperature (K, zw-grid)
+                                             rrtm_lwdflx,    & !< RRTM output of incoming longwave radiation flux (W/m2)
+                                             rrtm_lwdflxc,   & !< RRTM output of outgoing clear sky longwave radiation flux (W/m2) 
+                                             rrtm_lwuflx,    & !< RRTM output of outgoing longwave radiation flux (W/m2)
+                                             rrtm_lwuflxc,   & !< RRTM output of incoming clear sky longwave radiation flux (W/m2)
+                                             rrtm_lwuflx_dt, & !< RRTM output of incoming clear sky longwave radiation flux (W/m2)
+                                             rrtm_lwuflxc_dt,& !< RRTM output of outgoing clear sky longwave radiation flux (W/m2)
+                                             rrtm_lwhr,      & !< RRTM output of longwave radiation heating rate (K/d)
+                                             rrtm_lwhrc,     & !< RRTM output of incoming longwave clear sky radiation heating rate (K/d)
+                                             rrtm_swdflx,    & !< RRTM output of incoming shortwave radiation flux (W/m2)
+                                             rrtm_swdflxc,   & !< RRTM output of outgoing clear sky shortwave radiation flux (W/m2) 
+                                             rrtm_swuflx,    & !< RRTM output of outgoing shortwave radiation flux (W/m2)
+                                             rrtm_swuflxc,   & !< RRTM output of incoming clear sky shortwave radiation flux (W/m2)
+                                             rrtm_swhr,      & !< RRTM output of shortwave radiation heating rate (K/d)
+                                             rrtm_swhrc        !< RRTM output of incoming shortwave clear sky radiation heating rate (K/d) 
 
 !
@@ -296,10 +311,6 @@
     REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  rad_lw_cs_in,   & !< incoming clear sky longwave radiation (W/m2) (not used)
                                                 rad_lw_cs_out,  & !< outgoing clear sky longwave radiation (W/m2) (not used)
-                                                rad_lw_cs_hr,   & !< longwave clear sky radiation heating rate (K/d) (not used)
-                                                rad_lw_hr,      & !< longwave radiation heating rate (K/d)
                                                 rad_sw_cs_in,   & !< incoming clear sky shortwave radiation (W/m2) (not used)
                                                 rad_sw_cs_out,  & !< outgoing clear sky shortwave radiation (W/m2) (not used)
-                                                rad_sw_cs_hr,   & !< shortwave clear sky radiation heating rate (K/d) (not used)
-                                                rad_sw_hr,      & !< shortwave radiation heating rate (K/d)
                                                 rrtm_aldif,     & !< surface albedo for longwave diffuse radiation
                                                 rrtm_aldir,     & !< surface albedo for longwave direct radiation
@@ -316,4 +327,5 @@
                                                 rrtm_sw_asmaer, & !< sw aerosol asymmetry parameter
                                                 rrtm_sw_ecaer     !< sw aerosol optical detph at 0.55 microns (rrtm_iaer = 6 only)
+
 #endif
 
@@ -341,13 +353,17 @@
     PUBLIC albedo, albedo_type, albedo_type_name, albedo_lw_dif, albedo_lw_dir,&
            albedo_sw_dif, albedo_sw_dir, constant_albedo, day_init, dots_rad,  &
-           dt_radiation, init_radiation, lambda, lw_radiation, net_radiation,  &
-           rad_net, rad_net_av, radiation, radiation_clearsky,                 &
-           radiation_rrtmg, radiation_scheme, radiation_tendency, rad_lw_in,   &
-           rad_lw_in_av, rad_lw_out, rad_lw_out_av, rad_sw_in, rad_sw_in_av,   &
-           rad_sw_out, rad_sw_out_av, sigma_sb, sw_radiation, time_radiation,  &
-           time_utc_init 
+           dt_radiation, emissivity, force_radiation_call, init_radiation,     &
+           lambda, lw_radiation, net_radiation, rad_net, rad_net_av, radiation,&
+           radiation_clearsky, radiation_rrtmg, radiation_scheme,              &
+           radiation_tendency, rad_lw_in, rad_lw_in_av, rad_lw_out,            &
+           rad_lw_out_av, rad_lw_cs_hr, rad_lw_cs_hr_av, rad_lw_hr,            &
+           rad_lw_hr_av, rad_sw_in, rad_sw_in_av, rad_sw_out, rad_sw_out_av,   &
+           rad_sw_cs_hr, rad_sw_cs_hr_av, rad_sw_hr, rad_sw_hr_av, sigma_sb,   &
+           skip_time_do_radiation, sw_radiation, time_radiation, time_utc_init
+
 
 #if defined ( __rrtmg )
-    PUBLIC rrtm_aldif, rrtm_aldir, rrtm_asdif, rrtm_asdir
+    PUBLIC rrtm_aldif, rrtm_aldir, rrtm_asdif, rrtm_asdir, rrtm_idrv,          &
+           rrtm_lwuflx_dt
 #endif
 
@@ -483,22 +499,16 @@
 !
 !--       Allocate 3d arrays of radiative fluxes and heating rates
-          ALLOCATE ( rad_sw_hr(nzb+1:nzt+1,nysg:nyng,nxlg:nxrg) )
-          ALLOCATE ( rad_sw_cs_in(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
-          ALLOCATE ( rad_sw_cs_out(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
-          ALLOCATE ( rad_sw_cs_hr(nzb+1:nzt+1,nysg:nyng,nxlg:nxrg) )
-
           IF ( .NOT. ALLOCATED ( rad_sw_in ) )  THEN
              ALLOCATE ( rad_sw_in(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
              rad_sw_in = 0.0_wp
-
           ENDIF
 
           IF ( .NOT. ALLOCATED ( rad_sw_in_av ) )  THEN
              ALLOCATE ( rad_sw_in_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
-             rad_sw_out = 0.0_wp
           ENDIF
 
           IF ( .NOT. ALLOCATED ( rad_sw_out ) )  THEN
              ALLOCATE ( rad_sw_out(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+             rad_sw_out = 0.0_wp
           ENDIF
 
@@ -507,8 +517,23 @@
           ENDIF
 
-          ALLOCATE ( rad_lw_hr(nzb+1:nzt+1,nysg:nyng,nxlg:nxrg) )
-          ALLOCATE ( rad_lw_cs_in(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
-          ALLOCATE ( rad_lw_cs_out(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
-          ALLOCATE ( rad_lw_cs_hr(nzb+1:nzt+1,nysg:nyng,nxlg:nxrg) )
+          IF ( .NOT. ALLOCATED ( rad_sw_hr ) )  THEN
+             ALLOCATE ( rad_sw_hr(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+             rad_sw_hr = 0.0_wp
+          ENDIF
+
+          IF ( .NOT. ALLOCATED ( rad_sw_hr_av ) )  THEN
+             ALLOCATE ( rad_sw_hr_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+             rad_sw_hr_av = 0.0_wp
+          ENDIF
+
+          IF ( .NOT. ALLOCATED ( rad_sw_cs_hr ) )  THEN
+             ALLOCATE ( rad_sw_cs_hr(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+             rad_sw_cs_hr = 0.0_wp
+          ENDIF
+
+          IF ( .NOT. ALLOCATED ( rad_sw_cs_hr_av ) )  THEN
+             ALLOCATE ( rad_sw_cs_hr_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+             rad_sw_cs_hr_av = 0.0_wp
+          ENDIF
 
           IF ( .NOT. ALLOCATED ( rad_lw_in ) )  THEN
@@ -530,13 +555,33 @@
           ENDIF
 
-          rad_sw_hr     = 0.0_wp
+          IF ( .NOT. ALLOCATED ( rad_lw_hr ) )  THEN
+             ALLOCATE ( rad_lw_hr(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+             rad_lw_hr = 0.0_wp
+          ENDIF
+
+          IF ( .NOT. ALLOCATED ( rad_lw_hr_av ) )  THEN
+             ALLOCATE ( rad_lw_hr_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+             rad_lw_hr_av = 0.0_wp
+          ENDIF
+
+          IF ( .NOT. ALLOCATED ( rad_lw_cs_hr ) )  THEN
+             ALLOCATE ( rad_lw_cs_hr(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+             rad_lw_cs_hr = 0.0_wp
+          ENDIF
+
+          IF ( .NOT. ALLOCATED ( rad_lw_cs_hr_av ) )  THEN
+             ALLOCATE ( rad_lw_cs_hr_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+             rad_lw_cs_hr_av = 0.0_wp
+          ENDIF
+
+          ALLOCATE ( rad_sw_cs_in(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+          ALLOCATE ( rad_sw_cs_out(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
           rad_sw_cs_in  = 0.0_wp
           rad_sw_cs_out = 0.0_wp
-          rad_sw_cs_hr  = 0.0_wp
-
-          rad_lw_hr     = 0.0_wp
+
+          ALLOCATE ( rad_lw_cs_in(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+          ALLOCATE ( rad_lw_cs_out(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
           rad_lw_cs_in  = 0.0_wp
           rad_lw_cs_out = 0.0_wp
-          rad_lw_cs_hr  = 0.0_wp
 
 !
@@ -578,21 +623,23 @@
 !--    Add timeseries for radiation model
        dots_rad = dots_num + 1
-       dots_label(dots_num+1) = "rad_net"
-       dots_label(dots_num+2) = "rad_lw_in"
-       dots_label(dots_num+3) = "rad_lw_out"
-       dots_label(dots_num+4) = "rad_sw_in"
-       dots_label(dots_num+5) = "rad_sw_out"
-       dots_unit(dots_num+1:dots_num+5) = "W/m2"
-       dots_num  = dots_num + 5
+       dots_num = dots_num + 5
+
+       dots_label(dots_rad+1) = "rad_net"
+       dots_label(dots_rad+2) = "rad_lw_in"
+       dots_label(dots_rad+3) = "rad_lw_out"
+       dots_label(dots_rad+4) = "rad_sw_in"
+       dots_label(dots_rad+5) = "rad_sw_out"
+       dots_unit(dots_rad:dots_rad+4) = "W/m2"
 
 !
 !--    Output of albedos is only required for RRTMG
        IF ( radiation_scheme == 'rrtmg' )  THEN
-          dots_label(dots_num+1) = "rrtm_aldif"
-          dots_label(dots_num+2) = "rrtm_aldir"
-          dots_label(dots_num+3) = "rrtm_asdif"
-          dots_label(dots_num+4) = "rrtm_asdir"
-          dots_unit(dots_num+1:dots_num+4) = ""
           dots_num  = dots_num + 4
+          dots_label(dots_rad+5) = "rrtm_aldif"
+          dots_label(dots_rad+6) = "rrtm_aldir"
+          dots_label(dots_rad+7) = "rrtm_asdif"
+          dots_label(dots_rad+8) = "rrtm_asdir"
+          dots_unit(dots_num+5:dots_num+8) = ""
+
        ENDIF
 
@@ -624,5 +671,8 @@
        IMPLICIT NONE
 
-       INTEGER(iwp) :: i, j, k
+       INTEGER(iwp) :: i, j, k   !< loop indices
+       REAL(wp)     :: exn,   &  !< Exner functions at surface
+                       exn_1, &  !< Exner functions at first grid level
+                       pt_1      !< potential temperature at first grid level
 
 !
@@ -643,10 +693,20 @@
           DO j = nys, nyn
              k = nzb_s_inner(j,i)
+
+             exn_1 = (hyp(k+1) / 100000.0_wp )**0.286_wp
+
              rad_sw_in(0,j,i)  = solar_constant * sky_trans * zenith(0)
              rad_sw_out(0,j,i) = alpha(j,i) * rad_sw_in(0,j,i)
-             rad_lw_out(0,j,i) = sigma_sb * (pt(k,j,i) * exn)**4
-             rad_lw_in(0,j,i)  = 0.8_wp * sigma_sb * (pt(k+1,j,i) * exn)**4
-             rad_net(j,i)      = rad_sw_in(0,j,i) - rad_sw_out(0,j,i)          &
-                                 + rad_lw_in(0,j,i) - rad_lw_out(0,j,i)
+             rad_lw_out(0,j,i) = emissivity * sigma_sb * (pt(k,j,i) * exn)**4
+
+             IF ( cloud_physics )  THEN
+                pt_1 = pt(k+1,j,i) + l_d_cp / exn_1 * ql(k+1,j,i)
+                rad_lw_in(0,j,i)  = 0.8_wp * sigma_sb * (pt_1 * exn_1)**4
+             ELSE
+                rad_lw_in(0,j,i)  = 0.8_wp * sigma_sb * (pt(k+1,j,i) * exn_1)**4
+             ENDIF
+
+             rad_net(j,i) = rad_sw_in(0,j,i) - rad_sw_out(0,j,i)               &
+                            + rad_lw_in(0,j,i) - rad_lw_out(0,j,i)
 
           ENDDO
@@ -682,8 +742,8 @@
 #if defined ( __rrtmg )
 
-       INTEGER(iwp) :: i, j, k, n          !< 
-
-       REAL(wp)     ::  s_r2      !< weighted sum over all droplets with r^2
-       REAL(wp)     ::  s_r3      !< weighted sum over all droplets with r^3
+       INTEGER(iwp) :: i, j, k, n !< loop indices
+
+       REAL(wp)     ::  s_r2, &   !< weighted sum over all droplets with r^2
+                        s_r3      !< weighted sum over all droplets with r^3
 
 !
@@ -703,5 +763,5 @@
 !--    profile. nzt_rad might be modified by these calls and all required arrays
 !--    will then be re-allocated
-       IF ( large_scale_forcing  .AND.  lsf_surf ) THEN
+       IF ( large_scale_forcing  .AND.  lsf_surf )  THEN
           CALL read_sounding_data
           CALL read_trace_gas_data
@@ -714,10 +774,11 @@
 !
 !--          Prepare profiles of temperature and H2O volume mixing ratio
-             rrtm_tlev(0,nzb+1) = pt(nzb,j,i)
+             rrtm_tlev(0,nzb+1) = pt(nzb,j,i) * ( surface_pressure             &
+                                                  / 1000.0_wp )**0.286_wp
 
              DO k = nzb+1, nzt+1
                 rrtm_tlay(0,k) = pt(k,j,i) * ( (hyp(k) ) / 100000.0_wp         &
-                                 )**0.286_wp + ( l_v / cp ) * ql(k,j,i)
-                rrtm_h2ovmr(0,k) = mol_weight_air_d_wv * (q(k,j,i) - ql(k,j,i))
+                                 )**0.286_wp + l_d_cp * ql(k,j,i)
+                rrtm_h2ovmr(0,k) = mol_mass_air_d_wv * (q(k,j,i) - ql(k,j,i))
 
              ENDDO
@@ -754,20 +815,23 @@
              rrtm_reliq  = 0.0_wp
              rrtm_cliqwp = 0.0_wp
+             rrtm_icld   = 0
 
              DO k = nzb+1, nzt+1
-                rrtm_cliqwp(0,k) =  ql(k,j,i) * 1000.0_wp *                      &
-                                  (rrtm_plev(0,k) - rrtm_plev(0,k+1)) * 100.0_wp / g 
-
-                IF ( rrtm_cliqwp(0,k) .GT. 0 )  THEN
+                rrtm_cliqwp(0,k) =  ql(k,j,i) * 1000.0_wp *                    &
+                                    (rrtm_plev(0,k) - rrtm_plev(0,k+1))        &
+                                    * 100.0_wp / g 
+
+                IF ( rrtm_cliqwp(0,k) > 0.0_wp )  THEN
                    rrtm_cldfr(0,k) = 1.0_wp
-                   rrtm_icld = 1
+                   IF ( rrtm_icld == 0 )  rrtm_icld = 1
 
 !
 !--                Calculate cloud droplet effective radius
                    IF ( cloud_physics )  THEN
-                      rrtm_reliq(0,k) = 1.0E6_wp * ( 3.0_wp * ql(k,j,i)          &
-                                      / ( 4.0_wp * pi * nc_const * rho_l )     &
-                                      )**0.33333333333333_wp                   &
-                                     * EXP( LOG( sigma_gc )**2 )
+                      rrtm_reliq(0,k) = 1.0E6_wp * ( 3.0_wp * ql(k,j,i)        &
+                                        * rho_surface                          &
+                                        / ( 4.0_wp * pi * nc_const * rho_l )   &
+                                        )**0.33333333333333_wp                 &
+                                        * EXP( LOG( sigma_gc )**2 )
 
                    ELSEIF ( cloud_droplets )  THEN
@@ -794,10 +858,8 @@
 !
 !--                Limit effective radius
-                   IF ( rrtm_reliq(0,k) .GT. 0.0_wp )  THEN
+                   IF ( rrtm_reliq(0,k) > 0.0_wp )  THEN
                       rrtm_reliq(0,k) = MAX(rrtm_reliq(0,k),2.5_wp)
                       rrtm_reliq(0,k) = MIN(rrtm_reliq(0,k),60.0_wp)
                   ENDIF
-                ELSE
-                   rrtm_icld = 0
                 ENDIF
              ENDDO
@@ -817,6 +879,9 @@
                rrtm_reliq      , rrtm_lw_tauaer,                               &
                rrtm_lwuflx     , rrtm_lwdflx  , rrtm_lwhr  ,                   &
-               rrtm_lwuflxc    , rrtm_lwdflxc , rrtm_lwhrc )
-
+               rrtm_lwuflxc    , rrtm_lwdflxc , rrtm_lwhrc ,                   &
+               rrtm_lwuflx_dt  ,  rrtm_lwuflxc_dt )
+
+!
+!--             Save fluxes
                 DO k = nzb, nzt+1
                    rad_lw_in(k,j,i)  = rrtm_lwdflx(0,k)
@@ -824,4 +889,10 @@
                 ENDDO
 
+!
+!--             Save heating rates (convert from K/d to K/h)
+                DO k = nzb+1, nzt+1
+                   rad_lw_hr(k,j,i)     = rrtm_lwhr(0,k)  * d_hours_day
+                   rad_lw_cs_hr(k,j,i)  = rrtm_lwhrc(0,k) * d_hours_day
+                ENDDO
 
              ENDIF
@@ -841,8 +912,18 @@
                rrtm_swuflxc    , rrtm_swdflxc , rrtm_swhrc )
   
+!
+!--             Save fluxes
                 DO k = nzb, nzt+1
                    rad_sw_in(k,j,i)  = rrtm_swdflx(0,k)
                    rad_sw_out(k,j,i) = rrtm_swuflx(0,k)
                 ENDDO
+
+!
+!--             Save heating rates (convert from K/d to K/s)
+                DO k = nzb+1, nzt+1
+                   rad_sw_hr(k,j,i)     = rrtm_swhr(0,k)  * d_hours_day
+                   rad_sw_cs_hr(k,j,i)  = rrtm_swhrc(0,k) * d_hours_day
+                ENDDO
+
              ENDIF
 
@@ -857,6 +938,12 @@
        CALL exchange_horiz( rad_lw_in,  nbgp )
        CALL exchange_horiz( rad_lw_out, nbgp )
+       CALL exchange_horiz( rad_lw_hr,    nbgp )
+       CALL exchange_horiz( rad_lw_cs_hr, nbgp )
+
        CALL exchange_horiz( rad_sw_in,  nbgp )
        CALL exchange_horiz( rad_sw_out, nbgp ) 
+       CALL exchange_horiz( rad_sw_hr,    nbgp )
+       CALL exchange_horiz( rad_sw_cs_hr, nbgp )
+
        CALL exchange_horiz_2d( rad_net, nbgp )
 #endif
@@ -897,5 +984,5 @@
 !
 !--    Check if the sun is up (otheriwse shortwave calculations can be skipped)
-       IF ( zenith(0) .GT. 0.0_wp )  THEN
+       IF ( zenith(0) > 0.0_wp )  THEN
           sun_up = .TRUE.
        ELSE
@@ -996,9 +1083,16 @@
        IMPLICIT NONE
 
-       INTEGER(iwp) :: id, id_dim_zrad, id_var, k, nz_snd, nz_snd_start, nz_snd_end
-
-       REAL(wp) :: t_surface
-
-       REAL(wp), DIMENSION(:), ALLOCATABLE ::  hyp_snd_tmp, t_snd_tmp
+       INTEGER(iwp) :: id,           & !< NetCDF id of input file
+                       id_dim_zrad,  & !< pressure level id in the NetCDF file
+                       id_var,       & !< NetCDF variable id
+                       k,            & !< loop index
+                       nz_snd,       & !< number of vertical levels in the sounding data
+                       nz_snd_start, & !< start vertical index for sounding data to be used
+                       nz_snd_end      !< end vertical index for souding data to be used
+
+       REAL(wp) :: t_surface           !< actual surface temperature
+
+       REAL(wp), DIMENSION(:), ALLOCATABLE ::  hyp_snd_tmp, & !< temporary hydrostatic pressure profile (sounding)
+                                               t_snd_tmp      !< temporary temperature profile (sounding)
 
 !
@@ -1014,4 +1108,5 @@
           DEALLOCATE ( rrtm_tlay )
           DEALLOCATE ( rrtm_tlev )
+
           DEALLOCATE ( rrtm_h2ovmr )
           DEALLOCATE ( rrtm_cicewp )
@@ -1022,10 +1117,14 @@
           DEALLOCATE ( rrtm_lw_taucld )
           DEALLOCATE ( rrtm_lw_tauaer )
+
           DEALLOCATE ( rrtm_lwdflx  )
+          DEALLOCATE ( rrtm_lwdflxc )
           DEALLOCATE ( rrtm_lwuflx  )
+          DEALLOCATE ( rrtm_lwuflxc )
+          DEALLOCATE ( rrtm_lwuflx_dt )
+          DEALLOCATE ( rrtm_lwuflxc_dt )
           DEALLOCATE ( rrtm_lwhr  )
-          DEALLOCATE ( rrtm_lwuflxc )
-          DEALLOCATE ( rrtm_lwdflxc )
           DEALLOCATE ( rrtm_lwhrc )
+
           DEALLOCATE ( rrtm_sw_taucld )
           DEALLOCATE ( rrtm_sw_ssacld )
@@ -1035,11 +1134,13 @@
           DEALLOCATE ( rrtm_sw_ssaaer )
           DEALLOCATE ( rrtm_sw_asmaer ) 
-          DEALLOCATE ( rrtm_sw_ecaer )    
+          DEALLOCATE ( rrtm_sw_ecaer )   
+ 
           DEALLOCATE ( rrtm_swdflx  )
+          DEALLOCATE ( rrtm_swdflxc )
           DEALLOCATE ( rrtm_swuflx  )
+          DEALLOCATE ( rrtm_swuflxc )
           DEALLOCATE ( rrtm_swhr  )
-          DEALLOCATE ( rrtm_swuflxc )
-          DEALLOCATE ( rrtm_swdflxc )
           DEALLOCATE ( rrtm_swhrc )
+
        ENDIF
 
@@ -1063,5 +1164,5 @@
 !--    Read pressure from file
        nc_stat = NF90_INQ_VARID( id, "Pressure", id_var )
-       nc_stat = NF90_GET_VAR( id, id_var, hyp_snd_tmp(:), start = (/1/),    &
+       nc_stat = NF90_GET_VAR( id, id_var, hyp_snd_tmp(:), start = (/1/),      &
                                count = (/nz_snd/) )
        CALL handle_netcdf_error( 'netcdf', 552 )
@@ -1075,5 +1176,5 @@
 !--    Read temperature from file
        nc_stat = NF90_INQ_VARID( id, "ReferenceTemperature", id_var )
-       nc_stat = NF90_GET_VAR( id, id_var, t_snd_tmp(:), start = (/1/),      &
+       nc_stat = NF90_GET_VAR( id, id_var, t_snd_tmp(:), start = (/1/),        &
                                count = (/nz_snd/) )
        CALL handle_netcdf_error( 'netcdf', 553 )
@@ -1088,5 +1189,5 @@
 !--    in Pa, hyp_snd in hPa).
        DO  k = 1, nz_snd
-          IF ( hyp_snd_tmp(k) .LT. (hyp(nzt+1) - 1000.0_wp) * 0.01_wp )  THEN
+          IF ( hyp_snd_tmp(k) < ( hyp(nzt+1) - 1000.0_wp) * 0.01_wp )  THEN
              nz_snd_start = k
              EXIT
@@ -1094,5 +1195,5 @@
        END DO
 
-       IF ( nz_snd_start .LE. nz_snd )  THEN
+       IF ( nz_snd_start <= nz_snd )  THEN
           nz_snd_end = nz_snd - 1
        END IF
@@ -1128,5 +1229,5 @@
        ALLOCATE ( rrtm_plev(0:0,nzb+1:nzt_rad+2)   )
 
-       t_surface = pt_surface * (surface_pressure / 1000.0_wp )**0.286_wp
+       t_surface = pt_surface * ( surface_pressure / 1000.0_wp )**0.286_wp
        DO k = nzb+1, nzt+1
           rrtm_play(0,k) = hyp(k) * 0.01_wp
@@ -1160,6 +1261,6 @@
           rrtm_h2ovmr(0,k) = q_snd(k)
        ENDDO
-       rrtm_tlay(0,nzt_rad+1)   = 2.0_wp * rrtm_tlay(0,nzt_rad)                &
-                                  - rrtm_tlay(0,nzt_rad-1)
+       rrtm_tlay(0,nzt_rad+1) = 2.0_wp * rrtm_tlay(0,nzt_rad)                 &
+                                - rrtm_tlay(0,nzt_rad-1)
        DO k = nzt+9, nzt_rad+1
           rrtm_tlev(0,k)   = rrtm_tlay(0,k-1) + (rrtm_tlay(0,k)                &
@@ -1237,4 +1338,9 @@
        rrtm_lwhrc   = 0.0_wp
 
+       ALLOCATE ( rrtm_lwuflx_dt(0:0,nzb:nzt_rad+1) )
+       ALLOCATE ( rrtm_lwuflxc_dt(0:0,nzb:nzt_rad+1) )
+
+       rrtm_lwuflxc_dt = 0.0_wp
+       rrtm_lwuflxc_dt = 0.0_wp
 
     END SUBROUTINE read_sounding_data
@@ -1253,11 +1359,19 @@
        IMPLICIT NONE
 
-       INTEGER(iwp), PARAMETER :: num_trace_gases = 9 !< number of trace gases
-
-       CHARACTER(LEN=5), DIMENSION(num_trace_gases), PARAMETER ::              &
+       INTEGER(iwp), PARAMETER :: num_trace_gases = 9 !< number of trace gases (absorbers)
+
+       CHARACTER(LEN=5), DIMENSION(num_trace_gases), PARAMETER ::              & !< trace gas names
            trace_names = (/'O3   ', 'CO2  ', 'CH4  ', 'N2O  ', 'O2   ',        &
                            'CFC11', 'CFC12', 'CFC22', 'CCL4 '/)
 
-       INTEGER(iwp) :: id, k, m, n, nabs, np, id_abs, id_dim, id_var
+       INTEGER(iwp) :: id,     & !< NetCDF id
+                       k,      & !< loop index
+                       m,      & !< loop index
+                       n,      & !< loop index
+                       nabs,   & !< number of absorbers
+                       np,     & !< number of pressure levels
+                       id_abs, & !< NetCDF id of the respective absorber
+                       id_dim, & !< NetCDF id of asborber's dimension
+                       id_var    !< NetCDf id ot the absorber
 
        REAL(wp) :: p_mls_l, p_mls_u, p_wgt_l, p_wgt_u, p_mls_m
@@ -1380,5 +1494,5 @@
 !--          When the pressure level is higher than the trace gas pressure
 !--          level, assume that 
-             IF ( rrtm_plev_tmp(k-1) .GT. p_mls(1) )  THEN             
+             IF ( rrtm_plev_tmp(k-1) > p_mls(1) )  THEN             
                 
                 trace_mls_path(k,m) = trace_mls_path(k,m) + trace_mls(m,1)     &
@@ -1399,5 +1513,5 @@
                           MAX( rrtm_plev_tmp(k), p_mls(n-1) ) )
 
-                IF ( p_mls_l .GT. p_mls_u )  THEN
+                IF ( p_mls_l > p_mls_u )  THEN
 
 !
@@ -1412,9 +1526,9 @@
                                          +  ( p_wgt_u * trace_mls(m,n)         &
                                             + p_wgt_l * trace_mls(m,n-1) )     &
-                                         * (p_mls_l + p_mls_u) / g
+                                         * (p_mls_l - p_mls_u) / g
                 ENDIF
              ENDDO
 
-             IF ( rrtm_plev_tmp(k) .LT. p_mls(np) )  THEN 
+             IF ( rrtm_plev_tmp(k) < p_mls(np) )  THEN 
                 trace_mls_path(k,m) = trace_mls_path(k,m) + trace_mls(m,np)    &
                                       * ( MIN( rrtm_plev_tmp(k-1), p_mls(np) ) &
@@ -1503,40 +1617,19 @@
     SUBROUTINE radiation_tendency_ij ( i, j, tend )
 
-       USE arrays_3d,                                                          &
-           ONLY:  dzw
-
        USE cloud_parameters,                                                   &
-           ONLY:  pt_d_t, cp
-
-       USE control_parameters,                                                 &
-           ONLY:  rho_surface
+           ONLY:  pt_d_t
 
        IMPLICIT NONE
 
-       INTEGER(iwp) :: i, j, k
-
-       REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) :: tend
+       INTEGER(iwp) :: i, j, k !< loop indices
+
+       REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) :: tend !< pt tendency term
 
 #if defined ( __rrtmg )
-
-       REAL(wp) :: rad_sw_net_l, rad_sw_net_u, rad_lw_net_l, rad_lw_net_u
-
-       rad_sw_net_l = 0.0_wp
-       rad_sw_net_u = 0.0_wp
-       rad_lw_net_l = 0.0_wp
-       rad_lw_net_u = 0.0_wp
-
-!
-!--    Calculate radiative flux divergence
+!
+!--    Calculate tendency based on heating rate
        DO k = nzb+1, nzt+1
-
-          rad_sw_net_l = rad_sw_in(k-1,j,i) - rad_sw_out(k-1,j,i)
-          rad_sw_net_u = rad_sw_in(k,j,i)   - rad_sw_out(k,j,i)
-          rad_lw_net_l = rad_lw_in(k-1,j,i) - rad_lw_out(k-1,j,i)
-          rad_lw_net_u = rad_lw_in(k,j,i)   - rad_lw_out(k,j,i)
-
-          tend(k,j,i) = tend(k,j,i) + ( rad_sw_net_u - rad_sw_net_l            &
-                                      + rad_lw_net_u - rad_lw_net_l ) /        &
-                                     ( dzw(k) * cp * rho_surface ) * pt_d_t(k) 
+          tend(k,j,i) = tend(k,j,i) + (rad_lw_hr(k,j,i) + rad_sw_hr(k,j,i))    &
+                                      * pt_d_t(k) * d_seconds_hour
        ENDDO
 
@@ -1554,46 +1647,25 @@
     SUBROUTINE radiation_tendency ( tend )
 
-       USE arrays_3d,                                                          &
-           ONLY:  dzw
-
        USE cloud_parameters,                                                   &
-           ONLY:  pt_d_t, cp
+           ONLY:  pt_d_t
 
        USE indices,                                                            &
            ONLY:  nxl, nxr, nyn, nys
 
-       USE control_parameters,                                                 &
-           ONLY:  rho_surface
-
        IMPLICIT NONE
 
-       INTEGER(iwp) :: i, j, k
-
-       REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) :: tend
+       INTEGER(iwp) :: i, j, k !< loop indices
+
+       REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) :: tend !< pt tendency term
 
 #if defined ( __rrtmg )
-
-       REAL(wp) :: rad_sw_net_l, rad_sw_net_u, rad_lw_net_l, rad_lw_net_u
-
-       rad_sw_net_l = 0.0_wp
-       rad_sw_net_u = 0.0_wp
-       rad_lw_net_l = 0.0_wp
-       rad_lw_net_u = 0.0_wp
-
+!
+!--    Calculate tendency based on heating rate
        DO  i = nxl, nxr
           DO  j = nys, nyn
-
-!
-!--          Calculate radiative flux divergence
              DO k = nzb+1, nzt+1
-
-                rad_sw_net_l = rad_sw_in(k-1,j,i) - rad_sw_out(k-1,j,i)
-                rad_sw_net_u = rad_sw_in(k  ,j,i) - rad_sw_out(k  ,j,i)
-                rad_lw_net_l = rad_lw_in(k-1,j,i) - rad_lw_out(k-1,j,i)
-                rad_lw_net_u = rad_lw_in(k  ,j,i) - rad_lw_out(k  ,j,i)
-
-                tend(k,j,i) = tend(k,j,i) + ( rad_sw_net_u - rad_sw_net_l      &
-                                      + rad_lw_net_u - rad_lw_net_l ) /        &
-                                      ( dzw(k) * cp * rho_surface ) * pt_d_t(k) 
+                tend(k,j,i) = tend(k,j,i) + ( rad_lw_hr(k,j,i)                 &
+                                            +  rad_sw_hr(k,j,i) ) * pt_d_t(k)  &
+                                            * d_seconds_hour
              ENDDO
          ENDDO
Index: palm/trunk/SOURCE/read_3d_binary.f90
===================================================================
--- palm/trunk/SOURCE/read_3d_binary.f90	(revision 1686)
+++ palm/trunk/SOURCE/read_3d_binary.f90	(revision 1691)
@@ -14,10 +14,11 @@
 ! PALM. If not, see <http://www.gnu.org/licenses/>.
 !
-! Copyright 1997-2014 Leibniz Universitaet Hannover
+! Copyright 1997-2015 Leibniz Universitaet Hannover
 !--------------------------------------------------------------------------------!
 !
 ! Current revisions:
 ! -----------------
-! 
+! Added output of radiative heating rates and Obukhov length. Removed output of
+! rif.
 ! 
 ! Former revisions:
@@ -83,6 +84,6 @@
 
     USE arrays_3d,                                                             &
-        ONLY:  e, kh, km, p, pt, q, ql, qc, nr, nrs, nrsws, nrswst, qr, qrs,   &
-               qrsws, qrswst, qs, qsws, qswst, sa, saswsb, saswst, rif,        &
+        ONLY:  e, kh, km, ol, p, pt, q, ql, qc, nr, nrs, nrsws, nrswst, qr,    &
+               qrs, qrsws, qrswst, qs, qsws, qswst, sa, saswsb, saswst,        &
                rif_wall, shf, ts, tswst, u, u_m_l, u_m_n, u_m_r, u_m_s, us,    &
                usws, uswst, v, v_m_l, v_m_n, v_m_r, v_m_s, vpt, vsws, vswst,   &
@@ -119,5 +120,8 @@
     USE radiation_model_mod,                                                   &
         ONLY: rad_net, rad_net_av, rad_lw_in, rad_lw_in_av, rad_lw_out,        &
-              rad_lw_out_av, rad_sw_in, rad_sw_in_av, rad_sw_out, rad_sw_out_av
+              rad_lw_cs_hr, rad_lw_cs_hr_av, rad_lw_hr, rad_lw_hr_av,          &
+              rad_lw_out_av, rad_sw_in, rad_sw_in_av, rad_sw_out,              &
+              rad_sw_out_av, rad_sw_cs_hr, rad_sw_cs_hr_av, rad_sw_hr,         &
+              rad_sw_hr_av
 
     USE random_function_mod,                                                   &
@@ -595,4 +599,8 @@
                    nrswst(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp)  = &
                                           tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+                CASE ( 'ol' )
+                   IF ( k == 1 )  READ ( 13 )  tmp_2d
+                   ol(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp)  = &
+                                         tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
                 CASE ( 'p' )
@@ -867,4 +875,36 @@
                              tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
+                CASE ( 'rad_lw_cs_hr' )
+                   IF ( .NOT. ALLOCATED( rad_lw_cs_hr ) )  THEN
+                      ALLOCATE( rad_lw_cs_hr(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+                   ENDIF
+                   IF ( k == 1 )  READ ( 13 )  tmp_3d
+                   rad_lw_cs_hr(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = &
+                           tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+
+                CASE ( 'rad_lw_cs_hr_av' )
+                   IF ( .NOT. ALLOCATED( rad_lw_out_av ) )  THEN
+                      ALLOCATE( rad_lw_cs_hr_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+                   ENDIF
+                   IF ( k == 1 )  READ ( 13 )  tmp_3d
+                   rad_lw_cs_hr_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = &
+                           tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+
+                CASE ( 'rad_lw_hr' )
+                   IF ( .NOT. ALLOCATED( rad_lw_hr ) )  THEN
+                      ALLOCATE( rad_lw_hr(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+                   ENDIF
+                   IF ( k == 1 )  READ ( 13 )  tmp_3d
+                   rad_lw_hr(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = &
+                           tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+
+                CASE ( 'rad_lw_hr_av' )
+                   IF ( .NOT. ALLOCATED( rad_lw_hr_av ) )  THEN
+                      ALLOCATE( rad_lw_hr_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+                   ENDIF
+                   IF ( k == 1 )  READ ( 13 )  tmp_3d
+                   rad_lw_hr_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = &
+                           tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+
                 CASE ( 'rad_sw_in' )
                    IF ( .NOT. ALLOCATED( rad_sw_in ) )  THEN
@@ -898,4 +938,36 @@
                    rad_sw_out_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = &
                              tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+
+                CASE ( 'rad_sw_cs_hr' )
+                   IF ( .NOT. ALLOCATED( rad_sw_cs_hr ) )  THEN
+                      ALLOCATE( rad_sw_cs_hr(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+                   ENDIF
+                   IF ( k == 1 )  READ ( 13 )  tmp_3d
+                   rad_sw_cs_hr(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = &
+                           tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+
+                CASE ( 'rad_sw_cs_hr_av' )
+                   IF ( .NOT. ALLOCATED( rad_sw_out_av ) )  THEN
+                      ALLOCATE( rad_sw_cs_hr_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+                   ENDIF
+                   IF ( k == 1 )  READ ( 13 )  tmp_3d
+                   rad_sw_cs_hr_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = &
+                           tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+
+                CASE ( 'rad_sw_hr' )
+                   IF ( .NOT. ALLOCATED( rad_sw_hr ) )  THEN
+                      ALLOCATE( rad_sw_hr(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+                   ENDIF
+                   IF ( k == 1 )  READ ( 13 )  tmp_3d
+                   rad_sw_hr(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = &
+                           tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+
+                CASE ( 'rad_sw_hr_av' )
+                   IF ( .NOT. ALLOCATED( rad_sw_hr_av ) )  THEN
+                      ALLOCATE( rad_sw_hr_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+                   ENDIF
+                   IF ( k == 1 )  READ ( 13 )  tmp_3d
+                   rad_lw_hr_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = &
+                           tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
                 CASE ( 'random_iv' )  ! still unresolved issue
@@ -914,9 +986,4 @@
                    rho_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = &
                                 tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-
-                CASE ( 'rif' )
-                   IF ( k == 1 )  READ ( 13 )  tmp_2d
-                   rif(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp)  = &
-                                         tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
                 CASE ( 'rif_wall' )
Index: palm/trunk/SOURCE/read_var_list.f90
===================================================================
--- palm/trunk/SOURCE/read_var_list.f90	(revision 1686)
+++ palm/trunk/SOURCE/read_var_list.f90	(revision 1691)
@@ -14,10 +14,11 @@
 ! PALM. If not, see <http://www.gnu.org/licenses/>.
 !
-! Copyright 1997-2014 Leibniz Universitaet Hannover
+! Copyright 1997-2015 Leibniz Universitaet Hannover
 !--------------------------------------------------------------------------------!
 !
 ! Current revisions:
 ! ------------------
-! 
+! Added output of most_method, constant_flux_layer, zeta_min, zeta_max. Removed 
+! output of prandtl_layer and rif_min, rif_max.
 ! 
 ! Former revisions:
@@ -179,4 +180,5 @@
         ONLY:  statistic_regions, hom, hom_sum, pr_palm, u_max, u_max_ijk,     &
                v_max, v_max_ijk, w_max, w_max_ijk
+
 
     IMPLICIT NONE
@@ -356,4 +358,6 @@
           CASE ( 'conserve_volume_flow_mode' )
              READ ( 13 )  conserve_volume_flow_mode
+          CASE ( 'constant_flux_layer' )
+             READ ( 13 )  constant_flux_layer
           CASE ( 'coupling_start_time' )
              READ ( 13 )  coupling_start_time
@@ -460,4 +464,6 @@
           CASE ( 'momentum_advec' )
              READ ( 13 )  momentum_advec
+          CASE ( 'most_method' )
+             READ ( 13 )  most_method
           CASE ( 'nc_const' )
              READ ( 13 )  nc_const
@@ -494,6 +500,4 @@
           CASE ( 'phi' )
              READ ( 13 )  phi
-          CASE ( 'prandtl_layer' )
-             READ ( 13 )  prandtl_layer
           CASE ( 'prandtl_number' )
              READ ( 13 )  prandtl_number
@@ -552,8 +556,4 @@
           CASE ( 'residual_limit' )
              READ ( 13 )  residual_limit
-          CASE ( 'rif_max' )
-             READ ( 13 )  rif_max
-          CASE ( 'rif_min' )
-             READ ( 13 )  rif_min
           CASE ( 'roughness_length' )
              READ ( 13 )  roughness_length
@@ -714,4 +714,8 @@
           CASE ( 'w_max_ijk' )
              READ ( 13 )  w_max_ijk
+          CASE ( 'zeta_max' )
+             READ ( 13 )  zeta_max
+          CASE ( 'zeta_min' )
+             READ ( 13 )  zeta_min
           CASE ( 'z0h_factor' )
              READ ( 13 )  z0h_factor
Index: palm/trunk/SOURCE/sum_up_3d_data.f90
===================================================================
--- palm/trunk/SOURCE/sum_up_3d_data.f90	(revision 1686)
+++ palm/trunk/SOURCE/sum_up_3d_data.f90	(revision 1691)
@@ -14,10 +14,11 @@
 ! PALM. If not, see <http://www.gnu.org/licenses/>.
 !
-! Copyright 1997-2014 Leibniz Universitaet Hannover
+! Copyright 1997-2015 Leibniz Universitaet Hannover
 !--------------------------------------------------------------------------------!
 !
 ! Current revisions:
 ! -----------------
-! 
+! Added output of Obukhov length and radiative heating rates for RRTMG. 
+! Corrected output of LWC.
 ! 
 ! Former revisions:
@@ -84,9 +85,9 @@
 
     USE arrays_3d,                                                             &
-        ONLY:  dzw, e, nr, p, pt, q, qc, ql, ql_c, ql_v, qr, qsws, rho, sa,    &
+        ONLY:  dzw, e, nr, ol, p, pt, q, qc, ql, ql_c, ql_v, qr, qsws, rho, sa,&
                shf, ts, u, us, v, vpt, w, z0, z0h
 
     USE averaging,                                                             &
-        ONLY:  e_av, lpt_av, lwp_av, nr_av, p_av, pc_av, pr_av, prr_av,        &
+        ONLY:  e_av, lpt_av, lwp_av, nr_av, ol_av, p_av, pc_av, pr_av, prr_av, &
                precipitation_rate_av, pt_av, q_av, qc_av, ql_av, ql_c_av,      &
                ql_v_av, ql_vp_av, qr_av, qsws_av, qv_av, rho_av, s_av, sa_av,  &
@@ -97,5 +98,5 @@
 
     USE control_parameters,                                                    &
-        ONLY:  average_count_3d, cloud_physics, doav, doav_n
+        ONLY:  average_count_3d, cloud_physics, doav, doav_n, rho_surface
 
     USE cpulog,                                                                &
@@ -120,6 +121,9 @@
     USE radiation_model_mod,                                                   &
         ONLY:  rad_net, rad_net_av, rad_sw_in, rad_sw_in_av, rad_sw_out,       &
-               rad_sw_out_av, rad_lw_in, rad_lw_in_av, rad_lw_out,             &
-               rad_lw_out_av
+               rad_sw_out_av, rad_sw_cs_hr, rad_sw_cs_hr_av, rad_sw_hr,        &
+               rad_sw_hr_av, rad_lw_in, rad_lw_in_av, rad_lw_out,              &
+               rad_lw_out_av, rad_lw_cs_hr, rad_lw_cs_hr_av, rad_lw_hr,        &
+               rad_lw_hr_av
+
 
     IMPLICIT NONE
@@ -215,4 +219,10 @@
                 nr_av = 0.0_wp
 
+             CASE ( 'ol*' )
+                IF ( .NOT. ALLOCATED( ol_av ) )  THEN
+                   ALLOCATE( ol_av(nysg:nyng,nxlg:nxrg) )
+                ENDIF
+                ol_av = 0.0_wp
+
              CASE ( 'p' )
                 IF ( .NOT. ALLOCATED( p_av ) )  THEN
@@ -347,4 +357,16 @@
                 rad_lw_out_av = 0.0_wp
 
+             CASE ( 'rad_lw_cs_hr' )
+                IF ( .NOT. ALLOCATED( rad_lw_cs_hr_av ) )  THEN
+                   ALLOCATE( rad_lw_cs_hr_av(nzb+1:nzt+1,nysg:nyng,nxlg:nxrg) )
+                ENDIF
+                rad_lw_cs_hr_av = 0.0_wp
+
+             CASE ( 'rad_lw_hr' )
+                IF ( .NOT. ALLOCATED( rad_lw_hr_av ) )  THEN
+                   ALLOCATE( rad_lw_hr_av(nzb+1:nzt+1,nysg:nyng,nxlg:nxrg) )
+                ENDIF
+                rad_lw_hr_av = 0.0_wp
+
              CASE ( 'rad_sw_in' )
                 IF ( .NOT. ALLOCATED( rad_sw_in_av ) )  THEN
@@ -359,4 +381,16 @@
                 rad_sw_out_av = 0.0_wp
 
+             CASE ( 'rad_sw_cs_hr' )
+                IF ( .NOT. ALLOCATED( rad_sw_cs_hr_av ) )  THEN
+                   ALLOCATE( rad_sw_cs_hr_av(nzb+1:nzt+1,nysg:nyng,nxlg:nxrg) )
+                ENDIF
+                rad_sw_cs_hr_av = 0.0_wp
+
+             CASE ( 'rad_sw_hr' )
+                IF ( .NOT. ALLOCATED( rad_sw_hr_av ) )  THEN
+                   ALLOCATE( rad_sw_hr_av(nzb+1:nzt+1,nysg:nyng,nxlg:nxrg) )
+                ENDIF
+                rad_sw_hr_av = 0.0_wp
+
              CASE ( 'rho' )
                 IF ( .NOT. ALLOCATED( rho_av ) )  THEN
@@ -530,6 +564,6 @@
              DO  i = nxlg, nxrg
                 DO  j = nysg, nyng
-                   lwp_av(j,i) = lwp_av(j,i) + SUM( ql(nzb:nzt,j,i) * &
-                                                    dzw(1:nzt+1) )
+                   lwp_av(j,i) = lwp_av(j,i) + SUM( ql(nzb:nzt,j,i)            &
+                                               * dzw(1:nzt+1) ) * rho_surface
                 ENDDO
              ENDDO
@@ -557,4 +591,11 @@
                       nr_av(k,j,i) = nr_av(k,j,i) + nr(k,j,i)
                    ENDDO
+                ENDDO
+             ENDDO
+
+          CASE ( 'ol*' )
+             DO  i = nxlg, nxrg
+                DO  j = nysg, nyng
+                   ol_av(j,i) = ol_av(j,i) + ol(j,i)
                 ENDDO
              ENDDO
@@ -777,4 +818,21 @@
              ENDDO
 
+          CASE ( 'rad_lw_cs_hr' )
+             DO  i = nxlg, nxrg
+                DO  j = nysg, nyng
+                   DO  k = nzb, nzt+1
+                      rad_lw_cs_hr_av(k,j,i) = rad_lw_cs_hr_av(k,j,i) + rad_lw_cs_hr(k,j,i)
+                   ENDDO
+                ENDDO
+             ENDDO
+
+          CASE ( 'rad_lw_hr' )
+             DO  i = nxlg, nxrg
+                DO  j = nysg, nyng
+                   DO  k = nzb, nzt+1
+                      rad_lw_hr_av(k,j,i) = rad_lw_hr_av(k,j,i) + rad_lw_hr(k,j,i)
+                   ENDDO
+                ENDDO
+             ENDDO
 
           CASE ( 'rad_sw_in' )
@@ -792,4 +850,22 @@
                    DO  k = nzb, nzt+1
                       rad_sw_out_av(k,j,i) = rad_sw_out_av(k,j,i) + rad_sw_out(k,j,i)
+                   ENDDO
+                ENDDO
+             ENDDO
+
+          CASE ( 'rad_sw_cs_hr' )
+             DO  i = nxlg, nxrg
+                DO  j = nysg, nyng
+                   DO  k = nzb, nzt+1
+                      rad_sw_cs_hr_av(k,j,i) = rad_sw_cs_hr_av(k,j,i) + rad_sw_cs_hr(k,j,i)
+                   ENDDO
+                ENDDO
+             ENDDO
+
+          CASE ( 'rad_sw_hr' )
+             DO  i = nxlg, nxrg
+                DO  j = nysg, nyng
+                   DO  k = nzb, nzt+1
+                      rad_sw_hr_av(k,j,i) = rad_sw_hr_av(k,j,i) + rad_sw_hr(k,j,i)
                    ENDDO
                 ENDDO
Index: palm/trunk/SOURCE/surface_layer_fluxes.f90
===================================================================
--- palm/trunk/SOURCE/surface_layer_fluxes.f90	(revision 1691)
+++ palm/trunk/SOURCE/surface_layer_fluxes.f90	(revision 1691)
@@ -0,0 +1,1093 @@
+!> @file surface_layer_fluxes.f90
+!--------------------------------------------------------------------------------!
+! This file is part of PALM.
+!
+! PALM is free software: you can redistribute it and/or modify it under the terms
+! of the GNU General Public License as published by the Free Software Foundation,
+! either version 3 of the License, or (at your option) any later version.
+!
+! PALM is distributed in the hope that it will be useful, but WITHOUT ANY
+! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+! A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+!
+! You should have received a copy of the GNU General Public License along with
+! PALM. If not, see <http://www.gnu.org/licenses/>.
+!
+! Copyright 1997-2015 Leibniz Universitaet Hannover
+!
+!--------------------------------------------------------------------------------!
+! Current revisions:
+! -----------------
+! Modularized and completely re-written version of prandtl_fluxes.f90. In the
+! course of the re-writing two additional methods have been implemented. See
+! updated description.
+!
+! Former revisions:
+! -----------------
+! $Id$
+!
+! 1551 2015-03-03 14:18:16Z maronga
+! Removed land surface model part. The surface fluxes are now always calculated
+! within prandtl_fluxes, based on the given surface temperature/humidity (which 
+! is either provided by the land surface model, by large scale forcing data, or
+! directly prescribed by the user.
+! 
+! 1496 2014-12-02 17:25:50Z maronga
+! Adapted for land surface model
+! 
+! 1494 2014-11-21 17:14:03Z maronga
+! Bugfixes: qs is now calculated before calculation of Rif. calculation of
+! buoyancy flux in Rif corrected (added missing humidity term), allow use of 
+! topography for coupled runs (not tested)
+! 
+! 1361 2014-04-16 15:17:48Z hoffmann
+! Bugfix: calculation of turbulent fluxes of rain water content (qrsws) and rain 
+! drop concentration (nrsws) added
+! 
+! 1340 2014-03-25 19:45:13Z kanani
+! REAL constants defined as wp-kind
+!
+! 1320 2014-03-20 08:40:49Z raasch
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
+!
+! 1276 2014-01-15 13:40:41Z heinze
+! Use LSF_DATA also in case of Dirichlet bottom boundary condition for scalars
+!
+! 1257 2013-11-08 15:18:40Z raasch
+! openACC "kernels do" replaced by "kernels loop", "loop independent" added
+!
+! 1036 2012-10-22 13:43:42Z raasch
+! code put under GPL (PALM 3.9)
+!
+! 1015 2012-09-27 09:23:24Z raasch
+! OpenACC statements added
+!
+! 978 2012-08-09 08:28:32Z fricke
+! roughness length for scalar quantities z0h added
+!
+! Revision 1.1  1998/01/23 10:06:06  raasch
+! Initial revision
+!
+!
+! Description:
+! ------------
+!> Diagnostic computation of vertical fluxes in the constant flux layer from the
+!> values of the variables at grid point k=1. Three different methods are
+!> available:
+!> 1) the "old" version (most_method = 'circular') which is fast, but inaccurate
+!> 2) a Newton iteration method (most_method = 'newton'), which is accurate, but
+!>    slower
+!> 3) a method using a lookup table which is fast and accurate. Note, however,
+!>    that this method cannot be used in case of roughness heterogeneity
+!>
+!> @todo limiting of uv_total might be required is some cases
+!> @todo (re)move large_scale_forcing actions
+!> @todo check/optimize OpenMP and OpenACC directives
+!------------------------------------------------------------------------------!
+ MODULE surface_layer_fluxes_mod
+
+    USE arrays_3d,                                                             &
+        ONLY:  e, kh, nr, nrs, nrsws, ol, pt, q, ql, qr, qrs, qrsws, qs, qsws, &
+               shf, ts, u, us, usws, v, vpt, vsws, zu, zw, z0, z0h
+
+    USE cloud_parameters,                                                      &
+        ONLY:  l_d_cp, pt_d_t
+
+    USE constants,                                                             &
+        ONLY:  pi
+
+    USE cpulog
+
+    USE control_parameters,                                                    &
+        ONLY:  cloud_physics, constant_heatflux, constant_waterflux,           &
+               coupling_mode, g, humidity, ibc_e_b, ibc_pt_b, icloud_scheme,   &
+               initializing_actions, kappa, intermediate_timestep_count,       &
+               intermediate_timestep_count_max, large_scale_forcing, lsf_surf, &
+               message_string, most_method, neutral, passive_scalar,           &
+               precipitation, pt_surface, q_surface, run_coupled,              &
+               surface_pressure, simulated_time, terminate_run, zeta_max,      &
+               zeta_min 
+
+    USE indices,                                                               &
+        ONLY:  nxl, nxlg, nxr, nxrg, nys, nysg, nyn, nyng, nzb_s_inner,        &
+               nzb_u_inner, nzb_v_inner
+
+    USE kinds
+
+    USE pegrid
+
+    USE land_surface_model_mod,                                                &
+        ONLY:  land_surface, skip_time_do_lsm
+
+    IMPLICIT NONE
+
+    INTEGER(iwp) ::  i            !< loop index x direction
+    INTEGER(iwp) ::  j            !< loop index y direction
+    INTEGER(iwp) ::  k            !< loop indey z direction
+
+    INTEGER(iwp), PARAMETER     :: num_steps = 15000  !< number of steps in the lookup table
+
+    LOGICAL      ::  coupled_run  !< Flag for coupled atmosphere-ocean runs
+
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE :: pt1,      & !< Potential temperature at first grid level (required for cloud_physics = .T.)
+                                             qv1,      & !< Specific humidity at first grid level (required for cloud_physics = .T.)
+                                             uv_total    !< Total velocity at first grid level
+
+    REAL(wp), DIMENSION(0:num_steps-1) :: rib_tab,  & !< Lookup table bulk Richardson number
+                                          ol_tab      !< Lookup table values of L
+
+    REAL(wp)     ::  e_s,               & !< Saturation water vapor pressure
+                     l_bnd  = 7500,     & !< Lookup table index of the last time step
+                     ol_max = 1.0E6_wp, & !< Maximum Obukhov length
+                     rib_max,           & !< Maximum Richardson number in lookup table
+                     rib_min,           & !< Minimum Richardson number in lookup table
+                     z_mo                 !< Height of the constant flux layer where MOST is assumed
+
+
+    SAVE
+
+    PRIVATE
+
+    PUBLIC init_surface_layer_fluxes, surface_layer_fluxes
+
+    INTERFACE init_surface_layer_fluxes
+       MODULE PROCEDURE init_surface_layer_fluxes
+    END INTERFACE init_surface_layer_fluxes
+
+    INTERFACE surface_layer_fluxes
+       MODULE PROCEDURE surface_layer_fluxes
+    END INTERFACE surface_layer_fluxes
+
+
+ CONTAINS
+
+
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Main routine to compute the surface fluxes
+!------------------------------------------------------------------------------!
+    SUBROUTINE surface_layer_fluxes
+
+       IMPLICIT NONE
+
+!
+!--    In case cloud physics is used, it is required to derive potential
+!--    temperature and specific humidity at first grid level from the fields pt 
+!--    and q
+       IF ( cloud_physics )  THEN
+          CALL calc_pt_q
+       ENDIF
+
+!
+!--    First, calculate the new Obukhov length, then new friction velocity,
+!--    followed by the new scaling parameters (th*, q*, etc.), and the new
+!--    surface fluxes if required. The old routine ("circular") requires a 
+!--    different order of calls as the scaling parameters from the previous time
+!--    steps are used to calculate the Obukhov length
+
+!
+!--    Depending on setting of most_method use the "old" routine
+       IF ( most_method == 'circular' )  THEN
+
+          CALL calc_scaling_parameters
+
+          IF ( .NOT. neutral )  THEN
+             CALL calc_ol
+          ENDIF
+
+          CALL calc_us
+
+          CALL calc_surface_fluxes
+
+!
+!--    Use either Newton iteration or a lookup table for the bulk Richardson
+!--    number to calculate the Obukhov length 
+       ELSEIF ( most_method == 'newton' .OR. most_method == 'lookup' )  THEN
+
+          IF ( .NOT. neutral )  THEN
+             CALL calc_ol
+          ENDIF
+
+          CALL calc_us
+
+          CALL calc_scaling_parameters
+
+          CALL calc_surface_fluxes
+
+       ENDIF
+
+    END SUBROUTINE surface_layer_fluxes
+
+
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Initializing actions for the surface layer routine. Basically, this involves
+!> the preparation of a lookup table for the the bulk Richardson number vs 
+!> Obukhov length L when using the lookup table method.
+!------------------------------------------------------------------------------!
+    SUBROUTINE init_surface_layer_fluxes
+
+       IMPLICIT NONE
+
+       INTEGER(iwp) :: l,          & !< Index for loop to create lookup table
+                       num_steps_n   !< Number of non-stretched zeta steps
+
+       LOGICAL :: terminate_run_l = .FALSE.    !< Flag to terminate run (global)
+
+       REAL(wp), PARAMETER ::  zeta_stretch = -10.0_wp !< Start of stretching in the free convection limit
+                               
+       REAL(wp), DIMENSION(:), ALLOCATABLE :: zeta_tmp
+
+
+       REAL(wp) :: zeta_step,            & !< Increment of zeta
+                   regr      = 1.01_wp,  & !< Stretching factor of zeta_step in the free convection limit
+                   regr_old  = 1.0E9_wp, & !< Stretching factor of last iteration step
+                   z0h_min   = 0.0_wp,   & !< Minimum value of z0h to create table
+                   z0_min    = 0.0_wp      !< Minimum value of z0 to create table
+!
+!--    When cloud physics is used, arrays for storing potential temperature and
+!--    specific humidity at first grid level are required
+       IF ( cloud_physics )  THEN
+          ALLOCATE ( pt1(nysg:nyng,nxlg:nxrg) )
+          ALLOCATE ( qv1(nysg:nyng,nxlg:nxrg) )
+       ENDIF
+
+!
+!--    Allocate field for storing the horizontal velocity
+       ALLOCATE ( uv_total(nysg:nyng,nxlg:nxrg) )
+
+       IF ( most_method == 'lookup' )  THEN
+
+!
+!--       Check for roughness heterogeneity. In that case terminate run and
+!--       inform user
+          IF ( MINVAL( z0h ) /= MAXVAL( z0h ) .OR.                             &
+               MINVAL( z0  ) /= MAXVAL( z0  ) )  THEN
+             terminate_run_l = .TRUE.
+          ENDIF
+
+#if defined( __parallel )
+!
+!--       Make a logical OR for all processes. Force termiation of model if result
+!--       is TRUE
+          IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
+          CALL MPI_ALLREDUCE( terminate_run_l, terminate_run, 1, MPI_LOGICAL,  &
+                              MPI_LOR, comm2d, ierr )
+#else
+          terminate_run = terminate_run_l
+#endif
+
+          IF ( terminate_run )  THEN
+             message_string = 'most_method = "lookup" cannot be used in ' //   &
+                              'combination with a prescribed roughness '  //   &
+                              'heterogeneity'
+             CALL message( 'surface_layer_fluxes', 'PA0417', 1, 2, 0, 6, 0 )
+          ENDIF
+
+          ALLOCATE(  zeta_tmp(0:num_steps-1) )
+
+!
+!--       Use the lowest possible value for z_mo
+          k    = MINVAL(nzb_s_inner)
+          z_mo = zu(k+1) - zw(k)
+
+!
+!--       Calculate z/L range from zeta_stretch to zeta_max using 90% of the
+!--       available steps (num_steps). The calculation is done with negative
+!--       values of zeta in order to simplify the stretching in the free
+!--       convection limit for the remaining 10% of steps.
+          zeta_tmp(0) = - zeta_max
+          num_steps_n = ( num_steps * 9 / 10 ) - 1
+          zeta_step   = (zeta_max - zeta_stretch) / REAL(num_steps_n)
+
+          DO l = 1, num_steps_n
+             zeta_tmp(l) = zeta_tmp(l-1) + zeta_step
+          ENDDO
+
+!
+!--       Calculate stretching factor for the free convection range
+          DO WHILE ( ABS( (regr-regr_old) / regr_old ) > 1.0E-10_wp )
+             regr_old = regr
+             regr = ( 1.0_wp - ( -zeta_min / zeta_step ) * ( 1.0_wp - regr )   &
+                    )**( 10.0_wp / REAL(num_steps) )
+          ENDDO
+
+!
+!--       Calculate z/L range from zeta_min to zeta_stretch
+          DO l = num_steps_n+1, num_steps-1
+             zeta_tmp(l) = zeta_tmp(l-1) + zeta_step
+             zeta_step = zeta_step * regr
+          ENDDO
+
+!
+!--       Invert array and switch sign, then calculate Obukhov length and bulk
+!--       Richardson number
+          z0h_min = MINVAL(z0h)
+          z0_min  = MINVAL(z0)
+          
+!
+!--       Calculate lookup table for the Richardson number versus Obukhov length
+!--       The Richardson number (rib) is defined depending on the choice of 
+!--       boundary conditions for temperature
+          IF ( ibc_pt_b == 1 )  THEN
+             DO l = 0, num_steps-1
+                ol_tab(l)  = - z_mo / zeta_tmp(num_steps-1-l)
+                rib_tab(l) = z_mo / ol_tab(l)  / ( LOG( z_mo / z0_min )        &
+                                                - psi_m( z_mo / ol_tab(l) )    &
+                                                + psi_m( z0_min / ol_tab(l) )  &
+                                                  )**3
+             ENDDO  
+          ELSE
+             DO l = 0, num_steps-1
+                ol_tab(l)  = - z_mo / zeta_tmp(num_steps-1-l)
+                rib_tab(l) = z_mo / ol_tab(l)  * ( LOG( z_mo / z0h_min )       &
+                                              - psi_h( z_mo / ol_tab(l) )      &
+                                              + psi_h( z0h_min / ol_tab(l) )   &
+                                            )                                  &
+                                          / ( LOG( z_mo / z0_min )             &
+                                              - psi_m( z_mo / ol_tab(l) )      &
+                                              + psi_m( z0_min / ol_tab(l) )    &
+                                            )**2
+             ENDDO
+          ENDIF
+
+!
+!--       Determine minimum values of rib in the lookup table. Set upper limit 
+!--       to critical Richardson number (0.25)
+          rib_min  = MINVAL(rib_tab)
+          rib_max  = 0.25 !MAXVAL(rib_tab)
+
+          DEALLOCATE( zeta_tmp )
+       ENDIF
+
+    END SUBROUTINE init_surface_layer_fluxes
+
+
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Calculate the Obukhov length (L) and Richardson flux number (z/L)
+!------------------------------------------------------------------------------!
+    SUBROUTINE calc_ol
+
+       IMPLICIT NONE
+
+       INTEGER(iwp) :: iter,  & !< Newton iteration step
+                       l        !< look index
+
+       REAL(wp), DIMENSION(nysg:nyng,nxlg:nxrg) :: rib                
+                       
+       REAL(wp)     :: f,      & !< Function for Newton iteration: f = Ri - [...]/[...]^2 = 0
+                       f_d_ol, & !< Derivative of f
+                       ol_l,   & !< Lower bound of L for Newton iteration
+                       ol_m,   & !< Previous value of L for Newton iteration
+                       ol_old, & !< Previous time step value of L 
+                       ol_u,   & !< Upper bound of L for Newton iteration
+                       rib       !< Bulk Richardson number
+
+!
+!--    Compute the absolute value of the horizontal velocity (relative to the 
+!--    surface). This is required by all methods
+       !$OMP PARALLEL DO PRIVATE( k, z_mo )
+       !$acc kernels loop
+       DO  i = nxl, nxr
+          DO  j = nys, nyn
+
+             k   = nzb_s_inner(j,i)
+
+             uv_total(j,i) = SQRT( ( 0.5_wp * ( u(k+1,j,i) + u(k+1,j,i+1)      &
+                                         - u(k,j,i)   - u(k,j,i+1) ) )**2 +    &
+                              ( 0.5_wp * ( v(k+1,j,i) + v(k+1,j+1,i)           &
+                                         - v(k,j,i)   - v(k,j+1,i) ) )**2 )
+
+!
+!--          For too small values of the local wind, MOST does not work. A
+!--          threshold value is thus set if required
+!            uv_total(j,i) = MAX(0.01_wp,uv_total(j,i))
+
+          ENDDO
+       ENDDO
+
+!
+!--    Values of uv_total need to be exchanged at the ghost boundaries
+       !$acc update host( uv_total )
+       CALL exchange_horiz_2d( uv_total )
+       !$acc update device( uv_total )
+
+       IF ( TRIM( most_method ) /= 'circular' )  THEN
+      
+          !$OMP PARALLEL DO PRIVATE( k, z_mo )
+          !$acc kernels loop
+          DO  i = nxl, nxr
+             DO  j = nys, nyn
+
+                k   = nzb_s_inner(j,i)
+                z_mo = zu(k+1) - zw(k)
+
+!
+!--             Evaluate bulk Richardson number (calculation depends on
+!--             definition based on setting of boundary conditions
+                IF ( ibc_pt_b /= 1 )  THEN
+                   IF ( humidity )  THEN
+                      rib(j,i) = g * z_mo * ( vpt(k+1,j,i) - vpt(k,j,i) )      &
+                           / ( uv_total(j,i)**2 * vpt(k+1,j,i) )
+                   ELSE
+                      rib(j,i) = g * z_mo * ( pt(k+1,j,i) - pt(k,j,i) )        &
+                           / ( uv_total(j,i)**2 * pt(k+1,j,i) )
+                   ENDIF      
+                ELSE
+!
+!--                When using Neumann boundary conditions, the buoyancy flux
+!--                is required but cannot be calculated at the surface, as pt
+!--                and q are not known at the surface. Hence the values at 
+!--                first grid level are used to estimate the buoyancy flux
+                   IF ( humidity )  THEN
+                      rib(j,i) = - g * z_mo * ( ( 1.0_wp + 0.61_wp             &
+                                 * q(k+1,j,i) ) * shf(j,i) + 0.61_wp           &
+                                 * pt(k+1,j,i) * qsws(j,i) )   &
+                                 / ( uv_total(j,i)**3 * vpt(k+1,j,i) * kappa**2 )
+                   ELSE
+                      rib(j,i) = - g * z_mo * shf(j,i)                         &
+                           / ( uv_total(j,i)**3 * pt(k+1,j,i) * kappa**2 )
+                   ENDIF
+                ENDIF  
+     
+             ENDDO
+          ENDDO 
+
+       ENDIF
+
+!
+!--    Calculate the Obukhov length either using a Newton iteration
+!--    method, via a lookup table, or using the old circular way
+       IF ( TRIM( most_method ) == 'newton' )  THEN
+
+          !$OMP PARALLEL DO PRIVATE( k, z_mo )
+          !$acc kernels loop
+          DO  i = nxl, nxr
+             DO  j = nys, nyn
+
+                k   = nzb_s_inner(j,i)
+                z_mo = zu(k+1) - zw(k)
+
+!
+!--             Store current value in case the Newton iteration fails
+                ol_old = ol(j,i)
+
+!
+!--             Ensure that the bulk Richardson number and the Obukhov 
+!--             lengtH have the same sign
+                IF ( rib(j,i) * ol(j,i) < 0.0_wp .OR.                        &
+                     ABS( ol(j,i) ) == ol_max )  THEN
+                   IF ( rib(j,i) > 0.0_wp ) ol(j,i) =  0.01_wp
+                   IF ( rib(j,i) < 0.0_wp ) ol(j,i) = -0.01_wp
+                ENDIF
+!
+!--             Iteration to find Obukhov length
+                iter = 0
+                DO
+                   iter = iter + 1
+!
+!--                In case of divergence, use the value of the previous time step
+                   IF ( iter > 1000 )  THEN
+                      ol(j,i) = ol_old
+                      EXIT
+                   ENDIF
+
+                   ol_m = ol(j,i)
+                   ol_l = ol_m - 0.001_wp * ol_m
+                   ol_u = ol_m + 0.001_wp * ol_m
+
+
+                   IF ( ibc_pt_b /= 1 )  THEN
+!
+!--                   Calculate f = Ri - [...]/[...]^2 = 0
+                      f = rib(j,i) - ( z_mo / ol_m ) * ( LOG( z_mo / z0h(j,i) )&
+                                                    - psi_h( z_mo / ol_m )     &
+                                                    + psi_h( z0h(j,i) / ol_m ) &
+                                                   )                           &
+                                                 / ( LOG( z_mo / z0(j,i) )     &
+                                                    - psi_m( z_mo / ol_m )     &
+                                                    + psi_m( z0(j,i) / ol_m )  &
+                                                    )**2
+
+!
+!--                    Calculate df/dL
+                       f_d_ol = ( - ( z_mo / ol_u ) * ( LOG( z_mo / z0h(j,i) ) &
+                                                   - psi_h( z_mo / ol_u )      &
+                                                   + psi_h( z0h(j,i) / ol_u )  &
+                                                 )                             &
+                                               / ( LOG( z_mo / z0(j,i) )       &
+                                                   - psi_m( z_mo / ol_u )      &
+                                                   + psi_m( z0(j,i) / ol_u )   &
+                                                 )**2                          &
+                              + ( z_mo / ol_l ) * ( LOG( z_mo / z0h(j,i) )     &
+                                                   - psi_h( z_mo / ol_l )      &
+                                                   + psi_h( z0h(j,i) / ol_l )  &
+                                                 )                             &
+                                               / ( LOG( z_mo / z0(j,i) )       &
+                                                   - psi_m( z_mo / ol_l )      &
+                                                   + psi_m( z0(j,i) / ol_l )   &
+                                                 )**2                          &
+                                ) / ( ol_u - ol_l )
+                   ELSE
+!
+!--                   Calculate f = Ri - 1 /[...]^3 = 0
+                      f = rib(j,i) - ( z_mo / ol_m ) / ( LOG( z_mo / z0(j,i) )&
+                                                    - psi_m( z_mo / ol_m )    &
+                                                    + psi_m( z0(j,i) / ol_m ) &
+                                                       )**3
+
+!
+!--                   Calculate df/dL
+                      f_d_ol = ( - ( z_mo / ol_u ) / ( LOG( z_mo / z0(j,i) )  &
+                                                   - psi_m( z_mo / ol_u )     &
+                                                   + psi_m( z0(j,i) / ol_u )  &
+                                                 )**3                         &
+                              + ( z_mo / ol_l ) / ( LOG( z_mo / z0(j,i) )     &
+                                                   - psi_m( z_mo / ol_l )     &
+                                                   + psi_m( z0(j,i) / ol_l )  &
+                                                 )**3                         &
+                                     ) / ( ol_u - ol_l )
+                   ENDIF
+!
+!--                Calculate new L
+                   ol(j,i) = ol_m - f / f_d_ol
+
+!
+!--                Ensure that the bulk Richardson number and the Obukhov 
+!--                length have the same sign and ensure convergence.
+                   IF ( ol(j,i) * ol_m < 0.0_wp )  ol(j,i) = ol_m * 0.5_wp
+
+!
+!--                If unrealistic value occurs, set L to the maximum
+!--                value that is allowed
+                   IF ( ABS( ol(j,i) ) > ol_max )  THEN
+                      ol(j,i) = ol_max
+                      EXIT
+                   ENDIF
+!
+!--                Check for convergence
+                   IF ( ABS( ( ol(j,i) - ol_m ) / ol(j,i) ) < 1.0E-4_wp )  THEN
+                      EXIT
+                   ELSE
+                      CYCLE
+                   ENDIF
+
+                ENDDO
+                       
+             ENDDO
+          ENDDO
+
+       ELSEIF ( TRIM( most_method ) == 'lookup' )  THEN
+
+          !$OMP PARALLEL DO PRIVATE( k, z_mo )
+          !$acc kernels loop
+          DO  i = nxl, nxr
+             DO  j = nys, nyn
+
+                k   = nzb_s_inner(j,i)
+
+!
+!--             If the bulk Richardson number is outside the range of the lookup
+!--             table, set it to the exceeding threshold value
+                IF ( rib(j,i) < rib_min )  rib(j,i) = rib_min
+                IF ( rib(j,i) > rib_max )  rib(j,i) = rib_max
+
+!
+!--             Find the correct index bounds for linear interpolation. As the
+!--             Richardson number will not differ very much from time step to
+!--             time step , use the index from the last step and search in the 
+!--             correct direction
+                l = l_bnd
+                IF ( rib_tab(l) - rib(j,i) > 0.0_wp )  THEN
+                   DO WHILE ( rib_tab(l-1) - rib(j,i) > 0.0_wp .AND. l > 0 )
+                      l = l-1
+                   ENDDO
+                ELSE
+                   DO WHILE ( rib_tab(l) - rib(j,i) < 0.0_wp                &
+                              .AND. l < num_steps-1 )
+                      l = l+1
+                   ENDDO
+                ENDIF
+                l_bnd = l
+
+!
+!--             Linear interpolation to find the correct value of z/L
+                ol(j,i) = ( ol_tab(l-1) + ( ol_tab(l) - ol_tab(l-1) )       &
+                            / (  rib_tab(l) - rib_tab(l-1) )                &
+                            * ( rib(j,i) - rib_tab(l-1) ) )
+
+             ENDDO
+          ENDDO
+
+       ELSEIF ( TRIM( most_method ) == 'circular' )  THEN
+
+          !$OMP PARALLEL DO PRIVATE( k, z_mo )
+          !$acc kernels loop
+          DO  i = nxl, nxr
+             DO  j = nys, nyn
+
+                k   = nzb_s_inner(j,i)
+                z_mo = zu(k+1) - zw(k)
+
+                IF ( .NOT. humidity )  THEN
+                   ol(j,i) =  ( pt(k+1,j,i) *  us(j,i)**2 ) / ( kappa * g      &
+                              * ts(j,i) + 1E-30_wp )
+                ELSEIF ( cloud_physics )  THEN
+
+                   ol(j,i) =  ( vpt(k+1,j,i) * us(j,i)**2 ) / ( kappa * g      &
+                              * ( ts(j,i) + 0.61_wp * pt1(j,i) * qs(j,i)       &
+                              + 0.61_wp * qv1(j,i) * ts(j,i) - ts(j,i)         &
+                              * ql(k+1,j,i) ) + 1E-30_wp )
+                ELSE
+                   ol(j,i) =  ( vpt(k+1,j,i) *  us(j,i)**2 ) / ( kappa * g     &
+                              * ( ts(j,i) + 0.61_wp * pt(k+1,j,i) * qs(j,i)    &
+                                  + 0.61_wp * q(k+1,j,i) * ts(j,i) ) + 1E-30_wp )
+                ENDIF
+!
+!--             Limit the value range of the Obukhov length.
+!--             This is necessary for very small velocities (u,v --> 0), because
+!--             the absolute value of ol can then become very small, which in
+!--             consequence would result in very large shear stresses and very
+!--             small momentum fluxes (both are generally unrealistic).
+                IF ( ( z_mo / ol(j,i) ) < zeta_min )  ol(j,i) = z_mo / zeta_min
+                IF ( ( z_mo / ol(j,i) ) > zeta_max )  ol(j,i) = z_mo / zeta_max
+
+             ENDDO
+          ENDDO
+
+       ENDIF
+
+!
+!--    Values of ol at ghost point locations are needed for the evaluation
+!--    of usws and vsws.
+       !$acc update host( ol )
+       CALL exchange_horiz_2d( ol )
+       !$acc update device( ol )
+
+    END SUBROUTINE calc_ol
+
+!
+!-- Calculate friction velocity u*
+    SUBROUTINE calc_us
+
+       IMPLICIT NONE
+
+       DO  i = nxlg, nxrg
+          DO  j = nysg, nyng
+
+             k   = nzb_s_inner(j,i)+1
+             z_mo = zu(k+1) - zw(k)
+
+!
+!--          Compute u* at the scalars' grid points
+             !$OMP PARALLEL DO PRIVATE( a, b, k, uv_total, z_mo )
+             !$acc kernels loop
+             us(j,i) = kappa * uv_total(j,i) / ( LOG( z_mo / z0(j,i) )         &
+                                          - psi_m( z_mo / ol(j,i) )            &
+                                          + psi_m( z0(j,i) / ol(j,i) ) )
+          ENDDO
+       ENDDO
+
+    END SUBROUTINE calc_us
+
+!
+!-- Calculate potential temperature and specific humidity at first grid level
+    SUBROUTINE calc_pt_q
+
+       IMPLICIT NONE
+
+       DO  i = nxlg, nxrg
+          DO  j = nysg, nyng
+             k   = nzb_s_inner(j,i)+1
+             pt1(j,i) = pt(k,j,i) + l_d_cp * pt_d_t(k) * ql(k,j,i)
+             qv1(j,i) = q(k,j,i) - ql(k,j,i)
+          ENDDO
+       ENDDO
+
+    END SUBROUTINE calc_pt_q
+
+!
+!-- Calculate the other MOST scaling parameters theta*, q*, (qr*, nr*)
+    SUBROUTINE calc_scaling_parameters
+
+       IMPLICIT NONE
+
+!
+!--    Data information for accelerators
+       !$acc data present( e, nrsws, nzb_u_inner, nzb_v_inner, nzb_s_inner, pt )  &
+       !$acc      present( q, qs, qsws, qrsws, shf, ts, u, us, usws, v )     &
+       !$acc      present( vpt, vsws, zu, zw, z0, z0h )
+! 
+!--    Compute theta*
+       IF ( constant_heatflux )  THEN
+
+!
+!--       For a given heat flux in the surface layer:
+          !$OMP PARALLEL DO
+          !$acc kernels loop
+          DO  i = nxlg, nxrg
+             DO  j = nysg, nyng
+                ts(j,i) = -shf(j,i) / ( us(j,i) + 1E-30_wp )
+!
+!--             ts must be limited, because otherwise overflow may occur in case
+!--             of us=0 when computing ol further below
+                IF ( ts(j,i) < -1.05E5_wp )  ts(j,i) = -1.0E5_wp
+                IF ( ts(j,i) >   1.0E5_wp )  ts(j,i) =  1.0E5_wp
+             ENDDO
+          ENDDO
+
+       ELSE
+!
+!--       For a given surface temperature:
+          IF ( large_scale_forcing .AND. lsf_surf )  THEN
+             !$OMP PARALLEL DO
+             !$acc kernels loop
+             DO  i = nxlg, nxrg
+                DO  j = nysg, nyng
+                   k = nzb_s_inner(j,i)
+                   pt(k,j,i) = pt_surface
+                ENDDO
+             ENDDO
+          ENDIF
+
+          !$OMP PARALLEL DO PRIVATE( a, b, k, z_mo )
+          !$acc kernels loop
+          DO  i = nxlg, nxrg
+             DO  j = nysg, nyng
+
+                k   = nzb_s_inner(j,i)
+                z_mo = zu(k+1) - zw(k)
+
+                IF ( cloud_physics )  THEN
+                   ts(j,i) = kappa * ( pt1(j,i) - pt(k,j,i) )                  &
+                                     / ( LOG( z_mo / z0h(j,i) )                &
+                                         - psi_h( z_mo / ol(j,i) )             &
+                                         + psi_h( z0h(j,i) / ol(j,i) ) )
+                ELSE
+                   ts(j,i) = kappa * ( pt(k+1,j,i) - pt(k,j,i) )               &
+                                     / ( LOG( z_mo / z0h(j,i) )                &
+                                         - psi_h( z_mo / ol(j,i) )             &
+                                         + psi_h( z0h(j,i) / ol(j,i) ) )
+                ENDIF
+
+             ENDDO
+          ENDDO
+       ENDIF
+
+!
+!--    If required compute q*
+       IF ( humidity  .OR.  passive_scalar )  THEN
+          IF ( constant_waterflux )  THEN
+!
+!--          For a given water flux in the Prandtl layer:
+             !$OMP PARALLEL DO
+             !$acc kernels loop
+             DO  i = nxlg, nxrg
+                DO  j = nysg, nyng
+                   qs(j,i) = -qsws(j,i) / ( us(j,i) + 1E-30_wp )
+                ENDDO
+             ENDDO
+
+          ELSE
+             coupled_run = ( coupling_mode == 'atmosphere_to_ocean' .AND.      &
+                             run_coupled )
+
+             IF ( large_scale_forcing .AND. lsf_surf )  THEN
+                !$OMP PARALLEL DO
+                !$acc kernels loop
+                DO  i = nxlg, nxrg
+                   DO  j = nysg, nyng
+                      k = nzb_s_inner(j,i)
+                      q(k,j,i) = q_surface
+                   ENDDO
+                ENDDO
+             ENDIF
+
+             !$OMP PARALLEL DO PRIVATE( a, b, k, z_mo )
+             !$acc kernels loop independent
+             DO  i = nxlg, nxrg
+                !$acc loop independent
+                DO  j = nysg, nyng
+
+                   k   = nzb_s_inner(j,i)
+                   z_mo = zu(k+1) - zw(k)
+
+!
+!--                Assume saturation for atmosphere coupled to ocean (but not
+!--                in case of precursor runs)
+                   IF ( coupled_run )  THEN
+                      e_s = 6.1_wp * &
+                              EXP( 0.07_wp * ( MIN(pt(k,j,i),pt(k+1,j,i))      &
+                                               - 273.15_wp ) )
+                      q(k,j,i) = 0.622_wp * e_s / ( surface_pressure - e_s )
+                   ENDIF
+
+                   IF ( cloud_physics )  THEN
+                      qs(j,i) = kappa * ( qv1(j,i) - q(k,j,i) )                &
+                                        / ( LOG( z_mo / z0h(j,i) )             &
+                                            - psi_h( z_mo / ol(j,i) )          &
+                                            + psi_h( z0h(j,i) / ol(j,i) ) )
+
+                   ELSE
+                      qs(j,i) = kappa * ( q(k+1,j,i) - q(k,j,i) )              &
+                                        / ( LOG( z_mo / z0h(j,i) )             &
+                                            - psi_h( z_mo / ol(j,i) )          &
+                                            + psi_h( z0h(j,i) / ol(j,i) ) )
+                   ENDIF
+
+                ENDDO
+             ENDDO
+          ENDIF
+       ENDIF
+
+
+!
+!--    If required compute qr* and nr*
+       IF ( cloud_physics .AND. icloud_scheme == 0 .AND. precipitation )  THEN
+
+          !$OMP PARALLEL DO PRIVATE( a, b, k, z_mo )
+          !$acc kernels loop independent
+          DO  i = nxlg, nxrg
+             !$acc loop independent
+             DO  j = nysg, nyng
+
+                k   = nzb_s_inner(j,i)
+                z_mo = zu(k+1) - zw(k)
+
+                   qrs(j,i) = kappa * ( qr(k+1,j,i) - qr(k,j,i) )              &
+                                     / ( LOG( z_mo / z0h(j,i) )                &
+                                         - psi_h( z_mo / ol(j,i) )             &
+                                         + psi_h( z0h(j,i) / ol(j,i) ) )
+
+                   nrs(j,i) = kappa * ( nr(k+1,j,i) - nr(k,j,i) )              &
+                                     / ( LOG( z_mo / z0h(j,i) )                &
+                                         - psi_h( z_mo / ol(j,i) )             &
+                                         + psi_h( z0h(j,i) / ol(j,i) ) )
+             ENDDO
+          ENDDO
+
+       ENDIF
+
+    END SUBROUTINE calc_scaling_parameters
+
+
+
+!
+!-- Calculate surface fluxes usws, vsws, shf, qsws, (qrsws, nrsws)
+    SUBROUTINE calc_surface_fluxes
+
+       IMPLICIT NONE
+
+       REAL(wp) :: ol_mid !< Grid-interpolated L
+
+!
+!--    Compute u'w' for the total model domain.
+!--    First compute the corresponding component of u* and square it.
+       !$OMP PARALLEL DO PRIVATE( k, ol_mid, z_mo )
+       !$acc kernels loop
+       DO  i = nxl, nxr
+          DO  j = nys, nyn
+
+             k   = nzb_u_inner(j,i)
+             z_mo = zu(k+1) - zw(k)
+!
+!--          Compute bulk Obukhov length for this point
+             ol_mid = 0.5_wp * ( ol(j,i-1) + ol(j,i) )
+
+             IF ( ol_mid == 0.0_wp )  THEN
+                ol_mid = MIN(ol(j,i-1), ol(j,i))
+             ENDIF
+
+             usws(j,i) = kappa * ( u(k+1,j,i) - u(k,j,i) )                     &
+                                 / ( LOG( z_mo / z0(j,i) )                     &
+                                     - psi_m( z_mo / ol_mid )                  &
+                                     + psi_m( z0(j,i) / ol_mid ) )
+
+             usws(j,i) = -usws(j,i) * 0.5_wp * ( us(j,i-1) + us(j,i) )
+          ENDDO
+       ENDDO
+
+!
+!--    Compute v'w' for the total model domain.
+!--    First compute the corresponding component of u* and square it.
+       !$OMP PARALLEL DO PRIVATE( k, ol_mid, z_mo )
+       !$acc kernels loop
+       DO  i = nxl, nxr
+          DO  j = nys, nyn
+
+             k   = nzb_v_inner(j,i)
+             z_mo = zu(k+1) - zw(k)
+!
+!--          Compute bulk Obukhov length for this point
+             ol_mid = 0.5_wp * ( ol(j-1,i) + ol(j,i) )
+
+             IF ( ol_mid == 0.0_wp )  THEN
+                ol_mid = MIN(ol(j-1,i), ol(j-1,i))
+             ENDIF
+
+             vsws(j,i) = kappa * ( v(k+1,j,i) - v(k,j,i) )                     &
+                                 / ( LOG( z_mo / z0(j,i) )                     &
+                                     - psi_m( z_mo / ol_mid )                  &
+                                     + psi_m( z0(j,i) / ol_mid ) )
+
+             vsws(j,i) = -vsws(j,i) * 0.5_wp * ( us(j,i-1) + us(j,i) )
+
+          ENDDO
+       ENDDO
+
+!
+!--    Exchange the boundaries for the momentum fluxes (is this still required?)
+       !$acc update host( usws, vsws )
+       CALL exchange_horiz_2d( usws )
+       CALL exchange_horiz_2d( vsws )
+       !$acc update device( usws, vsws )
+
+!
+!--    Compute the vertical kinematic heat flux
+       IF ( .NOT. constant_heatflux .AND. ( simulated_time <=                &
+            skip_time_do_lsm .OR. .NOT. land_surface ) )  THEN
+          !$OMP PARALLEL DO
+          !$acc kernels loop independent
+          DO  i = nxlg, nxrg
+             !$acc loop independent
+             DO  j = nysg, nyng
+                shf(j,i) = -ts(j,i) * us(j,i)
+             ENDDO
+          ENDDO
+
+       ENDIF
+
+!
+!-- Compute the vertical water/scalar flux
+       IF ( .NOT. constant_waterflux .AND. ( humidity .OR. passive_scalar )    &
+            .AND. ( simulated_time <= skip_time_do_lsm .OR. .NOT.            &
+            land_surface ) )  THEN
+          !$OMP PARALLEL DO
+          !$acc kernels loop independent
+          DO  i = nxlg, nxrg
+             !$acc loop independent
+             DO  j = nysg, nyng
+                qsws(j,i) = -qs(j,i) * us(j,i)
+             ENDDO
+          ENDDO
+
+       ENDIF
+
+!
+!--    Compute (turbulent) fluxes of rain water content and rain drop conc.
+       IF ( cloud_physics  .AND.  icloud_scheme == 0  .AND.                    &
+            precipitation )  THEN
+          !$OMP PARALLEL DO
+          !$acc kernels loop independent
+          DO  i = nxlg, nxrg
+             !$acc loop independent
+             DO  j = nysg, nyng
+                qrsws(j,i) = -qrs(j,i) * us(j,i)
+                nrsws(j,i) = -nrs(j,i) * us(j,i)
+             ENDDO
+          ENDDO
+       ENDIF
+
+!
+!--    Bottom boundary condition for the TKE
+       IF ( ibc_e_b == 2 )  THEN
+          !$OMP PARALLEL DO
+          !$acc kernels loop independent
+          DO  i = nxlg, nxrg
+             !$acc loop independent
+             DO  j = nysg, nyng
+                e(nzb_s_inner(j,i)+1,j,i) = ( us(j,i) / 0.1_wp )**2
+!
+!--             As a test: cm = 0.4
+!               e(nzb_s_inner(j,i)+1,j,i) = ( us(j,i) / 0.4_wp )**2
+                e(nzb_s_inner(j,i),j,i)   = e(nzb_s_inner(j,i)+1,j,i)
+             ENDDO
+          ENDDO
+       ENDIF
+       !$acc end data
+
+    END SUBROUTINE calc_surface_fluxes
+
+
+!
+!-- Integrated stability function for momentum
+    FUNCTION psi_m( zeta ) 
+       
+       USE kinds
+
+       IMPLICIT NONE 
+
+       REAL(wp)            :: psi_m !< Integrated similarity function result
+       REAL(wp)            :: zeta  !< Stability parameter z/L
+       REAL(wp)            :: x     !< dummy variable
+
+       REAL(wp), PARAMETER :: a = 1.0_wp            !< constant
+       REAL(wp), PARAMETER :: b = 0.66666666666_wp  !< constant
+       REAL(wp), PARAMETER :: c = 5.0_wp            !< constant
+       REAL(wp), PARAMETER :: d = 0.35_wp           !< constant
+       REAL(wp), PARAMETER :: c_d_d = c / d         !< constant
+       REAL(wp), PARAMETER :: bc_d_d = b * c / d    !< constant
+
+
+       IF ( zeta < 0.0_wp )  THEN
+          x = SQRT( SQRT(1.0_wp  - 16.0_wp * zeta ) )
+          psi_m = pi * 0.5_wp - 2.0_wp * ATAN( x ) + LOG( ( 1.0_wp + x )**2    &
+                  * ( 1.0_wp + x**2 ) * 0.125_wp )
+       ELSE
+
+          psi_m = - b * ( zeta - c_d_d ) * EXP( -d * zeta ) - a * zeta         &
+                   - bc_d_d
+!
+!--       Old version for stable conditions (only valid for z/L < 0.5)
+!--       psi_m = - 5.0_wp * zeta
+
+       ENDIF
+
+    END FUNCTION psi_m
+
+
+!
+!-- Integrated stability function for heat and moisture
+    FUNCTION psi_h( zeta ) 
+       
+       USE kinds
+
+       IMPLICIT NONE 
+
+       REAL(wp)            :: psi_h !< Integrated similarity function result
+       REAL(wp)            :: zeta  !< Stability parameter z/L
+       REAL(wp)            :: x     !< dummy variable
+
+       REAL(wp), PARAMETER :: a = 1.0_wp            !< constant
+       REAL(wp), PARAMETER :: b = 0.66666666666_wp  !< constant
+       REAL(wp), PARAMETER :: c = 5.0_wp            !< constant
+       REAL(wp), PARAMETER :: d = 0.35_wp           !< constant
+       REAL(wp), PARAMETER :: c_d_d = c / d         !< constant
+       REAL(wp), PARAMETER :: bc_d_d = b * c / d    !< constant
+
+
+       IF ( zeta < 0.0_wp )  THEN
+          x = SQRT(1.0_wp  - 16.0_wp * zeta )
+          psi_h = 2.0_wp * LOG( (1.0_wp + x ) / 2.0_wp )
+       ELSE
+          psi_h = - b * ( zeta - c_d_d ) * EXP( -d * zeta ) - (1.0_wp          &
+                  + 0.66666666666_wp * a * zeta )**1.5_wp - bc_d_d             &
+                  + 1.0_wp
+!
+!--       Old version for stable conditions (only valid for z/L < 0.5)
+!--       psi_h = - 5.0_wp * zeta
+       ENDIF
+
+    END FUNCTION psi_h
+
+ END MODULE surface_layer_fluxes_mod
Index: palm/trunk/SOURCE/time_integration.f90
===================================================================
--- palm/trunk/SOURCE/time_integration.f90	(revision 1686)
+++ palm/trunk/SOURCE/time_integration.f90	(revision 1691)
@@ -14,10 +14,11 @@
 ! PALM. If not, see <http://www.gnu.org/licenses/>.
 !
-! Copyright 1997-2014 Leibniz Universitaet Hannover
+! Copyright 1997-2015 Leibniz Universitaet Hannover
 !--------------------------------------------------------------------------------!
 !
 ! Current revisions:
 ! ------------------
-! 
+! Added option for spin-ups without land surface and radiation models. Moved calls
+! for radiation and lan surface schemes.
 ! 
 ! Former revisions:
@@ -170,11 +171,11 @@
                averaging_interval_sp, bc_lr_cyc, bc_ns_cyc, bc_pt_t_val,       &
                bc_q_t_val, call_psolver_at_all_substeps, cloud_droplets,       &
-               cloud_physics, constant_heatflux, create_disturbances, dopr_n,  &
-               constant_diffusion, coupling_mode, coupling_start_time,         &
-               current_timestep_number, disturbance_created,                   &
-               disturbance_energy_limit, dist_range, do_sum, dt_3d,            &
-               dt_averaging_input, dt_averaging_input_pr, dt_coupling,         &
-               dt_data_output_av, dt_disturb, dt_do2d_xy, dt_do2d_xz,          &
-               dt_do2d_yz, dt_do3d, dt_domask,dt_dopts, dt_dopr,               &
+               cloud_physics, constant_flux_layer, constant_heatflux,          &
+               create_disturbances, dopr_n, constant_diffusion, coupling_mode, &
+               coupling_start_time, current_timestep_number,                   &
+               disturbance_created, disturbance_energy_limit, dist_range,      &
+               do_sum, dt_3d, dt_averaging_input, dt_averaging_input_pr,       &
+               dt_coupling, dt_data_output_av, dt_disturb, dt_do2d_xy,         &
+               dt_do2d_xz, dt_do2d_yz, dt_do3d, dt_domask,dt_dopts, dt_dopr,   &
                dt_dopr_listing, dt_dosp, dt_dots, dt_dvrp, dt_run_control,     &
                end_time, first_call_lpm, galilei_transformation, humidity,     &
@@ -183,5 +184,5 @@
                loop_optimization, lsf_surf, lsf_vert, masks, mid,              &
                netcdf_data_format, neutral, nr_timesteps_this_run, nudging,    &
-               ocean, on_device, passive_scalar, prandtl_layer, precipitation, &
+               ocean, on_device, passive_scalar, precipitation,                &
                prho_reference, pt_reference, pt_slope_offset, random_heatflux, &
                run_coupled, simulated_time, simulated_time_chr,                &
@@ -213,5 +214,6 @@
 
     USE land_surface_model_mod,                                                &
-        ONLY:  land_surface, lsm_energy_balance, lsm_soil_model
+        ONLY:  land_surface, lsm_energy_balance, lsm_soil_model,               &
+               skip_time_do_lsm
 
     USE ls_forcing_mod,                                                        &
@@ -238,9 +240,13 @@
 
     USE radiation_model_mod,                                                   &
-        ONLY: dt_radiation, radiation, radiation_clearsky,                     &
-              radiation_rrtmg, radiation_scheme, time_radiation
+        ONLY: dt_radiation, force_radiation_call, radiation,                   &
+              radiation_clearsky, radiation_rrtmg, radiation_scheme,           &
+              skip_time_do_radiation, time_radiation
 
     USE statistics,                                                            &
         ONLY:  flow_statistics_called, hom, pr_palm, sums_ls_l
+
+    USE surface_layer_fluxes_mod,                                              &
+        ONLY:  surface_layer_fluxes
 
     USE user_actions_mod,                                                      &
@@ -374,23 +380,4 @@
           ENDIF
 
-          IF ( radiation .AND. intermediate_timestep_count                     &
-               == intermediate_timestep_count_max  )  THEN
-
-               time_radiation = time_radiation + dt_3d
-
-             IF ( time_radiation >= dt_radiation )  THEN
-
-                CALL cpu_log( log_point(50), 'radiation', 'start' )
-
-                time_radiation = time_radiation - dt_radiation
-                IF ( radiation_scheme == 'clear-sky' )  THEN
-                   CALL radiation_clearsky
-                ELSEIF ( radiation_scheme == 'rrtmg' )  THEN
-                   CALL radiation_rrtmg
-                ENDIF
-
-                CALL cpu_log( log_point(50), 'radiation', 'stop' )
-             ENDIF
-          ENDIF
 !
 !--       Solve the prognostic equations. A fast cache optimized version with
@@ -631,19 +618,4 @@
 !--       velocities at the outflow in case of a non-cyclic lateral wall)
           CALL boundary_conds
-
-!
-!--       When using the land surface model: 
-!--       1) solve energy balance equation to calculate new skin temperature
-!--       2) run soil model 
-          IF ( land_surface )  THEN
-
-             CALL cpu_log( log_point(54), 'land_surface', 'start' )
-
-             CALL lsm_energy_balance
-             CALL lsm_soil_model
-
-             CALL cpu_log( log_point(54), 'land_surface', 'stop' )
-
-          ENDIF
 
 !
@@ -731,11 +703,21 @@
 
 !
-!--          First the vertical fluxes in the Prandtl layer are being computed
-             IF ( prandtl_layer )  THEN
-                CALL cpu_log( log_point(19), 'prandtl_fluxes', 'start' )
-                CALL prandtl_fluxes
-                CALL cpu_log( log_point(19), 'prandtl_fluxes', 'stop' )
-             ENDIF
-
+!--          First the vertical fluxes in the surface (constant flux) layer are computed
+             IF ( constant_flux_layer )  THEN
+                CALL cpu_log( log_point(19), 'surface_layer_fluxes', 'start' )
+                CALL surface_layer_fluxes
+                CALL cpu_log( log_point(19), 'surface_layer_fluxes', 'stop' )
+             ENDIF
+
+!
+!--          If required, solve the energy balance for the surface and run soil 
+!--          model
+             IF ( land_surface .AND. simulated_time > skip_time_do_lsm)  THEN
+
+                CALL cpu_log( log_point(54), 'land_surface', 'start' )
+                CALL lsm_energy_balance
+                CALL lsm_soil_model
+                CALL cpu_log( log_point(54), 'land_surface', 'stop' )
+             ENDIF
 !
 !--          Compute the diffusion coefficients
@@ -752,4 +734,34 @@
              CALL cpu_log( log_point(17), 'diffusivities', 'stop' )
 
+          ENDIF
+
+!
+!--       If required, calculate radiative fluxes and heating rates
+          IF ( radiation .AND. intermediate_timestep_count                     &
+               == intermediate_timestep_count_max .AND. simulated_time >    &
+               skip_time_do_radiation )  THEN
+
+               time_radiation = time_radiation + dt_3d
+
+             IF ( time_radiation >= dt_radiation .OR. force_radiation_call )   &
+             THEN
+
+                CALL cpu_log( log_point(50), 'radiation', 'start' )
+
+                IF ( .NOT. force_radiation_call )  THEN
+                   time_radiation = time_radiation - dt_radiation
+                ELSE
+                   WRITE(9,*) "Unscheduled radiation call at ", simulated_time
+                   CALL LOCAL_FLUSH ( 9 )
+                ENDIF
+
+                IF ( radiation_scheme == 'clear-sky' )  THEN
+                   CALL radiation_clearsky
+                ELSEIF ( radiation_scheme == 'rrtmg' )  THEN
+                   CALL radiation_rrtmg
+                ENDIF
+
+                CALL cpu_log( log_point(50), 'radiation', 'stop' )
+             ENDIF
           ENDIF
 
Index: palm/trunk/SOURCE/wall_fluxes.f90
===================================================================
--- palm/trunk/SOURCE/wall_fluxes.f90	(revision 1686)
+++ palm/trunk/SOURCE/wall_fluxes.f90	(revision 1691)
@@ -14,10 +14,10 @@
 ! PALM. If not, see <http://www.gnu.org/licenses/>.
 !
-! Copyright 1997-2014 Leibniz Universitaet Hannover
+! Copyright 1997-2015 Leibniz Universitaet Hannover
 !--------------------------------------------------------------------------------!
 !
 ! Current revisions:
 ! -----------------
-! 
+! Renamed rif_min and rif_max with zeta_min and zeta_max, respectively.
 ! 
 ! Former revisions:
@@ -69,4 +69,6 @@
 !> it gives slightly different results from the ij-version for some unknown
 !> reason.
+!>
+!> @todo Rename rif to zeta throughout the routine
 !------------------------------------------------------------------------------!
  MODULE wall_fluxes_mod
@@ -107,5 +109,5 @@
        
        USE control_parameters,                                                 &
-           ONLY:  g, kappa, rif_max, rif_min
+           ONLY:  g, kappa, zeta_max, zeta_min
        
        USE grid_variables,                                                     &
@@ -234,6 +236,6 @@
 !--                shear stresses and very small momentum fluxes (both are
 !--                generally unrealistic).
-                   IF ( rifs < rif_min )  rifs = rif_min
-                   IF ( rifs > rif_max )  rifs = rif_max
+                   IF ( rifs < zeta_min )  rifs = zeta_min
+                   IF ( rifs > zeta_max )  rifs = zeta_max
 
 !
@@ -291,5 +293,5 @@
        
        USE control_parameters,                                                 &
-           ONLY:  g, kappa, rif_max, rif_min
+           ONLY:  g, kappa, zeta_max, zeta_min
        
        USE grid_variables,                                                     &
@@ -428,6 +430,6 @@
 !--                shear stresses and very small momentum fluxes (both are
 !--                generally unrealistic).
-                   IF ( rifs < rif_min )  rifs = rif_min
-                   IF ( rifs > rif_max )  rifs = rif_max
+                   IF ( rifs < zeta_min )  rifs = zeta_min
+                   IF ( rifs > zeta_max )  rifs = zeta_max
 
 !
@@ -485,5 +487,5 @@
        
        USE control_parameters,                                                 &
-           ONLY:  g, kappa, rif_max, rif_min
+           ONLY:  g, kappa, zeta_max, zeta_min
        
        USE grid_variables,                                                     &
@@ -596,6 +598,6 @@
 !--       consequence would result in very large shear stresses and very
 !--       small momentum fluxes (both are generally unrealistic).
-          IF ( rifs < rif_min )  rifs = rif_min
-          IF ( rifs > rif_max )  rifs = rif_max
+          IF ( rifs < zeta_min )  rifs = zeta_min
+          IF ( rifs > zeta_max )  rifs = zeta_max
 
 !
Index: palm/trunk/SOURCE/write_3d_binary.f90
===================================================================
--- palm/trunk/SOURCE/write_3d_binary.f90	(revision 1686)
+++ palm/trunk/SOURCE/write_3d_binary.f90	(revision 1691)
@@ -14,10 +14,11 @@
 ! PALM. If not, see <http://www.gnu.org/licenses/>.
 !
-! Copyright 1997-2014 Leibniz Universitaet Hannover
+! Copyright 1997-2015 Leibniz Universitaet Hannover
 !--------------------------------------------------------------------------------!
 !
 ! Current revisions:
 ! -----------------
-! 
+! Added output of radiative heating rates for RRTMG. Added output of ol. Removed
+! output of rif.
 ! 
 ! Former revisions:
@@ -79,6 +80,6 @@
 
     USE arrays_3d,                                                             &
-        ONLY:  e, kh, km, p, pt, q, ql, qc, nr, nrs, nrsws, nrswst, qr, qrs,   &
-               qrsws, qrswst, qs, qsws, qswst, sa, saswsb, saswst, rif,        &
+        ONLY:  e, kh, km, ol, p, pt, q, ql, qc, nr, nrs, nrsws, nrswst, qr,    &
+               qrs, qrsws, qrswst, qs, qsws, qswst, sa, saswsb, saswst,        &
                rif_wall, shf, ts, tswst, u, u_m_l, u_m_n, u_m_r, u_m_s, us,    &
                usws, uswst, v, v_m_l, v_m_n, v_m_r, v_m_s, vpt, vsws, vswst,   &
@@ -110,6 +111,8 @@
     USE radiation_model_mod,                                                   &
         ONLY: radiation, rad_net, rad_net_av, rad_lw_in, rad_lw_in_av,         &
-              rad_lw_out, rad_lw_out_av, rad_sw_in, rad_sw_in_av, rad_sw_out,  &
-              rad_sw_out_av
+              rad_lw_out, rad_lw_out_av, rad_lw_cs_hr, rad_lw_cs_hr_av,        &
+              rad_lw_hr, rad_lw_hr_av, rad_sw_in, rad_sw_in_av, rad_sw_out,    &
+              rad_sw_out_av, rad_sw_cs_hr, rad_sw_cs_hr_av, rad_sw_hr,         &
+              rad_sw_hr_av
 
     USE random_function_mod,                                                   &
@@ -190,4 +193,5 @@
        ENDIF
     ENDIF
+    WRITE ( 14 )  'ol                  ';  WRITE ( 14 )  ol
     WRITE ( 14 )  'p                   ';  WRITE ( 14 )  p
     IF ( ALLOCATED( p_av ) )  THEN
@@ -290,4 +294,16 @@
           WRITE ( 14 )  'rad_lw_out_av       ';  WRITE ( 14 )  rad_lw_out_av  
        ENDIF 
+       IF ( ALLOCATED( rad_lw_cs_hr ) )  THEN
+          WRITE ( 14 )  'rad_lw_cs_hr        ';  WRITE ( 14 )  rad_lw_cs_hr
+       ENDIF
+       IF ( ALLOCATED( rad_lw_cs_hr_av ) )  THEN
+          WRITE ( 14 )  'rad_lw_cs_hr_av     ';  WRITE ( 14 )  rad_lw_cs_hr_av
+       ENDIF
+       IF ( ALLOCATED( rad_lw_hr ) )  THEN
+          WRITE ( 14 )  'rad_lw_hr           ';  WRITE ( 14 )  rad_lw_hr
+       ENDIF
+       IF ( ALLOCATED( rad_lw_hr_av ) )  THEN
+          WRITE ( 14 )  'rad_lw_hr_av        ';  WRITE ( 14 )  rad_lw_hr_av
+       ENDIF
        IF ( ALLOCATED( rad_sw_in ) )  THEN
           WRITE ( 14 )  'rad_sw_in           ';  WRITE ( 14 )  rad_sw_in  
@@ -302,4 +318,16 @@
           WRITE ( 14 )  'rad_sw_out_av       ';  WRITE ( 14 )  rad_sw_out_av  
        ENDIF 
+       IF ( ALLOCATED( rad_sw_cs_hr ) )  THEN
+          WRITE ( 14 )  'rad_sw_cs_hr        ';  WRITE ( 14 )  rad_sw_cs_hr
+       ENDIF
+       IF ( ALLOCATED( rad_sw_cs_hr_av ) )  THEN
+          WRITE ( 14 )  'rad_sw_cs_hr_av     ';  WRITE ( 14 )  rad_sw_cs_hr_av
+       ENDIF
+       IF ( ALLOCATED( rad_sw_hr ) )  THEN
+          WRITE ( 14 )  'rad_sw_hr           ';  WRITE ( 14 )  rad_sw_hr
+       ENDIF
+       IF ( ALLOCATED( rad_sw_hr_av ) )  THEN
+          WRITE ( 14 )  'rad_sw_hr_av        ';  WRITE ( 14 )  rad_sw_hr_av
+       ENDIF
     ENDIF
     IF ( ocean )  THEN
@@ -338,5 +366,4 @@
                                            WRITE ( 14 )  seq_random_array
     ENDIF
-    WRITE ( 14 )  'rif                 ';  WRITE ( 14 )  rif
     IF ( topography /= 'flat' )  THEN
        WRITE ( 14 )  'rif_wall            ';  WRITE ( 14 )  rif_wall
Index: palm/trunk/SOURCE/write_var_list.f90
===================================================================
--- palm/trunk/SOURCE/write_var_list.f90	(revision 1686)
+++ palm/trunk/SOURCE/write_var_list.f90	(revision 1691)
@@ -14,10 +14,11 @@
 ! PALM. If not, see <http://www.gnu.org/licenses/>.
 !
-! Copyright 1997-2014 Leibniz Universitaet Hannover
+! Copyright 1997-2015 Leibniz Universitaet Hannover
 !--------------------------------------------------------------------------------!
 !
 ! Current revisions:
 ! -----------------
-! 
+! Added output of most_method, constant_flux_layer, zeta_min, zeta_max. Removed 
+! output of prandtl_layer and rif_min, rif_max.
 ! 
 ! Former revisions:
@@ -161,4 +162,5 @@
         ONLY:  statistic_regions, hom, hom_sum, u_max, u_max_ijk, v_max,       &
                v_max_ijk, w_max, w_max_ijk
+
     
     IMPLICIT NONE
@@ -167,5 +169,5 @@
 
 
-    binary_version = '3.9b'
+    binary_version = '4.0'
 
     WRITE ( 14 )  binary_version
@@ -273,4 +275,6 @@
     WRITE ( 14 )  conserve_volume_flow_mode
     WRITE ( 14 )  'coupling_start_time           '
+    WRITE ( 14 )  'constant_flux_layer           '
+    WRITE ( 14 )  constant_flux_layer
     WRITE ( 14 )  coupling_start_time
     WRITE ( 14 )  'current_timestep_number       '
@@ -374,4 +378,6 @@
     WRITE ( 14 )  'momentum_advec                '
     WRITE ( 14 )  momentum_advec
+    WRITE ( 14 )  'most_method                   '
+    WRITE ( 14 )  most_method
     WRITE ( 14 )  'nc_const                      '
     WRITE ( 14 )  nc_const
@@ -406,6 +412,4 @@
     WRITE ( 14 )  'phi                           '
     WRITE ( 14 )  phi
-    WRITE ( 14 )  'prandtl_layer                 '
-    WRITE ( 14 )  prandtl_layer
     WRITE ( 14 )  'prandtl_number                '
     WRITE ( 14 )  prandtl_number
@@ -462,8 +466,4 @@
     WRITE ( 14 )  'residual_limit                '
     WRITE ( 14 )  residual_limit
-    WRITE ( 14 )  'rif_max                       '
-    WRITE ( 14 )  rif_max
-    WRITE ( 14 )  'rif_min                       '
-    WRITE ( 14 )  rif_min
     WRITE ( 14 )  'roughness_length              '
     WRITE ( 14 )  roughness_length
@@ -624,4 +624,8 @@
     WRITE ( 14 )  'w_max_ijk                     '
     WRITE ( 14 )  w_max_ijk
+    WRITE ( 14 )  'zeta_max                      '
+    WRITE ( 14 )  zeta_max
+    WRITE ( 14 )  'zeta_min                      '
+    WRITE ( 14 )  zeta_min
     WRITE ( 14 )  'z0h_factor                    '
     WRITE ( 14 )  z0h_factor
