Index: palm/trunk/SOURCE/surface_data_output_mod.f90
===================================================================
--- palm/trunk/SOURCE/surface_data_output_mod.f90	(revision 4128)
+++ palm/trunk/SOURCE/surface_data_output_mod.f90	(revision 4129)
@@ -25,26 +25,30 @@
 ! -----------------
 ! $Id$
+! - bugfix: corrected loop over horizontal default surfaces
+! - change default setting of to_vtk and to_netcdf
+!
+! 4029 2019-06-14 14:04:35Z raasch
 ! netcdf variable NF90_NOFILL is used as argument instead of "1" in call to NF90_DEF_VAR_FILL
-! 
+!
 ! 3881 2019-04-10 09:31:22Z suehring
-! Check for zero output timestep (not allowed in parallel NetCDF output mode) 
-! 
+! Check for zero output timestep (not allowed in parallel NetCDF output mode)
+!
 ! 3817 2019-03-26 13:53:57Z suehring
 ! Correct output coordinates of vertical surface elements
-! 
+!
 ! 3766 2019-02-26 16:23:41Z raasch
 ! bugfix in surface_data_output_rrd_local (variable k removed)
-! 
+!
 ! 3762 2019-02-25 16:54:16Z suehring
-! Remove unused variables and add preprocessor directives for variables that 
-! are used only when netcdf4 is defined 
-! 
+! Remove unused variables and add preprocessor directives for variables that
+! are used only when netcdf4 is defined
+!
 ! 3745 2019-02-15 18:57:56Z suehring
 ! Output of waste_heat and innermost wall flux from indoor model
-! 
+!
 ! 3744 2019-02-15 18:38:58Z suehring
-! Add azimuth and zenith to output file; set long-name attributes; 
+! Add azimuth and zenith to output file; set long-name attributes;
 ! clean-up coding layout
-! 
+!
 ! 3735 2019-02-12 09:52:40Z suehring
 ! - Split initialization into initialization of arrays and further initialization
@@ -196,6 +200,6 @@
 
    LOGICAL :: first_output(0:1) = .FALSE.                 !< true if first output was already called
-   LOGICAL :: to_netcdf = .TRUE.                          !< flag indicating parallel NetCDF output
-   LOGICAL :: to_vtk = .TRUE.                             !< flag indicating binary surface-data output that can be further
+   LOGICAL :: to_netcdf = .FALSE.                         !< flag indicating parallel NetCDF output
+   LOGICAL :: to_vtk = .FALSE.                            !< flag indicating binary surface-data output that can be further
                                                           !< processed to VTK format
 
@@ -323,5 +327,5 @@
 
       IMPLICIT NONE
-      
+
 #if defined( __netcdf4_parallel )
       CHARACTER (LEN=100)  :: filename            !< name of output file
@@ -600,11 +604,11 @@
 
          DO  l = 0, 1
-            DO  m = 1, surf_def_h(0)%ns
+            DO  m = 1, surf_def_h(l)%ns
 !
 !--            Determine the indices of the respective grid cell inside the
 !--            topography.
-               i = surf_def_h(0)%i(m) + surf_def_h(0)%ioff
-               j = surf_def_h(0)%j(m) + surf_def_h(0)%joff
-               k = surf_def_h(0)%k(m) + surf_def_h(0)%koff
+               i = surf_def_h(l)%i(m) + surf_def_h(l)%ioff
+               j = surf_def_h(l)%j(m) + surf_def_h(l)%joff
+               k = surf_def_h(l)%k(m) + surf_def_h(l)%koff
 !
 !--            Check if the vertices that define the surface element are
@@ -2802,5 +2806,5 @@
 
                ENDIF
-               
+
             CASE ( 'uvw1' )
 !
@@ -3789,5 +3793,5 @@
                                            surf_lsm_v(3)%uvw_abs,              &
                                            surf_usm_v(3)%uvw_abs, n_out )
-                                           
+
             CASE ( 'waste_heat' )
                CALL surface_data_output_sum_up( surf_def_h(0)%waste_heat,      &
@@ -3807,5 +3811,5 @@
                                            surf_lsm_v(3)%waste_heat,           &
                                            surf_usm_v(3)%waste_heat, n_out )
-                                           
+
             CASE ( 'im_hf' )
                CALL surface_data_output_sum_up( surf_def_h(0)%iwghf_eb,        &
@@ -4294,5 +4298,13 @@
        INTEGER(iwp) ::  ilen  !< string length
        INTEGER(iwp) ::  n_out !< running index for number of output variables
-
+!
+!--    Check if any output file type is selected
+       IF ( .NOT. to_vtk  .AND.  .NOT. to_netcdf )  THEN
+          WRITE( message_string, * )                                     &
+             'no output file type selected for surface-data output!&' // &
+             'Set at least either "to_vtk" or "to_netcdf" to .TRUE.'
+          CALL message( 'surface_data_output_check_parameters',          &
+                        'PA0662', 1, 2, 0, 6, 0 )
+       ENDIF
 !
 !--    Check the average interval
@@ -4324,6 +4336,6 @@
 !
 !--    In case of parallel NetCDF output the output timestep must not be zero.
-!--    This is because the number of requiered output timesteps is 
-!--    pre-calculated, which is not possible with zero output timestep. 
+!--    This is because the number of requiered output timesteps is
+!--    pre-calculated, which is not possible with zero output timestep.
        IF ( netcdf_data_format > 4 )  THEN
           IF ( dt_dosurf == 0.0_wp )  THEN
@@ -4334,5 +4346,5 @@
                            1, 2, 0, 6, 0 )
           ENDIF
-          
+
           IF ( dt_dosurf_av == 0.0_wp )  THEN
              message_string = 'dt_dosurf_av = 0.0 while using a ' //          &
@@ -4434,5 +4446,5 @@
             CASE ( 'r_a', 'r_canopy', 'r_soil', 'r_s' )
                unit = 's/m'
-               
+
             CASE ( 'waste_heat', 'im_hf' )
                IF ( .NOT. indoor_model )  THEN
@@ -4442,5 +4454,5 @@
                              'PA0588', 1, 2, 0, 6, 0 )
                ENDIF
-            
+
                unit = 'W/m2'
 
