Index: palm/trunk/SOURCE/netcdf_data_input_mod.f90
===================================================================
--- palm/trunk/SOURCE/netcdf_data_input_mod.f90	(revision 4279)
+++ palm/trunk/SOURCE/netcdf_data_input_mod.f90	(revision 4280)
@@ -25,4 +25,8 @@
 ! -----------------
 ! $Id$
+! Remove id_emis flags from get_variable_4d_to_3d_real and
+! get_variable_5d_to_4d_real
+! 
+! 4258 2019-10-07 13:29:08Z suehring
 ! - Migrate input of soil temperature and moisture to land-surface model.
 ! - Remove interpolate routines and move the only required subroutine to 
@@ -5233,6 +5237,4 @@
        CHARACTER(LEN=*)              ::  variable_name   !< variable name
 
-       INTEGER(iwp)                  ::  ns              !< start index for subdomain input along n dimension: ns coincides here with ne, since, we select only one value along the 1st dimension n
-
        INTEGER(iwp)                  ::  i               !< index along x direction
        INTEGER(iwp)                  ::  ie              !< end index for subdomain input along x direction
@@ -5246,14 +5248,16 @@
        INTEGER(iwp)                  ::  ke              !< end index of 4th dimension
        INTEGER(iwp)                  ::  ks              !< start index of 4th dimension
-       
+       INTEGER(iwp)                  ::  ns              !< start index for subdomain input along n dimension
+
        REAL(wp), DIMENSION(:,:,:), ALLOCATABLE   ::  tmp !< temporary variable to read data from file according 
                                                          !< to its reverse memory access
 
-       REAL(wp), DIMENSION(:,:,:), INTENT(INOUT) ::  var  !< variable where the read data have to be stored: one dimension is reduced in the process
+       REAL(wp), DIMENSION(:,:,:), INTENT(INOUT) ::  var  !< variable where the read data have to be stored: 
+                                                          !< one dimension is reduced in the process
 #if defined( __netcdf )
 
 !
 !--    Inquire variable id
-       nc_stat = NF90_INQ_VARID( id, TRIM( variable_name ), id_var )  
+       nc_stat = NF90_INQ_VARID( id, TRIM( variable_name ), id_var )
 !
 !--    Check for collective read-operation and set respective NetCDF flags if
@@ -5262,46 +5266,26 @@
           nc_stat = NF90_VAR_PAR_ACCESS (id, id_var, NF90_COLLECTIVE)
        ENDIF
-
-      !Temporary solution for reading emission chemistry files: 
-       IF ( id == id_emis ) THEN
-
-          !--    Allocate temporary variable according to memory access on file. 
-          ALLOCATE( tmp(is:ie,js:je,ks:ke) )
-
-          !--    Get variable
-          nc_stat = NF90_GET_VAR( id, id_var, tmp(is:ie,js:je,ks:ke),                                &
-                                  start = (/ ns, is,   js+1,   ks+1 /),                  &
-                                  count = (/ 1, ie-is+1 , je-js+1, ke-ks+1 /) ) 
-
-          var=tmp(:,:,:)
-
-          CALL handle_error( 'get_variable_4d_to_3d_real', 536, variable_name )
- 
-          DEALLOCATE( tmp )
-
-       ELSE
-!
-!--       Allocate temporary variable according to memory access on file. 
-          ALLOCATE( tmp(is:ie,js:je,ks:ke) )
-!
-!--       Get variable
-          nc_stat = NF90_GET_VAR( id, id_var, tmp,                             &
-                                  start = (/ is+1,    js+1,    ks+1,   ns+1 /),&
-                                  count = (/ ie-is+1, je-js+1, ke-ks+1, 1   /) )
-
-          CALL handle_error( 'get_variable_4d_to_3d_real', 536, variable_name )
-!
-!--       Resort data. Please note, dimension subscripts of var all start at 1.
-          DO  i = is, ie
-             DO  j = js, je
-                DO  k = ks, ke
-                   var(k-ks+1,j-js+1,i-is+1) = tmp(i,j,k)
-                ENDDO
+!
+!--    Allocate temporary variable according to memory access on file. 
+       ALLOCATE( tmp(is:ie,js:je,ks:ke) )
+!
+!--    Get variable
+       nc_stat = NF90_GET_VAR( id, id_var, tmp,                                &
+                               start = (/ is+1,    js+1,    ks+1,   ns+1 /),   &
+                               count = (/ ie-is+1, je-js+1, ke-ks+1, 1   /) )
+
+       CALL handle_error( 'get_variable_4d_to_3d_real', 536, variable_name )
+!
+!--    Resort data. Please note, dimension subscripts of var all start at 1.
+       DO  i = is, ie
+          DO  j = js, je
+             DO  k = ks, ke
+                var(k-ks+1,j-js+1,i-is+1) = tmp(i,j,k)
              ENDDO
           ENDDO
