emission.F90 42 KB

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