Index: /palm/trunk/SOURCE/chem_emissions_mod.f90
===================================================================
--- /palm/trunk/SOURCE/chem_emissions_mod.f90	(revision 3771)
+++ /palm/trunk/SOURCE/chem_emissions_mod.f90	(revision 3772)
@@ -27,4 +27,9 @@
 ! -----------------
 ! $Id$
+! - In case of parametrized emissions, assure that emissions are only on natural
+!   surfaces (i.e. streets) and not on urban surfaces. 
+! - some unnecessary if clauses removed
+! 
+! 3685 2019-01-21 01:02:11Z knoop
 ! Some interface calls moved to module_interface + cleanup
 ! 
@@ -1277,90 +1282,95 @@
           IF ( street_type_f%from_file )  THEN
 
-             !
-             !-- Streets are lsm surfaces, hence, no usm surface treatment required
-             IF ( surf_lsm_h%ns > 0 )  THEN
-                DO  m = 1, surf_lsm_h%ns
-                   i = surf_lsm_h%i(m)
-                   j = surf_lsm_h%j(m)
-                   k = surf_lsm_h%k(m)
-
-                   IF ( street_type_f%var(j,i) >= main_street_id  .AND. street_type_f%var(j,i) < max_street_id )  THEN
-
-                      !
-                      !-- Cycle over matched species
-                      DO  ispec = 1, nspec_out
+!
+!--          Streets are lsm surfaces, hence, no usm surface treatment required. 
+!--          However, urban surface may be initialized via default initialization
+!--          in surface_mod, e.g. at horizontal urban walls that are at k == 0
+!--          (building is lower than the first grid point). Hence, in order to 
+!--          have only emissions at streets, set the surfaces emissions to zero
+!--          at urban walls. 
+             IF ( surf_usm_h%ns >=1 )  surf_usm_h%cssws = 0.0_wp
+!
+!--          Now, treat land-surfaces.
+             DO  m = 1, surf_lsm_h%ns
+                i = surf_lsm_h%i(m)
+                j = surf_lsm_h%j(m)
+                k = surf_lsm_h%k(m)
+
+                IF ( street_type_f%var(j,i) >= main_street_id  .AND. street_type_f%var(j,i) < max_street_id )  THEN
+
+                   !
+                   !-- Cycle over matched species
+                   DO  ispec = 1, nspec_out
+
+                      !
+                      !-- PMs are already in kilograms 
+                      IF ( TRIM( spc_names(match_spec_model(ispec)) ) == "PM1 "  &
+                          .OR. TRIM( spc_names(match_spec_model(ispec)) ) == "PM25"  &
+                          .OR. TRIM( spc_names(match_spec_model(ispec)) )=="PM10")  THEN
 
                          !
-                         !-- PMs are already in kilograms 
-                         IF ( TRIM( spc_names(match_spec_model(ispec)) ) == "PM1 "  &
-                             .OR. TRIM( spc_names(match_spec_model(ispec)) ) == "PM25"  &
-                             .OR. TRIM( spc_names(match_spec_model(ispec)) )=="PM10")  THEN
-
-                            !
-                            !--           kg/(m^2*s) * kg/m^3
-                            surf_lsm_h%cssws(match_spec_model(ispec),m) = emiss_factor_main(match_spec_input(ispec)) * &
-                                                                           emis_distribution(1,j,i,ispec) *            &  !< in kg/(m^2*s)
-                                                                            rho_air(k)                                    !< in kg/m^3
-                            
+                         !--           kg/(m^2*s) * kg/m^3
+                         surf_lsm_h%cssws(match_spec_model(ispec),m) = emiss_factor_main(match_spec_input(ispec)) * &
+                                                                        emis_distribution(1,j,i,ispec) *            &  !< in kg/(m^2*s)
+                                                                         rho_air(k)                                    !< in kg/m^3
+                         
+                      !
+                      !-- Other Species
+                      !-- Inputs are micromoles
+                      ELSE
+
+                         !   
+                         !--             ppm/s *m *kg/m^3                
+                         surf_lsm_h%cssws(match_spec_model(ispec),m) = emiss_factor_main(match_spec_input(ispec)) * &
+                                                                        emis_distribution(1,j,i,ispec) *            &  !< in micromoles/(m^2*s)
+                                                                         conv_to_ratio(k,j,i) *                     &  !< in m^3/Nmole     
+                                                                          rho_air(k)                                   !< in kg/m^3
+
+                      ENDIF
+
+                   ENDDO
+
+
+                ELSEIF ( street_type_f%var(j,i) >= side_street_id  .AND. street_type_f%var(j,i) < main_street_id )  THEN
+
+                   !
+                   !-- Cycle over matched species
+                   DO  ispec = 1, nspec_out
+
+                      !
+                      !-- PMs are already in kilograms
+                      IF ( TRIM( spc_names(match_spec_model(ispec)) ) == "PM1"  &
+                          .OR. TRIM( spc_names(match_spec_model(ispec)) ) == "PM25"  &
+                          .OR. TRIM( spc_names(match_spec_model(ispec)) ) == "PM10" )  THEN
+
                          !
