Index: palm/trunk/SOURCE/salsa_mod.f90
===================================================================
--- palm/trunk/SOURCE/salsa_mod.f90	(revision 4298)
+++ palm/trunk/SOURCE/salsa_mod.f90	(revision 4315)
@@ -26,4 +26,8 @@
 ! -----------------
 ! $Id$
+! Add an additional check for the time dimension PIDS_SALSA in
+! salsa_emission_setup and correct some error message identifiers.
+! 
+! 4298 2019-11-21 15:59:16Z suehring
 ! Bugfix, close netcdf input files after reading
 ! 
@@ -297,5 +301,5 @@
     REAL(wp), PARAMETER ::  ambc     = 12.0E-3_wp     !< black carbon (BC)
     REAL(wp), PARAMETER ::  amdair   = 28.970E-3_wp   !< dry air
-    REAL(wp), PARAMETER ::  amdu     = 100.E-3_wp     !< mineral dust
+    REAL(wp), PARAMETER ::  amdu     = 100.0E-3_wp    !< mineral dust
     REAL(wp), PARAMETER ::  amh2o    = 18.0154E-3_wp  !< H2O
     REAL(wp), PARAMETER ::  amh2so4  = 98.06E-3_wp    !< H2SO4
@@ -305,5 +309,5 @@
     REAL(wp), PARAMETER ::  amo2     = 31.9988E-3_wp  !< O2
     REAL(wp), PARAMETER ::  amo3     = 47.998E-3_wp   !< O3
-    REAL(wp), PARAMETER ::  amoc     = 150.E-3_wp     !< organic carbon (OC)
+    REAL(wp), PARAMETER ::  amoc     = 150.0E-3_wp    !< organic carbon (OC)
     REAL(wp), PARAMETER ::  amss     = 58.44E-3_wp    !< sea salt (NaCl)
 !
@@ -5654,5 +5658,5 @@
     IF ( ptemp < 240.0_wp  .OR.  ptemp > 300.0_wp )  THEN
        message_string = 'Invalid input value: ptemp'
-       CALL message( 'salsa_mod: ternucl', 'PA0648', 1, 2, 0, 6, 0 )
+       CALL message( 'salsa_mod: ternucl', 'PA0689', 1, 2, 0, 6, 0 )
     ENDIF
     IF ( prh < 0.05_wp  .OR.  prh > 0.95_wp )  THEN
@@ -8602,4 +8606,7 @@
  SUBROUTINE salsa_emission_setup( init )
 
+    USE control_parameters,                                                                        &
+        ONLY:  end_time, spinup_time
+
     USE netcdf_data_input_mod,                                                                     &
         ONLY:  check_existence, close_input_file, get_attribute, get_variable,                     &
@@ -8700,5 +8707,5 @@
                    WRITE( message_string, * ) 'salsa_emission_mode = "parameterized" but the '//  &
                                               'street_type data is missing.'
-                   CALL message( 'salsa_emission_setup', 'PA0661', 1, 2, 0, 6, 0 )
+                   CALL message( 'salsa_emission_setup', 'PA0695', 1, 2, 0, 6, 0 )
                 ENDIF
              ENDIF
@@ -8823,5 +8830,5 @@
              ELSE
                 message_string = 'Missing emission_mass_fracs in ' //  TRIM( input_file_salsa )
-                CALL message( 'salsa_emission_setup', 'PA0659', 1, 2, 0, 6, 0 )
+                CALL message( 'salsa_emission_setup', 'PA0694', 1, 2, 0, 6, 0 )
              ENDIF
 !
@@ -9013,4 +9020,12 @@
                 ENDIF
 !
+!--             Check if the provided data covers the entire simulation. The spinup time is added
+!--             to the end_time, this must be considered here.
+                IF ( end_time - spinup_time > aero_emission_att%time(aero_emission_att%nt-1) )  THEN
+                   message_string = 'end_time of the simulation exceeds the time dimension in ' // &
+                                    'the salsa input file.'
+                   CALL message( 'salsa_emission_setup', 'PA0692', 1, 2, 0, 6, 0 ) 
+                ENDIF
+!
 !--             Read emission number fractions per category
                 IF ( check_existence( aero_emission_att%var_names, 'emission_number_fracs' ) )  THEN
@@ -9019,10 +9034,10 @@
                 ELSE
                    message_string = 'Missing emission_number_fracs in ' //  TRIM( input_file_salsa )
-                   CALL message( 'salsa_emission_setup', 'PA0659', 1, 2, 0, 6, 0 )
+                   CALL message( 'salsa_emission_setup', 'PA0694', 1, 2, 0, 6, 0 )
                 ENDIF
 
              ELSE
                 message_string = 'Unknown lod for aerosol_emission_values.'
-                CALL message( 'salsa_emission','PA0637', 1, 2, 0, 6, 0 )
+                CALL message( 'salsa_emission_setup','PA0637', 1, 2, 0, 6, 0 )
 
              ENDIF  ! lod
@@ -12540,10 +12555,10 @@
           message_string = 'end_time of the simulation exceeds the time dimension in the dynamic'//&
                            ' input file.'
-          CALL message( 'salsa_nesting_offl_init', 'PA0681', 1, 2, 0, 6, 0 ) 
+          CALL message( 'salsa_nesting_offl_init', 'PA0690', 1, 2, 0, 6, 0 ) 
        ENDIF
 
        IF ( salsa_nest_offl%time(0) /= time_utc_init )  THEN
           message_string = 'Offline nesting: time dimension must start at time_utc_init.'
-          CALL message( 'salsa_nesting_offl_init', 'PA0682', 1, 2, 0, 6, 0 )
+          CALL message( 'salsa_nesting_offl_init', 'PA0691', 1, 2, 0, 6, 0 )
        ENDIF
 !
@@ -12669,12 +12684,11 @@
 !
 !--    Read the vertical dimension
-       CALL get_dimension_length( salsa_nest_offl%id_dynamic,                    &
-                                                    salsa_nest_offl%nzu, 'z' )
+       CALL get_dimension_length( salsa_nest_offl%id_dynamic, salsa_nest_offl%nzu, 'z' )
        ALLOCATE( salsa_nest_offl%zu_atmos(1:salsa_nest_offl%nzu) )
        CALL get_variable( salsa_nest_offl%id_dynamic, 'z', salsa_nest_offl%zu_atmos )
 !
 !--    Read the number of aerosol chemical components
-       CALL get_dimension_length( salsa_nest_offl%id_dynamic,                    &
-                                                    salsa_nest_offl%ncc, 'composition_index' )
+       CALL get_dimension_length( salsa_nest_offl%id_dynamic, salsa_nest_offl%ncc,                 &
+                                  'composition_index' )
 !
 !--    Read the names of aerosol chemical components
@@ -12704,6 +12718,5 @@
           message_string = 'None of the aerosol chemical components in ' //                        &
                            TRIM( input_file_dynamic ) // ' correspond to ones applied in SALSA.'
-          CALL message( 'salsa_mod: salsa_nesting_offl_input',                      &
-                        'PA0662', 2, 2, 0, 6, 0 )
+          CALL message( 'salsa_mod: salsa_nesting_offl_input', 'PA0693', 2, 2, 0, 6, 0 )
        ENDIF
        
