Index: palm/trunk/SOURCE/check_open.f90
===================================================================
--- palm/trunk/SOURCE/check_open.f90	(revision 2963)
+++ palm/trunk/SOURCE/check_open.f90	(revision 2964)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Error message moved to radiation_model_mod
+! 
+! 2957 2018-04-11 08:48:06Z Giersch
 ! Error message has been corrected in case of writing sky view factors
 ! 
@@ -167,7 +170,7 @@
 
     USE control_parameters,                                                    &
-        ONLY:  coupling_char, data_output_2d_on_each_pe, max_masks,            &
-               message_string, mid, nz_do3d, openfile, run_description_header, &
-               runnr
+        ONLY:  coupling_char, data_output_2d_on_each_pe,                       &
+               max_masks, message_string, mid, nz_do3d, openfile,              &
+               run_description_header, runnr
 
     USE grid_variables,                                                        &
@@ -546,12 +549,4 @@
        CASE ( 88 )
 
-          IF (numprocs_previous_run /= numprocs) THEN
-             WRITE( message_string, * ) 'A different number of processors',    &
-                                        ' between the run that has written',   &
-                                        ' the svf data and the one that will ',&
-                                        ' read it is not allowed' 
-             CALL message( 'check_open', 'PA0484', 1, 2, 0, 6, 0 )
-          ENDIF
-
           IF ( myid_char == '' )  THEN
              OPEN ( 88, FILE='SVFIN'//TRIM( coupling_char )//myid_char,        &
@@ -887,5 +882,4 @@
 !--       actual run.
           INQUIRE( FILE=filename, EXIST=netcdf_extend )
-
           IF ( netcdf_extend )  THEN
 !
Index: palm/trunk/SOURCE/check_parameters.f90
===================================================================
--- palm/trunk/SOURCE/check_parameters.f90	(revision 2963)
+++ palm/trunk/SOURCE/check_parameters.f90	(revision 2964)
@@ -25,4 +25,8 @@
 ! -----------------
 ! $Id$
+! Calculation of fixed number of output time levels for parallel netcdf output
+! has been revised (based on calculations in netcdf_interface_mod)
+! 
+! 2938 2018-03-27 15:52:42Z suehring
 ! - Revise start and end indices for imposing random disturbances in case of
 !   nesting or large-scale forcing.
@@ -3689,11 +3693,32 @@
        CALL check_dt_do( dt_do2d_yz, 'dt_do2d_yz' )
 
-       ntdim_3d(0)    = CEILING( ( end_time - skip_time_do3d ) / dt_do3d )
+!--    Set needed time levels (ntdim) to 
+!--    saved time levels + to be saved time levels.
+       ntdim_3d(0) = do3d_time_count(0) + CEILING(                             &
+                     ( end_time - MAX( skip_time_do3d,                         &
+                                       simulated_time_at_begin )               &
+                     ) / dt_do3d )
        IF ( do3d_at_begin ) ntdim_3d(0) = ntdim_3d(0) + 1
-       ntdim_3d(1)    = CEILING( ( end_time - skip_time_data_output_av )           &
-                             / dt_data_output_av )
-       ntdim_2d_xy(0) = CEILING( ( end_time - skip_time_do2d_xy ) / dt_do2d_xy )
-       ntdim_2d_xz(0) = CEILING( ( end_time - skip_time_do2d_xz ) / dt_do2d_xz )
-       ntdim_2d_yz(0) = CEILING( ( end_time - skip_time_do2d_yz ) / dt_do2d_yz )
+
+       ntdim_3d(1) = do3d_time_count(1) + CEILING(                             &
+                     ( end_time - MAX( skip_time_data_output_av,               &
+                                       simulated_time_at_begin )               &
+                     ) / dt_data_output_av )
+
+       ntdim_2d_xy(0) = do2d_xy_time_count(0) + CEILING(                       &
+                        ( end_time - MAX( skip_time_do2d_xy,                   &
+                                          simulated_time_at_begin )            &
+                        ) / dt_do2d_xy )
+
+       ntdim_2d_xz(0) = do2d_xz_time_count(0) + CEILING(                       &
+                        ( end_time - MAX( skip_time_do2d_xz,                   &
+                                          simulated_time_at_begin )            &
+                        ) / dt_do2d_xz )
+
+       ntdim_2d_yz(0) = do2d_yz_time_count(0) + CEILING(                       &
+                        ( end_time - MAX( skip_time_do2d_yz,                   &
+                                          simulated_time_at_begin )            &
+                        ) / dt_do2d_yz )
+
        IF ( do2d_at_begin )  THEN
           ntdim_2d_xy(0) = ntdim_2d_xy(0) + 1
@@ -3701,7 +3726,19 @@
           ntdim_2d_yz(0) = ntdim_2d_yz(0) + 1
        ENDIF
-       ntdim_2d_xy(1) = ntdim_3d(1)
-       ntdim_2d_xz(1) = ntdim_3d(1)
-       ntdim_2d_yz(1) = ntdim_3d(1)
+
+       ntdim_2d_xy(1) = do2d_xy_time_count(1) + CEILING(                       &
+                        ( end_time - MAX( skip_time_data_output_av,            &
+                                          simulated_time_at_begin )            &
+                        ) / dt_data_output_av )
+
+       ntdim_2d_xz(1) = do2d_xz_time_count(1) + CEILING(                       &
+                        ( end_time - MAX( skip_time_data_output_av,            &
+                                          simulated_time_at_begin )            &
+                                 ) / dt_data_output_av )
+
+       ntdim_2d_yz(1) = do2d_yz_time_count(1) + CEILING(                       &
+                        ( end_time - MAX( skip_time_data_output_av,            &
+                                          simulated_time_at_begin )            &
+                        ) / dt_data_output_av )
 
     ENDIF
Index: palm/trunk/SOURCE/modules.f90
===================================================================
--- palm/trunk/SOURCE/modules.f90	(revision 2963)
+++ palm/trunk/SOURCE/modules.f90	(revision 2964)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! *_time_count variables are all initialized with zero now
+! 
+! 2918 2018-03-21 15:52:14Z gronemeier
 ! -l_grid, -l_wall
 ! 
@@ -1182,9 +1185,9 @@
     INTEGER(iwp) ::  dist_nys(0:1)                               !< south boundary of disturbance region
     INTEGER(iwp) ::  do2d_no(0:1) = 0                            !< number of 2d output quantities
-    INTEGER(iwp) ::  do2d_xy_time_count(0:1)                     !< number of output intervals for 2d data (xy)
-    INTEGER(iwp) ::  do2d_xz_time_count(0:1)                     !< number of output intervals for 2d data (xz)
-    INTEGER(iwp) ::  do2d_yz_time_count(0:1)                     !< number of output intervals for 2d data (yz)
+    INTEGER(iwp) ::  do2d_xy_time_count(0:1) = 0                 !< number of output intervals for 2d data (xy)
+    INTEGER(iwp) ::  do2d_xz_time_count(0:1) = 0                 !< number of output intervals for 2d data (xz)
+    INTEGER(iwp) ::  do2d_yz_time_count(0:1) = 0                 !< number of output intervals for 2d data (yz)
     INTEGER(iwp) ::  do3d_no(0:1) = 0                            !< number of 3d output quantities
-    INTEGER(iwp) ::  do3d_time_count(0:1)                        !< number of output intervals for 3d data
+    INTEGER(iwp) ::  do3d_time_count(0:1) = 0                    !< number of output intervals for 3d data
     INTEGER(iwp) ::  domask_no(max_masks,0:1) = 0                !< number of masked output quantities
     INTEGER(iwp) ::  domask_time_count(max_masks,0:1)            !< number of output intervals for masked data
Index: palm/trunk/SOURCE/netcdf_interface_mod.f90
===================================================================
--- palm/trunk/SOURCE/netcdf_interface_mod.f90	(revision 2963)
+++ palm/trunk/SOURCE/netcdf_interface_mod.f90	(revision 2964)
@@ -25,4 +25,8 @@
 ! -----------------
 ! $Id$
+! Calculation of fixed number of output time levels for parallel netcdf output
+! has been moved completely to check_parameters
+! 
+! 2932 2018-03-26 09:39:22Z maronga
 ! Renamed inipar to initialization_parameters.
 ! 
@@ -1830,20 +1834,4 @@
           IF ( netcdf_data_format > 4 )  THEN
 !
-!--          Set needed time levels (ntdim) to 
-!--          saved time levels + to be saved time levels.
-             IF ( av == 0 )  THEN 
-                ntdim_3d(0) = do3d_time_count(0) + CEILING(                &
-                              ( end_time - MAX( skip_time_do3d,            &
-                                                simulated_time_at_begin )  &
-                              ) / dt_do3d )
-                IF ( do3d_at_begin )  ntdim_3d(0) = ntdim_3d(0) + 1
-             ELSE
-                ntdim_3d(1) = do3d_time_count(1) + CEILING(                &
-                              ( end_time - MAX( skip_time_data_output_av,  &
-                                                simulated_time_at_begin )  &
-                              ) / dt_data_output_av )
-             ENDIF
-
-!
 !--          Check if the needed number of output time levels is increased
 !--          compared to the number of time levels in the existing file.
@@ -2606,20 +2594,4 @@
           IF ( netcdf_data_format > 4 )  THEN
 !
-!--          Set needed time levels (ntdim) to 
-!--          saved time levels + to be saved time levels.
-             IF ( av == 0 )  THEN 
-                ntdim_2d_xy(0) = do2d_xy_time_count(0) + CEILING(             &
-                                 ( end_time - MAX( skip_time_do2d_xy,         &
-                                                   simulated_time_at_begin )  &
-                                 ) / dt_do2d_xy )
-                IF ( do2d_at_begin )  ntdim_2d_xy(0) = ntdim_2d_xy(0) + 1
-             ELSE
-                ntdim_2d_xy(1) = do2d_xy_time_count(1) + CEILING(             &
-                                 ( end_time - MAX( skip_time_data_output_av,  &
-                                                   simulated_time_at_begin )  &
-                                 ) / dt_data_output_av )
-             ENDIF
-
-!
 !--          Check if the needed number of output time levels is increased
 !--          compared to the number of time levels in the existing file.
@@ -3265,20 +3237,4 @@
           IF ( netcdf_data_format > 4 )  THEN
 !
-!--          Set needed time levels (ntdim) to 
-!--          saved time levels + to be saved time levels.
-             IF ( av == 0 )  THEN 
-                ntdim_2d_xz(0) = do2d_xz_time_count(0) + CEILING(             &
-                                 ( end_time - MAX( skip_time_do2d_xz,         &
-                                                   simulated_time_at_begin )  &
-                                 ) / dt_do2d_xz )
-                IF ( do2d_at_begin )  ntdim_2d_xz(0) = ntdim_2d_xz(0) + 1
-             ELSE
-                ntdim_2d_xz(1) = do2d_xz_time_count(1) + CEILING(             &
-                                 ( end_time - MAX( skip_time_data_output_av,  &
-                                                   simulated_time_at_begin )  &
-                                 ) / dt_data_output_av )
-             ENDIF
-
-!
 !--          Check if the needed number of output time levels is increased
 !--          compared to the number of time levels in the existing file.
@@ -3927,20 +3883,4 @@
           IF ( netcdf_data_format > 4 )  THEN
 !
-!--          Set needed time levels (ntdim) to 
-!--          saved time levels + to be saved time levels.
-             IF ( av == 0 )  THEN 
-                ntdim_2d_yz(0) = do2d_yz_time_count(0) + CEILING(             &
-                                 ( end_time - MAX( skip_time_do2d_yz,         &
-                                                   simulated_time_at_begin )  &
-                                 ) / dt_do2d_yz )
-                IF ( do2d_at_begin )  ntdim_2d_yz(0) = ntdim_2d_yz(0) + 1
-             ELSE
-                ntdim_2d_yz(1) = do2d_yz_time_count(1) + CEILING(             &
-                                 ( end_time - MAX( skip_time_data_output_av,  &
-                                                   simulated_time_at_begin )  &
-                                 ) / dt_data_output_av )
-             ENDIF
-
-!
 !--          Check if the needed number of output time levels is increased
 !--          compared to the number of time levels in the existing file.
Index: palm/trunk/SOURCE/radiation_model_mod.f90
===================================================================
--- palm/trunk/SOURCE/radiation_model_mod.f90	(revision 2963)
+++ palm/trunk/SOURCE/radiation_model_mod.f90	(revision 2964)
@@ -28,4 +28,9 @@
 ! -----------------
 ! $Id$
+! Error message PA0491 has been introduced which could be previously found in 
+! check_open. The variable numprocs_previous_run is only known in case of 
+! initializing_actions == read_restart_data
+! 
+! 2963 2018-04-12 14:47:44Z suehring
 ! - Introduce index for vegetation/wall, pavement/green-wall and water/window 
 !   surfaces, for clearer access of surface fraction, albedo, emissivity, etc. .
@@ -6693,61 +6698,72 @@
 
         DO  i = 0, io_blocks-1
-            IF ( i == io_group )  THEN
-
-!
-!--          Open binary file 
-             CALL check_open( fsvf )
-
-!--             read and check version
-                READ ( fsvf ) rad_version_field
-                IF ( TRIM(rad_version_field) /= TRIM(rad_version) )  THEN
-                    WRITE( message_string, * ) 'Version of binary SVF file "',           &
-                                TRIM(rad_version_field), '" does not match ',            &
-                                'the version of model "', TRIM(rad_version), '"'
-                    CALL message( 'radiation_read_svf', 'PA0482', 1, 2, 0, 6, 0 )
-                ENDIF
-                
-!--             read nsvfl, ncsfl
-                READ ( fsvf ) nsvfl, ncsfl, nsurfl_from_file
-                IF ( nsvfl <= 0  .OR.  ncsfl < 0 )  THEN
-                    WRITE( message_string, * ) 'Wrong number of SVF or CSF'
-                    CALL message( 'radiation_read_svf', 'PA0483', 1, 2, 0, 6, 0 )
-                ELSE
-                    WRITE(message_string,*) '    Number of SVF, CSF, and nsurfl to read '&
-                         , nsvfl, ncsfl, nsurfl
-                    CALL location_message( message_string, .TRUE. )
-                ENDIF
-                IF ( nsurfl_from_file /= nsurfl )  THEN
-                    WRITE( message_string, * ) 'nsurfl from SVF file does not ', &
-                                               'match calculated nsurfl from ',  &
-                                               'radiation_interaction_init'
-                    CALL message( 'radiation_read_svf', 'PA0490', 1, 2, 0, 6, 0 )
-                ENDIF
-                
-                IF ( .NOT. ALLOCATED( skyvf ) )    ALLOCATE( skyvf(nsurfl) )
-                IF ( .NOT. ALLOCATED( skyvft ) )   ALLOCATE( skyvft(nsurfl) )
-                IF ( .NOT. ALLOCATED( svf ) )      ALLOCATE( svf(ndsvf,nsvfl) )
-                IF ( .NOT. ALLOCATED( svfsurf ) )  ALLOCATE( svfsurf(idsvf,nsvfl) )
-                READ(fsvf) skyvf
-                READ(fsvf) skyvft
-                READ(fsvf) svf
-                READ(fsvf) svfsurf
-                IF ( plant_canopy )  THEN
-                    IF ( .NOT. ALLOCATED( csf ) )      ALLOCATE( csf(ndcsf,ncsfl) )
-                    IF ( .NOT. ALLOCATED( csfsurf ) )  ALLOCATE( csfsurf(idcsf,ncsfl) )
-                    READ(fsvf) csf
-                    READ(fsvf) csfsurf
-                ENDIF
-                READ ( fsvf ) svf_code_field
-                
-                IF ( TRIM(svf_code_field) /= TRIM(svf_code) )  THEN
-                    WRITE( message_string, * ) 'Wrong structure of binary svf file'
-                    CALL message( 'radiation_read_svf', 'PA0484', 1, 2, 0, 6, 0 )
-                ENDIF       
+           IF ( i == io_group )  THEN
+
+              IF ( initializing_actions == 'read_restart_data' ) THEN
+
+                 IF ( numprocs_previous_run /= numprocs ) THEN
+                    WRITE( message_string, * ) 'A different number of processors',    &
+                                               ' between the run that has written',   &
+                                               ' the svf data and the one that will', &
+                                               ' read it is not allowed' 
+                    CALL message( 'check_open', 'PA0491', 1, 2, 0, 6, 0 )
+                 ENDIF
+
+              ENDIF
+!
+!--           Open binary file 
+              CALL check_open( fsvf )
+
+ !--          read and check version
+              READ ( fsvf ) rad_version_field
+              IF ( TRIM(rad_version_field) /= TRIM(rad_version) )  THEN
+                  WRITE( message_string, * ) 'Version of binary SVF file "',           &
+                              TRIM(rad_version_field), '" does not match ',            &
+                              'the version of model "', TRIM(rad_version), '"'
+                  CALL message( 'radiation_read_svf', 'PA0482', 1, 2, 0, 6, 0 )
+              ENDIF
+              
+ !--             read nsvfl, ncsfl
+              READ ( fsvf ) nsvfl, ncsfl, nsurfl_from_file
+              IF ( nsvfl <= 0  .OR.  ncsfl < 0 )  THEN
+                  WRITE( message_string, * ) 'Wrong number of SVF or CSF'
+                  CALL message( 'radiation_read_svf', 'PA0483', 1, 2, 0, 6, 0 )
+              ELSE
+                  WRITE(message_string,*) '    Number of SVF, CSF, and nsurfl to read '&
+                       , nsvfl, ncsfl, nsurfl
+                  CALL location_message( message_string, .TRUE. )
+              ENDIF
+              IF ( nsurfl_from_file /= nsurfl )  THEN
+                  WRITE( message_string, * ) 'nsurfl from SVF file does not ', &
+                                             'match calculated nsurfl from ',  &
+                                             'radiation_interaction_init'
+                  CALL message( 'radiation_read_svf', 'PA0490', 1, 2, 0, 6, 0 )
+              ENDIF
+              
+              IF ( .NOT. ALLOCATED( skyvf ) )    ALLOCATE( skyvf(nsurfl) )
+              IF ( .NOT. ALLOCATED( skyvft ) )   ALLOCATE( skyvft(nsurfl) )
+              IF ( .NOT. ALLOCATED( svf ) )      ALLOCATE( svf(ndsvf,nsvfl) )
+              IF ( .NOT. ALLOCATED( svfsurf ) )  ALLOCATE( svfsurf(idsvf,nsvfl) )
+              READ(fsvf) skyvf
+              READ(fsvf) skyvft
+              READ(fsvf) svf
+              READ(fsvf) svfsurf
+              IF ( plant_canopy )  THEN
+                  IF ( .NOT. ALLOCATED( csf ) )      ALLOCATE( csf(ndcsf,ncsfl) )
+                  IF ( .NOT. ALLOCATED( csfsurf ) )  ALLOCATE( csfsurf(idcsf,ncsfl) )
+                  READ(fsvf) csf
+                  READ(fsvf) csfsurf
+              ENDIF
+              READ ( fsvf ) svf_code_field
+              
+              IF ( TRIM(svf_code_field) /= TRIM(svf_code) )  THEN
+                  WRITE( message_string, * ) 'Wrong structure of binary svf file'
+                  CALL message( 'radiation_read_svf', 'PA0484', 1, 2, 0, 6, 0 )
+              ENDIF       
 !
 !--          Close binary file                 
              CALL close_file( fsvf )
                 
-            ENDIF
+           ENDIF
 #if defined( __parallel )
             CALL MPI_BARRIER( comm2d, ierr )
