Index: palm/trunk/SOURCE/data_output_2d.f90
===================================================================
--- palm/trunk/SOURCE/data_output_2d.f90	(revision 1319)
+++ palm/trunk/SOURCE/data_output_2d.f90	(revision 1320)
@@ -20,5 +20,11 @@
 ! Current revisions:
 ! -----------------
-!
+! 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
 !
 ! Former revisions:
@@ -65,67 +71,4 @@
 ! +z0h
 !
-! 790 2011-11-29 03:11:20Z raasch
-! bugfix: calculation of 'pr' must depend on the particle weighting factor
-!
-! 771 2011-10-27 10:56:21Z heinze
-! +lpt
-!
-! 759 2011-09-15 13:58:31Z raasch
-! Splitting of parallel I/O
-!
-! 729 2011-05-26 10:33:34Z heinze
-! Exchange ghost layers for p regardless of used pressure solver (except SOR).
-!
-! 691 2011-03-04 08:45:30Z maronga
-! Replaced simulated_time by time_since_reference_point
-!
-! 673 2011-01-18 16:19:48Z suehring
-! When using Multigrid or SOR solver an additional CALL exchange_horiz is 
-! is needed for pressure output.
-!
-! 667 2010-12-23 12:06:00Z suehring/gryschka
-! nxl-1, nxr+1, nys-1, nyn+1 replaced by nxlg, nxrg, nysg, nyng in loops and 
-! allocation of arrays local_2d and total_2d.
-! Calls of exchange_horiz are modiefied.
-!
-! 622 2010-12-10 08:08:13Z raasch
-! optional barriers included in order to speed up collective operations
-!
-! 493 2010-03-01 08:30:24Z raasch
-! netCDF4 support (parallel output)
-!
-! 367 2009-08-25 08:35:52Z maronga
-! simulated_time in netCDF output replaced by time_since_reference_point.
-! Output of netCDF messages with aid of message handling routine.
-! Bugfix: averaging along z is not allowed for 2d quantities (e.g. u* and z0)
-! Output of messages replaced by message handling routine.
-! Output of user defined 2D (XY) arrays at z=nzb+1 is now possible
-! Bugfix: to_be_resorted => s_av for time-averaged scalars
-! Calculation of shf* and qsws* added.
-!
-! 215 2008-11-18 09:54:31Z raasch
-! Bugfix: no output of particle concentration and radius unless particles
-! have been started
-!
-! 96 2007-06-04 08:07:41Z raasch
-! Output of density and salinity
-!
-! 75 2007-03-22 09:54:05Z raasch
-! Output of precipitation amount/rate and roughness length,
-! 2nd+3rd argument removed from exchange horiz
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.5  2006/08/22 13:50:29  raasch
-! xz and yz cross sections now up to nzt+1
-!
-! Revision 1.2  2006/02/23 10:19:22  raasch
-! Output of time-averaged data, output of averages along x, y, or z,
-! output of user-defined quantities,
-! section data are copied from local_pf to local_2d before they are output,
-! output of particle concentration and mean radius,
-! Former subroutine plot_2d renamed data_output_2d, pl2d.. renamed do2d..,
-! anz renamed ngp, ebene renamed section, pl2d_.._anz renamed do2d_.._n
-!
 ! Revision 1.1  1997/08/11 06:24:09  raasch
 ! Initial revision
@@ -140,34 +83,89 @@
 !------------------------------------------------------------------------------!
 
-    USE arrays_3d
+    USE arrays_3d,                                                             &
+        ONLY:  dzw, e, nr, 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
+        
     USE averaging
