Index: palm/trunk/SOURCE/exchange_horiz_2d.f90
===================================================================
--- palm/trunk/SOURCE/exchange_horiz_2d.f90	(revision 3183)
+++ palm/trunk/SOURCE/exchange_horiz_2d.f90	(revision 3542)
@@ -20,5 +20,6 @@
 ! Current revisions:
 ! -----------------
-! 
+! - New routine for exchange of 8-bit integer arrays
+! - Set Neumann conditions also at radiation boundary
 ! 
 ! Former revisions:
@@ -213,18 +214,17 @@
 
 
-
 !------------------------------------------------------------------------------!
 ! Description:
 ! ------------
 !> Exchange of lateral (ghost) boundaries (parallel computers) and cyclic
-!> boundary conditions, respectively, for 2D integer arrays.
-!------------------------------------------------------------------------------!
- 
- SUBROUTINE exchange_horiz_2d_int( ar, nys_l, nyn_l, nxl_l, nxr_l, nbgp_local )
+!> boundary conditions, respectively, for 2D 8-bit integer arrays.
+!------------------------------------------------------------------------------!
+ SUBROUTINE exchange_horiz_2d_byte( ar, nys_l, nyn_l, nxl_l, nxr_l, nbgp_local )
 
 
     USE control_parameters,                                                    &
         ONLY:  bc_dirichlet_l, bc_dirichlet_n, bc_dirichlet_r,                 &
-               bc_dirichlet_s, bc_lr_cyc, bc_ns_cyc, bc_radiation_l,           &
+               bc_dirichlet_s, bc_radiation_l, bc_radiation_n, bc_radiation_r, &
+               bc_radiation_s, bc_lr_cyc, bc_ns_cyc, bc_radiation_l,           &
                bc_radiation_n, bc_radiation_r, bc_radiation_s, grid_level
         
@@ -245,4 +245,140 @@
     INTEGER(iwp) ::  nbgp_local  !< number of ghost layers to be exchanged
 
