Index: palm/trunk/SOURCE/check_open.f90
===================================================================
--- palm/trunk/SOURCE/check_open.f90	(revision 4067)
+++ palm/trunk/SOURCE/check_open.f90	(revision 4069)
@@ -25,4 +25,8 @@
 ! -----------------
 ! $Id$
+! Masked output running index mid has been introduced as a local variable to 
+! avoid runtime error (Loop variable has been modified) in time_integration
+! 
+! 3967 2019-05-09 16:04:34Z gronemeier
 ! Save binary data of virtual measurements within separate folder
 ! 
@@ -189,5 +193,5 @@
     USE control_parameters,                                                    &
         ONLY:  coupling_char, data_output_2d_on_each_pe,                       &
-               max_masks, message_string, mid, nz_do3d, openfile,              &
+               max_masks, message_string, nz_do3d, openfile,              &
                run_description_header
 
@@ -227,4 +231,5 @@
     INTEGER(iwp) ::  file_id     !<
     INTEGER(iwp) ::  ioerr       !< IOSTAT flag for IO-commands ( 0 = no error )
+    INTEGER(iwp) ::  mid         !< masked output running index
     
     LOGICAL ::  netcdf_extend    !<
Index: palm/trunk/SOURCE/check_parameters.f90
===================================================================
--- palm/trunk/SOURCE/check_parameters.f90	(revision 4067)
+++ palm/trunk/SOURCE/check_parameters.f90	(revision 4069)
@@ -25,4 +25,8 @@
 ! -----------------
 ! $Id$
+! Masked output running index mid has been introduced as a local variable to 
+! avoid runtime error (Loop variable has been modified) in time_integration
+! 
+! 4048 2019-06-21 21:00:21Z knoop
 ! Moved tcm_check_data_output to module_interface
 ! 
@@ -858,4 +862,5 @@
     INTEGER(iwp) ::  k                               !< loop index
     INTEGER(iwp) ::  kk                              !< loop index
+    INTEGER(iwp) ::  mid                             !< masked output running index
     INTEGER(iwp) ::  netcdf_data_format_save         !< initial value of netcdf_data_format
     INTEGER(iwp) ::  position                        !< index position of string
Index: palm/trunk/SOURCE/chemistry_model_mod.f90
===================================================================
--- palm/trunk/SOURCE/chemistry_model_mod.f90	(revision 4067)
+++ palm/trunk/SOURCE/chemistry_model_mod.f90	(revision 4069)
@@ -27,4 +27,8 @@
 ! -----------------
 ! $Id$
+! Masked output running index mid has been introduced as a local variable to 
+! avoid runtime error (Loop variable has been modified) in time_integration
+! 
+! 4029 2019-06-14 14:04:35Z raasch
 ! nest_chemistry option removed
 ! 
@@ -1510,5 +1514,5 @@
 !> Subroutine defining mask output variables for chemical species
 !------------------------------------------------------------------------------!
- SUBROUTINE chem_data_output_mask( av, variable, found, local_pf )
+ SUBROUTINE chem_data_output_mask( av, variable, found, local_pf, mid )
 
 
@@ -1520,17 +1524,21 @@
 
     CHARACTER(LEN=5)  ::  grid        !< flag to distinquish between staggered grids
+    CHARACTER(LEN=16) ::  spec_name
     CHARACTER(LEN=*)  ::  variable    !< 
-    INTEGER(iwp)  ::  av              !< flag to control data output of instantaneous or time-averaged data
-    LOGICAL ::  found
-    REAL(wp), DIMENSION(mask_size_l(mid,1),mask_size_l(mid,2),mask_size_l(mid,3)) ::  &
-              local_pf   !< 
-!
-!-- local variables.
-    CHARACTER(LEN=16)  ::  spec_name
+    
+    INTEGER(iwp) ::  av              !< flag to control data output of instantaneous or time-averaged data
     INTEGER(iwp) ::  lsp
     INTEGER(iwp) ::  i               !< grid index along x-direction
     INTEGER(iwp) ::  j               !< grid index along y-direction
     INTEGER(iwp) ::  k               !< grid index along z-direction
+    INTEGER(iwp) ::  mid             !< masked output running index
     INTEGER(iwp) ::  topo_top_ind    !< k index of highest horizontal surface
+    
+    LOGICAL ::  found
+    
+    REAL(wp), DIMENSION(mask_size_l(mid,1),mask_size_l(mid,2),mask_size_l(mid,3)) ::  &
+              local_pf   !< 
+!
+!-- local variables.
 
     found = .TRUE.
