Index: /palm/trunk/SOURCE/pmc_interface_mod.f90
===================================================================
--- /palm/trunk/SOURCE/pmc_interface_mod.f90	(revision 4733)
+++ /palm/trunk/SOURCE/pmc_interface_mod.f90	(revision 4734)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Bugfix for RANS-RANS nesting and minor revision in the TKE treatment (only logical control)
+!
+! 4665 2020-09-03 14:04:24Z hellstea
 ! Interpolation and anterpolation subroutines renamed and all missing subroutine description
 ! comments added. 
@@ -1322,16 +1325,11 @@
 !--    Set data array name for TKE. Please note, nesting of TKE is actually only done if both parent
 !--    and child are in LES or in RANS mode. Due to design of model coupler, however, data array
-!--    names must be already available at this point.
-       IF ( ( rans_mode_parent  .AND.  rans_mode )  .OR.                              &
-            ( .NOT.  rans_mode_parent  .AND.  .NOT.  rans_mode  .AND.  .NOT. constant_diffusion ) )&
-            THEN
-          CALL pmc_set_dataarray_name( 'parent', 'e', 'child', 'e', ierr )
-       ENDIF
+!--    names must be already available at this point, though the control flag whether data shall
+!--    be interpolated / anterpolated is not available yet.
+       CALL pmc_set_dataarray_name( 'parent', 'e', 'child', 'e', ierr )
 !
 !--    Nesting of dissipation rate only if both parent and child are in RANS mode and TKE-epsilon
 !--    closure is applied. Please see also comment for TKE above.
-       IF ( rans_mode_parent  .AND.  rans_mode  .AND.  rans_tke_e )  THEN
-          CALL pmc_set_dataarray_name( 'parent', 'diss', 'child', 'diss', ierr )
-       ENDIF
+       CALL pmc_set_dataarray_name( 'parent', 'diss', 'child', 'diss', ierr )
 
        IF ( .NOT. neutral )  THEN
@@ -2580,6 +2578,6 @@
     IF ( TRIM(name) == "nr_part"    )  i_2d => nr_part
     IF ( TRIM(name) == "part_adr"   )  i_2d => part_adr
-    IF ( INDEX( TRIM(name), "chem_" ) /= 0      )  p_3d => chem_species(n)%conc
-    IF ( INDEX( TRIM(name), "an_" ) /= 0  )  p_3d => aerosol_number(n)%conc
+    IF ( INDEX( TRIM(name), "chem_" ) /= 0 )  p_3d => chem_species(n)%conc
+    IF ( INDEX( TRIM(name), "an_" ) /= 0 )  p_3d => aerosol_number(n)%conc
     IF ( INDEX( TRIM(name), "am_" ) /= 0 )  p_3d => aerosol_mass(n)%conc
     IF ( INDEX( TRIM(name), "sg_" ) /= 0  .AND.  .NOT. salsa_gases_from_chem )                     &
@@ -3596,15 +3594,13 @@
           CALL pmci_interp_lr( v, vc, kcto, jflv, jfuv, kflo, kfuo, 'l', 'v' )
           CALL pmci_interp_lr( w, wc, kctw, jflo, jfuo, kflw, kfuw, 'l', 'w' )
-
-          IF ( (        rans_mode_parent  .AND.         rans_mode )  .OR.                          &
-               ( .NOT.  rans_mode_parent  .AND.  .NOT.  rans_mode  .AND.                           &
-                 .NOT.  constant_diffusion ) )  THEN
-!             CALL pmci_interp_lr( e, ec, kcto, jflo, jfuo, kflo, kfuo, 'l', 'e' )
-!
-!--          Interpolation of e is replaced by the Neumann condition.
+!
+!--       Treatment of TKE. Interpolation is only required if parent and child operate in RANS mode,
+!--       else, interpolation is replaced by a Neumann condition.
+          IF ( rans_mode_parent  .AND.  rans_mode )  THEN
+              CALL pmci_interp_lr( e, ec, kcto, jflo, jfuo, kflo, kfuo, 'l', 'e' )
+          ELSE
              DO  ibgp = -nbgp, -1
                 e(nzb:nzt,nys:nyn,ibgp) = e(nzb:nzt,nys:nyn,0)
              ENDDO
-
           ENDIF
 
@@ -3669,11 +3665,10 @@
           CALL pmci_interp_lr( v, vc, kcto, jflv, jfuv, kflo, kfuo, 'r', 'v' )
           CALL pmci_interp_lr( w, wc, kctw, jflo, jfuo, kflw, kfuw, 'r', 'w' )
-
-          IF ( (        rans_mode_parent  .AND.         rans_mode )  .OR.                          &
-               ( .NOT.  rans_mode_parent  .AND.  .NOT.  rans_mode  .AND.                           &
-                 .NOT.  constant_diffusion ) )  THEN
-!             CALL pmci_interp_lr( e, ec, kcto, iflo, ifuo, jflo, jfuo, kflo, kfuo, 'r', 'e' )
-!
-!--          Interpolation of e is replaced by the Neumann condition.
+!
+!--       Treatment of TKE. Interpolation is only required if parent and child operate in RANS mode,
+!--       else, interpolation is replaced by a Neumann condition.
+          IF ( rans_mode_parent  .AND.  rans_mode )  THEN
+             CALL pmci_interp_lr( e, ec, kcto, jflo, jfuo, kflo, kfuo, 'r', 'e' )
+          ELSE
              DO  ibgp = nx+1, nx+nbgp
                 e(nzb:nzt,nys:nyn,ibgp) = e(nzb:nzt,nys:nyn,nx)
