Index: /palm/trunk/EXAMPLES/test_salsa/test_salsa_p3d
===================================================================
--- /palm/trunk/EXAMPLES/test_salsa/test_salsa_p3d	(revision 3898)
+++ /palm/trunk/EXAMPLES/test_salsa/test_salsa_p3d	(revision 3899)
@@ -143,9 +143,9 @@
 !
 !-- Concentration initial types: 0 = based on the parameter file, 1 = read from a NetCDF file
-    isdtyp    = 1, ! size distribution
-    igctyp    = 1, ! gases
-
-!
-!-- If isdtyp = 0, define the initial aerosol size distribution by dpg, sigmag and n_lognorm
+    init_aerosol_type  = 1, ! size distribution
+    init_gases_type    = 1, ! gases
+
+!
+!-- If init_aerosol_type = 0, define the initial aerosol size distribution by dpg, sigmag and n_lognorm
  !   dpg       = 13.5E-9, 54.0E-9, 864.1E-9, ! mean diameter per mode (in metres)
  !   sigmag    =     1.8,    2.16,     2.21, ! standard deviation per mode 
@@ -153,5 +153,5 @@
 
 !
-!-- If igctyp = 0, apply these initial gas concentrations			
+!-- If init_gases_type = 0, apply these initial gas concentrations			
  !   H2SO4_init = 5.0E12, ! sulphuric acid (#/m3)
  !   HNO3_init  = 3.0E15, ! nitric acid (#/m3)
Index: /palm/trunk/SOURCE/prognostic_equations.f90
===================================================================
--- /palm/trunk/SOURCE/prognostic_equations.f90	(revision 3898)
+++ /palm/trunk/SOURCE/prognostic_equations.f90	(revision 3899)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Corrections in the OpenMP version of salsa
+! 
+! 3887 2019-04-12 08:47:41Z schwenkel
 ! Implicit Bugfix for chemistry model, loop for non_transport_physics over 
 ! ghost points is avoided. Instead introducing module_interface_exchange_horiz.
@@ -562,8 +565,8 @@
           THEN
              CALL cpu_log( log_point_s(90), 'salsa processes ', 'start' )
-             !$OMP PARALLEL PRIVATE (i,j,ib,ic,icc,ig)
+             !$OMP PARALLEL PRIVATE (i,j)
+!
+!--          Call salsa processes
              !$OMP DO
-!
-!--          Call salsa processes
              DO  i = nxl, nxr
                 DO  j = nys, nyn
@@ -573,7 +576,8 @@
                 ENDDO
              ENDDO
+             !$OMP END PARALLEL
 
              CALL cpu_log( log_point_s(90), 'salsa processes ', 'stop' )
-             
+
              CALL cpu_log( log_point_s(91), 'salsa exch-horiz ', 'start' )
 !
@@ -599,6 +603,4 @@
              ENDIF
              CALL cpu_log( log_point_s(91), 'salsa exch-horiz ', 'stop' )
-             
-             !$OMP END PARALLEL
              last_salsa_time = time_since_reference_point
 
@@ -631,5 +633,5 @@
 !--       Tendency terms for u-velocity component. Please note, in case of 
 !--       non-cyclic boundary conditions the grid point i=0 is excluded from
-!--       the prognostic equations for the u-component.    
+!--       the prognostic equations for the u-component.
           IF ( i >= nxlu )  THEN
 
@@ -1175,5 +1177,5 @@
           THEN
              CALL cpu_log( log_point_s(90), 'salsa processes ', 'start' )
-             !$OMP PARALLEL PRIVATE (i,j,ib,ic,icc,ig)
+             !$OMP PARALLEL PRIVATE (i,j)
              !$OMP DO
 !
@@ -1186,4 +1188,5 @@
                 ENDDO
              ENDDO
+             !$OMP END PARALLEL
 
              CALL cpu_log( log_point_s(90), 'salsa processes ', 'stop' )
@@ -1210,5 +1213,4 @@
              ENDIF
              CALL cpu_log( log_point_s(91), 'salsa exch-horiz ', 'stop' )
-             !$OMP END PARALLEL
              last_salsa_time = time_since_reference_point
           ENDIF
Index: /palm/trunk/SOURCE/salsa_mod.f90
===================================================================
--- /palm/trunk/SOURCE/salsa_mod.f90	(revision 3898)
+++ /palm/trunk/SOURCE/salsa_mod.f90	(revision 3899)
@@ -26,4 +26,9 @@
 ! -----------------
 ! $Id$
+! 2018-04-11 monakurppa
+! - remove unnecessary error / location messages
+! - corrected some error message numbers
+! - allocate source arrays only if emissions or dry deposition is applied.
+! 3885 2019-04-11 11:29:34Z kanani
 ! Changes related to global restructuring of location messages and introduction 
 ! of additional debug messages
@@ -130,4 +135,6 @@
 !> @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 two-way nesting is not working properly
 !------------------------------------------------------------------------------!
  MODULE salsa_mod
@@ -162,5 +169,5 @@
 !
 !-- Local constants:
-    INTEGER(iwp), PARAMETER ::  luc_urban = 8      !< default landuse type for urban: use desert!
+    INTEGER(iwp), PARAMETER ::  luc_urban = 15     !< default landuse type for urban
     INTEGER(iwp), PARAMETER ::  ngases_salsa   = 5 !< total number of gaseous tracers:
                                                    !< 1 = H2SO4, 2 = HNO3, 3 = NH3, 4 = OCNV
@@ -306,16 +313,16 @@
     INTEGER(iwp) ::  index_bc  = -1         !< index for black carbon (BC)
     INTEGER(iwp) ::  index_du  = -1         !< index for dust
-    INTEGER(iwp) ::  igctyp = 0             !< Initial gas concentration type
-                                            !< 0 = uniform (read from PARIN)
-                                            !< 1 = read vertical profile from an input file
     INTEGER(iwp) ::  index_nh  = -1         !< index for NH3
     INTEGER(iwp) ::  index_no  = -1         !< index for HNO3
     INTEGER(iwp) ::  index_oc  = -1         !< index for organic carbon (OC)
-    INTEGER(iwp) ::  isdtyp = 0             !< Initial size distribution type
+    INTEGER(iwp) ::  index_so4 = -1         !< index for SO4 or H2SO4
+    INTEGER(iwp) ::  index_ss  = -1         !< index for sea salt
+    INTEGER(iwp) ::  init_aerosol_type = 0  !< Initial size distribution type
                                             !< 0 = uniform (read from PARIN)
                                             !< 1 = read vertical profile of the mode number
                                             !<     concentration from an input file
-    INTEGER(iwp) ::  index_so4 = -1         !< index for SO4 or H2SO4
-    INTEGER(iwp) ::  index_ss  = -1         !< index for sea salt
+    INTEGER(iwp) ::  init_gases_type = 0    !< Initial gas concentration type
+                                            !< 0 = uniform (read from PARIN)
+                                            !< 1 = read vertical profile from an input file
     INTEGER(iwp) ::  lod_gas_emissions = 0  !< level of detail of the gaseous emission data
     INTEGER(iwp) ::  nbins_aerosol = 1      !< total number of size bins
@@ -357,4 +364,5 @@
     LOGICAL ::  decycle_lr            = .FALSE.    !< Undo cyclic boundary conditions: left and right
     LOGICAL ::  decycle_ns            = .FALSE.    !< north and south boundaries
+    LOGICAL ::  include_emission      = .FALSE.    !< include or not emissions
     LOGICAL ::  feedback_to_palm      = .FALSE.    !< allow feedback due to condensation of H2O
     LOGICAL ::  nest_salsa            = .FALSE.    !< apply nesting for salsa
@@ -405,5 +413,5 @@
 !-- standard deviation (sigmag) and concentration (n_lognorm, #/m3)
     REAL(wp), DIMENSION(nmod) ::  dpg   = &
-                                     (/0.013_wp, 0.054_wp, 0.86_wp, 0.2_wp, 0.2_wp, 0.2_wp, 0.2_wp/)
+                     (/1.3E-8_wp, 5.4E-8_wp, 8.6E-7_wp, 2.0E-7_wp, 2.0E-7_wp, 2.0E-7_wp, 2.0E-7_wp/)
     REAL(wp), DIMENSION(nmod) ::  sigmag  = &
                                         (/1.8_wp, 2.16_wp, 2.21_wp, 2.0_wp, 2.0_wp, 2.0_wp, 2.0_wp/)
@@ -423,13 +431,13 @@
 !-- listspec) for both a (soluble) and b (insoluble) bins.
     REAL(wp), DIMENSION(nmod) ::  aerosol_flux_dpg   = &
-                                     (/0.013_wp, 0.054_wp, 0.86_wp, 0.2_wp, 0.2_wp, 0.2_wp, 0.2_wp/)
+                     (/1.3E-8_wp, 5.4E-8_wp, 8.6E-7_wp, 2.0E-7_wp, 2.0E-7_wp, 2.0E-7_wp, 2.0E-7_wp/)
     REAL(wp), DIMENSION(nmod) ::  aerosol_flux_sigmag  = &
                                         (/1.8_wp, 2.16_wp, 2.21_wp, 2.0_wp, 2.0_wp, 2.0_wp, 2.0_wp/)
-    REAL(wp), DIMENSION(nmod) ::  surface_aerosol_flux = &
-                             (/1.04e+11_wp, 3.23E+10_wp, 5.4E+6_wp, 0.0_wp, 0.0_wp, 0.0_wp, 0.0_wp/)
     REAL(wp), DIMENSION(maxspec) ::  aerosol_flux_mass_fracs_a = &
                                                                (/1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0/)
     REAL(wp), DIMENSION(maxspec) ::  aerosol_flux_mass_fracs_b = &
                                                                (/0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0/)
+    REAL(wp), DIMENSION(nmod) ::  surface_aerosol_flux = &
+                             (/1.04e+11_wp, 3.23E+10_wp, 5.4E+6_wp, 0.0_wp, 0.0_wp, 0.0_wp, 0.0_wp/)
 
     REAL(wp), DIMENSION(:), ALLOCATABLE ::  bin_low_limits     !< to deliver information about
@@ -795,11 +803,11 @@
                                      decycle_method, decycle_ns, depo_pcm_par, depo_pcm_type,      &
                                      depo_surf_par, dpg, dt_salsa, feedback_to_palm, h2so4_init,   &
-                                     hno3_init, igctyp, isdtyp, listspec, mass_fracs_a,            &
-                                     mass_fracs_b, n_lognorm, nbin, nest_salsa, nf2a, nh3_init,    &
-                                     nj3, nlcnd, nlcndgas, nlcndh2oae, nlcoag, nldepo, nldepo_pcm, &
-                                     nldepo_surf, nldistupdate, nsnucl, ocnv_init, ocsv_init,      &
-                                     read_restart_data_salsa, reglim, salsa, salsa_emission_mode,  &
-                                     sigmag, skip_time_do_salsa, surface_aerosol_flux,             &
-                                     van_der_waals_coagc, write_binary_salsa
+                                     hno3_init, init_gases_type, init_aerosol_type, listspec,      &
+                                     mass_fracs_a, mass_fracs_b, n_lognorm, nbin, nest_salsa, nf2a,&
+                                     nh3_init, nj3, nlcnd, nlcndgas, nlcndh2oae, nlcoag, nldepo,   &
+                                     nldepo_pcm,  nldepo_surf, nldistupdate, nsnucl, ocnv_init,    &
+                                     ocsv_init, read_restart_data_salsa, reglim, salsa,            &
+                                     salsa_emission_mode, sigmag, skip_time_do_salsa,              &
+                                     surface_aerosol_flux, van_der_waals_coagc, write_binary_salsa
 
     line = ' '
@@ -867,8 +875,10 @@
     ENDIF
 
-    IF ( salsa_emission_mode == 'read_from_file'  .AND.  ibc_salsa_b  == 0 ) THEN
-       message_string = 'salsa_emission_mode == read_from_file requires bc_salsa_b = "Neumann"'
+    IF ( salsa_emission_mode /= 'no_emission'  .AND.  ibc_salsa_b  == 0 ) THEN
+       message_string = 'salsa_emission_mode /= "no_emission" requires bc_salsa_b = "Neumann"'
        CALL message( 'salsa_check_parameters','PA0598', 1, 2, 0, 6, 0 )
     ENDIF
+
+    IF ( salsa_emission_mode /= 'no_emission' )  include_emission = .TRUE.
 
  END SUBROUTINE salsa_check_parameters
@@ -960,27 +970,17 @@
     ENDIF
     WRITE( io, 7 )
-    IF ( nsnucl > 0 )  THEN
-       WRITE( io, 8 ) nsnucl, nj3
-    ENDIF
-    IF ( nlcoag )  THEN
-       WRITE( io, 9 )
-    ENDIF
-    IF ( nlcnd )  THEN
-       WRITE( io, 10 ) nlcndgas, nlcndh2oae
-    ENDIF
-    IF ( lspartition )  THEN
-       WRITE( io, 11 )
-    ENDIF
-    IF ( nldepo )  THEN
-       WRITE( io, 12 ) nldepo_pcm, nldepo_surf
-    ENDIF
+    IF ( nsnucl > 0 )   WRITE( io, 8 ) nsnucl, nj3
+    IF ( nlcoag )       WRITE( io, 9 )
+    IF ( nlcnd )        WRITE( io, 10 ) nlcndgas, nlcndh2oae
+    IF ( lspartition )  WRITE( io, 11 )
+    IF ( nldepo )       WRITE( io, 12 ) nldepo_pcm, nldepo_surf
     WRITE( io, 13 )  reglim, nbin, bin_low_limits
-    IF ( isdtyp == 0 )  WRITE( io, 14 ) nsect
+    IF ( init_aerosol_type == 0 )  WRITE( io, 14 ) nsect
     WRITE( io, 15 ) ncc, listspec, mass_fracs_a, mass_fracs_b
     IF ( .NOT. salsa_gases_from_chem )  THEN
        WRITE( io, 16 ) ngases_salsa, h2so4_init, hno3_init, nh3_init, ocnv_init, ocsv_init
     ENDIF
-    WRITE( io, 17 )  isdtyp, igctyp
-    IF ( isdtyp == 0 )  THEN
+    WRITE( io, 17 )  init_aerosol_type, init_gases_type
+    IF ( init_aerosol_type == 0 )  THEN
        WRITE( io, 18 )  dpg, sigmag, n_lognorm
     ELSE
@@ -989,5 +989,12 @@
     IF ( nest_salsa )  WRITE( io, 20 )  nest_salsa
     WRITE( io, 21 ) salsa_emission_mode
-
+    IF ( salsa_emission_mode == 'uniform' )  THEN
+       WRITE( io, 22 ) surface_aerosol_flux, aerosol_flux_dpg, aerosol_flux_sigmag,                &
+                       aerosol_flux_mass_fracs_a
+    ENDIF
+    IF ( SUM( aerosol_flux_mass_fracs_b ) > 0.0_wp  .OR. salsa_emission_mode == 'read_from_file' ) &
+    THEN
+       WRITE( io, 23 )
+    ENDIF
 
 1   FORMAT (//' SALSA information:'/                                                               &
@@ -1024,6 +1031,6 @@
               '       OCSV:  ',ES12.4E3, ' #/m**3')
 17   FORMAT (/'   Initialising concentrations: ', /                                                &
-              '      Aerosol size distribution: isdtyp = ', I1,/                                   &
-              '      Gas concentrations: igctyp = ', I1 )
+              '      Aerosol size distribution: init_aerosol_type = ', I1,/                        &
+              '      Gas concentrations: init_gases_type = ', I1 )
 18   FORMAT ( '      Mode diametres: dpg(nmod) = ', 7(F7.3), ' (m)', /                             &
               '      Standard deviation: sigmag(nmod) = ', 7(F7.2),/                               &
@@ -1032,4 +1039,9 @@
 20   FORMAT (/'   Nesting for salsa variables: ', L1 )
 21   FORMAT (/'   Emissions: salsa_emission_mode = ', A )
+22   FORMAT (/'      surface_aerosol_flux = ', ES12.4E3, ' #/m**2/s', /                            &
+              '      aerosol_flux_dpg     =  ', 7(F7.3), ' (m)', /                                 &
+              '      aerosol_flux_sigmag  =  ', 7(F7.2), /                                         &
+              '      aerosol_mass_fracs_a =  ', 7(ES12.4E3) )
+23   FORMAT (/'      (currently all emissions are soluble!)')
 
  END SUBROUTINE salsa_header
@@ -1088,5 +1100,5 @@
 !-- Allocate:
     ALLOCATE( aero(nbins_aerosol), bc_am_t_val(nbins_aerosol*ncomponents_mass),                    &
-              bc_an_t_val(ngases_salsa), bc_gt_t_val(nbins_aerosol), bin_low_limits(nbins_aerosol),&
+              bc_an_t_val(nbins_aerosol), bc_gt_t_val(ngases_salsa), bin_low_limits(nbins_aerosol),&
               nsect(nbins_aerosol), massacc(nbins_aerosol) )
     ALLOCATE( k_topo_top(nysg:nyng,nxlg:nxrg) )
@@ -1108,10 +1120,13 @@
        aerosol_number(i)%conc_p(nzb:nzt+1,nysg:nyng,nxlg:nxrg)  => nconc_2(:,:,:,i)
        aerosol_number(i)%tconc_m(nzb:nzt+1,nysg:nyng,nxlg:nxrg) => nconc_3(:,:,:,i)
-       ALLOCATE( aerosol_number(i)%flux_s(nzb+1:nzt,0:threads_per_task-1),     &
-                 aerosol_number(i)%diss_s(nzb+1:nzt,0:threads_per_task-1),     &
-                 aerosol_number(i)%flux_l(nzb+1:nzt,nys:nyn,0:threads_per_task-1),&
-                 aerosol_number(i)%diss_l(nzb+1:nzt,nys:nyn,0:threads_per_task-1),&
-                 aerosol_number(i)%init(nzb:nzt+1),                            &
+       ALLOCATE( aerosol_number(i)%flux_s(nzb+1:nzt,0:threads_per_task-1),                         &
+                 aerosol_number(i)%diss_s(nzb+1:nzt,0:threads_per_task-1),                         &
+                 aerosol_number(i)%flux_l(nzb+1:nzt,nys:nyn,0:threads_per_task-1),                 &
+                 aerosol_number(i)%diss_l(nzb+1:nzt,nys:nyn,0:threads_per_task-1),                 &
+                 aerosol_number(i)%init(nzb:nzt+1),                                                &
                  aerosol_number(i)%sums_ws_l(nzb:nzt+1,0:threads_per_task-1) )
+       IF ( include_emission  .OR.  ( nldepo  .AND.  nldepo_surf ) )  THEN
+          ALLOCATE( aerosol_number(i)%source(nys:nyn,nxl:nxr) )
+       ENDIF
     ENDDO
 
@@ -1136,4 +1151,7 @@
                  aerosol_mass(i)%init(nzb:nzt+1),                                                  &
                  aerosol_mass(i)%sums_ws_l(nzb:nzt+1,0:threads_per_task-1)  )
+       IF ( include_emission  .OR.  ( nldepo  .AND.  nldepo_surf ) )  THEN
+          ALLOCATE( aerosol_mass(i)%source(nys:nyn,nxl:nxr) )
+       ENDIF
     ENDDO
 
@@ -1237,4 +1255,5 @@
                     salsa_gas(i)%init(nzb:nzt+1),                              &
                     salsa_gas(i)%sums_ws_l(nzb:nzt+1,0:threads_per_task-1) )
+          IF ( include_emission )  ALLOCATE( salsa_gas(i)%source(nys:nys,nxl:nxr) )
        ENDDO
 !
@@ -1434,9 +1453,9 @@
     IF ( nldepo )  CALL init_deposition
 
-    IF ( salsa_emission_mode /= 'no_emission' )  THEN
+    IF ( include_emission )  THEN
 !
 !--    Read in and initialize emissions
        CALL salsa_emission_setup( .TRUE. )
-       IF ( .NOT. salsa_gases_from_chem  .AND.  salsa_emission_mode == 'read_from_file' )  THEN
+       IF ( .NOT. salsa_gases_from_chem  .AND.  include_emission )  THEN
           CALL salsa_gas_emission_setup( .TRUE. )
        ENDIF
@@ -1598,5 +1617,5 @@
     pmfoc1a(:)   = 0.0_wp
 
-    IF ( isdtyp == 1 )  THEN
+    IF ( init_aerosol_type == 1 )  THEN
 !
 !--    Read input profiles from PIDS_DYNAMIC_SALSA
@@ -1608,5 +1627,5 @@
 !
 !--       Open file in read-only mode
-          CALL open_read_file( input_file_dynamic // TRIM( coupling_char ), id_dyn )
+          CALL open_read_file( TRIM( input_file_dynamic ) // TRIM( coupling_char ), id_dyn )
 !
 !--       Inquire dimensions:
@@ -1671,6 +1690,6 @@
 !--       Aerosol concentrations: lod=1 (total PM) or lod=2 (sectional number size distribution)
           CALL get_attribute( id_dyn, 'lod', lod_aero, .FALSE., 'init_atmosphere_aerosol' )
-          IF ( lod_aero /= 2 )  THEN
-             message_string = 'Currently only lod=2 accepted for init_atmosphere_aerosol'
+          IF ( lod_aero /= 1 )  THEN
+             message_string = 'Currently only lod=1 accepted for init_atmosphere_aerosol'
              CALL message( 'salsa_mod: aerosol_init', 'PA0603', 2, 2, 0, 6, 0 )
           ELSE
@@ -1693,6 +1712,6 @@
              IF ( ANY( ABS( ( aero(1:nbins_aerosol)%dmid - pr_dmid ) /                             &
                               aero(1:nbins_aerosol)%dmid )  > 0.1_wp )  ) THEN
-                message_string = 'Mean diameters of the aerosol size bins ' // TRIM(               &
-                                 input_file_dynamic ) // ' in do not conform to the sectional '//  &
+                message_string = 'Mean diameters of the aerosol size bins in ' // TRIM(            &
+                                 input_file_dynamic ) // ' do not match with the sectional '//     &
                                  'representation of the model.'
                 CALL message( 'salsa_mod: aerosol_init', 'PA0605', 2, 2, 0, 6, 0 )
@@ -1763,10 +1782,11 @@
 
 #else
-       message_string = 'isdtyp = 1 but preprocessor directive __netcdf is not used in compiling!'
+       message_string = 'init_aerosol_type = 1 but preprocessor directive __netcdf is not used '// &
+                        'in compiling!'
        CALL message( 'salsa_mod: aerosol_init', 'PA0608', 1, 2, 0, 6, 0 )
 
 #endif
 
-    ELSEIF ( isdtyp == 0 )  THEN
+    ELSEIF ( init_aerosol_type == 0 )  THEN
 !
 !--    Mass fractions for species in a and b-bins
@@ -1813,5 +1833,5 @@
     ENDIF
 
-    IF ( igctyp == 1 )  THEN
+    IF ( init_gases_type == 1 )  THEN
 !
 !--    Read input profiles from PIDS_CHEM
@@ -1823,5 +1843,5 @@
 !
 !--       Open file in read-only mode
-          CALL open_read_file( input_file_dynamic // TRIM( coupling_char ), id_dyn )
+          CALL open_read_file( TRIM( input_file_dynamic ) // TRIM( coupling_char ), id_dyn )
 !
 !--       Inquire dimensions:
@@ -1855,5 +1875,6 @@
        ENDIF   ! netcdf_extend
 #else
-       message_string = 'igctyp = 1 but preprocessor directive __netcdf is not used in compiling!'
+       message_string = 'init_gases_type = 1 but preprocessor directive __netcdf is not used in '//&
+                        'compiling!'
        CALL message( 'salsa_mod: aerosol_init', 'PA0611', 1, 2, 0, 6, 0 )
 
@@ -2508,5 +2529,6 @@
     REAL(wp), DIMENSION(nzb:nzt+1,nbins_aerosol) ::  vd           !< particle fall seed (m/s)
 
-    TYPE(t_section), DIMENSION(nbins_aerosol) ::  aero_old !< helper array
+    TYPE(t_section), DIMENSION(nbins_aerosol) ::  lo_aero   !< additional variable for OpenMP
+    TYPE(t_section), DIMENSION(nbins_aerosol) ::  aero_old  !< helper array
 
     aero_old(:)%numc = 0.0_wp
@@ -2514,4 +2536,5 @@
     in_u             = 0.0_wp
     kvis             = 0.0_wp
+    lo_aero          = aero
     schmidt_num      = 0.0_wp
     vd               = 0.0_wp
@@ -2524,5 +2547,5 @@
 !-- Aerosol number is always set, but mass can be uninitialized
     DO ib = 1, nbins_aerosol
-       aero(ib)%volc(:)     = 0.0_wp
+       lo_aero(ib)%volc(:)  = 0.0_wp
        aero_old(ib)%volc(:) = 0.0_wp
     ENDDO
@@ -2573,8 +2596,8 @@
           ic = 1
           DO ss = str, endi
-             aero(ic)%volc(vc) = aerosol_mass(ss)%conc(k,j,i) / arhoh2so4
+             lo_aero(ic)%volc(vc) = aerosol_mass(ss)%conc(k,j,i) / arhoh2so4
              ic = ic+1
           ENDDO
-          aero_old(1:nbins_aerosol)%volc(vc) = aero(1:nbins_aerosol)%volc(vc)
+          aero_old(1:nbins_aerosol)%volc(vc) = lo_aero(1:nbins_aerosol)%volc(vc)
        ENDIF
 !
@@ -2586,8 +2609,8 @@
           ic = 1
           DO ss = str, endi
-             aero(ic)%volc(vc) = aerosol_mass(ss)%conc(k,j,i) / arhooc
+             lo_aero(ic)%volc(vc) = aerosol_mass(ss)%conc(k,j,i) / arhooc
              ic = ic+1
           ENDDO
-          aero_old(1:nbins_aerosol)%volc(vc) = aero(1:nbins_aerosol)%volc(vc)
+          aero_old(1:nbins_aerosol)%volc(vc) = lo_aero(1:nbins_aerosol)%volc(vc)
        ENDIF
 !
@@ -2599,8 +2622,8 @@
           ic = 1 + end_subrange_1a
           DO ss = str, endi
-             aero(ic)%volc(vc) = aerosol_mass(ss)%conc(k,j,i) / arhobc
+             lo_aero(ic)%volc(vc) = aerosol_mass(ss)%conc(k,j,i) / arhobc
              ic = ic+1
           ENDDO
-          aero_old(1:nbins_aerosol)%volc(vc) = aero(1:nbins_aerosol)%volc(vc)
+          aero_old(1:nbins_aerosol)%volc(vc) = lo_aero(1:nbins_aerosol)%volc(vc)
        ENDIF
 !
@@ -2612,8 +2635,8 @@
           ic = 1 + end_subrange_1a
           DO ss = str, endi
-             aero(ic)%volc(vc) = aerosol_mass(ss)%conc(k,j,i) / arhodu
+             lo_aero(ic)%volc(vc) = aerosol_mass(ss)%conc(k,j,i) / arhodu
              ic = ic+1
           ENDDO
-          aero_old(1:nbins_aerosol)%volc(vc) = aero(1:nbins_aerosol)%volc(vc)
+          aero_old(1:nbins_aerosol)%volc(vc) = lo_aero(1:nbins_aerosol)%volc(vc)
        ENDIF
 !
@@ -2625,8 +2648,8 @@
           ic = 1 + end_subrange_1a
           DO ss = str, endi
-             aero(ic)%volc(vc) = aerosol_mass(ss)%conc(k,j,i) / arhoss
+             lo_aero(ic)%volc(vc) = aerosol_mass(ss)%conc(k,j,i) / arhoss
              ic = ic+1
           ENDDO
-          aero_old(1:nbins_aerosol)%volc(vc) = aero(1:nbins_aerosol)%volc(vc)
+          aero_old(1:nbins_aerosol)%volc(vc) = lo_aero(1:nbins_aerosol)%volc(vc)
        ENDIF
 !
@@ -2638,8 +2661,8 @@
           ic = 1
           DO ss = str, endi
-             aero(ic)%volc(vc) = aerosol_mass(ss)%conc(k,j,i) / arhohno3
+             lo_aero(ic)%volc(vc) = aerosol_mass(ss)%conc(k,j,i) / arhohno3
              ic = ic+1
           ENDDO
-          aero_old(1:nbins_aerosol)%volc(vc) = aero(1:nbins_aerosol)%volc(vc)
+          aero_old(1:nbins_aerosol)%volc(vc) = lo_aero(1:nbins_aerosol)%volc(vc)
        ENDIF
 !
@@ -2651,8 +2674,8 @@
           ic = 1
           DO ss = str, endi
-             aero(ic)%volc(vc) = aerosol_mass(ss)%conc(k,j,i) / arhonh3
+             lo_aero(ic)%volc(vc) = aerosol_mass(ss)%conc(k,j,i) / arhonh3
              ic = ic+1
           ENDDO
-          aero_old(1:nbins_aerosol)%volc(vc) = aero(1:nbins_aerosol)%volc(vc)
+          aero_old(1:nbins_aerosol)%volc(vc) = lo_aero(1:nbins_aerosol)%volc(vc)
        ENDIF
 !
@@ -2665,23 +2688,23 @@
        IF ( advect_particle_water )  THEN
           DO ss = str, endi
-             aero(ic)%volc(vc) = aerosol_mass(ss)%conc(k,j,i) / arhoh2o
+             lo_aero(ic)%volc(vc) = aerosol_mass(ss)%conc(k,j,i) / arhoh2o
              ic = ic+1
           ENDDO
        ELSE
-         aero(1:nbins_aerosol)%volc(vc) = mclim 
-       ENDIF
-       aero_old(1:nbins_aerosol)%volc(vc) = aero(1:nbins_aerosol)%volc(vc)
+         lo_aero(1:nbins_aerosol)%volc(vc) = mclim
+       ENDIF
+       aero_old(1:nbins_aerosol)%volc(vc) = lo_aero(1:nbins_aerosol)%volc(vc)
 !
 !--    Number concentrations (numc) and particle sizes 
 !--    (dwet = wet diameter, core = dry volume)
        DO  ib = 1, nbins_aerosol
-          aero(ib)%numc = aerosol_number(ib)%conc(k,j,i)
-          aero_old(ib)%numc = aero(ib)%numc
-          IF ( aero(ib)%numc > nclim )  THEN
-             aero(ib)%dwet = ( SUM( aero(ib)%volc(:) ) / aero(ib)%numc / api6 )**0.33333333_wp
-             aero(ib)%core = SUM( aero(ib)%volc(1:7) ) / aero(ib)%numc
+          lo_aero(ib)%numc = aerosol_number(ib)%conc(k,j,i)
+          aero_old(ib)%numc = lo_aero(ib)%numc
+          IF ( lo_aero(ib)%numc > nclim )  THEN
+             lo_aero(ib)%dwet = ( SUM( lo_aero(ib)%volc(:) ) / lo_aero(ib)%numc / api6 )**0.33333333_wp
+             lo_aero(ib)%core = SUM( lo_aero(ib)%volc(1:7) ) / lo_aero(ib)%numc
           ELSE
-             aero(ib)%dwet = aero(ib)%dmid
-             aero(ib)%core = api6 * ( aero(ib)%dwet )**3
+             lo_aero(ib)%dwet = lo_aero(ib)%dmid
+             lo_aero(ib)%core = api6 * ( lo_aero(ib)%dwet )**3
           ENDIF
        ENDDO
@@ -2692,5 +2715,5 @@
        in_rh = in_cw(k) / in_cs(k)
        IF ( prunmode==1  .OR.  .NOT. advect_particle_water )  THEN
-          CALL equilibration( in_rh, in_t(k), aero, .TRUE. )
+          CALL equilibration( in_rh, in_t(k), lo_aero, .TRUE. )
        ENDIF
 !
@@ -2717,10 +2740,10 @@
 !--    Coagulation
        IF ( lscoag )   THEN
-          CALL coagulation( aero, dt_salsa, in_t(k), in_p(k) )
+          CALL coagulation( lo_aero, dt_salsa, in_t(k), in_p(k) )
        ENDIF
 !
 !--    Condensation
        IF ( lscnd )   THEN
-          CALL condensation( aero, zgso4, zgocnv, zgocsv,  zghno3, zgnh3, in_cw(k), in_cs(k),      &
+          CALL condensation( lo_aero, zgso4, zgocnv, zgocsv,  zghno3, zgnh3, in_cw(k), in_cs(k),      &
                              in_t(k), in_p(k), dt_salsa, prtcl )
        ENDIF
@@ -2728,5 +2751,5 @@
 !--    Deposition
        IF ( lsdepo )  THEN
-          CALL deposition( aero, in_t(k), in_adn(k), in_u(k), in_lad, kvis(k), schmidt_num(k,:),   &
+          CALL deposition( lo_aero, in_t(k), in_adn(k), in_u(k), in_lad, kvis(k), schmidt_num(k,:),   &
                            vd(k,:) )
        ENDIF
@@ -2734,5 +2757,5 @@
 !--    Size distribution bin update
        IF ( lsdistupdate )   THEN
-          CALL distr_update( aero )
+          CALL distr_update( lo_aero )
        ENDIF
 !--    *********************************************************************************************
@@ -2742,5 +2765,5 @@
 !--    Calculate changes in concentrations
        DO ib = 1, nbins_aerosol
-          aerosol_number(ib)%conc(k,j,i) = aerosol_number(ib)%conc(k,j,i) + ( aero(ib)%numc -      &
+          aerosol_number(ib)%conc(k,j,i) = aerosol_number(ib)%conc(k,j,i) + ( lo_aero(ib)%numc -      &
                                            aero_old(ib)%numc ) * flag
        ENDDO
@@ -2752,5 +2775,5 @@
           ic = 1
           DO ss = str, endi
-             aerosol_mass(ss)%conc(k,j,i) = aerosol_mass(ss)%conc(k,j,i) + ( aero(ic)%volc(vc) -   &
+             aerosol_mass(ss)%conc(k,j,i) = aerosol_mass(ss)%conc(k,j,i) + ( lo_aero(ic)%volc(vc) -   &
                                             aero_old(ic)%volc(vc) ) * arhoh2so4 * flag
              ic = ic+1
@@ -2764,5 +2787,5 @@
           ic = 1
           DO ss = str, endi
-             aerosol_mass(ss)%conc(k,j,i) = aerosol_mass(ss)%conc(k,j,i) + ( aero(ic)%volc(vc) -   &
+             aerosol_mass(ss)%conc(k,j,i) = aerosol_mass(ss)%conc(k,j,i) + ( lo_aero(ic)%volc(vc) -   &
                                             aero_old(ic)%volc(vc) ) * arhooc * flag
              ic = ic+1
@@ -2776,5 +2799,5 @@
           ic = 1 + end_subrange_1a
           DO ss = str, endi
-             aerosol_mass(ss)%conc(k,j,i) = aerosol_mass(ss)%conc(k,j,i) + ( aero(ic)%volc(vc) -   &
+             aerosol_mass(ss)%conc(k,j,i) = aerosol_mass(ss)%conc(k,j,i) + ( lo_aero(ic)%volc(vc) -   &
                                             aero_old(ic)%volc(vc) ) * arhobc * flag
              ic = ic+1
@@ -2788,5 +2811,5 @@
           ic = 1 + end_subrange_1a
           DO ss = str, endi
-             aerosol_mass(ss)%conc(k,j,i) = aerosol_mass(ss)%conc(k,j,i) + ( aero(ic)%volc(vc) -   &
+             aerosol_mass(ss)%conc(k,j,i) = aerosol_mass(ss)%conc(k,j,i) + ( lo_aero(ic)%volc(vc) -   &
                                             aero_old(ic)%volc(vc) ) * arhodu * flag
              ic = ic+1
@@ -2800,5 +2823,5 @@
           ic = 1 + end_subrange_1a
           DO ss = str, endi
-             aerosol_mass(ss)%conc(k,j,i) = aerosol_mass(ss)%conc(k,j,i) + ( aero(ic)%volc(vc) -   &
+             aerosol_mass(ss)%conc(k,j,i) = aerosol_mass(ss)%conc(k,j,i) + ( lo_aero(ic)%volc(vc) -   &
                                             aero_old(ic)%volc(vc) ) * arhoss * flag
              ic = ic+1
@@ -2812,5 +2835,5 @@
           ic = 1
           DO ss = str, endi
-             aerosol_mass(ss)%conc(k,j,i) = aerosol_mass(ss)%conc(k,j,i) + ( aero(ic)%volc(vc) -   &
+             aerosol_mass(ss)%conc(k,j,i) = aerosol_mass(ss)%conc(k,j,i) + ( lo_aero(ic)%volc(vc) -   &
                                             aero_old(ic)%volc(vc) ) * arhohno3 * flag
              ic = ic+1
@@ -2824,5 +2847,5 @@
           ic = 1
           DO ss = str, endi
-             aerosol_mass(ss)%conc(k,j,i) = aerosol_mass(ss)%conc(k,j,i) + ( aero(ic)%volc(vc) -   &
+             aerosol_mass(ss)%conc(k,j,i) = aerosol_mass(ss)%conc(k,j,i) + ( lo_aero(ic)%volc(vc) -   &
                                             aero_old(ic)%volc(vc) ) * arhonh3 * flag
              ic = ic+1
@@ -2837,5 +2860,5 @@
           ic = 1
           DO ss = str, endi
-             aerosol_mass(ss)%conc(k,j,i) = aerosol_mass(ss)%conc(k,j,i) + ( aero(ic)%volc(vc) -   &
+             aerosol_mass(ss)%conc(k,j,i) = aerosol_mass(ss)%conc(k,j,i) + ( lo_aero(ic)%volc(vc) -   &
                                             aero_old(ic)%volc(vc) ) * arhoh2o * flag
              IF ( prunmode == 1 )  THEN
@@ -2918,4 +2941,5 @@
 
     ENDDO   ! k
+
 !
 !-- Set surfaces and wall fluxes due to deposition
@@ -2937,4 +2961,10 @@
        ENDIF
     ENDIF
+
+    IF ( prunmode < 3 )  THEN
+       !$OMP MASTER
+       aero = lo_aero
+       !$OMP END MASTER
+    END IF
 
  END SUBROUTINE salsa_driver
@@ -3655,11 +3685,5 @@
 !
 !--       Calculate changes in surface fluxes due to dry deposition
-          IF ( aero_emission_att%lod == 2  .OR.  salsa_emission_mode ==  'no_emission' )  THEN
-             surf%answs(m,ib) = -depo * norm_fac * aerosol_number(ib)%conc(k,j,i)
-             DO  ic = 1, ncomponents_mass
-                icc = ( ic - 1 ) * nbins_aerosol + ib
-                surf%amsws(m,icc) = -depo *  norm_fac * aerosol_mass(icc)%conc(k,j,i)
-             ENDDO    ! ic
-          ELSE
+          IF ( include_emission )  THEN
              surf%answs(m,ib) = aerosol_number(ib)%source(j,i) -                                   &
                                 MAX( 0.0_wp, depo * norm_fac * aerosol_number(ib)%conc(k,j,i) )
@@ -3669,4 +3693,10 @@
                                     MAX( 0.0_wp, depo *  norm_fac * aerosol_mass(icc)%conc(k,j,i) )
              ENDDO  ! ic
+          ELSE
+             surf%answs(m,ib) = -depo * norm_fac * aerosol_number(ib)%conc(k,j,i)
+             DO  ic = 1, ncomponents_mass
+                icc = ( ic - 1 ) * nbins_aerosol + ib
+                surf%amsws(m,icc) = -depo *  norm_fac * aerosol_mass(icc)%conc(k,j,i)
+             ENDDO    ! ic
           ENDIF
        ENDDO    ! ib
@@ -4975,17 +5005,17 @@
     IF ( ptemp < 240.0_wp  .OR.  ptemp > 300.0_wp )  THEN
        message_string = 'Invalid input value: ptemp'
-       CALL message( 'salsa_mod: ternucl', 'PA0619', 1, 2, 0, 6, 0 )
+       CALL message( 'salsa_mod: ternucl', 'PA0648', 1, 2, 0, 6, 0 )
     ENDIF
     IF ( prh < 0.05_wp  .OR.  prh > 0.95_wp )  THEN
        message_string = 'Invalid input value: prh'
-       CALL message( 'salsa_mod: ternucl', 'PA0620', 1, 2, 0, 6, 0 )
+       CALL message( 'salsa_mod: ternucl', 'PA0649', 1, 2, 0, 6, 0 )
     ENDIF
     IF ( pc_sa < 1.0E+4_wp  .OR.  pc_sa > 1.0E+9_wp )  THEN
        message_string = 'Invalid input value: pc_sa'
-       CALL message( 'salsa_mod: ternucl', 'PA0621', 1, 2, 0, 6, 0 )
+       CALL message( 'salsa_mod: ternucl', 'PA0650', 1, 2, 0, 6, 0 )
     ENDIF
     IF ( pc_nh3 < 0.1_wp  .OR.  pc_nh3 > 100.0_wp )  THEN
        message_string = 'Invalid input value: pc_nh3'
-       CALL message( 'salsa_mod: ternucl', 'PA0622', 1, 2, 0, 6, 0 )
+       CALL message( 'salsa_mod: ternucl', 'PA0651', 1, 2, 0, 6, 0 )
     ENDIF
 
@@ -6933,5 +6963,5 @@
 
           IF ( paero(ib)%numc > nclim )   THEN
-             zvpart = SUM( paero(ib)%volc(:) ) / paero(ib)%numc
+             zvpart = SUM( paero(ib)%volc(1:7) ) / paero(ib)%numc  ! Note: dry volume!
              within_bins = ( paero(ib)%vlolim < zvpart  .AND. zvpart < paero(ib)%vhilim )
           ENDIF
@@ -6991,5 +7021,8 @@
     zvol         = 0.0_wp
 
+    !$OMP MASTER
     CALL cpu_log( log_point_s(94), 'salsa diagnostics ', 'start' )
+    !$OMP END MASTER
+
 !
 !-- Calculate thermodynamic quantities needed in SALSA
@@ -7009,5 +7042,5 @@
 !--    Calculate total mass concentration per bin
        mcsum = 0.0_wp
-       DO  ic = 1, ncomponents_mass
+       DO  ic = 1, ncc
           icc = ( ic - 1 ) * nbins_aerosol + ib
           mcsum = mcsum + aerosol_mass(icc)%conc(:,j,i) * flag
@@ -7015,7 +7048,7 @@
 !
 !--    Check that number and mass concentration match qualitatively
-       IF ( ANY ( aerosol_number(ib)%conc(:,j,i) > nclim  .AND. mcsum <= 0.0_wp ) )  THEN
+       IF ( ANY ( aerosol_number(ib)%conc(:,j,i) >= nclim  .AND. mcsum <= 0.0_wp ) )  THEN
           DO  k = nzb+1, nzt
-             IF ( aerosol_number(ib)%conc(k,j,i) > nclim  .AND. mcsum(k) <= 0.0_wp )  THEN
+             IF ( aerosol_number(ib)%conc(k,j,i) >= nclim  .AND. mcsum(k) <= 0.0_wp )  THEN
                 aerosol_number(ib)%conc(k,j,i) = nclim * flag(k)
                 DO  ic = 1, ncomponents_mass
@@ -7103,5 +7136,7 @@
     ENDIF
 
+   !$OMP MASTER
     CALL cpu_log( log_point_s(94), 'salsa diagnostics ', 'stop' )
+   !$OMP END MASTER
 
  END SUBROUTINE salsa_diagnostics
@@ -7185,5 +7220,66 @@
     INTEGER(iwp) ::  tn           !<
 
-    LOGICAL ::  sedim  !< calculate sedimentation only for aerosols (number and mass)
+    IF ( time_since_reference_point >= skip_time_do_salsa )  THEN
+!
+!--    Aerosol number
+       DO  ib = 1, nbins_aerosol
+!kk          sums_salsa_ws_l = aerosol_number(ib)%sums_ws_l
+          CALL salsa_tendency( 'aerosol_number', aerosol_number(ib)%conc_p, aerosol_number(ib)%conc,&
+                               aerosol_number(ib)%tconc_m, i, j, i_omp_start, tn, ib, ib,          &
+                               aerosol_number(ib)%flux_s, aerosol_number(ib)%diss_s,               &
+                               aerosol_number(ib)%flux_l, aerosol_number(ib)%diss_l,               &
+                               aerosol_number(ib)%init, .TRUE. )
+!kk          aerosol_number(ib)%sums_ws_l = sums_salsa_ws_l
+!
+!--       Aerosol mass
+          DO  ic = 1, ncomponents_mass
+             icc = ( ic - 1 ) * nbins_aerosol + ib
+!kk             sums_salsa_ws_l = aerosol_mass(icc)%sums_ws_l
+             CALL salsa_tendency( 'aerosol_mass', aerosol_mass(icc)%conc_p, aerosol_mass(icc)%conc,&
+                                  aerosol_mass(icc)%tconc_m, i, j, i_omp_start, tn, ib, ic,        &
+                                  aerosol_mass(icc)%flux_s, aerosol_mass(icc)%diss_s,              &
+                                  aerosol_mass(icc)%flux_l, aerosol_mass(icc)%diss_l,              &
+                                  aerosol_mass(icc)%init, .TRUE. )
+!kk             aerosol_mass(icc)%sums_ws_l = sums_salsa_ws_l
+
+          ENDDO  ! ic
+       ENDDO  ! ib
+!
+!--    Gases
+       IF ( .NOT. salsa_gases_from_chem )  THEN
+
+          DO  ig = 1, ngases_salsa
+!kk             sums_salsa_ws_l = salsa_gas(ig)%sums_ws_l
+             CALL salsa_tendency( 'salsa_gas', salsa_gas(ig)%conc_p, salsa_gas(ig)%conc,           &
+                                  salsa_gas(ig)%tconc_m, i, j, i_omp_start, tn, ig, ig,            &
+                                  salsa_gas(ig)%flux_s, salsa_gas(ig)%diss_s, salsa_gas(ig)%flux_l,&
+                                  salsa_gas(ig)%diss_l, salsa_gas(ig)%init, .FALSE. )
+!kk             salsa_gas(ig)%sums_ws_l = sums_salsa_ws_l
+
+          ENDDO  ! ig
+
+       ENDIF
+
+    ENDIF
+
+ END SUBROUTINE salsa_prognostic_equations_ij
+!
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Calculate the prognostic equation for aerosol number and mass, and gas
+!> concentrations. Cache-optimized.
+!------------------------------------------------------------------------------!
+ SUBROUTINE salsa_prognostic_equations()
+
+    USE control_parameters,                                                                        &
+        ONLY:  time_since_reference_point
+
+    IMPLICIT NONE
+
+    INTEGER(iwp) ::  ib           !< loop index for aerosol number bin OR gas index
+    INTEGER(iwp) ::  ic           !< loop index for aerosol mass bin
+    INTEGER(iwp) ::  icc          !< (c-1)*nbins_aerosol+b
+    INTEGER(iwp) ::  ig           !< loop index for salsa gases
 
     IF ( time_since_reference_point >= skip_time_do_salsa )  THEN
@@ -7193,8 +7289,5 @@
           sums_salsa_ws_l = aerosol_number(ib)%sums_ws_l
           CALL salsa_tendency( 'aerosol_number', aerosol_number(ib)%conc_p, aerosol_number(ib)%conc,&
-                               aerosol_number(ib)%tconc_m, i, j, i_omp_start, tn, ib, ib,          &
-                               aerosol_number(ib)%flux_s, aerosol_number(ib)%diss_s,               &
-                               aerosol_number(ib)%flux_l, aerosol_number(ib)%diss_l,               &
-                               aerosol_number(ib)%init, sedim )
+                               aerosol_number(ib)%tconc_m, ib, ib, aerosol_number(ib)%init, .TRUE. )
           aerosol_number(ib)%sums_ws_l = sums_salsa_ws_l
 !
@@ -7204,8 +7297,5 @@
              sums_salsa_ws_l = aerosol_mass(icc)%sums_ws_l
              CALL salsa_tendency( 'aerosol_mass', aerosol_mass(icc)%conc_p, aerosol_mass(icc)%conc,&
-                                  aerosol_mass(icc)%tconc_m, i, j, i_omp_start, tn, ib, ic,        &
-                                  aerosol_mass(icc)%flux_s, aerosol_mass(icc)%diss_s,              &
-                                  aerosol_mass(icc)%flux_l, aerosol_mass(icc)%diss_l,              &
-                                  aerosol_mass(icc)%init, sedim )
+                                  aerosol_mass(icc)%tconc_m, ib, ic, aerosol_mass(icc)%init, .TRUE. )
              aerosol_mass(icc)%sums_ws_l = sums_salsa_ws_l
 
@@ -7219,64 +7309,5 @@
              sums_salsa_ws_l = salsa_gas(ig)%sums_ws_l
              CALL salsa_tendency( 'salsa_gas', salsa_gas(ig)%conc_p, salsa_gas(ig)%conc,           &
-                                  salsa_gas(ig)%tconc_m, i, j, i_omp_start, tn, ig, ig,            &
-                                  salsa_gas(ig)%flux_s, salsa_gas(ig)%diss_s, salsa_gas(ig)%flux_l,&
-                                  salsa_gas(ig)%diss_l, salsa_gas(ig)%init, sedim )
-             salsa_gas(ig)%sums_ws_l = sums_salsa_ws_l
-
-          ENDDO  ! ig
-
-       ENDIF
-
-    ENDIF
-
- END SUBROUTINE salsa_prognostic_equations_ij
-!
-!------------------------------------------------------------------------------!
-! Description:
-! ------------
-!> Calculate the prognostic equation for aerosol number and mass, and gas
-!> concentrations. Cache-optimized.
-!------------------------------------------------------------------------------!
- SUBROUTINE salsa_prognostic_equations()
-
-    USE control_parameters,                                                                        &
-        ONLY:  time_since_reference_point
-
-    IMPLICIT NONE
-
-    INTEGER(iwp) ::  ib           !< loop index for aerosol number bin OR gas index
-    INTEGER(iwp) ::  ic           !< loop index for aerosol mass bin
-    INTEGER(iwp) ::  icc          !< (c-1)*nbins_aerosol+b
-    INTEGER(iwp) ::  ig           !< loop index for salsa gases
-
-    LOGICAL ::  sedim  !< calculate sedimentation only for aerosols (number and mass)
-
-    IF ( time_since_reference_point >= skip_time_do_salsa )  THEN
-!
-!--    Aerosol number
-       DO  ib = 1, nbins_aerosol
-          sums_salsa_ws_l = aerosol_number(ib)%sums_ws_l
-          CALL salsa_tendency( 'aerosol_number', aerosol_number(ib)%conc_p, aerosol_number(ib)%conc,&
-                               aerosol_number(ib)%tconc_m, ib, ib, aerosol_number(ib)%init, sedim )
-          aerosol_number(ib)%sums_ws_l = sums_salsa_ws_l
-!
-!--       Aerosol mass
-          DO  ic = 1, ncomponents_mass
-             icc = ( ic - 1 ) * nbins_aerosol + ib
-             sums_salsa_ws_l = aerosol_mass(icc)%sums_ws_l
-             CALL salsa_tendency( 'aerosol_mass', aerosol_mass(icc)%conc_p, aerosol_mass(icc)%conc,&
-                                  aerosol_mass(icc)%tconc_m, ib, ic, aerosol_mass(icc)%init, sedim )
-             aerosol_mass(icc)%sums_ws_l = sums_salsa_ws_l
-
-          ENDDO  ! ic
-       ENDDO  ! ib
-!
-!--    Gases
-       IF ( .NOT. salsa_gases_from_chem )  THEN
-
-          DO  ig = 1, ngases_salsa
-             sums_salsa_ws_l = salsa_gas(ig)%sums_ws_l
-             CALL salsa_tendency( 'salsa_gas', salsa_gas(ig)%conc_p, salsa_gas(ig)%conc,           &
-                                  salsa_gas(ig)%tconc_m, ig, ig, salsa_gas(ig)%init, sedim )
+                                  salsa_gas(ig)%tconc_m, ig, ig, salsa_gas(ig)%init, .FALSE. )
              salsa_gas(ig)%sums_ws_l = sums_salsa_ws_l
 
@@ -7955,5 +7986,5 @@
     ELSE
        message_string = 'Error in itype!'
-       CALL message( 'salsa_mod: bin_mixrat', 'PA0628', 2, 2, 0, 6, 0 )
+       CALL message( 'bin_mixrat', 'PA0628', 2, 2, 0, 6, 0 )
     ENDIF
 
@@ -7978,16 +8009,20 @@
     IMPLICIT NONE
 
-    IF ( time_since_reference_point >= skip_time_do_salsa  )  THEN
-
-       IF ( next_aero_emission_update <= time_since_reference_point )  THEN
-          CALL salsa_emission_setup( .FALSE. )
-       ENDIF
-
-       IF ( next_gas_emission_update <= time_since_reference_point )  THEN
-          IF ( salsa_emission_mode == 'read_from_file'  .AND.  .NOT. salsa_gases_from_chem )  THEN
-             CALL salsa_gas_emission_setup( .FALSE. )
+    IF ( include_emission )  THEN
+
+       IF ( time_since_reference_point >= skip_time_do_salsa  )  THEN
+
+          IF ( next_aero_emission_update <= time_since_reference_point )  THEN
+             CALL salsa_emission_setup( .FALSE. )
           ENDIF
-       ENDIF
-
+
+          IF ( next_gas_emission_update <= time_since_reference_point )  THEN
+             IF ( salsa_emission_mode == 'read_from_file'  .AND.  .NOT. salsa_gases_from_chem )    &
+             THEN
+                CALL salsa_gas_emission_setup( .FALSE. )
+             ENDIF
+          ENDIF
+
+       ENDIF
     ENDIF
 
@@ -8041,12 +8076,10 @@
 
 !
-!-- Allocate source arrays:
+!-- Set source arrays to zero:
     DO  ib = 1, nbins_aerosol
-       IF ( init )  ALLOCATE( aerosol_number(ib)%source(nys:nyn,nxl:nxr) )
        aerosol_number(ib)%source = 0.0_wp
     ENDDO
 
     DO  ic = 1, ncomponents_mass * nbins_aerosol
-       IF ( init )  ALLOCATE( aerosol_mass(ic)%source(nys:nyn,nxl:nxr) )
        aerosol_mass(ic)%source = 0.0_wp
     ENDDO
@@ -8089,12 +8122,4 @@
 !--          Set uniform fluxes of default horizontal surfaces
              CALL set_flux( surf_def_h(0), cc_i2m, aerosol_flux_mass_fracs_a, source_array )
-!
-!--          Subrange 2b:
-!--          todo: this information should go to HEADER/RUN_CONTROL, it doesn't belong to the job log,
-!--          and actually, aerosol_flux_mass_fracs_b is not used anywhere else except for this message,
-!--          hence, what do we need it for?
-             IF ( SUM( aerosol_flux_mass_fracs_b ) > 0.0_wp )  THEN
-                CALL debug_message( '   salsa_emission_setup: emissions are soluble!', 'info' )
-             ENDIF
 
              DEALLOCATE( nsect_emission, source_array )
@@ -8119,5 +8144,6 @@
 !
 !--          Check existence of PIDS_SALSA file
-             INQUIRE( FILE = input_file_salsa // TRIM( coupling_char ), EXIST = netcdf_extend )
+             INQUIRE( FILE = TRIM( input_file_salsa ) // TRIM( coupling_char ),                    &
+                      EXIST = netcdf_extend )
              IF ( .NOT. netcdf_extend )  THEN
                 message_string = 'Input file '// TRIM( input_file_salsa ) //  TRIM( coupling_char )&
@@ -8127,5 +8153,5 @@
 !
 !--          Open file in read-only mode
-             CALL open_read_file( input_file_salsa // TRIM( coupling_char ), id_salsa )
+             CALL open_read_file( TRIM( input_file_salsa ) // TRIM( coupling_char ), id_salsa )
 !
 !--          Read the index and name of chemical components
@@ -8686,10 +8712,4 @@
                                     aero(ib)%core * prho * rho_air_zw(k-1)
        aerosol_mass(ic)%source(j,i) = aerosol_mass(ic)%source(j,i) + surface%amsws(surf_num,ic)
-!
-!--    Subrange 2b:
-!--          todo: this information should go to HEADER/RUN_CONTROL, it doesn't belong to the job log
-!        IF ( .NOT. no_insoluble )  THEN
-!           CALL location_message( '    salsa_mass_flux: All emissions are soluble!', .TRUE. )
-!        ENDIF
 
     END SUBROUTINE set_mass_flux
@@ -8784,8 +8804,4 @@
           END SELECT
        ENDDO
-!--          todo: this information should go to HEADER/RUN_CONTROL, it doesn't belong to the job log
-!        IF ( SUM( emission_index_chem ) == 0 )  THEN
-!           CALL location_message( '    salsa_gas_emission_setup: no gas emissions', .TRUE. )
-!        ENDIF
 !
 !--    Inquire the fill value
