2 !dis Open Source License/Disclaimer, Forecast Systems Laboratory
3 !dis NOAA/OAR/FSL, 325 Broadway Boulder, CO 80305
5 !dis This software is distributed under the Open Source Definition,
6 !dis which may be found at http://www.opensource.org/osd.html.
8 !dis In particular, redistribution and use in source and binary forms,
9 !dis with or without modification, are permitted provided that the
10 !dis following conditions are met:
12 !dis - Redistributions of source code must retain this notice, this
13 !dis list of conditions and the following disclaimer.
15 !dis - Redistributions in binary form must provide access to this
16 !dis notice, this list of conditions and the following disclaimer, and
17 !dis the underlying source code.
19 !dis - All modifications to this software must be clearly documented,
20 !dis and are solely the responsibility of the agent making the
23 !dis - If significant modifications or enhancements are made to this
24 !dis software, the FSL Software Policy Manager
25 !dis (softwaremgr@fsl.noaa.gov) should be notified.
27 !dis THIS SOFTWARE AND ITS DOCUMENTATION ARE IN THE PUBLIC DOMAIN
28 !dis AND ARE FURNISHED "AS IS." THE AUTHORS, THE UNITED STATES
29 !dis GOVERNMENT, ITS INSTRUMENTALITIES, OFFICERS, EMPLOYEES, AND
30 !dis AGENTS MAKE NO WARRANTY, EXPRESS OR IMPLIED, AS TO THE USEFULNESS
31 !dis OF THE SOFTWARE AND DOCUMENTATION FOR ANY PURPOSE. THEY ASSUME
32 !dis NO RESPONSIBILITY (1) FOR THE USE OF THE SOFTWARE AND
33 !dis DOCUMENTATION; OR (2) TO PROVIDE TECHNICAL SUPPORT TO USERS.
39 MODULE module_input_chem_bioemiss
43 USE module_driver_constants
44 USE module_state_description
50 USE module_aerosols_sorgam
51 USE module_get_file_names
55 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
57 SUBROUTINE input_ext_chem_beis3_file (grid)
58 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
64 INTEGER :: i,j,n,numfil,status,system
66 INTEGER :: ids, ide, jds, jde, kds, kde, &
67 ims, ime, jms, jme, kms, kme, &
68 ips, ipe, jps, jpe, kps, kpe
70 REAL, ALLOCATABLE, DIMENSION(:,:) :: emiss
74 ! Number of reference emission and LAI files to open
77 CHARACTER (LEN=80) :: message
79 TYPE (grid_config_rec_type) :: config_flags
81 ! Normalized biogenic emissions for standard conditions (moles compound/km^2/hr)
82 ! REAL, DIMENSION(i,j) :: &
83 ! sebio_iso,sebio_oli,sebio_api,sebio_lim,sebio_xyl, &
84 ! sebio_hc3,sebio_ete,sebio_olt,sebio_ket,sebio_ald, &
85 ! sebio_hcho,sebio_eth,sebio_ora2,sebio_co,sebio_nr, &
86 ! noag_grow,noag_nongrow,nononag
88 ! Leaf area index for isoprene
89 ! REAL, DIMENSION(i,j) :: slai
91 ! Filenames of reference emissions and LAI
93 CHARACTER*12 emfil(numfil)
94 DATA emfil/'ISO','OLI','API','LIM','XYL','HC3','ETE','OLT', &
95 'KET','ALD','HCHO','ETH','ORA2','CO','NR', &
96 'NOAG_GROW','NOAG_NONGROW','NONONAG','ISOP'/
98 !!!!!-------------------------------------------------------------------
100 ! Get grid dimensions
101 CALL get_ijk_from_grid ( grid , &
102 ids, ide, jds, jde, kds, kde, &
103 ims, ime, jms, jme, kms, kme, &
104 ips, ipe, jps, jpe, kps, kpe )
106 WRITE( message , FMT='(A,4I5)' ) ' DIMS: ',ids,ide-1,jds,jde-1
107 CALL wrf_message ( message )
109 ALLOCATE( emiss(ids:ide-1,jds:jde-1) )
112 ! Loop over the file names
115 ! Remove scratch unzipped file
116 status=system('rm -f scratem*')
118 ! All reference emissions except NO
120 onefil='../../run/BIOREF_'// &
121 TRIM(ADJUSTL(emfil(n)))//'.gz'
122 ! NO reference emissions
123 ELSE IF(n.GE.16.AND.n.LE.18)THEN
124 onefil='../../run/AVG_'// &
125 TRIM(ADJUSTL(emfil(n)))//'.gz'
128 onefil='../../run/LAI_'// &
129 TRIM(ADJUSTL(emfil(n)))//'S.gz'
132 ! Copy selected file to scratch
133 status=system('cp '//TRIM(ADJUSTL(onefil))//' scratem.gz')
136 status=system('gunzip scratem')
138 ! Open scratch and read into appropriate array
139 OPEN(26,FILE='scratem',FORM='FORMATTED')
141 READ(26,'(12E9.2)') emiss
142 grid%sebio_iso(ids:ide-1,jds:jde-1) = emiss
145 READ(26,'(12E9.2)') emiss
146 grid%sebio_oli(ids:ide-1,jds:jde-1) = emiss
149 READ(26,'(12E9.2)') emiss
150 grid%sebio_api(ids:ide-1,jds:jde-1) = emiss
153 READ(26,'(12E9.2)') emiss
154 grid%sebio_lim(ids:ide-1,jds:jde-1) = emiss
157 READ(26,'(12E9.2)') emiss
158 grid%sebio_xyl(ids:ide-1,jds:jde-1) = emiss
161 READ(26,'(12E9.2)') emiss
162 grid%sebio_hc3(ids:ide-1,jds:jde-1) = emiss
165 READ(26,'(12E9.2)') emiss
166 grid%sebio_ete(ids:ide-1,jds:jde-1) = emiss
169 READ(26,'(12E9.2)') emiss
170 grid%sebio_olt(ids:ide-1,jds:jde-1) = emiss
173 READ(26,'(12E9.2)') emiss
174 grid%sebio_ket(ids:ide-1,jds:jde-1) = emiss
177 READ(26,'(12E9.2)') emiss
178 grid%sebio_ald(ids:ide-1,jds:jde-1) = emiss
181 READ(26,'(12E9.2)') emiss
182 grid%sebio_hcho(ids:ide-1,jds:jde-1) = emiss
185 READ(26,'(12E9.2)') emiss
186 grid%sebio_eth(ids:ide-1,jds:jde-1) = emiss
189 READ(26,'(12E9.2)') emiss
190 grid%sebio_ora2(ids:ide-1,jds:jde-1) = emiss
193 READ(26,'(12E9.2)') emiss
194 grid%sebio_co(ids:ide-1,jds:jde-1) = emiss
197 READ(26,'(12E9.2)') emiss
198 grid%sebio_nr(ids:ide-1,jds:jde-1) = emiss
201 READ(26,'(12E9.2)') emiss
202 grid%noag_grow(ids:ide-1,jds:jde-1) = emiss
205 READ(26,'(12E9.2)') emiss
206 grid%noag_nongrow(ids:ide-1,jds:jde-1) = emiss
209 READ(26,'(12E9.2)') emiss
210 grid%nononag(ids:ide-1,jds:jde-1) = emiss
213 READ(26,'(12E9.2)') emiss
214 grid%slai(ids:ide-1,jds:jde-1) = emiss
219 ! End of loop over file names
223 END SUBROUTINE input_ext_chem_beis3_file
224 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
226 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
227 SUBROUTINE input_ext_chem_megan2_file (grid)
230 ! This subroutine reads in an ASCII file of variables that are needed
231 ! as input for biogenic emissions model MEGAN version 2. The
234 ! Isoprene emissions at referenece tempperature and
235 ! light conditions [=] moles/km2/hr
236 ! Leaf area index (one each month)
237 ! Plant functional groups
242 ! "Climatological" variables:
243 ! Monthly surface air temperature [=] K
244 ! Monthly downward solar radiation [=] W/m2
246 ! April, 2007 Serena H. Chung and Christine Wiedinmyer
255 INTEGER :: i,j,v,status,system, itmp, jtmp
257 INTEGER :: ids, ide, jds, jde, kds, kde, &
258 ims, ime, jms, jme, kms, kme, &
259 ips, ipe, jps, jpe, kps, kpe
261 REAL, ALLOCATABLE, DIMENSION(:,:,:) :: emiss
263 CHARACTER (LEN=80) :: message
265 TYPE (grid_config_rec_type) :: config_flags
268 ! Variables "Pointers"
269 ! The order must follow that of the ASCII input file
270 integer, parameter :: n_mgnin = 41
271 integer, parameter :: & ! Pointer for :
272 & mgnin_isop = 1 & ! isoprene reference emissions
273 & ,mgnin_lai01 = 2 & ! Leaf area index for January
274 & ,mgnin_lai02 = 3 & ! February
275 & ,mgnin_lai03 = 4 & ! March
276 & ,mgnin_lai04 = 5 & ! April
277 & ,mgnin_lai05 = 6 & ! May
278 & ,mgnin_lai06 = 7 & ! June
279 & ,mgnin_lai07 = 8 & ! July
280 & ,mgnin_lai08 = 9 & ! August
281 & ,mgnin_lai09 = 10 & ! September
282 & ,mgnin_lai10 = 11 & ! October
283 & ,mgnin_lai11 = 12 & ! November
284 & ,mgnin_lai12 = 13 & ! December
285 & ,mgnin_pftp_bt = 14 & ! plant functional type % for broadleaf trees
286 & ,mgnin_pftp_nt = 15 & ! needleleaf trees
287 & ,mgnin_pftp_sb = 16 & ! shrubs and bushes
288 & ,mgnin_pftp_hb = 17 & ! herbs
289 & ,mgnin_tsa01 = 18 & ! monthly-mean surface air temperature for January
290 & ,mgnin_tsa02 = 19 & ! February
291 & ,mgnin_tsa03 = 20 & ! March
292 & ,mgnin_tsa04 = 21 & ! April
293 & ,mgnin_tsa05 = 22 & ! May
294 & ,mgnin_tsa06 = 23 & ! June
295 & ,mgnin_tsa07 = 24 & ! July
296 & ,mgnin_tsa08 = 25 & ! August
297 & ,mgnin_tsa09 = 26 & ! September
298 & ,mgnin_tsa10 = 27 & ! October
299 & ,mgnin_tsa11 = 28 & ! November
300 & ,mgnin_tsa12 = 29 & ! December
301 & ,mgnin_swdown01 = 30 & ! monthl-mean solar irradiance at surface for January
302 & ,mgnin_swdown02 = 31 & ! February
303 & ,mgnin_swdown03 = 32 & ! March
304 & ,mgnin_swdown04 = 33 & ! April
305 & ,mgnin_swdown05 = 34 & ! May
306 & ,mgnin_swdown06 = 35 & ! June
307 & ,mgnin_swdown07 = 36 & ! July
308 & ,mgnin_swdown08 = 37 & ! August
309 & ,mgnin_swdown09 = 38 & ! September
310 & ,mgnin_swdown10 = 39 & ! October
311 & ,mgnin_swdown11 = 40 & ! November
312 & ,mgnin_swdown12 = 41 ! December
316 !!!!!-------------------------------------------------------------------
318 ! Get grid dimensions
319 CALL get_ijk_from_grid ( grid , &
320 ids, ide, jds, jde, kds, kde, &
321 ims, ime, jms, jme, kms, kme, &
322 ips, ipe, jps, jpe, kps, kpe )
324 WRITE( message , FMT='(A,4I5)' ) ' in input_ext_chem_megan2_file, DIMS: ',ids,ide-1,jds,jde-1
325 CALL wrf_message ( message )
327 ALLOCATE( emiss(ids:ide-1,jds:jde-1,n_mgnin) )
329 ! Remove scratch file
330 ! status=system('rm -f scratem*')
333 ! Copy selected file to scratch
334 onefil='MEGAN_input_WRFchem.txt'
335 ! status=system('cp '//TRIM(ADJUSTL(onefil))//' scratem')
337 ! Open scratch and read into appropriate array
338 ! OPEN(26,FILE='scratem',FORM='FORMATTED', status='old')
339 OPEN(26,FILE=trim(onefil),FORM='FORMATTED', status='old')
341 ! The following follows the file format provided by Christine Wiedinmyer
345 read (26, FMT='(2(I5,1x),41(ES11.2,1x))') itmp, jtmp, (emiss(i,j,v),v=1,n_mgnin)
346 ! redundant to be sure
347 if ( (i /= itmp) .or. j /= jtmp ) then
348 WRITE( message , FMT='(A,I3,I3,A,I3,I3)' ) 'Something is wrong (i,j) = ',i,j,"itmp, jtmp = ",itmp,jtmp
349 call wrf_error_fatal(message)
355 ! Isoprene emissions at standard conditions [=] mol/km2/hr
356 grid%msebio_isop(ids:ide-1,jds:jde-1) = emiss(ids:ide-1,jds:jde-1,mgnin_isop)
357 ! Leaf area index for each month
358 grid%mlai (ids:ide-1,jds:jde-1,01) = emiss(ids:ide-1,jds:jde-1,mgnin_lai01)
359 grid%mlai (ids:ide-1,jds:jde-1,02) = emiss(ids:ide-1,jds:jde-1,mgnin_lai02)
360 grid%mlai (ids:ide-1,jds:jde-1,03) = emiss(ids:ide-1,jds:jde-1,mgnin_lai03)
361 grid%mlai (ids:ide-1,jds:jde-1,04) = emiss(ids:ide-1,jds:jde-1,mgnin_lai04)
362 grid%mlai (ids:ide-1,jds:jde-1,05) = emiss(ids:ide-1,jds:jde-1,mgnin_lai05)
363 grid%mlai (ids:ide-1,jds:jde-1,06) = emiss(ids:ide-1,jds:jde-1,mgnin_lai06)
364 grid%mlai (ids:ide-1,jds:jde-1,07) = emiss(ids:ide-1,jds:jde-1,mgnin_lai07)
365 grid%mlai (ids:ide-1,jds:jde-1,08) = emiss(ids:ide-1,jds:jde-1,mgnin_lai08)
366 grid%mlai (ids:ide-1,jds:jde-1,09) = emiss(ids:ide-1,jds:jde-1,mgnin_lai09)
367 grid%mlai (ids:ide-1,jds:jde-1,10) = emiss(ids:ide-1,jds:jde-1,mgnin_lai10)
368 grid%mlai (ids:ide-1,jds:jde-1,11) = emiss(ids:ide-1,jds:jde-1,mgnin_lai11)
369 grid%mlai (ids:ide-1,jds:jde-1,12) = emiss(ids:ide-1,jds:jde-1,mgnin_lai12)
370 ! Plant functional group percentage
371 grid%pftp_bt (ids:ide-1,jds:jde-1) = emiss(ids:ide-1,jds:jde-1,mgnin_pftp_bt)
372 grid%pftp_nt (ids:ide-1,jds:jde-1) = emiss(ids:ide-1,jds:jde-1,mgnin_pftp_nt)
373 grid%pftp_sb (ids:ide-1,jds:jde-1) = emiss(ids:ide-1,jds:jde-1,mgnin_pftp_sb)
374 grid%pftp_hb (ids:ide-1,jds:jde-1) = emiss(ids:ide-1,jds:jde-1,mgnin_pftp_hb)
375 ! "Climatological" monthly mean surface air temperature [=] K
376 ! (Note: The height of surface air temperature is not considered important;
377 ! this is not needed if online 24-hour average values are used
378 grid%mtsa (ids:ide-1,jds:jde-1,01) = emiss(ids:ide-1,jds:jde-1,mgnin_tsa01)
379 grid%mtsa (ids:ide-1,jds:jde-1,02) = emiss(ids:ide-1,jds:jde-1,mgnin_tsa02)
380 grid%mtsa (ids:ide-1,jds:jde-1,03) = emiss(ids:ide-1,jds:jde-1,mgnin_tsa03)
381 grid%mtsa (ids:ide-1,jds:jde-1,04) = emiss(ids:ide-1,jds:jde-1,mgnin_tsa04)
382 grid%mtsa (ids:ide-1,jds:jde-1,05) = emiss(ids:ide-1,jds:jde-1,mgnin_tsa05)
383 grid%mtsa (ids:ide-1,jds:jde-1,06) = emiss(ids:ide-1,jds:jde-1,mgnin_tsa06)
384 grid%mtsa (ids:ide-1,jds:jde-1,07) = emiss(ids:ide-1,jds:jde-1,mgnin_tsa07)
385 grid%mtsa (ids:ide-1,jds:jde-1,08) = emiss(ids:ide-1,jds:jde-1,mgnin_tsa08)
386 grid%mtsa (ids:ide-1,jds:jde-1,09) = emiss(ids:ide-1,jds:jde-1,mgnin_tsa09)
387 grid%mtsa (ids:ide-1,jds:jde-1,10) = emiss(ids:ide-1,jds:jde-1,mgnin_tsa10)
388 grid%mtsa (ids:ide-1,jds:jde-1,11) = emiss(ids:ide-1,jds:jde-1,mgnin_tsa11)
389 grid%mtsa (ids:ide-1,jds:jde-1,12) = emiss(ids:ide-1,jds:jde-1,mgnin_tsa12)
390 ! "Climatological" monthly mean downward irradiance at the surface [=] W/m2
391 ! This is not needed if online 24-hour average values are used
392 grid%mswdown (ids:ide-1,jds:jde-1,01) = emiss(ids:ide-1,jds:jde-1,mgnin_swdown01)
393 grid%mswdown (ids:ide-1,jds:jde-1,02) = emiss(ids:ide-1,jds:jde-1,mgnin_swdown02)
394 grid%mswdown (ids:ide-1,jds:jde-1,03) = emiss(ids:ide-1,jds:jde-1,mgnin_swdown03)
395 grid%mswdown (ids:ide-1,jds:jde-1,04) = emiss(ids:ide-1,jds:jde-1,mgnin_swdown04)
396 grid%mswdown (ids:ide-1,jds:jde-1,05) = emiss(ids:ide-1,jds:jde-1,mgnin_swdown05)
397 grid%mswdown (ids:ide-1,jds:jde-1,06) = emiss(ids:ide-1,jds:jde-1,mgnin_swdown06)
398 grid%mswdown (ids:ide-1,jds:jde-1,07) = emiss(ids:ide-1,jds:jde-1,mgnin_swdown07)
399 grid%mswdown (ids:ide-1,jds:jde-1,08) = emiss(ids:ide-1,jds:jde-1,mgnin_swdown08)
400 grid%mswdown (ids:ide-1,jds:jde-1,09) = emiss(ids:ide-1,jds:jde-1,mgnin_swdown09)
401 grid%mswdown (ids:ide-1,jds:jde-1,10) = emiss(ids:ide-1,jds:jde-1,mgnin_swdown10)
402 grid%mswdown (ids:ide-1,jds:jde-1,11) = emiss(ids:ide-1,jds:jde-1,mgnin_swdown11)
403 grid%mswdown (ids:ide-1,jds:jde-1,12) = emiss(ids:ide-1,jds:jde-1,mgnin_swdown12)
410 end SUBROUTINE input_ext_chem_megan2_file
412 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
415 END MODULE module_input_chem_bioemiss