Index: palm/trunk/SOURCE/close_file.f90
===================================================================
--- palm/trunk/SOURCE/close_file.f90	(revision 4067)
+++ palm/trunk/SOURCE/close_file.f90	(revision 4069)
@@ -25,4 +25,8 @@
 ! -----------------
 ! $Id$
+! Masked output running index mid has been introduced as a local variable to 
+! avoid runtime error (Loop variable has been modified) in time_integration
+! 
+! 3655 2019-01-07 16:51:22Z knoop
 ! unused variables and format statements removed
 ! 
@@ -94,5 +98,5 @@
 
     USE control_parameters,                                                    &
-        ONLY:  max_masks, mid, openfile
+        ONLY:  max_masks, openfile
                 
     USE kinds
@@ -119,4 +123,5 @@
     INTEGER(iwp) ::  fid          !< 
     INTEGER(iwp) ::  file_id      !< 
+    INTEGER(iwp) ::  mid          !< masked output running index 
     INTEGER(iwp) ::  planz        !< 
 
Index: palm/trunk/SOURCE/data_output_mask.f90
===================================================================
--- palm/trunk/SOURCE/data_output_mask.f90	(revision 4067)
+++ palm/trunk/SOURCE/data_output_mask.f90	(revision 4069)
@@ -25,4 +25,8 @@
 ! -----------------
 ! $Id$
+! Masked output running index mid has been introduced as a local variable to 
+! avoid runtime error (Loop variable has been modified) in time_integration 
+! 
+! 4039 2019-06-18 10:32:41Z suehring
 ! Modularize diagnostic output
 ! 
@@ -156,5 +160,5 @@
 !> Masked data output in netCDF format for current mask (current value of mid).
 !------------------------------------------------------------------------------!
- SUBROUTINE data_output_mask( av )
+ SUBROUTINE data_output_mask( av, mid )
 
  
@@ -180,5 +184,5 @@
                mask_j, mask_k, mask_size, mask_size_l, mask_start_l,           &
                mask_surface,                                                   &
-               max_masks, message_string, mid, nz_do3d, salsa,                 &
+               max_masks, message_string, nz_do3d, salsa,                      &
                time_since_reference_point
 
@@ -229,4 +233,5 @@
     INTEGER(iwp) ::  k                       !< loop index
     INTEGER(iwp) ::  kk                      !< vertical index
+    INTEGER(iwp) ::  mid                     !< masked output running index
     INTEGER(iwp) ::  n                       !< loop index
     INTEGER(iwp) ::  netcdf_data_format_save !< value of netcdf_data_format
@@ -686,19 +691,20 @@
              IF ( radiation )  THEN
                 CALL radiation_data_output_mask(av, domask(mid,av,ivar), found,&
-                                                local_pf )
+                                                local_pf, mid )
              ENDIF
 
              IF ( air_chemistry )  THEN
                 CALL chem_data_output_mask(av, domask(mid,av,ivar), found,     &
-                                           local_pf )
+                                           local_pf, mid )
              ENDIF
 !
 !--          Check for diagnostic quantities
-             CALL doq_output_mask( av, domask(mid,av,ivar), found, local_pf )
+             CALL doq_output_mask( av, domask(mid,av,ivar), found, local_pf,   &
+                                   mid)
 !
 !--          SALSA quantities
              IF (  salsa )  THEN
                 CALL salsa_data_output_mask( av, domask(mid,av,ivar), found,   &
-                                             local_pf )
+                                             local_pf, mid )
              ENDIF         
 !
@@ -706,5 +712,5 @@
              IF ( .NOT. found )  THEN
                 CALL user_data_output_mask(av, domask(mid,av,ivar), found,     &
-                                           local_pf )
+                                           local_pf, mid )
              ENDIF
 
Index: palm/trunk/SOURCE/diagnostic_output_quantities_mod.f90
===================================================================
--- palm/trunk/SOURCE/diagnostic_output_quantities_mod.f90	(revision 4067)
+++ palm/trunk/SOURCE/diagnostic_output_quantities_mod.f90	(revision 4069)
@@ -25,4 +25,8 @@
 ! -----------------
 ! $Id$
+! Masked output running index mid has been introduced as a local variable to 
+! avoid runtime error (Loop variable has been modified) in time_integration 
+! 
+! 4039 2019-06-18 10:32:41Z suehring
 ! - Add output of uu, vv, ww to enable variance calculation according temporal
 !   EC method
@@ -679,5 +683,5 @@
 !> temporary array with indices (i,j,k) for masked data output.
 !------------------------------------------------------------------------------!
