Index: /palm/trunk/SOURCE/chemistry_model_mod.f90
===================================================================
--- /palm/trunk/SOURCE/chemistry_model_mod.f90	(revision 4028)
+++ /palm/trunk/SOURCE/chemistry_model_mod.f90	(revision 4029)
@@ -27,4 +27,7 @@
 ! -----------------
 ! $Id$
+! nest_chemistry option removed
+! 
+! 4004 2019-05-24 11:32:38Z suehring
 ! in subroutine chem_parin check emiss_lod / mod_emis only
 ! when emissions_anthropogenic is activated in namelist (E.C. Chan)
@@ -374,6 +377,4 @@
     SAVE
 
-    LOGICAL ::  nest_chemistry = .TRUE.  !< flag for nesting mode of chemical species, independent on parent or not
-
     REAL(kind=wp), ALLOCATABLE, DIMENSION(:,:,:,:), TARGET ::  spec_conc_1  !< pointer for swapping of timelevels for conc
     REAL(kind=wp), ALLOCATABLE, DIMENSION(:,:,:,:), TARGET ::  spec_conc_2  !< pointer for swapping of timelevels for conc
@@ -466,5 +467,4 @@
          3.25, -999., 2.8, 4.5/) 
 
-    PUBLIC nest_chemistry
     PUBLIC nreact
     PUBLIC nspec               !< number of gas phase chemical species including constant compound (e.g. N2)
@@ -2234,5 +2234,4 @@
          mode_emis,                        &
          my_steps,                         &
-         nest_chemistry,                   &
          rcntrl,                           &
          side_street_id,                   &
Index: /palm/trunk/SOURCE/netcdf_interface_mod.f90
===================================================================
--- /palm/trunk/SOURCE/netcdf_interface_mod.f90	(revision 4028)
+++ /palm/trunk/SOURCE/netcdf_interface_mod.f90	(revision 4029)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! netcdf variable NF90_NOFILL is used as argument instead of "1" in calls to NF90_DEF_VAR_FILL
+! 
+! 3995 2019-05-22 18:59:54Z suehring
 ! output of turbulence intensity added
 ! 
@@ -2016,5 +2019,5 @@
                 nc_stat = NF90_DEF_VAR_FILL( id_set_3d(av),     &
                                              id_var_do3d(av,i), &
-                                             1, 0 )
+                                             NF90_NOFILL, 0 )
                 CALL netcdf_handle_error( 'netcdf_define_header', 532 )
 !
@@ -3000,5 +3003,5 @@
                    nc_stat = NF90_DEF_VAR_FILL( id_set_xy(av),     &
                                                 id_var_do2d(av,i), &
-                                                1, 0 )
+                                                NF90_NOFILL, 0 )
                    CALL netcdf_handle_error( 'netcdf_define_header', 533 )
 !
@@ -3888,5 +3891,5 @@
                    nc_stat = NF90_DEF_VAR_FILL( id_set_xz(av),     &
                                                 id_var_do2d(av,i), &
-                                                1, 0 )
+                                                NF90_NOFILL, 0 )
                    CALL netcdf_handle_error( 'netcdf_define_header', 534 )
 !
@@ -4744,5 +4747,5 @@
                    nc_stat = NF90_DEF_VAR_FILL( id_set_yz(av),     &
                                                 id_var_do2d(av,i), &
-                                                1, 0 )
+                                                NF90_NOFILL, 0 )
                    CALL netcdf_handle_error( 'netcdf_define_header', 535 )
 !
Index: /palm/trunk/SOURCE/pmc_interface_mod.f90
===================================================================
--- /palm/trunk/SOURCE/pmc_interface_mod.f90	(revision 4028)
+++ /palm/trunk/SOURCE/pmc_interface_mod.f90	(revision 4029)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! nest_chemistry switch removed
+! 
+! 4026 2019-06-12 16:50:15Z suehring
 ! Masked topography at boundary grid points in mass conservation, in order to 
 ! avoid that mean velocities within topography are imposed
@@ -465,5 +468,5 @@
 
     USE chemistry_model_mod,                                                   &
-        ONLY:  nest_chemistry, spec_conc_2
+        ONLY:  spec_conc_2
 
     USE cpulog,                                                                &
@@ -1429,5 +1432,5 @@
        ENDIF
        
