Index: /palm/trunk/SOURCE/pmc_interface_mod.f90
===================================================================
--- /palm/trunk/SOURCE/pmc_interface_mod.f90	(revision 3797)
+++ /palm/trunk/SOURCE/pmc_interface_mod.f90	(revision 3798)
@@ -25,4 +25,8 @@
 ! -----------------
 ! $Id$
+! A bug fixed in lateral boundary interpolations. Dimension of val changed from  
+! 5 to 3 in pmci_setup_parent and pmci_setup_child.
+! 
+! 3794 2019-03-15 09:36:33Z raasch
 ! two remaining unused variables removed
 ! 
@@ -788,20 +792,17 @@
     CHARACTER(LEN=32) ::  myname
     
-    INTEGER(iwp) ::  child_id         !<
-    INTEGER(iwp) ::  ierr             !<
-    INTEGER(iwp) ::  k                !<
-    INTEGER(iwp) ::  m                !<
-    INTEGER(iwp) ::  mid              !<
-    INTEGER(iwp) ::  mm               !<
-    INTEGER(iwp) ::  n = 1            !< running index for chemical species
-    INTEGER(iwp) ::  nest_overlap     !<
-    INTEGER(iwp) ::  nomatch          !<
-    INTEGER(iwp) ::  nx_cl            !<
-    INTEGER(iwp) ::  ny_cl            !<
-    INTEGER(iwp) ::  nz_cl            !<
-
-    INTEGER(iwp), DIMENSION(5) ::  val    !<
-
-
+    INTEGER(iwp) ::  child_id           !<
+    INTEGER(iwp) ::  ierr               !<
+    INTEGER(iwp) ::  k                  !<
+    INTEGER(iwp) ::  m                  !<
+    INTEGER(iwp) ::  mid                !<
+    INTEGER(iwp) ::  mm                 !<
+    INTEGER(iwp) ::  n = 1              !< Running index for chemical species
+    INTEGER(iwp) ::  nest_overlap       !<
+    INTEGER(iwp) ::  nomatch            !<
+    INTEGER(iwp) ::  nx_cl              !<
+    INTEGER(iwp) ::  ny_cl              !<
+    INTEGER(iwp) ::  nz_cl              !<
+    INTEGER(iwp), DIMENSION(3) ::  val  !< Array for receiving the child-grid dimensions
     REAL(wp), DIMENSION(:), ALLOCATABLE ::  ch_xl   !<
     REAL(wp), DIMENSION(:), ALLOCATABLE ::  ch_xr   !<    
@@ -818,5 +819,5 @@
     REAL(wp) ::  xez              !<
     REAL(wp) ::  yez              !<
-    REAL(wp), DIMENSION(5) ::  fval                      !<
+    REAL(wp), DIMENSION(5) ::  fval                      !< Array for receiving the child-grid spacings etc 
     REAL(wp), DIMENSION(:), ALLOCATABLE ::  cl_coord_x   !<
     REAL(wp), DIMENSION(:), ALLOCATABLE ::  cl_coord_y   !<
@@ -1190,5 +1191,5 @@
     INTEGER(iwp) ::  jcsw       !< South index limit for children's parent-grid work arrays
     INTEGER(iwp) ::  n          !< Running index for number of chemical species
-    INTEGER(iwp), DIMENSION(5) ::  val        !<
+    INTEGER(iwp), DIMENSION(3) ::  val  !< Array for sending the child-grid dimensions to parent 
     REAL(wp) ::  xcs        !<
     REAL(wp) ::  xce        !<
@@ -1196,5 +1197,5 @@
     REAL(wp) ::  yce        !<
 
-    REAL(wp), DIMENSION(5) ::  fval       !<
+    REAL(wp), DIMENSION(5) ::  fval     !< Array for sending the child-grid spacings etc to parent 
                                              
 !
@@ -1276,6 +1277,4 @@
        val(2)  = ny
        val(3)  = nz
-       val(4)  = dx
-       val(5)  = dy
        fval(1) = zw(nzt+1)
        fval(2) = zw(nzt)
@@ -3536,6 +3535,4 @@
 !--            Use averages of the neighbouring matching grid-line values
                DO  j = jfl(m), jfl(m+1)