-                         !-- Other Species
-                         !-- Inputs are micromoles
-                         ELSE
-
-                            !   
-                            !--             ppm/s *m *kg/m^3                
-                            surf_lsm_h%cssws(match_spec_model(ispec),m) = emiss_factor_main(match_spec_input(ispec)) * &
-                                                                           emis_distribution(1,j,i,ispec) *            &  !< in micromoles/(m^2*s)
-                                                                            conv_to_ratio(k,j,i) *                     &  !< in m^3/Nmole     
-                                                                             rho_air(k)                                   !< in kg/m^3
-
-                         ENDIF
-
-                      ENDDO
-
-
-                   ELSEIF ( street_type_f%var(j,i) >= side_street_id  .AND. street_type_f%var(j,i) < main_street_id )  THEN
-
-                      !
-                      !-- Cycle over matched species
-                      DO  ispec = 1, nspec_out
-
-                         !
-                         !-- PMs are already in kilograms
-                         IF ( TRIM( spc_names(match_spec_model(ispec)) ) == "PM1"  &
-                             .OR. TRIM( spc_names(match_spec_model(ispec)) ) == "PM25"  &
-                             .OR. TRIM( spc_names(match_spec_model(ispec)) ) == "PM10" )  THEN
-
-                            !
-                            !--           kg/(m^2*s) * kg/m^3
-                            surf_lsm_h%cssws(match_spec_model(ispec),m) = emiss_factor_side(match_spec_input(ispec)) * &
-                                                                           emis_distribution(1,j,i,ispec) *            &  !< in kg/(m^2*s)
-                                                                            rho_air(k)                                    !< in kg/m^3   
-                         !
-                         !-- Other species
-                         !-- Inputs are micromoles
-                         ELSE
-                       
-                            !   
-                            !--             ppm/s *m *kg/m^3      
-                            surf_lsm_h%cssws(match_spec_model(ispec),m) = emiss_factor_side(match_spec_input(ispec)) * &
-                                                                           emis_distribution(1,j,i,ispec) *            &  !< in micromoles/(m^2*s)
-                                                                            conv_to_ratio(k,j,i) *                     &  !< in m^3/Nmole       
-                                                                             rho_air(k)                                   !< in kg/m^3   
-                         ENDIF
-
-                      ENDDO
-
-                   ELSE
-
-                      !
-                      !-- If no street type is defined, then assign zero emission to all the species
-                      surf_lsm_h%cssws(:,m) = 0.0_wp
-
-                   ENDIF
-
-                ENDDO
-
-             ENDIF
+                         !--           kg/(m^2*s) * kg/m^3
+                         surf_lsm_h%cssws(match_spec_model(ispec),m) = emiss_factor_side(match_spec_input(ispec)) * &
+                                                                        emis_distribution(1,j,i,ispec) *            &  !< in kg/(m^2*s)
+                                                                         rho_air(k)                                    !< in kg/m^3   
+                      !
+                      !-- Other species
+                      !-- Inputs are micromoles
+                      ELSE
+                    
+                         !   
+                         !--             ppm/s *m *kg/m^3      
+                         surf_lsm_h%cssws(match_spec_model(ispec),m) = emiss_factor_side(match_spec_input(ispec)) * &
+                                                                        emis_distribution(1,j,i,ispec) *            &  !< in micromoles/(m^2*s)
+                                                                         conv_to_ratio(k,j,i) *                     &  !< in m^3/Nmole       
+                                                                          rho_air(k)                                   !< in kg/m^3   
+                      ENDIF
+
+                   ENDDO
+
+                ELSE
+
+                   !
+                   !-- If no street type is defined, then assign zero emission to all the species
+                   surf_lsm_h%cssws(:,m) = 0.0_wp
+
+                ENDIF
+
+             ENDDO
 
           ENDIF