-    USE cloud_parameters
-    USE control_parameters
-    USE cpulog
-    USE grid_variables
-    USE indices
+        
+    USE cloud_parameters,                                                      &
+        ONLY:  hyrho, l_d_cp, precipitation_amount, precipitation_rate, prr,   &
+               pt_d_t
+               
+    USE control_parameters,                                                    &
+        ONLY:  cloud_physics, data_output_2d_on_each_pe, data_output_xy,       &
+               data_output_xz, data_output_yz, do2d,                           &
+               do2d_xy_last_time, do2d_xy_n, do2d_xy_time_count,               &
+               do2d_xz_last_time, do2d_xz_n, do2d_xz_time_count,               &
+               do2d_yz_last_time, do2d_yz_n, do2d_yz_time_count,               &
+               ibc_uv_b, icloud_scheme, io_blocks, io_group, iso2d_output,     &
+               message_string, netcdf_data_format, netcdf_output,              &
+               ntdim_2d_xy, ntdim_2d_xz, ntdim_2d_yz, psolver, section,        &
+               simulated_time,  simulated_time_chr, time_since_reference_point
+        
+    USE cpulog,                                                                &
+        ONLY:  cpu_log, log_point 
+        
+    USE grid_variables,                                                        &
+        ONLY:  dx, dy
+        
+    USE indices,                                                               &
+        ONLY:  nbgp, nx, nxl, nxlg, nxr, nxrg, ny, nyn, nyng, nys, nysg,       &
+               nz, nzb, nzt
+               
+    USE kinds
+        
     USE netcdf_control
-    USE particle_attributes
+
+    USE particle_attributes,                                                   &
+        ONLY:  particle_advection_start, particles, prt_count,                 &
+               prt_start_index
+    
     USE pegrid
 
     IMPLICIT NONE
 
-    CHARACTER (LEN=2)  ::  do2d_mode, mode
-    CHARACTER (LEN=4)  ::  grid
-    CHARACTER (LEN=25) ::  section_chr
-    CHARACTER (LEN=50) ::  rtext
-    INTEGER ::  av, ngp, file_id, i, if, is, iis, j, k, l, layer_xy, n, ns, &
-                psi, s, sender, &
-                ind(4)
-    LOGICAL ::  found, resorted, two_d
-    REAL    ::  mean_r, s_r3, s_r4
-    REAL, DIMENSION(:), ALLOCATABLE ::      level_z
-    REAL, DIMENSION(:,:), ALLOCATABLE ::    local_2d, local_2d_l
-    REAL, DIMENSION(:,:,:), ALLOCATABLE ::  local_pf, local_2d_sections, &
-                                            local_2d_sections_l
+    CHARACTER (LEN=2)  ::  do2d_mode    !: 
+    CHARACTER (LEN=2)  ::  mode         !: 
+    CHARACTER (LEN=4)  ::  grid         !: 
+    CHARACTER (LEN=25) ::  section_chr  !: 
+    CHARACTER (LEN=50) ::  rtext        !: 
+    
+    INTEGER(iwp) ::  av        !: 
+    INTEGER(iwp) ::  ngp       !: 
+    INTEGER(iwp) ::  file_id   !: 
+    INTEGER(iwp) ::  i         !: 
+    INTEGER(iwp) ::  if        !: 
+    INTEGER(iwp) ::  is        !: 
+    INTEGER(iwp) ::  iis       !: 
+    INTEGER(iwp) ::  j         !: 
+    INTEGER(iwp) ::  k         !: 
+    INTEGER(iwp) ::  l         !: 
+    INTEGER(iwp) ::  layer_xy  !: 
+    INTEGER(iwp) ::  n         !: 
+    INTEGER(iwp) ::  ns        !: 
+    INTEGER(iwp) ::  psi       !: 
+    INTEGER(iwp) ::  s         !: 
+    INTEGER(iwp) ::  sender    !: 
+    INTEGER(iwp) ::  ind(4)    !: 
+    
+    LOGICAL ::  found          !: 
+    LOGICAL ::  resorted       !: 
+    LOGICAL ::  two_d          !: 
+    
+    REAL(wp) ::  mean_r         !:
+    REAL(wp) ::  s_r3           !:
+    REAL(wp) ::  s_r4           !:
+    
+    REAL(wp), DIMENSION(:), ALLOCATABLE ::      level_z     !:
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::    local_2d    !:
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::    local_2d_l  !:
+    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  local_pf    !:
+    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  local_2d_sections   !:
+    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  local_2d_sections_l !:
 #if defined( __parallel )