- SUBROUTINE doq_output_mask( av, variable, found, local_pf )
+ SUBROUTINE doq_output_mask( av, variable, found, local_pf, mid )
  
     USE control_parameters
@@ -698,4 +702,5 @@
     INTEGER(iwp) ::  j            !< index variable along y-direction
     INTEGER(iwp) ::  k            !< index variable along z-direction
+    INTEGER(iwp) ::  mid          !< masked output running index 
     INTEGER(iwp) ::  topo_top_ind !< k index of highest horizontal surface
 
@@ -965,5 +970,5 @@
 
     USE control_parameters,                                                    &
-        ONLY:  do2d, do3d, domask, masks, mid
+        ONLY:  do2d, do3d, domask, masks
 
     IMPLICIT NONE
@@ -976,4 +981,5 @@
     INTEGER(iwp) ::  ivar_all   !< loop index
     INTEGER(iwp) ::  l          !< index for cutting string
+    INTEGER(iwp) ::  mid          !< masked output running index 
 
     prepared_diagnostic_output_quantities = .FALSE.
Index: palm/trunk/SOURCE/fft_xy_mod.f90
===================================================================
--- palm/trunk/SOURCE/fft_xy_mod.f90	(revision 4067)
+++ palm/trunk/SOURCE/fft_xy_mod.f90	(revision 4069)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Code added to avoid compiler warnings
+! 
+! 3655 2019-01-07 16:51:22Z knoop
 ! OpenACC port for SPEC
 ! 
@@ -457,4 +460,8 @@
        REAL(wp), DIMENSION(0:nx,nys_x:nyn_x,nzb_x:nzt_x) ::                    &
           ar      !<
+
+!
+!--    To avoid compiler warning: Unused dummy argument âar_2dâ
+       IF ( PRESENT( ar_2d ) )  CONTINUE
 
        IF ( direction == 'forward' )  THEN
Index: palm/trunk/SOURCE/header.f90
===================================================================
--- palm/trunk/SOURCE/header.f90	(revision 4067)
+++ palm/trunk/SOURCE/header.f90	(revision 4069)
@@ -25,4 +25,8 @@
 ! -----------------
 ! $Id$
+! Masked output running index mid has been introduced as a local variable to 
+! avoid runtime error (Loop variable has been modified) in time_integration 
+! 
+! 4023 2019-06-12 13:20:01Z maronga
 ! Renamed "coupling start time" to "spinup time"
 ! 
@@ -541,4 +545,5 @@
     INTEGER(iwp) ::  l              !< substring length
     INTEGER(iwp) ::  ll             !< substring length
+    INTEGER(iwp) ::  mid            !< masked output running index
     INTEGER(iwp) ::  my_cpl_id      !< run id in a nested model setup
     INTEGER(iwp) ::  n              !< running index over number of couplers in a nested model setup
Index: palm/trunk/SOURCE/init_masks.f90
===================================================================
--- palm/trunk/SOURCE/init_masks.f90	(revision 4067)
+++ palm/trunk/SOURCE/init_masks.f90	(revision 4069)
@@ -25,4 +25,8 @@
 ! -----------------
 ! $Id$
+! Masked output running index mid has been introduced as a local variable to 
+! avoid runtime error (Loop variable has been modified) in time_integration 
+! 
+! 3766 2019-02-26 16:23:41Z raasch
 ! unused variables removed
 ! 
@@ -178,5 +182,5 @@
                mask_surface, mask_x,                                           &
                mask_x_loop, mask_xyz_dimension, mask_y, mask_y_loop, mask_z,   &
-               mask_z_loop, max_masks,  message_string, mid,                   &
+               mask_z_loop, max_masks,  message_string,                        &
                passive_scalar, ocean_mode, varnamelength
 
@@ -216,4 +220,5 @@
     INTEGER(iwp) ::  k            !< loop index
     INTEGER(iwp) ::  m            !< mask index
+    INTEGER(iwp) ::  mid            !< masked output running index
     INTEGER(iwp) ::  n            !< loop index
     INTEGER(iwp) ::  sender       !< PE id of sending PE
Index: palm/trunk/SOURCE/modules.f90
===================================================================
--- palm/trunk/SOURCE/modules.f90	(revision 4067)
+++ palm/trunk/SOURCE/modules.f90	(revision 4069)
@@ -25,4 +25,8 @@
 ! -----------------
 ! $Id$
+! Masked output running index mid has been introduced as a local variable to 
+! avoid runtime error (Loop variable has been modified) in time_integration
+! 
+! 4017 2019-06-06 12:16:46Z schwenkel
 ! increase maximum number of virtual flights
 ! 