@@ -1373,54 +1383,157 @@
           DO ispec = 1, nspec_out 
                    
-             !
-             !-- Default surfaces
-             IF ( surf_def_h(0)%ns > 0 )  THEN
-
-                DO  m = 1, surf_def_h(0)%ns
-
-                   i = surf_def_h(0)%i(m)
-                   j = surf_def_h(0)%j(m)
-
-                   IF ( emis_distribution(1,j,i,ispec) > 0.0_wp )  THEN
-
-                      !
-                      !-- PMs
-                      IF ( TRIM( spc_names(match_spec_model(ispec)) ) == "PM1"  &
-                           .OR. TRIM( spc_names(match_spec_model(ispec)) ) == "PM25"  &
-                             .OR. TRIM( spc_names(match_spec_model(ispec)) ) == "PM10" )  THEN
+!
+!--          Default surfaces
+             DO  m = 1, surf_def_h(0)%ns
+
+                i = surf_def_h(0)%i(m)
+                j = surf_def_h(0)%j(m)
+
+                IF ( emis_distribution(1,j,i,ispec) > 0.0_wp )  THEN
+
+                   !
+                   !-- PMs
+                   IF ( TRIM( spc_names(match_spec_model(ispec)) ) == "PM1"  &
+                        .OR. TRIM( spc_names(match_spec_model(ispec)) ) == "PM25"  &
+                          .OR. TRIM( spc_names(match_spec_model(ispec)) ) == "PM10" )  THEN
+                
+                      !
+                      !--            kg/(m^2*s) *kg/m^3                         kg/(m^2*s)                 
+                      surf_def_h(0)%cssws(match_spec_model(ispec),m) = emis_distribution(1,j,i,ispec)*  &
+                                                                        rho_air(nzb)                           !< in kg/m^3  
+ 
+ 
+                   ELSE
+
+                      !
+                      !-- VOCs
+                      IF ( len_index_voc > 0 .AND. emt_att%species_name(match_spec_input(ispec)) == "VOC" )  THEN
+                         !
+                         !--           (ppm/s) * m * kg/m^3                        mole/(m^2/s)   
+                         surf_def_h(0)%cssws(match_spec_model(ispec),m) = emis_distribution(1,j,i,ispec) *  &
+                                                                           conv_to_ratio(nzb,j,i) *         &  !< in m^3/mole
+                                                                            ratio2ppm *                     &  !< in ppm
+                                                                             rho_air(nzb)                      !< in kg/m^3  
+
+
+                      !
+                      !-- Other species
+                      ELSE
+
+                         !
+                         !--           (ppm/s) * m  * kg/m^3                    kg/(m^2/s)
+                         surf_def_h(0)%cssws(match_spec_model(ispec),m) = emis_distribution(1,j,i,ispec) *  &       
+                                                                           ( 1.0_wp / emt_att%xm(ispec) ) * &  !< in mole/kg 
+                                                                             conv_to_ratio(nzb,j,i) *       &  !< in m^3/mole  
+                                                                              ratio2ppm *                   &  !< in ppm 
+                                                                               rho_air(nzb)                    !< in  kg/m^3  
+  
+
+                      ENDIF
+
+                   ENDIF
+
+                ENDIF
+
+             ENDDO
+         
+!
+!--          LSM surfaces
+             DO m = 1, surf_lsm_h%ns
+
+                i = surf_lsm_h%i(m)
+                j = surf_lsm_h%j(m)
+                k = surf_lsm_h%k(m)
+
+                IF ( emis_distribution(1,j,i,ispec) > 0.0_wp )  THEN
+
+                   !
+                   !-- PMs
+                   IF ( TRIM( spc_names(match_spec_model(ispec)) ) == "PM1"  &
+                        .OR. TRIM( spc_names(match_spec_model(ispec)) ) == "PM25"  &
+                          .OR. TRIM( spc_names(match_spec_model(ispec)) ) == "PM10" )  THEN
+   
+                      !
+                      !--         kg/(m^2*s) * kg/m^3                           kg/(m^2*s)            
+                      surf_lsm_h%cssws(match_spec_model(ispec),m) = emis_distribution(1,j,i,ispec) *  &
+                                                                     rho_air(k)                                !< in kg/m^3
+ 
+                   ELSE
+
+                      !
+                      !-- VOCs
+                      IF ( len_index_voc > 0 .AND. emt_att%species_name(match_spec_input(ispec)) == "VOC" )  THEN
+                         !
+                         !--          (ppm/s) * m * kg/m^3                        mole/(m^2/s)   
+                         surf_lsm_h%cssws(match_spec_model(ispec),m) = emis_distribution(1,j,i,ispec) *  &     
+                                                                        conv_to_ratio(k,j,i) *           &     !< in m^3/mole
+                                                                         ratio2ppm *                     &     !< in ppm
+                                                                          rho_air(k)                           !< in kg/m^3  
+
+                      !
+                      !-- Other species
+                      ELSE
+                         !
+                         !--           (ppm/s) * m  * kg/m^3                    kg/(m^2/s)
+                         surf_lsm_h%cssws(match_spec_model(ispec),m) = emis_distribution(1,j,i,ispec) *  & 
+                                                                        ( 1.0_wp / emt_att%xm(ispec) ) * &     !< in mole/kg
+                                                                         conv_to_ratio(k,j,i) *          &     !< in m^3/mole
+                                                                          ratio2ppm *                    &     !< in ppm
+                                                                           rho_air(k)                          !< in kg/m^3     
+                                                   
+                      ENDIF
+
+                   ENDIF
+
+                ENDIF
+
+             ENDDO
+
+!
+!--          USM surfaces
+             DO m = 1, surf_usm_h%ns
+
+                i = surf_usm_h%i(m)
+                j = surf_usm_h%j(m)
+                k = surf_usm_h%k(m)
+
+                IF ( emis_distribution(1,j,i,ispec) > 0.0_wp )  THEN
+
+                   !
+                   !-- PMs
+                   IF ( TRIM( spc_names(match_spec_model(ispec)) ) == "PM1" &
+                        .OR. TRIM( spc_names(match_spec_model(ispec)) ) == "PM25"  &
+                          .OR. TRIM( spc_names(match_spec_model(ispec)) ) == "PM10" )  THEN
                    