-       IF ( air_chemistry  .AND.  nest_chemistry )  THEN
+       IF ( air_chemistry )  THEN
           DO n = 1, nspec
              CALL pmc_set_dataarray_name( 'parent', 'chem_' // TRIM( chem_species(n)%name ),        &
@@ -2546,5 +2549,5 @@
 !
 !-- Chemistry, depends on number of species
-    IF ( air_chemistry  .AND.  nest_chemistry )  pmc_max_array = pmc_max_array + nspec
+    IF ( air_chemistry )  pmc_max_array = pmc_max_array + nspec
 !
 !-- SALSA, depens on the number aerosol size bins and chemical components + 
@@ -2623,9 +2626,9 @@
     IF ( TRIM(name) == "s"    )  p_3d_sec => s_2
     IF ( TRIM(name) == "diss" )  p_3d_sec => diss_2
-    IF ( INDEX( TRIM(name), "chem_" ) /= 0      )  p_3d_sec => spec_conc_2(:,:,:,n)
-    IF ( INDEX( TRIM(name), "an_" ) /= 0  )  p_3d_sec => nconc_2(:,:,:,n)
-    IF ( INDEX( TRIM(name), "am_" ) /= 0 )  p_3d_sec => mconc_2(:,:,:,n)
-    IF ( INDEX( TRIM(name), "sg_" ) /= 0  .AND.  .NOT. salsa_gases_from_chem ) &
-       p_3d_sec => gconc_2(:,:,:,n)
+    IF ( INDEX( TRIM(name), "chem_" ) /= 0 )  p_3d_sec => spec_conc_2(:,:,:,n)
+    IF ( INDEX( TRIM(name), "an_" )   /= 0 )  p_3d_sec => nconc_2(:,:,:,n)
+    IF ( INDEX( TRIM(name), "am_" )   /= 0 )  p_3d_sec => mconc_2(:,:,:,n)
+    IF ( INDEX( TRIM(name), "sg_" )   /= 0  .AND.  .NOT. salsa_gases_from_chem ) &
+                                 p_3d_sec => gconc_2(:,:,:,n)
 
     IF ( ASSOCIATED( p_3d ) )  THEN
@@ -2953,5 +2956,5 @@
        ENDIF
 
-       IF ( air_chemistry  .AND.  nest_chemistry )  THEN
+       IF ( air_chemistry )  THEN
           DO  n = 1, nspec
              CALL pmci_interp_1sto_all ( chem_species(n)%conc, chem_spec_c(:,:,:,n),                &
@@ -3630,5 +3633,5 @@
              ENDIF
 
-             IF ( air_chemistry  .AND.  nest_chemistry )  THEN
+             IF ( air_chemistry )  THEN
                 DO  n = 1, nspec
                    CALL pmci_interp_1sto_lr( chem_species(n)%conc, chem_spec_c(:,:,:,n),            &
@@ -3701,5 +3704,5 @@
              ENDIF
 
-             IF ( air_chemistry  .AND.  nest_chemistry )  THEN
+             IF ( air_chemistry )  THEN
                 DO  n = 1, nspec
                    CALL pmci_interp_1sto_lr( chem_species(n)%conc, chem_spec_c(:,:,:,n),            &
@@ -3772,5 +3775,5 @@
              ENDIF
 
-             IF ( air_chemistry  .AND.  nest_chemistry )  THEN
+             IF ( air_chemistry )  THEN
                 DO  n = 1, nspec
                    CALL pmci_interp_1sto_sn( chem_species(n)%conc, chem_spec_c(:,:,:,n),            &
@@ -3843,5 +3846,5 @@
              ENDIF
 
-             IF ( air_chemistry  .AND.  nest_chemistry )  THEN
+             IF ( air_chemistry )  THEN
                 DO  n = 1, nspec
                    CALL pmci_interp_1sto_sn( chem_species(n)%conc, chem_spec_c(:,:,:,n),            &
@@ -3909,5 +3912,5 @@
        ENDIF
 
-       IF ( air_chemistry  .AND.  nest_chemistry )  THEN
+       IF ( air_chemistry )  THEN
           DO  n = 1, nspec
              CALL pmci_interp_1sto_t( chem_species(n)%conc, chem_spec_c(:,:,:,n),                   &
@@ -4000,5 +4003,5 @@
       ENDIF
 
-      IF ( air_chemistry  .AND.  nest_chemistry )  THEN
+      IF ( air_chemistry )  THEN
          DO  n = 1, nspec
             CALL pmci_anterp_tophat( chem_species(n)%conc, chem_spec_c(:,:,:,n),                    &
@@ -5052,5 +5055,5 @@
 !
 !-- Set Neumann boundary conditions for chemical species
-    IF ( air_chemistry  .AND.  nest_chemistry )  THEN
+    IF ( air_chemistry )  THEN
        IF ( ibc_cs_b == 1 )  THEN
           DO  n = 1, nspec
Index: /palm/trunk/SOURCE/surface_data_output_mod.f90
===================================================================
--- /palm/trunk/SOURCE/surface_data_output_mod.f90	(revision 4028)
+++ /palm/trunk/SOURCE/surface_data_output_mod.f90	(revision 4029)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! netcdf variable NF90_NOFILL is used as argument instead of "1" in call to NF90_DEF_VAR_FILL
+! 
+! 3881 2019-04-10 09:31:22Z suehring
 ! Check for zero output timestep (not allowed in parallel NetCDF output mode) 
 ! 
@@ -1302,5 +1305,5 @@
                 nc_stat = NF90_DEF_VAR_FILL( id_set_surf(av),                  &
                                              id_var_dosurf(av,i),              &
-                                             1, 0 )
+                                             NF90_NOFILL, 0 )
                 CALL netcdf_handle_error( 'surface_data_output_init', 5566 )
 !
Index: /palm/trunk/SOURCE/time_integration.f90
===================================================================
--- /palm/trunk/SOURCE/time_integration.f90	(revision 4028)
+++ /palm/trunk/SOURCE/time_integration.f90	(revision 4029)
@@ -25,4 +25,8 @@
 ! -----------------
 ! $Id$
+! exchange of ghost points and boundary conditions separated for chemical species and SALSA module,
+! bugfix: decycling of chemistry species after nesting data transfer
+! 
+! 4022 2019-06-12 11:52:39Z suehring
 ! Call synthetic turbulence generator at last RK3 substep right after boundary
 ! conditions are updated in offline nesting in order to assure that 
@@ -1068,9 +1072,37 @@
              DO  lsp = 1, nvar
                 CALL exchange_horiz( chem_species(lsp)%conc_p, nbgp )
-!
-!--             kanani: Push chem_boundary_conds after CALL boundary_conds
+             ENDDO
+          ENDIF
+
+          IF ( salsa  .AND.  time_since_reference_point >= skip_time_do_salsa )  THEN
+             DO  ib = 1, nbins_aerosol
+                CALL exchange_horiz( aerosol_number(ib)%conc_p, nbgp )
+                DO  ic = 1, ncomponents_mass
+                   icc = ( ic - 1 ) * nbins_aerosol + ib
+                   CALL exchange_horiz( aerosol_mass(icc)%conc_p, nbgp )
+                ENDDO
+             ENDDO
+             IF ( .NOT. salsa_gases_from_chem )  THEN
+                DO  ig = 1, ngases_salsa
+                   CALL exchange_horiz( salsa_gas(ig)%conc_p, nbgp )
+                ENDDO
+             ENDIF
+          ENDIF
+          CALL cpu_log( log_point(26), 'exchange-horiz-progn', 'stop' )
+
+!
+!--       Boundary conditions for the prognostic quantities (except of the
+!--       velocities at the outflow in case of a non-cyclic lateral wall)
+          CALL boundary_conds
+
+!
+!--       Boundary conditions for prognostic quantitites of other modules:
+!--       Here, only decycling is carried out
+          IF ( air_chemistry )  THEN
+
+             DO  lsp = 1, nvar
                 lsp_usr = 1
                 DO WHILE ( TRIM( cs_name( lsp_usr ) ) /= 'novalue' )
-                   IF ( TRIM(chem_species(lsp)%name) == TRIM(cs_name(lsp_usr)) )  THEN
+                   IF ( TRIM( chem_species(lsp)%name ) == TRIM( cs_name(lsp_usr) ) )  THEN
                       CALL chem_boundary_conds( chem_species(lsp)%conc_p,                          &
                                                 chem_species(lsp)%conc_pr_init )
@@ -1079,15 +1111,13 @@
                 ENDDO
              ENDDO
+
           ENDIF
 
           IF ( salsa  .AND.  time_since_reference_point >= skip_time_do_salsa )  THEN
-!
-!--          Exchange ghost points and decycle boundary concentrations if needed
+
              DO  ib = 1, nbins_aerosol
-                CALL exchange_horiz( aerosol_number(ib)%conc_p, nbgp )
                 CALL salsa_boundary_conds( aerosol_number(ib)%conc_p, aerosol_number(ib)%init )
                 DO  ic = 1, ncomponents_mass
                    icc = ( ic - 1 ) * nbins_aerosol + ib
-                   CALL exchange_horiz( aerosol_mass(icc)%conc_p, nbgp )
                    CALL salsa_boundary_conds( aerosol_mass(icc)%conc_p, aerosol_mass(icc)%init )
                 ENDDO
@@ -1095,15 +1125,10 @@
              IF ( .NOT. salsa_gases_from_chem )  THEN
                 DO  ig = 1, ngases_salsa
-                   CALL exchange_horiz( salsa_gas(ig)%conc_p, nbgp )
                    CALL salsa_boundary_conds( salsa_gas(ig)%conc_p, salsa_gas(ig)%init )
                 ENDDO
              ENDIF
-          ENDIF
-          CALL cpu_log( log_point(26), 'exchange-horiz-progn', 'stop' )
-
-!
-!--       Boundary conditions for the prognostic quantities (except of the
-!--       velocities at the outflow in case of a non-cyclic lateral wall)
-          CALL boundary_conds
+
+          ENDIF
+
 !
 !--       Swap the time levels in preparation for the next time step.
@@ -1130,4 +1155,6 @@
 
              IF ( TRIM( nesting_mode ) == 'two-way' .OR.  nesting_mode == 'vertical' )  THEN
+
+                CALL cpu_log( log_point_s(92), 'exchange-horiz-nest', 'start' )
 !
 !--             Exchange_horiz is needed for all parent-domains after the
@@ -1170,9 +1197,7 @@
                    DO  ib = 1, nbins_aerosol
                       CALL exchange_horiz( aerosol_number(ib)%conc, nbgp )
-                      CALL salsa_boundary_conds( aerosol_number(ib)%conc, aerosol_number(ib)%init )
                       DO  ic = 1, ncomponents_mass
                          icc = ( ic - 1 ) * nbins_aerosol + ib
                          CALL exchange_horiz( aerosol_mass(icc)%conc, nbgp )
-                         CALL salsa_boundary_conds( aerosol_mass(icc)%conc, aerosol_mass(icc)%init )
                       ENDDO
                    ENDDO
@@ -1180,14 +1205,46 @@
                       DO  ig = 1, ngases_salsa
                          CALL exchange_horiz( salsa_gas(ig)%conc, nbgp )
-                         CALL salsa_boundary_conds( salsa_gas(ig)%conc, salsa_gas(ig)%init )
                       ENDDO
                    ENDIF
                 ENDIF
-                CALL cpu_log( log_point(26), 'exchange-horiz-progn', 'stop' )
-
-             ENDIF
+                CALL cpu_log( log_point_s(92), 'exchange-horiz-nest', 'stop' )
+
+             ENDIF
+
 !
 !--          Set boundary conditions again after interpolation and anterpolation.
              CALL pmci_boundary_conds
+
+!
+!--          Set chemistry boundary conditions (decycling)
+             IF ( air_chemistry )  THEN
+                DO  lsp = 1, nvar
+                   lsp_usr = 1
+                   DO WHILE ( TRIM( cs_name( lsp_usr ) ) /= 'novalue' )
+                      IF ( TRIM( chem_species(lsp)%name ) == TRIM( cs_name(lsp_usr) ) )  THEN
+                         CALL chem_boundary_conds( chem_species(lsp)%conc,                         &
+                                                   chem_species(lsp)%conc_pr_init )
+                      ENDIF
+                      lsp_usr = lsp_usr + 1
+                   ENDDO
+                ENDDO
+             ENDIF
+
+!
+!--          Set SALSA boundary conditions (decycling)
+             IF ( salsa  .AND. time_since_reference_point >= skip_time_do_salsa )  THEN
+                DO  ib = 1, nbins_aerosol
+                   CALL salsa_boundary_conds( aerosol_number(ib)%conc, aerosol_number(ib)%init )
+                   DO  ic = 1, ncomponents_mass
+                      icc = ( ic - 1 ) * nbins_aerosol + ib
+                      CALL salsa_boundary_conds( aerosol_mass(icc)%conc, aerosol_mass(icc)%init )
+                   ENDDO
+                ENDDO
+                IF ( .NOT. salsa_gases_from_chem )  THEN
+                   DO  ig = 1, ngases_salsa
+                      CALL salsa_boundary_conds( salsa_gas(ig)%conc, salsa_gas(ig)%init )
+                   ENDDO
+                ENDIF
+             ENDIF
 
              CALL cpu_log( log_point(60), 'nesting', 'stop' )
