Index: palm/trunk/SOURCE/chem_modules.f90
===================================================================
--- palm/trunk/SOURCE/chem_modules.f90	(revision 3834)
+++ palm/trunk/SOURCE/chem_modules.f90	(revision 3835)
@@ -15,7 +15,7 @@
 ! PALM. If not, see <http://www.gnu.org/licenses/>.
 !
-! Copyright 2018-2018 Leibniz Universitaet Hannover
-! Copyright 2018-2018 Karlsruhe Institute of Technology
-! Copyright 2018-2018 Freie Universitaet Berlin
+! Copyright 2018-2019 Leibniz Universitaet Hannover
+! Copyright 2018-2019 Karlsruhe Institute of Technology
+! Copyright 2018-2019 Freie Universitaet Berlin
 !------------------------------------------------------------------------------!
 !
@@ -27,4 +27,7 @@
 ! -----------------
 ! $Id$
+! Formatting, clean-up, clarified/corrected comments
+! 
+! 3833 2019-03-28 15:04:04Z forkel
 ! removed USE chem_gasphase_mod
 ! 
@@ -85,72 +88,74 @@
     IMPLICIT NONE
 
-    CHARACTER (LEN=20)                ::  bc_cs_b             = 'dirichlet'         !< namelist parameter
-    CHARACTER (LEN=20)                ::  bc_cs_t             = 'initial_gradient'  !< namelist parameter
-    CHARACTER (LEN=30)                ::  chem_mechanism      = 'phstatp'           !< KPP chmical mechanism
-                                                                                    !< by cs_name for each height lvls defined by cs_heights
-    CHARACTER (LEN=80)                ::  daytype_mdh         ='workday'            !< Type of day in the MDH case: workday, weekend, holiday
-    CHARACTER (LEN=80)                ::  mode_emis           ='PARAMETERIZED'      !< Mode of chemistry emissions: DEFAULT .OR. EXPERT .OR. 
-                                                                                    !< PARAMETERIZED
-    CHARACTER (LEN=80)                ::  time_fac_type       ='MDH'                !< Type of time treatment in the emis DEFAULT mode: HOUR .OR. MDH 
-    CHARACTER (LEN=11), DIMENSION(99) ::  cs_name             = 'novalue'           !< Namelist parameter: chem spcs names 
-    CHARACTER (LEN=11), DIMENSION(99) ::  cs_profile_name     = 'novalue'           !< Namelist parameter: Names of the chem for profiles
-    CHARACTER (LEN=11), DIMENSION(99) ::  data_output_pr_cs   = 'novalue'           !< Namelist parameter: Names of the chem species for profile output
-    CHARACTER (LEN=11), DIMENSION(99) ::  surface_csflux_name = 'novalue'           !< Namelist parameter: chem species names with surface fluxes specified
-                                                                                    !< active chem spcs, default is 'novalue')  ????
+    CHARACTER (LEN=20) ::  bc_cs_b        = 'dirichlet'         !< namelist parameter: surface boundary condition for concentration
+    CHARACTER (LEN=20) ::  bc_cs_t        = 'initial_gradient'  !< namelist parameter: top boudary condition for concentration
+    CHARACTER (LEN=30) ::  chem_mechanism = 'phstatp'           !< namelist parameter: chemistry mechanism
+    CHARACTER (LEN=80) ::  daytype_mdh    = 'workday'           !< namelist parameter: type of day - workday, weekend, holiday
+    CHARACTER (LEN=80) ::  mode_emis      = 'PARAMETERIZED'     !< namelist parameter: mode of chemistry emissions - DEFAULT, EXPERT, PARAMETERIZED
+    CHARACTER (LEN=80) ::  time_fac_type  = 'MDH'               !< namelist parameter: type of time treatment in the mode_emis DEFAULT - HOUR, MDH
+    
+    CHARACTER (LEN=11), DIMENSION(99) ::  cs_name             = 'novalue'  !< namelist parameter: names of species with given fluxes (see csflux)
+    CHARACTER (LEN=11), DIMENSION(99) ::  cs_profile_name     = 'novalue'  !< namelist parameter: tbc...???
+    CHARACTER (LEN=11), DIMENSION(99) ::  data_output_pr_cs   = 'novalue'  !< namelist parameter: tbc...???
+    CHARACTER (LEN=11), DIMENSION(99) ::  surface_csflux_name = 'novalue'  !< namelist parameter: tbc...???
 
