Ignore:
Timestamp:
Oct 30, 2018 2:51:23 PM (6 years ago)
Author:
kanani
Message:

Reintegrated fixes/changes from branch chemistry

File:
1 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/SOURCE/chem_emissions_mod.f90

    r3373 r3458  
    2727! -----------------
    2828! $Id$
     29! from chemistry branch r3443, banzhafs, Russo:
     30! Additional correction for index of input file of pre-processed mode
     31! Removed atomic and molecular weights as now available in chem_modules and
     32! added par_emis_time_factor (formerly in netcdf_data_input_mod)
     33! Added correction for index of input file of pre-processed mode
     34! Added a condition for default mode necessary for information read from ncdf file
     35! in pre-processed and default mode
     36! Correction of multiplying factor necessary for scaling emission values in time
     37! Introduced correction for scaling units in the case of DEFAULT emission mode
     38!
     39! 3373 2018-10-18 15:25:56Z kanani
    2940! Fix wrong location of __netcdf directive
    3041!
     
    4051! Authors:
    4152! --------
    42 ! Emmanuele Russo Fu-Berlin
    43 ! Sabine Banzhaf  FU-Berlin
    44 ! Martijn Schaap  FU-Berlin, TNO Utrecht
     53! @author Emmanuele Russo (Fu-Berlin)
     54! @author Sabine Banzhaf  (FU-Berlin)
     55! @author Martijn Schaap  (FU-Berlin, TNO Utrecht)
    4556!
    4657! Description:
     
    4960!>
    5061!> @todo Check_parameters routine should be developed: for now it includes just one condition
    51 !> @todo Add option for capital or small letters in the matching routine
    5262!> @todo Use of Restart files not contempled at the moment
     63!> @todo revise indices of files read from the netcdf: preproc_emission_data and expert_emission_data
     64!> @todo for now emission data may be passed on a singular vertical level: need to be more flexible
    5365!> @note <Enter notes on the module>
    5466!> @bug  <Enter known bugs here>
     
    6173
    6274    USE control_parameters,                                                    &
    63        ONLY:  initializing_actions,end_time, message_string,                   &
     75       ONLY:  initializing_actions, end_time, message_string,                  &
    6476              intermediate_timestep_count, dt_3d
    6577 
     
    6779
    6880    USE kinds
     81
     82#if defined ( __netcdf )
    6983
    7084    USE netcdf_data_input_mod,                                                  &
    7185       ONLY: chem_emis_att_type, chem_emis_val_type
    7286
    73 #if defined ( __netcdf )
    7487    USE NETCDF
     88
    7589#endif
    7690
    7791    USE date_and_time_mod,                                                      &
    78        ONLY: time_default_indices, month_of_year, day_of_month, hour_of_day,    &
     92       ONLY: time_default_indices, time_preprocessed_indices,                  &
     93             month_of_year, day_of_month, hour_of_day,                          &
    7994             index_mm, index_dd, index_hh
    8095
     
    92107   
    93108    CHARACTER (LEN=80)                               :: filename_emis                   !> Variable for the name of the netcdf input file
    94     CHARACTER (LEN=80), ALLOCATABLE, DIMENSION(:)    :: string_values                   !> Output of string variables read from netcdf input file
    95 
    96     INTEGER(iwp)                                     :: n_dims                          !> Number of dimensions of input variable netcdf file
     109
    97110    INTEGER(iwp)                                     :: i                               !> index 1st selected dimension (some dims are not spatial)
    98111    INTEGER(iwp)                                     :: j                               !> index 2nd selected dimension
     
    103116    INTEGER(iwp)                                     :: z_start                         !> Index to start read variable from netcdf in additional dims
    104117    INTEGER(iwp)                                     :: z_end                           !> Index to end read variable from netcdf in additional     dims
    105     INTEGER(iwp), ALLOCATABLE, DIMENSION(:)          :: id_dims                         !> id of dimension of selected variable netcdf input
    106     INTEGER(iwp), ALLOCATABLE, DIMENSION(:)          :: dum_var                         !> value of variable read from netcdf input
    107     INTEGER(iwp)                                     :: id_ncfile                       !> id netcdf file
    108     INTEGER(iwp)                                     :: errno                           !> error number NF90_???? function
    109     INTEGER(iwp)                                     :: id_var                          !< variable id
    110118    INTEGER(iwp)                                     :: dt_emis                         !> Time Step Emissions
    111119    INTEGER(iwp)                                     :: len_index                       !> length of index (used for several indices)
     
    124132    !> Dobson units:
    125133    REAL, PARAMETER        ::  Dobs = 2.68668e16    ! (mlc/cm2) / DU
    126    
    127     ! molar weights of components
    128  
    129     !> atomic weights: 
    130     REAL, PARAMETER        ::  xm_H     =    1.00790e-3               ! kg/mol
    131     REAL, PARAMETER        ::  xm_N     =   14.00670e-3               ! kg/mol
    132     REAL, PARAMETER        ::  xm_C     =   12.01115e-3               ! kg/mol
    133     REAL, PARAMETER        ::  xm_S     =   32.06400e-3               ! kg/mol
    134     REAL, PARAMETER        ::  xm_O     =   15.99940e-3               ! kg/mol
    135     REAL, PARAMETER        ::  xm_F     =   18.99840e-3               ! kg/mol
    136     REAL, PARAMETER        ::  xm_Na    =   22.98977e-3               ! kg/mol
    137     REAL, PARAMETER        ::  xm_Cl    =   35.45300e-3               ! kg/mol
    138     REAL, PARAMETER        ::  xm_Rn222 =  222.00000e-3               ! kg/mol
    139     REAL, PARAMETER        ::  xm_Pb210 =  210.00000e-3               ! kg/mol
    140     REAL, PARAMETER        ::  xm_Ca    =   40.07800e-3               ! kg/mol
    141     REAL, PARAMETER        ::  xm_K     =   39.09800e-3               ! kg/mol
    142     REAL, PARAMETER        ::  xm_Mg    =   24.30500e-3               ! kg/mol
    143     REAL, PARAMETER        ::  xm_Pb    =  207.20000e-3               ! kg/mol
    144     REAL, PARAMETER        ::  xm_Cd    =  112.41000e-3               ! kg/mol
    145     REAL, PARAMETER        ::  xm_Rh    =  102.90550e-3               ! kg/mol
    146  
    147     !> molecule weights:
    148     REAL, PARAMETER        ::  xm_h2o   = xm_H * 2 + xm_O             ! kg/mol
    149     REAL, PARAMETER        ::  xm_o3    = xm_O * 3                    ! kg/mol
    150     REAL, PARAMETER        ::  xm_N2O5  = xm_N * 2 + xm_O * 5         ! kg/mol
    151     REAL, PARAMETER        ::  xm_HNO3  = xm_H + xm_N + xm_O * 3      ! kg/mol
    152     REAL, PARAMETER        ::  xm_NH4   = xm_N + xm_H * 4             ! kg/mol
    153     REAL, PARAMETER        ::  xm_SO4   = xm_S + xm_O * 4             ! kg/mol
    154     REAL, PARAMETER        ::  xm_NO3   = xm_N + xm_O * 3             ! kg/mol
    155     REAL, PARAMETER        ::  xm_CO2   = xm_C + xm_O * 2             ! kg/mol
    156    
    157     !> mass of air
    158     REAL, PARAMETER        ::  xm_air   =  28.964e-3                  ! kg/mol
    159     REAL, PARAMETER        ::  xmair    =  28.94                      ! g/mol; old name!
    160134
    161135    !> sesalt composition:
     
    263237!-- Public Variables
    264238
    265     PUBLIC id_ncfile,errno,id_dims,n_dims,dum_var, con_factor,   &
    266            len_index,len_index_voc,len_index_pm, string_values
     239    PUBLIC con_factor, len_index,len_index_voc,len_index_pm
     240
    267241 CONTAINS
    268242
     
    275249
    276250
    277 !TBD: Where Should we put the call to chem_emissions_check_parameters? In chem_init or in check_parameters?
     251    !TBD: Where Should we put the call to chem_emissions_check_parameters? In chem_init or in check_parameters?
    278252
    279253    IMPLICIT NONE
     
    548522                IF (len_index_voc>0) THEN
    549523                   ALLOCATE(match_spec_voc_model(len_index_voc))   !> contains indices of the VOC model species
    550                    ALLOCATE(match_spec_voc_input(len_index_voc))   !> In input there is only one value for VOCs in the DEFAULT mode. This array contains the indices of the different values of VOC compositions of the input variable VOC_composition
     524                   ALLOCATE(match_spec_voc_input(len_index_voc))   !> In input there is only one value for VOCs in the DEFAULT mode.
     525                                                                   !  This array contains the indices of the different values of VOC compositions of the input variable VOC_composition
    551526                ENDIF
    552527
     
    661636                                 ' DO NOT MATCH'                                //          &
    662637                                 ' model chemical species'                      //          &
    663                                  ' Chemistry Emissions routine is not called'         !TBD: IMPORTANT:Add a condition in chem init that sets the emission_output_required to false when len_index==0 so that the chem_emissions modules are not used
     638                                 ' Chemistry Emissions routine is not called'         
    664639                CALL message( 'chem_emissions_matching', 'CM0440', 0, 0, 0, 6, 0 )
    665640
     
    724699                DO  ispec = 1 , len_index
    725700
    726                    IF ( emiss_factor_main(match_spec_input(ispec)) .LT. 0 .AND.                         &
    727                         emiss_factor_side(match_spec_input(ispec)) .LT. 0 ) THEN
    728 
    729                       message_string = 'PARAMETERIZED emissions mode selected:'            //           &
     701                   IF ( emiss_factor_main(match_spec_input(ispec)) .LT. 0 .AND. emiss_factor_side(match_spec_input(ispec)) .LT. 0 ) THEN
     702
     703                      message_string = 'PARAMETERIZED emissions mode selected:'            //          &
    730704                                       ' EMISSIONS POSSIBLE ONLY ON STREET SURFACES'        //          &
    731705                                       ' but values of scaling factors for street types'    //          &
     
    780754 SUBROUTINE chem_emissions_init(emt_att,emt,nspec_out)
    781755
    782 
     756#if defined( __netcdf )
    783757
    784758    USE surface_mod,                                                           &
     
    799773 
    800774    INTEGER(iwp)                                                      :: ispec     !> Index to go through the emission chemical species
    801 #if defined( __netcdf )
     775
    802776
    803777!-- Actions for initial runs : TBD: needs to be updated
     
    854828     SELECT CASE(TRIM(mode_emis))   !TBD: Add the option for CApital or small letters
    855829
     830
     831        !> PRE-PROCESSED case
     832        CASE ("PRE-PROCESSED")
     833
     834           IF ( .NOT. ALLOCATED( emis_distribution) ) ALLOCATE(emis_distribution(nzb:nzt+1,0:ny,0:nx,nspec_out)) 
     835
     836           CALL location_message( 'emis_distribution array allocated in PRE-PROCESSED mode', .FALSE. )
     837 
     838           !> Calculate the values of the emissions at the first time step
     839           CALL chem_emissions_setup(emt_att,emt,nspec_out)
     840
    856841        !> Default case
    857842        CASE ("DEFAULT")
     
    864849           CALL chem_emissions_setup(emt_att,emt,nspec_out)
    865850
    866 
    867         !> PRE-PROCESSED case
    868         CASE ("PRE-PROCESSED")
    869 
    870            IF ( .NOT. ALLOCATED( emis_distribution) ) ALLOCATE(emis_distribution(nzb:nzt+1,0:ny,0:nx,nspec_out)) 
    871 
    872            CALL location_message( 'emis_distribution array allocated in PRE-PROCESSED mode', .FALSE. )
    873  
    874            !> Calculate the values of the emissions at the first time step
    875            CALL chem_emissions_setup(emt_att,emt,nspec_out)
    876 
     851        !> PARAMETERIZED case
    877852        CASE ("PARAMETERIZED")
    878853
    879854           CALL location_message( 'emis_distribution array allocated in PARAMETERIZED mode', .FALSE. )
    880855
    881            ! For now for PAR and DEF values only, first vertical level of emis_distribution is allocated, while for EXP all.
     856           ! For now for PAR and DEF values only, first vertical level of emis_distribution is allocated, while for PRE-PROCESSED all.
    882857           IF ( .NOT. ALLOCATED( emis_distribution) ) ALLOCATE(emis_distribution(1,0:ny,0:nx,nspec_out))
    883858
     
    919894 IMPLICIT NONE
    920895
    921 
     896#if defined( __netcdf )
    922897 
    923898    !--- IN/OUT
     
    949924    REAL(wp),ALLOCATABLE, DIMENSION(:,:)                              ::  emis
    950925
     926    REAL(wp), DIMENSION(24)                                           :: par_emis_time_factor      !< time factors
     927                                                                                      !  for the parameterized mode: these are fixed for each hour
     928                                                                                      !  of a single day.
    951929    REAL(wp), DIMENSION(nzb:nzt+1,nys:nyn,nxl:nxr)                    ::  conv_to_ratio !> factor used for converting input
    952930                                                                                        !  to adimensional concentration ratio
     
    964942    ! --- const -------------------------------
    965943    !-CONVERSION FACTORS: TIME
     944    ! number of sec per hour = 3600   
     945    REAL, PARAMETER   ::  s_per_hour = 3600.0  !  (s)/(hour)
     946    ! number of sec per day = 86400   
     947    REAL, PARAMETER   ::  s_per_day = 86400.0  !  (s)/(day)
    966948    ! number of hours in a year of 365 days:
    967     REAL, PARAMETER  ::  hour_per_year = 8760.0 !> TBD: What about leap years?
     949    REAL, PARAMETER   ::  hour_per_year = 8760.0 !> TBD: What about leap years?
     950    ! number of hours in a day:
     951    REAL, PARAMETER   ::  hour_per_day = 24.0
     952
    968953    ! conversion from hours to seconds (s/hour) = 1/3600.0 ~ 0.2777778   
    969     REAL, PARAMETER   ::  hour_to_s = 0.0002777778  !  (hour)/(s)
     954    REAL, PARAMETER   ::  hour_to_s = 1/s_per_hour  !  (hour)/(s)
    970955    ! conversion from day to seconds (s/day) = 1/86400.0 ~ 1.157407e-05   
    971     REAL, PARAMETER   ::  day_to_s = 1.157407e-05   !  (day)/(s)
     956    REAL, PARAMETER   ::  day_to_s = 1/s_per_day   !  (day)/(s)
    972957    ! conversion from year to sec (s/year) = 1/31536000.0 ~ 3.170979e-08   
    973     REAL, PARAMETER   ::  year_to_s = 3.170979e-08  !  (year)/(s)
     958    REAL, PARAMETER   ::  year_to_s = 1/(s_per_hour*hour_per_year)  !  (year)/(s)
    974959
    975960    !-CONVERSION FACTORS: WEIGHT
     
    984969    REAL(wp), PARAMETER   ::  ratio2ppm  = 1.0e06_wp 
    985970    !------------------------------------------------------   
    986 #if defined( __netcdf )
     971
    987972    IF ( emission_output_required ) THEN
    988973
    989     !>  Set emis_dt  !TBD: this is the same as dt_chem. We should consider the fact that dt_emis should be the timestep of input emissions or better defined, the timestep at which the emission routines are calle: for now one hour. It should be made changeable.
     974    !>  Set emis_dt  !TBD: this is the same as dt_chem. We should consider the fact that dt_emis should be the timestep of input emissions or better defined, the timestep at which the emission routines are called: for now one hour. It should be made changeable.
    990975
    991976       IF ( call_chem_at_all_substeps )  THEN
     
    10931078 
    10941079          message_string = 'No Units conversion required for units of chemistry emissions' // &
    1095                            ' of the PARAMETERIZED mode: units have to be provided in mole/m**2/s '
     1080                           ' of the PARAMETERIZED mode: units have to be provided in'     //  &
     1081                           ' micromole/m**2/day for GASES and'                            //  &
     1082                           ' kg/m**2/day for PMs'                     
    10961083          CALL message( 'chem_emissions_setup', 'CM0447', 0, 0, 0, 6, 0 )
    10971084
     
    11101097             !  V/N=RT/P
    11111098
    1112              !>    m**3/Nmole             (J/mol)*K^-1           K                      Pa         
     1099             !>    m**3/Nmole              (J/mol)*K^-1           K                      Pa         
    11131100             conv_to_ratio(nzb:nzt+1,j,i) = ( (Rgas * tmp_temp(nzb:nzt+1,j,i)) / ((hyp(nzb:nzt+1))) ) 
    11141101          ENDDO
     
    11251112    !> PRE-PROCESSED MODE
    11261113       IF (TRIM(mode_emis)=="PRE-PROCESSED") THEN
     1114
     1115          !> Update time indices
     1116          CALL time_preprocessed_indices(index_hh)
    11271117
    11281118          CALL location_message( 'PRE-PROCESSED MODE: No time-factor specification required', .FALSE. )
     
    11941184                                 ' 24 values for every day of the year ', .FALSE. )
    11951185       
     1186          !Assign Constant Values of time factors, diurnal time profile for traffic sector:
     1187          par_emis_time_factor( : ) = (/ 0.009, 0.004, 0.004, 0.009, 0.029, 0.039, 0.056, 0.053, 0.051, 0.051, 0.052, 0.055, &
     1188                                                 0.059, 0.061, 0.064, 0.067, 0.069, 0.069, 0.049, 0.039, 0.039, 0.029, 0.024, 0.019 /)
     1189         
    11961190          !> in this case allocate time factor each hour in a day
    11971191          IF (.NOT. ALLOCATED(time_factor)) ALLOCATE(time_factor(1))
     
    12001194          index_hh=hour_of_day
    12011195
    1202           time_factor(1)=emt_att%par_emis_time_factor(index_hh)
     1196          time_factor(1) = par_emis_time_factor(index_hh)
    12031197
    12041198       ENDIF
     
    12121206          DO ispec=1,nspec_out
    12131207
    1214              !> Values are still micromoles/(m**2*s). Units are not given by the user for this mode and are always micromoles (or micrograms for PMs)
    1215              emis_distribution(1,nys:nyn,nxl:nxr,ispec)=surface_csflux(match_spec_input(ispec))*time_factor(1)
     1208             !> Values are still micromoles/(m**2*s). Units in this case are always micromoles/m**2*day (or kilograms/m**2*day for PMs)
     1209             emis_distribution(1,nys:nyn,nxl:nxr,ispec)=surface_csflux(match_spec_input(ispec))*time_factor(1)*hour_to_s
    12161210
    12171211          ENDDO
     
    12231217          DO ispec=1,nspec_out !> nspec_out represents the number of species in common between
    12241218                               !  the emission input data and the chemistry mechanism used
    1225 
    1226              emis_distribution(nzb:nzt+1,nys:nyn,nxl:nxr,ispec) = emt(match_spec_input(ispec))%                                  &
    1227                                                                       preproc_emission_data(index_hh,nzb:nzt+1,nys:nyn,nxl:nxr)* &
    1228                                                                    con_factor         
    1229 
     1219   
     1220             emis_distribution(1,nys:nyn,nxl:nxr,ispec) = emt(match_spec_input(ispec))%                               &
     1221                                                                   preproc_emission_data(index_hh,1,nys+1:nyn+1,nxl+1:nxr+1)* &
     1222                                                                      con_factor
     1223         
    12301224          ENDDO
    12311225
     
    12491243!TBD: The consideration of dt_emis of the input data is still missing. Basically the emissions could be provided every 10, 30 minutes and not always at one hour. This should be eventually solved in the date_and_time mode routine.
    12501244
     1245             !> the time factors are 24 for each day. When multiplied by a daily value, they allow to have an hourly value. Then to convert it to seconds, we still have to divide this value by 3600.
     1246             !  So given any units, we convert them to seconds and finally multiply them by 24 ((value/sec)*(24*3600)=value/day ---- (value/day)*time_factor=value/hour ---(value/hour)/(3600)=value/sec )
     1247             !                                                                                 ((value/sec)*(24*3600)*time_factor)/3600=24*(value/sec)*time_factor                         
     1248
    12511249             !> NOX Compositions
    12521250                IF (TRIM(spc_names(match_spec_model(ispec)))=="NO") THEN
    1253                 !>             Kg/m2                       kg/m2*s                                                   
    1254                    delta_emis(nys:nyn,nxl:nxr) =                                                             &
    1255                          emis(nys:nyn,nxl:nxr)*time_factor(icat)*emt_att%nox_comp(icat,1)*con_factor
     1251                !>             Kg/m2*s                   kg/m2*s                                                   
     1252                   delta_emis(nys:nyn,nxl:nxr) = emis(nys:nyn,nxl:nxr)*time_factor(icat)*emt_att%nox_comp(icat,1)*con_factor*hour_per_day
    12561253                   
    1257                    emis_distribution(1,nys:nyn,nxl:nxr,ispec) =                                              &
    1258                          emis_distribution(1,nys:nyn,nxl:nxr,ispec)+delta_emis(nys:nyn,nxl:nxr)
     1254                   emis_distribution(1,nys:nyn,nxl:nxr,ispec)=emis_distribution(1,nys:nyn,nxl:nxr,ispec)+delta_emis(nys:nyn,nxl:nxr)
    12591255
    12601256                ELSE IF (TRIM(spc_names(match_spec_model(ispec)))=="NO2") THEN
    12611257   
    1262                    delta_emis(nys:nyn,nxl:nxr) =                                                             &
    1263                          emis(nys:nyn,nxl:nxr)*time_factor(icat)*emt_att%nox_comp(icat,2)*con_factor
    1264 
    1265                    emis_distribution(1,nys:nyn,nxl:nxr,ispec) =                                              &
    1266                          emis_distribution(1,nys:nyn,nxl:nxr,ispec)+delta_emis(nys:nyn,nxl:nxr)
     1258                   delta_emis(nys:nyn,nxl:nxr) = emis(nys:nyn,nxl:nxr)*time_factor(icat)*emt_att%nox_comp(icat,2)*con_factor*hour_per_day
     1259
     1260                   emis_distribution(1,nys:nyn,nxl:nxr,ispec)=emis_distribution(1,nys:nyn,nxl:nxr,ispec)+delta_emis(nys:nyn,nxl:nxr)
    12671261 
    12681262             !> SOX Compositions
    12691263                     
    12701264                ELSE IF (TRIM(spc_names(match_spec_model(ispec)))=="SO2") THEN
    1271                      
    1272                    delta_emis(nys:nyn,nxl:nxr) =                                                             &
    1273                          emis(nys:nyn,nxl:nxr)*time_factor(icat)*emt_att%sox_comp(icat,1)*con_factor
    1274 
    1275                    emis_distribution(1,nys:nyn,nxl:nxr,ispec) =                                              &
    1276                          emis_distribution(1,nys:nyn,nxl:nxr,ispec)+delta_emis(nys:nyn,nxl:nxr)
     1265                   !>             Kg/m2*s                   kg/m2*s                                                                       
     1266                   delta_emis(nys:nyn,nxl:nxr) = emis(nys:nyn,nxl:nxr)*time_factor(icat)*emt_att%sox_comp(icat,1)*con_factor*hour_per_day
     1267
     1268                   emis_distribution(1,nys:nyn,nxl:nxr,ispec)=emis_distribution(1,nys:nyn,nxl:nxr,ispec)+delta_emis(nys:nyn,nxl:nxr)
    12771269
    12781270                ELSE IF (TRIM(spc_names(match_spec_model(ispec)))=="SO4") THEN
    1279    
    1280                    delta_emis(nys:nyn,nxl:nxr) =                                                             &
    1281                          emis(nys:nyn,nxl:nxr)*time_factor(icat)*emt_att%sox_comp(icat,2)*con_factor
    1282 
    1283                    emis_distribution(1,nys:nyn,nxl:nxr,ispec) =                                              &
    1284                          emis_distribution(1,nys:nyn,nxl:nxr,ispec)+delta_emis(nys:nyn,nxl:nxr)
     1271                   !>             Kg/m2*s                   kg/m2*s                                                                         
     1272                   delta_emis(nys:nyn,nxl:nxr) = emis(nys:nyn,nxl:nxr)*time_factor(icat)*emt_att%sox_comp(icat,2)*con_factor*hour_per_day
     1273
     1274                   emis_distribution(1,nys:nyn,nxl:nxr,ispec)=emis_distribution(1,nys:nyn,nxl:nxr,ispec)+delta_emis(nys:nyn,nxl:nxr)
    12851275 
    12861276
     
    12921282                   DO i_pm_comp= 1,SIZE(emt_att%pm_comp(1,:,1))
    12931283
    1294                       delta_emis(nys:nyn,nxl:nxr) =                                                          &
    1295                             emis(nys:nyn,nxl:nxr)*time_factor(icat)*emt_att%pm_comp(icat,i_pm_comp,1)*con_factor
     1284                      delta_emis(nys:nyn,nxl:nxr) = emis(nys:nyn,nxl:nxr)*time_factor(icat)*emt_att%pm_comp(icat,i_pm_comp,1)*con_factor*hour_per_day
    12961285                                                                                         
    12971286
    1298                       emis_distribution(1,nys:nyn,nxl:nxr,ispec) =                                           &
    1299                             emis_distribution(1,nys:nyn,nxl:nxr,ispec)+delta_emis(nys:nyn,nxl:nxr)
     1287                      emis_distribution(1,nys:nyn,nxl:nxr,ispec)=emis_distribution(1,nys:nyn,nxl:nxr,ispec)+delta_emis(nys:nyn,nxl:nxr)
    13001288 
    13011289                   ENDDO
     
    13071295                   DO i_pm_comp= 1,SIZE(emt_att%pm_comp(1,:,2))
    13081296
    1309                       delta_emis(nys:nyn,nxl:nxr) =                                                          &
    1310                             emis(nys:nyn,nxl:nxr)*time_factor(icat)*emt_att%pm_comp(icat,i_pm_comp,2)*con_factor
     1297                      delta_emis(nys:nyn,nxl:nxr) = emis(nys:nyn,nxl:nxr)*time_factor(icat)*emt_att%pm_comp(icat,i_pm_comp,2)*con_factor*hour_per_day
    13111298                                                                                         
    13121299
    1313                       emis_distribution(1,nys:nyn,nxl:nxr,ispec) =                                           &
    1314                             emis_distribution(1,nys:nyn,nxl:nxr,ispec)+delta_emis(nys:nyn,nxl:nxr)
     1300                      emis_distribution(1,nys:nyn,nxl:nxr,ispec)=emis_distribution(1,nys:nyn,nxl:nxr,ispec)+delta_emis(nys:nyn,nxl:nxr)
    13151301 
    13161302                   ENDDO
     
    13221308                   DO i_pm_comp= 1,SIZE(emt_att%pm_comp(1,:,3)) 
    13231309                       
    1324                       delta_emis(nys:nyn,nxl:nxr) =                                                          &
    1325                             emis(nys:nyn,nxl:nxr)*time_factor(icat)*emt_att%pm_comp(icat,i_pm_comp,3)*con_factor
     1310                      delta_emis(nys:nyn,nxl:nxr) = emis(nys:nyn,nxl:nxr)*time_factor(icat)*emt_att%pm_comp(icat,i_pm_comp,3)*con_factor*hour_per_day
    13261311                                                                                                 
    13271312
    1328                       emis_distribution(1,nys:nyn,nxl:nxr,ispec) =                                           &
    1329                             emis_distribution(1,nys:nyn,nxl:nxr,ispec)+delta_emis(nys:nyn,nxl:nxr)
     1313                      emis_distribution(1,nys:nyn,nxl:nxr,ispec)=emis_distribution(1,nys:nyn,nxl:nxr,ispec)+delta_emis(nys:nyn,nxl:nxr)
    13301314
    13311315                   ENDDO
     
    13391323                      IF (TRIM(spc_names(match_spec_model(ispec)))==TRIM(emt_att%voc_name(ivoc))) THEN   
    13401324
    1341                          delta_emis(nys:nyn,nxl:nxr) = emis(nys:nyn,nxl:nxr)*time_factor(icat)*               &
    1342                                                        emt_att%voc_comp(icat,match_spec_voc_input(ivoc))*con_factor
    1343 
    1344                          emis_distribution(1,nys:nyn,nxl:nxr,ispec) =                                         &
    1345                                emis_distribution(1,nys:nyn,nxl:nxr,ispec)+delta_emis(nys:nyn,nxl:nxr)
     1325                         delta_emis(nys:nyn,nxl:nxr) = emis(nys:nyn,nxl:nxr)*time_factor(icat)*                                    &
     1326                                                       emt_att%voc_comp(icat,match_spec_voc_input(ivoc))*con_factor*hour_per_day
     1327
     1328                         emis_distribution(1,nys:nyn,nxl:nxr,ispec)=emis_distribution(1,nys:nyn,nxl:nxr,ispec)+delta_emis(nys:nyn,nxl:nxr)
    13461329
    13471330                      ENDIF                       
     
    13521335                ELSE
    13531336
    1354                    delta_emis(nys:nyn,nxl:nxr) = emis(nys:nyn,nxl:nxr)*time_factor(icat)*con_factor
    1355  
    1356                    emis_distribution(1,nys:nyn,nxl:nxr,ispec) =                                               &
    1357                          emis_distribution(1,nys:nyn,nxl:nxr,ispec)+delta_emis(nys:nyn,nxl:nxr)
     1337                   delta_emis(nys:nyn,nxl:nxr) = emis(nys:nyn,nxl:nxr)*time_factor(icat)*con_factor*hour_per_day
     1338 
     1339                   emis_distribution(1,nys:nyn,nxl:nxr,ispec)=emis_distribution(1,nys:nyn,nxl:nxr,ispec)+delta_emis(nys:nyn,nxl:nxr)
    13581340
    13591341                ENDIF  ! IF (spc_names==)
     
    13961378                      DO  ispec=1,nspec_out
    13971379
    1398                          !> PMs are already in mass units:micrograms:they have to be converted to kilograms
    1399                          IF (TRIM(spc_names(match_spec_model(ispec)))=="PM1"         &
    1400                              .OR.  TRIM(spc_names(match_spec_model(ispec)))=="PM25"  &
     1380                         !> PMs are already in mass units: kilograms
     1381                         IF (TRIM(spc_names(match_spec_model(ispec)))=="PM1" .OR. TRIM(spc_names(match_spec_model(ispec)))=="PM25"  &
    14011382                             .OR. TRIM(spc_names(match_spec_model(ispec)))=="PM10") THEN
    14021383
     
    14121393                         !> Other Species: inputs are micromoles: they have to be converted in moles
    14131394                         !                 ppm/s *m *kg/m^3               
    1414                             surf_lsm_h%cssws(match_spec_model(ispec),m) = emiss_factor_main(match_spec_input(ispec))*  &
     1395                            surf_lsm_h%cssws(match_spec_model(ispec),m) = emiss_factor_main(match_spec_input(ispec))*   &
    14151396                         !                                                    micromoles/(m^2*s)
    1416                                                                           emis_distribution(1,j,i,ispec) *             &
    1417                          !                                                    m**3/Nmole
    1418                                                                           conv_to_ratio(k,j,i)*                        &
     1397                                                                          emis_distribution(1,j,i,ispec) *              &
     1398                         !                                                    m^3/Nmole
     1399                                                                          conv_to_ratio(k,j,i)*                         &       
    14191400                         !                                                    kg/m^3
    14201401                                                                          rho_air(k)   
     
    14261407
    14271408
    1428                    ELSEIF ( street_type_f%var(j,i) >= side_street_id  .AND.                                            &
    1429                             street_type_f%var(j,i) < main_street_id )  THEN
     1409                   ELSEIF ( street_type_f%var(j,i) >= side_street_id  .AND. street_type_f%var(j,i) < main_street_id )  THEN
    14301410
    14311411                   !> Cycle over already matched species
     
    14331413
    14341414                         !> PMs are already in mass units: micrograms
    1435                          IF (     TRIM(spc_names(match_spec_model(ispec)))=="PM1"   &
    1436                              .OR. TRIM(spc_names(match_spec_model(ispec)))=="PM25"  &
     1415                         IF (TRIM(spc_names(match_spec_model(ispec)))=="PM1" .OR. TRIM(spc_names(match_spec_model(ispec)))=="PM25"  &
    14371416                             .OR. TRIM(spc_names(match_spec_model(ispec)))=="PM10") THEN
    14381417
    14391418                            !              kg/(m^2*s) *kg/m^3                               
    1440                             surf_lsm_h%cssws(match_spec_model(ispec),m)= emiss_factor_side(match_spec_input(ispec)) *  &
     1419                            surf_lsm_h%cssws(match_spec_model(ispec),m)= emiss_factor_side(match_spec_input(ispec)) *   &
    14411420                            !                                                       kg/(m^2*s)
    14421421                                                                                emis_distribution(1,j,i,ispec)*        &
     
    14481427                         !>Other Species: inputs are micromoles
    14491428                         !                 ppm/s *m *kg/m^3               
    1450                             surf_lsm_h%cssws(match_spec_model(ispec),m) = emiss_factor_side(match_spec_input(ispec)) * &
     1429                            surf_lsm_h%cssws(match_spec_model(ispec),m) = emiss_factor_side(match_spec_input(ispec)) *   &
    14511430                         !                                                    micromoles/(m^2*s)
    1452                                                                           emis_distribution(1,j,i,ispec) *             &
    1453                          !                                                    m**3/Nmole
    1454                                                                           conv_to_ratio(k,j,i)*                        &
     1431                                                                          emis_distribution(1,j,i,ispec) *              &
     1432                         !                                                    m^3/Nmole
     1433                                                                          conv_to_ratio(k,j,i)*                         &       
    14551434                         !                                                    kg/m^3
    14561435                                                                          rho_air(k)   
     
    14861465                   j = surf_def_h(0)%j(m)
    14871466
    1488                    !> Distinguish between PMs (no needing conversion in ppms),
    1489                    !  VOC (already converted to moles/(m**2*s) using conv_factors: they do not need molar masses for their conversion to PPMs ) and
    1490                    ! other Species (still expressed in Kg/(m**2*s) at this point)
    1491 
    1492                    !> PMs
    1493                    IF (TRIM(spc_names(match_spec_model(ispec)))=="PM1"                                   &
    1494                          .OR. TRIM(spc_names(match_spec_model(ispec)))=="PM25"                           &
    1495                          .OR. TRIM(spc_names(match_spec_model(ispec)))=="PM10") THEN
     1467                   IF ( emis_distribution(1,j,i,ispec) > 0.0_wp )  THEN
     1468
     1469
     1470                      !> Distinguish between PMs (no needing conversion in ppms),
     1471                      !  VOC (already converted to moles/(m**2*s) using conv_factors: they do not need molar masses for their conversion to PPMs ) and
     1472                      ! other Species (still expressed in Kg/(m**2*s) at this point)
     1473
     1474                      !> PMs
     1475                      IF (TRIM(spc_names(match_spec_model(ispec)))=="PM1" .OR. TRIM(spc_names(match_spec_model(ispec)))=="PM25"  &
     1476                             .OR. TRIM(spc_names(match_spec_model(ispec)))=="PM10") THEN
    14961477                   
    1497                       !            kg/(m^2*s) *kg/m^3                         kg/(m^2*s)                 
    1498                       surf_def_h(0)%cssws(match_spec_model(ispec),m) = emis_distribution(1,j,i,ispec)*   &
    1499                       !                                                  kg/m^3
    1500                                                                        rho_air(k)   
    1501  
    1502  
    1503                    ELSE
    1504 
    1505                       !> VOCs
    1506                       IF ( len_index_voc .GT. 0 .AND. emt_att%species_name(match_spec_input(ispec))=="VOC" ) THEN
    1507                          !          ( ppm/s) * m * kg/m^3                         mole/(m**2/s)   
    1508                          surf_def_h(0)%cssws(match_spec_model(ispec),m) = emis_distribution(1,j,i,ispec) *      &
    1509                                                                          !    m**3/mole          ppm
    1510                                                                           conv_to_ratio(k,j,i)*ratio2ppm *      &
    1511                       !                                                    kg/m^3
    1512                                                                           rho_air(k)   
    1513 
    1514 
    1515                       !> OTHER SPECIES
     1478                         !            kg/(m^2*s) *kg/m^3                         kg/(m^2*s)                 
     1479                         surf_def_h(0)%cssws(match_spec_model(ispec),m) = emis_distribution(1,j,i,ispec)*   &
     1480                         !                                                  kg/m^3
     1481                                                                          rho_air(nzb)   
     1482 
     1483 
    15161484                      ELSE
    15171485
    1518                          !               ( ppm/s )*m  * kg/m^3                      kg/(m**2/s)                     
    1519                          surf_def_h(0)%cssws(match_spec_model(ispec),m) = emis_distribution(1,j,i,ispec) *      &
    1520                                                                             !  mole/Kg       
    1521                                                                           (1/emt_att%xm(ispec))*                &
    1522                          !                                                    m**3/mole          ppm
    1523                                                                           conv_to_ratio(k,j,i)*ratio2ppm*       &
    1524                          !                                                  kg/m^3
    1525                                                                           rho_air(k)   
    1526  
     1486                         !> VOCs
     1487                         IF ( len_index_voc .GT. 0 .AND. emt_att%species_name(match_spec_input(ispec))=="VOC" ) THEN
     1488                            !          ( ppm/s) * m * kg/m^3                         mole/(m^2/s)   
     1489                            surf_def_h(0)%cssws(match_spec_model(ispec),m) = emis_distribution(1,j,i,ispec) *      &
     1490                                                                            !    m^3/mole          ppm
     1491                                                                             conv_to_ratio(nzb,j,i)*ratio2ppm *      &
     1492                         !                                                    kg/m^3
     1493                                                                             rho_air(nzb)   
     1494
     1495
     1496                         !> OTHER SPECIES
     1497                         ELSE
     1498
     1499                            !               ( ppm/s )*m  * kg/m^3                      kg/(m^2/s)                     
     1500                            surf_def_h(0)%cssws(match_spec_model(ispec),m) = emis_distribution(1,j,i,ispec) *      &
     1501                                                                               !  mole/Kg       
     1502                                                                             (1/emt_att%xm(ispec))*                &
     1503                            !                                                    m^3/mole          ppm
     1504                                                                             conv_to_ratio(nzb,j,i)*ratio2ppm*       &
     1505                            !                                                  kg/m^3
     1506                                                                             rho_air(nzb)   
     1507 
     1508
     1509                         ENDIF
    15271510
    15281511                      ENDIF
     
    15431526                   k = surf_lsm_h%k(m)
    15441527
    1545                    !> Distinguish between PMs (no needing conversion in ppms),
    1546                    !  VOC (already converted to moles/(m**2*s) using conv_factors: they do not need molar masses for their conversion to PPMs ) and
    1547                    ! other Species (still expressed in Kg/(m**2*s) at this point)
    1548 
    1549                    !> PMs
    1550                    IF (TRIM(spc_names(match_spec_model(ispec)))=="PM1"                                            &
    1551                          .OR. TRIM(spc_names(match_spec_model(ispec)))=="PM25"                                    &
    1552                          .OR. TRIM(spc_names(match_spec_model(ispec)))=="PM10") THEN
    1553 
    1554                       !         kg/(m^2*s) * kg/m^3                           kg/(m^2*s)           
    1555                       surf_lsm_h%cssws(match_spec_model(ispec),m) = emis_distribution(1,j,i,ispec) *              &
    1556                       !                                                  kg/m^3
    1557                                                                        rho_air(k)   
    1558  
    1559                    ELSE
    1560 
    1561                       !> VOCs
    1562                       IF ( len_index_voc .GT. 0 .AND. emt_att%species_name(match_spec_input(ispec))=="VOC" ) THEN
    1563                          !          ( ppm/s) * m * kg/m^3                        mole/(m**2/s)   
    1564                          surf_lsm_h%cssws(match_spec_model(ispec),m) = emis_distribution(1,j,i,ispec) *      &
    1565                                                                        !    m**3/mole          ppm
    1566                                                                        conv_to_ratio(k,j,i)*ratio2ppm*    &
    1567                       !                                                 kg/m^3
    1568                                                                        rho_air(k)   
    1569 
    1570 
    1571                       !> OTHER SPECIES
     1528                   IF ( emis_distribution(1,j,i,ispec) > 0.0_wp )  THEN
     1529
     1530                      !> Distinguish between PMs (no needing conversion in ppms),
     1531                      !  VOC (already converted to moles/(m**2*s) using conv_factors: they do not need molar masses for their conversion to PPMs ) and
     1532                      ! other Species (still expressed in Kg/(m**2*s) at this point)
     1533
     1534                      !> PMs
     1535                      IF (TRIM(spc_names(match_spec_model(ispec)))=="PM1" .OR. TRIM(spc_names(match_spec_model(ispec)))=="PM25"  &
     1536                             .OR. TRIM(spc_names(match_spec_model(ispec)))=="PM10") THEN
     1537   
     1538                         !         kg/(m^2*s) * kg/m^3                           kg/(m^2*s)           
     1539                         surf_lsm_h%cssws(match_spec_model(ispec),m) = emis_distribution(1,j,i,ispec) *              &
     1540                         !                                                  kg/m^3
     1541                                                                          rho_air(k)   
     1542 
    15721543                      ELSE
    15731544
    1574                          !         ( ppm/s) * m * kg/m^3                        kg/(m**2/s)                     
    1575                          surf_lsm_h%cssws(match_spec_model(ispec),m) = emis_distribution(1,j,i,ispec) *               &
    1576                                                                             !  mole/Kg   
    1577                                                                       (1/emt_att%xm(ispec))*                          &
    1578                          !                                                m**3/mole           ppm
    1579                                                                       conv_to_ratio(k,j,i)*ratio2ppm*                 &
    1580                          !                                            kg/m^3
    1581                                                                       rho_air(k)   
     1545                         !> VOCs
     1546                         IF ( len_index_voc .GT. 0 .AND. emt_att%species_name(match_spec_input(ispec))=="VOC" ) THEN
     1547                            !          ( ppm/s) * m * kg/m^3                        mole/(m^2/s)   
     1548                            surf_lsm_h%cssws(match_spec_model(ispec),m) = emis_distribution(1,j,i,ispec) *      &
     1549                                                                          !    m^3/mole          ppm
     1550                                                                          conv_to_ratio(k,j,i)*ratio2ppm*    &
     1551                         !                                                 kg/m^3
     1552                                                                          rho_air(k)   
     1553
     1554                         !> OTHER SPECIES
     1555                         ELSE
     1556   
     1557                            !         ( ppm/s) * m * kg/m^3                        kg/(m^2/s)                     
     1558                            surf_lsm_h%cssws(match_spec_model(ispec),m) = emis_distribution(1,j,i,ispec) *               &
     1559                                                                               !  mole/Kg   
     1560                                                                         (1/emt_att%xm(ispec))*                          &
     1561                            !                                                m^3/mole           ppm
     1562                                                                         conv_to_ratio(k,j,i)*ratio2ppm*                 &
     1563                            !                                            kg/m^3
     1564                                                                         rho_air(k)   
    15821565                                                     
     1566                         ENDIF
     1567
    15831568                      ENDIF
    15841569
    15851570                   ENDIF
     1571
    15861572                ENDDO
    15871573
     
    15981584                   k = surf_usm_h%k(m)
    15991585
    1600 
    1601                    !> PMs
    1602                    IF (TRIM(spc_names(match_spec_model(ispec)))=="PM1"                                     &
    1603                          .OR. TRIM(spc_names(match_spec_model(ispec)))=="PM25"                             &
    1604                          .OR. TRIM(spc_names(match_spec_model(ispec)))=="PM10") THEN
    1605                    
    1606                       !          kg/(m^2*s) *kg/m^3                             kg/(m^2*s)                     
    1607                       surf_usm_h%cssws(match_spec_model(ispec),m) = emis_distribution(1,j,i,ispec)*        &
    1608                       !                                              kg/m^3
    1609                                                                     rho_air(k)   
    1610 
    1611  
    1612                    ELSE
    1613 
    1614                       !> VOCs
    1615                       IF ( len_index_voc .GT. 0 .AND. emt_att%species_name(match_spec_input(ispec))=="VOC" ) THEN
    1616                          !          ( ppm/s) * m * kg/m^3                        mole/(m**2/s)   
    1617                          surf_usm_h%cssws(match_spec_model(ispec),m) = emis_distribution(1,j,i,ispec) *   &
    1618                                                                        !    m**3/mole          ppm
    1619                                                                        conv_to_ratio(k,j,i)*ratio2ppm*    &
    1620                       !                                                kg/m^3
     1586                   IF ( emis_distribution(1,j,i,ispec) > 0.0_wp )  THEN
     1587
     1588                      !> PMs
     1589                      IF (TRIM(spc_names(match_spec_model(ispec)))=="PM1" .OR. TRIM(spc_names(match_spec_model(ispec)))=="PM25"  &
     1590                             .OR. TRIM(spc_names(match_spec_model(ispec)))=="PM10") THEN
     1591                     
     1592                         !          kg/(m^2*s) *kg/m^3                             kg/(m^2*s)                     
     1593                         surf_usm_h%cssws(match_spec_model(ispec),m) = emis_distribution(1,j,i,ispec)*        &
     1594                         !                                              kg/m^3
    16211595                                                                       rho_air(k)   
    16221596
    1623                       !> OTHER SPECIES
     1597 
    16241598                      ELSE
    16251599
    1626 
    1627                       !            ( ppm/s) * m * kg/m^3                        kg/(m**2/s)                     
    1628                          surf_usm_h%cssws(match_spec_model(ispec),m) = emis_distribution(1,j,i,ispec) *      &
    1629                                                                           !  mole/Kg   
    1630                                                                       (1/emt_att%xm(ispec))*                 &
    1631                          !                                                m**3/mole           ppm
    1632                                                                       conv_to_ratio(k,j,i)*ratio2ppm*        &
    1633                          !                                            kg/m^3
    1634                                                                       rho_air(k)   
    1635 
     1600                         !> VOCs
     1601                         IF ( len_index_voc .GT. 0 .AND. emt_att%species_name(match_spec_input(ispec))=="VOC" ) THEN
     1602                            !          ( ppm/s) * m * kg/m^3                        mole/(m^2/s)   
     1603                            surf_usm_h%cssws(match_spec_model(ispec),m) = emis_distribution(1,j,i,ispec) *   &
     1604                                                                          !    m^3/mole          ppm
     1605                                                                          conv_to_ratio(k,j,i)*ratio2ppm*    &
     1606                         !                                                kg/m^3
     1607                                                                          rho_air(k)   
     1608
     1609                         !> OTHER SPECIES
     1610                         ELSE
     1611
     1612
     1613                         !            ( ppm/s) * m * kg/m^3                        kg/(m^2/s)                     
     1614                            surf_usm_h%cssws(match_spec_model(ispec),m) = emis_distribution(1,j,i,ispec) *      &
     1615                                                                             !  mole/Kg   
     1616                                                                         (1/emt_att%xm(ispec))*                 &
     1617                            !                                                m^3/mole           ppm
     1618                                                                         conv_to_ratio(k,j,i)*ratio2ppm*        &
     1619                            !                                            kg/m^3
     1620                                                                         rho_air(k)   
     1621
     1622
     1623                         ENDIF
    16361624
    16371625                      ENDIF
Note: See TracChangeset for help on using the changeset viewer.