+                      !
+                      !--          kg/(m^2*s) *kg/m^3                             kg/(m^2*s)                     
+                      surf_usm_h%cssws(match_spec_model(ispec),m) = emis_distribution(1,j,i,ispec)*  & 
+                                                                     rho_air(k)                                !< in kg/m^3
+
+ 
+                   ELSE
+                      
+                      !
+                      !-- VOCs
+                      IF ( len_index_voc > 0 .AND. emt_att%species_name(match_spec_input(ispec)) == "VOC" ) THEN
                          !
-                         !--            kg/(m^2*s) *kg/m^3                         kg/(m^2*s)                 
-                         surf_def_h(0)%cssws(match_spec_model(ispec),m) = emis_distribution(1,j,i,ispec)*  &
-                                                                           rho_air(nzb)                           !< in kg/m^3  
- 
- 
+                         !--          (ppm/s) * m * kg/m^3                        mole/(m^2/s)   
+                         surf_usm_h%cssws(match_spec_model(ispec),m) = emis_distribution(1,j,i,ispec) *  &
+                                                                        conv_to_ratio(k,j,i) *           &     !< in m^3/mole
+                                                                         ratio2ppm *                     &     !< in ppm
+                                                                          rho_air(k)                           !< in kg/m^3   
+
+                      !
+                      !-- Other species
                       ELSE
 
                          !