-    INTEGER(iwp)                          ::  cs_pr_count                           = 0      !< namelist parameter : No. of species profiles (ecc)
-    INTEGER(iwp)                          ::  cs_vertical_gradient_level_ind(99,10) = -9999  !< grid index values of cs_vertical_gradient_level_ind(s)
-    INTEGER(iwp)                          ::  ibc_cs_b                                       !< integer flag for bc_cs_b
-    INTEGER(iwp)                          ::  ibc_cs_t                                       !< integer flag for bc_cs_t
-    INTEGER(iwp)                          ::  main_street_id                        = 0      !< namelist parameter for chem_emissions : ID for main streets  
-    INTEGER(iwp)                          ::  max_pr_cs                             = 0      !< namelist parameter : Max no. of species profiles (ecc)
-    INTEGER(iwp)                          ::  max_street_id                         = 0      !< namelist parameter for chem_emissions : maximum street IDs      
-    INTEGER(iwp)                          ::  nspec_out                                      !< Output of routine chem_emis_matching with 
-    INTEGER(iwp)                          ::  side_street_id                        = 0      !< namelist paramtger for chem_emissions : ID for side streets
-    INTEGER(iwp),DIMENSION(99)            ::  cs_pr_index                           = 0      !< index for chemical species profile (ecc)
-    INTEGER(iwp),DIMENSION(:)             ::  match_spec_nox(1:2)                            !< results of matching the input and model's NOx
-    INTEGER(iwp),DIMENSION(:)             ::  match_spec_pm(1:3)                             !< results of matching the input and model's PMs
-    INTEGER(iwp),DIMENSION(:)             ::  match_spec_sox(1:2)                            !< results of matching the input and model's SOx! 
-    INTEGER(iwp),DIMENSION(:),ALLOCATABLE ::  match_spec_input                               !< Index of Input chem species for matching routine 
-    INTEGER(iwp),DIMENSION(:),ALLOCATABLE ::  match_spec_model                               !< Index of Model chem species for matching routine
-    INTEGER(iwp),DIMENSION(:),ALLOCATABLE ::  match_spec_voc_input                           !< index of VOC input components matching the model's VOCs
-    INTEGER(iwp),DIMENSION(:),ALLOCATABLE ::  match_spec_voc_model                           !< index of VOC model species matching the input VOCs comp.
+    INTEGER(iwp) ::  cs_pr_count                           = 0      !< counter for chemical species profiles
+    INTEGER(iwp) ::  cs_vertical_gradient_level_ind(99,10) = -9999  !< grid index values of cs_vertical_gradient_level
+    INTEGER(iwp) ::  ibc_cs_b                                       !< integer flag for bc_cs_b
+    INTEGER(iwp) ::  ibc_cs_t                                       !< integer flag for bc_cs_t
+    INTEGER(iwp) ::  main_street_id                        = 0      !< namelist parameter: lower bound of main street IDs (OpenStreetMaps) for PARAMETERIZED mode
+    INTEGER(iwp) ::  max_pr_cs                             = 0      !< 
+    INTEGER(iwp) ::  max_street_id                         = 0      !< namelist parameter: upper bound of main street IDs (OpenStreetMaps) for PARAMETERIZED mode      
+    INTEGER(iwp) ::  nspec_out                                      !< output of routine chem_emis_matching with.....???
+    INTEGER(iwp) ::  side_street_id                        = 0      !< namelist parameter: lower bound of side street IDs (OpenStreetMaps) for PARAMETERIZED mode
 
