emission_read.F90 142 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151
  1. !
  2. #define TRACEBACK write (gol,'("in ",a," (",a,i6,")")') rname, __FILE__, __LINE__ ; call goErr
  3. #define IF_NOTOK_RETURN(action) if (status/=0) then; TRACEBACK; action; return; end if
  4. #define IF_ERROR_RETURN(action) if (status> 0) then; TRACEBACK; action; return; end if
  5. !
  6. #include "tm5.inc"
  7. !
  8. !-----------------------------------------------------------------------------
  9. ! TM5 !
  10. !-----------------------------------------------------------------------------
  11. !BOP
  12. !
  13. ! !MODULE: EMISSION_READ
  14. !
  15. ! !DESCRIPTION: This module provides objects and methods related to
  16. ! IPCC-AR5, EDGAR-4, RETRO_FIRES, LPJ and MACC emissions.
  17. !
  18. ! AR5 netCDF files are provided by FZ-Juelich and IIASA:
  19. ! ftp://ftp-ipcc.fz-juelich.de/pub/emissions/gridded_netcdf/
  20. ! http://www.iiasa.ac.at/web-apps/tnt/RcpDb/
  21. !
  22. ! These data sets are not covering natural emissions. For these
  23. ! sources additional data from the MACC project are used (sectors
  24. ! ocean, soil, biogenic and natural, see below).
  25. !
  26. ! There are a few keys in the rc-file which control the behaviour of
  27. ! this module and the data used:
  28. ! # specify the (main) provider of emission sets
  29. ! input.emis.provider : AR5
  30. ! # where to find the emissions (this will be used by install-emis-ar5)
  31. ! input.emis.dir : ${TEMP}/EMIS/AR5
  32. ! # year of emissions (AR5 emissions will be linearly interpolated)
  33. ! input.emis.year : 2000
  34. ! # choose RCP out of RCP26, RCP45, RCP60, RCP85
  35. ! input.emis.AR5.RCP : RCP45
  36. !
  37. !\\
  38. !\\
  39. ! !INTERFACE:
  40. !
  41. MODULE EMISSION_READ
  42. !
  43. ! !USES:
  44. !
  45. use GO, only : gol, goErr, goPr, goLabel
  46. use emission_data, only : emis_input_dir_ar5
  47. use emission_data, only : emis_input_dir_ed4, emis_input_dir_mac
  48. use emission_data, only : vd_class_name_len
  49. use dims, only : nlon360, nlat180, iglbsfc
  50. use chem_param, only : ncb4
  51. use chem_param, only : xmc, xmh, xmch2o, xmeth, xmgly
  52. use chem_param, only : xmole, xmald2, xmpar, xmo
  53. use Dims, only : okdebug
  54. USE MDF, ONLY : MDF_Open, MDF_NETCDF, MDF_HDF4, MDF_READ
  55. USE MDF, ONLY : MDF_Inq_VarID, MDF_Get_Var, MDF_Close
  56. implicit none
  57. private
  58. !
  59. ! !PUBLIC MEMBER FUNCTIONS:
  60. !
  61. public :: emission_read_init, emission_read_done
  62. !!$ public :: emission_ar5_readcategory
  63. public :: emission_ar5_regrid_aircraft
  64. public :: numb_2dsec, numb_3dsec
  65. public :: numb_sectors, sectors_def
  66. public :: numb_providers, providers_def
  67. public :: sector_name_len
  68. public :: emission_ar5_readsector
  69. public :: emission_macc_readsector
  70. public :: emission_ed4_readsector
  71. public :: emission_gfed_readsector
  72. public :: emission_retro_readsector
  73. public :: emission_lpj_readsector
  74. public :: emission_hymn_readsector
  75. public :: emission_megan_readsector
  76. public :: ar5_dim_3ddata
  77. public :: emis_ar5_voc2cbm4_default
  78. public :: emis_ar5_voc2cbm4_biomassb
  79. public :: emis_ar5_voc2cbm4_biogenic
  80. public :: emis_ar5_voc_name, emis_ar5_nvoc
  81. public :: ar5_cat_ant, ar5_cat_shp, ar5_cat_air, ar5_cat_bmb
  82. ! MACC
  83. public :: emis_macc_voc2cbm4_default
  84. public :: emis_macc_voc2cbm4_biogenic
  85. public :: emis_macc_voc2cbm4_biomassb
  86. public :: emis_macc_voc_name, emis_macc_nvoc
  87. ! MEGAN
  88. public :: emis_megan_voc2cbm4_biogenic
  89. public :: emis_megan_nvoc, emis_megan_voc_name
  90. public :: emis_gfed_voc_name, emis_gfed_nvoc
  91. public :: emis_retro_voc_name
  92. public :: sector_type, provider_type
  93. ! EDGAR 4.2
  94. public :: ed42_nsect_co, ed42_nsect_ch4
  95. public :: ed42_nsect_nox, ed42_nsect_hc
  96. public :: ed42_nsect_nh3, ed42_nsect_so2
  97. public :: ed42_co_sectors, ed42_ch4_sectors
  98. public :: ed42_nox_sectors, ed42_hc_sectors
  99. public :: ed42_nh3_sectors, ed42_so2_sectors
  100. !
  101. ! !PRIVATE DATA MEMBERS:
  102. !
  103. character(len=*), parameter :: mname = 'emission_read'
  104. ! ------------------------------
  105. ! global characteristics
  106. ! ------------------------------
  107. integer, parameter :: nlat360 = 360 ! number of latitudes for AR5, MACC, EDGAR, GFED, RETRO data (0.5deg)
  108. integer, parameter :: nlon720 = 720 ! number of longitudes for AR5, MACC, EDGAR, GFED, RETRO data (0.5deg)
  109. integer, parameter :: lpj_dim_nlat = 150 ! number of latitudes (1deg), no emissions 60S-90S
  110. integer, parameter :: lpj_dim_nlon = 360 ! number of longitudes (1deg)
  111. integer, parameter :: sector_name_len = 18 ! length of sector descriptor
  112. integer, parameter :: categ_name_len = 14 ! length of category descriptor
  113. integer, parameter :: numb_sectors = 72 ! number of sectors (All providers!)
  114. integer, parameter :: numb_2dsec = 67 ! number of 2d sectors (all except aircraft)
  115. integer, parameter :: numb_3dsec = 2 ! number of 3d sectors (aircraft)
  116. integer, parameter :: numb_providers = 9 ! AR5, MACC, ED41, ED42, LPJ, HYMN, GFEDv3, RETRO, MEGAN
  117. integer, parameter :: ar5_dim_3ddata = 25 ! number of layers for aircraft data
  118. ! full list of providers
  119. character(8), dimension(numb_providers), parameter :: all_providers = &
  120. & (/ 'RETRO ', 'AR5 ', 'MACC ', 'ED41 ', 'ED42 ', 'LPJ ', 'HYMN ', 'GFEDv3 ','MEGAN '/)
  121. ! List of providers effectively used
  122. character(8), PUBLIC, allocatable :: used_providers(:) ! general: CO, NMVOC, NOX, SOx, NH3
  123. character(8), PUBLIC, allocatable :: used_providers_isop(:) ! ISOP
  124. character(8), PUBLIC, allocatable :: used_providers_ch4(:) ! CH4
  125. character(8), PUBLIC, allocatable :: used_providers_aer(:) ! BC and POM
  126. ! flag for degenerated cases
  127. logical, PUBLIC :: has_aer_emis = .true.
  128. logical, PUBLIC :: has_ch4_emis = .true.
  129. logical, PUBLIC :: has_isop_emis = .true.
  130. logical, PUBLIC :: has_emis = .true.
  131. ! extra params EDGAR 4.2: sectors used per species (here we already take out BMB and transport)
  132. integer, parameter :: ed42_nsect_co = 8 ! (all=11) number of sectors for CO
  133. integer, parameter :: ed42_nsect_ch4 = 13 ! (all=16) number of sectors for CH4
  134. integer, parameter :: ed42_nsect_nox = 10 ! (all=13) number of sectors for NOx
  135. integer, parameter :: ed42_nsect_hc = 9 ! (all=12) number of sectors for NMVOC
  136. integer, parameter :: ed42_nsect_nh3 = 9 ! (all=11) number of sectors for NH3
  137. integer, parameter :: ed42_nsect_so2 = 8 ! (all=11) number of sectors for SO2
  138. character(len=sector_name_len), dimension(ed42_nsect_co) :: ed42_co_sectors ! CO sectors in EDGAR 4.2
  139. character(len=sector_name_len), dimension(ed42_nsect_ch4) :: ed42_ch4_sectors ! CH4 sectors in EDGAR 4.2
  140. character(len=sector_name_len), dimension(ed42_nsect_nox) :: ed42_nox_sectors ! NOx sectors in EDGAR 4.2
  141. character(len=sector_name_len), dimension(ed42_nsect_hc) :: ed42_hc_sectors ! NMVOC sectors in EDGAR 4.2
  142. character(len=sector_name_len), dimension(ed42_nsect_nh3) :: ed42_nh3_sectors ! NH3 sectors in EDGAR 4.2
  143. character(len=sector_name_len), dimension(ed42_nsect_so2) :: ed42_so2_sectors ! SO2 sectors in EDGAR 4.2
  144. ! ------------------------------
  145. ! data used to construct filenames
  146. ! ------------------------------
  147. character(len=15), parameter :: filestr_common_pre = 'IPCC_emissions'
  148. character(len=25), parameter :: filestr_common_post = '0.5x0.5.nc'
  149. ! ------------------------------
  150. ! identifier of RCPs (RCP26, RCP45,...)
  151. ! ------------------------------
  152. character(len=5) :: filestr_rcpiden
  153. ! ------------------------------
  154. ! available years and related parameters/variables
  155. ! ------------------------------
  156. ! availability (min, max years) - Limit MACC and MEGAN to one year for EC-Earth
  157. integer, dimension(2), parameter :: retro_avail = (/1960, 2000/)
  158. integer, dimension(2), parameter :: ar5_avail = (/1850, 2100/)
  159. integer, dimension(2), parameter :: macc_avail = (/1998, 1998/)
  160. integer, dimension(2), parameter :: ed41_avail = (/2005, 2005/)
  161. integer, dimension(2), parameter :: ed42_avail = (/1970, 2008/)
  162. integer, dimension(2), parameter :: lpj_avail = (/1990, 2008/)
  163. integer, dimension(2), parameter :: hymn_avail = (/ 999, 999/) ! not used
  164. integer, dimension(2), parameter :: gfed3_avail = (/1997, 2010/)
  165. integer, dimension(2), parameter :: megan_avail = (/2000, 2000/)
  166. integer, parameter :: ar5_nr_avail_yrs = 27
  167. integer, dimension(ar5_nr_avail_yrs), parameter :: &
  168. ar5_avail_yrs = (/ 1850, 1860, 1870, 1880, 1890, 1900, &
  169. 1910, 1920, 1930, 1940, 1950, 1960, &
  170. 1970, 1980, 1990, &
  171. 2000, 2005, 2010, 2020, 2030, 2040, &
  172. 2050, 2060, 2070, 2080, 2090, 2100 /)
  173. integer, parameter :: ed41_nr_avail_yrs = 12
  174. integer, dimension(ed41_nr_avail_yrs), parameter :: &
  175. ed41_avail_yrs = (/ 1970, 1975, 1980, 1985, 1990, 1995, 2000, &
  176. 2001, 2002, 2003, 2004, 2005 /)
  177. logical, dimension(:), allocatable :: ltimeind
  178. logical, save :: lpj_fractions_found
  179. real, dimension(:,:,:), allocatable :: lpj_frac_wetlands
  180. real, dimension(:,:,:), allocatable :: lpj_frac_rice
  181. real, dimension(:,:), allocatable :: lpj_frac_peatlands
  182. character(len=7) :: ar5_coverage = 'monthly'
  183. character(len=7) :: ed4_coverage = 'yearly '
  184. character(len=7) :: lpj_coverage = 'monthly'
  185. ! AR5 list of species available for each category
  186. character(len=26), target, dimension(31) :: ar5_cat_ant=(/ &
  187. 'Acids ', 'alcohols ', 'BC ', &
  188. 'benzene ', 'butanes ', 'CH4 ', &
  189. 'chlorinated_HC ', 'CO ', 'esters ', &
  190. 'ethane ', 'ethene ', 'ethers ', &
  191. 'ethyne ', 'formaldehyde ', 'hexanes_and_higher_alkanes', &
  192. 'ketones ', 'NH3 ', 'NMVOC ', &
  193. 'NO ', 'OC ', 'other_alkanals ', &
  194. 'other_alkenes_and_alkynes ', 'other_aromatics ', 'other_VOC ', &
  195. 'pentanes ', 'propane ', 'propene ', &
  196. 'SO2 ', 'toluene ', 'trimethyl_benzenes ', &
  197. 'xylene '/)
  198. character(len=26), target, dimension(3) :: ar5_cat_air=(/ &
  199. 'BC ', 'NO2 ', 'NO '/)
  200. character(len=26), target, dimension(22) :: ar5_cat_shp=(/ &
  201. 'BC ', 'benzene ', 'butanes ', &
  202. 'CH4 ', 'CO ', 'ethane ', &
  203. 'ethene ', 'ethyne ', 'hexanes_and_higher_alkanes', &
  204. 'NH3 ', 'NMVOC ', 'NO ', &
  205. 'OC ', 'other_alkenes_and_alkynes ', 'other_aromatics ', &
  206. 'pentanes ', 'propane ', 'propene ', &
  207. 'SO2 ', 'toluene ', 'trimethyl_benzenes ', &
  208. 'xylene '/)
  209. character(len=26), target, dimension(31) :: ar5_cat_bmb=(/ &
  210. 'acids ', 'alcohols ', 'BC ', &
  211. 'benzene ', 'butanes ', 'CH4 ', &
  212. 'chlorinated_HC ', 'CO ', 'ethane ', &
  213. 'ethene ', 'ethers ', 'ethyne ', &
  214. 'formaldehyde ', 'hexanes_and_higher_alkanes', 'isoprene ', &
  215. 'ketones ', 'NH3 ', 'NMVOC ', &
  216. 'NO ', 'OC ', 'other_alkanals ', &
  217. 'other_alkenes_and_alkynes ', 'other_aromatics ', 'other_VOC ', &
  218. 'pentanes ', 'propane ', 'propene ', &
  219. 'SO2 ', 'terpenes ', 'toluene ', &
  220. 'xylene '/)
  221. ! and number of sectors in each category
  222. integer, public :: n_ar5_ant_sec, n_ar5_shp_sec, n_ar5_air_sec, n_ar5_bmb_sec
  223. ! reduced ar5 species available per anthro-sector (to screen out unavailable VOC)
  224. character(len=26), target, dimension(28) :: ar5_cat_ant_ene_ind=(/ &
  225. 'acids ', 'alcohols ', 'BC ', &
  226. 'benzene ', 'butanes ', 'CH4 ', &
  227. 'CO ', 'ethane ', 'ethene ', &
  228. 'ethyne ', 'formaldehyde ', 'hexanes_and_higher_alkanes', &
  229. 'ketones ', 'NH3 ', 'NMVOC ', &
  230. 'NO ', 'OC ', 'other_alkanals ', &
  231. 'other_alkenes_and_alkynes ', 'other_aromatics ', 'other_VOC ', &
  232. 'pentanes ', 'propane ', 'propene ', &
  233. 'SO2 ', 'toluene ', 'trimethyl_benzenes ', &
  234. 'xylene '/)
  235. character(len=26), target, dimension(29) :: ar5_cat_ant_dom=(/&
  236. 'acids ', 'alcohols ', 'BC ', &
  237. 'benzene ', 'butanes ', 'CH4 ', &
  238. 'CO ', 'ethane ', 'ethene ', &
  239. 'ethers ', 'ethyne ', 'formaldehyde ', &
  240. 'hexanes_and_higher_alkanes', 'ketones ', 'NH3 ', &
  241. 'NMVOC ', 'NO ', 'OC ', &
  242. 'other_alkanals ', 'other_alkenes_and_alkynes ', 'other_aromatics ', &
  243. 'other_VOC ', 'pentanes ', 'propane ', &
  244. 'propene ', 'SO2 ', 'toluene ', &
  245. 'trimethyl_benzenes ', 'xylene '/)
  246. character(len=26), target, dimension(27) :: ar5_cat_ant_agr=(/ &
  247. 'acids ', 'alcohols ', 'BC ', &
  248. 'benzene ', 'butanes ', 'CH4 ', &
  249. 'CO ', 'ethane ', 'ethene ', &
  250. 'ethers ', 'ethyne ', 'formaldehyde ', &
  251. 'hexanes_and_higher_alkanes', 'ketones ', 'NH3 ', &
  252. 'NMVOC ', 'NO ', 'OC ', &
  253. 'other_alkanals ', 'other_alkenes_and_alkynes ', 'other_aromatics ', &
  254. 'pentanes ', 'propane ', 'propene ', &
  255. 'SO2 ', 'toluene ', 'xylene '/)
  256. character(len=26), target, dimension(25) :: ar5_cat_ant_awb=(/&
  257. 'acids ', 'alcohols ', 'BC ', &
  258. 'benzene ', 'butanes ', 'CH4 ', &
  259. 'CO ', 'ethane ', 'ethene ', &
  260. 'ethyne ', 'formaldehyde ', 'hexanes_and_higher_alkanes', &
  261. 'ketones ', 'NH3 ', 'NMVOC ', &
  262. 'NO ', 'OC ', 'other_alkanals ', &
  263. 'other_alkenes_and_alkynes ', 'pentanes ', 'propane ', &
  264. 'propene ', 'SO2 ', 'toluene ', &
  265. 'xylene '/)
  266. character(len=26), target, dimension(18) :: ar5_cat_ant_slv=(/&
  267. 'alcohols ', 'BC ', 'CH4 ', &
  268. 'chlorinated_HC ', 'CO ', 'esters ', &
  269. 'ethers ', 'hexanes_and_higher_alkanes', 'ketones ', &
  270. 'NH3 ', 'NMVOC ', 'NO ', &
  271. 'OC ', 'other_aromatics ', 'other_VOC ', &
  272. 'SO2 ', 'toluene ', 'xylene '/)
  273. character(len=26), target, dimension(29) :: ar5_cat_ant_tra=(/&
  274. 'BC ', 'benzene ', 'butanes ', &
  275. 'CH4 ', 'chlorinated_HC ', 'CO ', &
  276. 'esters ', 'ethane ', 'ethene ', &
  277. 'ethers ', 'ethyne ', 'formaldehyde ', &
  278. 'hexanes_and_higher_alkanes', 'ketones ', 'NH3 ', &
  279. 'NMVOC ', 'NO ', 'OC ', &
  280. 'other_alkanals ', 'other_alkenes_and_alkynes ', 'other_aromatics ', &
  281. 'other_VOC ', 'pentanes ', 'propane ', &
  282. 'propene ', 'SO2 ', 'toluene ', &
  283. 'trimethyl_benzenes ', 'xylene '/)
  284. ! ------------------------------
  285. ! gridbox area (to be read only once per proc)
  286. ! ------------------------------
  287. character(len=25),parameter :: ar5_filestr_gridboxarea = 'gridbox_area.nc'
  288. character(len=25),parameter :: ed4_filestr_gridboxarea = 'gridbox_area.nc'
  289. character(len=25),parameter :: lpj_filestr_gridboxarea = 'maps/lpj_gridcell_area.nc'
  290. logical, save :: area_found_05
  291. logical, save :: lpj_area_found
  292. real, dimension(:,:), allocatable :: gridbox_area_05 ! gridbox area on 0.5x0.5 deg - used for AR5, MACC, EDGAR, GFED, RETRO, MEGAN
  293. real, dimension(:,:), allocatable :: lpj_gridbox_area
  294. ! -----------------------
  295. ! data type for sectors
  296. ! -----------------------
  297. type sector_type
  298. sequence
  299. character(len=sector_name_len) :: name ! name of sector
  300. character(len=categ_name_len) :: catname ! name of category to be found in
  301. logical :: f3d ! 3d-data y/n
  302. character(len=vd_class_name_len) :: vdisttype ! vertical distribution type (equal to "classes" still to be defined)
  303. character(len=8) :: prov ! provider of information (AR5, MACC, ED4)
  304. character(len=26), dimension(:), pointer :: species ! list of species available for that sector (use for AR5 only)
  305. end type sector_type
  306. type provider_type
  307. character(len=8) :: name
  308. integer :: nsect2d, nsect3d
  309. end type provider_type
  310. type(sector_type), dimension(numb_sectors) :: sectors_def
  311. type(provider_type), dimension(numb_providers) :: providers_def
  312. ! ----------------------------------------------------------------------------------
  313. ! NMVOC settings
  314. ! ----------------------------------------------------------------------------------
  315. ! -------------------------------------------------------------------
  316. ! A R 5 ( following GEMS setup ) - also used for EDGAR
  317. ! -------------------------------------------------------------------
  318. !
  319. ! Quotation of emission_tools_gems.F90:
  320. ! -------------------------------------
  321. ! Distribution of NMV over the CBM-4 components (kg C/kg NMV) .
  322. ! VOC numbering according to TNO/RETRO speciation.
  323. ! Anthropogenic emissions of isoprene (ivoc=10), monoterpenes(ivoc=11) and others(ivoc=25)
  324. ! are not used (set to zero in voc2c_tno and voc2c_fires) .
  325. ! The speciation is slightly different for biomass burning emissions, where:
  326. ! voc_1 is methanol (which does not contribute) instead of alcohols,
  327. ! voc_23 is acetone instead of ketones and
  328. ! acetaldehyde is given instead of 'other aldehydes' (voc_22)
  329. ! For biomass burning isoprene (ivoc_10) and monoterpene (ivoc_11) are nonzero
  330. ! and need to be included separately.
  331. !
  332. integer, parameter :: emis_ar5_nvoc = 25
  333. !
  334. ! AR5 components TM4-RETRO Available EDGAR41 UNavailable EDGAR42 from ED42_HC_SECTORS
  335. ! Transport sectors (1A3*) (ignoring 1A3* transport, and 5A_C_D_F_4E fires)
  336. ! --------------------------------------------------------------------------------------------------------------------------
  337. ! alcohols 1) alcohols 1A3b_c_e (2005 only) 1A4
  338. ! ethane 2) ethane 1A3b_c_e 1A3d1 1A3d_SHIP = id. 3
  339. ! propane 3) propane id. 3
  340. ! butanes 4) butanes id. 3
  341. ! pentanes 5) pentanes id. 3
  342. ! hexanes and higher alkanes 6) hexanes and higher alkanes id.
  343. ! ethene 7) ethene id. 3
  344. ! propene 8) propene id. 3
  345. ! ethyne 9) ethyne id. 3
  346. ! isoprene 10) isoprene --none-- all
  347. ! terpenes 11) terpenes --none-- all
  348. ! other alkenes and alkynes 12) lumped alkenes id. 3
  349. ! benzene 13) benzene id. 3
  350. ! toluene 14) toluene id.
  351. ! xylene 15) xylene id.
  352. ! trimethyl benzenes 16) trimethylbenzene id. 3; 4F
  353. ! other aromatics 17) other_aromatics id. 4F
  354. ! esters 18) esters 1A3b_c_e 1A1a, 1A1b_c_1B_2C1_2C2, 1A2, 2A_B_D_E_F_G, 4F; 7A
  355. ! ethers 19) ethers 1A3b_c_e 1A1a, 1A1b_c_1B_2C1_2C2, 1A2, 2A_B_D_E_F_G, 4F; 7A
  356. ! chlorinated HC 20) Cl HC 1A3b_c_e 1A1a, 1A1b_c_1B_2C1_2C2, 1A2, 2A_B_D_E_F_G, 4F; 7A
  357. ! formaldehyde 21) formaldehyde 1A3b_c_e 3
  358. ! other alkanal 22) acetaldehyde 1A3b_c_e 3
  359. ! ketones 23) acetone/ketones 1A3b_c_e
  360. ! acids 24) acids 1A3b_c_e (2005 only) 1A4; 3
  361. ! other VOC 25) othervoc 1A3b_c_e 4F
  362. !
  363. character(len=26), parameter :: emis_ar5_voc_name(emis_ar5_nvoc) = (/ &
  364. 'alcohols ', & ! 1
  365. 'ethane ', & ! 2
  366. 'propane ', & ! 3
  367. 'butanes ', & ! 4
  368. 'pentanes ', & ! 5
  369. 'hexanes_and_higher_alkanes', & ! 6
  370. 'ethene ', & ! 7
  371. 'propene ', & ! 8
  372. 'ethyne ', & ! 9
  373. 'isoprene ', & ! 10
  374. 'terpenes ', & ! 11
  375. 'other_alkenes_and_alkynes ', & ! 12
  376. 'benzene ', & ! 13
  377. 'toluene ', & ! 14
  378. 'xylene ', & ! 15
  379. 'trimethyl_benzenes ', & ! 16
  380. 'other_aromatics ', & ! 17
  381. 'esters ', & ! 18
  382. 'ethers ', & ! 19
  383. 'chlorinated_HC ', & ! 20
  384. 'formaldehyde ', & ! 21
  385. 'other_alkanals ', & ! 22
  386. 'ketones ', & ! 23
  387. 'acids ', & ! 24
  388. 'other_VOC ' /) ! 25
  389. !
  390. ! voc_to_cbm4: Table to convert kg(nmvoc) to 'kg(cbm4) for variable cbm4
  391. ! JEW: the addition of some components is reassessd for eg butanes/pentanes
  392. ! JEW: see xl file : TAR_VOC_emissions_speciation-TM-2010
  393. ! JEW: for other voc species 20% of total C is assumed to be PAR
  394. real, parameter :: emis_ar5_voc2cbm4_default(emis_ar5_nvoc*ncb4) = (/ &
  395. ! PAR
  396. 3.3946E-01 , xmc/(2*xmc+6*xmh) , 1.5*xmc/(3*xmc+8*xmh) , 4.0*(xmc/(4*xmc+10*xmh)) , 5.0*(xmc/(5*xmc+12*xmh)) , &
  397. 6.0*(xmc/(6*xmc+14*xmh)) , 0.0 , xmc/(3*xmc+6*xmh) , 4.6157E-01 , 0.0 , &
  398. 0.0 , 4.9970E-01 , xmc/(xmc*6+xmh*6) , xmc/(xmc*7+xmh*8) , xmc/(xmc*8+xmh*10) , &
  399. 2.0997E-01 , 2.5229E-01 , 3.6635E-01 , 3.8643E-01 , 2.6354E-01 , &
  400. 0.0 , 0.0 , 4.4762E-01 , 1.8433E-01 , 1.85E-01 , &
  401. ! ETH
  402. 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , &
  403. 0.0 , xmeth/(xmc*2+xmh*4) , 0.0 , 0.0 , 0.0 , &
  404. 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , &
  405. 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , &
  406. 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , &
  407. ! OLE
  408. 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , &
  409. 0.0 , 0.0 , xmole/(3*xmc+6*xmh) , 0.0 , 0.0 , &
  410. 0.0 , 0.0 , 3.5668E-01 , 0.0 , 0.0 , &
  411. 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , &
  412. 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , &
  413. ! ALD2
  414. 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , &
  415. 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , &
  416. 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , &
  417. 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , &
  418. 0.0 , xmald2/(2*xmc+xmo+4*xmh) , 0.0 , 0.0 , 0.0 , &
  419. ! MGLY
  420. 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , &
  421. 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , &
  422. 0.0 , 0.0 , 0.0 , 0.2*(xmgly/92.) , 2.7167E-01 , &
  423. 2.3978E-01 , 2.2409E-01 , 0.0 , 0.0 , 0.0 , &
  424. 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , &
  425. ! CH2O
  426. 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , &
  427. 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , &
  428. 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , &
  429. 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , &
  430. 1.0 , 0.0 , 0.0 , 0.0 , 0.0 /)
  431. !
  432. ! The table below is used for the RETRO FIRES inventory only.
  433. ! It differs from the default AR5 table above in that
  434. ! methanol and acetaldehyde are provided directly.
  435. ! Remaining differences are either small or
  436. ! occur for species that are not provided.
  437. real, parameter :: emis_ar5_voc2cbm4_biomassb(emis_ar5_nvoc*ncb4) = (/ &
  438. ! PAR
  439. 0.0 , xmpar/(2*xmc+6*xmh) , 1.5*xmpar/(3*xmc+8*xmh) , 4.0*(xmc/( 4*xmc+10*xmh)) , 5.0*(xmc/(5*xmc+12*xmh)) , &
  440. 6.0*(xmc/(6*xmc+14*xmh)), 0.0 , xmpar/(3*xmc+6*xmh) , 4.6157E-01 , 0.0 , &
  441. 0.0 , 0.0 , xmc/(xmc*6+xmh*6) , xmc/(xmc*7+xmh*8) , xmc/(xmc*8+xmh*10) , &
  442. 2.9995E-01 , 2.5229E-01 , 3.6635E-01 , 3.8643E-01 , 2.6354E-01 , &
  443. 0.0 , 0.0 , 2*xmc/(3*xmc+xmo+6*xmh) , 1.8433E-01 , 0.0 , &
  444. ! ETH
  445. 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , &
  446. 0.0 , xmeth/(xmc*2+xmh*4) , 0.0 , 0.0 , 0.0 , &
  447. 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , &
  448. 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , &
  449. 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , &
  450. ! OLE
  451. 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , &
  452. 0.0 , 0.0 , xmole/(3*xmc+6*xmh) , 0.0 , 0.0 , &
  453. 0.0 , 0.0 , 3.5693E-01 , 0.0 , 0.0 , &
  454. 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , &
  455. 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , &
  456. ! ALD2
  457. 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , &
  458. 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , &
  459. 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , &
  460. 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , &
  461. 0.0 , xmald2/(2*xmc+xmo+4*xmh), 0.0 , 0.0 , 0.0 , &
  462. ! MGLY
  463. 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , &
  464. 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , &
  465. 0.0 , 0.0 , 0.0 , 0.2*(xmgly/92.) , 2.7167E-01 , &
  466. 2.3996E-01 , 2.2426E-01 , 0.0 , 0.0 , 0.0 , &
  467. 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , &
  468. ! CH2O
  469. 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , &
  470. 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , &
  471. 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , &
  472. 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , &
  473. 1.0 , 0.0 , 0.0 , 0.0 , 0.0 /)
  474. ! voc_to_cbm4: Table to convert kg(nmvoc) to kg(cbm4) for variable cbm4
  475. ! specific for biogenic emissions
  476. ! For alcohols methanol is used to account for ethanol. Therefore
  477. ! use 0.1 scaling factor. For other species the ratio of xmpar/xmspecies is adopted,
  478. ! using molecular weights for each species given in Schultz and Stein (2004)
  479. ! For species that have no biogenic contribution we adopt a value of 0.
  480. real, parameter :: emis_ar5_voc2cbm4_biogenic(emis_ar5_nvoc*ncb4) = (/ &
  481. ! PAR
  482. 0.1 , xmpar/(2*xmc+6*xmh) , 1.5*xmpar/(3*xmc+8*xmh), 4.0*(xmc/(4*xmc+10*xmh)), 5.0*(xmc/(5*xmc+12*xmh)) , &
  483. 8.4049E-01 , 0.0 , xmpar/(3*xmc+6*xmh) , 0.0 , 0.0 , &
  484. 0.0 , 4.9970E-01 , 0.0 , 0.0 , 0.0 , &
  485. 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , &
  486. 0.0 , 0.0 , 0.3184 , 0.0 , 0.0 , &
  487. ! ETH
  488. 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , &
  489. 0.0 , xmeth/(xmc*2+xmh*4) , 0.0 , 0.0 , 0.0 , &
  490. 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , &
  491. 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , &
  492. 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , &
  493. ! OLE
  494. 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , &
  495. 0.0 , 0.0 , xmole/(3*xmc+6*xmh) , 0.0 , 0.0 , &
  496. 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , &
  497. 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , &
  498. 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , &
  499. ! ALD2
  500. 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , &
  501. 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , &
  502. 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , &
  503. 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , &
  504. 0.0 , xmald2/(2*xmc+xmo+4*xmh), 0.0 , 0.0 , 0.0 , &
  505. ! MGLY
  506. 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , &
  507. 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , &
  508. 0.0 , 0.0 , 0.0 , 0.2*(xmgly/92.) , 0.0 , &
  509. 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , &
  510. 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , &
  511. ! CH2O
  512. 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , &
  513. 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , &
  514. 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , &
  515. 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , &
  516. 1.0 , 0.0 , 0.0 , 0.0 , 0.0 /)
  517. ! -------------------------------------------------------------------
  518. ! M A C C
  519. ! -------------------------------------------------------------------
  520. !
  521. ! Distribution of NMV over the CBM-4 components (kg C/kg NMV) .
  522. ! VOC numbering according to TNO/RETRO speciation.
  523. ! Anthropogenic emissions of isoprene (ivoc=10), monoterpenes(ivoc=11) and others(ivoc=25)
  524. ! are not used (set to zero in voc2c_tno and voc2c_fires) .
  525. ! The speciation is slightly different for biomass burning emissions, where:
  526. ! voc_1 is methanol (which does not contribute) instead of alcohols,
  527. ! voc_23 is acetone instead of ketones and
  528. ! acetaldehyde is given instead of 'other aldehydes' (voc_22)
  529. ! For biomass burning isoprene (ivoc_10) and monoterpene (ivoc_11) are nonzero
  530. ! and need to be included separately.
  531. !
  532. integer, parameter :: emis_macc_nvoc = 14
  533. !
  534. ! TM4-RETRO names MACC/grg names
  535. ! ---------------------------------- ------------------------
  536. ! 2.1 CO
  537. ! 2.2 NO
  538. ! 1 alcohols 2.x CH3OH <- no C-C bond: not included TM5
  539. ! 2.4 C2H5OH <-1 PAR
  540. ! 2 ethane 2.5 C2H6
  541. ! 3 propane 2.6 C3H8
  542. ! 2.7 BIGALK: lumped_alkanes: (58 g/mole = butane)
  543. ! 4 butanes incl- c4h10
  544. ! 5 pentanes
  545. ! 6 hexanes_plus_higher_alkanes
  546. ! 7 ethene 2.8 C2H4
  547. ! 8 propene 2.9 C3H6
  548. ! 9
  549. ! 10 2.10 ISOPRENE
  550. ! 11 2.11 TERPENES
  551. ! 12 other_alkenes_and_alkynes 2.12 BIKENE: lumped_alkenes (56 g/mole -> CBM-5 speciation gives one OLE. (1 double bond)
  552. ! 2.13 TOLUENE: lumped_aromatics:
  553. ! 13 incl?- benzene
  554. ! 14 - toluene
  555. ! 15 xylene - xylene
  556. ! 16 trimethylbenzenes
  557. ! 17 other_aromatics
  558. ! 18 esters
  559. ! 19 ethers
  560. ! 20 chlorinated_hydrocarbons
  561. ! 21 methanal 2.14 CH2O (formaldehyde,methanal)
  562. ! 22 alkanals 2.15 CH3CHO (acetaldehyde,acetal)
  563. ! 23 ketones 2.16 CH3COCH3: acetone
  564. ! 24 acids
  565. ! 2.17 h2
  566. !
  567. ! vh. According to Angelika Heil (FZ Juelich) the mol. weights for lumped species in biomass burning are
  568. ! vh different from the anthropogenic emissions, as follows:
  569. ! vh Ankelika Heil:
  570. ! We updated these molecular weights for biomass burning for the MOZART
  571. ! lumped groups as follows:
  572. ! Higher_Alkanes: 58 g/mole ==> 78.8 g/mole
  573. ! Higher_Alkenes: 56 g/mole ==> 64.0 g/mole
  574. ! Toluene_lump: 92 g/mole ==> 85.7 g/mole
  575. ! The MOZART lumped groups were formed as follows:
  576. ! Toluene_lump (C7H8+ C6H6 + C8H10): MOZART lumped toluene species,
  577. ! incorporating benzene, toluene, xylene
  578. ! Higher Alkenes (CnH2n, C>=4): all alkenes (C>=4) specified in Andreae
  579. ! and Merlet (2001) which are not contained in the Toluene_lump group.
  580. ! These are: Butenes (1-butene + i-butene + tr-2-butene + cis-2-butene)
  581. ! (C4H8), Pentenes (1-pentene + 2-pentene) (C5H10), Hexene (C6H12),
  582. ! Octene (C8H16)
  583. ! Higher Alkanes (CnH2n+2, C>=4): all alkanes (C>=4) specified in Andreae
  584. ! and Merlet (2001). These are: Butanes (n-butane + i-butane) (C4H10),
  585. ! Pentanes (n-pentane + i-pentane) (C5H12), Hexane (n-hexane + i-hexane)
  586. ! (C6H14), Heptane (C7H16)
  587. ! We calculated the molecular weight of these lumped groups from weighting
  588. ! the molecular mass of the individual species with their relative mass
  589. ! contribution to the total fire emissions of each group during 2001-2006
  590. ! (calculated from GFEDv2 data).
  591. ! JEW: looking at the decomposition of TOL reveals ther is a product yield of 0.2MGLY
  592. ! which should be added analogous to the xylene > MGLY link in Houweling et al. (1998)
  593. integer, parameter :: emis_gfed_nvoc = 11
  594. ! the same as MACC, except CH3CHO, CH3COCH3, and MEK
  595. ! From the CB05 speciation guide : CH3COCH3 = 3.0*par
  596. !
  597. character(len=26), parameter :: emis_macc_voc_name(emis_macc_nvoc) = (/ &
  598. 'C2H5OH ', & ! 1
  599. 'C2H6 ', & ! 2
  600. 'C3H8 ', & ! 3
  601. 'BIGALK ', & ! 4
  602. 'C2H4 ', & ! 5
  603. 'C3H6 ', & ! 6
  604. 'ISOPRENE ', & ! 7
  605. 'TERPENES ', & ! 8
  606. 'BIGENE ', & ! 9
  607. 'TOLUENE ', & ! 10
  608. 'CH2O ', & ! 11
  609. 'CH3CHO ', & ! 12
  610. 'CH3COCH3 ', & ! 13
  611. 'MEK '/) ! 14
  612. ! voc_to_cbm4: Table to convert kg(nmvoc) to 'kg(cbm4) for variable cbm4
  613. real, parameter :: emis_macc_voc2cbm4_default(emis_macc_nvoc*ncb4) = (/ &
  614. ! PAR
  615. xmpar/(xmc*2+xmo+xmh*6) , xmpar/(2*xmc+6*xmh) , 1.5*xmpar/(3*xmc+8*xmh) , 4.0*xmpar/(58.0) , &
  616. 0.0 , xmpar/(3*xmc+6*xmh) , 0.0 , 0.0 , &
  617. 0.0 , xmpar/92. , 0.0 , 0.0 , &
  618. 3.0*xmpar/(58.) , 4*xmpar/72. , &
  619. ! ETH
  620. 0.0 , 0.0 , 0.0 , 0.0 , &
  621. xmeth/(xmc*2+xmh*4) , 0.0 , 0.0 , 0.0 , &
  622. 0.0 , 0.0 , 0.0 , 0.0 , &
  623. 0.0 , 0.0 , &
  624. ! OLE
  625. 0.0 , 0.0 , 0.0 , 0.0 , &
  626. 0.0 , xmole/(3*xmc+6*xmh) , 0.0 , 0.0 , &
  627. xmole/(56.) , 0.0 , 0.0 , 0.0 , &
  628. 0.0 , 0.0 , &
  629. ! ALD2
  630. 0.0 , 0.0 , 0.0 , 0.0 , &
  631. 0.0 , 0.0 , 0.0 , 0.0 , &
  632. 0.0 , 0.0 , 0.0 , xmald2/44. , &
  633. 0.0 , 0.0 , &
  634. ! MGLY
  635. 0.0 , 0.0 , 0.0 , 0.0 , &
  636. 0.0 , 0.0 , 0.0 , 0.0 , &
  637. 0.0 , 0.2*(xmgly/92.) , 0.0 , 0.0 , &
  638. 0.0 , 0.0 , &
  639. ! CH2O
  640. 0.0 , 0.0 , 0.0 , 0.0 , &
  641. 0.0 , 0.0 , 0.0 , 0.0 , &
  642. 0.0 , 0.0 , 1.0 , 0.0 , &
  643. 0.0 , 0.0 /)
  644. ! For Biomass burning, use a the same table
  645. real, parameter :: emis_macc_voc2cbm4_biomassb(emis_macc_nvoc*ncb4) = (/ &
  646. ! PAR
  647. xmpar/(xmc*2+xmo+xmh*6) , xmpar/(2*xmc+6*xmh) , 1.5*xmpar/(3*xmc+8*xmh) , 4.0*xmpar/(78.8) , &
  648. 0.0 , xmpar/(3*xmc+6*xmh) , 0.0 , 0.0 , &
  649. 0.0 , xmpar/85.7 , 0.0 , 0.0 , &
  650. 2*xmpar/(3*xmc+xmo+6*xmh) ,4*xmpar/72. , &
  651. ! ETH
  652. 0.0 , 0.0 , 0.0 , 0.0 , &
  653. xmeth/(xmc*2+xmh*4) , 0.0 , 0.0 , 0.0 , &
  654. 0.0 , 0.0 , 0.0 , 0.0 , &
  655. 0.0 , 0.0 , &
  656. ! OLE
  657. 0.0 , 0.0 , 0.0 , 0.0 , &
  658. 0.0 , xmole/(3*xmc+6*xmh) , 0.0 , 0.0 , &
  659. xmole/(64.) , 0.0 , 0.0 , 0.0 , &
  660. 0.0 , 0.0 , &
  661. ! ALD2
  662. 0.0 , 0.0 , 0.0 , 0.0 , &
  663. 0.0 , 0.0 , 0.0 , 0.0 , &
  664. 0.0 , 0.0 , 0.0 , xmald2/44. , &
  665. 0.0 , 0.0 , &
  666. ! MGLY
  667. 0.0 , 0.0 , 0.0 , 0.0 , &
  668. 0.0 , 0.0 , 0.0 , 0.0 , &
  669. 0.0 , 0.2*(xmgly/92.) , 0.0 , 0.0 , &
  670. 0.0 , 0.0 , &
  671. ! CH2O
  672. 0.0 , 0.0 , 0.0 , 0.0 , &
  673. 0.0 , 0.0 , 0.0 , 0.0 , &
  674. 0.0 , 0.0 , 1.0 , 0.0 , &
  675. 0.0 , 0.0 /)
  676. ! specific for biogenic emissions
  677. real, parameter :: emis_macc_voc2cbm4_biogenic(emis_macc_nvoc*ncb4) = (/ &
  678. ! PAR
  679. xmpar/(xmc*2+xmo+xmh*6) , xmpar/(2*xmc+6*xmh) , 1.5*xmpar/(3*xmc+8*xmh) , 4.0*xmpar/(58.0) , &
  680. 0.0 , xmpar/(3*xmc+6*xmh) , 0.0 , 0.0 , &
  681. 0.0 , xmpar/92. , 0.0 , 0.0 , &
  682. 2*xmpar/(3*xmc+xmo+6*xmh) ,4*xmpar/72. , &
  683. ! ETH
  684. 0.0 , 0.0 , 0.0 , 0.0 , &
  685. xmeth/(xmc*2+xmh*4) , 0.0 , 0.0 , 0.0 , &
  686. 0.0 , 0.0 , 0.0 , 0.0 , &
  687. 0.0 , 0.0 , &
  688. ! OLE
  689. 0.0 , 0.0 , 0.0 , 0.0 , &
  690. 0.0 , xmole/(3*xmc+6*xmh) , 0.0 , 0.0 , &
  691. xmole/(56.) , 0.0 , 0.0 , 0.0 , &
  692. 0.0 , 0.0 , &
  693. ! ALD2
  694. 0.0 , 0.0 , 0.0 , 0.0 , &
  695. 0.0 , 0.0 , 0.0 , 0.0 , &
  696. 0.0 , 0.0 , 0.0 , xmald2/44. , &
  697. 0.0 , 0.0 , &
  698. ! MGLY
  699. 0.0 , 0.0 , 0.0 , 0.0 , &
  700. 0.0 , 0.0 , 0.0 , 0.0 , &
  701. 0.0 , 0.2*(xmgly/92.) , 0.0 , 0.0 , &
  702. 0.0 , 0.0 , &
  703. ! CH2O
  704. 0.0 , 0.0 , 0.0 , 0.0 , &
  705. 0.0 , 0.0 , 0.0 , 0.0 , &
  706. 0.0 , 0.0 , 1.0 , 0.0 , &
  707. 0.0 , 0.0 /)
  708. ! -------------------------------------------------------------------
  709. ! M A C C - M E G A N
  710. ! -------------------------------------------------------------------
  711. !
  712. ! Distribution of NMV over the CBM-4 components (kg C/kg NMV) .
  713. ! VOC numbering according to TNO/RETRO speciation.
  714. ! The speciation is slightly different for biomass burning emissions, where:
  715. ! voc_1 is methanol (which does not contribute) instead of alcohols,
  716. ! voc_23 is acetone instead of ketones and
  717. ! acetaldehyde is given instead of 'other aldehydes' (voc_22)
  718. ! For biomass burning isoprene (ivoc_10) and monoterpene (ivoc_11) are nonzero
  719. ! and need to be included separately.
  720. !
  721. !
  722. ! TM4-RETRO names MEGAN/grg names
  723. ! ---------------------------------- ------------------------
  724. ! 2.1 CO
  725. ! 1 alcohols 2.2 methanol <- no C-C bond: not included TM5
  726. ! 2.3 ethanol <-1 PAR
  727. ! 2 ethane 2.4 ethane
  728. ! 3 propane 2.5 propane
  729. ! 4 butanes 2.6 butanes_and_higher_alkanes (58 g/mole = butane)
  730. ! incl- c4h10
  731. ! 5 pentanes
  732. ! 6 hexanes_plus_higher_alkanes
  733. ! 7 ethene 2.7 ethene
  734. ! 8 propene 2.8 propene
  735. ! 9
  736. ! 10 2.10 ISOPRENE
  737. ! 11 2.11 monoterpenes
  738. ! 12 other_alkenes_and_alkynes 2.12 butenes_and_higher_alkenes -> (56g/mole = butene)
  739. ! 13 2.13 toluene (92g/mole=toluene) <- 0.2 MGLY
  740. ! 14
  741. ! 15 xylene
  742. ! 16 trimethylbenzenes
  743. ! 17 other_aromatics
  744. ! 18 esters
  745. ! 19 ethers
  746. ! 20 chlorinated_hydrocarbons
  747. ! 21 methanal 2.14 formaldehyde
  748. ! 22 alkanals 2.15 acetaldehyde
  749. ! 2.16 other_aldehydes (44g/mole=C2 and above aldehydes): ignore other double count
  750. ! 23 ketones 2.17 acetone
  751. ! 2.18 other_ketones (72g/mole=other ketones except acetone): <-4*PAR as lower limit
  752. ! 24 acids 2.19 formic acid <- no C-C bond: not included TM5
  753. ! 2.20 acetic acid <-1 PAR
  754. !
  755. integer, parameter :: emis_megan_nvoc = 18
  756. ! the same as MACC, except no MEK
  757. character(len=26), parameter :: emis_megan_voc_name(emis_megan_nvoc) = (/ &
  758. 'methanol ', & ! 1
  759. 'ethanol ', & ! 2
  760. 'ethane ', & ! 3
  761. 'propane ', & ! 4
  762. 'butanes_and_higher_alkanes', & ! 5
  763. 'ethene ', & ! 6
  764. 'propene ', & ! 7
  765. 'isoprene ', & ! 8
  766. 'monoterpenes ', & ! 9
  767. 'butenes_and_higher_alkenes', & ! 10
  768. 'toluene ', & ! 11
  769. 'formaldehyde ', & ! 12
  770. 'acetaldehyde ', & ! 13
  771. 'other_aldehydes ', & ! 14
  772. 'acetone ', & ! 15
  773. 'other_ketones ', & ! 16
  774. 'formic_acid ', & ! 17
  775. 'acetic_acid '/) ! 18
  776. ! specific for MEGAN biogenic emissions
  777. real, parameter :: emis_megan_voc2cbm4_biogenic(emis_megan_nvoc*ncb4) = (/ &
  778. ! PAR
  779. 0.0 , xmpar/(2*xmc+xmo+5*xmh), xmpar/(2*xmc+6*xmh), xmpar/(3*xmc+8*xmh), &
  780. 4.0*xmpar/(58.0) , 0.0 , xmpar/(3*xmc+6*xmh) , 0.0 , 0.0 , &
  781. xmpar/(4*xmc+xmh*8) , xmpar/(92.0) , 0.0 , 0.0 , 0.0 , &
  782. 3.0*xmpar/(58.0) , 4.0*xmpar/(72.0) , 0.0 , xmpar/(60.0) , &
  783. ! ETH
  784. 0.0 , 0.0 , 0.0 , 0.0 , &
  785. 0.0 , xmeth/(xmc*2+xmh*4) , 0.0 , 0.0 , 0.0 , &
  786. 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , &
  787. 0.0 , 0.0 , 0.0 , 0.0 , &
  788. ! OLE
  789. 0.0 , 0.0 , 0.0 , 0.0 , &
  790. 0.0 , 0.0 , xmole/(3*xmc+6*xmh) , 0.0 , 0.0 , &
  791. xmole/(56.) , 0.0 , 0.0 , 0.0 , 0.0 , &
  792. 0.0 , 0.0 , 0.0 , 0.0 , &
  793. ! ALD2
  794. 0.0 , 0.0 , 0.0 , 0.0 , &
  795. 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , &
  796. 0.0 , 0.0 , 0.0 , xmald2/44. , 0.0 , &
  797. 0.0 , 0.0 , 0.0 , 0.0 , &
  798. ! MGLY
  799. 0.0 , 0.0 , 0.0 , 0.0 , &
  800. 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , &
  801. 0.0 , 0.2*xmgly/(92.0) , 0.0 , 0.0 , 0.0 , &
  802. 0.0 , 0.0 , 0.0 , 0.0 , &
  803. ! CH2O
  804. 0.0 , 0.0 , 0.0 , 0.0 , &
  805. 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , &
  806. 0.0 , 0.0 , 1.0 , 0.0 , 0.0 , &
  807. 0.0 , 0.0 , 0.0 , 0.0 /)
  808. character(len=26), parameter :: emis_gfed_voc_name(emis_gfed_nvoc) = (/ &
  809. 'c2h5oh ', & ! 1
  810. 'c2h6 ', & ! 2
  811. 'c3h8 ', & ! 3
  812. 'higher_alkanes ', & ! 4
  813. 'c2h4 ', & ! 5
  814. 'c3h6 ', & ! 6
  815. 'isoprene ', & ! 7
  816. 'terpenes ', & ! 8
  817. 'higher_alkenes ', & ! 9
  818. 'toluenes ', & ! 10
  819. 'ch2o '/) ! 11
  820. ! NB: base the RETRO voc speciation on AR5 (retro species are a subset of AR5)
  821. character(len=26), parameter :: emis_retro_voc_name(emis_ar5_nvoc) = (/ &
  822. 'not provided ', & ! 1 ! only methanol provided, we do not include it
  823. 'ETHANE ', & ! 2
  824. 'PROPANE ', & ! 3
  825. 'not provided ', & ! 4
  826. 'not provided ', & ! 5
  827. 'not provided ', & ! 6
  828. 'ETHENE ', & ! 7
  829. 'PROPENE ', & ! 8
  830. 'ETHYNE ', & ! 9
  831. 'ISOPRENE ', & ! 10
  832. 'MONOTERPENES ', & ! 11
  833. 'not provided ', & ! 12
  834. 'BENZENE ', & ! 13
  835. 'TOLUENE ', & ! 14
  836. 'XYLENE ', & ! 15
  837. 'not provided ', & ! 16
  838. 'not provided ', & ! 17
  839. 'not provided ', & ! 18
  840. 'not provided ', & ! 19
  841. 'not provided ', & ! 20
  842. 'CH2O ', & ! 21
  843. 'CH3CHO ', & ! 22
  844. 'ACETONE ', & ! 23
  845. 'not provided ', & ! 24
  846. 'not provided ' /) ! 25
  847. !
  848. ! !REVISION HISTORY:
  849. ! 1 Oct 2010 - Achim Strunk - v0 for AR5, MACC
  850. ! 1 Dec 2011 - Narcisa Banda - added EDGAR 4.1 and 4.2
  851. ! 19 Jun 2012 - P. Le Sager - cosmetic for lon-lat MPI domain decomposition
  852. ! (all reading/regridding on root for now)
  853. ! 20 Nov 2012 - Ph. Le Sager - defined and build lists of used providers
  854. ! - deal with inventories years availability
  855. ! - switch to MDF interface to read data
  856. !
  857. ! !TODO:
  858. ! - should be renamed something like "emission_inventories" or "emiss_providers"
  859. ! - and need to get a **SEPARATE** module for each inventories, before it
  860. ! becomes unmanageable again
  861. !
  862. !EOP
  863. !------------------------------------------------------------------------
  864. CONTAINS
  865. !--------------------------------------------------------------------------
  866. ! TM5 !
  867. !--------------------------------------------------------------------------
  868. !BOP
  869. !
  870. ! !IROUTINE: EMISSION_READ_INIT
  871. !
  872. ! !DESCRIPTION: Initialise reading related parameters and
  873. ! allocate needed arrays
  874. !
  875. !\\
  876. ! !INTERFACE:
  877. !
  878. SUBROUTINE EMISSION_READ_INIT( rcF, status )
  879. !
  880. ! !USES:
  881. !
  882. use GO, only : TrcFile, ReadRc
  883. use partools, only : isRoot
  884. use emission_data, only : LAR5, LEDGAR4, LRETROF, LGFED3, LMACC, LLPJ, LHYMN, LAR5BMB, LMACCITY, LMEGAN
  885. use meteodata, only : set, gph_dat
  886. use dims, only : im, jm, lm, nregions
  887. !
  888. ! !INPUT PARAMETERS:
  889. !
  890. type(TrcFile) :: rcF
  891. !
  892. ! !OUTPUT PARAMETERS:
  893. !
  894. integer, intent(out) :: status
  895. !
  896. ! !REVISION HISTORY:
  897. ! 1 Oct 2010 - Achim Strunk - v0 for AR5
  898. ! 1 Dec 2011 - Narcisa Banda - added EDGAR 4.1 and 4.2
  899. ! 20 Nov 2012 - Ph. Le Sager - build lists of used providers
  900. ! 29 Nov 2014 - Jason Williams - Introduced yearly specific biogenic emissions
  901. !
  902. ! !REMARKS:
  903. !
  904. !EOP
  905. !------------------------------------------------------------------------
  906. !BOC
  907. character(len=*), parameter :: rname=mname//'/emission_read_init'
  908. integer :: isect, iprov, nused, region
  909. logical :: mask(numb_providers), LEDGARCH4
  910. ! --- begin --------------------------------------
  911. call ReadRc( rcF, 'input.emis.AR5.RCP', filestr_rcpiden, status )
  912. IF_ERROR_RETURN(status=1)
  913. ! ------------------
  914. ! build list of used providers
  915. ! ------------------
  916. ! LMACCITY does not provide anthropogenic CH4, then use EDGAR instead
  917. if (LMACCITY) then
  918. LEDGARCH4=.true.
  919. else
  920. LEDGARCH4=LEDGAR4
  921. end if
  922. ! CH4 (any inventory, but skip MACC and MEGAN since they have no CH4)
  923. mask = (/ LRETROF, LAR5, .false., LEDGARCH4, LEDGARCH4, LLPJ, LHYMN, LGFED3, .false. /)
  924. nused = count(mask)
  925. if (nused /= 0) then
  926. allocate( used_providers_ch4(nused) )
  927. used_providers_ch4 = pack( all_providers, mask)
  928. else
  929. has_ch4_emis = .false.
  930. end if
  931. ! ISOP (anything except EDGAR, LPJ and HYMN; AR5 : only if fires requested)
  932. mask = (/ LRETROF, LAR5BMB, LMACC, .false., .false., .false., .false., LGFED3, LMEGAN /)
  933. nused = count(mask)
  934. if (nused /= 0) then
  935. allocate( used_providers_isop(nused) )
  936. used_providers_isop = pack( all_providers, mask)
  937. else
  938. has_isop_emis = .false.
  939. end if
  940. ! Others gases (anything except LPJ and HYMN)
  941. mask = (/ LRETROF, LAR5, LMACC, LEDGAR4, LEDGAR4, .false., .false., LGFED3, LMEGAN /)
  942. nused = count(mask)
  943. if (nused /= 0) then
  944. allocate( used_providers(nused) )
  945. used_providers = pack( all_providers, mask)
  946. else
  947. has_emis = .false.
  948. end if
  949. ! BC and POM (anything except EDGAR, LPJ, HYMN and MEGAN)
  950. mask = (/ LRETROF, LAR5, LMACC, .false., .false., .false., .false., LGFED3, .false. /)
  951. nused = count(mask)
  952. if (nused /= 0) then
  953. allocate( used_providers_aer(nused) )
  954. used_providers_aer = pack( all_providers, mask)
  955. else
  956. has_aer_emis = .false.
  957. end if
  958. ! info
  959. if (has_isop_emis) then
  960. write(gol,*) 'EMISS-INFO - Emissions providers used for ISOP : ', used_providers_isop ; call goPr
  961. else
  962. write(gol,*) 'EMISS-INFO - Emissions providers used for ISOP : NONE' ; call goPr
  963. end if
  964. if ( has_ch4_emis ) then
  965. write(gol,*) 'EMISS-INFO - Emissions providers used for CH4 : ', used_providers_ch4 ; call goPr
  966. else
  967. write(gol,*) 'EMISS-INFO - Emissions providers used for CH4 : NONE' ; call goPr
  968. end if
  969. if ( has_aer_emis ) then
  970. write(gol,*) 'EMISS-INFO - Emissions providers used for BC/POM : ', used_providers_aer ; call goPr
  971. else
  972. write(gol,*) 'EMISS-INFO - Emissions providers used for BC/POM : NONE' ; call goPr
  973. end if
  974. if ( has_emis ) then
  975. write(gol,*) 'EMISS-INFO - Emissions providers used for others : ', used_providers ; call goPr
  976. else
  977. write(gol,*) 'EMISS-INFO - Emissions providers used for others : NONE' ; call goPr
  978. end if
  979. ! ------------------
  980. ! initialise sectors
  981. ! ------------------
  982. ! Type sequence is (name, category, is_3D_data, vdisttype, providers)
  983. sectors_def( 1) = sector_type('emiss_ene ', 'anthropogenic ', .false., 'combenergy ', 'AR5 ', NULL() ) ! Energy production & distribution
  984. sectors_def( 2) = sector_type('emiss_dom ', 'anthropogenic ', .false., 'combrescom ', 'AR5 ', NULL() ) ! Residential and commercial combustion
  985. sectors_def( 3) = sector_type('emiss_ind ', 'anthropogenic ', .false., 'industry ', 'AR5 ', NULL() ) ! Industrial processes and combustion
  986. sectors_def( 4) = sector_type('emiss_wst ', 'anthropogenic ', .false., 'waste ', 'AR5 ', NULL() ) ! Waste treatment and disposal
  987. sectors_def( 5) = sector_type('emiss_agr ', 'anthropogenic ', .false., 'surface ', 'AR5 ', NULL() ) ! Agriculture
  988. sectors_def( 6) = sector_type('emiss_awb ', 'anthropogenic ', .false., 'nearsurface ', 'AR5 ', NULL() ) ! Agricultural waste burning
  989. sectors_def( 7) = sector_type('emiss_slv ', 'anthropogenic ', .false., 'nearsurface ', 'AR5 ', NULL() ) ! Solvent production and use
  990. sectors_def( 8) = sector_type('emiss_tra ', 'anthropogenic ', .false., 'surface ', 'AR5 ', NULL() ) ! Land transport
  991. sectors_def( 9) = sector_type('emiss_shp ', 'ships ', .false., 'nearsurface ', 'AR5 ', NULL() ) ! Ships
  992. sectors_def(10) = sector_type('emiss_air ', 'aircraft ', .true. , 'aircraft ', 'AR5 ', NULL() ) ! Aircraft
  993. sectors_def(11) = sector_type('grassfire ', 'biomassburning', .false., 'nearsurface ', 'AR5 ', NULL() ) ! Grassland Fire
  994. sectors_def(12) = sector_type('forestfire', 'biomassburning', .false., 'forestfire ', 'AR5 ', NULL() ) ! Grassland Fire
  995. ! macc sectors (-> natural, missing in AR5 and EDGAR )
  996. sectors_def(13) = sector_type('emiss_soil', 'natural ', .false., 'surface ', 'MACC ', NULL() ) ! Natural sources (soil) - only for NO and NH3
  997. sectors_def(14) = sector_type('emiss_oc ', 'natural ', .false., 'surface ', 'MACC ', NULL() ) ! Natural sources (ocean)
  998. sectors_def(15) = sector_type('emiss_bio ', 'natural ', .false., 'surface ', 'MACC ', NULL() ) ! Natural sources (biogenic)
  999. sectors_def(16) = sector_type('emiss_nat ', 'natural ', .false., 'volcanic ', 'MACC ', NULL() ) ! Natural sources (volcanic)
  1000. if (LMACCITY) then
  1001. sectors_def(70) = sector_type('emiss_anthro', 'anthropogenic ', .false., 'combrescom ', 'MACC ', NULL() ) ! Anthropogenic (MACCITY only)
  1002. sectors_def(71) = sector_type('emiss_air ', 'aircraft ', .true. , 'aircraft ', 'MACC ', NULL() ) ! Aircraft (MACCITY only)
  1003. else
  1004. sectors_def(70) = sector_type('emiss_anthro', 'anthropogenic ', .false., 'combrescom ', 'DUMMY ', NULL() ) ! Off if MACC only to provide natural emissions
  1005. sectors_def(71) = sector_type('emiss_air ', 'aircraft ', .true. , 'aircraft ', 'DUMMY ', NULL() ) !
  1006. end if
  1007. ! MEGAN emissions from MACC
  1008. sectors_def(72) = sector_type('MEGAN_MACC ', 'natural ', .false., 'surface ', 'MEGAN ', NULL())! Natural sources (soil)
  1009. ! edgar 4.1 sectors
  1010. sectors_def(17) = sector_type('1A1_ENE ', 'anthropogenic ', .false., 'combenergy ', 'ED41 ', NULL()) ! Energy production & distribution
  1011. sectors_def(18) = sector_type('1A2_2 ', 'anthropogenic ', .false., 'industry ', 'ED41 ', NULL()) ! Industrial processes and combustion
  1012. sectors_def(19) = sector_type('1A3b_c_e ', 'anthropogenic ', .false., 'surface ', 'ED41 ', NULL()) ! Land transport
  1013. sectors_def(20) = sector_type('1A3a ', 'aircraft ', .true. , 'aircraft ', 'ED41 ', NULL()) ! Aircraft
  1014. sectors_def(21) = sector_type('1A3d_SHIP ', 'ships ', .false., 'nearsurface ', 'ED41 ', NULL()) ! Ships domestic
  1015. sectors_def(22) = sector_type('1A3d1 ', 'ships ', .false., 'nearsurface ', 'ED41 ', NULL()) ! Ships international
  1016. sectors_def(23) = sector_type('1A4_5 ', 'anthropogenic ', .false., 'combrescom ', 'ED41 ', NULL()) ! Residential and commercial combustion
  1017. sectors_def(24) = sector_type('1B ', 'anthropogenic ', .false., 'combenergy ', 'ED41 ', NULL()) ! Fugitive emissions
  1018. sectors_def(25) = sector_type('3 ', 'anthropogenic ', .false., 'nearsurface ', 'ED41 ', NULL()) ! Solvent emissions
  1019. sectors_def(26) = sector_type('4_but_4E ', 'anthropogenic ', .false., 'surface ', 'ED41 ', NULL()) ! Agriculture (soils, waste burning, livestock)
  1020. sectors_def(27) = sector_type('6A_6C ', 'anthropogenic ', .false., 'waste ', 'ED41 ', NULL()) ! Waste disposal and incineration
  1021. sectors_def(28) = sector_type('7 ', 'anthropogenic ', .false., 'waste ', 'ED41 ', NULL()) ! Fossil fuel fires
  1022. ! edgar 4.2 sectors
  1023. sectors_def(29) = sector_type('1A1a ', 'anthropogenic ', .false., 'combenergy ', 'ED42 ', NULL()) ! Energy production
  1024. sectors_def(30) = sector_type('1A1a_6 ', 'anthropogenic ', .false., 'combenergy ', 'ED42 ', NULL()) ! Energy production and waste (CO & NH3 sector; waste part is small compared to energy, so use energy vdist)
  1025. sectors_def(31) = sector_type('1A1a_6C ', 'anthropogenic ', .false., 'combenergy ', 'ED42 ', NULL()) ! Energy production and waste (SO2 sector; waste part is small compared to energy, so use energy vdist)
  1026. sectors_def(32) = sector_type('1A1_1A2 ', 'anthropogenic ', .false., 'industry ', 'ED42 ', NULL()) ! Energy and manufacturing industry (CH4 sector; energy part is small compared to industry, so use industry vdist)
  1027. sectors_def(33) = sector_type('1A1b_c ', 'anthropogenic ', .false., 'combenergy ', 'ED42 ', NULL()) ! Energy production
  1028. sectors_def(34) = sector_type('1A1b_c_1B_2C1_2C2', 'anthropogenic ', .false., 'combenergy ', 'ED42 ', NULL()) ! Energy, fugitive and metal industry (NMVOC sector; metal part is small, so use energy vdist)
  1029. sectors_def(35) = sector_type('1A2 ', 'anthropogenic ', .false., 'industry ', 'ED42 ', NULL()) ! Combustion in manufacturing industry
  1030. sectors_def(36) = sector_type('1A3 ', 'anthropogenic ', .false. , 'nearsurface', 'ED42 ', NULL()) ! Transport (including ships, aircraft!)
  1031. sectors_def(37) = sector_type('1A3a_c_d_e', 'anthropogenic ', .false. , 'nearsurface', 'ED42 ', NULL()) ! Non-road transport (including ships, aircraft!)
  1032. sectors_def(38) = sector_type('1A3b ', 'anthropogenic ', .false., 'surface ', 'ED42 ', NULL()) ! Road transport
  1033. sectors_def(39) = sector_type('1A4 ', 'anthropogenic ', .false., 'combrescom ', 'ED42 ', NULL()) ! Residential
  1034. sectors_def(40) = sector_type('1B1 ', 'anthropogenic ', .false., 'combenergy ', 'ED42 ', NULL()) ! Fugitive emissions
  1035. sectors_def(41) = sector_type('1B1_1B2_1A1b_c', 'anthropogenic ', .false., 'combenergy ', 'ED42 ', NULL()) ! Fugitive and energy emissions
  1036. sectors_def(42) = sector_type('1B2a ', 'anthropogenic ', .false., 'combenergy ', 'ED42 ', NULL()) ! Fugitive emissions
  1037. sectors_def(43) = sector_type('1B2b ', 'anthropogenic ', .false., 'combenergy ', 'ED42 ', NULL()) ! Fugitive emissions
  1038. sectors_def(44) = sector_type('1B2a_c_1A1b_c', 'anthropogenic ', .false., 'combenergy ', 'ED42 ', NULL()) ! Fugitive and energy emissions
  1039. sectors_def(45) = sector_type('2A_B_D_E_F_G', 'anthropogenic ', .false., 'industry ', 'ED42 ', NULL()) ! Industry emissions
  1040. sectors_def(46) = sector_type('2 ', 'anthropogenic ', .false., 'industry ', 'ED42 ', NULL()) ! Industry emissions
  1041. sectors_def(47) = sector_type('2A ', 'anthropogenic ', .false., 'industry ', 'ED42 ', NULL()) ! Industry emissions
  1042. sectors_def(48) = sector_type('2A_2B_2D ', 'anthropogenic ', .false., 'industry ', 'ED42 ', NULL()) ! Industry emissions
  1043. sectors_def(49) = sector_type('2B ', 'anthropogenic ', .false., 'industry ', 'ED42 ', NULL()) ! Industry emissions
  1044. sectors_def(50) = sector_type('2C ', 'anthropogenic ', .false., 'industry ', 'ED42 ', NULL()) ! Industry emissions
  1045. sectors_def(51) = sector_type('3 ', 'anthropogenic ', .false., 'nearsurface ', 'ED42 ', NULL()) ! Solvent emissions
  1046. sectors_def(52) = sector_type('4A ', 'anthropogenic ', .false., 'surface ', 'ED42 ', NULL()) ! Agriculture
  1047. sectors_def(53) = sector_type('4B ', 'anthropogenic ', .false., 'surface ', 'ED42 ', NULL()) ! Agriculture
  1048. sectors_def(54) = sector_type('4C_4D ', 'anthropogenic ', .false., 'surface ', 'ED42 ', NULL()) ! Agriculture
  1049. sectors_def(55) = sector_type('4F ', 'anthropogenic ', .false., 'surface ', 'ED42 ', NULL()) ! Agricultural waste burning
  1050. sectors_def(56) = sector_type('6A_6C ', 'anthropogenic ', .false., 'waste ', 'ED42 ', NULL()) ! Waste disposal and incineration
  1051. sectors_def(57) = sector_type('6B ', 'anthropogenic ', .false., 'waste ', 'ED42 ', NULL()) ! Waste disposal and incineration
  1052. sectors_def(58) = sector_type('7 ', 'anthropogenic ', .false., 'waste ', 'ED42 ', NULL()) ! Fossil fuel fires
  1053. sectors_def(59) = sector_type('7A ', 'anthropogenic ', .false., 'waste ', 'ED42 ', NULL()) ! Fossil fuel fires
  1054. sectors_def(60) = sector_type('5A_C_D_F_4E', 'biomassburning', .false., 'forestfire ', 'ED42 ', NULL()) ! Large scale biomass burning
  1055. ! natural methane emissions LPJ and HYMN project
  1056. sectors_def(61) = sector_type('wetlands ', 'natural ', .false., 'surface ', 'LPJ ',NULL()) ! Methane from wetlands
  1057. sectors_def(62) = sector_type('peatlands ', 'natural ', .false., 'surface ', 'LPJ ',NULL()) ! Methane from peatlands
  1058. sectors_def(63) = sector_type('wetsoils ', 'natural ', .false., 'surface ', 'LPJ ',NULL()) ! Methane from wet soils
  1059. sectors_def(64) = sector_type('soilconsumption', 'natural ', .false., 'surface ', 'LPJ ',NULL()) ! Methane soil uptake
  1060. sectors_def(65) = sector_type('oceans ', 'natural ', .false., 'surface ', 'HYMN ',NULL()) ! Methane ocean emissions
  1061. sectors_def(66) = sector_type('wildanimals', 'natural ', .false., 'surface ', 'HYMN ',NULL()) ! Methane emissions from wild animals
  1062. sectors_def(67) = sector_type('termites ', 'natural ', .false., 'surface ', 'HYMN ',NULL()) ! Methane ternite emissions
  1063. ! Biomass burning GFEDv3 monthly
  1064. sectors_def(68) = sector_type('wildfires ', 'biomassburning', .false., 'forestfire ', 'GFEDv3 ', NULL())
  1065. ! Biomass burning RETRO
  1066. sectors_def(69) = sector_type('fire_emis ', 'biomassburning', .false., 'forestfire ', 'RETRO ',NULL())
  1067. ! -------------------------
  1068. ! info per species
  1069. ! ------------------------
  1070. ! ED42 sectors are not available for all species, so we define a sectors list per species.
  1071. !! These are the "ALL AVAILABLE". Kept for reference.
  1072. !ed42_co_sectors = (/'1A1a_6 ', '1A2 ', '1A3a_c_d_e ', '1A3b ', '1A4 ', &
  1073. ! '1B2a_c_1A1b_c', '2A_2B_2D ', '2C ', '4F ', '5A_C_D_F_4E ', '7A ' /)
  1074. !
  1075. !ed42_ch4_sectors = (/'1A1_1A2 ', '1A3a_c_d_e ', '1A3b ', '1A4 ', '1B1 ', '1B2a ', &
  1076. ! '1B2b ', '2 ', '4A ', '4B ', '4C_4D ', '4F ', &
  1077. ! '5A_C_D_F_4E', '6A_6C ', '6B ', '7A '/)
  1078. !
  1079. !ed42_nox_sectors = (/'1A1a ', '1A2 ', '1A3a_c_d_e ', '1A3b ', '1A4 ',&
  1080. ! '1B2a_c_1A1b_c', '2 ', '4B ', '4C_4D ', '4F ',&
  1081. ! '5A_C_D_F_4E ', '6A_6C ', '7A ' /)
  1082. !
  1083. !ed42_hc_sectors = (/'1A1a ', '1A1b_c_1B_2C1_2C2', '1A2 ', '1A3a_c_d_e ', &
  1084. ! '1A3b ', '1A4 ', '2A_B_D_E_F_G ', '3 ', &
  1085. ! '4F ', '5A_C_D_F_4E ', '6A_6C ', '7A ' /)
  1086. !
  1087. !ed42_nh3_sectors = (/'1A1a_6 ', '1A1b_c ', '1A2 ', '1A3 ', '1A4 ', '2A ',&
  1088. ! '2B ', '4B ', '4C_4D ', '4F ', '5A_C_D_F_4E' /)
  1089. !
  1090. !ed42_so2_sectors = (/'1A1a_6C ', '1A2 ', '1A3a_c_d_e ', '1A3b ', '1A4 ',&
  1091. ! '1B1_1B2_1A1b_c', '2B_2D ', '2C ', '4F ', '5A_C_D_F_4E ', '7A '/)
  1092. ! Use only non-transport sectors (they are provided by ED41), and remove biomassburning:
  1093. ed42_co_sectors = (/'1A1a_6 ', '1A2 ', '1A4 ', '1B2a_c_1A1b_c', '2A_2B_2D ', &
  1094. '2C ', '4F ', '7A ' /)
  1095. ed42_ch4_sectors = (/'1A1_1A2 ', '1A4 ', '1B1 ', '1B2a ', '1B2b ', '2 ', &
  1096. '4A ', '4B ', '4C_4D ', '4F ', '6A_6C ', &
  1097. '6B ', '7A '/)
  1098. ed42_nox_sectors = (/'1A1a ', '1A2 ', '1A4 ', '1B2a_c_1A1b_c', '2 ', &
  1099. '4B ', '4C_4D ', '4F ', '6A_6C ', &
  1100. '7A ' /)
  1101. ! Note that '5A_C_D_F_4E' is not only fire, but it is available only for the NMVOC species which we do not use (instead we loop through emis_ar5_nvoc constituents) anyway
  1102. ed42_hc_sectors = (/'1A1a ', '1A1b_c_1B_2C1_2C2', '1A2 ', &
  1103. '1A4 ', '2A_B_D_E_F_G ', '3 ', &
  1104. '4F ', '6A_6C ', '7A ' /)
  1105. ed42_nh3_sectors = (/'1A1a_6 ', '1A1b_c ', '1A2 ', '1A4 ', '2A ', &
  1106. '2B ', '4B ', '4C_4D ', '4F ' /)
  1107. ed42_so2_sectors = (/'1A1a_6C ', '1A2 ', '1A4 ', '1B1_1B2_1A1b_c', '2B_2D ', &
  1108. '2C ', '4F ', '7A '/)
  1109. ! ED41 sectors are used only for the transport sector - the screening is
  1110. ! coded in the *declare routines of each emission_*.F90 according to
  1111. ! sector name. It boils down to four cases:
  1112. !
  1113. ! (/'1A3a', '1A3b_c_e', '1A3d1', '1A3d_SHIP'/) : NOx
  1114. ! (/'1A3b_c_e', '1A3d1', '1A3d_SHIP'/) : some NMVOC, CO, CH4, SOx
  1115. ! (/'1A3b_c_e'/) : some NMVOC, NH3
  1116. ! NONE : some NMVOC
  1117. ! AR5
  1118. sectors_def( 1)%species => ar5_cat_ant_ene_ind
  1119. sectors_def( 2)%species => ar5_cat_ant_dom
  1120. sectors_def( 3)%species => ar5_cat_ant_ene_ind
  1121. sectors_def( 4)%species => ar5_cat_ant
  1122. sectors_def( 5)%species => ar5_cat_ant_agr
  1123. sectors_def( 6)%species => ar5_cat_ant_awb
  1124. sectors_def( 7)%species => ar5_cat_ant_slv
  1125. sectors_def( 8)%species => ar5_cat_ant_tra
  1126. sectors_def( 9)%species => ar5_cat_shp
  1127. sectors_def(10)%species => ar5_cat_air
  1128. sectors_def(11)%species => ar5_cat_bmb
  1129. sectors_def(12)%species => ar5_cat_bmb
  1130. n_ar5_ant_sec=8 ! hardcoded but could be counted
  1131. n_ar5_shp_sec=1
  1132. n_ar5_air_sec=1
  1133. n_ar5_bmb_sec=2
  1134. ! -------------------------
  1135. ! initialise providers info
  1136. ! ------------------------
  1137. do iprov = 1, numb_providers
  1138. providers_def(iprov)%name = all_providers(iprov)
  1139. providers_def(iprov)%nsect2d = count( (sectors_def%prov == all_providers(iprov)) .and. (sectors_def%f3d .eqv. .false.))
  1140. providers_def(iprov)%nsect3d = count( (sectors_def%prov == all_providers(iprov)) .and. (sectors_def%f3d .eqv. .true.))
  1141. if(okdebug) then
  1142. write(gol,'("EMISS-INFO - Inventory ",a," has ",i3, " 2d-sectors, and ",i3," 3d-sectors")')&
  1143. & all_providers(iprov), providers_def(iprov)%nsect2d, providers_def(iprov)%nsect3d ; call goPr
  1144. endif
  1145. end do
  1146. ! -------------------------
  1147. ! initialise GeopPotential Height on 1x1
  1148. ! ------------------------
  1149. do region=1, nregions
  1150. call Set( gph_dat(region), status, used=.true. )
  1151. end do
  1152. ! ----------------------------------------
  1153. ! allocate gridbox_area arrays
  1154. ! ----------------------------------------
  1155. allocate( gridbox_area_05( nlon720, nlat360 ) )
  1156. #ifdef with_ch4_emis
  1157. allocate( lpj_gridbox_area ( lpj_dim_nlon, lpj_dim_nlat ) )
  1158. allocate( lpj_frac_wetlands ( lpj_dim_nlon, lpj_dim_nlat, 12 ) )
  1159. allocate( lpj_frac_rice ( lpj_dim_nlon, lpj_dim_nlat, 12 ) )
  1160. allocate( lpj_frac_peatlands ( lpj_dim_nlon, lpj_dim_nlat ) )
  1161. #endif
  1162. ! OK
  1163. status = 0
  1164. END SUBROUTINE EMISSION_READ_INIT
  1165. !EOC
  1166. !--------------------------------------------------------------------------
  1167. ! TM5 !
  1168. !--------------------------------------------------------------------------
  1169. !BOP
  1170. !
  1171. ! !IROUTINE: EMISSION_READ_DONE
  1172. !
  1173. ! !DESCRIPTION: Free allocated arrays.
  1174. !\\
  1175. !\\
  1176. ! !INTERFACE:
  1177. !
  1178. subroutine emission_read_done( status )
  1179. !
  1180. ! !OUTPUT PARAMETERS:
  1181. !
  1182. integer, intent(out) :: status
  1183. !
  1184. ! !REVISION HISTORY:
  1185. ! 1 Oct 2010 - Achim Strunk - v0
  1186. !
  1187. !EOP
  1188. !------------------------------------------------------------------------
  1189. !BOC
  1190. character(len=*), parameter :: rname=mname//'/emission_read_done'
  1191. deallocate( gridbox_area_05 )
  1192. #ifdef with_ch4_emis
  1193. deallocate( lpj_gridbox_area )
  1194. deallocate( lpj_frac_wetlands )
  1195. deallocate( lpj_frac_rice )
  1196. deallocate( lpj_frac_peatlands )
  1197. #endif
  1198. if (allocated( used_providers )) deallocate( used_providers )
  1199. if (allocated( used_providers_ch4 )) deallocate( used_providers_ch4 )
  1200. if (allocated( used_providers_isop)) deallocate( used_providers_isop )
  1201. if (allocated( used_providers_aer )) deallocate( used_providers_aer )
  1202. ! OK
  1203. status = 0
  1204. END SUBROUTINE EMISSION_READ_DONE
  1205. !EOC
  1206. !--------------------------------------------------------------------------
  1207. ! TM5 !
  1208. !--------------------------------------------------------------------------
  1209. !BOP
  1210. !
  1211. ! !FUNCTION: EMISSION_COARSEN_TO_1X1
  1212. !
  1213. ! !DESCRIPTION: Coarsen the gridded information to 1x1 deg.
  1214. ! (taken from GEMS/MACC repository)
  1215. !\\
  1216. !\\
  1217. ! !INTERFACE:
  1218. !
  1219. function emission_coarsen_to_1x1( emis_in, dim_nlon, dim_nlat, shift_lon, status )
  1220. !
  1221. ! !RETURN VALUE:
  1222. !
  1223. real, dimension(360,180) :: emission_coarsen_to_1x1
  1224. !
  1225. ! !INPUT PARAMETERS:
  1226. !
  1227. integer, intent(in) :: dim_nlon
  1228. integer, intent(in) :: dim_nlat
  1229. real, intent(in) :: emis_in(dim_nlon, dim_nlat)
  1230. logical, intent(in) :: shift_lon
  1231. !
  1232. ! OUTPUT PARAMETERS:
  1233. !
  1234. integer , intent(out) :: status
  1235. !
  1236. ! !REVISION HISTORY:
  1237. ! 1 Oct 2010 - Achim Strunk - v0 for AR5
  1238. ! 1 Dec 2011 - Narcisa Banda - works for any input resolution lower than 1x1
  1239. ! if 1x1 can be divided into exact number of gridcells (no interpolation)
  1240. ! 1 Jul 2012 - Narcisa Banda - added the shift_lon logical flag:
  1241. ! true if the data is read on longitudes [0,360] (then they need to be shifted on [-180,180])
  1242. ! false if the data is read already on [-180,180]
  1243. !
  1244. !EOP
  1245. !------------------------------------------------------------------------
  1246. !BOC
  1247. integer :: i, j
  1248. integer :: nri, nrj
  1249. ! --- begin -----------------------------------
  1250. ! combine grid cells :
  1251. ! from [ 0,360]x[-90,90] 001:360,361:720 001:360
  1252. ! to [-180,180]x[-90,90] 001:180,181:360 001:180
  1253. if ((mod(dim_nlon, 360) /= 0 ) .or. (mod(dim_nlat, 180) /= 0)) then
  1254. write(gol,*) 'coarsening of emissions to 1x1 does not work for this resolution' ; call goErr
  1255. status = 1
  1256. return
  1257. endif
  1258. nri = dim_nlon/360
  1259. nrj = dim_nlat/180
  1260. if (shift_lon) then
  1261. ! combine grid cells :
  1262. ! from [ 0,360]x[-90,90] 001:360,361:720 001:360
  1263. ! to [-180,180]x[-90,90] 001:180,181:360 001:180
  1264. do j = 1, 180
  1265. ! west half
  1266. do i = 1, 180
  1267. emission_coarsen_to_1x1(i,j) = sum(emis_in(nri*180+nri*i-nri+1:nri*180+nri*i,nrj*j-nrj+1:nrj*j))
  1268. end do
  1269. ! east half
  1270. do i = 1, 180
  1271. emission_coarsen_to_1x1(180+i,j) = sum(emis_in(nri*i-nri+1:nri*i,nrj*j-nrj+1:nrj*j))
  1272. end do
  1273. end do
  1274. else
  1275. do j=1, 180
  1276. do i=1, 360
  1277. emission_coarsen_to_1x1(i,j) = sum(emis_in(nri*i-nri+1:nri*i,nrj*j-nrj+1:nrj*j))
  1278. end do
  1279. end do
  1280. endif
  1281. ! ok
  1282. status = 0
  1283. end function emission_coarsen_to_1x1
  1284. !EOC
  1285. !--------------------------------------------------------------------------
  1286. ! TM5 !
  1287. !--------------------------------------------------------------------------
  1288. !BOP
  1289. !
  1290. ! !FUNCTION: VALID_YEAR
  1291. !
  1292. ! !DESCRIPTION: return a valid year for an emission inventory, based on
  1293. ! requested year.
  1294. !\\
  1295. !\\
  1296. ! !INTERFACE:
  1297. !
  1298. FUNCTION VALID_YEAR( iyear, iminmax, provider_name, verbose)
  1299. !
  1300. ! !RETURN VALUE:
  1301. !
  1302. integer :: valid_year
  1303. !
  1304. ! !INPUT PARAMETERS:
  1305. !
  1306. integer, intent(in) :: iyear, iminmax(2)
  1307. character(len=*), intent(in) :: provider_name
  1308. logical, intent(in) :: verbose
  1309. !
  1310. ! !REVISION HISTORY:
  1311. ! 26 Nov 2012 - Ph. Le Sager - v0
  1312. !
  1313. !EOP
  1314. !------------------------------------------------------------------------
  1315. !BOC
  1316. valid_year = MIN(iminmax(2),MAX(iyear,iminmax(1)))
  1317. ! info only once a year, and per inventory
  1318. if (verbose) then
  1319. write(gol,'(a,i4," (avail: ",i4,"-",i4,")")') ' EMISS-INFO - EMISS YEAR for '//trim(provider_name)//' : ', &
  1320. valid_year, iminmax ; call goPr
  1321. end if
  1322. END FUNCTION VALID_YEAR
  1323. !EOC
  1324. !--------------------------------------------------------------------------
  1325. ! TM5 !
  1326. !--------------------------------------------------------------------------
  1327. !BOP
  1328. !
  1329. ! !IROUTINE: EMISSION_AR5_READSECTOR
  1330. !
  1331. ! !DESCRIPTION: Reading one sector of the files to be interpolated and
  1332. ! returning an interpolated 3d emission field (d3data)
  1333. !\\
  1334. !\\
  1335. ! !INTERFACE:
  1336. !
  1337. subroutine emission_ar5_ReadSector( comp, iyear, imonth, sector, d3data, status )
  1338. !
  1339. ! !INPUT PARAMETERS:
  1340. !
  1341. character(len=*) , intent(in) :: comp
  1342. integer , intent(in) :: iyear
  1343. integer , intent(in) :: imonth
  1344. integer , intent(in) :: sector
  1345. !
  1346. ! !OUTPUT PARAMETERS:
  1347. !
  1348. integer , intent(out) :: status
  1349. real, dimension(nlon360,nlat180,ar5_dim_3ddata), intent(out) :: d3data
  1350. !
  1351. ! !REVISION HISTORY:
  1352. ! 1 Oct 2010 - Achim Strunk - v0
  1353. !
  1354. !EOP
  1355. !------------------------------------------------------------------------
  1356. !BOC
  1357. character(len=*), parameter :: rname = mname//'/emission_ar5_read2dsector'
  1358. character(len=256) :: fname
  1359. character(len=256) :: fname_gridboxarea
  1360. character(32) :: secname
  1361. integer :: lt, year
  1362. logical :: existfile
  1363. integer, dimension(2) :: ltimes
  1364. character(len=4), dimension(2) :: ar5_cyears
  1365. real, dimension(2) :: ar5_ipcoef_years
  1366. logical :: first=.true.
  1367. real, dimension(nlon360,nlat180) :: d2data
  1368. ! --- begin -----------------------------------
  1369. ! initialise target array
  1370. d3data = 0.0
  1371. ! read in gridbox-area; once per CPU
  1372. if( .not. area_found_05 ) then
  1373. fname_gridboxarea = trim(emis_input_dir_ar5)//'/'//trim(ar5_filestr_gridboxarea)
  1374. call emission_ReadGridboxArea(fname_gridboxarea, 'gridbox_area', gridbox_area_05, &
  1375. & nlon720, nlat360, status )
  1376. IF_NOTOK_RETURN(status=1)
  1377. area_found_05=.true.
  1378. endif
  1379. ! ----------------------------------------
  1380. ! get the right times to interpolate and related coefficients
  1381. ! (ar5_avail_yrs(ltimes))
  1382. !
  1383. ! --> result will be a linear interpolation between neighbouring files
  1384. !
  1385. ! ----------------------------------------
  1386. allocate( ltimeind( ar5_nr_avail_yrs ) )
  1387. ltimeind = .false.
  1388. ! deal with out-of-bounds requested years
  1389. year = valid_year( iyear, ar5_avail, 'AR5', first)
  1390. first=.false.
  1391. where( ar5_avail_yrs < year ) ltimeind = .true.
  1392. ! times(1): index representing time instance earlier than current year
  1393. ! times(2): -"- -"- later than current year
  1394. ltimes(2) = count( ltimeind ) + 1
  1395. ltimes(1) = max( ltimes(2) - 1, 1 )
  1396. ! check a match with repository
  1397. ! (in order to copy only one file instead of two)
  1398. if( ar5_avail_yrs(ltimes(2)) == year ) &
  1399. ltimes(1) = ltimes(2)
  1400. deallocate( ltimeind )
  1401. ! ar5_cyears will contain strings with the years
  1402. write(ar5_cyears(1),'(I4.4)') ar5_avail_yrs(ltimes(1))
  1403. write(ar5_cyears(2),'(I4.4)') ar5_avail_yrs(ltimes(2))
  1404. ! ar5_ipcoef_years will contain interpolation coefficients
  1405. ! default: factors 1.0/0.0
  1406. ar5_ipcoef_years(1) = 1.0
  1407. ar5_ipcoef_years(2) = 0.0
  1408. if( ltimes(2) /= ltimes(1) ) then
  1409. ar5_ipcoef_years(1) = (ar5_avail_yrs(ltimes(2)) - year) / &
  1410. real( ar5_avail_yrs(ltimes(2)) - ar5_avail_yrs(ltimes(1)) )
  1411. ar5_ipcoef_years(2) = 1.0 - ar5_ipcoef_years(1)
  1412. end if
  1413. ! ------------------------
  1414. ! read files (index=1: earlier file; index=2: later file)
  1415. ! ------------------------
  1416. do lt = 1, 2
  1417. if (ar5_ipcoef_years(lt) == 0.) cycle
  1418. ! ------------------------
  1419. ! construct filename
  1420. ! e.g.: <emisdir>/IPCC_emissions_RCP45_CO_biomassburning_2010_0.5x0.5_v1_21_12_2009.nc
  1421. ! ------------------------
  1422. if (trim(filestr_rcpiden)=='hist') then
  1423. fname = trim(emis_input_dir_ar5) //'/'// &
  1424. trim(filestr_common_pre) //'_'// &
  1425. trim(comp) //'_'// &
  1426. trim(sectors_def(sector)%catname) //'_'// &
  1427. ar5_cyears(lt) //'_'// &
  1428. trim(filestr_common_post)
  1429. else
  1430. fname = trim(emis_input_dir_ar5) //'/'// &
  1431. trim(filestr_common_pre) //'_'// &
  1432. trim(filestr_rcpiden) //'_'// &
  1433. trim(comp) //'_'// &
  1434. trim(sectors_def(sector)%catname) //'_'// &
  1435. ar5_cyears(lt) //'_'// &
  1436. trim(filestr_common_post)
  1437. endif
  1438. ! test existence of file
  1439. inquire( file=trim(fname), exist=existfile)
  1440. if( .not. existfile ) then
  1441. write (gol,'(" AR5 file `",a,"` not found ")') trim(fname); call goErr
  1442. status = 1; TRACEBACK; return
  1443. end if
  1444. ! ------------------------------------------------
  1445. ! data record is read by emission_ar5_Read2/3DRecord
  1446. ! add data scaled by interpolation factor ar5_ipcoef_years
  1447. secname = sectors_def(sector)%name
  1448. ! distinguish 2d/3d sectors
  1449. if( sectors_def(sector)%f3d ) then
  1450. d3data(:,:,:) = d3data(:,:,:) + ar5_ipcoef_years(lt) * &
  1451. emission_ar5_Read3DRecord( fname, secname, imonth, status )
  1452. else
  1453. !>>> TvN
  1454. ! Set sectoral emissions not provided in the historical AR5 files to zero
  1455. ! for years before 2000.
  1456. ! Note these emissions are non-zero in the RCPs.
  1457. ! It is assumed below that the data for 2000 (and 2005) are taken from the RCP files.
  1458. if ( ar5_avail_yrs(ltimes(lt)) .lt. 2000 .and. &
  1459. ( ( trim(secname) .eq. 'emiss_slv' .and. (trim(comp) .eq. 'CO') ) .or. &
  1460. ( trim(secname) .eq. 'emiss_agr' .and. &
  1461. ( trim(comp) .eq. 'acids' .or. &
  1462. trim(comp) .eq. 'alcohols' .or. &
  1463. trim(comp) .eq. 'benzene' .or. &
  1464. trim(comp) .eq. 'butanes' .or. &
  1465. trim(comp) .eq. 'ethane' .or. &
  1466. trim(comp) .eq. 'ethene' .or. &
  1467. trim(comp) .eq. 'ethers' .or. &
  1468. trim(comp) .eq. 'ethyne' .or. &
  1469. trim(comp) .eq. 'formaldehyde' .or. &
  1470. trim(comp) .eq. 'hexanes_and_higher_alkanes' .or. &
  1471. trim(comp) .eq. 'ketones' .or. &
  1472. trim(comp) .eq. 'other_alkanals' .or. &
  1473. trim(comp) .eq. 'other_alkenes_and_alkynes' .or. &
  1474. trim(comp) .eq. 'other_aromatics' .or. &
  1475. trim(comp) .eq. 'pentanes' .or. &
  1476. trim(comp) .eq. 'propane' .or. &
  1477. trim(comp) .eq. 'propene' .or. &
  1478. trim(comp) .eq. 'toluene' .or. &
  1479. trim(comp) .eq. 'xylene' ) ) ) ) then
  1480. d2data(:,:) = 0.
  1481. else
  1482. d2data(:,:) = emission_ar5_Read2DRecord( fname, secname, imonth, status )
  1483. endif
  1484. !d3data(:,:,1) = d3data(:,:,1) + ar5_ipcoef_years(lt) * &
  1485. ! emission_ar5_Read2DRecord( fname, secname, imonth, status )
  1486. d3data(:,:,1) = d3data(:,:,1) + ar5_ipcoef_years(lt) * d2data(:,:)
  1487. !<<< TvN
  1488. end if
  1489. IF_NOTOK_RETURN(status=1)
  1490. end do ! lt
  1491. end subroutine emission_ar5_ReadSector
  1492. !EOC
  1493. !--------------------------------------------------------------------------
  1494. ! TM5 !
  1495. !--------------------------------------------------------------------------
  1496. !BOP
  1497. !
  1498. ! !FUNCTION: EMISSION_AR5_READ2DRECORD
  1499. !
  1500. ! !DESCRIPTION: Read a single 2d record of a given file and
  1501. ! return a 2d emission field interpolated on 1x1 grid.
  1502. !\\
  1503. !\\
  1504. ! !INTERFACE:
  1505. !
  1506. function emission_ar5_Read2DRecord( fname, secname, imonth, status )
  1507. !
  1508. ! !RETURN VALUE:
  1509. !
  1510. real :: emission_ar5_Read2DRecord(nlon360,nlat180)
  1511. !
  1512. ! !INPUT PARAMETERS:
  1513. !
  1514. character(len=*), intent(in) :: fname
  1515. character(len=sector_name_len), intent(in) :: secname
  1516. integer, intent(in) :: imonth
  1517. !
  1518. ! !OUTPUT PARAMETERS:
  1519. !
  1520. integer, intent(out) :: status
  1521. !
  1522. ! !REVISION HISTORY:
  1523. ! 1 Oct 2010 - Achim Strunk - v0
  1524. !
  1525. !EOP
  1526. !------------------------------------------------------------------------
  1527. !BOC
  1528. character(len=*), parameter :: rname = mname//'/emission_ar5_Read2DRecord'
  1529. integer :: fid, varid
  1530. real :: emis_in(nlon720, nlat360, 1)
  1531. ! --- begin -----------------------------------
  1532. ! initialise
  1533. emission_ar5_Read2DRecord = 0.0
  1534. CALL MDF_Open( TRIM(fname), MDF_NETCDF, MDF_READ, fid, status )
  1535. IF_NOTOK_RETURN(status=1)
  1536. CALL MDF_Inq_VarID( fid, TRIM(secname), varid, status )
  1537. IF_ERROR_RETURN(status=1)
  1538. if ( varid < 0 ) then
  1539. write (gol,'("EMISS - AR5 - no `",a,"` emissions in file ",a)') &
  1540. secname, trim(fname) ; call goErr
  1541. status=1; TRACEBACK; return
  1542. else
  1543. if( okdebug ) then
  1544. write (gol,'("EMISS-INFO - AR5 - found `",a,"` emissions in file ",a)') &
  1545. secname, trim(fname) ; call goPr
  1546. endif
  1547. CALL MDF_Get_Var( fid, varid, emis_in, status, start=(/1,1,imonth/) )
  1548. IF_NOTOK_RETURN(status=1)
  1549. ! convert from kg(species)/m^2/s to kg(species)/gridbox/s
  1550. emis_in(:,:,1) = emis_in(:,:,1) * gridbox_area_05
  1551. ! now coarsen to nlon360,nlat180
  1552. emission_ar5_Read2DRecord = emission_coarsen_to_1x1( emis_in(:,:,1), nlon720, nlat360,.true., status )
  1553. IF_NOTOK_RETURN(status=1)
  1554. end if
  1555. CALL MDF_Close( fid, status )
  1556. IF_NOTOK_RETURN(status=1)
  1557. status = 0
  1558. return
  1559. end function emission_ar5_Read2DRecord
  1560. !EOC
  1561. !--------------------------------------------------------------------------
  1562. ! TM5 !
  1563. !--------------------------------------------------------------------------
  1564. !BOP
  1565. !
  1566. ! !FUNCTION: EMISSION_AR5_READ3DRECORD
  1567. !
  1568. ! !DESCRIPTION: read one 3D sector
  1569. !
  1570. !\\
  1571. !\\
  1572. ! !INTERFACE:
  1573. !
  1574. function emission_ar5_Read3DRecord( fname, secname, imonth, status )
  1575. !
  1576. ! !RETURN VALUE:
  1577. !
  1578. real :: emission_ar5_Read3DRecord(nlon360,nlat180,ar5_dim_3ddata)
  1579. !
  1580. ! !INPUT/OUTPUT PARAMETERS:
  1581. !
  1582. character(len=*), intent(in) :: fname
  1583. character(32), intent(inout) :: secname
  1584. !
  1585. ! !INPUT PARAMETERS:
  1586. !
  1587. integer, intent(in) :: imonth
  1588. !
  1589. ! !OUTPUT PARAMETERS:
  1590. !
  1591. integer, intent(out) :: status
  1592. !
  1593. ! !REVISION HISTORY:
  1594. ! 1 Oct 2010 - Achim Strunk -
  1595. !
  1596. ! !REMARKS:
  1597. !
  1598. !EOP
  1599. !------------------------------------------------------------------------
  1600. !BOC
  1601. character(len=*), parameter :: rname = mname//'/emission_ar5_Read3DRecord'
  1602. integer :: fid, varid, lk
  1603. real, dimension(nlon720,nlat360,ar5_dim_3ddata,1) :: emis_in
  1604. ! --- begin -----------------------------------
  1605. ! initialise
  1606. emission_ar5_Read3DRecord = 0.0
  1607. CALL MDF_Open( TRIM(fname), MDF_NETCDF, MDF_READ, fid, status )
  1608. IF_NOTOK_RETURN(status=1)
  1609. CALL MDF_Inq_VarID( fid, TRIM(secname), varid, status )
  1610. IF_ERROR_RETURN(status=1)
  1611. if ( varid < 0 ) then
  1612. write (gol,'("EMISS - AR5 - no `",a,"` emissions in file ",a)') &
  1613. secname, trim(fname) ; call goErr
  1614. status=1; TRACEBACK; return
  1615. else
  1616. if( okdebug ) then
  1617. write (gol,'("EMISS-INFO - AR5 - found `",a,"` emissions in file ",a)') &
  1618. secname, trim(fname) ; call goPr
  1619. endif
  1620. CALL MDF_Get_Var( fid, varid, emis_in, status, start=(/1,1,1,imonth/) )
  1621. IF_NOTOK_RETURN(status=1)
  1622. do lk = 1, ar5_dim_3ddata
  1623. ! convert from kg(species)/m^2/s to kg(species)/gridbox/s :
  1624. emis_in(:,:,lk,1) = emis_in(:,:,lk,1) * gridbox_area_05
  1625. ! now coarsen to nlon360,nlat180
  1626. emission_ar5_Read3DRecord(:,:,lk) = emission_coarsen_to_1x1( emis_in(:,:,lk,1) ,&
  1627. & nlon720, nlat360, .true., status )
  1628. IF_NOTOK_RETURN(status=1)
  1629. end do
  1630. end if
  1631. CALL MDF_Close( fid, status )
  1632. IF_NOTOK_RETURN(status=1)
  1633. status = 0
  1634. return
  1635. end function emission_ar5_Read3DRecord
  1636. !EOC
  1637. !--------------------------------------------------------------------------
  1638. ! TM5 !
  1639. !--------------------------------------------------------------------------
  1640. !BOP
  1641. !
  1642. ! !IROUTINE: EMISSION_READGRIDBOXAREA
  1643. !
  1644. ! !DESCRIPTION:
  1645. ! reading gridbox surface areas for 0.5 x 0.5 Edgar 4
  1646. ! needed to scale the emissions from mass/m^2 to mass/grid
  1647. !\\
  1648. !\\
  1649. ! !INTERFACE:
  1650. !
  1651. subroutine emission_ReadGridboxArea(fname, recname, gridbox_area, dim_nlon, dim_nlat, status )
  1652. !
  1653. ! !INPUT PARAMETERS:
  1654. !
  1655. character(len=*), intent(in) :: fname
  1656. character(len=*), intent(in) :: recname
  1657. integer, intent(in) :: dim_nlon
  1658. integer, intent(in) :: dim_nlat
  1659. !
  1660. ! !OUTPUT PARAMETERS:
  1661. !
  1662. integer, intent(out) :: status
  1663. real, dimension(dim_nlon, dim_nlat), intent(out) :: gridbox_area
  1664. !
  1665. ! !REVISION HISTORY:
  1666. !
  1667. ! 1 Oct 2010 - Achim Strunk - v0
  1668. ! 1 Dec 2011 - Narcisa Banda - generalized it for any gridbox area size
  1669. !
  1670. ! !REMARKS:
  1671. !
  1672. !EOP
  1673. !------------------------------------------------------------------------
  1674. !BOC
  1675. character(len=*), parameter :: rname = mname//'/emission_ReadGridboxArea'
  1676. integer :: fid, varid
  1677. ! --- begin -----------------------------------
  1678. CALL MDF_Open( TRIM(fname), MDF_NETCDF, MDF_READ, fid, status )
  1679. IF_NOTOK_RETURN(status=1)
  1680. CALL MDF_Inq_VarID( fid, TRIM(recname), varid, status )
  1681. IF_ERROR_RETURN(status=1)
  1682. CALL MDF_Get_Var( fid, varid, gridbox_area, status )
  1683. IF_NOTOK_RETURN(status=1)
  1684. CALL MDF_Close( fid, status )
  1685. IF_NOTOK_RETURN(status=1)
  1686. status = 0
  1687. end subroutine emission_ReadGridboxArea
  1688. !EOC
  1689. !--------------------------------------------------------------------------
  1690. ! TM5 !
  1691. !--------------------------------------------------------------------------
  1692. !BOP
  1693. !
  1694. ! !IROUTINE: EMISSION_AR5_REGRID_AIRCRAFT
  1695. !
  1696. ! !DESCRIPTION: Vertical regridding of the AR5 aircraft data.
  1697. ! The vertical levels of the input data are hard coded.
  1698. ! (Taken from GFED_daily_AR5 (VH) and left as is)
  1699. !\\
  1700. !\\
  1701. ! !INTERFACE:
  1702. !
  1703. subroutine emission_ar5_regrid_aircraft(region, i0, j0, field_in, field_out, status )
  1704. !
  1705. ! !USES:
  1706. !
  1707. use meteodata, only : gph_dat
  1708. use tm5_distgrid, only : dgrid, get_distgrid
  1709. use dims, only : lm
  1710. !
  1711. ! !OUTPUT PARAMETERS:
  1712. !
  1713. integer, intent(out) :: status
  1714. !
  1715. ! !INPUT PARAMETERS:
  1716. !
  1717. integer, intent(in) :: region, i0, j0
  1718. real, dimension(i0:, j0:, 1:), intent(in) :: field_in
  1719. real, dimension(i0:, j0:, 1:), intent(out) :: field_out
  1720. !
  1721. ! !REVISION HISTORY:
  1722. ! 1 Oct 2010 - Achim Strunk - Taken from GFED_daily_AR5 (VH) and left as is
  1723. ! 3 Dec 2012 - Ph. Le Sager - modified for lat-lon mpi decomposition
  1724. ! - work with zoom regions
  1725. ! - mass conservation per column
  1726. !
  1727. ! !REMARKS:
  1728. !
  1729. !EOP
  1730. !------------------------------------------------------------------------
  1731. !BOC
  1732. character(len=*), parameter :: rname = mname//'/emission_ar5_regrid_aircraft'
  1733. integer, parameter :: lm_in=25 ! must be same as ar5_dim_3ddata !
  1734. real, dimension(:,:,:), pointer :: gph ! geopotential height (m)
  1735. integer :: i,j,l
  1736. real, dimension(lm_in) :: height_in_min, height_in_max
  1737. real, allocatable :: dz(:), height(:)
  1738. real :: height_min,height_max
  1739. real :: height_out_min,height_out_max
  1740. real, dimension(lm_in), parameter :: height_in=(/ & ! Height in meter
  1741. 305., 915., 1525., 2135., 2745., 3355., 3965., 4575., 5185., 5795., &
  1742. 6405., 7015., 7625., 8235., 8845., 9455.,10065.,10675.,11285., &
  1743. 11895.,12505.,13115.,13725.,14335.,14945./)
  1744. real :: dz_in(25)
  1745. integer :: l_in, i1, i2, j1, j2, lmr
  1746. real :: total_in, total_out, total_ratio
  1747. ! --- begin --------------------------------------
  1748. call golabel()
  1749. gph => gph_dat(region)%data
  1750. CALL GET_DISTGRID( dgrid(region), I_STRT=i1, I_STOP=i2, J_STRT=j1, J_STOP=j2 )
  1751. lmr = lm(region)
  1752. allocate(dz(lmr), height(lmr+1))
  1753. ! sanity check
  1754. if (okdebug) then
  1755. if (i1/=i0 .or. j1/=j0) then
  1756. status = 1 ; TRACEBACK
  1757. return
  1758. end if
  1759. if (lm_in /= ubound(field_in,3) ) then
  1760. write(gol,*)'wrong vertical input resolution'; call goErr
  1761. status = 1
  1762. TRACEBACK; return
  1763. endif
  1764. if ((ubound(field_out,3)+1) /= ubound(gph,3)) then
  1765. write(gol,*)'wrong vertical output resolution'; call goErr
  1766. status = 1
  1767. TRACEBACK; return
  1768. endif
  1769. end if
  1770. ! locally flat atmosphere assumed
  1771. ! area linear in i,j
  1772. ! height above sea level
  1773. height_in_min(1)=0.
  1774. do l_in = 2,lm_in
  1775. height_in_min(l_in)=(height_in(l_in-1)+height_in(l_in))/2.
  1776. enddo
  1777. height_in_max(lm_in)=15555.
  1778. do l_in = 1,lm_in-1
  1779. height_in_max(l_in)=(height_in(l_in)+height_in(l_in+1))/2.
  1780. enddo
  1781. ! init
  1782. field_out = 0.0
  1783. ! regrid
  1784. do i=i1, i2
  1785. do j=j1, j2
  1786. total_in = 0.0
  1787. ! calculate total input emissions
  1788. do l_in=1, lm_in
  1789. dz_in(l_in) = height_in_max(l_in)-height_in_min(l_in)
  1790. total_in =total_in + field_in(i,j,l_in)*dz_in(l_in)
  1791. enddo
  1792. ! zero based height:
  1793. height(1) = 0.0
  1794. do l=1, lmr
  1795. dz(l) = gph(i,j,l+1) - gph(i,j,l)
  1796. height(l+1) = height(l) + dz(l)
  1797. enddo
  1798. do l=1,lmr-1
  1799. height_out_min=height(l)
  1800. height_out_max=height(l+1)
  1801. ! write(*,*)'DO AR5- regrid - C2',i,j,l,height_out_min,height_out_max
  1802. do l_in=1,lm_in
  1803. if (height_out_max .le. height_in_min(l_in)) exit
  1804. if (height_out_min .lt. height_in_max(l_in)) then
  1805. height_max=min(height_out_max,height_in_max(l_in))
  1806. height_min=max(height_out_min,height_in_min(l_in))
  1807. ! helpfield as field_in is ordered from high to low
  1808. ! field_out(i,j,l) = field_out(i,j,l) + helpfield2(i,j,lm_in-l_in+1)* &
  1809. ! (height_max-height_min)/(height_in_max(l_in)-height_in_min(l_in))
  1810. ! helpfield as field_in is ordered from low to high
  1811. ! write(*,*)'DO AR5- regrid - C',i,j,l,l_in,height_max-height_min
  1812. field_out(i,j,l) = field_out(i,j,l) + field_in(i,j,l_in)* &
  1813. (height_max-height_min) ! kg/m -> kg / gridbox
  1814. endif
  1815. enddo
  1816. enddo
  1817. ! conserve total exactly: not possible because units are in kg/m...
  1818. total_out = sum(field_out(i,j,:))
  1819. if (total_out /= 0) then
  1820. total_ratio = total_in/total_out
  1821. field_out(i,j,:) = field_out(i,j,:)*total_ratio
  1822. end if
  1823. enddo
  1824. enddo
  1825. deallocate(dz, height)
  1826. call golabel()
  1827. ! ok
  1828. status = 0
  1829. end subroutine emission_ar5_regrid_aircraft
  1830. !EOC
  1831. !--------------------------------------------------------------------------
  1832. ! TM5 !
  1833. !--------------------------------------------------------------------------
  1834. !BOP
  1835. !
  1836. ! !IROUTINE: EMISSION_MACC_READSECTOR
  1837. !
  1838. ! !DESCRIPTION: Read an MACC sector field out of an open file.
  1839. !\\
  1840. !\\
  1841. ! !INTERFACE:
  1842. !
  1843. subroutine emission_macc_ReadSector( fpath, comp, iyear, imonth, fext, recname, unit, emis, status )
  1844. !
  1845. ! !USES:
  1846. !
  1847. use chem_param, only : xmn, xmno2
  1848. !
  1849. ! !INPUT PARAMETERS:
  1850. !
  1851. character(len=*), intent(in) :: fpath ! dir
  1852. character(len=*), intent(in) :: comp ! species name (as in filename)
  1853. integer, intent(in) :: iyear
  1854. integer, intent(in) :: imonth
  1855. character(len=*), intent(in) :: fext ! tail of filename
  1856. character(len=*), intent(in) :: recname ! sector name
  1857. character(len=*), intent(in) :: unit
  1858. !
  1859. ! !OUTPUT PARAMETERS:
  1860. !
  1861. real, intent(out) :: emis(nlon360,nlat180,ar5_dim_3ddata)
  1862. integer, intent(out) :: status
  1863. !
  1864. ! !REVISION HISTORY:
  1865. ! 1 Oct 2010 - Achim Strunk -
  1866. ! 28 Nov 2012 - Ph. Le Sager - switch to MDF interface
  1867. ! 6 Jan 2014 - Ph. Le Sager - code for MACCity: 3D emission field to deal with IPCC aircraft file
  1868. !
  1869. ! !REMARKS:
  1870. !
  1871. !EOP
  1872. !------------------------------------------------------------------------
  1873. !BOC
  1874. character(len=*), parameter :: rname = mname//'/emission_macc_ReadSector'
  1875. character(len=256) :: fname
  1876. character(len=256) :: fname_gridboxarea
  1877. character(len=32) :: fcomp
  1878. integer :: fid, varid, year, lk
  1879. real :: emis_in( nlon720, nlat360, ar5_dim_3ddata, 1)
  1880. logical :: first=.true.
  1881. ! --- begin -----------------------------------
  1882. ! read in gridbox-area; same name as ar5 gridbox area file
  1883. if( .not. area_found_05 ) then
  1884. fname_gridboxarea = trim(emis_input_dir_mac)//'/'//trim(ar5_filestr_gridboxarea)
  1885. call emission_ReadGridboxArea(fname_gridboxarea, 'gridbox_area', gridbox_area_05, &
  1886. & nlon720, nlat360, status )
  1887. IF_NOTOK_RETURN(status=1)
  1888. area_found_05 = .true.
  1889. endif
  1890. ! file name component:
  1891. fcomp = comp
  1892. year = valid_year( iyear, macc_avail, 'MACC', first)
  1893. first = .false.
  1894. ! zero field
  1895. emis = 0.0
  1896. !=== FILENAME
  1897. if (trim(recname) == "emiss_air") then ! If MACC-CITY, specific handling of aircraft emissions
  1898. ! available only for NO or BC
  1899. if ( (trim(fcomp) /= "NO").and.(trim(fcomp) /= "BC") ) return
  1900. write (fname,'(a,"/IPCC_emissions_",a,"_aircraft_",i4.4,"_0.5x0.5.nc")') trim(fpath), trim(fcomp), year
  1901. else
  1902. write (fname,'(a,"/JUELICH_MACC_reanalysis_",a,"_",i4.4,"_",a)') trim(fpath), trim(fcomp), year, trim(fext)
  1903. end if
  1904. !=== SCREEN OUT cases without data (There are more cases, but they are already handled in calling routines.)
  1905. ! ***************************************************************************
  1906. ! ****** THIS IS MESSY. IT NEEDS CONSOLIDATION: SHOULD BUILD LIST OF ********
  1907. ! ****** SECTORS PER SPECIES, LIKE ED42 ********
  1908. ! ***************************************************************************
  1909. if (trim(recname) == "emiss_oc") then
  1910. ! no "emiss_oc" for : C2H5OH, BIGALK, ISOPRENE, TERPENES, BIGENE, TOLUENE, CH2O, CH3CHO, CH3COCH3, MEK
  1911. ! only for : C2H6, C3H8, C2H4, C3H6, NH3, and CO
  1912. if ( (trim(fcomp) /= "C2H6").and.(trim(fcomp) /= "C3H8").and.(trim(fcomp) /= "C2H4").and.&
  1913. (trim(fcomp) /= "C3H6").and.(trim(fcomp) /= "NH3").and.(trim(fcomp) /= "CO") ) return
  1914. else if (trim(recname) == "emiss_anthro") then
  1915. ! there is no "emiss_anthro" for : ISOPRENE, TERPENES
  1916. if ( (trim(fcomp) == "ISOPRENE").or.(trim(fcomp) == "TERPENES") ) return
  1917. end if
  1918. if (trim(recname) == "emiss_bio") then
  1919. ! We arrive here if we are not using MEGAN. No "emiss_bio" for C2H5OH, BIGALK, BIGENE:
  1920. if ( (trim(fcomp) == "C2H5OH").or.(trim(fcomp) == "BIGALK").or.(trim(fcomp) == "BIGENE") ) return
  1921. endif
  1922. if (trim(fcomp) == "BC") then
  1923. if ((trim(recname) /= "emiss_anthro").and.(trim(recname) /= "emiss_air") ) return
  1924. endif
  1925. if ((trim(fcomp) == "OC").and.(trim(recname) /= "emiss_anthro")) return
  1926. !=== READ
  1927. CALL MDF_Open( TRIM(fname), MDF_NETCDF, MDF_READ, fid, status )
  1928. IF_NOTOK_RETURN(status=1)
  1929. CALL MDF_Inq_VarID( fid, trim(recname), varid, status )
  1930. IF_NOTOK_RETURN(status=1)
  1931. if( okdebug ) then
  1932. write (gol,'("EMISS-INFO - MACC - found `",a,"` emissions category in file `",a,"`")') trim(recname), trim(fname); call goPr
  1933. endif
  1934. ! 3D
  1935. if (trim(recname) == "emiss_air") then
  1936. CALL MDF_Get_Var( fid, varid, emis_in, status, start=(/1,1,1,imonth/) )
  1937. IF_NOTOK_RETURN(status=1)
  1938. do lk = 1, ar5_dim_3ddata
  1939. ! convert from kg(species)/m^2/s to kg(species)/gridbox/s :
  1940. emis_in(:,:,lk,1) = emis_in(:,:,lk,1) * gridbox_area_05
  1941. ! now coarsen to nlon360,nlat180
  1942. emis(:,:,lk) = emission_coarsen_to_1x1( emis_in(:,:,lk,1) , nlon720, nlat360, .true., status )
  1943. IF_NOTOK_RETURN(status=1)
  1944. end do
  1945. else !2D
  1946. CALL MDF_Get_Var( fid, varid, emis_in(:,:,1,1), status, start=(/1,1,imonth/) )
  1947. IF_NOTOK_RETURN(status=1)
  1948. ! convert from kg(species)/m^2/s to kg(species)/s
  1949. emis_in(:,:,1,1) = emis_in(:,:,1,1) * gridbox_area_05
  1950. ! combine grid cells
  1951. emis(:,:,1) = emission_coarsen_to_1x1( emis_in(:,:,1,1), nlon720, nlat360, .true., status )
  1952. IF_NOTOK_RETURN(status=1)
  1953. endif
  1954. CALL MDF_Close( fid, status )
  1955. IF_NOTOK_RETURN(status=1)
  1956. status = 0
  1957. end subroutine Emission_macc_ReadSector
  1958. !EOC
  1959. !--------------------------------------------------------------------------
  1960. ! TM5 !
  1961. !--------------------------------------------------------------------------
  1962. !BOP
  1963. !
  1964. ! !IROUTINE: EMISSION_ED4_READSECTOR
  1965. !
  1966. ! !DESCRIPTION: Read an EDAGR-4 sector field out of an open file.
  1967. !
  1968. !\\
  1969. !\\
  1970. ! !INTERFACE:
  1971. !
  1972. function emission_ed4_Read2DRecord( fname, secname, status )
  1973. !
  1974. ! !RETURN VALUE:
  1975. !
  1976. real :: emission_ed4_Read2DRecord(nlon360,nlat180)
  1977. !
  1978. ! !INPUT PARAMETERS:
  1979. !
  1980. character(len=*), intent(in) :: fname
  1981. character(32), intent(in) :: secname
  1982. !
  1983. ! !OUTPUT PARAMETERS:
  1984. !
  1985. integer, intent(out) :: status
  1986. !
  1987. ! !REVISION HISTORY:
  1988. ! 1 Apr 2012 - Narcisa Banda - v0
  1989. !
  1990. ! !REMARKS:
  1991. !
  1992. !EOP
  1993. !------------------------------------------------------------------------
  1994. !BOC
  1995. character(len=*), parameter :: rname = mname//'/emission_ed4_Read2DRecord'
  1996. integer :: fid, varid
  1997. real, dimension(nlon720,nlat360) :: emis_in
  1998. ! initialise
  1999. emission_ed4_Read2DRecord = 0.0
  2000. ! search for the record
  2001. CALL MDF_Open( TRIM(fname), MDF_NETCDF, MDF_READ, fid, status )
  2002. IF_NOTOK_RETURN(status=1)
  2003. CALL MDF_Inq_VarID( fid, secname, varid, status )
  2004. IF_ERROR_RETURN(status=1)
  2005. if ( varid < 0 ) then
  2006. write (gol,'("EMISS-INFO - ED41 - no `",a,"` emissions in file", a)') &
  2007. trim(secname), trim(fname); call goPr
  2008. status=1; TRACEBACK; return
  2009. else
  2010. if( okdebug ) then
  2011. write (gol,'("EMISS-INFO - ED41 - found `",a,"` emissions in file", a)') &
  2012. trim(secname), trim(fname); call goPr
  2013. endif
  2014. CALL MDF_Get_Var( fid, varid, emis_in, status )
  2015. IF_NOTOK_RETURN(status=1)
  2016. ! convert from kg(species)/m^2/s to kg(species)/s
  2017. emis_in = emis_in * gridbox_area_05
  2018. ! combine grid cells
  2019. emission_ed4_Read2DRecord = emission_coarsen_to_1x1( emis_in , nlon720, nlat360, .true., status )
  2020. IF_NOTOK_RETURN(status=1)
  2021. end if
  2022. CALL MDF_Close( fid, status )
  2023. IF_NOTOK_RETURN(status=1)
  2024. status = 0
  2025. return
  2026. end function Emission_ed4_Read2DRecord
  2027. !EOC
  2028. !--------------------------------------------------------------------------
  2029. ! TM5 !
  2030. !--------------------------------------------------------------------------
  2031. !BOP
  2032. !
  2033. ! !IROUTINE: EMISSION_ED4_READSECTOR
  2034. !
  2035. ! !DESCRIPTION: Reading one sector of the files to be interpolated and
  2036. ! returning an interpolated 3d emission field (d3data)
  2037. !\\
  2038. !\\
  2039. ! !INTERFACE:
  2040. !
  2041. subroutine emission_ed4_ReadSector( fpath, comp, compl, iyear, imonth, sector, version, unit, d3data, status)
  2042. !
  2043. ! !INPUT PARAMETERS:
  2044. !
  2045. character(len=*), intent(in) :: fpath
  2046. character(len=*), intent(in) :: comp
  2047. character(len=*), intent(in) :: compl
  2048. integer, intent(in) :: iyear
  2049. integer, intent(in) :: sector
  2050. character(len=*), intent(in) :: version
  2051. character(len=*), intent(in) :: unit
  2052. integer, intent(in) :: imonth
  2053. !
  2054. ! !OUTPUT PARAMETERS:
  2055. !
  2056. integer, intent(out) :: status
  2057. real, intent(out) :: d3data( nlon360, nlat180, ar5_dim_3ddata)
  2058. !
  2059. ! !REVISION HISTORY:
  2060. ! 1 Apr 2012 - Narcisa Banda - v0
  2061. !
  2062. ! !REMARKS:
  2063. !
  2064. !EOP
  2065. !------------------------------------------------------------------------
  2066. !BOC
  2067. character(len=*), parameter :: rname = mname//'/emission_ed4_readsector'
  2068. character(len=256) :: fname
  2069. character(len=256) :: fname_gridboxarea
  2070. character(len=sector_name_len) :: secname
  2071. character(len=32) :: recname
  2072. character(len=4) :: ver
  2073. integer :: lt, year
  2074. logical :: existfile
  2075. logical :: first41=.true., first42=.true.
  2076. integer, dimension(2) :: ltimes
  2077. character(len=4), dimension(2) :: ed41_cyears
  2078. real, dimension(2) :: ed41_ipcoef_years
  2079. ! --- begin -----------------------------------
  2080. ! initialise target array
  2081. d3data = 0.0
  2082. ! read in gridbox-area; once per CPU
  2083. if( .not. area_found_05 ) then
  2084. fname_gridboxarea = trim(emis_input_dir_ar5)//'/'//trim(ed4_filestr_gridboxarea)
  2085. call emission_ReadGridboxArea(fname_gridboxarea, 'cell_area', gridbox_area_05, &
  2086. & nlon720, nlat360, status )
  2087. IF_NOTOK_RETURN(status=1)
  2088. area_found_05 = .true.
  2089. endif
  2090. ! ------------------------
  2091. ! target year(s)
  2092. ! ------------------------
  2093. if (version == 'ED41') then
  2094. ver='41'
  2095. year = valid_year( iyear, ed41_avail, 'EDGAR 4.1', first41)
  2096. first41=.false.
  2097. allocate( ltimeind( ed41_nr_avail_yrs ) )
  2098. ltimeind = .false.
  2099. where( ed41_avail_yrs < year ) ltimeind = .true.
  2100. ! times(1): index representing time instance earlier than current year
  2101. ! times(2): -"- -"- later than current year
  2102. ltimes(2) = count( ltimeind ) + 1
  2103. ltimes(1) = max( ltimes(2) - 1, 1 )
  2104. ! check a match with repository (in order to copy only one file instead of two)
  2105. if( ed41_avail_yrs(ltimes(2)) == year ) ltimes(1) = ltimes(2)
  2106. deallocate( ltimeind )
  2107. ! ed41_cyears will contain strings with the years
  2108. write(ed41_cyears(1),'(I4.4)') ed41_avail_yrs(ltimes(1))
  2109. write(ed41_cyears(2),'(I4.4)') ed41_avail_yrs(ltimes(2))
  2110. ! ed41_ipcoef_years will contain interpolation coefficients
  2111. ! default: factors 1.0/0.0
  2112. ed41_ipcoef_years(1) = 1.0
  2113. ed41_ipcoef_years(2) = 0.0
  2114. if( ltimes(2) /= ltimes(1) ) then
  2115. ed41_ipcoef_years(1) = (ed41_avail_yrs(ltimes(2)) - year) / &
  2116. real( ed41_avail_yrs(ltimes(2)) - ed41_avail_yrs(ltimes(1)) )
  2117. ed41_ipcoef_years(2) = 1.0 - ed41_ipcoef_years(1)
  2118. end if
  2119. else if (version == 'ED42') then
  2120. ver='42'
  2121. year = valid_year( iyear, ed42_avail, 'EDGAR 4.2', first42)
  2122. first42=.false.
  2123. else
  2124. write (gol,'("ERROR - This version of EDGAR has not been implemented ")'); call goErr
  2125. status=1; TRACEBACK; return
  2126. endif
  2127. ! ------------------------
  2128. ! read files (EDv4.1 - index=1: earlier file; index=2: later file)
  2129. ! ------------------------
  2130. recname = 'emi_'//trim(compl)
  2131. if (version=='ED41') then
  2132. do lt = 1, 2
  2133. if (ed41_ipcoef_years(lt) == 0.) cycle
  2134. write (fname,'(a,"/v",a,"_",a,"_",a,"_IPCC_",a,".0.5x0.5.nc")') trim(fpath), trim(ver), trim(comp), &
  2135. & ed41_cyears(lt), trim(sectors_def(sector)%name)
  2136. ! test existence of file
  2137. inquire( file=trim(fname), exist=existfile)
  2138. if( .not. existfile ) then
  2139. write (gol,'(" EDGAR4.1 - file `",a,"` not found ")') trim(fname); call goErr
  2140. status=1; TRACEBACK; return
  2141. end if
  2142. ! distinguish 2d/3d sectors
  2143. if( sectors_def(sector)%f3d ) then
  2144. d3data(:,:,:) = d3data(:,:,:) + ed41_ipcoef_years(lt) * &
  2145. emission_ar5_Read3DRecord( trim(fname), recname, imonth, status )
  2146. else
  2147. d3data(:,:,1) = d3data(:,:,1) + ed41_ipcoef_years(lt) * &
  2148. emission_ed4_Read2DRecord( trim(fname), recname, status )
  2149. end if
  2150. IF_NOTOK_RETURN(status=1)
  2151. enddo
  2152. else
  2153. write (fname,'(a,"/v",a,"_",a,"_",i4.4,"_IPCC_",a,".0.5x0.5.nc")') trim(fpath), trim(ver), trim(comp), &
  2154. & year, trim(sectors_def(sector)%name)
  2155. ! test existence of file
  2156. inquire( file=trim(fname), exist=existfile)
  2157. if( .not. existfile ) then
  2158. write (gol,'(" EDGAR4.2 - file `",a,"` not found ")') trim(fname); call goErr
  2159. status=1; TRACEBACK; return
  2160. end if
  2161. if( sectors_def(sector)%f3d ) then
  2162. d3data(:,:,:) = d3data(:,:,:) + emission_ar5_Read3DRecord( trim(fname), recname, imonth, status )
  2163. else
  2164. d3data(:,:,1) = d3data(:,:,1) + emission_ed4_Read2DRecord( trim(fname), recname, status )
  2165. end if
  2166. IF_NOTOK_RETURN(status=1)
  2167. end if
  2168. status=0
  2169. end subroutine emission_ed4_ReadSector
  2170. !EOC
  2171. !--------------------------------------------------------------------------
  2172. ! TM5 !
  2173. !--------------------------------------------------------------------------
  2174. !BOP
  2175. !
  2176. ! !IROUTINE: EMISSION_LPJ_READSECTOR
  2177. !
  2178. ! !DESCRIPTION: Read an LPJ sector field out of an open file.
  2179. !\\
  2180. !\\
  2181. ! !INTERFACE:
  2182. !
  2183. subroutine emission_LPJ_ReadSector( fpath, iyear, imonth, sector, unit, emis, status )
  2184. !
  2185. ! !USES:
  2186. !
  2187. use dims, only : sec_year
  2188. !
  2189. ! !INPUT PARAMETERS:
  2190. !
  2191. character(len=*), intent(in) :: fpath
  2192. integer, intent(in) :: iyear
  2193. integer, intent(in) :: imonth
  2194. character(len=*), intent(in) :: sector
  2195. character(len=*), intent(in) :: unit
  2196. !
  2197. ! !OUTPUT PARAMETERS:
  2198. !
  2199. real, intent(out) :: emis(nlon360,nlat180)
  2200. integer, intent(out) :: status
  2201. !
  2202. ! !REVISION HISTORY:
  2203. ! 1 Oct 2010 - Achim Strunk - v0
  2204. !
  2205. ! !REMARKS:
  2206. !
  2207. !EOP
  2208. !------------------------------------------------------------------------
  2209. !BOC
  2210. character(len=*), parameter :: rname = mname//'/emission_LPJ_ReadSector'
  2211. ! --- local -----------------------------------
  2212. character(len=256) :: fname
  2213. character(len=256) :: fname_gridboxarea
  2214. real :: emis_in(lpj_dim_nlon,lpj_dim_nlat,1)
  2215. integer :: fid, varid, year, i, j
  2216. logical :: first=.true.
  2217. ! --- begin -----------------------------------
  2218. ! read in gridbox-area; once per CPU
  2219. if( .not. lpj_area_found ) then
  2220. fname_gridboxarea = trim(fpath)//'/'//trim(lpj_filestr_gridboxarea)
  2221. call emission_ReadGridboxArea(fname_gridboxarea, 'areaw', lpj_gridbox_area, &
  2222. & lpj_dim_nlon, lpj_dim_nlat, status )
  2223. lpj_area_found = .true.
  2224. IF_NOTOK_RETURN(status=1)
  2225. endif
  2226. ! Following emissions are from the EU HYMN project via the LPJ model (Spahni et al., Biogeosciences, 2011)
  2227. ! Three categories used: peatlands, wetsoils and wetlands
  2228. ! units in inputfiles: g CH4/y/m2
  2229. ! coverage is 60S - 90N ; no emissions south of 60S
  2230. ! grid cells with any emission have values -999 there skip in the summing across all emission types
  2231. !
  2232. ! CALCULATION EXAMPLE FOR CH4 FLUXES (e.g. for the year 2004):
  2233. ! ***************************************************************************
  2234. ! PEATLAND FLUX per grid cell (PLFpgc):
  2235. ! PLF = lpj_NHpeatlands_2004.nc(ch4_flux) * 0.75
  2236. ! PLFpgc = PLF * A * PF/2.61
  2237. ! "The PLF is corrected for microtopography of peatlands: half of the area emits only half as much thus 25% less in total [Wania et al., 2010]"
  2238. ! "The PF map overestimates total peatland area by a factor of 2.61 compared to Prigent et al., 2007"
  2239. !RICE AGRICULTURE FLUX per grid cell (RAFpgc) - Not Used as implicitly in EDGAR 4.0
  2240. !RAF = lpj_rice_2004.nc(ch4_flux)
  2241. !RAFpgc = RAF * A * RF
  2242. !WETLAND FLUX per grid cell (WLFpgc):
  2243. !WLF = lpj_wetlands_2004.nc(ch4_flux)
  2244. !WLFpgc = WLF * A * IF
  2245. !WETSOILS FLUX per grid cell (WSFpgc):
  2246. !WSF = lpj_wetsoils_2004.nc(ch4_flux)
  2247. !WSFpgc = WSF * A * (1-PF/2.61-IF-RF)
  2248. !"PF is set =0 between 60°S-45°N, IF is set =0 between 45°N-90°N"
  2249. !TOTAL NET FLUX per grid cell (TFpgc):
  2250. !TFpgc = PLFpgc + WLFpgc + RAFpgc + WSFpgc - SCFpgc
  2251. !e.g. for 2004 this results in a global net source:
  2252. !TFpgc = 28.17 + 81.31 + 43.11 + 63.16 - 25.83 Tg CH4/year
  2253. !TFpgc = 189.92 Tg CH4/year
  2254. !
  2255. ! sink term for uptake of CH4 by soils given in mg CH4/ y/ m2 / ppmv(CH4)
  2256. ! therefore store field and then apply later on using latitudinal average for CH4
  2257. !
  2258. ! SOIL CONSUMPTION FLUX per grid cell (SCFpgc):
  2259. ! SCF = lpj_soilconsumption_2004.nc(ch4_flux)
  2260. ! or
  2261. ! SCF = lpj_soilconsumption-perconc_2004.nc(ch4_flux) * atm. CH4 (in ppmv)
  2262. ! SCFpgc = SCF * A * (1-IF-RF) "peatland grid cells are already excluded"
  2263. if( .not. lpj_fractions_found ) then
  2264. fname = trim(fpath)//'/maps/lpj_natwet_fraction.nc'
  2265. CALL MDF_Open( TRIM(fname), MDF_NETCDF, MDF_READ, fid, status )
  2266. IF_NOTOK_RETURN(status=1)
  2267. CALL MDF_Inq_VarID( fid, 'inund', varid, status )
  2268. IF_ERROR_RETURN(status=1)
  2269. CALL MDF_Get_Var( fid, varid, lpj_frac_wetlands, status )
  2270. IF_NOTOK_RETURN(status=1)
  2271. CALL MDF_Close( fid, status )
  2272. IF_NOTOK_RETURN(status=1)
  2273. fname = trim(fpath)//'/maps/lpj_rice_fraction.nc'
  2274. CALL MDF_Open( TRIM(fname), MDF_NETCDF, MDF_READ, fid, status )
  2275. IF_NOTOK_RETURN(status=1)
  2276. CALL MDF_Inq_VarID( fid, 'rice', varid, status )
  2277. IF_ERROR_RETURN(status=1)
  2278. CALL MDF_Get_Var( fid, varid, lpj_frac_rice, status )
  2279. IF_NOTOK_RETURN(status=1)
  2280. CALL MDF_Close( fid, status )
  2281. IF_NOTOK_RETURN(status=1)
  2282. fname = trim(fpath)//'/maps/lpj_peatland_fraction.nc'
  2283. CALL MDF_Open( TRIM(fname), MDF_NETCDF, MDF_READ, fid, status )
  2284. IF_NOTOK_RETURN(status=1)
  2285. CALL MDF_Inq_VarID( fid, 'scfrac', varid, status )
  2286. IF_ERROR_RETURN(status=1)
  2287. CALL MDF_Get_Var( fid, varid, lpj_frac_peatlands, status )
  2288. IF_NOTOK_RETURN(status=1)
  2289. CALL MDF_Close( fid, status )
  2290. IF_NOTOK_RETURN(status=1)
  2291. lpj_fractions_found = .true.
  2292. lpj_frac_peatlands = lpj_frac_peatlands/2.61
  2293. endif
  2294. year = valid_year( iyear, lpj_avail, 'LPJ', first)
  2295. first=.false.
  2296. ! target file name with year
  2297. if (trim(sector).eq.'soilconsumption') then
  2298. write (fname,'(a,"/",a,"/lpj_",a,"-perconc_",i4.4,".nc")') trim(fpath), trim(sector), trim(sector), year
  2299. else
  2300. write (fname,'(a,"/",a,"/lpj_",a,"_",i4.4,".nc")') trim(fpath), trim(sector), trim(sector), year
  2301. end if
  2302. CALL MDF_Open( TRIM(fname), MDF_NETCDF, MDF_READ, fid, status )
  2303. IF_NOTOK_RETURN(status=1)
  2304. CALL MDF_Inq_VarID( fid, 'ch4_flux', varid, status )
  2305. IF_NOTOK_RETURN(status=1)
  2306. if( okdebug ) then
  2307. write (gol,'("EMISS-INFO - LPJ - found ch4 emissions for sector `",a,"` in file ",a)') &
  2308. trim(sector), trim(fname); call goPr
  2309. endif
  2310. emis = 0.0
  2311. ! extract record for requested month
  2312. CALL MDF_Get_Var( fid, varid, emis_in, status, start=(/1,1,imonth/) )
  2313. IF_NOTOK_RETURN(status=1)
  2314. do j=1,lpj_dim_nlat
  2315. do i=1, lpj_dim_nlon
  2316. if(emis_in(i,j,1)>0.) then
  2317. select case( trim(sector) )
  2318. case('wetlands')
  2319. !convert from [g m-2 per year] to [kg per cell per sec]
  2320. emis(i,j+30) = emis_in(i,j,1)*lpj_gridbox_area(i,j)*lpj_frac_wetlands(i,j,imonth)*(1.e-3/sec_year)
  2321. case('peatlands')
  2322. emis(i,j+30) = emis_in(i,j,1)*0.75*lpj_gridbox_area(i,j)*lpj_frac_peatlands(i,j)*(1.e-3/sec_year)
  2323. case('wetsoils')
  2324. emis(i,j+30) = emis_in(i,j,1)*lpj_gridbox_area(i,j)*&
  2325. &(1.-lpj_frac_wetlands(i,j,imonth)-lpj_frac_peatlands(i,j)-lpj_frac_rice(i,j,imonth))*(1.e-3/sec_year)
  2326. case('rice')
  2327. emis(i,j+30) = emis_in(i,j,1)*lpj_gridbox_area(i,j)*lpj_frac_rice(i,j,imonth)*(1.e-3/sec_year)
  2328. case('soilconsumption')
  2329. !convert from [mg m-2 per year per ppmv] to [kg per cell per sec per ppmv]
  2330. emis(i,j+30) = emis_in(i,j,1)*lpj_gridbox_area(i,j)*&
  2331. &(1. - lpj_frac_wetlands(i,j,imonth) - lpj_frac_rice(i,j,imonth))*(1.e-6/sec_year)
  2332. end select
  2333. endif
  2334. enddo
  2335. enddo
  2336. ! no coarsening needed, but used to shift the longitudes from [0, 360]
  2337. ! to [-180, 180]
  2338. emis = emission_coarsen_to_1x1( emis, nlon360, nlat180,.true., status )
  2339. CALL MDF_Close( fid, status )
  2340. IF_NOTOK_RETURN(status=1)
  2341. status = 0
  2342. end subroutine Emission_LPJ_ReadSector
  2343. !EOC
  2344. !--------------------------------------------------------------------------
  2345. ! TM5 !
  2346. !--------------------------------------------------------------------------
  2347. !BOP
  2348. !
  2349. ! !IROUTINE: EMISSION_HYMN_READSECTOR
  2350. !
  2351. ! !DESCRIPTION: Read a HYMN Non-LPJ sector field out of an open file.
  2352. !\\
  2353. !\\
  2354. ! !INTERFACE:
  2355. !
  2356. subroutine emission_HYMN_ReadSector( fpath, sector, unit, emis, status )
  2357. !
  2358. ! !USES:
  2359. !
  2360. use dims, only : sec_year, dxy11
  2361. !
  2362. ! !INPUT PARAMETERS:
  2363. !
  2364. character(len=*), intent(in) :: fpath
  2365. character(len=*), intent(in) :: sector
  2366. character(len=*), intent(in) :: unit
  2367. !
  2368. ! !OUTPUT PARAMETERS:
  2369. !
  2370. real, intent(out) :: emis(nlon360,nlat180)
  2371. integer, intent(out) :: status
  2372. !
  2373. ! !REVISION HISTORY:
  2374. ! 1 Oct 2010 - Achim Strunk - v0
  2375. !
  2376. ! !REMARKS:
  2377. !
  2378. !EOP
  2379. !------------------------------------------------------------------------
  2380. !BOC
  2381. character(len=*), parameter :: rname = mname//'/emission_HYMN_ReadSector'
  2382. ! --- local -----------------------------------
  2383. character(len=256) :: fname
  2384. character(len=256) :: fname_gridboxarea
  2385. integer :: fid, varid, i, j
  2386. real :: emis_in(nlon360,nlat180,1,1)
  2387. character(len=80) :: title
  2388. character(len=80) :: units
  2389. ! --- begin -----------------------------------
  2390. ! target file name with year
  2391. select case(trim(sector))
  2392. case('oceans')
  2393. write (fname,'(a,"/CH4-natural-nonLPJ/CH4-N40-Lambert-0000-sfc-glb100x100.hdf")' ) trim(fpath)
  2394. case('wildanimals')
  2395. write (fname,'(a,"/CH4-natural-nonLPJ/CH4-N70-Olson-0000-sfc-glb100x100.hdf")' ) trim(fpath)
  2396. case('termites')
  2397. write (fname,'(a,"/CH4-natural-nonLPJ/CH4-N71-Sanderson-0000-sfc-glb100x100.hdf")') trim(fpath)
  2398. end select
  2399. CALL MDF_Open( TRIM(fname), MDF_HDF4, MDF_READ, fid, status )
  2400. IF_NOTOK_RETURN(status=1)
  2401. CALL MDF_Inq_VarID( fid, 'field', varid, status )
  2402. IF_NOTOK_RETURN(status=1)
  2403. if( okdebug ) then
  2404. write (gol,'("EMISS-INFO - HYMN - found ch4 emissions from sector `",a,"` in file ",a)') &
  2405. trim(sector), trim(fname); call goPr
  2406. endif
  2407. emis = 0.0
  2408. CALL MDF_Get_Var( fid, varid, emis_in, status )
  2409. IF_NOTOK_RETURN(status=1)
  2410. do j=1,nlat180
  2411. do i=1, nlon360
  2412. ! from [kg fm cl-1 yr-1] or [1e-10 kg/m2/yr] to [kg/cell/sec]
  2413. emis(i,j) = emis_in(i,j,1,1)*dxy11(j) *1.e-10/sec_year
  2414. enddo
  2415. enddo
  2416. CALL MDF_Close( fid, status )
  2417. IF_NOTOK_RETURN(status=1)
  2418. status = 0
  2419. end subroutine Emission_HYMN_ReadSector
  2420. !EOC
  2421. !--------------------------------------------------------------------------
  2422. ! TM5 !
  2423. !--------------------------------------------------------------------------
  2424. !BOP
  2425. !
  2426. ! !IROUTINE: emission_gfed_ReadSector
  2427. !
  2428. ! !DESCRIPTION: Read GFEDv3 out of an open file.
  2429. !\\
  2430. !\\
  2431. ! !INTERFACE:
  2432. !
  2433. subroutine emission_gfed_ReadSector( fpath, comp, iyear, imonth, recname, unit, emis, status )
  2434. !
  2435. ! !USES:
  2436. !
  2437. use chem_param, only : xmn, xmno2
  2438. !
  2439. ! !INPUT PARAMETERS:
  2440. !
  2441. character(len=*), intent(in) :: fpath
  2442. character(len=*), intent(in) :: comp
  2443. integer, intent(in) :: iyear
  2444. integer, intent(in) :: imonth
  2445. character(len=*), intent(in) :: recname
  2446. character(len=*), intent(in) :: unit
  2447. !
  2448. ! !OUTPUT PARAMETERS:
  2449. !
  2450. real, intent(out) :: emis(nlon360,nlat180)
  2451. integer, intent(out) :: status
  2452. !
  2453. ! !REVISION HISTORY:
  2454. ! 1 Oct 2010 - Achim Strunk -
  2455. !
  2456. ! !REMARKS:
  2457. !
  2458. !EOP
  2459. !------------------------------------------------------------------------
  2460. !BOC
  2461. character(len=*), parameter :: rname = mname//'/emission_gfed_ReadSector'
  2462. ! --- local -----------------------------------
  2463. character(len=256) :: fname
  2464. real :: emis_in(nlon720,nlat360,1)
  2465. real :: emis_help(nlon360,nlat180)
  2466. integer :: fid, varid, year, j
  2467. logical :: first=.true.
  2468. ! --- begin -----------------------------------
  2469. ! target file name with year
  2470. year = valid_year( iyear, gfed3_avail, 'GFEDv3', first)
  2471. first=.false.
  2472. write (fname,'(a,"/GFEDv3_surface_",a,"_",i4.4,".0.5x0.5.nc")') trim(fpath), trim(comp), year
  2473. ! read in gridbox-area; once per CPU
  2474. if( .not. area_found_05 ) then
  2475. call emission_ReadGridboxArea(fname, 'gridbox_area', gridbox_area_05, &
  2476. & nlon720, nlat360, status )
  2477. IF_NOTOK_RETURN(status=1)
  2478. area_found_05 = .true.
  2479. endif
  2480. CALL MDF_Open( TRIM(fname), MDF_NETCDF, MDF_READ, fid, status )
  2481. IF_NOTOK_RETURN(status=1)
  2482. CALL MDF_Inq_VarID( fid, trim(recname), varid, status )
  2483. IF_ERROR_RETURN(status=1)
  2484. if ( varid < 0 ) then
  2485. write (gol,'("EMISS-INFO - GFEDv3 - no `",a,"` emissions for `",a,"` in file ",a)') &
  2486. trim(recname), trim(comp), trim(fname); call goErr
  2487. status=1; TRACEBACK; return
  2488. else
  2489. if( okdebug ) then
  2490. write (gol,'("EMISS-INFO - GFEDv3 - found `",a,"` emissions for `",a,"` in file ",a)') &
  2491. trim(recname), trim(comp), trim(fname); call goPr
  2492. endif
  2493. CALL MDF_Get_Var( fid, varid, emis_in, status, start=(/1,1,imonth/) )
  2494. IF_NOTOK_RETURN(status=1)
  2495. ! convert from kg(species)/m^2/s to kg(species)/s
  2496. emis_in(:,:,1) = emis_in(:,:,1) * gridbox_area_05
  2497. ! combine grid cells :
  2498. if (trim(comp)=='bc' .or. trim(comp)=='oc') then
  2499. ! GFED3 emissions of BC and OC are correctly given in the files.
  2500. ! They don't need a shift in the zonal direction, but latitudes need to be reversed.
  2501. emis_help = emission_coarsen_to_1x1( emis_in(:,:,1), nlon720, nlat360, .false., status )
  2502. IF_NOTOK_RETURN(status=1)
  2503. do j=1,nlat180
  2504. emis(:,j)=emis_help(:,nlat180-j+1)
  2505. end do
  2506. else
  2507. ! GFED3 emissions of other components are erroneously shifted by 180 degrees in the files.
  2508. ! This is corrected by applying a shift to the data.
  2509. emis = emission_coarsen_to_1x1( emis_in(:,:,1), nlon720, nlat360, .true., status )
  2510. IF_NOTOK_RETURN(status=1)
  2511. endif
  2512. endif
  2513. CALL MDF_Close( fid, status )
  2514. IF_NOTOK_RETURN(status=1)
  2515. status = 0
  2516. end subroutine Emission_gfed_ReadSector
  2517. !EOC
  2518. !--------------------------------------------------------------------------
  2519. ! TM5 !
  2520. !--------------------------------------------------------------------------
  2521. !BOP
  2522. !
  2523. ! !IROUTINE: emission_retro_ReadSector
  2524. !
  2525. ! !DESCRIPTION: Read a RETRO sector field out of an open file.
  2526. !\\
  2527. !\\
  2528. ! !INTERFACE:
  2529. !
  2530. subroutine emission_retro_ReadSector( fpath, comp, iyear, imonth, recname, unit, emis, status )
  2531. !
  2532. ! !USES:
  2533. !
  2534. use chem_param, only : xmn, xmno2
  2535. !
  2536. ! !INPUT PARAMETERS:
  2537. !
  2538. character(len=*), intent(in) :: fpath
  2539. character(len=*), intent(in) :: comp
  2540. integer, intent(in) :: iyear
  2541. integer, intent(in) :: imonth
  2542. character(len=*), intent(in) :: recname
  2543. character(len=*), intent(in) :: unit
  2544. !
  2545. ! !OUTPUT PARAMETERS:
  2546. !
  2547. real, intent(out) :: emis(nlon360,nlat180)
  2548. integer, intent(out) :: status
  2549. !
  2550. ! !REVISION HISTORY:
  2551. ! 1 Oct 2010 - Achim Strunk -
  2552. !
  2553. ! !REMARKS:
  2554. !
  2555. !EOP
  2556. !------------------------------------------------------------------------
  2557. !BOC
  2558. character(len=*), parameter :: rname = mname//'/emission_retro_ReadSector'
  2559. character(len=256) :: fname
  2560. real :: emis_in(nlon720,nlat360,1)
  2561. integer :: fid, varid, year
  2562. logical :: first=.true.
  2563. ! --- begin -----------------------------------
  2564. year = valid_year( iyear, retro_avail, 'RETRO', first)
  2565. first=.false.
  2566. write (fname,'(a,"/RETRO_FIRES_V2_",i4.4,"_",a,"_aggregated.nc")') trim(fpath), year, trim(comp)
  2567. ! read in gridbox-area
  2568. if( .not. area_found_05 ) then
  2569. call emission_ReadGridboxArea(fname, 'gridbox_area', gridbox_area_05, &
  2570. & nlon720, nlat360, status )
  2571. IF_NOTOK_RETURN(status=1)
  2572. area_found_05 = .true.
  2573. endif
  2574. CALL MDF_Open( TRIM(fname), MDF_NETCDF, MDF_READ, fid, status )
  2575. IF_NOTOK_RETURN(status=1)
  2576. CALL MDF_Inq_VarID( fid, trim(recname), varid, status )
  2577. IF_ERROR_RETURN(status=1)
  2578. if ( varid < 0 ) then
  2579. write (gol,'("EMISS-INFO - RETRO - no `",a,"` emissions for `",a,"` in file ", a)') &
  2580. trim(recname), trim(comp), trim(fname); call goErr
  2581. status=1; TRACEBACK; return
  2582. else
  2583. if( okdebug ) then
  2584. write (gol,'("EMISS-INFO - RETRO - found `",a,"` emissions for `",a,"` in file ", a)') &
  2585. trim(recname), trim(comp), trim(fname); call goPr
  2586. endif
  2587. CALL MDF_Get_Var( fid, varid, emis_in, status, start=(/1,1,imonth/) )
  2588. IF_NOTOK_RETURN(status=1)
  2589. !convert from kg(species)/m^2/s to kg(species)/s
  2590. emis_in(:,:,1) = emis_in(:,:,1) * gridbox_area_05
  2591. ! combine grid cells :
  2592. emis = emission_coarsen_to_1x1( emis_in(:,:,1), nlon720, nlat360, .true., status )
  2593. IF_NOTOK_RETURN(status=1)
  2594. end if ! emis category found
  2595. CALL MDF_Close( fid, status )
  2596. IF_NOTOK_RETURN(status=1)
  2597. status = 0
  2598. end subroutine Emission_retro_ReadSector
  2599. !EOC
  2600. !--------------------------------------------------------------------------
  2601. ! TM5 !
  2602. !--------------------------------------------------------------------------
  2603. !BOP
  2604. !
  2605. ! !IROUTINE: emission_megan_ReadSector
  2606. !
  2607. ! !DESCRIPTION: Read a MACC-MEGAN sector field out of an open file.
  2608. !\\
  2609. !\\
  2610. ! !INTERFACE:
  2611. !
  2612. subroutine emission_megan_ReadSector( fpath, comp, iyear, imonth, recname, unit, emis, status )
  2613. !
  2614. ! !USES:
  2615. !
  2616. use chem_param, only : xmn, xmno2
  2617. !
  2618. ! !INPUT PARAMETERS:
  2619. !
  2620. character(len=*), intent(in) :: fpath
  2621. character(len=*), intent(in) :: comp
  2622. integer, intent(in) :: iyear
  2623. integer, intent(in) :: imonth
  2624. character(len=*), intent(in) :: recname
  2625. character(len=*), intent(in) :: unit
  2626. !
  2627. ! !OUTPUT PARAMETERS:
  2628. !
  2629. real, intent(out) :: emis(nlon360,nlat180)
  2630. integer, intent(out) :: status
  2631. integer :: i,j
  2632. !
  2633. ! REVISION HISTORY:
  2634. ! 29 Jan 2014 - Jason Williams -
  2635. !
  2636. ! !REMARKS:
  2637. !
  2638. !EOP
  2639. !------------------------------------------------------------------------
  2640. !BOC
  2641. character(len=*), parameter :: rname = mname//'/emission_megan_ReadSector'
  2642. character(len=256) :: fname
  2643. real :: emis_in(nlon720,nlat360,1)
  2644. real :: flip_array(360,180)
  2645. integer :: fid, varid, year
  2646. logical :: first=.true.
  2647. ! --- begin -----------------------------------
  2648. ! target file name with year
  2649. year = valid_year( iyear, megan_avail, 'MACC-MEGAN', first)
  2650. first=.false.
  2651. write (fname,'(a,"/MEGAN-MACC_biogenic_",i4.4,"_",a,".nc")') trim(fpath), year, trim(comp)
  2652. ! read in gridbox-area; once per CPU
  2653. if( .not. area_found_05 ) then
  2654. call emission_ReadGridboxArea(fname, 'gridbox_area', gridbox_area_05, nlon720, nlat360, status )
  2655. IF_NOTOK_RETURN(status=1)
  2656. area_found_05 = .true.
  2657. endif
  2658. CALL MDF_Open( TRIM(fname), MDF_NETCDF, MDF_READ, fid, status )
  2659. IF_NOTOK_RETURN(status=1)
  2660. CALL MDF_Inq_VarID( fid, trim(recname), varid, status )
  2661. IF_ERROR_RETURN(status=1)
  2662. if ( varid < 0 ) then
  2663. write (gol,'("EMISS-INFO - MACC-MEGAN - no `",a,"` emissions for `",a,"` in file ", a)') &
  2664. trim(recname), trim(comp), trim(fname); call goErr
  2665. status=1; TRACEBACK; return
  2666. else
  2667. if (okdebug) then
  2668. write (gol,'("EMISS-INFO - MACC-MEGAN - found `",a,"` emissions for `",a,"` in file ", a)') &
  2669. trim(recname), trim(comp), trim(fname); call goPr
  2670. endif
  2671. CALL MDF_Get_Var( fid, varid, emis_in, status, start=(/1,1,imonth/) )
  2672. IF_NOTOK_RETURN(status=1)
  2673. !convert from kg(species)/m^2/s to kg(species)/s
  2674. emis_in(:,:,1) = emis_in(:,:,1) * gridbox_area_05
  2675. ! combine grid cells :
  2676. emis = emission_coarsen_to_1x1( emis_in(:,:,1), nlon720, nlat360, .true., status )
  2677. IF_NOTOK_RETURN(status=1)
  2678. flip_array(:,:)=emis(:,:)
  2679. !
  2680. ! flip the array
  2681. !
  2682. do j=1,180
  2683. emis(:,j)=flip_array(:,(180-j)+1)
  2684. enddo
  2685. do i=1,180
  2686. flip_array(i,:)=emis(i+180,:)
  2687. flip_array(i+180,:)=emis(i,:)
  2688. enddo
  2689. do j=1,180
  2690. emis(:,j)=flip_array(:,j)
  2691. enddo
  2692. end if ! emis category found
  2693. CALL MDF_Close( fid, status )
  2694. IF_NOTOK_RETURN(status=1)
  2695. status = 0
  2696. end subroutine Emission_megan_ReadSector
  2697. !EOC
  2698. END MODULE EMISSION_READ