@@ -1226,5 +1230,4 @@
     INTEGER(iwp) ::  mg_cycles = 4                     !< namelist parameter
     INTEGER(iwp) ::  mg_switch_to_pe0_level = -1       !< namelist parameter
-    INTEGER(iwp) ::  mid                               !< masked output running index
     INTEGER(iwp) ::  ngsrb = 2                         !< namelist parameter
     INTEGER(iwp) ::  nr_timesteps_this_run = 0         !< number of timesteps (cpu time measurements)
Index: palm/trunk/SOURCE/netcdf_interface_mod.f90
===================================================================
--- palm/trunk/SOURCE/netcdf_interface_mod.f90	(revision 4067)
+++ palm/trunk/SOURCE/netcdf_interface_mod.f90	(revision 4069)
@@ -25,4 +25,8 @@
 ! -----------------
 ! $Id$
+! Masked output running index mid has been introduced as a local variable to 
+! avoid runtime error (Loop variable has been modified) in time_integration
+! 
+! 4046 2019-06-21 17:32:04Z knoop
 ! removal of special treatment for usm_define_netcdf_grid call
 ! 
@@ -697,5 +701,5 @@
                mask_size_l, mask_i, mask_i_global, mask_j, mask_j_global,      &
                mask_k_global, mask_surface,                                    &
-               message_string, mid, ntdim_2d_xy, ntdim_2d_xz,                  &
+               message_string, ntdim_2d_xy, ntdim_2d_xz,                       &
                ntdim_2d_yz, ntdim_3d, nz_do3d, ocean_mode, plant_canopy,       &
                run_description_header, salsa, section, simulated_time,         &
@@ -796,4 +800,5 @@
     INTEGER(iwp) ::  k                                       !<
     INTEGER(iwp) ::  kk                                      !<
+    INTEGER(iwp) ::  mid                                     !< masked output running index
     INTEGER(iwp) ::  ns                                      !<
     INTEGER(iwp) ::  ns_do                                   !< actual value of ns for soil model data
Index: palm/trunk/SOURCE/radiation_model_mod.f90
===================================================================
--- palm/trunk/SOURCE/radiation_model_mod.f90	(revision 4067)
+++ palm/trunk/SOURCE/radiation_model_mod.f90	(revision 4069)
@@ -28,4 +28,8 @@
 ! -----------------
 ! $Id$
+! Masked output running index mid has been introduced as a local variable to 
+! avoid runtime error (Loop variable has been modified) in time_integration
+! 
+! 4067 2019-07-01 13:29:25Z suehring
 ! Bugfix, pass dummy string to MPI_INFO_SET (J. Resler)
 ! 
@@ -11101,5 +11105,5 @@
 !> Subroutine defining masked data output
 !------------------------------------------------------------------------------!
- SUBROUTINE radiation_data_output_mask( av, variable, found, local_pf )
+ SUBROUTINE radiation_data_output_mask( av, variable, found, local_pf, mid )
  
     USE control_parameters
@@ -11120,4 +11124,5 @@
     INTEGER(iwp) ::  j               !< 
     INTEGER(iwp) ::  k               !< 
+    INTEGER(iwp) ::  mid             !< masked output running index
     INTEGER(iwp) ::  topo_top_ind    !< k index of highest horizontal surface
 
Index: palm/trunk/SOURCE/salsa_mod.f90
===================================================================
--- palm/trunk/SOURCE/salsa_mod.f90	(revision 4067)
+++ palm/trunk/SOURCE/salsa_mod.f90	(revision 4069)
@@ -26,4 +26,8 @@
 ! -----------------
 ! $Id$
+! Masked output running index mid has been introduced as a local variable to 
+! avoid runtime error (Loop variable has been modified) in time_integration
+! 
+! 4058 2019-06-27 15:25:42Z knoop
 ! Bugfix: to_be_resorted was uninitialized in case of s_H2O in 3d_data_averaging
 ! 
@@ -10716,5 +10720,5 @@
 !> Subroutine defining mask output variables
 !------------------------------------------------------------------------------!
- SUBROUTINE salsa_data_output_mask( av, variable, found, local_pf )
+ SUBROUTINE salsa_data_output_mask( av, variable, found, local_pf, mid )
 
     USE arrays_3d,                                                                                 &
@@ -10722,5 +10726,5 @@
 
     USE control_parameters,                                                                        &
-        ONLY:  mask_size_l, mask_surface, mid
+        ONLY:  mask_size_l, mask_surface
 
     USE surface_mod,                                                                               &