-!                  f(kfl(n):kfu(n),j,ibc) = 0.5_wp * ( workarrc_lr(n,m,lw)       &
-!                       +  workarrc_lr(n,m+1,lw) )
                   f(kfl(n):kfu(n),j,ibc) = 0.5_wp * ( f_interp_1 + f_interp_2 )
                ENDDO
@@ -3543,5 +3540,4 @@
 !--            Then set the values along the matching grid-lines  
                IF  ( MOD( jfl(m), jgsr ) == 0 )  THEN
-!                  f(kfl(n):kfu(n),jfl(m),ibc) = workarrc_lr(n,m,lw)
                   f(kfl(n):kfu(n),jfl(m),ibc) = f_interp_1
                ENDIF
@@ -3551,7 +3547,6 @@
 !--      Finally, set the values along the last matching grid-line  
          IF  ( MOD( jfl(jcnw), jgsr ) == 0 )  THEN
-            f_interp_1 = cb * workarrc_lr(n,jcnw,lw) + cp * workarrc_lr(n,jcnw,lwp)
             DO  n = 0, kct
-!               f(kfl(n):kfu(n),jfl(jcnw),ibc) = workarrc_lr(n,jcnw,lw)
+               f_interp_1 = cb * workarrc_lr(n,jcnw,lw) + cp * workarrc_lr(n,jcnw,lwp)
                f(kfl(n):kfu(n),jfl(jcnw),ibc) = f_interp_1
             ENDDO
@@ -3579,5 +3574,4 @@
 !
 !--            First substitute only the matching-node values
-!               f(kfu(n),jfl(m):jfu(m),ibc) = workarrc_lr(n,m,lw)
                f(kfu(n),jfl(m):jfu(m),ibc) = f_interp_1
                   
@@ -3606,5 +3600,4 @@
                DO  j = jfl(m), jfu(m)
                   DO  k = kfl(n), kfu(n)
-!                     f(k,j,ibc) = workarrc_lr(n,m,lw)
                      f(k,j,ibc) = f_interp_1
                   ENDDO
@@ -3771,6 +3764,4 @@
 !--            Use averages of the neighbouring matching grid-line values
                DO  i = ifl(l), ifl(l+1)
-!                  f(kfl(n):kfu(n),jbc,i) = 0.5_wp * ( workarrc_sn(n,mw,l)       &
-!                       +  workarrc_sn(n,mw,l+1) )
                   f(kfl(n):kfu(n),jbc,i) = 0.5_wp * ( f_interp_1 + f_interp_2 )
                ENDDO
@@ -3778,5 +3769,4 @@
 !--            Then set the values along the matching grid-lines  
                IF  ( MOD( ifl(l), igsr ) == 0 )  THEN
-!                  f(kfl(n):kfu(n),jbc,ifl(l)) = workarrc_sn(n,mw,l)
                   f(kfl(n):kfu(n),jbc,ifl(l)) = f_interp_1
                ENDIF
@@ -3787,7 +3777,6 @@
 !--      Finally, set the values along the last matching grid-line  
          IF  ( MOD( ifl(icrw), igsr ) == 0 )  THEN
-            f_interp_1 = cb * workarrc_sn(n,mw,icrw) + cp * workarrc_sn(n,mwp,icrw)
             DO  n = 0, kct
-!               f(kfl(n):kfu(n),jbc,ifl(icrw)) = workarrc_sn(n,mw,icrw)
+               f_interp_1 = cb * workarrc_sn(n,mw,icrw) + cp * workarrc_sn(n,mwp,icrw)
                f(kfl(n):kfu(n),jbc,ifl(icrw)) = f_interp_1
             ENDDO
@@ -3815,5 +3804,4 @@
 !                  
 !--            First substitute only the matching-node values                 
-!               f(kfu(n),jbc,ifl(l):ifu(l)) = workarrc_sn(n,mw,l)
                f(kfu(n),jbc,ifl(l):ifu(l)) = f_interp_1
 
@@ -3842,5 +3830,4 @@
                DO  i = ifl(l), ifu(l)
                   DO  k = kfl(n), kfu(n)
-!                     f(k,jbc,i) = workarrc_sn(n,mw,l)
                      f(k,jbc,i) = f_interp_1
                   ENDDO
