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

Last change on this file since 2699 was 2696, checked in by kanani, 7 years ago

Merge of branch palm4u into trunk

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