-    LOGICAL      ::  constant_top_csflux(99)               = .TRUE.   !< chem spcs at the top  orig .TRUE.
-    LOGICAL      ::  constant_csflux(99)                   = .TRUE.   !< chem spcs at namelist parameter   orig TRUE
-    LOGICAL      ::  call_chem_at_all_substeps             = .FALSE.  !< namelist parameter 
-    LOGICAL      ::  chem_debug0                           = .FALSE.  !< namelist parameter flag for minimum print output
-    LOGICAL      ::  chem_debug1                           = .FALSE.  !< namelist parameter flag for print output
-    LOGICAL      ::  chem_debug2                           = .FALSE.  !< namelist parameter flag for further print output
-    LOGICAL      ::  chem_gasphase_on                      = .TRUE.   !< namelist parameter 
-    LOGICAL      ::  cs_pr_namelist_found                  = .FALSE.  !< Namelist parameter: Names of t
-    LOGICAL      ::  deposition_dry                        = .FALSE.  !< namelist parameter for activation of deposition calculation
-    LOGICAL      ::  emissions_anthropogenic               = .FALSE.  !< Flag for turning on anthropogenic emissions
-    LOGICAL      ::  emission_output_required              = .TRUE.   !< Logical Variable for requiring Emission Outputs
-!
-!-- Namelist parameters for creating initial chemistry profiles
-    REAL(wp)                                        ::  cs_surface_initial_change(99)     = 0.0_wp        !< namelist parameter : initial surface flux difference
-    REAL(wp)                                        ::  cs_vertical_gradient(99,10)       = 0.0_wp        !< namelist parameter : vertical gradient
-    REAL(wp)                                        ::  cs_vertical_gradient_level(99,10) = -999999.9_wp  !< namelist parameter : vertical gradient level
-    REAL(wp)                                        ::  emiss_factor_main(99)             = -9999.0_wp    !< emission factor for main streets
-    REAL(wp)                                        ::  emiss_factor_side(99)             = -9999.0_wp    !< emission factor for side streets
-                                                                                                          !< in the namelist
-    REAL(wp)                                        ::  surface_csflux(99)                = 0.0_wp        !< namelist parameter : fluxes where 'surface_csflux_name' is
-    REAL(wp)                                        ::  top_csflux(99)                    = 0.0_wp        !< namelist parameter : chemical species flux at ceiling
-    REAL(wp)                                        ::  wall_csflux(99,0:5)               = 0.0_wp        !< namelist parameter : chemical species flux lateral
-    REAL(wp),DIMENSION(99)                          ::  cs_surface                        = 0.0_wp        !< Namelist parameter: Surface conc of chem spcs'
-    REAL(wp),DIMENSION(99,100)                      ::  cs_heights                        = 9999999.9_wp  !< Namelist parameter: Height lvls(m) for cs_profiles
-    REAL(wp),DIMENSION(99,100)                      ::  cs_profile                        = 9999999.9_wp  !< Namelist parameter: Chem conc for each spcs defined
-    REAL(wp),DIMENSION(:),ALLOCATABLE               ::  bc_cs_t_val                                       !< chemical specices time value at BC
-    REAL(wp),DIMENSION(:),ALLOCATABLE               ::  css                                               !< scaling parameter for chem spcs
-    REAL(wp),DIMENSION(:,:,:,:),ALLOCATABLE         ::  emis_distribution                                 !< Emissions Final Values (main module output)
-    REAL(wp),DIMENSION(:,:,:,:),ALLOCATABLE, TARGET ::  cs_1                                              !< pointer for swapping of timelevels for respective quantity
-    REAL(wp),DIMENSION(:,:,:,:),ALLOCATABLE, TARGET ::  cs_2                                              !< pointer for swapping of timelevels for respective quantity
-    REAL(wp),DIMENSION(:,:,:,:),ALLOCATABLE, TARGET ::  cs_3                                              !< pointer for swapping of timelevels for respective quantity
-    REAL(wp),DIMENSION(:,:,:),POINTER               ::  cs                                                !< pointer: sgs chem spcs)
-    REAL(wp),DIMENSION(:,:,:),POINTER               ::  cs_p                                              !< pointer: prognostic value of sgs chem spcs 
-    REAL(wp),DIMENSION(:,:,:),POINTER               ::  tcs_m                                             !< pointer: to tcs array (temp)
-!
-!-- molecular weights
+    INTEGER(iwp), DIMENSION(99) ::  cs_pr_index  = 0      !< index for chemical species profiles
+    INTEGER(iwp), DIMENSION(:)  ::  match_spec_nox(1:2)   !< results of matching the input and model's NOx
+    INTEGER(iwp), DIMENSION(:)  ::  match_spec_pm(1:3)    !< results of matching the input and model's PMs
+    INTEGER(iwp), DIMENSION(:)  ::  match_spec_sox(1:2)   !< results of matching the input and model's SOx! 
+
+    INTEGER(iwp), DIMENSION(:), ALLOCATABLE ::  match_spec_input      !< index of input chem species for matching routine 
+    INTEGER(iwp), DIMENSION(:), ALLOCATABLE ::  match_spec_model      !< index of model chem species for matching routine
+    INTEGER(iwp), DIMENSION(:), ALLOCATABLE ::  match_spec_voc_input  !< index of VOC input components matching the model's VOCs
+    INTEGER(iwp), DIMENSION(:), ALLOCATABLE ::  match_spec_voc_model  !< index of VOC model species matching the input VOCs comp.
+
+    LOGICAL ::  constant_top_csflux(99)   = .TRUE.   !< internal flag, set to .FALSE. if no top_csflux is prescribed
+    LOGICAL ::  constant_csflux(99)       = .TRUE.   !< internal flag, set to .FALSE. if no surface_csflux is prescribed
+    LOGICAL ::  call_chem_at_all_substeps = .FALSE.  !< namelist parameter: ....??? 
+    LOGICAL ::  chem_debug0               = .FALSE.  !< namelist parameter: flag for minimum print output
+    LOGICAL ::  chem_debug1               = .FALSE.  !< namelist parameter: flag for print output
+    LOGICAL ::  chem_debug2               = .FALSE.  !< namelist parameter: flag for further print output
+    LOGICAL ::  chem_gasphase_on          = .TRUE.   !< namelist parameter: flag to switch off chemical reactions
+    LOGICAL ::  cs_pr_namelist_found      = .FALSE.  !< ...???
+    LOGICAL ::  deposition_dry            = .FALSE.  !< namelist parameter: flag for activation of deposition calculation
+    LOGICAL ::  emissions_anthropogenic   = .FALSE.  !< namelist parameter: flag for turning on anthropogenic emissions
+    LOGICAL ::  emission_output_required  = .TRUE.   !< internal flag for requiring emission outputs
+
+    REAL(wp) ::  cs_surface_initial_change(99)     = 0.0_wp        !< namelist parameter: ...???
+    REAL(wp) ::  cs_vertical_gradient(99,10)       = 0.0_wp        !< namelist parameter: ...???
+    REAL(wp) ::  cs_vertical_gradient_level(99,10) = -999999.9_wp  !< namelist parameter: ...???
+    REAL(wp) ::  emiss_factor_main(99)             = -9999.0_wp    !< namelist parameter: ...???
+    REAL(wp) ::  emiss_factor_side(99)             = -9999.0_wp    !< namelist parameter: ...???
+    REAL(wp) ::  surface_csflux(99)                = 0.0_wp        !< namelist parameter: ...???
+    REAL(wp) ::  top_csflux(99)                    = 0.0_wp        !< namelist parameter: ...???
+    REAL(wp) ::  wall_csflux(99,0:5)               = 0.0_wp        !< namelist parameter: ...???
+
+    REAL(wp), DIMENSION(99)     ::  cs_surface = 0.0_wp        !< namelist parameter: chem species concentration at surface
+    REAL(wp), DIMENSION(99,100) ::  cs_heights = 9999999.9_wp  !< namelist parameter: height levels for initial chem species concentrations
+    REAL(wp), DIMENSION(99,100) ::  cs_profile = 9999999.9_wp  !< namelist parameter: chem species concentration values at cs_heights levels
+
+    REAL(wp), DIMENSION(:), ALLOCATABLE ::  bc_cs_t_val  !< vertical gradient of chemical species near domain top
+    REAL(wp), DIMENSION(:), ALLOCATABLE ::  css          !< scaling parameter for chem species
+
+    REAL(wp), DIMENSION(:,:,:,:), ALLOCATABLE ::  emis_distribution  !< emissions final values (main module output) ???
+                                  
+    REAL(wp), DIMENSION(:,:,:,:), ALLOCATABLE, TARGET ::  cs_1  !< pointer for swapping of timelevels for respective quantity
+    REAL(wp), DIMENSION(:,:,:,:), ALLOCATABLE, TARGET ::  cs_2  !< pointer for swapping of timelevels for respective quantity
+    REAL(wp), DIMENSION(:,:,:,:), ALLOCATABLE, TARGET ::  cs_3  !< pointer for swapping of timelevels for respective quantity
+
+    REAL(wp), DIMENSION(:,:,:), POINTER ::  cs     !< pointer: sgs chem spcs  ???
+    REAL(wp), DIMENSION(:,:,:), POINTER ::  cs_p   !< pointer: prognostic value of sgs chem spcs ???
+    REAL(wp), DIMENSION(:,:,:), POINTER ::  tcs_m  !< pointer: to tcs array (temp)
+
     REAL, PARAMETER ::  xm_air   =   28.964e-3             !< air      molecular weight (kg/mol)
     REAL, PARAMETER ::  xm_C     =   12.01115e-3           !< C        molecular weight (kg/mol)