-                         !-- VOCs
-                         IF ( len_index_voc > 0 .AND. emt_att%species_name(match_spec_input(ispec)) == "VOC" )  THEN
-                            !
-                            !--           (ppm/s) * m * kg/m^3                        mole/(m^2/s)   
-                            surf_def_h(0)%cssws(match_spec_model(ispec),m) = emis_distribution(1,j,i,ispec) *  &
-                                                                              conv_to_ratio(nzb,j,i) *         &  !< in m^3/mole
-                                                                               ratio2ppm *                     &  !< in ppm
-                                                                                rho_air(nzb)                      !< in kg/m^3  
-
-
-                         !
-                         !-- Other species
-                         ELSE
-
-                            !
-                            !--           (ppm/s) * m  * kg/m^3                    kg/(m^2/s)
-                            surf_def_h(0)%cssws(match_spec_model(ispec),m) = emis_distribution(1,j,i,ispec) *  &       
-                                                                              ( 1.0_wp / emt_att%xm(ispec) ) * &  !< in mole/kg 
-                                                                                conv_to_ratio(nzb,j,i) *       &  !< in m^3/mole  
-                                                                                 ratio2ppm *                   &  !< in ppm 
-                                                                                  rho_air(nzb)                    !< in  kg/m^3  
-  
-
-                         ENDIF
+                         !--          (ppm/s) * m * kg/m^3                        kg/(m^2/s)                      
+                         surf_usm_h%cssws(match_spec_model(ispec),m) = emis_distribution(1,j,i,ispec) *  &   
+                                                                        ( 1.0_wp / emt_att%xm(ispec) ) * &     !< in mole/kg
+                                                                         conv_to_ratio(k,j,i) *          &     !< in m^3/mole
+                                                                          ratio2ppm*                     &     !< in ppm
+                                                                           rho_air(k)                          !< in kg/m^3   
+
 
                       ENDIF
@@ -1428,123 +1541,7 @@
                    ENDIF
 