@@ -10740,4 +10744,5 @@
     INTEGER(iwp) ::  j               !< loop index in y-direction
     INTEGER(iwp) ::  k               !< loop index in z-direction
+    INTEGER(iwp) ::  mid            !< masked output running index
     INTEGER(iwp) ::  topo_top_ind    !< k index of highest horizontal surface
 
Index: palm/trunk/SOURCE/time_integration.f90
===================================================================
--- palm/trunk/SOURCE/time_integration.f90	(revision 4067)
+++ palm/trunk/SOURCE/time_integration.f90	(revision 4069)
@@ -25,4 +25,8 @@
 ! -----------------
 ! $Id$
+! Masked output running index mid has been introduced as a local variable to 
+! avoid runtime error (Loop variable has been modified) in time_integration
+! 
+! 4064 2019-07-01 05:33:33Z gronemeier
 ! Moved call to radiation module out of intermediate time loop
 ! 
@@ -572,5 +576,5 @@
                indoor_model, intermediate_timestep_count, intermediate_timestep_count_max,         &
                land_surface, large_scale_forcing, loop_optimization, lsf_surf, lsf_vert, masks,    &
-               mid, multi_agent_system_end, multi_agent_system_start, nesting_offline, neutral,    &
+               multi_agent_system_end, multi_agent_system_start, nesting_offline, neutral,         &
                nr_timesteps_this_run, nudging, ocean_mode, passive_scalar, pt_reference,           &
                pt_slope_offset, random_heatflux, rans_mode, rans_tke_e, run_coupled, salsa,        &
@@ -728,11 +732,12 @@
     CHARACTER (LEN=9) ::  time_to_string   !<
 
-    INTEGER(iwp)      ::  ib        !< index for aerosol size bins
-    INTEGER(iwp)      ::  ic        !< index for aerosol mass bins
-    INTEGER(iwp)      ::  icc       !< additional index for aerosol mass bins
-    INTEGER(iwp)      ::  ig        !< index for salsa gases
-    INTEGER(iwp)      ::  lsp
-    INTEGER(iwp)      ::  lsp_usr   !<
-    INTEGER(iwp)      ::  n         !< loop counter for chemistry species
+    INTEGER(iwp) ::  ib        !< index for aerosol size bins
+    INTEGER(iwp) ::  ic        !< index for aerosol mass bins
+    INTEGER(iwp) ::  icc       !< additional index for aerosol mass bins
+    INTEGER(iwp) ::  ig        !< index for salsa gases
+    INTEGER(iwp) ::  lsp
+    INTEGER(iwp) ::  lsp_usr   !<
+    INTEGER(iwp) ::  mid       !< masked output running index
+    INTEGER(iwp) ::  n         !< loop counter for chemistry species
 
     REAL(wp) ::  dt_3d_old  !< temporary storage of timestep to be used for
@@ -1870,5 +1875,5 @@
                 CALL doq_calculate
 
-             CALL data_output_mask( 0 )
+             CALL data_output_mask( 0, mid )
              time_domask(mid) = MOD( time_domask(mid), MAX( dt_domask(mid), dt_3d ) )
           ENDIF
@@ -1890,5 +1895,5 @@
           CALL data_output_3d( 1 )
           DO  mid = 1, masks
-             CALL data_output_mask( 1 )
+             CALL data_output_mask( 1, mid )
           ENDDO
           time_do_av = MOD( time_do_av, MAX( dt_data_output_av, dt_3d ) )
Index: palm/trunk/SOURCE/user_data_output_mask.f90
===================================================================
--- palm/trunk/SOURCE/user_data_output_mask.f90	(revision 4067)
+++ palm/trunk/SOURCE/user_data_output_mask.f90	(revision 4069)
@@ -25,4 +25,8 @@
 ! -----------------
 ! $Id$
+! Masked output running index mid has been introduced as a local variable to 
+! avoid runtime error (Loop variable has been modified) in time_integration
+! 
+! 3768 2019-02-27 14:35:58Z raasch
 ! variables commented + statement added to avoid compiler warnings about unused variables
 ! 
@@ -59,5 +63,5 @@
 !> temporary array with indices (i,j,k) for masked data output.
 !------------------------------------------------------------------------------!
- SUBROUTINE user_data_output_mask( av, variable, found, local_pf )
+ SUBROUTINE user_data_output_mask( av, variable, found, local_pf, mid )
  
 
@@ -79,4 +83,5 @@
 
     INTEGER(iwp) ::  av             !< 
+    INTEGER(iwp) ::  mid            !< masked output running index
 !    INTEGER(iwp) ::  i              !<
 !    INTEGER(iwp) ::  j              !<
