source: palm/trunk/SOURCE/chem_modules.f90

Last change on this file was 4881, checked in by forkel, 3 years ago

removed unused parameters and write statements in chemistry

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