+    INTEGER(KIND=1), DIMENSION(nys_l-nbgp_local:nyn_l+nbgp_local,              &
+                               nxl_l-nbgp_local:nxr_l+nbgp_local) ::  ar  !< treated array
+
+    CALL cpu_log( log_point_s(13), 'exchange_horiz_2d', 'start' )
+
+#if defined( __parallel )
+
+!
+!-- Exchange of lateral boundary values for parallel computers
+    IF ( pdims(1) == 1 )  THEN
+
+!
+!--    One-dimensional decomposition along y, boundary values can be exchanged
+!--    within the PE memory
+       ar(:,nxl_l-nbgp_local:nxl_l-1) = ar(:,nxr_l-nbgp_local+1:nxr_l)
+       ar(:,nxr_l+1:nxr_l+nbgp_local) = ar(:,nxl_l:nxl_l+nbgp_local-1)
+
+    ELSE
+!
+!--    Send left boundary, receive right one
+       CALL MPI_SENDRECV( ar(nys_l-nbgp_local,nxl_l),   1,                     &
+                          type_y_byte, pleft,  0,                              &
+                          ar(nys_l-nbgp_local,nxr_l+1), 1,                     &
+                          type_y_byte, pright, 0,                              &
+                          comm2d, status, ierr )
+!
+!--    Send right boundary, receive left one
+       CALL MPI_SENDRECV( ar(nys_l-nbgp_local,nxr_l+1-nbgp_local), 1,          &
+                          type_y_byte, pright, 1,                              &
+                          ar(nys_l-nbgp_local,nxl_l-nbgp_local),   1,          & 
+                          type_y_byte, pleft,  1,                              &
+                          comm2d, status, ierr )                         
+
+    ENDIF
+
+    IF ( pdims(2) == 1 )  THEN
+!
+!--    One-dimensional decomposition along x, boundary values can be exchanged
+!--    within the PE memory
+       ar(nys_l-nbgp_local:nys_l-1,:) = ar(nyn_l+1-nbgp_local:nyn_l,:)
+       ar(nyn_l+1:nyn_l+nbgp_local,:) = ar(nys_l:nys_l-1+nbgp_local,:)
+
+
+    ELSE
+!
+!--    Send front boundary, receive rear one
+       CALL MPI_SENDRECV( ar(nys_l,nxl_l-nbgp_local),   1,                    &
+                          type_x_byte, psouth, 0,                             &
+                          ar(nyn_l+1,nxl_l-nbgp_local), 1,                    &
+                          type_x_byte, pnorth, 0,                             &
+                          comm2d, status, ierr )                          
+
+!
+!--    Send rear boundary, receive front one
+       CALL MPI_SENDRECV( ar(nyn_l+1-nbgp_local,nxl_l-nbgp_local), 1,         &
+                          type_x_byte, pnorth, 1,                             &
+                          ar(nys_l-nbgp_local,nxl_l-nbgp_local),   1,         &
+                          type_x_byte, psouth, 1,                             &
+                          comm2d, status, ierr )
+
+    ENDIF
+
+#else
+
+!
+!-- Lateral boundary conditions in the non-parallel case
+    IF ( bc_lr_cyc )  THEN
+       ar(:,nxl_l-nbgp_local:nxl_l-1) = ar(:,nxr_l-nbgp_local+1:nxr_l)
+       ar(:,nxr_l+1:nxr_l+nbgp_local) = ar(:,nxl_l:nxl_l+nbgp_local-1)
+    ENDIF
+
+    IF ( bc_ns_cyc )  THEN
+       ar(nys_l-nbgp_local:nys_l-1,:) = ar(nyn_l+1-nbgp_local:nyn_l,:)
+       ar(nyn_l+1:nyn_l+nbgp_local,:) = ar(nys_l:nys_l-1+nbgp_local,:)
+    ENDIF
+
+#endif
+!
+!-- Neumann-conditions at inflow/outflow/nested boundaries
+    IF ( bc_dirichlet_l  .OR.  bc_radiation_l )  THEN
+       DO  i = nbgp_local, 1, -1
+         ar(:,nxl_l-i) = ar(:,nxl_l)
+       ENDDO
+    ENDIF
+    IF ( bc_dirichlet_r  .OR.  bc_radiation_r  )  THEN
+       DO  i = 1, nbgp_local
+          ar(:,nxr_l+i) = ar(:,nxr_l)
+       ENDDO
+    ENDIF
+    IF ( bc_dirichlet_s  .OR.  bc_radiation_s  )  THEN
+       DO  i = nbgp_local, 1, -1
+         ar(nys_l-i,:) = ar(nys_l,:)
+       ENDDO
+    ENDIF
+    IF ( bc_dirichlet_n  .OR.  bc_radiation_n  )  THEN
+       DO  i = 1, nbgp_local
+         ar(nyn_l+i,:) = ar(nyn_l,:)
+       ENDDO
+    ENDIF
+
+    CALL cpu_log( log_point_s(13), 'exchange_horiz_2d', 'stop' )
+
+ END SUBROUTINE exchange_horiz_2d_byte
+ 
+
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Exchange of lateral (ghost) boundaries (parallel computers) and cyclic
+!> boundary conditions, respectively, for 2D 32-bit integer arrays.
+!------------------------------------------------------------------------------!
+ SUBROUTINE exchange_horiz_2d_int( ar, nys_l, nyn_l, nxl_l, nxr_l, nbgp_local )
+
+
+    USE control_parameters,                                                    &
+        ONLY:  bc_dirichlet_l, bc_dirichlet_n, bc_dirichlet_r,                 &
+               bc_dirichlet_s, bc_radiation_l, bc_radiation_n, bc_radiation_r, &
+               bc_radiation_s, bc_lr_cyc, bc_ns_cyc, bc_radiation_l,           &
+               bc_radiation_n, bc_radiation_r, bc_radiation_s, grid_level
+        
+    USE cpulog,                                                                &
+        ONLY:  cpu_log, log_point_s
+               
+    USE kinds
+    
+    USE pegrid
+
+    IMPLICIT NONE
+
+    INTEGER(iwp) ::  i           !< dummy index to zero-gradient conditions at in/outflow boundaries
+    INTEGER(iwp) ::  nxl_l       !< local index bound at current grid level, left side
+    INTEGER(iwp) ::  nxr_l       !< local index bound at current grid level, right side
+    INTEGER(iwp) ::  nyn_l       !< local index bound at current grid level, north side
+    INTEGER(iwp) ::  nys_l       !< local index bound at current grid level, south side
+    INTEGER(iwp) ::  nbgp_local  !< number of ghost layers to be exchanged
+
     INTEGER(iwp), DIMENSION(nys_l-nbgp_local:nyn_l+nbgp_local,                 &
                             nxl_l-nbgp_local:nxr_l+nbgp_local) ::  ar  !< treated array
@@ -324,20 +460,20 @@
 !
 !-- Neumann-conditions at inflow/outflow/nested boundaries
-    IF ( bc_dirichlet_l )  THEN
+    IF ( bc_dirichlet_l  .OR.  bc_radiation_l )  THEN
        DO  i = nbgp_local, 1, -1
          ar(:,nxl_l-i) = ar(:,nxl_l)
        ENDDO
     ENDIF
-    IF ( bc_dirichlet_r )  THEN
+    IF ( bc_dirichlet_r  .OR.  bc_radiation_r  )  THEN
        DO  i = 1, nbgp_local
           ar(:,nxr_l+i) = ar(:,nxr_l)
        ENDDO
     ENDIF
-    IF ( bc_dirichlet_s )  THEN
+    IF ( bc_dirichlet_s  .OR.  bc_radiation_s  )  THEN
        DO  i = nbgp_local, 1, -1
          ar(nys_l-i,:) = ar(nys_l,:)
        ENDDO
     ENDIF
-    IF ( bc_dirichlet_n )  THEN
+    IF ( bc_dirichlet_n  .OR.  bc_radiation_n  )  THEN
        DO  i = 1, nbgp_local
          ar(nyn_l+i,:) = ar(nyn_l,:)
