source: palm/trunk/SOURCE/chem_photolysis_mod.f90 @ 2834

Last change on this file since 2834 was 2766, checked in by kanani, 7 years ago

Removal of chem directive, plus minor changes

  • Property svn:keywords set to Id
File size: 12.9 KB
Line 
1!> @file chem_photolysis_mod.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 1997-2018 Leibniz Universitaet Hannover
18! Copyright 2017-2018 Karlsruhe Institute of Technology
19!------------------------------------------------------------------------------!
20!
21! Current revisions:
22! -----------------
23!
24!
25! Former revisions:
26! -----------------
27! $Id: chem_photolysis_mod.f90 2766 2018-01-22 17:17:47Z raasch $
28! Removed preprocessor directive __chem
29!
30! 2718 2018-01-02 08:49:38Z maronga
31! Initial revision
32!
33!
34!
35!
36! Authors:
37! --------
38! @author Renate Forkel
39!
40!
41!------------------------------------------------------------------------------!
42! Description:
43! ------------
44!> photolysis models and interfaces (Adapted from photolysis_model_mod.f90)
45!> @todo Alles!
46!------------------------------------------------------------------------------!
47 MODULE chem_photolysis_mod
48
49    USE arrays_3d,                                                             &
50        ONLY:  dzw, hyp, pt, q, ql, zu, zw
51
52    USE constants,                                                             &
53        ONLY:  pi
54
55    USE control_parameters,                                                    &
56        ONLY:  time_since_reference_point
57
58    USE pegrid,             ONLY: myid, threads_per_task
59
60    USE indices,                                                               &
61        ONLY:  nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg, nzb, nzt
62
63    USE radiation_model_mod,                                                   &
64        ONLY:  calc_zenith, zenith
65               !day, day_init, lat, lambda, lon,                   &
66               !time_utc, time_utc_init,    !FKa: This is now handled by date_and_time_mod
67
68    USE control_parameters,                                                    &
69        ONLY:  initializing_actions           
70!       ONLY:  cloud_droplets, cloud_physics, g, initializing_actions,         &
71!              large_scale_forcing, lsf_surf, phi, pt_surface, rho_surface,    &
72!              surface_pressure, time_since_reference_point
73
74    USE chem_gasphase_mod,                                                     &
75        ONLY: nphot, phot_names, phot 
76
77    USE chemistry_model_mod,                                                   &
78        ONLY: phot_frequen, photolysis_scheme
79
80    USE chem_modules,                                                          &
81        ONLY: chem_debug2
82
83!   REAL(wp), DIMENSION(0:0) ::  zenith,         & !< cosine of solar zenith angle
84!                                sun_dir_lat,    & !< solar directional vector in latitudes
85!                                sun_dir_lon       !< solar directional vector in longitudes
86    USE kinds
87
88#if defined ( __netcdf )
89    USE NETCDF
90#endif
91
92
93    IMPLICIT NONE
94
95
96!   LOGICAL ::  unscheduled_photolysis_calls = .TRUE., & !< flag parameter indicating whether additional calls of the photolysis code are allowed
97!               constant_albedo = .FALSE.,           & !< flag parameter indicating whether the albedo may change depending on zenith
98!               force_photolysis_call = .FALSE.,     & !< flag parameter for unscheduled photolysis calls
99!               photolysis = .FALSE.,                & !< flag parameter indicating whether the photolysis model is used
100!               sun_up    = .TRUE.,                  & !< flag parameter indicating whether the sun is up or down
101!               photolysis = .TRUE.,                 & !< flag parameter indicing whether photolysis shall be calculated
102!               sun_direction = .FALSE.                !< flag parameter indicing whether solar direction shall be calculated
103
104!-- Parameters for constant photolysis frequencies
105     INTEGER,PARAMETER :: nconst  = 15               !< available predefined photolysis prequencies for constant
106
107! Names for predefined fixed photolysis frequencies at zenith angle 0
108     CHARACTER(LEN=10), PARAMETER, DIMENSION(nconst) :: names_c =  (/                    &
109                     'J_O31D    ','J_O33P    ','J_NO2     ','J_HNO3    ','J_RCHO    ', &
110                     'J         ','J         ','J         ','J         ','J         ', &
111                     'J         ','J         ','J         ','J         ','J         ' /)
112! Photolysis frequency at zenith angle 0 in 1/s
113     REAL(wp), PARAMETER, DIMENSION(nconst) :: phot0 =  (/                             &
114                     2.489E-05_wp,3.556E-04_wp, 8.89E-03_wp,5.334E-07_wp,3.734E-05_wp, &
115                     0.0000E00_wp,0.0000E00_wp,0.0000E00_wp,0.0000E00_wp,0.0000E00_wp, &
116                     0.0000E00_wp,0.0000E00_wp,0.0000E00_wp,0.0000E00_wp,0.0000E00_wp /)
117
118
119!-- Parameters for simple photolysis frequencies
120     INTEGER,PARAMETER :: nsimple = 15               !< available predefined photolysis prequencies for simpel parameterisation
121! Names for simple photolysis frequencies parameterisation (
122     CHARACTER(LEN=10), PARAMETER, DIMENSION(nsimple) :: names_s =  (/                 &
123                     'J_O31D    ','J_O33P    ','J_H2O2    ','J_NO2     ','J_NO3_A   ', &
124                     'J_NO3_B   ','J_HONO    ','J_HNO3    ','J_HCHO_A  ','J_HCHO_B  ', &
125                     'J_CH3CHO  ','J         ','J         ','J         ','J_RCHO    ' /)
126
127!-- Parameters for simeple photolysis frequencies from MCM (http://mcm.leeds.ac.uk/MCM)
128!-- Saunders et al., 2003, Atmos. Chem. Phys., 3, 161-180
129     REAL(wp), PARAMETER, DIMENSION(nconst) :: par_l =  (/                             &
130                     6.073E-05_wp,4.775E-04_wp,1.041E-05_wp,1.165E-02_wp,2.485E-02_wp, &
131                     1.747E-01_wp,2.644E-03_wp,9.312E-07_wp,4.642E-05_wp,6.853E-05_wp, &
132                     7.344E-06_wp,0.0000E00_wp,0.0000E00_wp,0.000E00_wp, 6.853E-05_wp /)
133
134     REAL(wp), PARAMETER, DIMENSION(nconst) :: par_m =  (/                             &
135                         1.743_wp,    0.298_wp,    0.723_wp,    0.244_wp,    0.168_wp, &
136                         0.155_wp,    0.261_wp,    1.230_wp,    0.762_wp,    0.477_wp, &
137                         1.202_wp,    0.000_wp,    0.000_wp,    0.000_wp,    0.477_wp /)
138
139     REAL(wp), PARAMETER, DIMENSION(nconst) :: par_n =  (/                             &
140                         0.474_wp,    0.080_wp,    0.279_wp,    0.267_wp,    0.108_wp, &
141                         0.125_wp,    0.288_wp,    0.307_wp,    0.353_wp,    0.323_wp, &
142                         0.417_wp,    0.000_wp,    0.000_wp,    0.000_wp,    0.323_wp /)
143
144
145    REAL(wp) :: time_photolysis = 0.0_wp,         & !< time since last call of photolysis code
146                dt_photolysis = 0.0_wp,           & !< hotolysis model timestep
147                skip_time_do_photolysis = 0.0_wp    !< Radiation model is not called before this time
148
149    REAL(wp)     :: cosz = 0.7_wp                   !< cosine of Zenith angle (45 deg, if not specified otherwise)
150
151!
152!-- Variables and parameters used in Fast-J only
153! ....
154
155!   INTERFACE photolysis_check_parameters
156!      MODULE PROCEDURE photolysis_check_parameters
157!   END INTERFACE photolysis_check_parameters
158 
159    INTERFACE photolysis_constant
160       MODULE PROCEDURE photolysis_constant
161    END INTERFACE photolysis_constant
162 
163    INTERFACE photolysis_simple
164       MODULE PROCEDURE photolysis_simple
165    END INTERFACE photolysis_simple
166!
167!   INTERFACE photolysis_fastj
168!      MODULE PROCEDURE photolysis_fastj
169!   END INTERFACE photolysis_fastj
170!
171    INTERFACE photolysis_control
172       MODULE PROCEDURE photolysis_control
173    END INTERFACE photolysis_control
174
175!   INTERFACE photolysis_header
176!      MODULE PROCEDURE photolysis_header
177!   END INTERFACE photolysis_header
178!
179    INTERFACE photolysis_init
180       MODULE PROCEDURE photolysis_init
181    END INTERFACE photolysis_init
182
183!   INTERFACE photolysis_parin
184!      MODULE PROCEDURE photolysis_parin
185!   END INTERFACE photolysis_parin
186   
187!   INTERFACE photolysis_read_restart_data
188!      MODULE PROCEDURE photolysis_read_restart_data
189!   END INTERFACE photolysis_read_restart_data
190
191!   INTERFACE photolysis_last_actions
192!      MODULE PROCEDURE photolysis_last_actions
193!   END INTERFACE photolysis_last_actions
194
195    SAVE
196
197    PRIVATE
198
199!
200!-- Public functions / NEEDS SORTING
201!   PUBLIC photolysis_init
202!          photolysis_check_parameters, photolysis_control,                      &
203!          photolysis_header, photolysis_init, photolysis_parin !,                 &
204!          photolysis_define_netcdf_grid, photolysis_last_actions,               &
205!          photolysis_read_restart_data, photolysis_data_output_mask
206
207   PUBLIC  photolysis_control, photolysis_init
208
209   PUBLIC  photolysis_scheme
210!
211
212 CONTAINS
213
214
215!------------------------------------------------------------------------------!
216! Description:
217! ------------
218!> This subroutine controls the calls of the photolysis schemes
219!------------------------------------------------------------------------------!
220    SUBROUTINE photolysis_control
221 
222 
223       IMPLICIT NONE
224
225
226       SELECT CASE ( TRIM( photolysis_scheme ) )
227
228          CASE ( 'constant' )
229             CALL photolysis_constant
230         
231          CASE ( 'simple' )
232             CALL photolysis_simple
233       
234!         CASE ( 'fastj' )
235!            CALL photolysis_fastj
236
237          CASE DEFAULT
238
239       END SELECT
240
241
242    END SUBROUTINE photolysis_control
243
244!------------------------------------------------------------------------------!
245! Description:
246! ------------
247!> Initialization of the photolysis model
248!------------------------------------------------------------------------------!
249    SUBROUTINE photolysis_init    !### not yes used. Call should be placed near call of chem_init
250   
251       IMPLICIT NONE
252
253!-- Just in case we need anything
254
255       RETURN
256
257    END SUBROUTINE photolysis_init
258
259
260!------------------------------------------------------------------------------!
261! Description:
262! ------------
263!> This scheme keeps the prescribed net radiation constant during the run
264!> Default zenith angle is 45 deg
265!------------------------------------------------------------------------------!
266    SUBROUTINE photolysis_constant
267
268
269       IMPLICIT NONE
270
271!      INTEGER(iwp) :: i, j, k   !< loop indices
272       INTEGER(iwp) :: iphot,iav !< loop indix for photolysis reaction
273!      REAL(wp)     :: exn,   &  !< Exner functions at surface
274!                      pt1       !< potential temperature at first grid level
275
276       DO iphot = 1,nphot
277          DO iav = 1,nconst
278             IF ( TRIM( names_c(iav) ) == TRIM( phot_names(iphot) ) ) then
279!--    Prescribe fixed photolysis frequencies  [1/s]
280!             IF(myid == 0 .AND. chem_debug2 )  WRITE(06,*) iphot, iav,phot_names(iphot),names_c(iav)
281
282                      phot_frequen(iphot)%freq(nzb+1:nzt,:,:) =    &
283                            phot0(iav) * cosz
284
285!              IF(myid == 0 .AND. chem_debug2 )  WRITE(06,*) phot_frequen(iphot)%freq(1,5,5)
286            ENDIF
287          ENDDO
288       ENDDO
289
290    END SUBROUTINE photolysis_constant
291
292
293!------------------------------------------------------------------------------!
294! Description:
295! ------------
296!> This scheme applies a simple parameterisation for clear sky photolysis frequencies
297!> from the Master Chemical Mechanism, MCM v3.2 (http://mcm.leeds.ac.uk/MCM).
298!> Reference: Saunders et al., Atmos. Chem. Phys., 3, 161, 2003
299!------------------------------------------------------------------------------!
300    SUBROUTINE photolysis_simple
301
302       IMPLICIT NONE
303
304!      INTEGER(iwp) :: i, j, k   !< loop indices
305       INTEGER(iwp) :: iphot,iav !< loop indix for photolysis reaction
306!      REAL(wp)     :: exn,   &  !< Exner functions at surface
307!                      pt1       !< potential temperature at first grid level
308       REAL(wp)     :: coszi     !< 1./cosine of zenith angle
309
310    DO iphot = 1,nphot
311       phot_frequen(iphot)%freq = 0.0_wp
312    ENDDO
313
314    CALL calc_zenith
315
316    IF ( zenith(0) > 0.0_wp ) THEN
317       coszi = 1. / zenith(0)
318
319       DO iphot = 1,nphot
320          DO iav = 1,nsimple
321             IF ( TRIM( names_s(iav) ) == TRIM( phot_names(iphot) ) ) then
322!              if(myid == 0 .AND. chem_debug2 )  WRITE(06,*) 'simple', iphot, iav,phot_names(iphot),names_s(iav)
323
324                      phot_frequen(iphot)%freq(nzb+1:nzt,:,:) =    &
325                            par_l(iav) * zenith(0)**par_m(iav) *  EXP( -par_n(iav) * coszi ) 
326
327!              if(myid == 0 .AND. chem_debug2 )  WRITE(06,*) 'simple', phot_frequen(iphot)%freq(1,5,5)
328            ENDIF
329          ENDDO
330       ENDDO
331    ENDIF
332
333    END SUBROUTINE photolysis_simple
334
335 END MODULE chem_photolysis_mod
Note: See TracBrowser for help on using the repository browser.