-
-         DEALLOCATE( tmp )
-
-       ENDIF
+       ENDDO
+
+      DEALLOCATE( tmp )
+
 #endif
     END SUBROUTINE get_variable_4d_to_3d_real
@@ -5435,5 +5419,5 @@
        INTEGER(iwp)                  ::  ke              !< end index of 5th dimension
        INTEGER(iwp)                  ::  ks              !< start index of 5th dimension
-       
+
        REAL(wp), DIMENSION(:,:,:,:), ALLOCATABLE   ::  tmp !< temporary variable to read data from file according 
                                                            ! to its reverse memory access
@@ -5449,50 +5433,28 @@
           nc_stat = NF90_VAR_PAR_ACCESS (id, id_var, NF90_COLLECTIVE)
        ENDIF
-
-      !Temporary solution for reading emission chemistry files: 
-       IF ( id == id_emis ) THEN
-
-          !--    Allocate temporary variable according to memory access on file. 
-          ALLOCATE( tmp(ts:te,1,js+1:je+1,ks+1:ke+1) )
-
-          !--    Get variable
-          nc_stat = NF90_GET_VAR( id, id_var, tmp(ts:te,1,js+1:je+1,ks+1:ke+1),               &
-                                  start = (/ ns, ts,  1,   js+1,   ks+1 /),                  &
-                                  count = (/ 1, te-ts+1, 1, je-js+1, ke-ks+1 /) ) 
-
-          var=tmp
-
-          CALL handle_error( 'get_variable_5d_to_4d_real', 538, variable_name )
- 
-          DEALLOCATE( tmp )
-
-       !>  Original Subroutine part
-       ELSE
 !
 !--    Allocate temporary variable according to memory access on file. 
-          ALLOCATE( tmp(ks:ke,js:je,is:is,ts:te) )
+       ALLOCATE( tmp(ks:ke,js:je,is:is,ts:te) )
 !
 !--    Get variable
-          nc_stat = NF90_GET_VAR( id, id_var, tmp,                                &
-                                  start = (/ ks+1, js+1, is+1, ts+1, ns /),           &
-                                  count = (/ ke-ks+1, je-js+1, ie-is+1, te-ts+1, 1 /) )   
-                               
-          CALL handle_error( 'get_variable_5d_to_4d_real', 538, variable_name )
-!
-!--    Resort data. Please note, dimension subscripts of var all start at 1. 
-
-          DO  t = ts, te 
-             DO  i = is, ie 
-                DO  j = js, je
-                   DO  k = ks, ke
-                      var(t-ts+1,i-is+1,j-js+1,k-ks+1) = tmp(k,j,i,t)
-                   ENDDO
+       nc_stat = NF90_GET_VAR( id, id_var, tmp,                                &
+                               start = (/ ks+1, js+1, is+1, ts+1, ns /),       &
+                               count = (/ ke-ks+1, je-js+1, ie-is+1, te-ts+1, 1 /) )
+
+       CALL handle_error( 'get_variable_5d_to_4d_real', 538, variable_name )
+!
+!--    Resort data. Please note, dimension subscripts of var all start at 1.
+
+       DO  t = ts, te 
+          DO  i = is, ie 
+             DO  j = js, je
+                DO  k = ks, ke
+                   var(t-ts+1,i-is+1,j-js+1,k-ks+1) = tmp(k,j,i,t)
                 ENDDO
              ENDDO