-    REAL, DIMENSION(:,:),   ALLOCATABLE ::  total_2d
-#endif
-    REAL, DIMENSION(:,:,:), POINTER ::  to_be_resorted
+    REAL(wp), DIMENSION(:,:),   ALLOCATABLE ::  total_2d  !:
+#endif
+    REAL(wp), DIMENSION(:,:,:), POINTER ::  to_be_resorted  !: 
 
     NAMELIST /LOCAL/  rtext
@@ -184,24 +182,24 @@
 !-- the given end time by the length of the given output interval.
     IF ( netcdf_data_format > 4 )  THEN
-       IF ( mode == 'xy'  .AND.  do2d_xy_time_count(av) + 1 > &
+       IF ( mode == 'xy'  .AND.  do2d_xy_time_count(av) + 1 >                  &
             ntdim_2d_xy(av) )  THEN
-          WRITE ( message_string, * ) 'Output of xy cross-sections is not ', &
-                          'given at t=', simulated_time, '&because the', & 
+          WRITE ( message_string, * ) 'Output of xy cross-sections is not ',   &
+                          'given at t=', simulated_time, '&because the',       & 
                           ' maximum number of output time levels is exceeded.'
           CALL message( 'data_output_2d', 'PA0384', 0, 1, 0, 6, 0 )          
           RETURN
        ENDIF
-       IF ( mode == 'xz'  .AND.  do2d_xz_time_count(av) + 1 > &
+       IF ( mode == 'xz'  .AND.  do2d_xz_time_count(av) + 1 >                  &
             ntdim_2d_xz(av) )  THEN
-          WRITE ( message_string, * ) 'Output of xz cross-sections is not ',  &
-                          'given at t=', simulated_time, '&because the', & 
+          WRITE ( message_string, * ) 'Output of xz cross-sections is not ',   &
+                          'given at t=', simulated_time, '&because the',       & 
                           ' maximum number of output time levels is exceeded.'
           CALL message( 'data_output_2d', 'PA0385', 0, 1, 0, 6, 0 )          
           RETURN
        ENDIF
-       IF ( mode == 'yz'  .AND.  do2d_yz_time_count(av) + 1 > &
+       IF ( mode == 'yz'  .AND.  do2d_yz_time_count(av) + 1 >                  &
             ntdim_2d_yz(av) )  THEN
-          WRITE ( message_string, * ) 'Output of yz cross-sections is not ', &
-                          'given at t=', simulated_time, '&because the', & 
+          WRITE ( message_string, * ) 'Output of yz cross-sections is not ',   &
+                          'given at t=', simulated_time, '&because the',       & 
                           ' maximum number of output time levels is exceeded.'
           CALL message( 'data_output_2d', 'PA0386', 0, 1, 0, 6, 0 )          
@@ -363,5 +361,5 @@
                    DO  i = nxlg, nxrg
                       DO  j = nysg, nyng
-                         local_pf(i,j,nzb+1) = SUM( ql(nzb:nzt,j,i) * &
+                         local_pf(i,j,nzb+1) = SUM( ql(nzb:nzt,j,i) *          &
                                                     dzw(1:nzt+1) )
                       ENDDO
@@ -427,7 +425,7 @@
                                s_r4 = 0.0
                                DO  n = psi, psi+prt_count(k,j,i)-1
-                                  s_r3 = s_r3 + particles(n)%radius**3 * &
+                                  s_r3 = s_r3 + particles(n)%radius**3 *       &
                                                 particles(n)%weight_factor
-                                  s_r4 = s_r4 + particles(n)%radius**4 * &
+                                  s_r4 = s_r4 + particles(n)%radius**4 *       &
                                                 particles(n)%weight_factor
                                ENDDO
@@ -499,5 +497,6 @@
                       DO  i = nxlg, nxrg
                          DO  j = nysg, nyng
-                            local_pf(i,j,nzb+1) = prr_av(nzb+1,j,i) * hyrho(nzb+1)
+                            local_pf(i,j,nzb+1) = prr_av(nzb+1,j,i) *          &
+                                                  hyrho(nzb+1)
                          ENDDO
                       ENDDO
@@ -539,6 +538,6 @@
                       DO  j = nysg, nyng
                             DO  k = nzb, nzt+1
-                               local_pf(i,j,k) = pt(k,j,i) + l_d_cp *    &
-                                                             pt_d_t(k) * &
+                               local_pf(i,j,k) = pt(k,j,i) + l_d_cp *          &
+                                                             pt_d_t(k) *       &
                                                              ql(k,j,i)
                             ENDDO
@@ -600,6 +599,6 @@
                                psi = prt_start_index(k,j,i)
                                DO  n = psi, psi+prt_count(k,j,i)-1
-                                  tend(k,j,i) =  tend(k,j,i) + &
-                                                 particles(n)%weight_factor / &
+                                  tend(k,j,i) =  tend(k,j,i) +                 &
+                                                 particles(n)%weight_factor /  &
                                                  prt_count(k,j,i)
                                ENDDO
@@ -824,5 +823,5 @@
 !
 !--             User defined quantity
-                CALL user_data_output_2d( av, do2d(av,if), found, grid, &
+                CALL user_data_output_2d( av, do2d(av,if), found, grid,        &
                                           local_pf, two_d )
                 resorted = .TRUE.
@@ -837,5 +836,5 @@
 
                 IF ( .NOT. found )  THEN
-                   message_string = 'no output provided for: ' //    &
+                   message_string = 'no output provided for: ' //              &
                                     TRIM( do2d(av,if) )
                    CALL message( 'data_output_2d', 'PA0181', 0, 0, 0, 6, 0 )
@@ -881,6 +880,6 @@
                       do2d_xy_last_time(av)  = simulated_time
                       IF ( myid == 0 )  THEN
-                         IF ( ( .NOT. data_output_2d_on_each_pe  .AND. &
-                              netcdf_output )  .OR.  netcdf_data_format > 4 ) &
+                         IF ( ( .NOT. data_output_2d_on_each_pe  .AND.         &
+                              netcdf_output )  .OR.  netcdf_data_format > 4 )  &
                          THEN
 #if defined( __netcdf )
@@ -947,5 +946,5 @@
 #if defined( __netcdf )
                          IF ( netcdf_output  .AND.  myid == 0 )  THEN
-                            WRITE ( 21 )  time_since_reference_point, &
+                            WRITE ( 21 )  time_since_reference_point,          &
                                           do2d_xy_time_count(av), av
                          ENDIF
@@ -981,12 +980,12 @@
 !--                            Index limits are received in arbitrary order from
 !--                            the PEs.
-                               CALL MPI_RECV( ind(1), 4, MPI_INTEGER,    &
-                                              MPI_ANY_SOURCE, 0, comm2d, &
+                               CALL MPI_RECV( ind(1), 4, MPI_INTEGER,          &
+                                              MPI_ANY_SOURCE, 0, comm2d,       &
                                               status, ierr )
                                sender = status(MPI_SOURCE)
                                DEALLOCATE( local_2d )
                                ALLOCATE( local_2d(ind(1):ind(2),ind(3):ind(4)) )
-                               CALL MPI_RECV( local_2d(ind(1),ind(3)), ngp,  &
-                                              MPI_REAL, sender, 1, comm2d,   &
+                               CALL MPI_RECV( local_2d(ind(1),ind(3)), ngp,    &
+                                              MPI_REAL, sender, 1, comm2d,     &
                                               status, ierr )
                                total_2d(ind(1):ind(2),ind(3):ind(4)) = local_2d
@@ -1026,9 +1025,9 @@
                             ind(1) = nxlg; ind(2) = nxrg
                             ind(3) = nysg; ind(4) = nyng
-                            CALL MPI_SEND( ind(1), 4, MPI_INTEGER, 0, 0, &
+                            CALL MPI_SEND( ind(1), 4, MPI_INTEGER, 0, 0,       &
                                            comm2d, ierr )
 !
 !--                         Send data to PE0
-                            CALL MPI_SEND( local_2d(nxlg,nysg), ngp, &
+                            CALL MPI_SEND( local_2d(nxlg,nysg), ngp,           &
                                            MPI_REAL, 0, 1, comm2d, ierr )
                          ENDIF
@@ -1076,10 +1075,10 @@
                       ENDIF
                       IF ( av == 0 )  THEN
-                         rtext = TRIM( do2d(av,if) ) // '  t = ' //    &
-                                 TRIM( simulated_time_chr ) // '  ' // &
+                         rtext = TRIM( do2d(av,if) ) // '  t = ' //            &
+                                 TRIM( simulated_time_chr ) // '  ' //         &
                                  TRIM( section_chr )
                       ELSE
-                         rtext = TRIM( do2d(av,if) ) // '  averaged t = ' // &
-                                 TRIM( simulated_time_chr ) // '  ' //       &
+                         rtext = TRIM( do2d(av,if) ) // '  averaged t = ' //   &
+                                 TRIM( simulated_time_chr ) // '  ' //         &
                                  TRIM( section_chr )
                       ENDIF
@@ -1103,6 +1102,6 @@
                       do2d_xz_last_time(av)  = simulated_time
                       IF ( myid == 0 )  THEN
-                         IF ( ( .NOT. data_output_2d_on_each_pe  .AND.        &
-                              netcdf_output )  .OR.  netcdf_data_format > 4 ) &
+                         IF ( ( .NOT. data_output_2d_on_each_pe  .AND.         &
+                              netcdf_output )  .OR.  netcdf_data_format > 4 )  &
                          THEN
 #if defined( __netcdf )
@@ -1130,5 +1129,5 @@
                          DO  j = nys, nyn
                             DO  i = nxlg, nxrg
-                               local_2d_l(i,k) = local_2d_l(i,k) + &
+                               local_2d_l(i,k) = local_2d_l(i,k) +             &
                                                  local_pf(i,j,k)
                             ENDDO
@@ -1139,6 +1138,6 @@
 !--                   Now do the averaging over all PEs along y
                       IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
-                      CALL MPI_ALLREDUCE( local_2d_l(nxlg,nzb),              &
-                                          local_2d(nxlg,nzb), ngp, MPI_REAL, &
+                      CALL MPI_ALLREDUCE( local_2d_l(nxlg,nzb),                &
+                                          local_2d(nxlg,nzb), ngp, MPI_REAL,   &
                                           MPI_SUM, comm1dy, ierr )
 #else
@@ -1167,6 +1166,6 @@
 !--                   sections reside. Cross sections averaged along y are
 !--                   output on the respective first PE along y (myidy=0).
-                      IF ( ( section(is,s) >= nys  .AND.  &
-                             section(is,s) <= nyn )  .OR.  &
+                      IF ( ( section(is,s) >= nys  .AND.                       &
+                             section(is,s) <= nyn )  .OR.                      &
                            ( section(is,s) == -1  .AND.  myidy == 0 ) )  THEN
 #if defined( __netcdf )
@@ -1192,5 +1191,5 @@
 #if defined( __netcdf )
                          IF ( netcdf_output  .AND.  myid == 0 )  THEN
-                            WRITE ( 22 )  time_since_reference_point, &
+                            WRITE ( 22 )  time_since_reference_point,          &
                                           do2d_xz_time_count(av), av
                          ENDIF
@@ -1198,8 +1197,8 @@
                          DO  i = 0, io_blocks-1
                             IF ( i == io_group )  THEN
-                               IF ( ( section(is,s) >= nys  .AND.   &
-                                      section(is,s) <= nyn )  .OR.  &
-                                    ( section(is,s) == -1  .AND.    &
-                                      nys-1 == -1 ) )               &
+                               IF ( ( section(is,s) >= nys  .AND.              &
+                                      section(is,s) <= nyn )  .OR.             &
+                                    ( section(is,s) == -1  .AND.               &
+                                      nys-1 == -1 ) )                          &
                                THEN
                                   WRITE (22)  nxlg, nxrg, nzb, nzt+1
@@ -1239,6 +1238,6 @@
 !--                            Index limits are received in arbitrary order from
 !--                            the PEs.
-                               CALL MPI_RECV( ind(1), 4, MPI_INTEGER,     &
-                                              MPI_ANY_SOURCE, 0, comm2d,  &
+                               CALL MPI_RECV( ind(1), 4, MPI_INTEGER,          &
+                                              MPI_ANY_SOURCE, 0, comm2d,       &
                                               status, ierr )
 !
@@ -1247,10 +1246,10 @@
                                   sender = status(MPI_SOURCE)
                                   DEALLOCATE( local_2d )
-                                  ALLOCATE( local_2d(ind(1):ind(2), &
+                                  ALLOCATE( local_2d(ind(1):ind(2),            &
                                                      ind(3):ind(4)) )
                                   CALL MPI_RECV( local_2d(ind(1),ind(3)), ngp, &
                                                  MPI_REAL, sender, 1, comm2d,  &
                                                  status, ierr )
-                                  total_2d(ind(1):ind(2),ind(3):ind(4)) = &
+                                  total_2d(ind(1):ind(2),ind(3):ind(4)) =      &
                                                                         local_2d
                                ENDIF
@@ -1291,10 +1290,10 @@
                                ind(3) = -9999; ind(4) = -9999
                             ENDIF
-                            CALL MPI_SEND( ind(1), 4, MPI_INTEGER, 0, 0, &
+                            CALL MPI_SEND( ind(1), 4, MPI_INTEGER, 0, 0,       &
                                            comm2d, ierr )
 !
 !--                         If applicable, send data to PE0.
                             IF ( ind(1) /= -9999 )  THEN
-                               CALL MPI_SEND( local_2d(nxlg,nzb), ngp, &
+                               CALL MPI_SEND( local_2d(nxlg,nzb), ngp,         &
                                               MPI_REAL, 0, 1, comm2d, ierr )
                             ENDIF
@@ -1335,10 +1334,10 @@
                       ENDIF
                       IF ( av == 0 )  THEN
-                         rtext = TRIM( do2d(av,if) ) // '  t = ' //    &
-                                 TRIM( simulated_time_chr ) // '  ' // &
+                         rtext = TRIM( do2d(av,if) ) // '  t = ' //            &
+                                 TRIM( simulated_time_chr ) // '  ' //         &
                                  TRIM( section_chr )
                       ELSE
-                         rtext = TRIM( do2d(av,if) ) // '  averaged t = ' // &
-                                 TRIM( simulated_time_chr ) // '  ' //       &
+                         rtext = TRIM( do2d(av,if) ) // '  averaged t = ' //   &
+                                 TRIM( simulated_time_chr ) // '  ' //         &
                                  TRIM( section_chr )
                       ENDIF
@@ -1355,6 +1354,6 @@
                       do2d_yz_last_time(av)  = simulated_time
                       IF ( myid == 0 )  THEN
-                         IF ( ( .NOT. data_output_2d_on_each_pe  .AND.        &
-                              netcdf_output )  .OR.  netcdf_data_format > 4 ) &
+                         IF ( ( .NOT. data_output_2d_on_each_pe  .AND.         &
+                              netcdf_output )  .OR.  netcdf_data_format > 4 )  &
                          THEN
 #if defined( __netcdf )
@@ -1382,5 +1381,5 @@
                          DO  j = nysg, nyng
                             DO  i = nxl, nxr
-                               local_2d_l(j,k) = local_2d_l(j,k) + &
+                               local_2d_l(j,k) = local_2d_l(j,k) +             &
                                                  local_pf(i,j,k)
                             ENDDO
@@ -1391,6 +1390,6 @@
 !--                   Now do the averaging over all PEs along x
                       IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
-                      CALL MPI_ALLREDUCE( local_2d_l(nysg,nzb),              &
-                                          local_2d(nysg,nzb), ngp, MPI_REAL, &
+                      CALL MPI_ALLREDUCE( local_2d_l(nysg,nzb),                &
+                                          local_2d(nysg,nzb), ngp, MPI_REAL,   &
                                           MPI_SUM, comm1dx, ierr )
 #else
@@ -1419,6 +1418,6 @@
 !--                   sections reside. Cross sections averaged along x are
 !--                   output on the respective first PE along x (myidx=0).
-                      IF ( ( section(is,s) >= nxl  .AND.  &
-                             section(is,s) <= nxr )  .OR.  &
+                      IF ( ( section(is,s) >= nxl  .AND.                       &
+                             section(is,s) <= nxr )  .OR.                      &
                            ( section(is,s) == -1  .AND.  myidx == 0 ) )  THEN
 #if defined( __netcdf )
@@ -1444,5 +1443,5 @@
 #if defined( __netcdf )
                          IF ( netcdf_output  .AND.  myid == 0 )  THEN
-                            WRITE ( 23 )  time_since_reference_point, &
+                            WRITE ( 23 )  time_since_reference_point,          &
                                           do2d_yz_time_count(av), av
                          ENDIF
@@ -1450,8 +1449,8 @@
                          DO  i = 0, io_blocks-1
                             IF ( i == io_group )  THEN
-                               IF ( ( section(is,s) >= nxl  .AND.   &
-                                      section(is,s) <= nxr )  .OR.  &
-                                    ( section(is,s) == -1  .AND.    &
-                                      nxl-1 == -1 ) )               &
+                               IF ( ( section(is,s) >= nxl  .AND.              &
+                                      section(is,s) <= nxr )  .OR.             &
+                                    ( section(is,s) == -1  .AND.               &
+                                      nxl-1 == -1 ) )                          &
                                THEN
                                   WRITE (23)  nysg, nyng, nzb, nzt+1
@@ -1491,6 +1490,6 @@
 !--                            Index limits are received in arbitrary order from
 !--                            the PEs.
-                               CALL MPI_RECV( ind(1), 4, MPI_INTEGER,     &
-                                              MPI_ANY_SOURCE, 0, comm2d,  &
+                               CALL MPI_RECV( ind(1), 4, MPI_INTEGER,          &
+                                              MPI_ANY_SOURCE, 0, comm2d,       &
                                               status, ierr )
 !
@@ -1499,10 +1498,10 @@
                                   sender = status(MPI_SOURCE)
                                   DEALLOCATE( local_2d )
-                                  ALLOCATE( local_2d(ind(1):ind(2), &
+                                  ALLOCATE( local_2d(ind(1):ind(2),            &
                                                      ind(3):ind(4)) )
                                   CALL MPI_RECV( local_2d(ind(1),ind(3)), ngp, &
                                                  MPI_REAL, sender, 1, comm2d,  &
                                                  status, ierr )
-                                  total_2d(ind(1):ind(2),ind(3):ind(4)) = &
+                                  total_2d(ind(1):ind(2),ind(3):ind(4)) =      &
                                                                         local_2d
                                ENDIF
@@ -1543,10 +1542,10 @@
                                ind(3) = -9999; ind(4) = -9999
                             ENDIF
-                            CALL MPI_SEND( ind(1), 4, MPI_INTEGER, 0, 0, &
+                            CALL MPI_SEND( ind(1), 4, MPI_INTEGER, 0, 0,       &
                                            comm2d, ierr )
 !
 !--                         If applicable, send data to PE0.
                             IF ( ind(1) /= -9999 )  THEN
-                               CALL MPI_SEND( local_2d(nysg,nzb), ngp, &
+                               CALL MPI_SEND( local_2d(nysg,nzb), ngp,         &
                                               MPI_REAL, 0, 1, comm2d, ierr )
                             ENDIF
@@ -1587,10 +1586,10 @@
                       ENDIF
                       IF ( av == 0 )  THEN
-                         rtext = TRIM( do2d(av,if) ) // '  t = ' //    &
-                                 TRIM( simulated_time_chr ) // '  ' // &
+                         rtext = TRIM( do2d(av,if) ) // '  t = ' //            &
+                                 TRIM( simulated_time_chr ) // '  ' //         &
                                  TRIM( section_chr )
                       ELSE
-                         rtext = TRIM( do2d(av,if) ) // '  averaged t = ' // &
-                                 TRIM( simulated_time_chr ) // '  ' //       &
+                         rtext = TRIM( do2d(av,if) ) // '  averaged t = ' //   &
+                                 TRIM( simulated_time_chr ) // '  ' //         &
                                  TRIM( section_chr )
                       ENDIF
