source: palm/trunk/SOURCE/chem_modules.f90 @ 4525

Last change on this file since 4525 was 4511, checked in by raasch, 5 years ago

chemistry decycling replaced by explicit setting of lateral boundary conditions

  • Property svn:keywords set to Id
File size: 17.2 KB
Line 
1!> @file chem_modules.f90
2!------------------------------------------------------------------------------!
3! This file is part of the PALM model system.
4!
5! PALM is free software: you can redistribute it and/or modify it under the
6! terms of the GNU General Public License as published by the Free Software
7! Foundation, either version 3 of the License, or (at your option) any later
8! version.
9!
10! PALM is distributed in the hope that it will be useful, but WITHOUT ANY
11! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12! A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
13!
14! You should have received a copy of the GNU General Public License along with
15! PALM. If not, see <http://www.gnu.org/licenses/>.
16!
17! Copyright 2018-2020 Leibniz Universitaet Hannover
18! Copyright 2018-2020 Karlsruhe Institute of Technology
19! Copyright 2018-2020 Freie Universitaet Berlin
20!------------------------------------------------------------------------------!
21!
22! Current revisions:
23! -----------------
24!
25!
26! Former revisions:
27! -----------------
28! $Id: chem_modules.f90 4511 2020-04-30 12:20:40Z raasch $
29! new variables for explicit settings of lateral boundary conditions introduced
30!
31! 4481 2020-03-31 18:55:54Z maronga
32! added namelist flag 'emiss_read_legacy_mode' to allow concurrent
33! functioning of new emission read mode under development (ECC)
34!
35! 4273 2019-10-24 13:40:54Z monakurppa
36! Add logical switches nesting_chem and nesting_offline_chem (both .TRUE.
37! by default)
38!
39! 4182 2019-08-22 15:20:23Z scharf
40! Corrected "Former revisions" section
41!
42! 4110 2019-07-22 17:05:21Z suehring
43! +cs_advc_flags_s
44!
45! 4109 2019-07-22 17:00:34Z suehring
46! - introduced namelist item chem_modules@emiss_lod as future
47! - replacement to chem_modules@mode_emis.  Currently keeping both
48!   for backward compatibility.  chem_modules@mode_emis will be
49!   depreciated upon migration of all dependent modules (e.g., salsa)
50!   to chem_modules@emiss_lod
51!
52! (ecc) 20190513 replaced nspec_out with n_matched_vars
53!
54! 3877 2019-04-08 19:09:16Z knoop
55! Formatting, clean-up, clarified/corrected comments
56!
57! 3833 2019-03-28 15:04:04Z forkel
58! removed USE chem_gasphase_mod
59!
60! 3827 2019-03-27 17:20:32Z forkel
61! some formatting  and reordering (ecc)
62!
63! 3820 2019-03-27 11:53:41Z forkel
64! renamed do_emis to emissions_anthropogenic, removed USE statistics, variables sorted by type
65!
66!
67! 3780 2019-03-05 11:19:45Z forkel
68! added cs_mech
69!
70! 3652 2019-01-07 15:29:59Z forkel
71! parameter chem_mechanism added (basit)
72!
73! 3282 2018-09-27 10:49:12Z basit
74! Initial revision
75!
76! Authors:
77! --------
78! @author Farah Kanani-Suehring
79! @author Basit Khan
80! @author Sabine Banzhaf
81! @author Emmanuele Russo
82! @author Edward C. Chan
83!
84!------------------------------------------------------------------------------!
85! Description:
86! ------------
87!> Definition of global PALM-4U chemistry variables
88!------------------------------------------------------------------------------!
89!
90 MODULE chem_modules
91
92    USE kinds
93
94    IMPLICIT NONE
95
96    CHARACTER (LEN=20) ::  bc_cs_b        = 'dirichlet'         !< namelist parameter: surface boundary condition for concentration
97    CHARACTER (LEN=20) ::  bc_cs_l        = 'undefined'         !< left boundary condition
98    CHARACTER (LEN=20) ::  bc_cs_n        = 'undefined'         !< north boundary condition
99    CHARACTER (LEN=20) ::  bc_cs_r        = 'undefined'         !< right boundary condition
100    CHARACTER (LEN=20) ::  bc_cs_s        = 'undefined'         !< south boundary condition
101    CHARACTER (LEN=20) ::  bc_cs_t        = 'initial_gradient'  !< namelist parameter: top boudary condition for concentration
102    CHARACTER (LEN=30) ::  chem_mechanism = 'phstatp'           !< namelist parameter: chemistry mechanism
103    CHARACTER (LEN=80) ::  daytype_mdh    = 'workday'           !< namelist parameter: type of day - workday, weekend, holiday
104    CHARACTER (LEN=80) ::  mode_emis      = 'PARAMETERIZED'     !< namelist parameter: mode of chemistry emissions - DEFAULT, EXPERT, PARAMETERIZED
105    CHARACTER (LEN=80) ::  time_fac_type  = 'MDH'               !< namelist parameter: type of time treatment in the mode_emis DEFAULT - HOUR, MDH
106    CHARACTER (LEN=10) ::  photolysis_scheme                    !< 'constant',
107                                                                !< 'simple' (Simple parameterisation from MCM, Saunders et al., 2003, Atmos. Chem. Phys., 3, 161-180
108                                                                !< 'fastj'  (Wild et al., 2000, J. Atmos. Chem., 37, 245-282) STILL NOT IMPLEMENTED
109
110    CHARACTER (LEN=11), DIMENSION(99) ::  cs_name             = 'novalue'  !< namelist parameter: names of species with given fluxes (see csflux)
111    CHARACTER (LEN=11), DIMENSION(99) ::  cs_profile_name     = 'novalue'  !< namelist parameter: tbc...???
112    CHARACTER (LEN=11), DIMENSION(99) ::  data_output_pr_cs   = 'novalue'  !< namelist parameter: tbc...???
113    CHARACTER (LEN=11), DIMENSION(99) ::  surface_csflux_name = 'novalue'  !< namelist parameter: tbc...???
114
115    INTEGER(iwp) ::  communicator_chem      !< stores the number of the MPI communicator to be used
116                                            !< for ghost layer data exchange
117                                            !< 1: cyclic, 2: cyclic along x, 3: cyclic along y,
118                                            !< 4: non-cyclic
119
120    INTEGER(iwp) ::  cs_pr_count                           = 0      !< counter for chemical species profiles
121    INTEGER(iwp) ::  cs_vertical_gradient_level_ind(99,10) = -9999  !< grid index values of cs_vertical_gradient_level
122    INTEGER(iwp) ::  emiss_lod                             = -1     !< namelist parameter: chem emission LOD (same as mode_emis)
123                                                                    !< -1 = unassigned, 0 = parameterized, 1 = default, 2 = pre-processed
124    INTEGER(iwp) ::  ibc_cs_b                                       !< integer flag for bc_cs_b
125    INTEGER(iwp) ::  ibc_cs_t                                       !< integer flag for bc_cs_t
126    INTEGER(iwp) ::  main_street_id                        = 0      !< namelist parameter: lower bound of main street IDs (OpenStreetMaps) for PARAMETERIZED mode
127    INTEGER(iwp) ::  max_pr_cs                             = 0      !<
128    INTEGER(iwp) ::  max_street_id                         = 0      !< namelist parameter: upper bound of main street IDs (OpenStreetMaps) for PARAMETERIZED mode     
129    INTEGER(iwp) ::  n_matched_vars                                 !< number of matched emissions variables
130    INTEGER(iwp) ::  side_street_id                        = 0      !< namelist parameter: lower bound of side street IDs (OpenStreetMaps) for PARAMETERIZED mode
131
132    INTEGER(iwp), DIMENSION(99) ::  cs_pr_index  = 0      !< index for chemical species profiles
133    INTEGER(iwp), DIMENSION(:)  ::  match_spec_nox(1:2)   !< results of matching the input and model's NOx
134    INTEGER(iwp), DIMENSION(:)  ::  match_spec_pm(1:3)    !< results of matching the input and model's PMs
135    INTEGER(iwp), DIMENSION(:)  ::  match_spec_sox(1:2)   !< results of matching the input and model's SOx!
136
137    INTEGER(iwp), DIMENSION(:), ALLOCATABLE ::  match_spec_input      !< index of input chem species for matching routine
138    INTEGER(iwp), DIMENSION(:), ALLOCATABLE ::  match_spec_model      !< index of model chem species for matching routine
139    INTEGER(iwp), DIMENSION(:), ALLOCATABLE ::  match_spec_voc_input  !< index of VOC input components matching the model's VOCs
140    INTEGER(iwp), DIMENSION(:), ALLOCATABLE ::  match_spec_voc_model  !< index of VOC model species matching the input VOCs comp.
141   
142    INTEGER(iwp), DIMENSION(:,:,:), ALLOCATABLE  ::  cs_advc_flags_s !< flags used to degrade order of advection scheme for
143                                                                     !< chemical species near walls and lateral boundaries
144
145    LOGICAL ::  bc_dirichlet_cs_l         = .FALSE.  !< flag for indicating a dirichlet condition at
146                                                     !< the left boundary
147    LOGICAL ::  bc_dirichlet_cs_n         = .FALSE.  !< flag for indicating a dirichlet condition at
148                                                     !< the north boundary
149    LOGICAL ::  bc_dirichlet_cs_r         = .FALSE.  !< flag for indicating a dirichlet condition at
150                                                     !< the right boundary
151    LOGICAL ::  bc_dirichlet_cs_s         = .FALSE.  !< flag for indicating a dirichlet condition at
152                                                     !< the south boundary
153    LOGICAL ::  bc_radiation_cs_l         = .FALSE.  !< flag for indicating a radiation/neumann
154                                                     !< condition at the left boundary
155    LOGICAL ::  bc_radiation_cs_n         = .FALSE.  !< flag for indicating a radiation/neumann
156                                                     !< condition at the north boundary
157    LOGICAL ::  bc_radiation_cs_r         = .FALSE.  !< flag for indicating a radiation/neumann
158                                                     !< condition at the right boundary
159    LOGICAL ::  bc_radiation_cs_s         = .FALSE.  !< flag for indicating a radiation/neumann
160                                                     !< condition at the south boundary
161    LOGICAL ::  constant_top_csflux(99)   = .TRUE.   !< internal flag, set to .FALSE. if no top_csflux is prescribed
162    LOGICAL ::  constant_csflux(99)       = .TRUE.   !< internal flag, set to .FALSE. if no surface_csflux is prescribed
163    LOGICAL ::  call_chem_at_all_substeps = .FALSE.  !< namelist parameter: ....???
164    LOGICAL ::  chem_debug0               = .FALSE.  !< namelist parameter: flag for minimum print output
165    LOGICAL ::  chem_debug1               = .FALSE.  !< namelist parameter: flag for print output
166    LOGICAL ::  chem_debug2               = .FALSE.  !< namelist parameter: flag for further print output
167    LOGICAL ::  chem_gasphase_on          = .TRUE.   !< namelist parameter: flag to switch off chemical reactions
168    LOGICAL ::  cs_pr_namelist_found      = .FALSE.  !< ...???
169    LOGICAL ::  deposition_dry            = .FALSE.  !< namelist parameter: flag for activation of deposition calculation
170    LOGICAL ::  emissions_anthropogenic   = .FALSE.  !< namelist parameter: flag for turning on anthropogenic emissions
171    LOGICAL ::  emission_output_required  = .TRUE.   !< internal flag for requiring emission outputs
172    LOGICAL ::  emiss_read_legacy_mode    = .TRUE.   !< namelist parameter: flag to read emission data using legacy mode
173    LOGICAL ::  nesting_chem              = .TRUE.   !< apply self-nesting for the chemistry model
174    LOGICAL ::  nesting_offline_chem      = .TRUE.   !< apply offline nesting for the chemistry model
175
176    REAL(wp) ::  cs_surface_initial_change(99)     = 0.0_wp        !< namelist parameter: ...???
177    REAL(wp) ::  cs_vertical_gradient(99,10)       = 0.0_wp        !< namelist parameter: ...???
178    REAL(wp) ::  cs_vertical_gradient_level(99,10) = -999999.9_wp  !< namelist parameter: ...???
179    REAL(wp) ::  emiss_factor_main(99)             = -9999.0_wp    !< namelist parameter: ...???
180    REAL(wp) ::  emiss_factor_side(99)             = -9999.0_wp    !< namelist parameter: ...???
181    REAL(wp) ::  surface_csflux(99)                = 0.0_wp        !< namelist parameter: ...???
182    REAL(wp) ::  top_csflux(99)                    = 0.0_wp        !< namelist parameter: ...???
183    REAL(wp) ::  wall_csflux(99,0:5)               = 0.0_wp        !< namelist parameter: ...???
184
185    REAL(wp), DIMENSION(99)     ::  cs_surface = 0.0_wp        !< namelist parameter: chem species concentration at surface
186    REAL(wp), DIMENSION(99,100) ::  cs_heights = 9999999.9_wp  !< namelist parameter: height levels for initial chem species concentrations
187    REAL(wp), DIMENSION(99,100) ::  cs_profile = 9999999.9_wp  !< namelist parameter: chem species concentration values at cs_heights levels
188
189    REAL(wp), DIMENSION(:), ALLOCATABLE ::  bc_cs_t_val  !< vertical gradient of chemical species near domain top
190    REAL(wp), DIMENSION(:), ALLOCATABLE ::  css          !< scaling parameter for chem species
191
192    REAL(wp), DIMENSION(:,:,:,:), ALLOCATABLE ::  emis_distribution  !< emissions final values (main module output) ???
193                                 
194    REAL(wp), DIMENSION(:,:,:,:), ALLOCATABLE, TARGET ::  cs_1  !< pointer for swapping of timelevels for respective quantity
195    REAL(wp), DIMENSION(:,:,:,:), ALLOCATABLE, TARGET ::  cs_2  !< pointer for swapping of timelevels for respective quantity
196    REAL(wp), DIMENSION(:,:,:,:), ALLOCATABLE, TARGET ::  cs_3  !< pointer for swapping of timelevels for respective quantity
197
198    REAL(wp), DIMENSION(:,:,:), POINTER ::  cs     !< pointer: sgs chem spcs  ???
199    REAL(wp), DIMENSION(:,:,:), POINTER ::  cs_p   !< pointer: prognostic value of sgs chem spcs ???
200    REAL(wp), DIMENSION(:,:,:), POINTER ::  tcs_m  !< pointer: to tcs array (temp)
201
202    REAL, PARAMETER ::  xm_air   =   28.964e-3             !< air      molecular weight (kg/mol)
203    REAL, PARAMETER ::  xm_C     =   12.01115e-3           !< C        molecular weight (kg/mol)
204    REAL, PARAMETER ::  xm_Ca    =   40.07800e-3           !< Ca       molecular weight (kg/mol)
205    REAL, PARAMETER ::  xm_Cd    =  112.41000e-3           !< Cd       molecular weight (kg/mol)
206    REAL, PARAMETER ::  xm_Cl    =   35.45300e-3           !< Cl       molecular weight (kg/mol)
207    REAL, PARAMETER ::  xm_dummy = 1000.0e-3               !< dummy    molecular weight (kg/mol)
208    REAL, PARAMETER ::  xm_F     =   18.99840e-3           !< F        molecular weight (kg/mol)
209    REAL, PARAMETER ::  xm_H     =    1.00790e-3           !< H        molecular weight (kg/mol)
210    REAL, PARAMETER ::  xm_K     =   39.09800e-3           !< K        molecular weight (kg/mol)
211    REAL, PARAMETER ::  xm_Mg    =   24.30500e-3           !< Mg       molecular weight (kg/mol)
212    REAL, PARAMETER ::  xm_N     =   14.00670e-3           !< N        molecular weight (kg/mol)
213    REAL, PARAMETER ::  xm_Na    =   22.98977e-3           !< Na       molecular weight (kg/mol)
214    REAL, PARAMETER ::  xm_O     =   15.99940e-3           !< O        molecular weight (kg/mol)
215    REAL, PARAMETER ::  xm_Pb    =  207.20000e-3           !< Pb       molecular weight (kg/mol)
216    REAL, PARAMETER ::  xm_Pb210 =  210.00000e-3           !< Pb (210) molecular weight (kg/mol)
217    REAL, PARAMETER ::  xm_Rn222 =  222.00000e-3           !< Rn (222) molecular weight (kg/mol)
218    REAL, PARAMETER ::  xm_S     =   32.06400e-3           !< S        molecular weight (kg/mol)
219    REAL, PARAMETER ::  xm_CO2   = xm_C + xm_O * 2         !< CO2      molecular weight (kg/mol)
220    REAL, PARAMETER ::  xm_h2o   = xm_H * 2 + xm_O         !< H2O      molecular weight (kg/mol)
221    REAL, PARAMETER ::  xm_HNO3  = xm_H + xm_N + xm_O * 3  !< HNO3     molecular weight (kg/mol)
222    REAL, PARAMETER ::  xm_o3    = xm_O * 3                !< O3       molecular weight (kg/mol)
223    REAL, PARAMETER ::  xm_N2O5  = xm_N * 2 + xm_O * 5     !< N2O5     molecular weight (kg/mol)
224    REAL, PARAMETER ::  xm_NH4   = xm_N + xm_H * 4         !< NH4      molecular weight (kg/mol)
225    REAL, PARAMETER ::  xm_NO3   = xm_N + xm_O * 3         !< NO3      molecular weight (kg/mol)
226    REAL, PARAMETER ::  xm_SO4   = xm_S + xm_O * 4         !< SO4      molecular weight (kg/mol)
227!
228!-  Define chemical variables within chem_species
229    TYPE species_def
230       CHARACTER(LEN=15)                            ::  name         !< name of chemical species
231       CHARACTER(LEN=15)                            ::  unit         !< unit (ppm for gases, kg m^-3 for aerosol tracers)
232       REAL(kind=wp), POINTER, DIMENSION(:,:,:)     ::  conc         !< concentrations of trace gases
233       REAL(kind=wp), POINTER, DIMENSION(:,:,:)     ::  conc_av      !< averaged concentrations
234       REAL(kind=wp), POINTER, DIMENSION(:,:,:)     ::  conc_p       !< conc at prognostic time level
235       REAL(kind=wp), POINTER, DIMENSION(:,:,:)     ::  tconc_m      !< weighted tendency of conc for previous sub-timestep (Runge-Kutta)
236       REAL(kind=wp), ALLOCATABLE, DIMENSION(:,:)   ::  cssws_av     !< averaged fluxes of trace gases at surface
237       REAL(kind=wp), ALLOCATABLE, DIMENSION(:,:)   ::  flux_s_cs    !< 6th-order advective flux at south face of grid box of chemical species (='cs')
238       REAL(kind=wp), ALLOCATABLE, DIMENSION(:,:)   ::  diss_s_cs    !< artificial numerical dissipation flux at south face of grid box of chemical species
239       REAL(kind=wp), ALLOCATABLE, DIMENSION(:,:,:) ::  flux_l_cs    !< 6th-order advective flux at left face of grid box of chemical species (='cs')
240       REAL(kind=wp), ALLOCATABLE, DIMENSION(:,:,:) ::  diss_l_cs    !< artificial numerical dissipation flux at left face of grid box of chemical species
241       REAL(kind=wp), ALLOCATABLE, DIMENSION(:)     ::  conc_pr_init !< initial profile of chemical species
242    END TYPE species_def
243!
244!-- Define photolysis frequencies in phot_frequen
245    TYPE photols_def
246       CHARACTER(LEN=15)                            :: name          !< name of pgotolysis frequency
247       CHARACTER(LEN=15)                            :: unit          !< unit (1/s)
248       REAL(kind=wp), POINTER, DIMENSION(:,:,:)     :: freq          !< photolysis frequency
249    END TYPE photols_def
250
251
252    TYPE(species_def), ALLOCATABLE, DIMENSION(:), TARGET ::  chem_species
253    TYPE(photols_def), ALLOCATABLE, DIMENSION(:), TARGET ::  phot_frequen
254
255    SAVE
256
257 END MODULE chem_modules
Note: See TracBrowser for help on using the repository browser.