-                ENDDO
-
-             ENDIF
-         
-             !
-             !-- LSM surfaces
-             IF ( surf_lsm_h%ns > 0 )  THEN
-
-                DO m = 1, surf_lsm_h%ns
-
-                   i = surf_lsm_h%i(m)
-                   j = surf_lsm_h%j(m)
-                   k = surf_lsm_h%k(m)
-
-                   IF ( emis_distribution(1,j,i,ispec) > 0.0_wp )  THEN
-
-                      !
-                      !-- PMs
-                      IF ( TRIM( spc_names(match_spec_model(ispec)) ) == "PM1"  &
-                           .OR. TRIM( spc_names(match_spec_model(ispec)) ) == "PM25"  &
-                             .OR. TRIM( spc_names(match_spec_model(ispec)) ) == "PM10" )  THEN
-   
-                         !
-                         !--         kg/(m^2*s) * kg/m^3                           kg/(m^2*s)            
-                         surf_lsm_h%cssws(match_spec_model(ispec),m) = emis_distribution(1,j,i,ispec) *  &
-                                                                        rho_air(k)                                !< in kg/m^3
- 
-                      ELSE
-
-                         !
-                         !-- VOCs
-                         IF ( len_index_voc > 0 .AND. emt_att%species_name(match_spec_input(ispec)) == "VOC" )  THEN
-                            !
-                            !--          (ppm/s) * m * kg/m^3                        mole/(m^2/s)   
-                            surf_lsm_h%cssws(match_spec_model(ispec),m) = emis_distribution(1,j,i,ispec) *  &     
-                                                                           conv_to_ratio(k,j,i) *           &     !< in m^3/mole
-                                                                            ratio2ppm *                     &     !< in ppm
-                                                                             rho_air(k)                           !< in kg/m^3  
-
-                         !
-                         !-- Other species
-                         ELSE
-                            !
-                            !--           (ppm/s) * m  * kg/m^3                    kg/(m^2/s)
-                            surf_lsm_h%cssws(match_spec_model(ispec),m) = emis_distribution(1,j,i,ispec) *  & 
-                                                                           ( 1.0_wp / emt_att%xm(ispec) ) * &     !< in mole/kg
-                                                                            conv_to_ratio(k,j,i) *          &     !< in m^3/mole
-                                                                             ratio2ppm *                    &     !< in ppm
-                                                                              rho_air(k)                          !< in kg/m^3     
-                                                      
-                         ENDIF
-
-                      ENDIF
-
-                   ENDIF
-
-                ENDDO
-
-             ENDIF
-
-             !
-             !-- USM surfaces
-             IF ( surf_usm_h%ns > 0 )  THEN
-
-
-                DO m = 1, surf_usm_h%ns
-
-                   i = surf_usm_h%i(m)
-                   j = surf_usm_h%j(m)
-                   k = surf_usm_h%k(m)
-
-                   IF ( emis_distribution(1,j,i,ispec) > 0.0_wp )  THEN
-
-                      !
-                      !-- PMs
-                      IF ( TRIM( spc_names(match_spec_model(ispec)) ) == "PM1" &
-                           .OR. TRIM( spc_names(match_spec_model(ispec)) ) == "PM25"  &
-                             .OR. TRIM( spc_names(match_spec_model(ispec)) ) == "PM10" )  THEN
-                      
-                         !
-                         !--          kg/(m^2*s) *kg/m^3                             kg/(m^2*s)                     
-                         surf_usm_h%cssws(match_spec_model(ispec),m) = emis_distribution(1,j,i,ispec)*  & 
-                                                                        rho_air(k)                                !< in kg/m^3
-
- 
-                      ELSE
-                         
-                         !
-                         !-- VOCs
-                         IF ( len_index_voc > 0 .AND. emt_att%species_name(match_spec_input(ispec)) == "VOC" ) THEN
-                            !
-                            !--          (ppm/s) * m * kg/m^3                        mole/(m^2/s)   
-                            surf_usm_h%cssws(match_spec_model(ispec),m) = emis_distribution(1,j,i,ispec) *  &
-                                                                           conv_to_ratio(k,j,i) *           &     !< in m^3/mole
-                                                                            ratio2ppm *                     &     !< in ppm
-                                                                             rho_air(k)                           !< in kg/m^3   
-
-                         !
-                         !-- Other species
-                         ELSE
-
-                            !
-                            !--          (ppm/s) * m * kg/m^3                        kg/(m^2/s)                      
-                            surf_usm_h%cssws(match_spec_model(ispec),m) = emis_distribution(1,j,i,ispec) *  &   
-                                                                           ( 1.0_wp / emt_att%xm(ispec) ) * &     !< in mole/kg
-                                                                            conv_to_ratio(k,j,i) *          &     !< in m^3/mole
-                                                                             ratio2ppm*                     &     !< in ppm
-                                                                              rho_air(k)                          !< in kg/m^3   
-
-
-                         ENDIF
-
-                      ENDIF
-
-                   ENDIF
- 
-                ENDDO
-
-             ENDIF
+                ENDIF
+ 
+             ENDDO
 
           ENDDO
Index: /palm/trunk/SOURCE/surface_mod.f90
===================================================================
--- /palm/trunk/SOURCE/surface_mod.f90	(revision 3771)
+++ /palm/trunk/SOURCE/surface_mod.f90	(revision 3772)
@@ -26,4 +26,7 @@
 ! -----------------
 ! $Id$
+! small change in the todo's
+! 
+! 3767 2019-02-27 08:18:02Z raasch
 ! unused variables removed from rrd-subroutine parameter list
 ! 
@@ -259,5 +262,5 @@
 !>        default type 
 !> @todo Clean up urban-surface variables (some of them are not used any more) 
-!> @todo Revise chemistry surface flux part (reduce loops?!) 
+!> @todo Revise initialization of surface fluxes (especially for chemistry) 
 !> @todo Get rid-off deallocation routines in restarts
 !------------------------------------------------------------------------------!