-          ENDDO 
-
-          DEALLOCATE( tmp )
-
-       ENDIF
+          ENDDO
+       ENDDO 
+
+       DEALLOCATE( tmp )
 #endif
     END SUBROUTINE get_variable_5d_to_4d_real
Index: palm/trunk/SOURCE/salsa_mod.f90
===================================================================
--- palm/trunk/SOURCE/salsa_mod.f90	(revision 4279)
+++ palm/trunk/SOURCE/salsa_mod.f90	(revision 4280)
@@ -26,4 +26,7 @@
 ! -----------------
 ! $Id$
+! Corrected a bug in boundary conditions and fac_dt in offline nesting
+! 
+! 4273 2019-10-24 13:40:54Z monakurppa
 ! - Rename nest_salsa to nesting_salsa
 ! - Correct some errors in boundary condition flags
@@ -217,7 +220,5 @@
 !>
 !> @todo Apply information from emission_stack_height to lift emission sources
-!> @todo emission mode "parameterized", i.e. based on street type
 !> @todo Allow insoluble emissions
-!> @todo Apply flux limiter in prognostic equations
 !------------------------------------------------------------------------------!
  MODULE salsa_mod
@@ -1121,5 +1122,11 @@
 !
 !-- For nested runs, explicitly set nesting boundary conditions.
-    IF ( nesting_salsa  .AND. child_domain )  bc_salsa_t = 'nested'
+    IF ( child_domain )  THEN
+       IF ( nesting_salsa )  THEN
+          bc_salsa_t = 'nested'
+       ELSE
+          bc_salsa_t = 'neumann'
+       ENDIF
+    ENDIF
 !
 !-- Set boundary conditions also in case the model is offline-nested in larger-scale models.
@@ -1177,4 +1184,5 @@
        init_gases_type = 1
     ENDIF
+
 
  END SUBROUTINE salsa_check_parameters
@@ -8943,5 +8951,5 @@
                                                                aero_emission%mass_fracs(:,cc_i2m(7))
 !
-!--             Allocate and read surface emission data (in total PM)
+!--             Allocate and read surface emission data (in total PM, get_variable_3d_real)
                 ALLOCATE( aero_emission%def_data(nys:nyn,nxl:nxr,1:aero_emission_att%ncat) )
                 CALL get_variable( id_salsa, 'aerosol_emission_values', aero_emission%def_data,    &
@@ -9113,5 +9121,5 @@
                        source_array(nys:nyn,nxl:nxr,1:nbins_aerosol) )
 !
-!--          Read in the next time step
+!--          Read in the next time step (get_variable_4d_to_3d_real)
              CALL get_variable( id_salsa, 'aerosol_emission_values', aero_emission%preproc_data,   &
                                 aero_emission_att%tind, 0, aero_emission_att%ncat-1,               &
@@ -12184,7 +12192,8 @@
 !-- Determine interpolation factor and limit it to 1. This is because t+dt can slightly exceed
 !-- time(tind_p) before boundary data is updated again.
-    fac_dt = ( time_since_reference_point - salsa_nest_offl%time(salsa_nest_offl%tind)  + dt_3d )  &
-             / ( salsa_nest_offl%time(salsa_nest_offl%tind_p) -                                    &
-                 salsa_nest_offl%time(salsa_nest_offl%tind) )
+    fac_dt = ( time_utc_init + time_since_reference_point -                                        &
+               salsa_nest_offl%time(salsa_nest_offl%tind) + dt_3d ) /                              &
+             ( salsa_nest_offl%time(salsa_nest_offl%tind_p) -                                      &
+               salsa_nest_offl%time(salsa_nest_offl%tind) )
     fac_dt = MIN( 1.0_wp, fac_dt )
 
