emission.F90 42 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223
  1. #define TRACEBACK write (gol,'("in ",a," (",a,i6,")")') rname, __FILE__, __LINE__ ; call goErr
  2. #define IF_NOTOK_RETURN(action) if (status/=0) then; TRACEBACK; action; return; end if
  3. #define IF_ERROR_RETURN(action) if (status> 0) then; TRACEBACK; action; return; end if
  4. !
  5. #include "tm5.inc"
  6. !
  7. !------------------------------------------------------------------------------
  8. ! TM5 !
  9. !------------------------------------------------------------------------------
  10. !BOP
  11. !
  12. ! !MODULE: EMISSION
  13. !
  14. ! !DESCRIPTION: wrappers around various emissions (init/declare/apply/done)
  15. ! routines, needed for TM5 CBM4 version.
  16. ! Also hold emissions budget variables.
  17. !
  18. !\\
  19. !\\
  20. ! !INTERFACE:
  21. !
  22. MODULE EMISSION
  23. !
  24. ! !USES:
  25. !
  26. USE GO, ONLY : gol, goErr, goPr
  27. use GO, ONLY : GO_Timer_Def, GO_Timer_End, GO_Timer_Start
  28. USE TM5_DISTGRID, ONLY : dgrid, Get_DistGrid, scatter, gather
  29. USE dims, ONLY : nregions, okdebug
  30. USE emission_data, ONLY : plandr, emis2D ! , bmbcycle, bb_lm
  31. #ifdef with_m7
  32. USE emission_data, ONLY : emis_number, emis_mass, emis_temp
  33. #endif
  34. #ifdef with_budgets
  35. USE emission_data, ONLY : budemi_dat, budemi_data, sum_emission
  36. USE budget_global, ONLY : nbud_vg,nbudg
  37. USE chem_param, ONLY : ntracet
  38. #endif
  39. use emission_nox , only : Emission_NOx_Init , Emission_NOx_Done , emission_nox_declare
  40. use emission_co , only : Emission_CO_Init , Emission_CO_Done , emission_co_declare , emission_co_apply
  41. use emission_nmvoc, only : Emission_NMVOC_Init, Emission_NMVOC_Done , emission_nmvoc_declare, emission_nmvoc_apply
  42. use emission_ch4 , only : Emission_CH4_Init , Emission_CH4_Done , emission_ch4_declare , emission_ch4_apply
  43. use emission_nh3 , only : Emission_nh3_Init , Emission_nh3_Done , emission_nh3_declare , emission_nh3_apply
  44. use emission_sox , only : Emission_SOx_Init , Emission_SOx_Done , emission_sox_declare , emission_sox_apply
  45. use emission_dms , only : Emission_DMS_Init , emission_dms_done , emission_dms_declare , emission_dms_apply
  46. use emission_rn222, only : Emission_rn222_Init, emission_rn222_done , emission_rn222_declare, emission_rn222_apply
  47. #ifdef with_online_bvoc
  48. USE emission_bvoc, ONLY : declare_emission_bvoc, free_emission_bvoc, emission_apply_bvoc
  49. #else
  50. use emission_isop , only: Emission_isop_Init , Emission_isop_Done , emission_isop_declare , emission_isop_apply
  51. use emission_terp , only: Emission_terp_Init , Emission_terp_Done , emission_terp_declare , emission_terp_apply
  52. #endif
  53. #ifdef with_m7
  54. use emission_dust, only : emission_dust_done , emission_dust_declare
  55. use emission_pom , only : Emission_POM_Init, Emission_POM_Done , emission_pom_declare
  56. use emission_bc , only : Emission_BC_Init , Emission_BC_Done , emission_bc_declare
  57. !!$ use emission_ss, only: declare_emission_ss , free_emission_ss
  58. #endif
  59. IMPLICIT NONE
  60. PRIVATE
  61. !
  62. ! !PUBLIC MEMBER FUNCTIONS:
  63. !
  64. PUBLIC :: Emission_Init ! allocate/init budget var; call other emiss-related init
  65. PUBLIC :: Emission_Done ! gather/write final budget
  66. PUBLIC :: Declare_Emission ! allocate emiss var (new run), read emiss data (new month)
  67. PUBLIC :: Emission_Apply !
  68. !
  69. ! !PRIVATE DATA MEMBERS:
  70. !
  71. ! budemig_all (used to sum budemig from all processors) is used in chemistry for its NOx values.
  72. #ifdef with_budgets
  73. REAL, DIMENSION(nbudg, nbud_vg, ntracet) :: budemig
  74. REAL, DIMENSION(nbudg, nbud_vg, ntracet), PUBLIC :: budemig_all ! for buggy MPI (see budget_global.F90)
  75. #endif
  76. integer :: itim_appl, itim_co, itim_voc, itim_nh3, itim_sox, itim_dms, itim_ch4, itim_isop, itim_rn222
  77. CHARACTER(len=*), PARAMETER :: mname = 'emission'
  78. !
  79. ! !REVISION HISTORY:
  80. ! 16 Jul 2010 - P. Le Sager - fix for m7 with GFED_8days
  81. ! 20 Aug 2010 - A. Strunk - Adapted to AR5 emissions + various other changes.
  82. ! 27 Mar 2012 - P. Le Sager - adapted for lon-lat MPI domain decomposition
  83. ! 02 Apr 2014 - J. E. Williams - Updated for terpenes
  84. !
  85. ! - NO MORE REVISION HISTORY. This is gathered from repository from now on.
  86. !EOP
  87. !----------------------------------------------------------------------
  88. CONTAINS
  89. !----------------------------------------------------------------------
  90. ! TM5 !
  91. !----------------------------------------------------------------------
  92. !BOP
  93. !
  94. ! !IROUTINE: EMISSION_INIT
  95. !
  96. ! !DESCRIPTION: Initialise emission fields and parameters by reading
  97. ! the rc-file. Allocate and initialize budget variables.
  98. !\\
  99. !\\
  100. ! !INTERFACE:
  101. !
  102. SUBROUTINE EMISSION_INIT( status )
  103. !
  104. ! !USES:
  105. !
  106. use GO, only : TrcFile, Init, Done, ReadRc
  107. use meteodata, only : Set, oro_dat
  108. use dims, only : iglbsfc, nregions, lm
  109. use dims, only : idate, ndyn_max, tref
  110. use global_data, only : inputdir, rcfile
  111. use emission_data, only : emis_input_dir, use_tiedkte
  112. use emission_data, only : emis_input_dir_gfed
  113. use emission_data, only : emis_input_dir_retro
  114. use emission_data, only : emis_input_year_nat
  115. use emission_data, only : emis_input_year_bc
  116. use emission_data, only : emis_input_year_oc
  117. use emission_data, only : emis_input_year_sox
  118. use emission_data, only : emis_input_year_nh3
  119. use emission_data, only : emis_input_year_nox
  120. use emission_data, only : emis_input_year_co
  121. use emission_data, only : emis_input_year_nmvoc
  122. use emission_data, only : emis_input_year_ch4
  123. use emission_data, only : ch4_fixyear
  124. use emission_data, only : cmip6_ch4_dirname
  125. use emission_data, only : LCMIP6, LCMIP6BMB, LCMIP6_CH4
  126. use emission_data, only : LAR5, LAR5BMB, LEDGAR4, LRETROF, LGFED3
  127. use emission_data, only : LLPJ, LHYMN, LMACCITY, LMEGAN, LMACC
  128. #ifdef with_ch4_emis
  129. use emission_data, only : emis_input_dir_natch4
  130. #endif
  131. #ifdef with_m7
  132. use chem_param, only : mode_nm
  133. use emission_data, only : emis_input_dir_aerocom
  134. use emission_data, only : emis_input_dir_dust, emis_input_dust
  135. use mo_aero_m7, only : nmod,nnucl
  136. use mo_aero_nucl, only : d_form
  137. use mo_aero, only : nsoa
  138. use ebischeme, only : isoprene_on
  139. #endif
  140. use emission_data, only : emis_input_dir_cmip6
  141. use emission_data, only : emis_input_dir_ar5
  142. use emission_data, only : emis_input_dir_mac
  143. use emission_data, only : emis_input_dir_ed4
  144. use emission_data, only : emis_input_dir_dms
  145. use emission_data, only : emis_input_dir_rn222
  146. use emission_data, only : emis_input_dir_megan
  147. use emission_data, only : emis_ch4_single, emis_ch4_fix3d
  148. use emission_data, only : emis_ch4_fixed_ppb, emis_zch4_fname
  149. use emission_data, only : emis_bb_trop_cycle, bb_cycle, scale_cycle
  150. use emission_read, only : emission_read_init
  151. #ifdef with_online_nox
  152. use online_nox_data, only : input_nox_dir
  153. #endif
  154. !
  155. ! !OUTPUT PARAMETERS:
  156. !
  157. INTEGER, INTENT(out) :: status
  158. !
  159. ! !REVISION HISTORY:
  160. ! 27 Mar 2012 - P. Le Sager - adapted for lon-lat MPI domain decomposition
  161. !
  162. !EOP
  163. !------------------------------------------------------------------------------
  164. !BOC
  165. CHARACTER(len=*), PARAMETER :: rname = mname//'/Emission_Init'
  166. INTEGER :: region, i1, i2, j1, j2, ntim, lmr, imode
  167. TYPE(TrcFile) :: rcF
  168. REAL :: dtime
  169. integer :: emis_input_year
  170. integer :: emis_input_year_ntcf
  171. integer :: emis_input_year_aer
  172. integer :: emis_input_year_o3
  173. ! -----------------------------------
  174. ! read settings from rcfile
  175. ! -----------------------------------
  176. call Init( rcF, rcfile, status )
  177. IF_NOTOK_RETURN(status=1)
  178. if (okdebug) then
  179. write(gol,*) "EMISS-INFO - running year : ", idate(1) ; call goPr
  180. end if
  181. ! emission base year (assumption: no run overlapping more than one year)
  182. call ReadRc( rcF, 'input.emis.year', emis_input_year, status, default=idate(1) )
  183. IF_ERROR_RETURN(status=1)
  184. ! natural emissions (MACC, MEGAN, LPJ)
  185. CALL ReadRc( rcF, 'input.natemis.year', emis_input_year_nat, status, default= emis_input_year )
  186. IF_ERROR_RETURN(status=1)
  187. write(gol,*) 'EMISS-INFO - Natural emissions requested for year: ', emis_input_year_nat; call goPr
  188. write(gol,*) 'EMISS-INFO - Anthropogenic and biomass burning emissions'; call goPr
  189. write(gol,*) 'EMISS-INFO - requested for the following years:'; call goPr
  190. ! anthropogenic and biomass burning emissions of all NTCFs, excluding CH4
  191. call ReadRc( rcF, 'input.emis.year.ntcf', emis_input_year_ntcf, status, default=emis_input_year )
  192. IF_ERROR_RETURN(status=1)
  193. ! aerosol precursors (BC, OC, SOx, NH3)
  194. call ReadRc( rcF, 'input.emis.year.aer', emis_input_year_aer, status, default=emis_input_year_ntcf )
  195. IF_ERROR_RETURN(status=1)
  196. call ReadRc( rcF, 'input.emis.year.bc', emis_input_year_bc, status, default=emis_input_year_aer )
  197. IF_ERROR_RETURN(status=1)
  198. write(gol,*) 'EMISS-INFO - BC: ', emis_input_year_bc; call goPr
  199. call ReadRc( rcF, 'input.emis.year.oc', emis_input_year_oc, status, default=emis_input_year_aer )
  200. IF_ERROR_RETURN(status=1)
  201. write(gol,*) 'EMISS-INFO - OC: ', emis_input_year_oc; call goPr
  202. call ReadRc( rcF, 'input.emis.year.sox', emis_input_year_sox, status, default=emis_input_year_aer )
  203. IF_ERROR_RETURN(status=1)
  204. write(gol,*) 'EMISS-INFO - SOx: ', emis_input_year_sox; call goPr
  205. call ReadRc( rcF, 'input.emis.year.nh3', emis_input_year_nh3, status, default=emis_input_year_aer )
  206. IF_ERROR_RETURN(status=1)
  207. write(gol,*) 'EMISS-INFO - NH3: ', emis_input_year_nh3; call goPr
  208. ! tropospheric ozone precursors (NOx, CO, NMVOCs incl. isoprene and terpenes)
  209. call ReadRc( rcF, 'input.emis.year.o3', emis_input_year_o3, status, default=emis_input_year_ntcf )
  210. IF_ERROR_RETURN(status=1)
  211. call ReadRc( rcF, 'input.emis.year.nox', emis_input_year_nox, status, default=emis_input_year_o3 )
  212. IF_ERROR_RETURN(status=1)
  213. write(gol,*) 'EMISS-INFO - NOx: ', emis_input_year_nox; call goPr
  214. call ReadRc( rcF, 'input.emis.year.co', emis_input_year_co, status, default=emis_input_year_o3 )
  215. IF_ERROR_RETURN(status=1)
  216. write(gol,*) 'EMISS-INFO - CO: ', emis_input_year_co; call goPr
  217. call ReadRc( rcF, 'input.emis.year.nmvoc', emis_input_year_nmvoc, status, default=emis_input_year_o3 )
  218. IF_ERROR_RETURN(status=1)
  219. write(gol,*) 'EMISS-INFO - NMVOC:', emis_input_year_nmvoc; call goPr
  220. if (emis_input_year_co /= emis_input_year_nmvoc) then
  221. write(gol,*) 'ERROR: Emission year for CO and NMVOCs should be the same.'; call goErr
  222. write(gol,*) 'ERROR: This is a restriction built in for AerChemMIP.'; call goErr
  223. write(gol,*) 'ERROR: Please comment these messages in the code,'; call goErr
  224. write(gol,*) 'ERROR: in case you want to use different years.'; call goErr
  225. status=1; TRACEBACK; return
  226. end if
  227. ! CH4 emissions
  228. call ReadRc( rcF, 'input.ch4.fixyear', ch4_fixyear, status, default = .false. )
  229. IF_ERROR_RETURN(status=1)
  230. if (ch4_fixyear) then
  231. CALL ReadRc( rcF, 'input.ch4.year', emis_input_year_ch4, status, default=emis_input_year )
  232. IF_ERROR_RETURN(status=1)
  233. write(gol,*) 'EMISS-INFO - CH4 boundary conditions fixed to year: ', emis_input_year_ch4; call goPr
  234. else
  235. emis_input_year_ch4=emis_input_year
  236. write(gol,*) 'EMISS-INFO - CH4 boundary conditions for year: ', emis_input_year_ch4; call goPr
  237. if (emis_input_year_ch4 /= idate(1) ) then
  238. write(gol,*) 'ERROR: CH4 boundary conditions are not fixed'; call goErr
  239. write(gol,*) 'ERROR: and not set to the current year either.'; call goErr
  240. write(gol,*) 'ERROR: This combination is currently not allowed.'; call goErr
  241. write(gol,*) 'ERROR: To remove this restriction,'; call goErr
  242. write(gol,*) 'ERROR: please comment these messages in the code.'; call goErr
  243. write(gol,*) 'ERROR: To use fixed boundary conditions,'; call goErr
  244. write(gol,*) 'ERROR: please use input.ch4.fixyear.'; call goErr
  245. status=1; TRACEBACK; return
  246. endif
  247. endif
  248. ! default directory for emissions data is "standard input files" dir
  249. emis_input_dir=trim(inputdir)
  250. ! directory of each data provider
  251. call ReadRc( rcF, 'input.emis.dir.CMIP6', emis_input_dir_cmip6, status, default=emis_input_dir )
  252. IF_ERROR_RETURN(status=1)
  253. call ReadRc( rcF, 'input.emis.dir.AR5', emis_input_dir_ar5, status, default=emis_input_dir )
  254. IF_ERROR_RETURN(status=1)
  255. call ReadRc( rcF, 'input.emis.dir.MACC', emis_input_dir_mac, status, default=emis_input_dir )
  256. IF_ERROR_RETURN(status=1)
  257. call ReadRc( rcF, 'input.emis.dir.ED41', emis_input_dir_ed4, status, default=emis_input_dir )
  258. IF_ERROR_RETURN(status=1)
  259. call ReadRc( rcF, 'input.emis.dir.gfed', emis_input_dir_gfed, status, default=emis_input_dir )
  260. IF_ERROR_RETURN(status=1)
  261. call ReadRc( rcF, 'input.emis.dir.retro', emis_input_dir_retro, status, default=emis_input_dir )
  262. IF_ERROR_RETURN(status=1)
  263. call ReadRc( rcF, 'input.emis.dir.MEGAN', emis_input_dir_megan, status, default=emis_input_dir )
  264. IF_ERROR_RETURN(status=1)
  265. #ifdef with_ch4_emis
  266. ! for both HYMN and LPJ datasets
  267. call ReadRc( rcF, 'input.emis.dir.natch4', emis_input_dir_natch4, status, default=emis_input_dir )
  268. IF_ERROR_RETURN(status=1)
  269. #endif
  270. ! Flags
  271. call ReadRc( rcF, 'use_cmip6', LCMIP6, status, default=.false. )
  272. IF_ERROR_RETURN(status=1)
  273. call ReadRc( rcF, 'use_cmip6_fires', LCMIP6BMB,status, default=.false. )
  274. IF_ERROR_RETURN(status=1)
  275. call ReadRc( rcF, 'use_ar5', LAR5, status, default=.false. )
  276. IF_ERROR_RETURN(status=1)
  277. call ReadRc( rcF, 'use_ar5_fires', LAR5BMB, status, default=.false. )
  278. IF_ERROR_RETURN(status=1)
  279. call ReadRc( rcF, 'use_edgar4', LEDGAR4, status, default=.false. )
  280. IF_ERROR_RETURN(status=1)
  281. call ReadRc( rcF, 'use_retro_fires', LRETROF, status, default=.false. )
  282. IF_ERROR_RETURN(status=1)
  283. call ReadRc( rcF, 'use_gfed3', LGFED3, status, default=.false. )
  284. IF_ERROR_RETURN(status=1)
  285. call ReadRc( rcF, 'use_macc', LMACC, status, default=.false. )
  286. IF_ERROR_RETURN(status=1)
  287. call ReadRc( rcF, 'use_lpj', LLPJ, status, default=.false. )
  288. IF_ERROR_RETURN(status=1)
  289. call ReadRc( rcF, 'use_hymn', LHYMN, status, default=.false. )
  290. IF_ERROR_RETURN(status=1)
  291. call ReadRc( rcF, 'use_maccity', LMACCITY,status, default=.false. )
  292. IF_ERROR_RETURN(status=1)
  293. IF(LMACCITY) LMACC=.true. ! ensure that MACC data are read. LMACCITY just add anthro sector to MACC's sector list.
  294. call ReadRc( rcF, 'use_megan', LMEGAN, status, default=.false. )
  295. IF_ERROR_RETURN(status=1)
  296. ! very basic checks
  297. if (count((/ LCMIP6, LAR5, LEDGAR4, LMACCITY /)) > 1) then
  298. write(gol,*) 'ERROR: You use more than one ANTHROPOGENIC inventory'; call goErr
  299. status=1; TRACEBACK; return
  300. end if
  301. if (count((/ LCMIP6BMB, LAR5BMB, LRETROF, LGFED3 /)) > 1) then
  302. write(gol,*) 'ERROR: You use more than one BIOMASS BURNING inventory'; call goErr
  303. status=1; TRACEBACK; return
  304. end if
  305. ! CH4
  306. call ReadRc( rcF, 'input.conc.ch4.cmip6', LCMIP6_CH4, status, default=.true. )
  307. IF_ERROR_RETURN(status=1)
  308. if (.not.LCMIP6_CH4 .and. (LCMIP6 .and. LCMIP6BMB) ) then
  309. write(gol,'("ERROR: When using CMIP6 emissions, CMIP6 CH4 mixing ratios should be used")'); call goErr
  310. status=1; TRACEBACK; return
  311. endif
  312. if (LCMIP6_CH4) then
  313. #ifdef with_ch4_emis
  314. write (gol,'("Surface CH4 will be nudged to zonal mean values from CMIP6")'); call goPr
  315. #else
  316. write(gol,'("WARNING: CH4 emissions are not used")'); call goPr
  317. write(gol,'("WARNING: Surface CH4 will be fixed to zonal mean values from CMIP6")'); call goPr
  318. #endif
  319. if (.not.LCMIP6 .or. .not.LCMIP6BMB) then
  320. write(gol,'("WARNING: CMIP6 CH4 mixing ratios used, while CMIP6 emissions are not")'); call goPr
  321. endif
  322. ! dir with the monthly data (yearly data for stratosphere read in boundary.F90)
  323. CALL ReadRc( rcF, 'input.conc.ch4.cmip6.dir.month', cmip6_ch4_dirname, status )
  324. IF_NOTOK_RETURN(status=1)
  325. emis_ch4_single = .false.
  326. else
  327. call ReadRc( rcF, 'input.emis.ch4.single', emis_ch4_single, status )
  328. IF_NOTOK_RETURN(status=1)
  329. if ( emis_ch4_single ) then
  330. #ifdef with_ch4_emis
  331. write (gol,'("ERROR: Switch off CH4 emissions when using a single mixing ratio")'); call goErr
  332. status=1; TRACEBACK; return
  333. #endif
  334. call ReadRc( rcF, 'input.emis.ch4.fixed_ppb', emis_ch4_fixed_ppb, status )
  335. IF_NOTOK_RETURN(status=1)
  336. call ReadRc( rcF, 'input.emis.ch4.fix3d', emis_ch4_fix3d, status, default=.true. )
  337. IF_NOTOK_RETURN(status=1)
  338. if ( emis_ch4_fix3d ) then
  339. write (gol,*) '3-D CH4 will be fixed to ', emis_ch4_fixed_ppb, ' ppb'; call goPr
  340. else
  341. write (gol,*) 'Surface CH4 will be fixed to ', emis_ch4_fixed_ppb, ' ppb'; call goPr
  342. endif
  343. else
  344. call ReadRc( rcF, 'input.emis.ch4.surf', emis_zch4_fname, status )
  345. IF_NOTOK_RETURN(status=1)
  346. #ifdef with_ch4_emis
  347. write (gol,'("Surface CH4 will be nudged to a zonal background field")'); call goPr
  348. #else
  349. write(gol,'("WARNING: CH4 emissions are not used")'); call goPr
  350. write(gol,'("WARNING: Surface CH4 will be fixed to a zonal background field")'); call goPr
  351. #endif
  352. endif
  353. endif
  354. ! init providers info
  355. call emission_read_init( rcF, status )
  356. #ifdef with_online_nox
  357. call ReadRc( rcF, 'input.onlinenox.dir', input_nox_dir, status )
  358. IF_NOTOK_RETURN(status=1)
  359. #endif
  360. ! are convection fluxes computed (Tiedkte) or read?
  361. call ReadRc( rcF, 'tiedtke', use_tiedkte, status )
  362. IF_NOTOK_RETURN(status=1)
  363. #ifdef with_m7
  364. call ReadRc( rcF, 'input.emis.dir.aerocom', emis_input_dir_aerocom, status, default=emis_input_dir )
  365. IF_NOTOK_RETURN(status=1)
  366. call ReadRc( rcF, 'input.emis.dust', emis_input_dust, status, default="AEROCOM" )
  367. IF_NOTOK_RETURN(status=1)
  368. call ReadRc( rcF, 'input.emis.dir.dust', emis_input_dir_dust, status, default=emis_input_dir )
  369. IF_NOTOK_RETURN(status=1)
  370. call ReadRc( rcF, 'input.nucleation.scheme', nnucl, status )
  371. IF_NOTOK_RETURN(status=1)
  372. call ReadRc( rcF, 'input.soa.scheme', nsoa, status )
  373. IF_NOTOK_RETURN(status=1)
  374. if (nsoa==2) then
  375. write (gol,*) 'INFO: Chemical production of SOA '; call goPr
  376. end if
  377. call ReadRc( rcF, 'input.KK.d_form', d_form, status, default=5.0 )
  378. IF_ERROR_RETURN(status=1)
  379. write (gol,*) 'INFO: Diameter of formed particles in Kerminen&Kulmala parammeterization ',d_form, ' nm' ; call goPr
  380. call ReadRc( rcF, 'input.soa.isoprene_on', isoprene_on, status, default=.true. )
  381. IF_ERROR_RETURN(status=1)
  382. if (isoprene_on) then
  383. write (gol,*) 'INFO: production of SOA from isoprene on'; call goPr
  384. end if
  385. ! Output info on the chosen new particle formation scheme
  386. ! and force unknown scheme into Vehkamaki et al.
  387. if (nnucl==1) then
  388. write (gol,*) 'INFO: Nucleation scheme Vehkamaki et al. '; call goPr
  389. else if (nnucl==2) then
  390. write (gol,*) 'INFO: Nucleation scheme Kulmala et al. '; call goPr
  391. else if (nnucl==3) then
  392. write (gol,*) 'INFO: Nucleation scheme Paasonen et al. '; call goPr
  393. else if (nnucl==4) then
  394. write (gol,*) 'INFO: Nucleation scheme Riccobono et al. '; call goPr
  395. else
  396. write (gol,*) 'INFO: Nucleation scheme ',nnucl,' not recognised. ' ; call goPr
  397. nnucl=1
  398. write (gol,*) 'INFO: Using Vehkamaki et al. (nnucl = ',nnucl,') ' ; call goPr
  399. end if
  400. ! end SUBROUTINE EMISSION_INIT
  401. #endif
  402. call ReadRc( rcF, 'input.emis.dir.dms', emis_input_dir_dms, status, default=emis_input_dir )
  403. IF_NOTOK_RETURN(status=1)
  404. call ReadRc( rcF, 'input.emis.dir.rn222', emis_input_dir_rn222, status, default=emis_input_dir )
  405. IF_ERROR_RETURN(status=1)
  406. ! Get biomassburning time splitting factors (same for all constituents)
  407. ! -----------------------------------------------------------------------------------
  408. call ReadRc( rcF, 'input.emis.bb.dailycycle', emis_bb_trop_cycle, status, default=.false. )
  409. IF_ERROR_RETURN(status=1)
  410. if (emis_bb_trop_cycle) then
  411. do region = 1, nregions
  412. dtime = float(ndyn_max)/(2*tref(region)) ! timestep emissions (CMK changed 5/2006)
  413. ntim = 86400/nint(dtime) ! number of timesteps in 24 hours for this region
  414. allocate(bb_cycle(region)%scalef(ntim))
  415. call scale_cycle(ntim, bb_cycle(region)%scalef)
  416. end do
  417. end if
  418. ! used by vertical distribution:
  419. CALL Set( oro_dat(iglbsfc), status, used=.TRUE. )
  420. ! Allocate data
  421. ! -------------
  422. DO region=1,nregions
  423. CALL GET_DISTGRID( dgrid(region), I_STRT=i1, I_STOP=i2, J_STRT=j1, J_STOP=j2 )
  424. lmr = lm(region)
  425. ALLOCATE( plandr(region)%surf(i1:i2, j1:j2))
  426. ALLOCATE( emis2D(region)%surf(i1:i2, j1:j2))
  427. #ifdef with_m7
  428. ! aerosols (up to lmr instead of bb_lm)
  429. DO imode=1,nmod
  430. ALLOCATE(emis_number(region,imode)%d4( i1:i2, j1:j2, lmr, mode_nm(imode)))
  431. ALLOCATE(emis_mass (region,imode)%d4( i1:i2, j1:j2, lmr, mode_nm(imode)))
  432. ENDDO
  433. ALLOCATE(emis_temp(region)%surf(i1:i2, j1:j2))
  434. #endif
  435. #ifdef with_budgets
  436. ALLOCATE( budemi_dat(region)%emi(i1:i2, j1:j2, nbud_vg, ntracet) )
  437. budemi_dat(region)%emi = 0.0
  438. sum_emission(region) = 0.0
  439. #endif
  440. ENDDO
  441. ! Done
  442. ! -------------
  443. call Done( rcF, status )
  444. IF_NOTOK_RETURN(status=1)
  445. ! define timers:
  446. call GO_Timer_Def( itim_appl, 'emission appl', status )
  447. IF_NOTOK_RETURN(status=1)
  448. call GO_Timer_Def( itim_co, 'emission co', status )
  449. IF_NOTOK_RETURN(status=1)
  450. call GO_Timer_Def( itim_voc, 'emission voc', status )
  451. IF_NOTOK_RETURN(status=1)
  452. call GO_Timer_Def( itim_dms, 'emission dms', status )
  453. IF_NOTOK_RETURN(status=1)
  454. call GO_Timer_Def( itim_nh3, 'emission nh3', status )
  455. IF_NOTOK_RETURN(status=1)
  456. call GO_Timer_Def( itim_sox, 'emission sox', status )
  457. IF_NOTOK_RETURN(status=1)
  458. call GO_Timer_Def( itim_ch4, 'emission ch4 ', status )
  459. IF_NOTOK_RETURN(status=1)
  460. call GO_Timer_Def( itim_isop, 'emission isop', status )
  461. IF_NOTOK_RETURN(status=1)
  462. call GO_Timer_Def( itim_rn222, 'emission rn222', status )
  463. IF_NOTOK_RETURN(status=1)
  464. status = 0
  465. END SUBROUTINE EMISSION_INIT
  466. !EOC
  467. !------------------------------------------------------------------------------
  468. ! TM5 !
  469. !------------------------------------------------------------------------------
  470. !BOP
  471. !
  472. ! !IROUTINE: EMISSION_DONE
  473. !
  474. ! !DESCRIPTION: calculate and write final budgets
  475. !\\
  476. !\\
  477. ! !INTERFACE:
  478. !
  479. SUBROUTINE EMISSION_DONE( status )
  480. !
  481. ! !USES:
  482. !
  483. USE dims, ONLY : nregions, im, jm
  484. #ifdef with_budgets
  485. USE chem_param, ONLY : ntracet, names
  486. USE budget_global, ONLY : budget_file_global, nbud_vg, budg_dat, nbudg, NHAB
  487. USE file_hdf, ONLY : THdfFile, TSds
  488. USE file_hdf, ONLY : Init, Done, WriteAttribute, WriteData, SetDim
  489. USE Dims, ONLY : region_name
  490. USE partools, ONLY : isRoot, par_reduce, par_reduce_element
  491. #endif
  492. use emission_data, only : bb_cycle
  493. use emission_data, only : emis_bb_trop_cycle
  494. !
  495. ! !OUTPUT PARAMETERS:
  496. !
  497. INTEGER, INTENT(out) :: status
  498. !
  499. ! !REVISION HISTORY:
  500. ! 16 Jul 2010 - A. Strunk -
  501. ! 27 Mar 2012 - P. Le Sager - adapted for lon-lat MPI domain decomposition
  502. !
  503. !EOP
  504. !------------------------------------------------------------
  505. !BOC
  506. CHARACTER(len=*), PARAMETER :: rname = mname//'/Emission_Done'
  507. INTEGER :: region, i1, i2, j1, j2
  508. #ifdef with_budgets
  509. TYPE(THdfFile) :: io
  510. TYPE(TSds) :: sds
  511. REAL, DIMENSION(:,:,:,:), ALLOCATABLE :: collect_emissions
  512. INTEGER :: nsend,j,i,n,nzone,nzone_v
  513. real, dimension(nregions) :: sum_emission_all
  514. #endif
  515. ! --- begin ---------------------------------
  516. #ifdef with_budgets
  517. ! add up contribution from all proc
  518. DO region = 1, nregions
  519. CALL PAR_REDUCE(sum_emission(region), 'SUM', sum_emission_all(region), status)
  520. IF_NOTOK_RETURN(status=1)
  521. END DO
  522. ! Write global budget of tracer #1
  523. IF ( isRoot ) THEN
  524. write (gol,'("EMISS-INFO - ----------------------------------------------")'); call goPr
  525. write (gol,'("EMISS-INFO - Budget of tracer ",a," (kg) ")') trim(names(1)) ; call goPr
  526. write (gol,'("EMISS-INFO - ----------------------------------------------")'); call goPr
  527. do region = 1, nregions
  528. write (gol,'(A,E13.6)') 'EMISS-INFO - mass emitted : ',sum_emission(region); call goPr
  529. enddo
  530. CALL Init(io, budget_file_global, 'write', status)
  531. IF_NOTOK_RETURN(status=1)
  532. CALL WriteAttribute(io, 'sum_emission', sum_emission_all, status)
  533. IF_NOTOK_RETURN(status=1)
  534. budemig = 0.0
  535. END IF
  536. ! Gather budgets
  537. REG: DO region = 1, nregions
  538. CALL GET_DISTGRID( dgrid(region), I_STRT=i1, I_STOP=i2, J_STRT=j1, J_STOP=j2 )
  539. if (isRoot) then
  540. ALLOCATE(collect_emissions(im(region), jm(region), nbud_vg, ntracet))
  541. else
  542. ALLOCATE(collect_emissions(1,1,1,1) )
  543. end if
  544. CALL GATHER( dgrid(region), budemi_dat(region)%emi, collect_emissions, 0, status)
  545. IF_NOTOK_RETURN(status=1)
  546. ! write Not-Horizontally-Aggregated-Budgets
  547. IF (isRoot.and.NHAB) THEN
  548. CALL Init(Sds,io, 'budemi_dat_'//region_name(region),(/im(region),jm(region),nbud_vg,ntracet/), 'real(4)', status)
  549. CALL SetDim(Sds, 0, 'im_'//region_name(region),'longitude', (/(j, j=1,im(region))/), status)
  550. CALL SetDim(Sds, 1, 'jm_'//region_name(region),'latitude', (/(j, j=1,jm(region))/), status)
  551. CALL SetDim(Sds, 2, 'nbud_vg','vertical layer', (/(j, j=1,nbud_vg)/), status)
  552. CALL SetDim(Sds, 3, 'ntracet','tracer number', (/(j, j=1,ntracet)/), status)
  553. IF_NOTOK_RETURN(status=1)
  554. CALL WriteData(Sds,collect_emissions,status)
  555. IF_NOTOK_RETURN(status=1)
  556. CALL Done(Sds, status)
  557. IF_NOTOK_RETURN(status=1)
  558. ENDIF
  559. ! horizontally aggregates budgets
  560. DO n=1,ntracet
  561. DO nzone_v=1,nbud_vg
  562. DO j=j1,j2
  563. DO i=i1,i2
  564. nzone = budg_dat(region)%nzong(i,j)
  565. budemig(nzone,nzone_v,n) = budemig(nzone,nzone_v,n) + budemi_dat(region)%emi(i,j,nzone_v,n)
  566. END DO
  567. END DO !j
  568. END DO !nzone_v
  569. END DO !nt
  570. DEALLOCATE( collect_emissions )
  571. DEALLOCATE( budemi_dat(region)%emi )
  572. ENDDO REG
  573. CALL PAR_REDUCE_ELEMENT( budemig, 'SUM', budemig_all, status)
  574. IF_NOTOK_RETURN(status=1)
  575. ! Write horizontally aggregated budget
  576. IF ( isRoot ) THEN
  577. CALL Init(Sds,io, 'budemi',(/nbudg,nbud_vg,ntracet/), 'real(8)', status)
  578. IF_NOTOK_RETURN(status=1)
  579. CALL SetDim(Sds, 0, 'nbudg','horizontal region', (/(j, j=1,nbudg)/), status)
  580. CALL SetDim(Sds, 1, 'nbud_vg','vertical layer', (/(j, j=1,nbud_vg)/), status)
  581. CALL SetDim(Sds, 2, 'ntracet','tracer number', (/(j, j=1,ntracet)/), status)
  582. IF_NOTOK_RETURN(status=1)
  583. CALL WriteData(Sds,budemig_all,status)
  584. IF_NOTOK_RETURN(status=1)
  585. CALL Done(Sds, status)
  586. IF_NOTOK_RETURN(status=1)
  587. CALL Done(io, status)
  588. IF_NOTOK_RETURN(status=1)
  589. ENDIF
  590. #endif /* BUDGETS */
  591. ! call other emission_*_done routines
  592. CALL FREE_EMISSION(status)
  593. IF_NOTOK_RETURN(status=1)
  594. ! -----------------------------------------------------------------------------------
  595. ! Free biomassburning time splitting factors (now globally, instead of by constituent)
  596. if( emis_bb_trop_cycle ) then
  597. do region = 1, nregions
  598. deallocate(bb_cycle(region)%scalef)
  599. end do
  600. end if
  601. ! -----------------------------------------------------------------------------------
  602. ! ok
  603. status = 0
  604. END SUBROUTINE EMISSION_DONE
  605. !EOC
  606. !---------------------------------------------------------------------------
  607. ! TM5 !
  608. !---------------------------------------------------------------------------
  609. !BOP
  610. !
  611. ! !IROUTINE: DECLARE_EMISSION
  612. !
  613. ! !DESCRIPTION: Called at run start (init/allocate emiss data) and then at
  614. ! beginning of every month to just read in data.
  615. ! Called from SS_MONTHLY_UPDATE.
  616. !\\
  617. !\\
  618. ! !INTERFACE:
  619. !
  620. SUBROUTINE DECLARE_EMISSION( status )
  621. !
  622. ! !USES:
  623. !
  624. USE Grid, ONLY : FillGrid
  625. USE MDF, ONLY : MDF_Open, MDF_HDF4, MDF_READ, MDF_Inq_VarID, MDF_Get_Var, MDF_Close
  626. USE dims, ONLY : im, jm, lm, newsrun
  627. USE dims, ONLY : nregions, iglbsfc, nlat180, nlon360
  628. USE chem_param
  629. #ifdef with_m7
  630. USE mo_aero_m7, ONLY : nmod
  631. #endif
  632. USE partools, ONLY : isRoot
  633. USE global_data, ONLY : emis_data
  634. USE meteodata, ONLY : global_lli
  635. #ifdef with_online_nox
  636. use Online_NOx, only : Online_NOx_Init
  637. ! use online_nox_data, only : mlai2d_onlinenox
  638. #endif
  639. #ifdef with_online_bvoc
  640. USE Emission_BVOC, ONLY : Online_BVOC_Init
  641. #endif
  642. ! AR5/EDGAR4
  643. use emission_data, only : emis_input_dir
  644. !
  645. ! !OUTPUT PARAMETERS:
  646. !
  647. INTEGER, INTENT(out) :: status
  648. !
  649. ! !REVISION HISTORY:
  650. ! 16 Jul 2010 - A. Strunk - Adapted to revised emission_*.F90 routines
  651. ! 27 Mar 2012 - P. Le Sager - adapted for lon-lat MPI domain decomposition
  652. !
  653. ! !REMARKS:
  654. ! - anything that is done only if it's a newrun, and that does not require meteo data, should go in INIT
  655. !
  656. !EOP
  657. !------------------------------------------------------------------------------
  658. !BOC
  659. CHARACTER(len=*), PARAMETER :: rname = mname//'/declare_emission'
  660. INTEGER :: region, imode, hid
  661. REAL, DIMENSION(:,:), ALLOCATABLE :: pland
  662. type(emis_data), dimension(nregions) :: wrk
  663. ! -----------------
  664. ! Reset M7 emission
  665. ! -----------------
  666. #ifdef with_m7
  667. DO region=1,nregions
  668. DO imode=1,nmod
  669. emis_number(region,imode)%d4 = 0.0
  670. emis_mass (region,imode)%d4 = 0.0
  671. END DO
  672. END DO
  673. #endif
  674. ! ---------------------------------------------------------------
  675. ! ** land fraction
  676. ! ---------------------------------------------------------------
  677. IF( newsrun ) THEN
  678. if(isRoot)then
  679. ALLOCATE( pland(nlon360,nlat180) )
  680. DO region=1,nregions
  681. allocate( wrk(region)%surf(im(region),jm(region)) )
  682. end DO
  683. else
  684. ALLOCATE( pland(1,1) )
  685. DO region=1,nregions
  686. allocate( wrk(region)%surf(1,1))
  687. end DO
  688. end if
  689. if (isRoot)then
  690. CALL MDF_Open( TRIM(emis_input_dir)//'/land/landfraction.hdf', MDF_HDF4, MDF_READ, hid, status )
  691. IF_NOTOK_RETURN(status=1)
  692. ! CALL MDF_Inq_VarID( hid, TRIM(filemon), varid, status ) ! more than one 'landfraction' sds
  693. ! IF_NOTOK_RETURN(status=1)
  694. CALL MDF_Get_Var( hid, 1, pland, status )
  695. IF_NOTOK_RETURN(status=1)
  696. CALL MDF_Close( hid, status )
  697. IF_NOTOK_RETURN(status=1)
  698. ! coarsen or distribute to zoom regions:
  699. DO region = 1, nregions
  700. ! convert grid:
  701. CALL FillGrid( global_lli(region), 'n', wrk(region)%surf, &
  702. global_lli(iglbsfc), 'n', pland, 'area-aver', status )
  703. IF_NOTOK_RETURN(status=1)
  704. END DO
  705. end if
  706. DO region = 1, nregions
  707. call scatter( dgrid(region), plandr(region)%surf, wrk(region)%surf, 0, status)
  708. IF_NOTOK_RETURN(status=1)
  709. DEALLOCATE( wrk(region)%surf )
  710. END DO
  711. DEALLOCATE( pland )
  712. ENDIF
  713. ! ---------------------------------------------------------------
  714. ! ** init each constituent
  715. ! ---------------------------------------------------------------
  716. ! ** 1st time, initialise emissions
  717. IF ( newsrun ) THEN
  718. CALL Emission_NOx_Init( status )
  719. IF_NOTOK_RETURN(status=1)
  720. #ifdef with_online_nox
  721. ! init online nox module:
  722. CALL Online_NOx_Init( status )
  723. IF_NOTOK_RETURN(status=1)
  724. #endif
  725. CALL Emission_NMVOC_Init( status )
  726. IF_NOTOK_RETURN(status=1)
  727. CALL Emission_NH3_Init( status )
  728. IF_NOTOK_RETURN(status=1)
  729. CALL Emission_CO_Init( status )
  730. IF_NOTOK_RETURN(status=1)
  731. CALL Emission_CH4_Init( status )
  732. IF_NOTOK_RETURN(status=1)
  733. CALL Emission_SOx_Init( status )
  734. IF_NOTOK_RETURN(status=1)
  735. CALL Emission_DMS_Init( status )
  736. IF_NOTOK_RETURN(status=1)
  737. CALL Emission_rn222_Init( status )
  738. IF_NOTOK_RETURN(status=1)
  739. #ifdef with_m7
  740. call emission_bc_init( status )
  741. IF_NOTOK_RETURN(status=1)
  742. call emission_pom_init( status )
  743. IF_NOTOK_RETURN(status=1)
  744. #endif
  745. END IF
  746. ! ** every month, read and re-grid
  747. CALL emission_nox_declare( status )
  748. IF_NOTOK_RETURN(status=1)
  749. CALL emission_nmvoc_declare( status )
  750. IF_NOTOK_RETURN(status=1)
  751. CALL emission_nh3_declare( status )
  752. IF_NOTOK_RETURN(status=1)
  753. CALL emission_co_declare( status )
  754. IF_NOTOK_RETURN(status=1)
  755. CALL emission_ch4_declare( status )
  756. IF_NOTOK_RETURN(status=1)
  757. CALL emission_sox_declare( status )
  758. IF_NOTOK_RETURN(status=1)
  759. CALL emission_dms_declare( status )
  760. IF_NOTOK_RETURN(status=1)
  761. ! ** special case of bio voc/isoprene
  762. #ifdef with_online_bvoc
  763. CALL Online_BVOC_Init( status )
  764. IF_NOTOK_RETURN(status=1)
  765. CALL declare_emission_bvoc( status )
  766. #else
  767. IF ( newsrun ) THEN
  768. CALL Emission_isop_Init( status )
  769. IF_NOTOK_RETURN(status=1)
  770. CALL Emission_terp_Init( status )
  771. IF_NOTOK_RETURN(status=1)
  772. END IF
  773. CALL emission_isop_declare( status )
  774. IF_NOTOK_RETURN(status=1)
  775. CALL emission_terp_declare( status )
  776. IF_NOTOK_RETURN(status=1)
  777. #endif
  778. CALL emission_rn222_declare( status )
  779. IF_NOTOK_RETURN(status=1)
  780. #ifdef with_m7
  781. CALL emission_bc_declare( status)
  782. IF_NOTOK_RETURN(status=1)
  783. CALL emission_pom_declare( status )
  784. IF_NOTOK_RETURN(status=1)
  785. CALL emission_dust_declare(status)
  786. IF_NOTOK_RETURN(status=1)
  787. !!$ CALL declare_emission_ss(status)
  788. !!$ IF_NOTOK_RETURN(status=1)
  789. #endif
  790. ! ok
  791. status = 0
  792. END SUBROUTINE DECLARE_EMISSION
  793. !EOC
  794. !-------------------------------------------------------------------
  795. ! TM5 !
  796. !-------------------------------------------------------------------
  797. !BOP
  798. !
  799. ! !IROUTINE: EMISSION_APPLY
  800. !
  801. ! !DESCRIPTION: Call emission_apply methods of constituent modules.
  802. ! --> add current emissions to tracers array.
  803. !\\
  804. !\\
  805. ! !INTERFACE:
  806. !
  807. SUBROUTINE EMISSION_APPLY( region, status )
  808. !
  809. ! !USES:
  810. !
  811. USE chem_param
  812. !
  813. ! !INPUT PARAMETERS:
  814. !
  815. INTEGER, INTENT(in) :: region
  816. !
  817. ! !OUTPUT PARAMETERS:
  818. !
  819. INTEGER, INTENT(out) :: status
  820. !
  821. ! !REVISION HISTORY:
  822. ! 16 Jul 2010 - A. Strunk - Adapted to revised emission_*.F90 routines
  823. ! 27 Mar 2012 - P. Le Sager - cleanup for lat-lon mpi decomposition
  824. !
  825. !EOP
  826. !-----------------------------------------------------------------
  827. !BOC
  828. CHARACTER(len=*), PARAMETER :: rname = mname//'/emission_apply'
  829. ! --- begin --------------------------------------
  830. ! start timing:
  831. call GO_Timer_Start( itim_appl, status )
  832. IF_NOTOK_RETURN(status=1)
  833. IF (okdebug) then
  834. WRITE(gol,*) 'start of emission_apply for region:',region ; call goPr
  835. END IF
  836. ! CO emissions
  837. call GO_Timer_Start( itim_co, status )
  838. IF_NOTOK_RETURN(status=1)
  839. CALL emission_co_apply( region, status )
  840. IF_NOTOK_RETURN(status=1)
  841. call GO_Timer_End( itim_co, status )
  842. IF_NOTOK_RETURN(status=1)
  843. ! CH4 emissions
  844. call GO_Timer_Start( itim_ch4, status )
  845. IF_NOTOK_RETURN(status=1)
  846. CALL emission_ch4_apply(region, status )
  847. IF_NOTOK_RETURN(status=1)
  848. call GO_Timer_End( itim_ch4, status )
  849. IF_NOTOK_RETURN(status=1)
  850. ! biogenic NMHC emissions (isoprene)
  851. call GO_Timer_Start( itim_isop, status )
  852. IF_NOTOK_RETURN(status=1)
  853. #ifdef with_online_bvoc
  854. CALL emission_apply_bvoc( region, status )
  855. #else
  856. CALL emission_isop_apply( region, status )
  857. IF_NOTOK_RETURN(status=1)
  858. CALL emission_terp_apply( region, status )
  859. IF_NOTOK_RETURN(status=1)
  860. #endif
  861. call GO_Timer_End( itim_isop, status )
  862. IF_NOTOK_RETURN(status=1)
  863. ! add di-methyl sulfide emissions:
  864. call GO_Timer_Start( itim_dms, status )
  865. IF_NOTOK_RETURN(status=1)
  866. CALL emission_dms_apply(region, status)
  867. IF_NOTOK_RETURN(status=1)
  868. call GO_Timer_End( itim_dms, status )
  869. IF_NOTOK_RETURN(status=1)
  870. ! add SOx emissions:
  871. call GO_Timer_Start( itim_sox, status )
  872. IF_NOTOK_RETURN(status=1)
  873. CALL emission_sox_apply( region, status )
  874. IF_NOTOK_RETURN(status=1)
  875. call GO_Timer_End( itim_sox, status )
  876. IF_NOTOK_RETURN(status=1)
  877. ! add NH3 emissions:
  878. call GO_Timer_Start( itim_nh3, status )
  879. IF_NOTOK_RETURN(status=1)
  880. CALL emission_nh3_apply(region, status)
  881. IF_NOTOK_RETURN(status=1)
  882. call GO_Timer_End( itim_nh3, status )
  883. IF_NOTOK_RETURN(status=1)
  884. ! add Rn222 emissions:
  885. call GO_Timer_Start( itim_rn222, status )
  886. IF_NOTOK_RETURN(status=1)
  887. CALL emission_rn222_apply(region, status)
  888. IF_NOTOK_RETURN(status=1)
  889. call GO_Timer_End( itim_rn222, status )
  890. IF_NOTOK_RETURN(status=1)
  891. ! black carbon and particulate organic matter emissions are added in the sedimentation routine...
  892. ! seasalt and dust (which also sediment) are added in tracer_after_read...
  893. ! add non-methane voc emissions:
  894. call GO_Timer_Start( itim_voc, status )
  895. IF_NOTOK_RETURN(status=1)
  896. CALL emission_nmvoc_apply( region, status )
  897. IF_NOTOK_RETURN(status=1)
  898. call GO_Timer_End( itim_voc, status )
  899. IF_NOTOK_RETURN(status=1)
  900. IF(okdebug) then
  901. WRITE(gol,*) 'End of adding emission '; call goPr
  902. END IF
  903. ! end timing:
  904. call GO_Timer_End( itim_appl, status )
  905. IF_NOTOK_RETURN(status=1)
  906. ! ok
  907. status = 0
  908. END SUBROUTINE EMISSION_APPLY
  909. !EOC
  910. !----------------------------------------------------------------------------
  911. ! TM5 !
  912. !----------------------------------------------------------------------------
  913. !BOP
  914. !
  915. ! !IROUTINE: FREE_EMISSION
  916. !
  917. ! !DESCRIPTION: Deallocate space needed to handle the emissions by calling
  918. ! *done methods of constituents' modules.
  919. !\\
  920. !\\
  921. ! !INTERFACE:
  922. !
  923. SUBROUTINE FREE_EMISSION( status )
  924. !
  925. ! !USES:
  926. !
  927. USE dims, ONLY : nregions
  928. #ifdef with_m7
  929. USE mo_aero_m7, ONLY : nmod
  930. #endif
  931. #ifdef with_online_nox
  932. USE Online_NOx, ONLY : Online_NOx_Done
  933. #endif
  934. #ifdef with_online_bvoc
  935. USE Emission_BVOC, ONLY : Online_BVOC_Done
  936. #endif
  937. !
  938. ! !OUTPUT PARAMETERS:
  939. !
  940. INTEGER, INTENT(out) :: status
  941. !
  942. ! !REVISION HISTORY:
  943. ! 16 Jul 2010 - A. Strunk - Adapted to revised emission_*.F90 routines
  944. ! 27 Mar 2012 - P. Le Sager - Adapted for lon-lat MPI domain decomposition
  945. !
  946. !EOP
  947. !---------------------------------------------------------------------------
  948. !BOC
  949. CHARACTER(len=*), PARAMETER :: rname = mname//'/free_emission'
  950. INTEGER :: region, imode
  951. ! --- begin -----------------------------------
  952. DO region = 1, nregions
  953. DEALLOCATE(plandr(region)%surf)
  954. DEALLOCATE(emis2D(region)%surf)
  955. #ifdef with_m7
  956. ! aerosols:
  957. DO imode = 1, nmod
  958. DEALLOCATE(emis_number(region,imode)%d4)
  959. DEALLOCATE(emis_mass(region,imode)%d4)
  960. ENDDO
  961. DEALLOCATE(emis_temp(region)%surf)
  962. #endif
  963. ENDDO
  964. CALL Emission_NOx_Done( status )
  965. IF_NOTOK_RETURN(status=1)
  966. #ifdef with_online_nox
  967. CALL Online_NOx_Done( status )
  968. IF_NOTOK_RETURN(status=1)
  969. #endif
  970. CALL emission_nh3_done( status )
  971. IF_NOTOK_RETURN(status=1)
  972. CALL Emission_CO_Done( status )
  973. IF_NOTOK_RETURN(status=1)
  974. CALL Emission_CH4_Done( status )
  975. IF_NOTOK_RETURN(status=1)
  976. CALL Emission_SOx_Done( status )
  977. IF_NOTOK_RETURN(status=1)
  978. CALL emission_dms_done( status )
  979. IF_NOTOK_RETURN(status=1)
  980. #ifdef with_online_bvoc
  981. CALL free_emission_bvoc ( status )
  982. ! done with online bvoc module:
  983. CALL Online_BVOC_Done( status )
  984. IF_NOTOK_RETURN(status=1)
  985. #else
  986. CALL Emission_isop_Done ( status )
  987. IF_NOTOK_RETURN(status=1)
  988. CALL Emission_terp_Done ( status )
  989. IF_NOTOK_RETURN(status=1)
  990. #endif
  991. CALL emission_rn222_done( status )
  992. IF_NOTOK_RETURN(status=1)
  993. #ifdef with_m7
  994. CALL emission_bc_done( status )
  995. IF_NOTOK_RETURN(status=1)
  996. CALL emission_pom_done( status )
  997. IF_NOTOK_RETURN(status=1)
  998. CALL emission_dust_done
  999. !!$ CALL free_emission_ss
  1000. #endif
  1001. CALL Emission_NMVOC_Done( status )
  1002. IF_NOTOK_RETURN(status=1)
  1003. ! done
  1004. status = 0
  1005. END SUBROUTINE FREE_EMISSION
  1006. !EOC
  1007. END MODULE EMISSION