@@ -3740,11 +3735,10 @@
           CALL pmci_interp_sn( w, wc, kctw, iflo, ifuo, kflw, kfuw, 's', 'w' )
           CALL pmci_interp_sn( u, uc, kcto, iflu, ifuu, kflo, kfuo, 's', 'u' )
-
-          IF ( (        rans_mode_parent  .AND.         rans_mode )  .OR.                          &
-               ( .NOT.  rans_mode_parent  .AND.  .NOT.  rans_mode  .AND.                           &
-                 .NOT.  constant_diffusion ) )  THEN
-!             CALL pmci_interp_sn( e, ec, kcto, iflo, ifuo, kflo, kfuo, 's', 'e' )
-!
-!--          Interpolation of e is replaced by the Neumann condition.
+!
+!--       Treatment of TKE. Interpolation is only required if parent and child operate in RANS mode,
+!--       else, interpolation is replaced by a Neumann condition.
+          IF ( rans_mode_parent  .AND.  rans_mode )  THEN
+             CALL pmci_interp_sn( e, ec, kcto, iflo, ifuo, kflo, kfuo, 's', 'e' )
+          ELSE
              DO  jbgp = -nbgp, -1
                 e(nzb:nzt,jbgp,nxl:nxr) = e(nzb:nzt,0,nxl:nxr)
@@ -3811,11 +3805,10 @@
           CALL pmci_interp_sn( w, wc, kctw, iflo, ifuo, kflw, kfuw, 'n', 'w' )
           CALL pmci_interp_sn( u, uc, kcto, iflu, ifuu, kflo, kfuo, 'n', 'u' )
-
-          IF ( (        rans_mode_parent  .AND.         rans_mode )  .OR.                          &
-               ( .NOT.  rans_mode_parent  .AND.  .NOT.  rans_mode  .AND.                           &
-                 .NOT.  constant_diffusion ) )  THEN
-!             CALL pmci_interp_sn( e, ec, kcto, iflo, ifuo, kflo, kfuo, 'n', 'e' )
-!
-!--          Interpolation of e is replaced by the Neumann condition.
+!
+!--       Treatment of TKE. Interpolation is only required if parent and child operate in RANS mode,
+!--       else, interpolation is replaced by a Neumann condition.
+          IF ( rans_mode_parent  .AND.  rans_mode )  THEN
+             CALL pmci_interp_sn( e, ec, kcto, iflo, ifuo, kflo, kfuo, 'n', 'e' )
+          ELSE
              DO  jbgp = ny+1, ny+nbgp
                 e(nzb:nzt,jbgp,nxl:nxr) = e(nzb:nzt,ny,nxl:nxr)
@@ -3882,11 +3875,10 @@
     CALL pmci_interp_t( u, uc, kcto, iflu, ifuu, jflo, jfuo, 'u' )
     CALL pmci_interp_t( v, vc, kcto, iflo, ifuo, jflv, jfuv, 'v' )
-
-    IF ( (        rans_mode_parent  .AND.         rans_mode )  .OR.                                &
-         ( .NOT.  rans_mode_parent  .AND.  .NOT.  rans_mode  .AND.                                 &
-           .NOT.  constant_diffusion ) )  THEN
-!       CALL pmci_interp_t( e, ec, kcto, iflo, ifuo, jflo, jfuo, 'e' )
-!
-!--    Interpolation of e is replaced by the Neumann condition.
+!
+!-- Treatment of TKE. Interpolation is only required if parent and child operate in RANS mode,
+!-- else, interpolation is replaced by a Neumann condition.
+    IF ( rans_mode_parent  .AND.  rans_mode )  THEN
+       CALL pmci_interp_t( e, ec, kcto, iflo, ifuo, jflo, jfuo, 'e' )
+    ELSE
        e(nzt+1,nys:nyn,nxl:nxr) = e(nzt,nys:nyn,nxl:nxr)
     ENDIF
Index: /palm/trunk/SOURCE/urban_surface_mod.f90
===================================================================
--- /palm/trunk/SOURCE/urban_surface_mod.f90	(revision 4733)
+++ /palm/trunk/SOURCE/urban_surface_mod.f90	(revision 4734)
@@ -22,10 +22,13 @@
 ! Current revisions:
 ! -----------------
-! Bugfix in calculation of absored radiation by windows (reflected radiation was not taken into
-! account)
+!
 !
 ! Former revisions:
 ! -----------------
 ! $Id$
+! Bugfix in calculation of absored radiation by windows (reflected radiation was not taken into
+! account)
+!
+! 4733 2020-10-09 12:24:16Z maronga
 ! Remove unused variables from USE statement
 !
