user_output_aerocom.F90 139 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711
  1. #define TRACEBACK write (gol,'("in ",a," (",a,i6,")")') rname, __FILE__, __LINE__ ; call goErr
  2. #define IF_NOTOK_RETURN(action) if (status/=0) then; TRACEBACK; action; return; end if
  3. #define IF_ERROR_RETURN(action) if (status> 0) then; TRACEBACK; action; return; end if
  4. #define IF_NOTOK_MDF(action) if (status/=0) then; TRACEBACK; action; call MDF_CLose(fid,status); status=1; return; end if
  5. !
  6. #include "tm5.inc"
  7. !
  8. !-----------------------------------------------------------------------------
  9. ! TM5 !
  10. !-----------------------------------------------------------------------------
  11. !BOP
  12. !
  13. ! !MODULE: USER_OUTPUT_AEROCOM
  14. !
  15. ! !DESCRIPTION:
  16. !
  17. ! This module provides objects and methods for the AEROCOM-2 related
  18. ! diagnostics package. It is strongly related to the setup of the
  19. ! optics module.
  20. ! A list of parameters are defined for which daily averages are output
  21. ! (so far), result is one file per day containing 50 2d-fields and
  22. ! 4 3d-fields.
  23. !
  24. ! Life cycle(s):
  25. ! 1) output_aerocom_init:
  26. ! - if( newsrun ): - allocation and initialisation of output container
  27. ! (mixf%..., drydepos/wetdepos/emission, wdep_out)
  28. ! - initialisation of optics module
  29. ! - lookuptable
  30. ! - wavelengths
  31. ! - open output file (for today), initialise it and write attributes
  32. ! 2) output_aerocom_step:
  33. ! - gather tracer
  34. ! - add current state of model to containers
  35. ! (weighted by time since last call, --> period of validity)
  36. ! - do fluxes, surface concentrations and loads
  37. ! - do optics
  38. ! - aerocom_aopio_init: initialise and fill input parameters
  39. ! - optics::optics_calculate_aop:
  40. ! calculate optical properties (per wavelength)
  41. ! (take into account additional splitting, facilitated in
  42. ! optics::optics_calculate_aop)
  43. ! - fill containers for optical properties
  44. ! - free optics input parameters
  45. ! - fill aerocom output containers
  46. ! 3) output_aerocom_write:
  47. ! - collect_budgets:
  48. ! - use current budget containers (budemi, buddep, buddry)
  49. ! - compare with saved values and infer by that the increment
  50. ! - add to temporary output containers (wetdepos,drydepos,emission)
  51. ! - write output containers to file
  52. ! - close file
  53. ! 4) output_aerocom_done:
  54. ! - free allocated containers
  55. ! (mixf%..., drydepos/wetdepos/emission, wdep_out)
  56. !
  57. !\\
  58. !\\
  59. ! !INTERFACE:
  60. !
  61. MODULE USER_OUTPUT_AEROCOM
  62. !
  63. ! !USES:
  64. !
  65. use go, only : gol, goErr, goPr, goLabel
  66. use dims, only : nregions
  67. use optics, only : wavelendep
  68. use meteodata, only : global_lli, levi
  69. use MDF
  70. use TM5_DISTGRID, only : dgrid, Get_DistGrid, update_halo, update_halo_iband
  71. implicit none
  72. private
  73. !
  74. ! !PUBLIC MEMBER FUNCTIONS:
  75. !
  76. public :: output_aerocom_init
  77. public :: output_aerocom_step
  78. public :: output_aerocom_write
  79. public :: output_aerocom_done
  80. public :: wdep_out
  81. character(len=20), public :: aerocom_exper ! AeroCom experiment name
  82. character(len=20), public :: aerocom_freq ! AeroCom output frequency
  83. logical, parameter :: aai_output=.false.
  84. !
  85. ! !PRIVATE DATA MEMBERS:
  86. !
  87. character(len=*), parameter :: mname = 'user_output_aerocom'
  88. ! Changed naming convections to AeroCom Control 2015 experiment
  89. character(len=20), parameter :: f_dataid='aerocom3', f_model='TM5'
  90. character(len=20), parameter :: f_dimmix='global', f_dimstat='stations'
  91. !
  92. ! !PRIVATE TYPES:
  93. !
  94. type metafields
  95. integer :: itm5
  96. character(len=16) :: vname
  97. character(len=64) :: lname
  98. character(len=10) :: unit
  99. character(len=10) :: positive
  100. character(len=130) :: standard_name
  101. end type metafields
  102. type metafields2
  103. integer :: itm5
  104. character(len=17) :: vname
  105. character(len=64) :: lname
  106. character(len=10) :: unit
  107. character(len=130) :: standard_name
  108. end type metafields2
  109. type field3d
  110. type( metafields ) :: mf
  111. real, dimension(:,:,:), pointer :: field
  112. integer :: varid
  113. end type field3d
  114. type field2d
  115. type( metafields ) :: mf
  116. real, dimension(:,:), pointer :: field
  117. integer :: varid
  118. end type field2d
  119. type field1d
  120. type( metafields2 ) :: mf
  121. real, dimension(:,:), pointer :: field
  122. integer :: varid
  123. end type field1d
  124. type field0d
  125. type( metafields2 ) :: mf
  126. real, dimension(:), pointer :: field
  127. integer :: varid
  128. end type field0d
  129. type mixfile
  130. type( field3d ), dimension(:), pointer :: f3d
  131. type( field2d ), dimension(:), pointer :: f2d
  132. character(len=200) :: fname
  133. integer :: acct ! accumulation time
  134. integer :: funit ! unit number
  135. integer :: nlon ! x dimension of requested field
  136. integer :: nlat ! y dimension of requested field
  137. integer :: nlev ! z dimension of requested field
  138. end type mixfile
  139. type(mixfile), dimension(nregions), save :: mixf
  140. type stationfile
  141. type( field1d ), dimension(:), pointer :: f1d
  142. type( field0d ), dimension(:), pointer :: f0d
  143. character(len=200) :: fname
  144. integer :: acct ! accumulation time
  145. integer :: funit ! unit number
  146. integer :: nstat ! dimension of requested field
  147. integer :: nlev ! z dimension of requested field
  148. end type stationfile
  149. type(stationfile), dimension(nregions), save :: statf
  150. integer, dimension(5) :: statvarid
  151. type budgetstore
  152. real, dimension(:,:,:), allocatable :: f2dslast
  153. integer :: lasttime
  154. end type budgetstore
  155. type(budgetstore), dimension(nregions), save :: drydepos, wetdepos, emission
  156. ! wavelength information
  157. type(wavelendep), dimension(:), allocatable :: wdep_out
  158. integer, parameter :: statnamelen = 22
  159. integer :: snamelendim
  160. type station
  161. integer :: statnb ! station number
  162. character(len=statnamelen) :: statname ! station name
  163. real :: statlat ! geographic coordinate
  164. real :: statlon ! geographic coordinate
  165. real :: statalt ! geographic coordinate
  166. end type station
  167. type(station), dimension(:), allocatable :: statlist
  168. character(len=statnamelen), dimension(:), allocatable :: tmpstatnames
  169. type statintp
  170. integer,dimension(:),pointer :: ixr, ixl ! coordinates in current grid
  171. integer,dimension(:),pointer :: jyr, jyl ! coordinates in current grid
  172. integer,dimension(:),pointer :: lzr, lzl ! coordinates in current grid
  173. real, dimension(:),pointer :: wixl, wixr ! interpolation coefficients
  174. real, dimension(:),pointer :: wjyl, wjyr ! interpolation coefficients
  175. real, dimension(:),pointer :: wlzl, wlzr ! interpolation coefficients
  176. real, dimension(:),pointer :: tght ! terrain height at station
  177. end type statintp
  178. type(statintp), dimension(nregions) :: sintp
  179. logical, dimension(:), allocatable :: stat_active ! true if station is in processor domain
  180. integer :: stat_halo_loc ! 1 if halo cells are needed for the local processor, else 0
  181. integer :: stat_halo_glob ! 1 if halo cells are needed on any processor, else 0
  182. ! the region dimension has already been removed for the above three variables
  183. integer :: fid ! file id for IF_NOTOK_MDF macro
  184. integer :: access_mode ! netcdf-4 parallel access mode for distributed data
  185. ! generate output if true:
  186. logical :: okdebug = .true.
  187. ! reference time:
  188. integer, parameter :: time_reftime6(6) = (/2001,01,01,00,00,00/)
  189. character(len=*), parameter :: time_units = 'days since 2001-01-01 00:00'
  190. ! sizes of arrays
  191. integer, save :: ntracer_3d, ntracer_2d
  192. integer, save :: ntracer_1dstat, ntracer_0dstat, nstations
  193. integer, save :: nextra_1dstat
  194. ! index pointers for 1d/2d/3d fields in mixf
  195. integer, save :: temp, hus, airmass, pressure
  196. integer, save :: ec5503Daer, abs5503Daer, ec3503Daer, abs3503Daer
  197. integer, save :: ps , precip , sconcoa , sconcbc , sconcso4 , sconcdust
  198. integer, save :: sconcss , sconcno3 , loadoa , loadbc , loadso4 , loaddust
  199. integer, save :: loadss , loadno3 , emioa , emibc , emiso2 , emiso4
  200. integer, save :: emidust , emidms , emiss , dryso2 , drybc , dryso4
  201. integer, save :: drydust , drydms , dryss , wetoa , wetbc , wetso2
  202. integer, save :: wetso4 , wetdust , wetdms , wetss , od550aer , od550so4
  203. integer, save :: od550bc , od550oa , od550ss , od550dust , od550no3 , od550aerh2o
  204. integer, save :: od550lt1aer , od550lt1dust, od550lt1ss , abs550aer , ec550aer , asyaer
  205. integer, save :: ec550dryaer , abs550dryaer, asydryaer , ec550drylt1aer, abs550drylt1aer
  206. integer, save :: od440aer , od870aer , sconcmsa , dryoa , sconcnh4
  207. integer, save :: abs440aer , ec440dryaer , abs440dryaer
  208. integer, save :: abs870aer , ec870dryaer , abs870dryaer
  209. integer, save :: od350aer , abs350aer
  210. integer, save :: ec550dryaer_stat, abs550dryaer_stat, asydryaer_stat
  211. integer, save :: ec550drylt1aer_stat, abs550drylt1aer_stat
  212. integer, save :: ec440dryaer_stat, abs440dryaer_stat
  213. integer, save :: ec870dryaer_stat, abs870dryaer_stat
  214. integer, save :: bso4nus, bso4ais, bso4acs, bso4cos, bbcais , bbcacs
  215. integer, save :: bbccos , bbcaii , bpomais, bpomacs, bpomcos, bpomaii
  216. integer, save :: bssacs , bsscos , bduacs , bducos , bduaci , bducoi, bno3_a
  217. integer, save :: bnus_n , bais_n , bacs_n , bcos_n , baii_n , baci_n
  218. integer, save :: bcoi_n , bh2onus, bh2oais, bh2oacs, bh2ocos
  219. !
  220. ! !REVISION HISTORY:
  221. ! 29 Nov 2010 - Achim Strunk - Creation
  222. ! 10 Oct 2014 - Twan van Noije - Adapted for TM5-mp
  223. !
  224. ! !REMARKS:
  225. ! (1) compiled only if with_m7 is used.
  226. !
  227. !EOP
  228. !------------------------------------------------------------------------
  229. contains
  230. !--------------------------------------------------------------------------
  231. ! TM5 !
  232. !--------------------------------------------------------------------------
  233. !BOP
  234. !
  235. ! !IROUTINE: OUTPUT_AEROCOM_INIT
  236. !
  237. ! !DESCRIPTION: Initialise various parameters, eg., station lists,
  238. ! wavelengths for optics and output containers.
  239. ! This routine should be called once per day, since fields
  240. ! are daily averages and one file per day is written.
  241. ! Additional tasks are done for newsrun==.true. .
  242. !\\
  243. !\\
  244. ! !INTERFACE:
  245. !
  246. subroutine output_aerocom_init(stat_output, status, iregion)
  247. !
  248. ! !USES:
  249. !
  250. !use MeteoData, only : sp_dat, set
  251. use chem_param, only : ntracet
  252. use chem_param, only : inus_n, iso4nus, nmod
  253. use chem_param, only : iais_n, iso4ais, ibcais, ipomais
  254. use chem_param, only : iacs_n, iso4acs, ibcacs, ipomacs, issacs, iduacs
  255. use chem_param, only : icos_n, iso4cos, ibccos, ipomcos, isscos, iducos
  256. use chem_param, only : iaii_n, ibcaii, ipomaii
  257. use chem_param, only : iaci_n, icoi_n, iduaci, iducoi
  258. use chem_param, only : ino3_a, inh4, imsa
  259. use dims, only : nregions, newsrun, idatee, idatei
  260. use dims, only : region_name, parent, itau
  261. use dims, only : xbeg, xend, ybeg, yend, dx, dy, xref, yref
  262. use dims, only : zbeg, zend, dz, zref
  263. use global_data, only : region_dat, outdir
  264. use datetime, only : tau2date, date2tau
  265. use budget_global, only : nbud_vg
  266. use partools, only : MPI_INFO_NULL, localComm
  267. use optics, only : Optics_Init
  268. use datetime, only : date2tau
  269. use dims, only : mlen
  270. !
  271. ! !OUTPUT PARAMETERS:
  272. !
  273. integer, intent(out) :: status
  274. !
  275. ! !INPUT PARAMETERS:
  276. !
  277. logical, intent(in) :: stat_output ! true if stations output is requested
  278. integer, intent(in), optional :: iregion
  279. !
  280. ! !REVISION HISTORY:
  281. ! 29 Nov 2010 - Achim Strunk -
  282. !
  283. ! !REMARKS:
  284. !
  285. !EOP
  286. !------------------------------------------------------------------------
  287. !BOC
  288. character(len=*), parameter :: rname = mname//'/output_aerocom_init'
  289. ! --- local ------------------------------
  290. integer :: imr, jmr, lmr, access_mode_sta
  291. integer :: region, varid
  292. integer :: io, istat, i, j, n, sc
  293. integer :: i1, i2, j1, j2
  294. integer, dimension(6) :: idater
  295. character(len=10) :: idates
  296. character(len=16) :: lidates
  297. character(len=3) :: cwavel
  298. real :: reftime
  299. integer :: itaucur, itauref
  300. real :: dlat, dlon
  301. integer :: mlength
  302. ! --- begin -------------------------------
  303. call goLabel(rname)
  304. ! access mode for distributed data (2d and 3d)
  305. #ifdef MPI
  306. #ifdef with_netcdf4_par
  307. access_mode = MDF_COLLECTIVE
  308. #else
  309. write(gol,'("AeroCom aerosol output requires netcdf4 with parallel access enabled")') ; call goErr
  310. TRACEBACK
  311. status=1; return
  312. #endif
  313. #else
  314. access_mode = MDF_INDEPENDENT
  315. #endif
  316. ! for station
  317. access_mode_sta = MDF_INDEPENDENT
  318. ! initialize (only once)
  319. if( newsrun ) then
  320. ! ensure that required meteo is loaded:
  321. ! call Set( sp_dat(region), status, used=.true. )
  322. ! set wavelength information
  323. ! wl: wavelength in microns
  324. ! split: whether to split into contributions from
  325. ! M7 constituents (incl. water)
  326. allocate( wdep_out( 4 ) )
  327. wdep_out(1)%wl = 0.550 ; wdep_out(1)%split = .true. ; wdep_out(1)%insitu = .true.
  328. wdep_out(2)%wl = 0.440 ; wdep_out(2)%split = .false. ; wdep_out(2)%insitu = .true.
  329. wdep_out(3)%wl = 0.870 ; wdep_out(3)%split = .false. ; wdep_out(3)%insitu = .true.
  330. wdep_out(4)%wl = 0.350 ; wdep_out(4)%split = .false. ; wdep_out(4)%insitu = .false.
  331. ! get the optics code prepared
  332. call Optics_Init(size(wdep_out), wdep_out, status )
  333. IF_NOTOK_RETURN(status=1)
  334. ! -----------------------
  335. ! parameters needed to reference the different 1d/2d/3d-fields
  336. ! (in order to avoid errors in referencing)
  337. ! finally, this list here simply determines the order in the output files
  338. ntracer_3d = 4
  339. if (aai_output) then
  340. ntracer_3d = ntracer_3d + 4
  341. endif
  342. ! -----------------------
  343. temp = 1 ! 3d
  344. hus = 2 ! 3d
  345. airmass = 3 ! 3d
  346. pressure = 4 ! 3d
  347. ec5503Daer = 5 ! 3d
  348. abs5503Daer = 6 ! 3d
  349. ec3503Daer = 7 ! 3d
  350. abs3503Daer = 8 ! 3d
  351. ntracer_2d = 66
  352. ps = 1 ! 2d
  353. precip = 2 ! 2d
  354. sconcoa = 3 ! 2d
  355. sconcbc = 4 ! 2d
  356. sconcso4 = 5 ! 2d
  357. sconcdust = 6 ! 2d
  358. sconcss = 7 ! 2d
  359. sconcno3 = 8 ! 2d
  360. sconcnh4 = 9 ! 2d
  361. sconcmsa = 10 ! 2d
  362. loadoa = 11 ! 2d
  363. loadbc = 12 ! 2d
  364. loadso4 = 13 ! 2d
  365. loaddust = 14 ! 2d
  366. loadss = 15 ! 2d
  367. loadno3 = 16 ! 2d
  368. emioa = 17 ! 2d
  369. emibc = 18 ! 2d
  370. emiso2 = 19 ! 2d
  371. emiso4 = 20 ! 2d
  372. emidust = 21 ! 2d
  373. emidms = 22 ! 2d
  374. emiss = 23 ! 2d
  375. dryso2 = 24 ! 2d
  376. dryoa = 25 ! 2d
  377. drybc = 26 ! 2d
  378. dryso4 = 27 ! 2d
  379. drydust = 28 ! 2d
  380. drydms = 29 ! 2d
  381. dryss = 30 ! 2d
  382. wetoa = 31 ! 2d
  383. wetbc = 32 ! 2d
  384. wetso2 = 33 ! 2d
  385. wetso4 = 34 ! 2d
  386. wetdust = 35 ! 2d
  387. wetdms = 36 ! 2d
  388. wetss = 37 ! 2d
  389. ! --- from here onwards keep consistent with order in optics (optics.F90)
  390. ! --- begin split order
  391. od550aer = 38 ! 2d
  392. od550so4 = 39 ! 2d
  393. od550bc = 40 ! 2d
  394. od550oa = 41 ! 2d
  395. od550ss = 42 ! 2d
  396. od550dust = 43 ! 2d
  397. od550no3 = 44 ! 2d
  398. od550aerh2o = 45 ! 2d
  399. od550lt1aer = 46 ! 2d
  400. od550lt1dust = 47 ! 2d
  401. od550lt1ss = 48 ! 2d
  402. ! --- end split order
  403. abs550aer = 49 ! 2d
  404. asyaer = 50 ! 2d
  405. ec550aer = 51 ! 2d
  406. ! --- begin in-situ data order
  407. ec550dryaer = 52 ! 2d
  408. abs550dryaer = 53 ! 2d
  409. asydryaer = 54 ! 2d
  410. ec550drylt1aer = 55 ! 2d
  411. abs550drylt1aer = 56 ! 2d
  412. ! --- end in-situ data order
  413. !
  414. od440aer = 57 ! 2d
  415. abs440aer = 58 ! 2d
  416. ec440dryaer = 59 ! 2d
  417. abs440dryaer = 60 ! 2d
  418. !
  419. od870aer = 61 ! 2d
  420. abs870aer = 62 ! 2d
  421. ec870dryaer = 63 ! 2d
  422. abs870dryaer = 64 ! 2d
  423. !
  424. od350aer = 65 ! 2d
  425. abs350aer = 66 ! 2d
  426. if (stat_output) then
  427. ! -----------------------
  428. ! set station information
  429. ! -----------------------
  430. ! this here is a kind of redundant coding, but it enables to easily check for correct
  431. ! information (instead of assigning dedicated arrays (name,lat,lon etc.) side by side)
  432. ec550dryaer_stat=33
  433. abs550dryaer_stat=34
  434. asydryaer_stat=35
  435. ec550drylt1aer_stat=36
  436. abs550drylt1aer_stat=37
  437. ec440dryaer_stat=38
  438. abs440dryaer_stat=39
  439. ec870dryaer_stat=40
  440. abs870dryaer_stat=41
  441. nextra_1dstat=3 ! temperature, specific humidity and pressure at model levels
  442. ntracer_1dstat=41+nextra_1dstat
  443. ntracer_0dstat=ntracer_1dstat+2 ! plus surface pressure and precipitation
  444. ! Adapted station list for AeroCom Phase III in-situ projects
  445. nstations = 90
  446. allocate( statlist( nstations ) )
  447. sc = 1
  448. statlist(sc) = station( sc, 'Alert ', 82.499, -62.342, 210.0 ); sc = sc + 1
  449. statlist(sc) = station( sc, 'Anmyeon-do ', 36.540, 126.330, 94.0 ); sc = sc + 1
  450. statlist(sc) = station( sc, 'Annaberg-Buchholz ', 50.570, 13.000, 545.0 ); sc = sc + 1
  451. statlist(sc) = station( sc, 'Appalachian State U. ', 36.213, -81.692, 1076.0 ); sc = sc + 1
  452. statlist(sc) = station( sc, 'Aspvreten ', 58.806, 17.388, 20.0 ); sc = sc + 1
  453. statlist(sc) = station( sc, 'Auchencorth Moss ', 55.793, -3.245, 260.0 ); sc = sc + 1
  454. statlist(sc) = station( sc, 'Backgarden ', 23.540, 113.060, -999.0 ); sc = sc + 1
  455. statlist(sc) = station( sc, 'Barrow ', 71.323, -156.611, 11.0 ); sc = sc + 1
  456. statlist(sc) = station( sc, 'BEO Moussala ', 42.179, 23.586, 2925.0 ); sc = sc + 1
  457. statlist(sc) = station( sc, 'Birkenes ', 58.388, 8.252, 190.0 ); sc = sc + 1
  458. statlist(sc) = station( sc, 'Bondville ', 40.050, -88.367, 213.0 ); sc = sc + 1
  459. statlist(sc) = station( sc, 'Bukit Kototabang ', -0.202, 100.318, 864.0 ); sc = sc + 1
  460. statlist(sc) = station( sc, 'Bosel ', 52.998, 7.943, 40.0 ); sc = sc + 1
  461. statlist(sc) = station( sc, 'Cabauw ', 51.971, 4.927, 1.0 ); sc = sc + 1
  462. statlist(sc) = station( sc, 'Cape Cod ', 40.070, -70.200, 43.0 ); sc = sc + 1
  463. statlist(sc) = station( sc, 'Cape Grim ', -40.682, 144.688, 94.0 ); sc = sc + 1
  464. statlist(sc) = station( sc, 'Cape Point ', -34.353, 18.490, 230.0 ); sc = sc + 1
  465. statlist(sc) = station( sc, 'Cape San Juan ', 18.381, -65.618, 65.0 ); sc = sc + 1
  466. statlist(sc) = station( sc, 'Chacaltaya ', -16.200, -68.100, 5320.0 ); sc = sc + 1
  467. statlist(sc) = station( sc, 'Danum Valley ', 4.981, 117.844, 426.0 ); sc = sc + 1
  468. statlist(sc) = station( sc, 'Demokritos ', 37.995, 23.816, 270.0 ); sc = sc + 1
  469. statlist(sc) = station( sc, 'East Trout Lake ', 54.350, -104.983, 500.0 ); sc = sc + 1
  470. statlist(sc) = station( sc, 'Egbert ', 44.230, -79.783, 255.0 ); sc = sc + 1
  471. statlist(sc) = station( sc, 'El Arenosillo ', 37.104, -6.734, 41.0 ); sc = sc + 1
  472. statlist(sc) = station( sc, 'El Tololo ', -30.173, -70.799, 2220.0 ); sc = sc + 1
  473. statlist(sc) = station( sc, 'Elandsfontein ', -25.533, 25.750, 1424.0 ); sc = sc + 1
  474. statlist(sc) = station( sc, 'Finokalia ', 35.333, 25.670, 250.0 ); sc = sc + 1
  475. statlist(sc) = station( sc, 'Giordan Lighthouse ', 36.073, 14.219, 167.0 ); sc = sc + 1
  476. statlist(sc) = station( sc, 'Gosan ', 33.280, 126.170, 72.0 ); sc = sc + 1
  477. statlist(sc) = station( sc, 'Graciosa ', 39.080, -28.030, 30.0 ); sc = sc + 1
  478. statlist(sc) = station( sc, 'Granada ', 37.164, -3.605, 680.0 ); sc = sc + 1
  479. statlist(sc) = station( sc, 'Hesselbach ', 48.540, 8.400, 51.4 ); sc = sc + 1
  480. statlist(sc) = station( sc, 'Harwell ', 51.573, -1.317, 137.0 ); sc = sc + 1
  481. statlist(sc) = station( sc, 'Hohenpeissenberg ', 47.802, 11.010, 985.0 ); sc = sc + 1
  482. statlist(sc) = station( sc, 'Hyytiala ', 61.847, 24.295, 181.0 ); sc = sc + 1
  483. statlist(sc) = station( sc, 'Illmitz ', 47.767, 16.767, 117.0 ); sc = sc + 1
  484. statlist(sc) = station( sc, 'Ispra ', 45.803, 8.627, 209.0 ); sc = sc + 1
  485. statlist(sc) = station( sc, 'Izana ', 28.309, -16.499, 2373.0 ); sc = sc + 1
  486. statlist(sc) = station( sc, 'Jungfraujoch ', 46.547, 7.985, 3580.0 ); sc = sc + 1
  487. statlist(sc) = station( sc, 'Kosetice ', 49.583, 15.083, 535.0 ); sc = sc + 1
  488. statlist(sc) = station( sc, 'K-Puszta ', 46.967, 19.583, 125.0 ); sc = sc + 1
  489. statlist(sc) = station( sc, 'Leibzig ', 51.353, 12.435, 126.0 ); sc = sc + 1
  490. statlist(sc) = station( sc, 'Leibzig-West ', 51.318, 12.298, 122.0 ); sc = sc + 1
  491. statlist(sc) = station( sc, 'Lille Valby ', 55.683, 12.117, 20.0 ); sc = sc + 1
  492. statlist(sc) = station( sc, 'London - N. Kensington', 51.521, -0.214, 27.0 ); sc = sc + 1
  493. statlist(sc) = station( sc, 'Lulin ', 23.470, 120.870, 2862.0 ); sc = sc + 1
  494. statlist(sc) = station( sc, 'Mace Head ', 53.326, -9.899, 5.0 ); sc = sc + 1
  495. statlist(sc) = station( sc, 'Madrid ', 40.450, -3.720, 669.0 ); sc = sc + 1
  496. statlist(sc) = station( sc, 'Manacapuro ', -3.210, -60.590, 50.0 ); sc = sc + 1
  497. statlist(sc) = station( sc, 'Manaus ', -2.595, -60.209, 45.0 ); sc = sc + 1
  498. statlist(sc) = station( sc, 'Mauna Loa ', 19.536, -155.576, 3397.0 ); sc = sc + 1
  499. statlist(sc) = station( sc, 'Melpitz ', 51.530, 12.930, 86.0 ); sc = sc + 1
  500. statlist(sc) = station( sc, 'Montseny ', 41.767, 2.350, 700.0 ); sc = sc + 1
  501. statlist(sc) = station( sc, 'Monte Cimone ', 44.167, 10.683, 2165.0 ); sc = sc + 1
  502. statlist(sc) = station( sc, 'Mount Waliguan ', 36.283, 100.900, 3810.0 ); sc = sc + 1
  503. statlist(sc) = station( sc, 'Nepal Climate Obs. ', 27.958, 86.815, 5079.0 ); sc = sc + 1
  504. statlist(sc) = station( sc, 'Nainital ', 29.360, 79.460, 1936.0 ); sc = sc + 1
  505. statlist(sc) = station( sc, 'Neuglobsov ', 53.143, 13.033, 62.0 ); sc = sc + 1
  506. statlist(sc) = station( sc, 'Neumayer ', -70.666, -8.266, 42.0 ); sc = sc + 1
  507. statlist(sc) = station( sc, 'Niamey ', 13.470, 2.170, 223.0 ); sc = sc + 1
  508. statlist(sc) = station( sc, 'Pallas ', 67.974, 24.116, 560.0 ); sc = sc + 1
  509. statlist(sc) = station( sc, 'Payerne ', 46.817, 6.950, 490.0 ); sc = sc + 1
  510. statlist(sc) = station( sc, 'Prague-Suchdol ', 50.130, 14.380, 270.0 ); sc = sc + 1
  511. statlist(sc) = station( sc, 'Preila ', 55.350, 21.067, 5.0 ); sc = sc + 1
  512. statlist(sc) = station( sc, 'Pt. Reyes ', 38.091, -122.957, 8.0 ); sc = sc + 1
  513. statlist(sc) = station( sc, 'Puy de Dome ', 45.772, 2.966, 1465.0 ); sc = sc + 1
  514. statlist(sc) = station( sc, 'Resolute Bay ', 74.717, -94.983, 64.0 ); sc = sc + 1
  515. statlist(sc) = station( sc, 'Sable Island ', 43.933, -60.017, 2.0 ); sc = sc + 1
  516. statlist(sc) = station( sc, 'Samoa ', -14.232, -170.563, 77.0 ); sc = sc + 1
  517. statlist(sc) = station( sc, 'Schauinsland ', 47.900, 7.917, 1205.0 ); sc = sc + 1
  518. statlist(sc) = station( sc, 'Shang Dianzi ', 40.390, 117.070, 294.0 ); sc = sc + 1
  519. statlist(sc) = station( sc, 'Shouxian ', 32.558, 116.782, 23.0 ); sc = sc + 1
  520. statlist(sc) = station( sc, 'SIRTA ', 48.709, 2.159, 160.0 ); sc = sc + 1
  521. statlist(sc) = station( sc, 'Sonnblick ', 47.054, 12.959, 3106.0 ); sc = sc + 1
  522. statlist(sc) = station( sc, 'South Pole ', -89.997, -24.800, 2841.0 ); sc = sc + 1
  523. statlist(sc) = station( sc, 'Southern Great Plains ', 36.617, -97.500, 318.0 ); sc = sc + 1
  524. statlist(sc) = station( sc, 'Storm Peak ', 40.455, -106.744, 3220.0 ); sc = sc + 1
  525. statlist(sc) = station( sc, 'Summit ', 72.580, -38.480, 3238.0 ); sc = sc + 1
  526. statlist(sc) = station( sc, 'Tahkuse ', 58.520, 24.940, 23.0 ); sc = sc + 1
  527. statlist(sc) = station( sc, 'Tiksi ', 71.586, 128.919, 8.0 ); sc = sc + 1
  528. statlist(sc) = station( sc, 'Trinidad Head ', 41.054, -124.151, 107.0 ); sc = sc + 1
  529. statlist(sc) = station( sc, 'Trollhaugen ', -72.012, 2.535, 1553.0 ); sc = sc + 1
  530. statlist(sc) = station( sc, 'Uto ', 59.783, 21.383, 7.0 ); sc = sc + 1
  531. statlist(sc) = station( sc, 'Varrio ', 67.767, 29.583, 400.0 ); sc = sc + 1
  532. statlist(sc) = station( sc, 'Vavihill ', 56.017, 13.150, 172.0 ); sc = sc + 1
  533. statlist(sc) = station( sc, 'Vielsalm ', 50.304, 6.001, 496.0 ); sc = sc + 1
  534. statlist(sc) = station( sc, 'Waldhof ', 52.802, 10.759, 74.0 ); sc = sc + 1
  535. statlist(sc) = station( sc, 'Whistler Mountain ', 50.059, -122.958, 2182.0 ); sc = sc + 1
  536. statlist(sc) = station( sc, 'Zeppelin ', 78.907, 11.889, 475.0 ); sc = sc + 1
  537. statlist(sc) = station( sc, 'Zugspitze ', 47.417, 10.980, 2650.0 ); sc = sc + 1
  538. ! this copy is needed for the netcdf output of the 2d-character-array [statnamelen,nstations]
  539. allocate( tmpstatnames( nstations ) )
  540. tmpstatnames = statlist(:)%statname
  541. allocate(stat_active(nstations))
  542. stat_active(:)=.false.
  543. stat_halo_loc=0
  544. endif
  545. end if
  546. regionloop: do region = 1, nregions
  547. ! if region given, cycle if other region!
  548. if (present(iregion)) then
  549. if(iregion /= region) cycle regionloop
  550. endif
  551. imr = global_lli(region)%nlon
  552. jmr = global_lli(region)%nlat
  553. lmr = levi%nlev
  554. if( nbud_vg /= lmr ) then
  555. write(gol,*)'output_aerocom_init: nbud_vg /= lmr'; call goErr
  556. write(gol,*)'output_aerocom_init: YOU MUST ADD THE PROJ/BUDGET10 TO SRC CODE !!!!!'; call goErr
  557. TRACEBACK
  558. status=1; return
  559. end if
  560. ! initialize the output:
  561. if( newsrun ) then
  562. call Get_DistGrid( dgrid(region), I_STRT=i1, I_STOP=i2, J_STRT=j1, J_STOP=j2 )
  563. ! target structures for output
  564. allocate(mixf (region)%f3d(ntracer_3d))
  565. allocate(mixf (region)%f2d(ntracer_2d))
  566. ! allocate fields
  567. do i=1,ntracer_3d
  568. allocate( mixf(region)%f3d(i)%field(i1:i2,j1:j2,lmr) )
  569. end do
  570. do i=1,ntracer_2d
  571. allocate( mixf(region)%f2d(i)%field(i1:i2,j1:j2) )
  572. end do
  573. if (stat_output) then
  574. ! ---------
  575. ! find coordinates in grid and get interpolation coefficients
  576. ! ---------
  577. allocate( sintp(region)%ixl(nstations), sintp(region)%wixl(nstations), &
  578. sintp(region)%ixr(nstations), sintp(region)%wixr(nstations), &
  579. sintp(region)%jyl(nstations), sintp(region)%wjyl(nstations), &
  580. sintp(region)%jyr(nstations), sintp(region)%wjyr(nstations), &
  581. sintp(region)%lzl(nstations), sintp(region)%wlzl(nstations), &
  582. sintp(region)%lzr(nstations), sintp(region)%wlzr(nstations), &
  583. sintp(region)%tght(nstations) )
  584. call aerocom_get_statintp( region, status )
  585. IF_NOTOK_RETURN(status=1)
  586. allocate(statf(region)%f1d(ntracer_1dstat))
  587. allocate(statf(region)%f0d(ntracer_0dstat))
  588. do i=1,ntracer_1dstat
  589. allocate( statf(region)%f1d(i)%field(nstations,lmr) )
  590. end do
  591. do i=1,ntracer_0dstat
  592. allocate( statf(region)%f0d(i)%field(nstations) )
  593. end do
  594. endif
  595. ! 3d data
  596. mixf(region)%f3d(temp )%mf = metafields( -1 , 'temp ', 'Temperature ' , 'K ', '', 'air_temperature' )
  597. mixf(region)%f3d(hus )%mf = metafields( -1 , 'hus ', 'Specific Humidity ' , '1 ', '', 'specific_humidity' )
  598. mixf(region)%f3d(airmass )%mf = metafields( -1 , 'airmass ', 'Air Mass ' , 'kg m-2 ', '', 'atmosphere_mass_of_air_per_unit_area' )
  599. mixf(region)%f3d(pressure )%mf = metafields( -1 , 'pressure ', 'Pressure ' , 'Pa ', '', 'air_pressure' )
  600. if (aai_output) then
  601. mixf(region)%f3d(ec5503Daer )%mf = metafields( -1 , 'ec5503Daer ', 'Aerosol Extinction @550nm ' , 'm-1 ', '', 'atmosphere_extinction_due_to_ambient_aerosol' )
  602. mixf(region)%f3d(abs5503Daer )%mf = metafields( -1 , 'abs5503Daer ', 'Aerosol Absorption @550nm ' , 'm-1 ', '', 'atmosphere_absorption_due_to_ambient_aerosol' )
  603. mixf(region)%f3d(ec3503Daer )%mf = metafields( -1 , 'ec3503Daer ', 'Aerosol Extinction @350nm ' , 'm-1 ', '', 'atmosphere_extinction_due_to_ambient_aerosol' )
  604. mixf(region)%f3d(abs3503Daer )%mf = metafields( -1 , 'abs3503Daer ', 'Aerosol Absorption @350nm ' , 'm-1 ', '', 'atmosphere_absorption_due_to_ambient_aerosol' )
  605. endif
  606. ! 2d data
  607. mixf(region)%f2d(ps )%mf = metafields( -1 , 'ps ', 'Surface Air Pressure ' , 'Pa ', '', 'surface_air_pressure' )
  608. mixf(region)%f2d(precip )%mf = metafields( -1 , 'precip ', 'Precipitation ' , 'kg m-2 s-1', '', 'precipitation_flux' )
  609. mixf(region)%f2d(sconcoa )%mf = metafields( -1 , 'sconcoa ', 'Surface Concentration POM ' , 'kg m-3 ', '', 'mass_concentration_of_particulate_organic_matter_dry_aerosol_in_air' )
  610. mixf(region)%f2d(sconcbc )%mf = metafields( -1 , 'sconcbc ', 'Surface Concentration BC ' , 'kg m-3 ', '', 'mass_concentration_of_black_carbon_dry_aerosol_in_air' )
  611. mixf(region)%f2d(sconcso4 )%mf = metafields( -1 , 'sconcso4 ', 'Surface Concentration SO4 ' , 'kg m-3 ', '', 'mass_concentration_of_sulfate_dry_aerosol_in_air' )
  612. mixf(region)%f2d(sconcdust )%mf = metafields( -1 , 'sconcdust ', 'Surface Concentration Dust ' , 'kg m-3 ', '', 'mass_concentration_of_dust_dry_aerosol_in_air' )
  613. mixf(region)%f2d(sconcss )%mf = metafields( -1 , 'sconcss ', 'Surface Concentration SS ' , 'kg m-3 ', '', 'mass_concentration_of_seasalt_dry_aerosol_in_air' )
  614. mixf(region)%f2d(sconcno3 )%mf = metafields( -1 , 'sconcno3 ', 'Surface Concentration NO3 ' , 'kg m-3 ', '', 'mass_concentration_of_nitrate_dry_aerosol_in_air' )
  615. mixf(region)%f2d(sconcnh4 )%mf = metafields( -1 , 'sconcnh4 ', 'Surface Concentration NH4 ' , 'kg m-3 ', '', 'mass_concentration_of_ammonium_dry_aerosol_in_air' )
  616. mixf(region)%f2d(sconcmsa )%mf = metafields( -1 , 'sconcmsa ', 'Surface Concentration MSA ' , 'kg m-3 ', '', 'mass_concentration_of_methane_sulfonic_acid_in_air' )
  617. mixf(region)%f2d(loadoa )%mf = metafields( -1 , 'loadoa ', 'Load of POM ' , 'kg m-2 ', '', 'atmosphere_mass_content_of_particulate_organic_matter_dry_aerosol' )
  618. mixf(region)%f2d(loadbc )%mf = metafields( -1 , 'loadbc ', 'Load of BC ' , 'kg m-2 ', '', 'atmosphere_mass_content_of_black_carbon_dry_aerosol' )
  619. mixf(region)%f2d(loadso4 )%mf = metafields( -1 , 'loadso4 ', 'Load of SO4 ' , 'kg m-2 ', '', 'atmosphere_mass_content_of_sulfate_dry_aerosol' )
  620. mixf(region)%f2d(loaddust )%mf = metafields( -1 , 'loaddust ', 'Load of Dust ' , 'kg m-2 ', '', 'atmosphere_mass_content_of_dust_dry_aerosol' )
  621. mixf(region)%f2d(loadss )%mf = metafields( -1 , 'loadss ', 'Load of SS ' , 'kg m-2 ', '', 'atmosphere_mass_content_of_seasalt_dry_aerosol' )
  622. mixf(region)%f2d(loadno3 )%mf = metafields( -1 , 'loadno3 ', 'Load of NO3 ' , 'kg m-2 ', '', 'atmosphere_mass_content_of_nitrate_dry_aerosol' )
  623. mixf(region)%f2d(emioa )%mf = metafields( -1 , 'emioa ', 'Total Emission of POM ' , 'kg m-2 s-1', 'up', 'tendency_of_atmosphere_mass_content_of_primary_particulate_organic_matter_dry_aerosol_due_to_emission' )
  624. mixf(region)%f2d(emibc )%mf = metafields( -1 , 'emibc ', 'Total Emission of BC ' , 'kg m-2 s-1', 'up', 'tendency_of_atmosphere_mass_content_of_black_carbon_dry_aerosol_due_to_emission' )
  625. mixf(region)%f2d(emiso2 )%mf = metafields( -1 , 'emiso2 ', 'Total Emission of SO2 ' , 'kg m-2 s-1', 'up', 'tendency_of_atmosphere_mass_content_of_sulfur_dioxide_due_to_emission' )
  626. mixf(region)%f2d(emiso4 )%mf = metafields( -1 , 'emiso4 ', 'Total Direct Emission of SO4 ' , 'kg m-2 s-1', 'up', 'tendency_of_atmosphere_mass_content_of_sulfate_dry_aerosol_due_to_emission' )
  627. mixf(region)%f2d(emidust )%mf = metafields( -1 , 'emidust ', 'Total Emission of Dust ' , 'kg m-2 s-1', 'up', 'tendency_of_atmosphere_mass_content_of_dust_dry_aerosol_due_to_emission' )
  628. mixf(region)%f2d(emidms )%mf = metafields( -1 , 'emidms ', 'Total Emission of DMS ' , 'kg m-2 s-1', 'up', 'tendency_of_atmosphere_mass_content_of_dimethyl_sulfide_due_to_emission' )
  629. mixf(region)%f2d(emiss )%mf = metafields( -1 , 'emiss ', 'Total Emission of SeaSalt ' , 'kg m-2 s-1', 'up', 'tendency_of_atmosphere_mass_content_of_seasalt_dry_aerosol_due_to_emission' )
  630. mixf(region)%f2d(dryso2 )%mf = metafields( -1 , 'dryso2 ', 'Dry Deposition of SO2 ' , 'kg m-2 s-1', 'down', 'tendency_of_atmosphere_mass_content_of_sulfur_dioxide_due_to_dry_deposition' )
  631. mixf(region)%f2d(dryoa )%mf = metafields( -1 , 'dryoa ', 'Dry Deposition of POM ' , 'kg m-2 s-1', 'down', &
  632. 'tendency_of_atmosphere_mass_content_of_primary_particulate_organic_matter_dry_aerosol_due_to_dry_deposition' )
  633. mixf(region)%f2d(drybc )%mf = metafields( -1 , 'drybc ', 'Dry Deposition of BC ' , 'kg m-2 s-1', 'down', 'tendency_of_atmosphere_mass_content_of_black_carbon_dry_aerosol_due_to_dry_deposition' )
  634. mixf(region)%f2d(dryso4 )%mf = metafields( -1 , 'dryso4 ', 'Dry Deposition of SO4 ' , 'kg m-2 s-1', 'down', 'tendency_of_atmosphere_mass_content_of_sulfate_dry_aerosol_due_to_dry_deposition' )
  635. mixf(region)%f2d(drydust )%mf = metafields( -1 , 'drydust ', 'Dry Deposition of Dust ' , 'kg m-2 s-1', 'down', 'tendency_of_atmosphere_mass_content_of_dust_dry_aerosol_due_to_dry_deposition' )
  636. mixf(region)%f2d(drydms )%mf = metafields( -1 , 'drydms ', 'Dry Deposition of DMS ' , 'kg m-2 s-1', 'down', 'tendency_of_atmosphere_mass_content_of_dimethyl_sulfide_due_to_dry_deposition' )
  637. mixf(region)%f2d(dryss )%mf = metafields( -1 , 'dryss ', 'Dry Deposition of SeaSalt ' , 'kg m-2 s-1', 'down', 'tendency_of_atmosphere_mass_content_of_seasalt_dry_aerosol_due_to_dry_deposition' )
  638. mixf(region)%f2d(wetoa )%mf = metafields( -1 , 'wetoa ', 'Wet Deposition of POM ' , 'kg m-2 s-1', 'down', 'tendency_of_atmosphere_mass_content_of_particulate_organic_matter_dry_aerosol_due_to_wet_deposition' )
  639. mixf(region)%f2d(wetbc )%mf = metafields( -1 , 'wetbc ', 'Wet Deposition of BC ' , 'kg m-2 s-1', 'down', 'tendency_of_atmosphere_mass_content_of_black_carbon_dry_aerosol_due_to_wet_deposition' )
  640. mixf(region)%f2d(wetso2 )%mf = metafields( -1 , 'wetso2 ', 'Wet Deposition of SO2 ' , 'kg m-2 s-1', 'down', 'tendency_of_atmosphere_mass_content_of_sulfur_dioxide_due_to_wet_deposition' )
  641. mixf(region)%f2d(wetso4 )%mf = metafields( -1 , 'wetso4 ', 'Wet Deposition of SO4 ' , 'kg m-2 s-1', 'down', 'tendency_of_atmosphere_mass_content_of_sulfate_dry_aerosol_due_to_wet_deposition' )
  642. mixf(region)%f2d(wetdust )%mf = metafields( -1 , 'wetdust ', 'Wet Deposition of Dust ' , 'kg m-2 s-1', 'down', 'tendency_of_atmosphere_mass_content_of_dust_dry_aerosol_due_to_wet_deposition' )
  643. mixf(region)%f2d(wetdms )%mf = metafields( -1 , 'wetdms ', 'Wet Deposition of DMS ' , 'kg m-2 s-1', 'down', 'tendency_of_atmosphere_mass_content_of_dimethyl_sulfide_due_to_wet_deposition' )
  644. mixf(region)%f2d(wetss )%mf = metafields( -1 , 'wetss ', 'Wet Deposition of Seasalt ' , 'kg m-2 s-1', 'down', 'tendency_of_atmosphere_mass_content_of_seasalt_dry_aerosol_due_to_wet_deposition' )
  645. mixf(region)%f2d(od550aer )%mf = metafields( -1 , 'od550aer ', 'AOD@550nm ' , '1 ', '', 'atmosphere_optical_thickness_due_to_ambient_aerosol' )
  646. mixf(region)%f2d(od550so4 )%mf = metafields( -1 , 'od550so4 ', 'SO4 AOD@550nm ' , '1 ', '', 'atmosphere_optical_thickness_due_to_sulfate_ambient_aerosol' )
  647. mixf(region)%f2d(od550bc )%mf = metafields( -1 , 'od550bc ', 'Black Carbon AOD@550nm ' , '1 ', '', 'atmosphere_optical_thickness_due_to_black_carbon_ambient_aerosol' )
  648. mixf(region)%f2d(od550oa )%mf = metafields( -1 , 'od550oa ', 'POM AOD@550nm ' , '1 ', '', 'atmosphere_optical_thickness_due_to_particulate_organic_matter_ambient_aerosol' )
  649. mixf(region)%f2d(od550ss )%mf = metafields( -1 , 'od550ss ', 'SeaSalt AOD@550nm ' , '1 ', '', 'atmosphere_optical_thickness_due_to_seasalt_ambient_aerosol' )
  650. mixf(region)%f2d(od550dust )%mf = metafields( -1 , 'od550dust ', 'Dust AOD@550nm ' , '1 ', '', 'atmosphere_optical_thickness_due_to_dust_ambient_aerosol' )
  651. mixf(region)%f2d(od550no3 )%mf = metafields( -1 , 'od550no3 ', 'Nitrate AOD@550nm ' , '1 ', '', 'atmosphere_optical_thickness_due_to_nitrate_ambient_aerosol' )
  652. mixf(region)%f2d(od550aerh2o )%mf = metafields( -1 , 'od550aerh2o ', 'Aerosol Water AOD@550nm ' , '1 ', '', 'atmosphere_optical_thickness_due_to_water_in_ambient_aerosol' )
  653. mixf(region)%f2d(od550lt1aer )%mf = metafields( -1 , 'od550lt1aer ', 'Fine Mode AOD@550nm ' , '1 ', '', 'atmosphere_optical_thickness_due_to_pm1_ambient_aerosol' )
  654. mixf(region)%f2d(od550lt1dust)%mf = metafields( -1 , 'od550lt1dust', 'Fine Mode Dust AOD@550nm ' , '1 ', '', 'atmosphere_optical_thickness_due_to_dust_pm1_ambient_aerosol' )
  655. mixf(region)%f2d(od550lt1ss)%mf = metafields( -1 , 'od550lt1ss ', 'Fine Mode SeaSalt AOD@550nm ' , '1 ', '', 'atmosphere_optical_thickness_due_to_seasalt_pm1_ambient_aerosol' )
  656. mixf(region)%f2d(abs550aer )%mf = metafields( -1 , 'abs550aer ', 'Absorption AOD@550nm ' , '1 ', '', 'atmosphere_absorption_optical_thickness_due_to_ambient_aerosol' )
  657. mixf(region)%f2d(asyaer )%mf = metafields( -1 , 'asyaer ', 'Asymmetry Parameter ' , '1 ', '', 'atmosphere_asymmetry_parameter_ambient_aerosol' )
  658. mixf(region)%f2d(ec550aer )%mf = metafields( -1 , 'ec550aer ', 'Surface Ambient Aerosol Extinction@550nm' , 'm-1 ', '', 'surface_extinction_due_to_ambient_aerosol' )
  659. mixf(region)%f2d(ec550dryaer )%mf = metafields( -1 , 'ec550dryaer ', 'Surface Dry Aerosol Extinction@550 nm','m-1 ', '', 'surface_extinction_due_to_dry_aerosol' )
  660. mixf(region)%f2d(abs550dryaer)%mf = metafields( -1 , 'abs550dryaer', 'Surface Dry Aerosol Absorption@550 nm','m-1 ', '', 'surface_absorption_due_to_dry_aerosol' )
  661. mixf(region)%f2d(asydryaer )%mf = metafields( -1 , 'asydryaer ', 'Surface Dry Aersol Asymmetry Parameter' , '1 ', '', 'surface_asymmetry_parameter_dry_aerosol' )
  662. mixf(region)%f2d(ec550drylt1aer )%mf = metafields( -1 , 'ec550drylt1aer ', 'Surface Fine Mode Dry Aerosol Extinction@550 nm' , 'm-1', '', 'surface_extinction_due_to_pm1_dry_aerosol' )
  663. mixf(region)%f2d(abs550drylt1aer)%mf = metafields( -1 , 'abs550drylt1aer', 'Surface Fine Mode Dry Aerosol Absorption@550 nm' , 'm-1', '', 'surface_absorption_due_to_pm1_dry_aerosol' )
  664. mixf(region)%f2d(od440aer )%mf = metafields( -1 , 'od440aer ', 'AOD@440nm ' , '1 ', '', 'atmosphere_optical_thickness_due_to_ambient_aerosol' )
  665. mixf(region)%f2d(abs440aer )%mf = metafields( -1 , 'abs440aer ', 'Absorption AOD@440nm ' , '1 ', '', 'atmosphere_absorption_optical_thickness_due_to_ambient_aerosol' )
  666. mixf(region)%f2d(ec440dryaer )%mf = metafields( -1 , 'ec440dryaer ', 'Surface Dry Aerosol Extinction@440nm' , 'm-1 ', '', 'surface_extinction_due_to_dry_aerosol' )
  667. mixf(region)%f2d(abs440dryaer)%mf = metafields( -1 , 'abs440dryaer', 'Surface Dry Aerosol Absorption@440nm' , 'm-1 ', '', 'surface_absorption_due_to_dry_aerosol' )
  668. mixf(region)%f2d(od870aer )%mf = metafields( -1 , 'od870aer ', 'AOD@870nm ' , '1 ', '', 'atmosphere_optical_thickness_due_to_ambient_aerosol' )
  669. mixf(region)%f2d(abs870aer )%mf = metafields( -1 , 'abs870aer ', 'Absorption AOD@870nm ' , '1 ', '', 'atmosphere_absorption_optical_thickness_due_to_ambient_aerosol' )
  670. mixf(region)%f2d(ec870dryaer )%mf = metafields( -1 , 'ec870dryaer ', 'Surface Dry Aerosol Extinction@870nm' , 'm-1 ', '', 'surface_extinction_due_to_dry_aerosol' )
  671. mixf(region)%f2d(abs870dryaer)%mf = metafields( -1 , 'abs870dryaer', 'Surface Dry Aerosol Absorption@870nm' , 'm-1 ', '', 'surface_absorption_due_to_dry_aerosol' )
  672. mixf(region)%f2d(od350aer )%mf = metafields( -1 , 'od350aer ', 'AOD@350nm ' , '1 ', '', 'atmosphere_optical_thickness_due_to_ambient_aerosol' )
  673. mixf(region)%f2d(abs350aer )%mf = metafields( -1 , 'abs350aer ', 'Absorption AOD@350nm ' , '1 ', '', 'atmosphere_absorption_optical_thickness_due_to_ambient_aerosol' )
  674. !!$ mixf(region)%f2d(52)%mf = metafields( 'od550soa ', 'AOD@550nm SOA ' , '1 ' )
  675. !!$ mixf(region)%f2d(53)%mf = metafields( 'od550bb ', 'AOD@550nm BB ' , '1 ' )
  676. !!$ mixf(region)%f2d(54)%mf = metafields( 'gf90aer ', 'GF @ 90 % RH ' , '1 ' )
  677. if (stat_output) then
  678. ! 1d fields (stations)
  679. statf(region)%f1d( 1)%mf = metafields2( iso4nus, 'mmr1Dtr01', 'mmr of tracer 01' , 'kg kg-1', 'mass_fraction_of_tracer_dry_aerosol_in_air' )
  680. statf(region)%f1d( 2)%mf = metafields2( iso4ais, 'mmr1Dtr02', 'mmr of tracer 02' , 'kg kg-1', 'mass_fraction_of_tracer_dry_aerosol_in_air' )
  681. statf(region)%f1d( 3)%mf = metafields2( iso4acs, 'mmr1Dtr03', 'mmr of tracer 03' , 'kg kg-1', 'mass_fraction_of_tracer_dry_aerosol_in_air' )
  682. statf(region)%f1d( 4)%mf = metafields2( iso4cos, 'mmr1Dtr04', 'mmr of tracer 04' , 'kg kg-1', 'mass_fraction_of_tracer_dry_aerosol_in_air' )
  683. statf(region)%f1d( 5)%mf = metafields2( ibcais , 'mmr1Dtr05', 'mmr of tracer 05' , 'kg kg-1', 'mass_fraction_of_tracer_dry_aerosol_in_air' )
  684. statf(region)%f1d( 6)%mf = metafields2( ibcacs , 'mmr1Dtr06', 'mmr of tracer 06' , 'kg kg-1', 'mass_fraction_of_tracer_dry_aerosol_in_air' )
  685. statf(region)%f1d( 7)%mf = metafields2( ibccos , 'mmr1Dtr07', 'mmr of tracer 07' , 'kg kg-1', 'mass_fraction_of_tracer_dry_aerosol_in_air' )
  686. statf(region)%f1d( 8)%mf = metafields2( ibcaii , 'mmr1Dtr08', 'mmr of tracer 08' , 'kg kg-1', 'mass_fraction_of_tracer_dry_aerosol_in_air' )
  687. statf(region)%f1d( 9)%mf = metafields2( ipomais, 'mmr1Dtr09', 'mmr of tracer 09' , 'kg kg-1', 'mass_fraction_of_tracer_dry_aerosol_in_air' )
  688. statf(region)%f1d(10)%mf = metafields2( ipomacs, 'mmr1Dtr10', 'mmr of tracer 10' , 'kg kg-1', 'mass_fraction_of_tracer_dry_aerosol_in_air' )
  689. statf(region)%f1d(11)%mf = metafields2( ipomcos, 'mmr1Dtr11', 'mmr of tracer 11' , 'kg kg-1', 'mass_fraction_of_tracer_dry_aerosol_in_air' )
  690. statf(region)%f1d(12)%mf = metafields2( ipomaii, 'mmr1Dtr12', 'mmr of tracer 12' , 'kg kg-1', 'mass_fraction_of_tracer_dry_aerosol_in_air' )
  691. statf(region)%f1d(13)%mf = metafields2( issacs , 'mmr1Dtr13', 'mmr of tracer 13' , 'kg kg-1', 'mass_fraction_of_tracer_dry_aerosol_in_air' )
  692. statf(region)%f1d(14)%mf = metafields2( isscos , 'mmr1Dtr14', 'mmr of tracer 14' , 'kg kg-1', 'mass_fraction_of_tracer_dry_aerosol_in_air' )
  693. statf(region)%f1d(15)%mf = metafields2( iduacs , 'mmr1Dtr15', 'mmr of tracer 15' , 'kg kg-1', 'mass_fraction_of_tracer_dry_aerosol_in_air' )
  694. statf(region)%f1d(16)%mf = metafields2( iducos , 'mmr1Dtr16', 'mmr of tracer 16' , 'kg kg-1', 'mass_fraction_of_tracer_dry_aerosol_in_air' )
  695. statf(region)%f1d(17)%mf = metafields2( iduaci , 'mmr1Dtr17', 'mmr of tracer 17' , 'kg kg-1', 'mass_fraction_of_tracer_dry_aerosol_in_air' )
  696. statf(region)%f1d(18)%mf = metafields2( iducoi , 'mmr1Dtr18', 'mmr of tracer 18' , 'kg kg-1', 'mass_fraction_of_tracer_dry_aerosol_in_air' )
  697. statf(region)%f1d(19)%mf = metafields2( inus_n , 'conccn1Dmode01', 'number concentration of mode 01' , 'm-3' , 'number_concentration_of_ambient_aerosol_in_air' )
  698. statf(region)%f1d(20)%mf = metafields2( iais_n , 'conccn1Dmode02', 'number concentration of mode 02' , 'm-3' , 'number_concentration_of_ambient_aerosol_in_air' )
  699. statf(region)%f1d(21)%mf = metafields2( iacs_n , 'conccn1Dmode03', 'number concentration of mode 03' , 'm-3' , 'number_concentration_of_ambient_aerosol_in_air' )
  700. statf(region)%f1d(22)%mf = metafields2( icos_n , 'conccn1Dmode04', 'number concentration of mode 04' , 'm-3' , 'number_concentration_of_ambient_aerosol_in_air' )
  701. statf(region)%f1d(23)%mf = metafields2( iaii_n , 'conccn1Dmode05', 'number concentration of mode 05' , 'm-3' , 'number_concentration_of_ambient_aerosol_in_air' )
  702. statf(region)%f1d(24)%mf = metafields2( iaci_n , 'conccn1Dmode06', 'number concentration of mode 06' , 'm-3' , 'number_concentration_of_ambient_aerosol_in_air' )
  703. statf(region)%f1d(25)%mf = metafields2( icoi_n , 'conccn1Dmode07', 'number concentration of mode 07' , 'm-3' , 'number_concentration_of_ambient_aerosol_in_air' )
  704. statf(region)%f1d(26)%mf = metafields2( 1 , 'mmr1Daerh2o01 ', 'mmr of aerosol water of mode 01' , 'kg kg-1', 'mass_fraction_of_water_in_ambient_aerosol_in_air' )
  705. statf(region)%f1d(27)%mf = metafields2( 2 , 'mmr1Daerh2o02 ', 'mmr of aerosol water of mode 02' , 'kg kg-1', 'mass_fraction_of_water_in_ambient_aerosol_in_air' )
  706. statf(region)%f1d(28)%mf = metafields2( 3 , 'mmr1Daerh2o03 ', 'mmr of aerosol water of mode 03' , 'kg kg-1', 'mass_fraction_of_water_in_ambient_aerosol_in_air' )
  707. statf(region)%f1d(29)%mf = metafields2( 4 , 'mmr1Daerh2o04 ', 'mmr of aerosol water of mode 04' , 'kg kg-1', 'mass_fraction_of_water_in_ambient_aerosol_in_air' )
  708. statf(region)%f1d(30)%mf = metafields2( ino3_a , 'mmr1Dno3_a ', 'mmr of nitrate aerosol' , 'kg kg-1', 'mass_fraction_of_nitrate_dry_aerosol_in_air' )
  709. statf(region)%f1d(31)%mf = metafields2( inh4 , 'mmr1Dnh4 ', 'mmr of ammonium' , 'kg kg-1', 'mass_fraction_of_ammonium_dry_aerosol_in_air' )
  710. statf(region)%f1d(32)%mf = metafields2( imsa , 'mmr1Dmsa ', 'mmr of methane sulfonic acid' , 'kg kg-1', 'mass_fraction_of_methane_sulfonic_acid_in_air' )
  711. statf(region)%f1d(33)%mf = metafields2( -1 , 'ec550dry1Daer ', 'dry aerosol extinction at 550 nm' , 'm-1' , 'atmosphere_extinction_due_to_dry_aerosol' )
  712. statf(region)%f1d(34)%mf = metafields2( -1 , 'abs550dry1Daer', 'dry aerosol absorption at 550 nm' , 'm-1' , 'atmosphere_absorption_due_to_dry_aerosol' )
  713. statf(region)%f1d(35)%mf = metafields2( -1 , 'asydry1Daer', 'dry aerosol asymmetry parameter' , '1' , 'atmosphere_absorption_due_to_dry_aerosol' )
  714. statf(region)%f1d(36)%mf = metafields2( -1 , 'ec550dry1Dlt1aer', 'fine mode dry aerosol extinction at 550 nm' , 'm-1' , 'atmosphere_absorption_due_to_dry_aerosol' )
  715. statf(region)%f1d(37)%mf = metafields2( -1 , 'abs550dry1Dlt1aer', 'fine mode dry aerosol absorption at 550 nm' , 'm-1' , 'atmosphere_absorption_due_to_dry_aerosol' )
  716. statf(region)%f1d(38)%mf = metafields2( -1 , 'ec440dry1Daer', 'dry aerosol extinction at 440 nm' , 'm-1' , 'atmosphere_absorption_due_to_dry_aerosol' )
  717. statf(region)%f1d(39)%mf = metafields2( -1 , 'abs440dry1Daer', 'dry aerosol absorption at 440 nm' , 'm-1' , 'atmosphere_absorption_due_to_dry_aerosol' )
  718. statf(region)%f1d(40)%mf = metafields2( -1 , 'ec870dry1Daer', 'dry aerosol extinction at 870 nm' , 'm-1' , 'atmosphere_absorption_due_to_dry_aerosol' )
  719. statf(region)%f1d(41)%mf = metafields2( -1 , 'abs870dry1Daer', 'dry aerosol absorption at 870 nm' , 'm-1' , 'atmosphere_absorption_due_to_dry_aerosol' )
  720. statf(region)%f1d(42)%mf = metafields2( -1 , 'temp1D ', 'Temperature ' , 'K' , 'air_temperature' )
  721. statf(region)%f1d(43)%mf = metafields2( -1 , 'hus1D ', 'Specific Humidity ' , '1' , 'specific_humidity' )
  722. statf(region)%f1d(44)%mf = metafields2( -1 , 'pressure1D ', 'Pressure ' , 'Pa' , 'air_pressure' )
  723. ! 0d fields (stations)
  724. statf(region)%f0d( 1)%mf = metafields2( iso4nus, 'mmrtr01', 'mmr of tracer 01' , 'kg kg-1', 'mass_fraction_of_tracer_dry_aerosol_in_air' )
  725. statf(region)%f0d( 2)%mf = metafields2( iso4ais, 'mmrtr02', 'mmr of tracer 02' , 'kg kg-1', 'mass_fraction_of_tracer_dry_aerosol_in_air' )
  726. statf(region)%f0d( 3)%mf = metafields2( iso4acs, 'mmrtr03', 'mmr of tracer 03' , 'kg kg-1', 'mass_fraction_of_tracer_dry_aerosol_in_air' )
  727. statf(region)%f0d( 4)%mf = metafields2( iso4cos, 'mmrtr04', 'mmr of tracer 04' , 'kg kg-1', 'mass_fraction_of_tracer_dry_aerosol_in_air' )
  728. statf(region)%f0d( 5)%mf = metafields2( ibcais , 'mmrtr05', 'mmr of tracer 05' , 'kg kg-1', 'mass_fraction_of_tracer_dry_aerosol_in_air' )
  729. statf(region)%f0d( 6)%mf = metafields2( ibcacs , 'mmrtr06', 'mmr of tracer 06' , 'kg kg-1', 'mass_fraction_of_tracer_dry_aerosol_in_air' )
  730. statf(region)%f0d( 7)%mf = metafields2( ibccos , 'mmrtr07', 'mmr of tracer 07' , 'kg kg-1', 'mass_fraction_of_tracer_dry_aerosol_in_air' )
  731. statf(region)%f0d( 8)%mf = metafields2( ibcaii , 'mmrtr08', 'mmr of tracer 08' , 'kg kg-1', 'mass_fraction_of_tracer_dry_aerosol_in_air' )
  732. statf(region)%f0d( 9)%mf = metafields2( ipomais, 'mmrtr09', 'mmr of tracer 09' , 'kg kg-1', 'mass_fraction_of_tracer_dry_aerosol_in_air' )
  733. statf(region)%f0d(10)%mf = metafields2( ipomacs, 'mmrtr10', 'mmr of tracer 10' , 'kg kg-1', 'mass_fraction_of_tracer_dry_aerosol_in_air' )
  734. statf(region)%f0d(11)%mf = metafields2( ipomcos, 'mmrtr11', 'mmr of tracer 11' , 'kg kg-1', 'mass_fraction_of_tracer_dry_aerosol_in_air' )
  735. statf(region)%f0d(12)%mf = metafields2( ipomaii, 'mmrtr12', 'mmr of tracer 12' , 'kg kg-1', 'mass_fraction_of_tracer_dry_aerosol_in_air' )
  736. statf(region)%f0d(13)%mf = metafields2( issacs , 'mmrtr13', 'mmr of tracer 13' , 'kg kg-1', 'mass_fraction_of_tracer_dry_aerosol_in_air' )
  737. statf(region)%f0d(14)%mf = metafields2( isscos , 'mmrtr14', 'mmr of tracer 14' , 'kg kg-1', 'mass_fraction_of_tracer_dry_aerosol_in_air' )
  738. statf(region)%f0d(15)%mf = metafields2( iduacs , 'mmrtr15', 'mmr of tracer 15' , 'kg kg-1', 'mass_fraction_of_tracer_dry_aerosol_in_air' )
  739. statf(region)%f0d(16)%mf = metafields2( iducos , 'mmrtr16', 'mmr of tracer 16' , 'kg kg-1', 'mass_fraction_of_tracer_dry_aerosol_in_air' )
  740. statf(region)%f0d(17)%mf = metafields2( iduaci , 'mmrtr17', 'mmr of tracer 17' , 'kg kg-1', 'mass_fraction_of_tracer_dry_aerosol_in_air' )
  741. statf(region)%f0d(18)%mf = metafields2( iducoi , 'mmrtr18', 'mmr of tracer 18' , 'kg kg-1', 'mass_fraction_of_tracer_dry_aerosol_in_air' )
  742. statf(region)%f0d(19)%mf = metafields2( inus_n , 'conccnmode01', 'number concentration of mode 01' , 'm-3' , 'number_concentration_of_ambient_aerosol_in_air' )
  743. statf(region)%f0d(20)%mf = metafields2( iais_n , 'conccnmode02', 'number concentration of mode 02' , 'm-3' , 'number_concentration_of_ambient_aerosol_in_air' )
  744. statf(region)%f0d(21)%mf = metafields2( iacs_n , 'conccnmode03', 'number concentration of mode 03' , 'm-3' , 'number_concentration_of_ambient_aerosol_in_air' )
  745. statf(region)%f0d(22)%mf = metafields2( icos_n , 'conccnmode04', 'number concentration of mode 04' , 'm-3' , 'number_concentration_of_ambient_aerosol_in_air' )
  746. statf(region)%f0d(23)%mf = metafields2( iaii_n , 'conccnmode05', 'number concentration of mode 05' , 'm-3' , 'number_concentration_of_ambient_aerosol_in_air' )
  747. statf(region)%f0d(24)%mf = metafields2( iaci_n , 'conccnmode06', 'number concentration of mode 06' , 'm-3' , 'number_concentration_of_ambient_aerosol_in_air' )
  748. statf(region)%f0d(25)%mf = metafields2( icoi_n , 'conccnmode07', 'number concentration of mode 07' , 'm-3' , 'number_concentration_of_ambient_aerosol_in_air' )
  749. statf(region)%f0d(26)%mf = metafields2( 1 , 'mmraerh2o01 ', 'mmr of aerosol water of mode 01' , 'kg kg-1', 'mass_fraction_of_water_in_ambient_aerosol_in_air' )
  750. statf(region)%f0d(27)%mf = metafields2( 2 , 'mmraerh2o02 ', 'mmr of aerosol water of mode 02' , 'kg kg-1', 'mass_fraction_of_water_in_ambient_aerosol_in_air' )
  751. statf(region)%f0d(28)%mf = metafields2( 3 , 'mmraerh2o03 ', 'mmr of aerosol water of mode 03' , 'kg kg-1', 'mass_fraction_of_water_in_ambient_aerosol_in_air' )
  752. statf(region)%f0d(29)%mf = metafields2( 4 , 'mmraerh2o04 ', 'mmr of aerosol water of mode 04' , 'kg kg-1', 'mass_fraction_of_water_in_ambient_aerosol_in_air' )
  753. statf(region)%f0d(30)%mf = metafields2( ino3_a , 'mmrno3_a ', 'mmr of nitrate aerosol' , 'kg kg-1', 'mass_fraction_of_nitrate_dry_aerosol_in_air' )
  754. statf(region)%f0d(31)%mf = metafields2( inh4 , 'mmrnh4 ', 'mmr of ammonium' , 'kg kg-1', 'mass_fraction_of_ammonium_dry_aerosol_in_air' )
  755. statf(region)%f0d(32)%mf = metafields2( imsa , 'mmrmsa ', 'mmr of methane sulfonic acid' , 'kg kg-1', 'mass_fraction_of_methane_sulfonic_acid_in_air' )
  756. statf(region)%f0d(33)%mf = metafields2( -1 , 'ec550dryaer ', 'dry aerosol extinction at 550 nm' , 'm-1' , 'atmosphere_extinction_due_to_dry_aerosol' )
  757. statf(region)%f0d(34)%mf = metafields2( -1 , 'abs550dryaer', 'dry aerosol absorption at 550 nm' , 'm-1' , 'atmosphere_absorption_due_to_dry_aerosol' )
  758. statf(region)%f0d(35)%mf = metafields2( -1 , 'asydryaer', 'dry aerosol asymmetry parameter' , '1' , 'atmosphere_absorption_due_to_dry_aerosol' )
  759. statf(region)%f0d(36)%mf = metafields2( -1 , 'ec550drylt1aer', 'fine mode dry aerosol extinction at 550 nm' , 'm-1' , 'atmosphere_absorption_due_to_dry_aerosol' )
  760. statf(region)%f0d(37)%mf = metafields2( -1 , 'abs550drylt1aer', 'fine mode dry aerosol absorption at 550 nm' , 'm-1' , 'atmosphere_absorption_due_to_dry_aerosol' )
  761. statf(region)%f0d(38)%mf = metafields2( -1 , 'ec440dryaer', 'dry aerosol extinction at 440 nm' , 'm-1' , 'atmosphere_absorption_due_to_dry_aerosol' )
  762. statf(region)%f0d(39)%mf = metafields2( -1 , 'abs440dryaer', 'dry aerosol absorption at 440 nm' , 'm-1' , 'atmosphere_absorption_due_to_dry_aerosol' )
  763. statf(region)%f0d(40)%mf = metafields2( -1 , 'ec870dryaer', 'dry aerosol extinction at 870 nm' , 'm-1' , 'atmosphere_absorption_due_to_dry_aerosol' )
  764. statf(region)%f0d(41)%mf = metafields2( -1 , 'abs870dryaer', 'dry aerosol absorption at 870 nm' , 'm-1' , 'atmosphere_absorption_due_to_dry_aerosol' )
  765. statf(region)%f0d(42)%mf = metafields2( -1 , 'temp ', 'Temperature ' , 'K' , 'air_temperature' )
  766. statf(region)%f0d(43)%mf = metafields2( -1 , 'hus ', 'Specific Humidity ' , '1' , 'specific_humidity' )
  767. statf(region)%f0d(44)%mf = metafields2( -1 , 'pressure ', 'Pressure ' , 'Pa' , 'air_pressure' )
  768. statf(region)%f0d(45)%mf = metafields2( -1 , 'ps ', 'Surface Air Pressure ' , 'Pa ' , 'surface_air_pressure' )
  769. statf(region)%f0d(46)%mf = metafields2( -1 , 'precip ', 'Precipitation ' , 'kg m-2 s-1', 'precipitation_flux' )
  770. endif
  771. ! set global dimensions of fields for netcdf definitions
  772. mixf (region)%nlon = imr
  773. mixf (region)%nlat = jmr
  774. mixf (region)%nlev = lmr
  775. if (stat_output) then
  776. statf(region)%nstat = nstations
  777. statf(region)%nlev = lmr
  778. endif
  779. ! intermediate structures for budgets
  780. allocate(drydepos(region)%f2dslast(i1:i2,j1:j2,7))
  781. allocate(wetdepos(region)%f2dslast(i1:i2,j1:j2,7))
  782. allocate(emission(region)%f2dslast(i1:i2,j1:j2,7))
  783. ! these here are the initial budgets (monthly): 0.0
  784. drydepos(region)%f2dslast = 0.0
  785. wetdepos(region)%f2dslast = 0.0
  786. emission(region)%f2dslast = 0.0
  787. endif ! newsrun
  788. ! reset counters and accumulators
  789. mixf (region)%acct = 0
  790. do i = 1, ntracer_3d
  791. mixf(region)%f3d(i)%field = 0.0
  792. end do
  793. do i = 1, ntracer_2d
  794. mixf(region)%f2d(i)%field = 0.0
  795. end do
  796. if (stat_output) then
  797. ! stations
  798. statf(region)%acct = 0
  799. do i = 1, ntracer_1dstat
  800. statf(region)%f1d(i)%field = 0.0
  801. end do
  802. do i = 1, ntracer_0dstat
  803. statf(region)%f0d(i)%field = 0.0
  804. end do
  805. endif
  806. ! ----------------
  807. ! open NetCDF file (mixf)
  808. ! ----------------
  809. call tau2date(itau,idater)
  810. ! time (in days since 2001-01-01 00:00)
  811. call date2tau( time_reftime6, itauref )
  812. select case (trim(aerocom_freq))
  813. case ('hourly')
  814. write(idates, '(i4,3i2.2)') idater(1), idater(2), idater(3), idater(4)+1
  815. write(lidates, '(i4,"-",i2.2,"-",i2.2," ",i2.2,":30")') idater(1), idater(2), idater(3), idater(4)
  816. idater(5:6) = (/30,0/)
  817. case ('daily')
  818. write(idates, '(i4,2i2.2)') idater(1), idater(2), idater(3)
  819. write(lidates, '(i4,"-",i2.2,"-",i2.2," 12:00")') idater(1), idater(2), idater(3)
  820. ! set noon (recommendations)
  821. idater(4:6) = (/12,0,0/)
  822. case ('monthly')
  823. ! for monthly files, set time to middle of the month
  824. write(idates, '(i4,i2.2)') idater(1), idater(2)
  825. mlength=mlen(idater(2))
  826. if ( mod(mlength,2) == 0 ) then
  827. idater(3:6) = (/mlength/2 + 1,0,0,0/)
  828. write(lidates, '(i4,"-",i2.2,"-",i2.2," 00:00")') idater(1), idater(2), idater(3)
  829. else
  830. idater(3:6) = (/(mlength+1)/2,12,0,0/)
  831. write(lidates, '(i4,"-",i2.2,"-",i2.2," 12:00")') idater(1), idater(2), idater(3)
  832. endif
  833. case default
  834. write (gol,'("Unknown AeroCom output frequency;")'); call goErr
  835. end select
  836. call date2tau( idater, itaucur )
  837. reftime = (itaucur - itauref) / 86400.
  838. ! Changed file name convention to AeroCom Control 2015
  839. mixf(region)%fname = trim(outdir)//'/'//&
  840. trim(f_dataid)//'_'//&
  841. trim(f_model) //'_'//&
  842. trim(aerocom_exper)//'_'//&
  843. trim(f_dimmix)//'_'//&
  844. trim(idates) //'_'//&
  845. trim(aerocom_freq) //'.nc'
  846. #ifdef MPI
  847. ! overwrite existing files (clobber), provide MPI stuff:
  848. call MDF_Create( mixf(region)%fname, MDF_NETCDF4, MDF_REPLACE, mixf(region)%funit, status, &
  849. mpi_comm=localComm, mpi_info=MPI_INFO_NULL )
  850. if (status/=0) then
  851. write (gol,'("from creating NetCDF4 file for writing in parallel;")'); call goErr
  852. write (gol,'("MDF module not compiled with netcdf4_par support ?")'); call goErr
  853. TRACEBACK; status=1; return
  854. end if
  855. #else
  856. ! overwrite existing files (clobber)
  857. call MDF_Create( mixf(region)%fname, MDF_NETCDF4, MDF_REPLACE, mixf(region)%funit, status )
  858. IF_NOTOK_RETURN(status=1)
  859. #endif
  860. if(okdebug) then
  861. write(gol,*) 'output_aerocom_init: File ', trim(mixf(region)%fname), ' opened ' ; call goPr
  862. endif
  863. ! global attributes
  864. call MDF_Put_Att( mixf(region)%funit, MDF_GLOBAL, 'title', 'Model output for AeroCom', status )
  865. IF_NOTOK_MDF(fid=mixf(region)%funit)
  866. call MDF_Put_Att( mixf(region)%funit, MDF_GLOBAL, 'source', 'TM5-mp', status )
  867. IF_NOTOK_MDF(fid=mixf(region)%funit)
  868. call MDF_Put_Att( mixf(region)%funit, MDF_GLOBAL, 'institution', 'Royal Netherlands Meteorological Institute (KNMI), De Bilt, The Netherlands)', status )
  869. IF_NOTOK_MDF(fid=mixf(region)%funit)
  870. call MDF_Put_Att( mixf(region)%funit, MDF_GLOBAL, 'contact' , 'Twan van Noije; noije@knmi.nl', status )
  871. IF_NOTOK_MDF(fid=mixf(region)%funit)
  872. call MDF_Put_Att( mixf(region)%funit, MDF_GLOBAL, 'project_id', 'AeroCom Phase 3', status )
  873. IF_NOTOK_MDF(fid=mixf(region)%funit)
  874. call MDF_Put_Att( mixf(region)%funit, MDF_GLOBAL, 'conventions', 'CF-1.0 - HTAP', status )
  875. IF_NOTOK_MDF(fid=mixf(region)%funit)
  876. call MDF_Put_Att( mixf(region)%funit, MDF_GLOBAL, 'date', lidates, status )
  877. IF_NOTOK_MDF(fid=mixf(region)%funit)
  878. call MDF_Put_Att( mixf(region)%funit, MDF_GLOBAL, 'time_units', time_units, status )
  879. IF_NOTOK_MDF(fid=mixf(region)%funit)
  880. call MDF_Put_Att( mixf(region)%funit, MDF_GLOBAL, 'references', 'http://tm5.sourceforge.net/', status )
  881. IF_NOTOK_MDF(fid=mixf(region)%funit)
  882. ! define dimensions
  883. call MDF_Def_Dim( mixf(region)%funit, 'longitude', imr, mixf(region)%nlon, status )
  884. IF_NOTOK_MDF(fid=mixf(region)%funit)
  885. call MDF_Def_Dim( mixf(region)%funit, 'latitude', jmr, mixf(region)%nlat, status )
  886. IF_NOTOK_MDF(fid=mixf(region)%funit)
  887. call MDF_Def_Dim( mixf(region)%funit, 'alevel', lmr, mixf(region)%nlev, status )
  888. IF_NOTOK_MDF(fid=mixf(region)%funit)
  889. ! define variables
  890. do i = 1, ntracer_3d
  891. call MDF_Def_Var( mixf(region)%funit, trim(mixf(region)%f3d(i)%mf%vname), MDF_FLOAT, &
  892. (/mixf(region)%nlon, mixf(region)%nlat, mixf(region)%nlev/), varid, status )
  893. IF_NOTOK_MDF(fid=mixf(region)%funit)
  894. call MDF_Var_Par_Access( mixf(region)%funit, varid, access_mode, status )
  895. IF_NOTOK_MDF(fid=mixf(region)%funit)
  896. call MDF_Put_Att( mixf(region)%funit, varid, 'long_name', trim(mixf(region)%f3d(i)%mf%lname), status )
  897. IF_NOTOK_MDF(fid=mixf(region)%funit)
  898. call MDF_Put_Att( mixf(region)%funit, varid, 'standard_name', trim(mixf(region)%f3d(i)%mf%standard_name), status )
  899. IF_NOTOK_MDF(fid=mixf(region)%funit)
  900. call MDF_Put_Att( mixf(region)%funit, varid, 'units', trim(mixf(region)%f3d(i)%mf%unit), status )
  901. IF_NOTOK_MDF(fid=mixf(region)%funit)
  902. call MDF_Put_Att( mixf(region)%funit, varid, 'time', reftime, status )
  903. IF_NOTOK_MDF(fid=mixf(region)%funit)
  904. call MDF_Put_Att( mixf(region)%funit, varid, 'cell_methods', 'time: mean', status )
  905. IF_NOTOK_MDF(fid=mixf(region)%funit)
  906. if( mixf(region)%f3d(i)%mf%positive /= '' ) then
  907. call MDF_Put_Att( mixf(region)%funit, varid, 'positive', trim(mixf(region)%f3d(i)%mf%positive), status )
  908. IF_NOTOK_MDF(fid=mixf(region)%funit)
  909. end if
  910. mixf(region)%f3d(i)%varid = varid
  911. end do
  912. do i = 1, ntracer_2d
  913. call MDF_Def_Var( mixf(region)%funit, trim(mixf(region)%f2d(i)%mf%vname), MDF_FLOAT, &
  914. (/mixf(region)%nlon, mixf(region)%nlat/), varid, status )
  915. IF_NOTOK_MDF(fid=mixf(region)%funit)
  916. call MDF_Var_Par_Access( mixf(region)%funit, varid, access_mode, status )
  917. IF_NOTOK_MDF(fid=mixf(region)%funit)
  918. call MDF_Put_Att( mixf(region)%funit, varid, 'long_name', trim(mixf(region)%f2d(i)%mf%lname), status )
  919. IF_NOTOK_MDF(fid=mixf(region)%funit)
  920. call MDF_Put_Att( mixf(region)%funit, varid, 'standard_name', trim(mixf(region)%f2d(i)%mf%standard_name), status )
  921. IF_NOTOK_MDF(fid=mixf(region)%funit)
  922. call MDF_Put_Att( mixf(region)%funit, varid, 'units', trim(mixf(region)%f2d(i)%mf%unit), status )
  923. IF_NOTOK_MDF(fid=mixf(region)%funit)
  924. call MDF_Put_Att( mixf(region)%funit, varid, 'time', reftime, status )
  925. IF_NOTOK_MDF(fid=mixf(region)%funit)
  926. call MDF_Put_Att( mixf(region)%funit, varid, 'cell_methods', 'time: mean', status )
  927. IF_NOTOK_MDF(fid=mixf(region)%funit)
  928. if( mixf(region)%f2d(i)%mf%positive /= '' ) then
  929. call MDF_Put_Att( mixf(region)%funit, varid, 'positive', trim(mixf(region)%f2d(i)%mf%positive), status )
  930. IF_NOTOK_MDF(fid=mixf(region)%funit)
  931. end if
  932. mixf(region)%f2d(i)%varid = varid
  933. end do
  934. call MDF_EndDef( mixf(region)%funit, status )
  935. IF_NOTOK_MDF(fid=mixf(region)%funit)
  936. if (stat_output) then
  937. ! ------------
  938. ! station NetCDF file
  939. ! ------------
  940. statf(region)%fname = trim(outdir)//'/'//&
  941. trim(f_dataid) //'_'//&
  942. trim(f_model) //'_'//&
  943. trim(aerocom_exper) //'_'//&
  944. trim(f_dimstat)//'_'//&
  945. trim(idates) //'_'//&
  946. trim(aerocom_freq) //'.nc'
  947. #ifdef MPI
  948. ! overwrite existing files (clobber), provide MPI stuff:
  949. call MDF_Create( statf(region)%fname, MDF_NETCDF4, MDF_REPLACE, statf(region)%funit, status, &
  950. mpi_comm=localComm, mpi_info=MPI_INFO_NULL )
  951. if (status/=0) then
  952. write (gol,'("from creating NetCDF4 file for writing in parallel;")'); call goErr
  953. write (gol,'("MDF module not compiled with netcdf4_par support ?")'); call goErr
  954. TRACEBACK; status=1; return
  955. end if
  956. #else
  957. ! overwrite existing files (clobber)
  958. call MDF_Create( statf(region)%fname, MDF_NETCDF4, MDF_REPLACE, statf(region)%funit, status )
  959. IF_NOTOK_RETURN(status=1)
  960. #endif
  961. if(okdebug) then
  962. write(gol,*) ' output_aerocom_init: File ', trim(statf(region)%fname), ' opened '; call goPr
  963. endif
  964. ! global attributes
  965. call MDF_Put_Att( statf(region)%funit, MDF_GLOBAL, 'title', 'Model output for AeroCom', status )
  966. IF_NOTOK_MDF(fid=statf(region)%funit)
  967. call MDF_Put_Att( statf(region)%funit, MDF_GLOBAL, 'source', 'TM5-mp', status )
  968. IF_NOTOK_MDF(fid=statf(region)%funit)
  969. call MDF_Put_Att( statf(region)%funit, MDF_GLOBAL, 'institution', 'Royal Netherlands Meteorological Institute (KNMI), De Bilt, The Netherlands)', status )
  970. IF_NOTOK_MDF(fid=statf(region)%funit)
  971. call MDF_Put_Att( statf(region)%funit, MDF_GLOBAL, 'contact', 'Twan van Noije; noije@knmi.nl', status )
  972. IF_NOTOK_MDF(fid=statf(region)%funit)
  973. call MDF_Put_Att( statf(region)%funit, MDF_GLOBAL, 'project_id', 'AeroCom Phase 3', status )
  974. IF_NOTOK_MDF(fid=statf(region)%funit)
  975. call MDF_Put_Att( statf(region)%funit, MDF_GLOBAL, 'conventions', 'CF-1.0 - HTAP', status )
  976. IF_NOTOK_MDF(fid=statf(region)%funit)
  977. call MDF_Put_Att( statf(region)%funit, MDF_GLOBAL, 'date', lidates, status )
  978. IF_NOTOK_MDF(fid=statf(region)%funit)
  979. call MDF_Put_Att( statf(region)%funit, MDF_GLOBAL, 'time_units', time_units, status )
  980. IF_NOTOK_MDF(fid=statf(region)%funit)
  981. call MDF_Put_Att( statf(region)%funit, MDF_GLOBAL, 'references', 'http://tm5.sourceforge.net/', status )
  982. IF_NOTOK_MDF(fid=statf(region)%funit)
  983. ! define dimensions
  984. call MDF_Def_Dim( statf(region)%funit, 'station', nstations, statf(region)%nstat, status )
  985. IF_NOTOK_MDF(fid=statf(region)%funit)
  986. call MDF_Def_Dim( statf(region)%funit, 'stationname_len', statnamelen, snamelendim, status )
  987. IF_NOTOK_MDF(fid=statf(region)%funit)
  988. call MDF_Def_Dim( statf(region)%funit, 'alevel', lmr, statf(region)%nlev, status )
  989. IF_NOTOK_MDF(fid=statf(region)%funit)
  990. ! define variables
  991. do i = 1, ntracer_1dstat
  992. call MDF_Def_Var( statf(region)%funit, trim(statf(region)%f1d(i)%mf%vname), MDF_FLOAT, &
  993. (/statf(region)%nstat,statf(region)%nlev/), varid, status )
  994. IF_NOTOK_MDF(fid=statf(region)%funit)
  995. call MDF_Var_Par_Access( statf(region)%funit, varid, access_mode_sta, status )
  996. IF_NOTOK_MDF(fid=statf(region)%funit)
  997. call MDF_Put_Att( statf(region)%funit, varid, 'long_name', trim(statf(region)%f1d(i)%mf%lname), status )
  998. IF_NOTOK_MDF(fid=statf(region)%funit)
  999. call MDF_Put_Att( statf(region)%funit, varid, 'standard_name', trim(statf(region)%f1d(i)%mf%standard_name), status )
  1000. IF_NOTOK_MDF(fid=statf(region)%funit)
  1001. call MDF_Put_Att( statf(region)%funit, varid, 'units', trim(statf(region)%f1d(i)%mf%unit), status )
  1002. IF_NOTOK_MDF(fid=statf(region)%funit)
  1003. call MDF_Put_Att( statf(region)%funit, varid, 'time', reftime, status )
  1004. IF_NOTOK_MDF(fid=statf(region)%funit)
  1005. call MDF_Put_Att( statf(region)%funit, varid, 'cell_methods', 'time: mean', status )
  1006. IF_NOTOK_MDF(fid=statf(region)%funit)
  1007. statf(region)%f1d(i)%varid = varid
  1008. end do
  1009. do i = 1, ntracer_0dstat
  1010. call MDF_Def_Var( statf(region)%funit, trim(statf(region)%f0d(i)%mf%vname), MDF_FLOAT, &
  1011. (/statf(region)%nstat/), varid, status )
  1012. IF_NOTOK_MDF(fid=statf(region)%funit)
  1013. call MDF_Var_Par_Access( statf(region)%funit, varid, access_mode_sta, status )
  1014. IF_NOTOK_MDF(fid=statf(region)%funit)
  1015. call MDF_Put_Att( statf(region)%funit, varid, 'long_name', trim(statf(region)%f0d(i)%mf%lname), status )
  1016. IF_NOTOK_MDF(fid=statf(region)%funit)
  1017. call MDF_Put_Att( statf(region)%funit, varid, 'standard_name', trim(statf(region)%f0d(i)%mf%standard_name), status )
  1018. IF_NOTOK_MDF(fid=statf(region)%funit)
  1019. call MDF_Put_Att( statf(region)%funit, varid, 'units', trim(statf(region)%f0d(i)%mf%unit), status )
  1020. IF_NOTOK_MDF(fid=statf(region)%funit)
  1021. call MDF_Put_Att( statf(region)%funit, varid, 'time', reftime, status )
  1022. IF_NOTOK_MDF(fid=statf(region)%funit)
  1023. call MDF_Put_Att( statf(region)%funit, varid, 'cell_methods', 'time: mean', status )
  1024. IF_NOTOK_MDF(fid=statf(region)%funit)
  1025. statf(region)%f0d(i)%varid = varid
  1026. end do
  1027. ! station information (name, nb, lat, lon, alt)
  1028. call MDF_Def_Var( statf(region)%funit, 'stationname', MDF_CHAR, (/snamelendim,statf(region)%nstat/), varid, status )
  1029. IF_NOTOK_MDF(fid=statf(region)%funit)
  1030. call MDF_Var_Par_Access( statf(region)%funit, varid, access_mode_sta, status )
  1031. IF_NOTOK_MDF(fid=statf(region)%funit)
  1032. call MDF_Put_Att( statf(region)%funit, varid, 'long_name', 'station name', status )
  1033. IF_NOTOK_MDF(fid=statf(region)%funit)
  1034. call MDF_Put_Att( statf(region)%funit, varid, 'standard_name', 'station_name', status )
  1035. IF_NOTOK_MDF(fid=statf(region)%funit)
  1036. call MDF_Put_Att( statf(region)%funit, varid, 'units', '1', status )
  1037. IF_NOTOK_MDF(fid=statf(region)%funit)
  1038. statvarid(1) = varid
  1039. call MDF_Def_Var( statf(region)%funit, 'stationnb', MDF_INT, (/statf(region)%nstat/), varid, status )
  1040. IF_NOTOK_MDF(fid=statf(region)%funit)
  1041. call MDF_Var_Par_Access( statf(region)%funit, varid, access_mode_sta, status )
  1042. IF_NOTOK_MDF(fid=statf(region)%funit)
  1043. call MDF_Put_Att( statf(region)%funit, varid, 'long_name', 'station number', status )
  1044. IF_NOTOK_MDF(fid=statf(region)%funit)
  1045. call MDF_Put_Att( statf(region)%funit, varid, 'standard_name', 'station_nb', status )
  1046. IF_NOTOK_MDF(fid=statf(region)%funit)
  1047. call MDF_Put_Att( statf(region)%funit, varid, 'units', '1', status )
  1048. IF_NOTOK_MDF(fid=statf(region)%funit)
  1049. statvarid(2) = varid
  1050. call MDF_Def_Var( statf(region)%funit, 'stationlat', MDF_FLOAT, (/statf(region)%nstat/), varid, status )
  1051. IF_NOTOK_MDF(fid=statf(region)%funit)
  1052. call MDF_Var_Par_Access( statf(region)%funit, varid, access_mode_sta, status )
  1053. IF_NOTOK_MDF(fid=statf(region)%funit)
  1054. call MDF_Put_Att( statf(region)%funit, varid, 'long_name', 'location of station: station latitude', status )
  1055. IF_NOTOK_MDF(fid=statf(region)%funit)
  1056. call MDF_Put_Att( statf(region)%funit, varid, 'standard_name', 'stationlat', status )
  1057. IF_NOTOK_MDF(fid=statf(region)%funit)
  1058. call MDF_Put_Att( statf(region)%funit, varid, 'units', '1', status )
  1059. IF_NOTOK_MDF(fid=statf(region)%funit)
  1060. statvarid(3) = varid
  1061. call MDF_Def_Var( statf(region)%funit, 'stationlon', MDF_FLOAT, (/statf(region)%nstat/), varid, status )
  1062. IF_NOTOK_MDF(fid=statf(region)%funit)
  1063. call MDF_Var_Par_Access( statf(region)%funit, varid, access_mode_sta, status )
  1064. IF_NOTOK_MDF(fid=statf(region)%funit)
  1065. call MDF_Put_Att( statf(region)%funit, varid, 'long_name', 'location of station: station longitude', status )
  1066. IF_NOTOK_MDF(fid=statf(region)%funit)
  1067. call MDF_Put_Att( statf(region)%funit, varid, 'standard_name', 'stationlon', status )
  1068. IF_NOTOK_MDF(fid=statf(region)%funit)
  1069. call MDF_Put_Att( statf(region)%funit, varid, 'units', '1', status )
  1070. IF_NOTOK_MDF(fid=statf(region)%funit)
  1071. statvarid(4) = varid
  1072. call MDF_Def_Var( statf(region)%funit, 'stationalt', MDF_FLOAT, (/statf(region)%nstat/), varid, status )
  1073. IF_NOTOK_MDF(fid=statf(region)%funit)
  1074. call MDF_Var_Par_Access( statf(region)%funit, varid, access_mode_sta, status )
  1075. IF_NOTOK_MDF(fid=statf(region)%funit)
  1076. call MDF_Put_Att( statf(region)%funit, varid, 'long_name', 'location of station: station altitude', status )
  1077. IF_NOTOK_MDF(fid=statf(region)%funit)
  1078. call MDF_Put_Att( statf(region)%funit, varid, 'standard_name', 'stationalt', status )
  1079. IF_NOTOK_MDF(fid=statf(region)%funit)
  1080. call MDF_Put_Att( statf(region)%funit, varid, 'units', '1', status )
  1081. IF_NOTOK_MDF(fid=statf(region)%funit)
  1082. statvarid(5) = varid
  1083. call MDF_EndDef( statf(region)%funit, status )
  1084. IF_NOTOK_MDF(fid=statf(region)%funit)
  1085. ! put station information (note: behavior here is like if all procs write same data)
  1086. call MDF_Put_Var( statf(region)%funit, statvarid(1), tmpstatnames, status, start=(/ 1, 1/), count=(/ statnamelen,nstations /) )
  1087. IF_NOTOK_MDF(fid=statf(region)%funit)
  1088. call MDF_Put_Var( statf(region)%funit, statvarid(2), statlist(:)%statnb, status )
  1089. IF_NOTOK_MDF(fid=statf(region)%funit)
  1090. call MDF_Put_Var( statf(region)%funit, statvarid(3), statlist(:)%statlat, status )
  1091. IF_NOTOK_MDF(fid=statf(region)%funit)
  1092. call MDF_Put_Var( statf(region)%funit, statvarid(4), statlist(:)%statlon, status )
  1093. IF_NOTOK_MDF(fid=statf(region)%funit)
  1094. call MDF_Put_Var( statf(region)%funit, statvarid(5), statlist(:)%statalt, status )
  1095. IF_NOTOK_MDF(fid=statf(region)%funit)
  1096. endif
  1097. end do regionloop ! nregions
  1098. call goLabel() ; status = 0
  1099. end subroutine output_aerocom_init
  1100. !EOC
  1101. !--------------------------------------------------------------------------
  1102. ! TM5 !
  1103. !--------------------------------------------------------------------------
  1104. !BOP
  1105. !
  1106. ! !IROUTINE: OUTPUT_AEROCOM_DONE
  1107. !
  1108. ! !DESCRIPTION: Free parameters.
  1109. !\\
  1110. !\\
  1111. ! !INTERFACE:
  1112. !
  1113. subroutine output_aerocom_done(stat_output, status, iregion)
  1114. !
  1115. ! !USES:
  1116. !
  1117. ! !INPUT PARAMETERS:
  1118. !
  1119. logical, intent(in) :: stat_output ! true if stations output is requested
  1120. integer, intent(in), optional :: iregion
  1121. !
  1122. ! !OUTPUT PARAMETERS:
  1123. !
  1124. integer, intent(out) :: status
  1125. !
  1126. ! !REVISION HISTORY:
  1127. ! 29 Nov 2010 - Achim Strunk -
  1128. !
  1129. ! !REMARKS:
  1130. !
  1131. !EOP
  1132. !------------------------------------------------------------------------
  1133. !BOC
  1134. character(len=*), parameter :: rname = mname//'/output_aerocom_done'
  1135. integer :: i, region
  1136. ! --- begin -------------------------------------
  1137. call goLabel(rname)
  1138. deallocate( wdep_out )
  1139. regionloop: do region = 1, nregions
  1140. ! if region given, cycle if other region!
  1141. if (present(iregion)) then
  1142. if(iregion /= region) cycle regionloop
  1143. endif
  1144. do i=1,ntracer_3d
  1145. deallocate( mixf(region)%f3d(i)%field )
  1146. end do
  1147. do i=1,ntracer_2d
  1148. deallocate( mixf(region)%f2d(i)%field )
  1149. end do
  1150. deallocate( mixf (region)%f3d )
  1151. deallocate( mixf (region)%f2d )
  1152. deallocate( drydepos(region)%f2dslast )
  1153. deallocate( wetdepos(region)%f2dslast )
  1154. deallocate( emission(region)%f2dslast )
  1155. if (stat_output) then
  1156. ! stations
  1157. do i=1,ntracer_1dstat
  1158. deallocate( statf(region)%f1d(i)%field )
  1159. end do
  1160. do i=1,ntracer_0dstat
  1161. deallocate( statf(region)%f0d(i)%field )
  1162. end do
  1163. deallocate( statf(region)%f1d )
  1164. deallocate( statf(region)%f0d )
  1165. deallocate( sintp(region)%ixl, sintp(region)%wixl, sintp(region)%ixr, sintp(region)%wixr, &
  1166. sintp(region)%jyl, sintp(region)%wjyl, sintp(region)%jyr, sintp(region)%wjyr, &
  1167. sintp(region)%lzl, sintp(region)%wlzl, sintp(region)%lzr, sintp(region)%wlzr, &
  1168. sintp(region)%tght )
  1169. endif
  1170. end do regionloop
  1171. if (stat_output) then
  1172. deallocate( statlist )
  1173. deallocate( tmpstatnames )
  1174. deallocate( stat_active )
  1175. endif
  1176. call goLabel() ; status = 0
  1177. end subroutine output_aerocom_done
  1178. !EOC
  1179. !--------------------------------------------------------------------------
  1180. ! TM5 !
  1181. !--------------------------------------------------------------------------
  1182. !BOP
  1183. !
  1184. ! !IROUTINE: output_aerocom_write
  1185. !
  1186. ! !DESCRIPTION: This routines builds the average by dividing accumulated
  1187. ! data by stack counter. The results are written to file.
  1188. !\\
  1189. !\\
  1190. ! !INTERFACE:
  1191. !
  1192. subroutine output_aerocom_write(region, stat_output, status)
  1193. !
  1194. ! !USES:
  1195. !
  1196. ! !INPUT PARAMETERS:
  1197. !
  1198. integer, intent(in) :: region
  1199. logical, intent(in) :: stat_output ! true if stations output is requested
  1200. !
  1201. ! !OUTPUT PARAMETERS:
  1202. !
  1203. integer, intent(out) :: status
  1204. !
  1205. ! !REVISION HISTORY:
  1206. ! 29 Nov 2010 - Achim Strunk -
  1207. !
  1208. ! !REMARKS:
  1209. !
  1210. !EOP
  1211. !------------------------------------------------------------------------
  1212. !BOC
  1213. character(len=*), parameter :: rname = mname//'/output_aerocom_write'
  1214. integer :: i, imr, jmr, lmr
  1215. integer :: i1, i2, j1, j2, ilev
  1216. integer :: istat
  1217. ! --- begin -------------------------------------
  1218. call goLabel(rname)
  1219. ! grid size
  1220. call Get_DistGrid( dgrid(region), I_STRT=i1, I_STOP=i2, J_STRT=j1, J_STOP=j2 )
  1221. imr = i2-i1+1
  1222. jmr = j2-j1+1
  1223. lmr = levi%nlev
  1224. ! this here is already accumulated over the time period (day)
  1225. call collect_budgets( region, status )
  1226. IF_NOTOK_RETURN(status=1)
  1227. ! ---------------------
  1228. ! divide by accumulator
  1229. ! ---------------------
  1230. do i = 1, ntracer_3d
  1231. mixf(region)%f3d(i)%field = mixf(region)%f3d(i)%field / real( mixf(region)%acct )
  1232. end do
  1233. do i = 1, ntracer_2d
  1234. mixf(region)%f2d(i)%field = mixf(region)%f2d(i)%field / real( mixf(region)%acct )
  1235. end do
  1236. if (stat_output) then
  1237. ! stations
  1238. do istat = 1, nstations
  1239. if (stat_active(istat)) then
  1240. do i = 1, ntracer_1dstat
  1241. statf(region)%f1d(i)%field(istat,:) = statf(region)%f1d(i)%field(istat,:) / real( statf(region)%acct )
  1242. end do
  1243. do i = 1, ntracer_0dstat
  1244. statf(region)%f0d(i)%field(istat) = statf(region)%f0d(i)%field(istat) / real( statf(region)%acct )
  1245. end do
  1246. endif
  1247. end do
  1248. endif
  1249. select case (trim(aerocom_freq))
  1250. case ('hourly')
  1251. write(gol,'("---> AEROCOM diagnostics: write file for previous hour")'); call goPr
  1252. case ('daily')
  1253. write(gol,'("---> AEROCOM diagnostics: write file for previous day")'); call goPr
  1254. case ('monthly')
  1255. write(gol,'("---> AEROCOM diagnostics: write file for previous month")'); call goPr
  1256. end select
  1257. ! -------------
  1258. ! write to file
  1259. ! -------------
  1260. do i=1,ntracer_2d
  1261. call MDF_Put_Var( mixf(region)%funit, mixf(region)%f2d(i)%varid, mixf(region)%f2d(i)%field, status, start=(/i1,j1/), count=(/imr,jmr/) )
  1262. IF_NOTOK_MDF(fid=mixf(region)%funit)
  1263. end do
  1264. do i=1,ntracer_3d
  1265. call MDF_Put_Var( mixf(region)%funit, mixf(region)%f3d(i)%varid, mixf(region)%f3d(i)%field, status, start=(/i1,j1,1/), count=(/imr,jmr,lmr/) )
  1266. IF_NOTOK_MDF(fid=mixf(region)%funit)
  1267. end do
  1268. call MDF_Close( mixf(region)%funit, status )
  1269. IF_NOTOK_MDF(fid=mixf(region)%funit)
  1270. if (stat_output) then
  1271. ! stations
  1272. do istat = 1, nstations
  1273. if (stat_active(istat)) then
  1274. do i=1,ntracer_1dstat
  1275. call MDF_Put_Var( statf(region)%funit, statf(region)%f1d(i)%varid, statf(region)%f1d(i)%field(istat,:), &
  1276. status, start=(/istat,1/), count=(/1,lmr/) )
  1277. IF_NOTOK_MDF(fid=statf(region)%funit)
  1278. end do
  1279. do i=1,ntracer_0dstat
  1280. call MDF_Put_Var( statf(region)%funit, statf(region)%f0d(i)%varid, (/statf(region)%f0d(i)%field(istat)/), &
  1281. status, start=(/istat/), count=(/1/) )
  1282. IF_NOTOK_MDF(fid=statf(region)%funit)
  1283. end do
  1284. endif
  1285. end do
  1286. call MDF_Close( statf(region)%funit, status )
  1287. IF_NOTOK_MDF(fid=statf(region)%funit)
  1288. endif
  1289. call goLabel() ; status = 0
  1290. end subroutine output_aerocom_write
  1291. !EOC
  1292. !--------------------------------------------------------------------------
  1293. ! TM5 !
  1294. !--------------------------------------------------------------------------
  1295. !BOP
  1296. !
  1297. ! !IROUTINE: OUTPUT_AEROCOM_STEP
  1298. !
  1299. ! !DESCRIPTION: This is the accumulation routine. It is called following
  1300. ! the user specification aerocom.dhour in rc-file. It
  1301. ! evaluates the various diagnostics and does summing.
  1302. !\\
  1303. !\\
  1304. ! !INTERFACE:
  1305. !
  1306. subroutine output_aerocom_step( region, dhour, stat_output, status )
  1307. !
  1308. ! !USES:
  1309. !
  1310. use GO , only : TDate, NewDate, rTotal, operator(-)
  1311. use Grid , only : FPressure
  1312. use binas, only : rgas, rol
  1313. use datetime, only : tau2date
  1314. use MeteoData, only : sp_dat, lsp_dat, cp_dat, m_dat
  1315. use MeteoData, only : temper_dat, humid_dat, gph_dat
  1316. use global_data, only : mass_dat, region_dat
  1317. use tracer_data, only : chem_dat
  1318. use dims, only : itaur
  1319. use chem_param, only : iso4acs, iso4cos, iduacs, iso4ais, ibccos, ibcaii, xmair
  1320. use chem_param, only : iso4nus, isscos, ino3_a, issacs, iducos, iduaci, nmod
  1321. use chem_param, only : iducoi, ibcacs, ipomcos, ipomaii, ibcais, ipomacs, ipomais
  1322. use chem_param, only : imsa, inh4
  1323. use chem_param, only : ntracet
  1324. use mo_aero_m7, only : nsol
  1325. use optics, only : optics_aop_get
  1326. use m7_data, only : h2o_mode, rw_mode, rwd_mode
  1327. !
  1328. ! !INPUT PARAMETERS:
  1329. !
  1330. integer, intent(in) :: region
  1331. integer, intent(in) :: dhour ! this is aerocom.dhour [hours]
  1332. logical, intent(in) :: stat_output ! true if stations output is requested
  1333. !
  1334. ! !OUTPUT PARAMETERS:
  1335. !
  1336. integer, intent(out) :: status
  1337. !
  1338. ! !REVISION HISTORY:
  1339. ! 29 Nov 2010 - Achim Strunk - Creation
  1340. !
  1341. ! !REMARKS:
  1342. !
  1343. !EOP
  1344. !------------------------------------------------------------------------
  1345. !BOC
  1346. character(len=*), parameter :: rname = mname//'/output_aerocom_step'
  1347. ! MPI arrays to gather fields.
  1348. real, dimension(:,:,:,:), pointer :: rm, rmc
  1349. real, dimension(:,:,:), allocatable, target :: mg
  1350. real, dimension(:), pointer :: dxyp
  1351. real, dimension(:,:,:), allocatable :: pres3d
  1352. integer :: i, j, k, imr, jmr, lmr, lwl, dtime
  1353. integer :: i1, i2, j1, j2
  1354. integer :: ie, je ! indices for subdomain extended with halo cells
  1355. integer, parameter :: l_halo=1
  1356. logical :: polar
  1357. integer :: istat, imode
  1358. real :: dens, load_tmp
  1359. Real, Dimension(:,:,:), Allocatable :: aop_output_ext ! extinctions
  1360. Real, Dimension(:,:), Allocatable :: aop_output_a ! single scattering albedo
  1361. Real, Dimension(:,:), Allocatable :: aop_output_g ! assymetry factor
  1362. Real, Dimension(:,:,:), Allocatable :: aop_output_add ! additional parameters
  1363. real, dimension(:,:,:,:,:), allocatable :: opt_ext
  1364. real, dimension(:,:,:,:), allocatable :: opt_a
  1365. real, dimension(:,:,:,:), allocatable :: opt_g
  1366. real, dimension(:,:,:,:,:), allocatable :: opt_add
  1367. real, dimension(:,:,:), allocatable :: volume
  1368. real, dimension(:,:), allocatable :: temp2d
  1369. integer :: ncontr, lvec, lct, l, indoffset, nwl
  1370. integer :: nadd, nadd_max, indoffset_stat, indabs
  1371. integer :: iadd
  1372. real :: no3fac, wght, dwght, tabs
  1373. integer,dimension(6) :: idate_f
  1374. type(TDate) :: t, t0
  1375. real :: time
  1376. ! --- begin -------------------------------
  1377. call goLabel(rname)
  1378. ! grid size
  1379. call Get_DistGrid( dgrid(region), I_STRT=i1, I_STOP=i2, J_STRT=j1, J_STOP=j2, hasNorthPole=polar )
  1380. imr = i2-i1+1
  1381. jmr = j2-j1+1
  1382. lmr = levi%nlev
  1383. nullify(rmc)
  1384. rmc => chem_dat(region)%rm
  1385. dxyp => region_dat(region)%dxyp
  1386. rm => mass_dat(region)%rm
  1387. ! get helping pressure field in 3d
  1388. ie=i2; je=j2
  1389. if (stat_output) then
  1390. if (stat_halo_glob.eq.1) then
  1391. CALL UPDATE_HALO( dgrid(region), sp_dat(region)%data(:,:,1), sp_dat(region)%halo, status)
  1392. IF_NOTOK_RETURN(status=1)
  1393. ! in the interpolation routine,
  1394. ! halo cells are only needed at the eastern or northern boundary of the subdomain
  1395. ie=i2+1
  1396. if (.not.polar) je=j2+1
  1397. endif
  1398. endif
  1399. allocate( pres3d(i1:ie,j1:je,lmr) )
  1400. ! fill mid level pressure
  1401. call FPressure( levi, sp_dat(region)%data(i1:ie,j1:je,1), pres3d, status )
  1402. IF_NOTOK_RETURN(status=1)
  1403. ! dtime is seconds per step
  1404. ! dtime will be taken as weight for summing up
  1405. ! (makes it fit for varying step lengths)
  1406. dtime = dhour * 3600.
  1407. ! sum up for later averaging
  1408. mixf (region)%acct = mixf (region)%acct + dtime
  1409. if (stat_output) then
  1410. statf(region)%acct = statf(region)%acct + dtime
  1411. endif
  1412. ! ----------------------
  1413. ! 3D meteo fields
  1414. ! ----------------------
  1415. ! temperature
  1416. mixf(region)%f3d(temp)%field = mixf(region)%f3d(temp)%field + dtime * temper_dat(region)%data(i1:i2,j1:j2,:)
  1417. ! specific humidity
  1418. mixf(region)%f3d(hus)%field = mixf(region)%f3d(hus)%field + dtime * humid_dat(region)%data(i1:i2,j1:j2,:)
  1419. ! air mass (kg -> kg/m2)
  1420. do j = j1, j2
  1421. mixf(region)%f3d(airmass)%field(:,j,:) = mixf(region)%f3d(airmass)%field(:,j,:) + &
  1422. dtime * m_dat(region)%data(i1:i2,j,:) / dxyp(j)
  1423. end do
  1424. ! pressure (already filled above)
  1425. mixf(region)%f3d(pressure)%field = mixf(region)%f3d(pressure)%field + dtime * pres3d
  1426. ! ----------------------
  1427. ! cycle over horizontal domain
  1428. ! ----------------------
  1429. do j = j1, j2
  1430. do i = i1, i2
  1431. ! -----------------------
  1432. ! SURFACE FIELDS
  1433. ! -----------------------
  1434. k = 1
  1435. ! ----------------------
  1436. ! Physical Parameters
  1437. ! ----------------------
  1438. ! surface pressure [Pa]
  1439. mixf(region)%f2d(ps)%field(i,j) = mixf(region)%f2d(ps)%field(i,j) + dtime * sp_dat(region)%data(i,j,k)
  1440. ! precipitation ([m s-1] --> [kg m-2 s-1] with density of water `rol`)
  1441. mixf(region)%f2d(precip)%field(i,j) = mixf(region)%f2d(precip)%field(i,j) + dtime * (cp_dat(region)%data(i,j,k) + lsp_dat(region)%data(i,j,k)) * rol
  1442. ! density for conversion of aerosol mass densities ( ---> 1/m3 )
  1443. ! (conversion factor 1.E-03 is for g --> kg)
  1444. dens = pres3d(i,j,k) / temper_dat(region)%data(i,j,k) * xmair * 1.E-3 / (m_dat(region)%data(i,j,k) * Rgas)
  1445. ! ----------------------
  1446. ! Surface Concentrations in [kg m-3]
  1447. ! ----------------------
  1448. ! POM: (AIS + ACS + COS + AII)
  1449. mixf(region)%f2d(sconcoa)%field(i,j) = mixf(region)%f2d(sconcoa)%field(i,j) + dtime * &
  1450. dens * (rm(i,j,k,iPOMais) + rm(i,j,k,iPOMacs) + rm(i,j,k,iPOMcos) + rm(i,j,k,iPOMaii))
  1451. ! BC: (AIS + ACS + COS + AII)
  1452. mixf(region)%f2d(sconcbc)%field(i,j) = mixf(region)%f2d(sconcbc)%field(i,j) + dtime * &
  1453. dens * (rm(i,j,k,iBCais) + rm(i,j,k,iBCacs) + rm(i,j,k,iBCcos) + rm(i,j,k,iBCaii))
  1454. ! SO4: (NUS + AIS + ACS + COS)
  1455. mixf(region)%f2d(sconcso4)%field(i,j) = mixf(region)%f2d(sconcso4)%field(i,j) + dtime * &
  1456. dens * (rm(i,j,k,iSO4nus) + rm(i,j,k,iSO4ais) + rm(i,j,k,iSO4acs) + rm(i,j,k,iSO4cos))
  1457. ! Dust:
  1458. mixf(region)%f2d(sconcdust)%field(i,j) = mixf(region)%f2d(sconcdust)%field(i,j) + dtime * &
  1459. dens * (rm(i,j,k,iDUacs) + rm(i,j,k,iDUcos) + rm(i,j,k,iDUaci) + rm(i,j,k,iDUcoi))
  1460. ! Seasalt:
  1461. mixf(region)%f2d(sconcss)%field(i,j) = mixf(region)%f2d(sconcss)%field(i,j) + dtime * &
  1462. dens * (rm(i,j,k,iSSacs) + rm(i,j,k,iSScos))
  1463. ! NO3:
  1464. mixf(region)%f2d(sconcno3)%field(i,j) = mixf(region)%f2d(sconcno3)%field(i,j) + dtime * &
  1465. dens * rm(i,j,k,iNO3_a)
  1466. ! NH4:
  1467. mixf(region)%f2d(sconcnh4)%field(i,j) = mixf(region)%f2d(sconcnh4)%field(i,j) + dtime * &
  1468. dens * rm(i,j,k,iNH4)
  1469. ! MSA:
  1470. mixf(region)%f2d(sconcmsa)%field(i,j) = mixf(region)%f2d(sconcmsa)%field(i,j) + dtime * &
  1471. dens * rm(i,j,k,iMSA)
  1472. ! ----------------------
  1473. ! Load in [kg m-2]
  1474. ! ----------------------
  1475. do k = 1, lmr
  1476. ! POM: (AIS + ACS + COS + AII)
  1477. load_tmp = (rm(i,j,k,iPOMais) + rm(i,j,k,iPOMacs) + rm(i,j,k,iPOMcos) + rm(i,j,k,iPOMaii))
  1478. mixf(region)%f2d(loadoa)%field(i,j) = mixf(region)%f2d(loadoa)%field(i,j) + load_tmp * dtime / dxyp(j)
  1479. ! BC: (AIS + ACS + COS + AII)
  1480. load_tmp = (rm(i,j,k,iBCais) + rm(i,j,k,iBCacs) + rm(i,j,k,iBCcos) + rm(i,j,k,iBCaii))
  1481. mixf(region)%f2d(loadbc)%field(i,j) = mixf(region)%f2d(loadbc)%field(i,j) + load_tmp * dtime / dxyp(j)
  1482. ! SO4: (NUS + AIS + ACS + COS)
  1483. load_tmp = (rm(i,j,k,iSO4nus) + rm(i,j,k,iSO4ais) + rm(i,j,k,iSO4acs) + rm(i,j,k,iSO4cos))
  1484. mixf(region)%f2d(loadso4)%field(i,j) = mixf(region)%f2d(loadso4)%field(i,j) + load_tmp * dtime / dxyp(j)
  1485. ! Dust: (ACS + COS + ACI + COI)
  1486. load_tmp = (rm(i,j,k,iDUacs) + rm(i,j,k,iDUcos) + rm(i,j,k,iDUaci) + rm(i,j,k,iDUcoi))
  1487. mixf(region)%f2d(loaddust)%field(i,j) = mixf(region)%f2d(loaddust)%field(i,j) + load_tmp * dtime / dxyp(j)
  1488. ! Seasalt: (ACS + COS)
  1489. load_tmp = (rm(i,j,k,iSSacs) + rm(i,j,k,iSScos))
  1490. mixf(region)%f2d(loadss)%field(i,j) = mixf(region)%f2d(loadss)%field(i,j) + load_tmp * dtime / dxyp(j)
  1491. ! NO3:
  1492. load_tmp = rm(i,j,k,iNO3_a)
  1493. mixf(region)%f2d(loadno3)%field(i,j) = mixf(region)%f2d(loadno3)%field(i,j) + load_tmp * dtime / dxyp(j)
  1494. end do ! k
  1495. end do ! i
  1496. end do ! j
  1497. if (stat_output) then
  1498. ! --------------------------------------
  1499. ! stations
  1500. ! --------------------------------------
  1501. if (stat_halo_glob.eq.1) then
  1502. CALL UPDATE_HALO( dgrid(region), rm, mass_dat(region)%halo, status)
  1503. IF_NOTOK_RETURN(status=1)
  1504. CALL UPDATE_HALO( dgrid(region), m_dat(region)%data, m_dat(region)%halo, status)
  1505. IF_NOTOK_RETURN(status=1)
  1506. CALL UPDATE_HALO( dgrid(region), gph_dat(region)%data, gph_dat(region)%halo, status)
  1507. IF_NOTOK_RETURN(status=1)
  1508. do imode = 1, nsol
  1509. CALL UPDATE_HALO( dgrid(region), h2o_mode(region,imode)%d3, h2o_mode(region,imode)%halo, status)
  1510. IF_NOTOK_RETURN(status=1)
  1511. end do
  1512. CALL UPDATE_HALO( dgrid(region), temper_dat(region)%data(:,:,:), temper_dat(region)%halo, status)
  1513. IF_NOTOK_RETURN(status=1)
  1514. CALL UPDATE_HALO( dgrid(region), humid_dat(region)%data(:,:,:), humid_dat(region)%halo, status)
  1515. IF_NOTOK_RETURN(status=1)
  1516. ! sp_dat has been updated earlier
  1517. CALL UPDATE_HALO( dgrid(region), cp_dat(region)%data(:,:,1), cp_dat(region)%halo, status)
  1518. IF_NOTOK_RETURN(status=1)
  1519. CALL UPDATE_HALO( dgrid(region), lsp_dat(region)%data(:,:,1), lsp_dat(region)%halo, status)
  1520. IF_NOTOK_RETURN(status=1)
  1521. CALL UPDATE_HALO_IBAND ( dgrid(region), dxyp(:), region_dat(region)%halo, status)
  1522. endif
  1523. allocate(volume(i1:ie,j1:je,1:lmr))
  1524. do j = j1, je
  1525. volume(i1:ie,j,1:lmr) = (gph_dat(region)%data(i1:ie,j,2:lmr+1)-gph_dat(region)%data(i1:ie,j,1:lmr)) * dxyp(j)
  1526. end do
  1527. do istat = 1, nstations
  1528. if (stat_active(istat)) then
  1529. ! masses
  1530. do i = 1, 18
  1531. statf(region)%f1d(i)%field(istat,:) = statf(region)%f1d(i)%field(istat,:) + dtime * &
  1532. aerocom_do_interp_1d( rm(i1:ie,j1:je,1:lmr,statf(region)%f1d(i)%mf%itm5) / &
  1533. m_dat(region)%data(i1:ie,j1:je,1:lmr), region, istat )
  1534. statf(region)%f0d(i)%field(istat) = statf(region)%f0d(i)%field(istat) + dtime * &
  1535. aerocom_do_interp_0d( rm(i1:ie,j1:je,1:lmr,statf(region)%f1d(i)%mf%itm5) / &
  1536. m_dat(region)%data(i1:ie,j1:je,1:lmr), region, istat )
  1537. end do
  1538. ! number densities
  1539. do i = 19, 19+nmod-1
  1540. statf(region)%f1d(i)%field(istat,:) = statf(region)%f1d(i)%field(istat,:) + dtime * &
  1541. aerocom_do_interp_1d( rm(i1:ie,j1:je,1:lmr,statf(region)%f1d(i)%mf%itm5) / &
  1542. volume(i1:ie,j1:je,1:lmr), region, istat )
  1543. statf(region)%f0d(i)%field(istat) = statf(region)%f0d(i)%field(istat) + dtime * &
  1544. aerocom_do_interp_0d( rm(i1:ie,j1:je,1:lmr,statf(region)%f1d(i)%mf%itm5) / &
  1545. volume(i1:ie,j1:je,1:lmr), region, istat )
  1546. end do
  1547. ! aerosol water of the wet modes
  1548. do i = 19+nmod, 19+nmod+nsol-1
  1549. statf(region)%f1d(i)%field(istat,:) = statf(region)%f1d(i)%field(istat,:) + dtime * &
  1550. aerocom_do_interp_1d( h2o_mode(region,statf(region)%f1d(i)%mf%itm5)%d3(i1:ie,j1:je,1:lmr) / &
  1551. m_dat(region)%data(i1:ie,j1:je,1:lmr), region, istat )
  1552. statf(region)%f0d(i)%field(istat) = statf(region)%f0d(i)%field(istat) + dtime * &
  1553. aerocom_do_interp_0d( h2o_mode(region,statf(region)%f1d(i)%mf%itm5)%d3(i1:ie,j1:je,1:lmr) / &
  1554. m_dat(region)%data(i1:ie,j1:je,1:lmr), region, istat )
  1555. end do
  1556. ! nitrate, ammonium and MSA
  1557. do i= 19+nmod+nsol,19+nmod+nsol+3-1
  1558. statf(region)%f1d(i)%field(istat,:) = statf(region)%f1d(i)%field(istat,:) + dtime * &
  1559. aerocom_do_interp_1d( rm(i1:ie,j1:je,1:lmr,statf(region)%f1d(i)%mf%itm5) / &
  1560. m_dat(region)%data(i1:ie,j1:je,1:lmr), region, istat )
  1561. statf(region)%f0d(i)%field(istat) = statf(region)%f0d(i)%field(istat) + dtime * &
  1562. aerocom_do_interp_0d( rm(i1:ie,j1:je,1:lmr,statf(region)%f1d(i)%mf%itm5) / &
  1563. m_dat(region)%data(i1:ie,j1:je,1:lmr), region, istat )
  1564. end do
  1565. ! temperature
  1566. i=ntracer_1dstat-nextra_1dstat+1
  1567. statf(region)%f1d(i)%field(istat,:) = statf(region)%f1d(i)%field(istat,:) + dtime * &
  1568. aerocom_do_interp_1d( temper_dat(region)%data(i1:ie,j1:je,:), region, istat )
  1569. statf(region)%f0d(i)%field(istat) = statf(region)%f0d(i)%field(istat) + dtime * &
  1570. aerocom_do_interp_0d( temper_dat(region)%data(i1:ie,j1:je,:), region, istat )
  1571. ! specific humidity
  1572. i=i+1
  1573. statf(region)%f1d(i)%field(istat,:) = statf(region)%f1d(i)%field(istat,:) + dtime * &
  1574. aerocom_do_interp_1d( humid_dat(region)%data(i1:ie,j1:je,:), region, istat )
  1575. statf(region)%f0d(i)%field(istat) = statf(region)%f0d(i)%field(istat) + dtime * &
  1576. aerocom_do_interp_0d( humid_dat(region)%data(i1:ie,j1:je,:), region, istat )
  1577. ! pressure
  1578. i=i+1
  1579. statf(region)%f1d(i)%field(istat,:) = statf(region)%f1d(i)%field(istat,:) + dtime * &
  1580. aerocom_do_interp_1d( pres3d(i1:ie,j1:je,:), region, istat )
  1581. statf(region)%f0d(i)%field(istat) = statf(region)%f0d(i)%field(istat) + dtime * &
  1582. aerocom_do_interp_0d( pres3d(i1:ie,j1:je,:), region, istat )
  1583. ! surface pressure
  1584. i=i+1
  1585. statf(region)%f0d(i)%field(istat) = statf(region)%f0d(i)%field(istat) + dtime * &
  1586. aerocom_do_interp_surf( sp_dat(region)%data(i1:ie,j1:je,1), region, istat )
  1587. ! total precipitation
  1588. i=i+1
  1589. statf(region)%f0d(i)%field(istat) = statf(region)%f0d(i)%field(istat) + dtime * &
  1590. aerocom_do_interp_surf( ( cp_dat(region)%data(i1:ie,j1:je,1) + &
  1591. lsp_dat(region)%data(i1:ie,j1:je,1) ) *rol, region, istat )
  1592. endif
  1593. end do
  1594. deallocate(volume)
  1595. endif
  1596. ! ---------------------
  1597. ! DO OPTICS IN PARALLEL
  1598. ! ---------------------
  1599. ! steps needed for that:
  1600. ! 1) according to the parallelisation there is different container sizes for
  1601. ! the results of the optics; these have to be allocated correctly
  1602. ! (aop_output_ext/a/g/add)
  1603. ! 2) the optics code is called (init/calculate_aop/done), see documentation
  1604. ! in the optics module
  1605. ! 3) the distributed fields (levels/tracers) are reshaped to global fields
  1606. ! (opt_ext/a/g/add), according to parallelisation
  1607. ! 4) fields are communicated such that the result contains the right
  1608. ! total extinctions, albedos, asymmetry factors etc.
  1609. ! 5) post-calculations (AOD etc.) are done and results are written
  1610. ! to mixf%../statf% containers as well as to the AOD dump files
  1611. ! 6) done...
  1612. ! ------------ REMARKS
  1613. ! IMPOSSIBLE / TOO EXPENSIVE (from the AEROCOM list of parameters for QUICKLOOK)
  1614. ! - gf @ 90% RH
  1615. ! - "AOD@550nm SOA", "AOD@550nm BB"
  1616. ! ---------------------------------
  1617. ! fill current M7 state into an appropriate container
  1618. ! and allocate output fields (ext,a,g)
  1619. ! ---------------------------------
  1620. ! ----- A T T E N T I O N ---------
  1621. ! in case for a 'split', we need a field big enough to contain
  1622. ! various contributions
  1623. ! (to be synchronously changed with optics_aop_calculate!!)
  1624. ! ncontr is here number of contributors
  1625. ! Total, SO4, BC, OC, SS, DU, NO3, Water, Fine, Fine Dust, Fine SS
  1626. !ncontr = 10
  1627. ncontr = 11
  1628. ! Additional fields for surface dry aerosol
  1629. ! to be used for validation against in-situ data:
  1630. ! extinction, absorption, asymmetry factor
  1631. ! fine-mode contribution to extinction, absorption
  1632. nadd = 5
  1633. lvec = imr*jmr*lmr
  1634. ! allocate output fields for optics_calculate_aop
  1635. Allocate( aop_output_ext(lvec, size(wdep_out), ncontr ) ) ! extinction
  1636. Allocate( aop_output_a (lvec, size(wdep_out) ) ) ! single scattering albedo
  1637. Allocate( aop_output_g (lvec, size(wdep_out) ) ) ! asymmetry factor
  1638. Allocate( aop_output_add(lvec, size(wdep_out), nadd ) ) ! extinction/absorption due to dry aerosol at surface
  1639. call optics_aop_get(lvec, region, size(wdep_out), wdep_out, ncontr, aop_output_ext, aop_output_a, aop_output_g, &
  1640. status, aop_output_add )
  1641. IF_NOTOK_RETURN(status=1)
  1642. ! allocate here result arrays for ext, abs, ssa, asymmetry parameter, additional parameters (PM10)
  1643. ! ncontr is number of contributors for 'split'
  1644. allocate( opt_ext( i1:i2, j1:j2, lmr, size(wdep_out), ncontr ) ) ; opt_ext = 0.0
  1645. allocate( opt_a ( i1:i2, j1:j2, lmr, size(wdep_out) ) ) ; opt_a = 0.0
  1646. allocate( opt_g ( i1:i2, j1:j2, lmr, size(wdep_out) ) ) ; opt_g = 0.0
  1647. if (stat_output) then
  1648. ! halo cells are needed for interpolation of opt_add
  1649. allocate( opt_add( i1-l_halo:i2+l_halo, j1-l_halo:j2+l_halo, lmr, size(wdep_out), nadd ) ) ; opt_add = 0.0
  1650. else
  1651. allocate( opt_add( i1:i2, j1:j2, lmr, size(wdep_out), nadd ) ) ; opt_add = 0.0
  1652. endif
  1653. ! ---------------------------------
  1654. ! unpack results from calculate_aop
  1655. ! ---------------------------------
  1656. do lwl = 1, size(wdep_out)
  1657. if( wdep_out(lwl)%split ) then
  1658. ! fill the array for the extinction coefficients of contributors
  1659. do lct = 1, ncontr
  1660. opt_ext(:,:,:,lwl,lct) = reshape( aop_output_ext(:,lwl,lct), (/imr,jmr,lmr/) )
  1661. end do
  1662. else
  1663. ! fill only total extinction coefficients
  1664. opt_ext(:,:,:,lwl,1) = reshape( aop_output_ext(:,lwl,1), (/imr,jmr,lmr/) )
  1665. endif
  1666. opt_a(:,:,:,lwl) = reshape( aop_output_a(:,lwl),(/imr,jmr,lmr/) )
  1667. opt_g(:,:,:,lwl) = reshape( aop_output_g(:,lwl),(/imr,jmr,lmr/) )
  1668. if ( wdep_out(lwl)%insitu ) then
  1669. ! additional fields for split
  1670. do lct = 1, nadd
  1671. opt_add(i1:i2,j1:j2,:,lwl,lct) = reshape( aop_output_add(:,lwl,lct),(/imr,jmr,lmr/) )
  1672. end do
  1673. endif
  1674. end do ! lwl
  1675. ! free temporary arrays for results from calculate_aop
  1676. deallocate( aop_output_ext )
  1677. deallocate( aop_output_a )
  1678. deallocate( aop_output_g )
  1679. deallocate( aop_output_add )
  1680. ! the following sections assume that for 550nm there is splitted information
  1681. ! available and that there is *NO* split for other wavelengths!
  1682. if( count( (wdep_out(:)%wl == 0.550) .and. wdep_out(:)%split ) /= 1 ) then
  1683. write(gol,*) 'user_output_aerocom: wrong setup with splitted AOD information.'; call goErr
  1684. TRACEBACK
  1685. status=1; return
  1686. end if
  1687. ! -------------------------------------
  1688. ! here additional calculations and
  1689. ! file writing begin
  1690. ! -------------------------------------
  1691. ! cycle over wavelengths
  1692. do lwl = 1, size(wdep_out)
  1693. if( wdep_out(lwl)%split ) then
  1694. ! for 550nm:
  1695. ! 1) AODs (35 - 44)
  1696. ! fill for contributors (total, SO4, BC, POM, SS, DU, NO3, H2O, fine, fine dust, fine SS)
  1697. ! 2) Absorption for 550nm (45)
  1698. ! Extinction is here the sum of scattering and absorption and
  1699. ! the scattering part is given by the albedo (SSA). Thus the
  1700. ! remainder is absorption: Abs = Ext * (1 - SSA)
  1701. indoffset = od550aer
  1702. allocate(temp2d(i1:i2,j1:j2))
  1703. do lct = 1, ncontr
  1704. temp2d = 0.0
  1705. do j = j1, j2
  1706. do i = i1, i2
  1707. ! multiply with height elements and sum up
  1708. tabs = 0.0
  1709. do l = 1, lmr
  1710. temp2d(i,j) = temp2d(i,j) + opt_ext(i,j,l,lwl,lct) * &
  1711. (gph_dat(region)%data(i,j,l+1) - &
  1712. gph_dat(region)%data(i,j,l ))
  1713. if( lct == 1 ) then
  1714. ! Absorption: do this only once for the totals
  1715. tabs = tabs + opt_ext(i,j,l,lwl,lct) * (1.0 - opt_a(i,j,l,lwl)) * &
  1716. (gph_dat(region)%data(i,j,l+1) - gph_dat(region)%data(i,j,l))
  1717. end if
  1718. end do
  1719. ! Absorption: do this only once for the totals
  1720. if( lct == 1 ) then
  1721. mixf(region)%f2d(abs550aer)%field(i,j) = &
  1722. mixf(region)%f2d(abs550aer)%field(i,j) + tabs * dtime
  1723. end if
  1724. end do
  1725. end do
  1726. ! this here is AODs for different contributors, splitted by volumes
  1727. mixf(region)%f2d(indoffset+lct-1)%field = &
  1728. mixf(region)%f2d(indoffset+lct-1)%field + temp2d * dtime
  1729. end do
  1730. deallocate( temp2d )
  1731. ! Asymmetry Parameter, weighted by AOD and single scattering albedo at each layer
  1732. allocate(temp2d(i1:i2,j1:j2)) ; temp2d = 0.0
  1733. do j = j1, j2
  1734. do i = i1, i2
  1735. wght = 0.0
  1736. do l = 1, lmr
  1737. dwght = opt_ext(i,j,l,lwl,1) * (gph_dat(region)%data(i,j,l+1) - gph_dat(region)%data(i,j,l )) * opt_a(i,j,l,lwl)
  1738. temp2d(i,j) = temp2d(i,j) + opt_g(i,j,l,lwl) * dwght
  1739. wght = wght + dwght
  1740. end do
  1741. temp2d(i,j) = temp2d(i,j) / wght
  1742. end do
  1743. end do
  1744. mixf(region)%f2d(asyaer)%field = mixf(region)%f2d(asyaer)%field + temp2d * dtime
  1745. deallocate(temp2d)
  1746. ! Surface Ambient Aerosol Extinction
  1747. mixf(region)%f2d(ec550aer)%field = &
  1748. mixf(region)%f2d(ec550aer)%field + opt_ext(:,:,1,lwl,1) * dtime
  1749. else
  1750. ! for 440/870/350 nm:
  1751. ! 1) fill total AOD and AAOD and write to containers
  1752. ! 2) dump AOD fields
  1753. if ( wdep_out(lwl)%wl == 0.440 ) then
  1754. indoffset = od440aer
  1755. indabs = abs440aer
  1756. elseif ( wdep_out(lwl)%wl == 0.550 ) then
  1757. indoffset = od550aer
  1758. indabs = abs550aer
  1759. elseif ( wdep_out(lwl)%wl == 0.870 ) then
  1760. indoffset = od870aer
  1761. indabs = abs870aer
  1762. elseif ( wdep_out(lwl)%wl == 0.350 ) then
  1763. indoffset = od350aer
  1764. indabs = abs350aer
  1765. else
  1766. write(gol,*) 'user_output_aerocom: wrong wavelength given for aerocom diagnostics' ; call goErr
  1767. TRACEBACK
  1768. status=1; return
  1769. end if
  1770. ! fill AODs
  1771. allocate(temp2d(i1:i2,j1:j2))
  1772. temp2d = 0.0
  1773. do j = j1, j2
  1774. do i = i1, i2
  1775. ! multiply with height elements and sum up
  1776. tabs = 0.0
  1777. do l = 1, lmr
  1778. temp2d(i,j) = temp2d(i,j) + opt_ext(i,j,l,lwl,1) * &
  1779. (gph_dat(region)%data(i,j,l+1) - &
  1780. gph_dat(region)%data(i,j,l ))
  1781. tabs = tabs + opt_ext(i,j,l,lwl,1) * (1.0 - opt_a(i,j,l,lwl)) * &
  1782. (gph_dat(region)%data(i,j,l+1) - gph_dat(region)%data(i,j,l))
  1783. end do
  1784. mixf(region)%f2d(indabs)%field(i,j) = &
  1785. mixf(region)%f2d(indabs)%field(i,j) + tabs * dtime
  1786. end do
  1787. end do
  1788. ! write to container
  1789. mixf(region)%f2d(indoffset)%field = &
  1790. mixf(region)%f2d(indoffset)%field + temp2d * dtime
  1791. deallocate(temp2d)
  1792. endif
  1793. ! 3-D extinction and absorption (m-1)
  1794. if ( aai_output ) then
  1795. if ( wdep_out(lwl)%wl == 0.550 .or. wdep_out(lwl)%wl == 0.350 ) then
  1796. if ( wdep_out(lwl)%wl == 0.550 ) then
  1797. indoffset = ec5503Daer
  1798. elseif ( wdep_out(lwl)%wl == 0.350 ) then
  1799. indoffset = ec3503Daer
  1800. endif
  1801. mixf(region)%f3d(indoffset)%field = &
  1802. mixf(region)%f3d(indoffset)%field + opt_ext(:,:,:,lwl,1) * dtime
  1803. mixf(region)%f3d(indoffset+1)%field = &
  1804. mixf(region)%f3d(indoffset+1)%field + opt_ext(:,:,:,lwl,1) * (1.0 - opt_a(:,:,:,lwl)) * dtime
  1805. endif
  1806. endif
  1807. if ( wdep_out(lwl)%insitu ) then
  1808. if ( wdep_out(lwl)%wl == 0.440 ) then
  1809. indoffset = ec440dryaer
  1810. indoffset_stat = ec440dryaer_stat
  1811. nadd_max=2
  1812. elseif ( wdep_out(lwl)%wl == 0.550 ) then
  1813. indoffset = ec550dryaer
  1814. indoffset_stat = ec550dryaer_stat
  1815. nadd_max=5
  1816. elseif ( wdep_out(lwl)%wl == 0.870 ) then
  1817. indoffset = ec870dryaer
  1818. indoffset_stat = ec870dryaer_stat
  1819. nadd_max=2
  1820. else
  1821. write(gol,*) 'user_output_aerocom: wrong wavelength given for aerocom diagnostics' ; call goErr
  1822. TRACEBACK
  1823. status=1; return
  1824. end if
  1825. ! Surface dry aerosol extinction & absorption
  1826. do lct = 1, nadd_max
  1827. mixf(region)%f2d(indoffset+lct-1)%field = mixf(region)%f2d(indoffset+lct-1)%field + &
  1828. opt_add(i1:i2,j1:j2,1,lwl,lct) * dtime
  1829. enddo
  1830. if (stat_output) then
  1831. ! --------------------------------------
  1832. ! stations
  1833. ! --------------------------------------
  1834. if (stat_halo_glob.eq.1) then
  1835. do lct = 1, nadd_max
  1836. CALL UPDATE_HALO( dgrid(region), opt_add(:,:,:,lwl,lct), l_halo, status)
  1837. IF_NOTOK_RETURN(status=1)
  1838. enddo
  1839. endif
  1840. do istat = 1, nstations
  1841. if (stat_active(istat)) then
  1842. do lct = 1, nadd_max
  1843. statf(region)%f1d(indoffset_stat+lct-1)%field(istat,:) = &
  1844. statf(region)%f1d(indoffset_stat+lct-1)%field(istat,:) + &
  1845. aerocom_do_interp_1d( opt_add(i1:ie,j1:je,:,lwl,lct), region, istat ) * dtime
  1846. statf(region)%f0d(indoffset_stat+lct-1)%field(istat) = &
  1847. statf(region)%f0d(indoffset_stat+lct-1)%field(istat) + &
  1848. aerocom_do_interp_0d( opt_add(i1:ie,j1:je,:,lwl,lct), region, istat ) * dtime
  1849. enddo
  1850. endif
  1851. end do
  1852. endif
  1853. endif
  1854. end do
  1855. ! done
  1856. deallocate( opt_ext, opt_a, opt_g, opt_add )
  1857. nullify(rm)
  1858. nullify(dxyp)
  1859. deallocate( pres3d )
  1860. call goLabel() ; status = 0
  1861. end subroutine output_aerocom_step
  1862. !EOC
  1863. !--------------------------------------------------------------------------
  1864. ! TM5 !
  1865. !--------------------------------------------------------------------------
  1866. !BOP
  1867. !
  1868. ! !IROUTINE: COLLECT_BUDGETS
  1869. !
  1870. ! !DESCRIPTION: This routine does book keeping of the budget values in
  1871. ! order to extract daily contributions to
  1872. ! emissions / dry deposition / wet deposition.
  1873. !\\
  1874. !\\
  1875. ! !INTERFACE:
  1876. !
  1877. subroutine collect_budgets(region, status)
  1878. !
  1879. ! !USES:
  1880. !
  1881. #ifndef without_chemistry
  1882. use ebischeme, only : buddry_dat => buddep_dat
  1883. #endif
  1884. use wet_deposition, only : buddep_dat
  1885. use emission_data, only : budemi_dat
  1886. use budget_global, only : nbud_vg
  1887. use global_data, only : region_dat
  1888. use chem_param, only : iducoi, iduacs, iducos, iduaci, isscos, issacs
  1889. use chem_param, only : ibccos, ibcaii, ibcacs, ibcais, ino3_a, xmair
  1890. use chem_param, only : iso4nus, iso4acs, iso4cos, iso4ais
  1891. use chem_param, only : ipomcos, ipomaii, ipomacs, ipomais
  1892. use chem_param, only : idms, iso2, ntracet, ntrace
  1893. use chem_param, only : xmso2, xmso4, xmdms, xmpom, xmbc, xmdust, xmnacl
  1894. #ifndef without_sedimentation
  1895. use sedimentation, only : buddep_m7_dat
  1896. use sedimentation, only : nsed, ised
  1897. #endif
  1898. !
  1899. ! !INPUT PARAMETERS:
  1900. !
  1901. integer, intent(in) :: region
  1902. !
  1903. ! !OUTPUT PARAMETERS:
  1904. !
  1905. integer, intent(out) :: status
  1906. !
  1907. ! !REVISION HISTORY:
  1908. ! 29 Nov 2010 - Achim Strunk -
  1909. !
  1910. ! !REMARKS:
  1911. !
  1912. !EOP
  1913. !------------------------------------------------------------------------
  1914. !BOC
  1915. character(len=*), parameter :: rname = mname//'/collect_budgets'
  1916. real, dimension(:,:,:,:), allocatable :: collect4d
  1917. real, dimension(:,:,:), allocatable :: collect3d
  1918. real, dimension(:,:), allocatable :: tmpbud2d
  1919. real, dimension(:), pointer :: dxyp
  1920. integer :: imr, jmr, lmr, j
  1921. integer :: i1, i2, j1, j2
  1922. !>>> TvN
  1923. integer :: l, n
  1924. !<<< TvN
  1925. ! --- begin -------------------------------
  1926. call goLabel(rname)
  1927. ! grid size
  1928. call Get_DistGrid( dgrid(region), I_STRT=i1, I_STOP=i2, J_STRT=j1, J_STOP=j2 )
  1929. imr=i2-i1+1
  1930. jmr=j2-j1+1
  1931. lmr = levi%nlev
  1932. ! this is area element
  1933. dxyp => region_dat(region)%dxyp
  1934. ! --------------
  1935. ! EMISSIONS
  1936. ! --------------
  1937. ! collect emission budget
  1938. allocate( collect4d(i1:i2,j1:j2,nbud_vg,ntracet) ); collect4d = 0.0
  1939. ! emissions are in [mole]
  1940. ! convert first to kilomole per area [k-mole/m2]
  1941. #ifndef without_emission
  1942. do j = j1, j2
  1943. collect4d(:,j,:,:) = budemi_dat(region)%emi(i1:i2,j,:,:) / dxyp(j) * 1.E-03
  1944. end do
  1945. #endif
  1946. allocate( tmpbud2d(i1:i2,j1:j2) )
  1947. ! on the way: convert from kilomole/m2 to kg/m2 via molar mass [g/mole]
  1948. ! POM (AIS + ACS + COS + AII)
  1949. tmpbud2d = ( sum(collect4d(:,:,:,iPOMais),3) + sum(collect4d(:,:,:,iPOMacs),3) + &
  1950. sum(collect4d(:,:,:,iPOMcos),3) + sum(collect4d(:,:,:,iPOMaii),3) ) * xmpom
  1951. mixf(region)%f2d(emioa)%field = tmpbud2d - emission(region)%f2dslast(:,:,1)
  1952. emission(region)%f2dslast(:,:,1) = tmpbud2d
  1953. ! BC (AIS + ACS + COS + AII)
  1954. tmpbud2d = ( sum(collect4d(:,:,:,iBCais ),3) + sum(collect4d(:,:,:,iBCacs ),3) + &
  1955. sum(collect4d(:,:,:,iBCcos ),3) + sum(collect4d(:,:,:,iBCaii ),3) ) * xmbc
  1956. mixf(region)%f2d(emibc)%field = tmpbud2d - emission(region)%f2dslast(:,:,2)
  1957. emission(region)%f2dslast(:,:,2) = tmpbud2d
  1958. ! SO2
  1959. tmpbud2d = sum(collect4d(:,:,:,iSO2 ),3) * xmso2
  1960. mixf(region)%f2d(emiso2)%field = tmpbud2d - emission(region)%f2dslast(:,:,3)
  1961. emission(region)%f2dslast(:,:,3) = tmpbud2d
  1962. ! SO4 (NUS + AIS + ACS + COS)
  1963. tmpbud2d = ( sum(collect4d(:,:,:,iSO4nus),3) + sum(collect4d(:,:,:,iSO4ais),3) + &
  1964. sum(collect4d(:,:,:,iSO4acs),3) + sum(collect4d(:,:,:,iSO4cos),3) ) * xmso4
  1965. mixf(region)%f2d(emiso4)%field = tmpbud2d - emission(region)%f2dslast(:,:,4)
  1966. emission(region)%f2dslast(:,:,4) = tmpbud2d
  1967. ! Dust (ACS + COS + ACI + COI)
  1968. tmpbud2d = ( sum(collect4d(:,:,:,iDUacs ),3) + sum(collect4d(:,:,:,iDUcos ),3) + &
  1969. sum(collect4d(:,:,:,iDUaci ),3) + sum(collect4d(:,:,:,iDUcoi ),3) ) * xmdust
  1970. mixf(region)%f2d(emidust)%field = tmpbud2d - emission(region)%f2dslast(:,:,5)
  1971. emission(region)%f2dslast(:,:,5) = tmpbud2d
  1972. ! DMS
  1973. tmpbud2d = sum(collect4d(:,:,:,iDMS ),3) * xmdms
  1974. mixf(region)%f2d(emidms)%field = tmpbud2d - emission(region)%f2dslast(:,:,6)
  1975. emission(region)%f2dslast(:,:,6) = tmpbud2d
  1976. ! Seasalt: (ACS + COS)
  1977. tmpbud2d = ( sum(collect4d(:,:,:,iSSacs ),3) + sum(collect4d(:,:,:,iSScos ),3) ) * xmnacl
  1978. mixf(region)%f2d(emiss)%field = tmpbud2d - emission(region)%f2dslast(:,:,7)
  1979. emission(region)%f2dslast(:,:,7) = tmpbud2d
  1980. deallocate( tmpbud2d )
  1981. deallocate( collect4d )
  1982. ! --------------
  1983. ! DRY DEPOSITION
  1984. ! --------------
  1985. allocate( collect3d(i1:i2,j1:j2,ntrace) ); collect3d = 0.0
  1986. ! deposition is in [mole]
  1987. ! convert first to kilomole per area [k-mole/m2]
  1988. do j = j1, j2
  1989. #ifndef without_chemistry
  1990. collect3d(:,j,:) = buddry_dat(region)%dry(i1:i2,j,:) / dxyp(j) * 1.E-3
  1991. #endif
  1992. ! Add sedimentation at the surface to dry depostion
  1993. ! Sedimentation budgets have to be summed in the vertical
  1994. ! to get the surface contribution.
  1995. #ifndef without_sedimentation
  1996. do l = 1, nbud_vg
  1997. do n = 1, nsed
  1998. collect3d(:,j,ised(n)) = collect3d(:,j,ised(n)) + &
  1999. buddep_m7_dat(region)%sed(i1:i2,j,l,n) / dxyp(j) * 1.E-3
  2000. end do
  2001. end do
  2002. #endif
  2003. end do
  2004. allocate( tmpbud2d(i1:i2,j1:j2) )
  2005. ! on the way: convert from kilomole/m2 to kg/m2 via molar mass [g/mole]
  2006. ! SO2
  2007. tmpbud2d = collect3d(:,:,iSO2) * xmso2
  2008. mixf(region)%f2d(dryso2)%field = tmpbud2d - drydepos(region)%f2dslast(:,:,1)
  2009. drydepos(region)%f2dslast(:,:,1) = tmpbud2d
  2010. ! POM (AIS + ACS + COS + AII)
  2011. tmpbud2d = ( collect3d(:,:,iPOMais ) + collect3d(:,:,iPOMacs ) + &
  2012. collect3d(:,:,iPOMcos ) + collect3d(:,:,iPOMaii ) ) * xmpom
  2013. mixf(region)%f2d(dryoa)%field = tmpbud2d - drydepos(region)%f2dslast(:,:,2)
  2014. drydepos(region)%f2dslast(:,:,2) = tmpbud2d
  2015. ! BC (AIS + ACS + COS + AII)
  2016. tmpbud2d = ( collect3d(:,:,iBCais ) + collect3d(:,:,iBCacs ) + &
  2017. collect3d(:,:,iBCcos ) + collect3d(:,:,iBCaii ) ) * xmbc
  2018. mixf(region)%f2d(drybc)%field = tmpbud2d - drydepos(region)%f2dslast(:,:,3)
  2019. drydepos(region)%f2dslast(:,:,3) = tmpbud2d
  2020. ! SO4 (NUS + AIS + ACS + COS)
  2021. tmpbud2d = ( collect3d(:,:,iSO4nus) + collect3d(:,:,iSO4ais) + &
  2022. collect3d(:,:,iSO4acs) + collect3d(:,:,iSO4cos) ) * xmso4
  2023. mixf(region)%f2d(dryso4)%field = tmpbud2d - drydepos(region)%f2dslast(:,:,4)
  2024. drydepos(region)%f2dslast(:,:,4) = tmpbud2d
  2025. ! Dust (ACS + COS + ACI + COI)
  2026. tmpbud2d = ( collect3d(:,:,iDUacs) + collect3d(:,:,iDUcos) + &
  2027. collect3d(:,:,iDUaci) + collect3d(:,:,iDUcoi) ) * xmdust
  2028. mixf(region)%f2d(drydust)%field = tmpbud2d - drydepos(region)%f2dslast(:,:,5)
  2029. drydepos(region)%f2dslast(:,:,5) = tmpbud2d
  2030. ! DMS
  2031. ! DMS is NOT deposited in TM5 --> the fields will contain zeros
  2032. tmpbud2d = collect3d(:,:,iDMS) * xmdms
  2033. mixf(region)%f2d(drydms)%field = tmpbud2d - drydepos(region)%f2dslast(:,:,6)
  2034. drydepos(region)%f2dslast(:,:,6) = tmpbud2d
  2035. ! Seasalt: (ACS + COS)
  2036. tmpbud2d = ( collect3d(:,:,iSSacs) + collect3d(:,:,iSScos) ) * xmnacl
  2037. mixf(region)%f2d(dryss)%field = tmpbud2d - drydepos(region)%f2dslast(:,:,7)
  2038. drydepos(region)%f2dslast(:,:,7) = tmpbud2d
  2039. deallocate( tmpbud2d )
  2040. deallocate( collect3d )
  2041. ! --------------
  2042. ! WET DEPOSITION
  2043. ! --------------
  2044. allocate( collect4d (i1:i2,j1:j2,nbud_vg,ntracet) ); collect4d = 0.0
  2045. ! deposition is in [mole]
  2046. ! convert first to kilomole per area [k-mole/m2]
  2047. do j = j1, j2
  2048. collect4d(:,j,:,:) = ( buddep_dat(region)%lsp(i1:i2,j,:,:) + buddep_dat(region)%cp(i1:i2,j,:,:) ) / dxyp(j) * 1.E-3
  2049. end do
  2050. allocate( tmpbud2d(i1:i2,j1:j2) )
  2051. ! on the way: convert from kilomole/m2 to kg/m2 via molar mass [g/mole]
  2052. ! POM (AIS + ACS + COS + AII)
  2053. tmpbud2d = ( sum(collect4d(:,:,:,iPOMais),3) + sum(collect4d(:,:,:,iPOMacs),3) + &
  2054. sum(collect4d(:,:,:,iPOMcos),3) + sum(collect4d(:,:,:,iPOMaii),3) ) * xmpom
  2055. mixf(region)%f2d(wetoa)%field = tmpbud2d - wetdepos(region)%f2dslast(:,:,1)
  2056. wetdepos(region)%f2dslast(:,:,1) = tmpbud2d
  2057. ! BC (AIS + ACS + COS + AII)
  2058. tmpbud2d = ( sum(collect4d(:,:,:,iBCais ),3) + sum(collect4d(:,:,:,iBCacs ),3) + &
  2059. sum(collect4d(:,:,:,iBCcos ),3) + sum(collect4d(:,:,:,iBCaii ),3) ) * xmbc
  2060. mixf(region)%f2d(wetbc)%field = tmpbud2d - wetdepos(region)%f2dslast(:,:,2)
  2061. wetdepos(region)%f2dslast(:,:,2) = tmpbud2d
  2062. ! SO2
  2063. tmpbud2d = sum(collect4d(:,:,:,iSO2 ),3) * xmso2
  2064. mixf(region)%f2d(wetso2)%field = tmpbud2d - wetdepos(region)%f2dslast(:,:,3)
  2065. wetdepos(region)%f2dslast(:,:,3) = tmpbud2d
  2066. ! SO4 (NUS + AIS + ACS + COS)
  2067. tmpbud2d = ( sum(collect4d(:,:,:,iSO4nus),3) + sum(collect4d(:,:,:,iSO4ais),3) + &
  2068. sum(collect4d(:,:,:,iSO4acs),3) + sum(collect4d(:,:,:,iSO4cos),3) ) * xmso4
  2069. mixf(region)%f2d(wetso4)%field = tmpbud2d - wetdepos(region)%f2dslast(:,:,4)
  2070. wetdepos(region)%f2dslast(:,:,4) = tmpbud2d
  2071. ! Dust (ACS + COS + ACI + COI)
  2072. tmpbud2d = ( sum(collect4d(:,:,:,iDUacs ),3) + sum(collect4d(:,:,:,iDUcos ),3) + &
  2073. sum(collect4d(:,:,:,iDUaci ),3) + sum(collect4d(:,:,:,iDUcoi ),3) ) * xmdust
  2074. mixf(region)%f2d(wetdust)%field = tmpbud2d - wetdepos(region)%f2dslast(:,:,5)
  2075. wetdepos(region)%f2dslast(:,:,5) = tmpbud2d
  2076. ! DMS
  2077. ! DMS is NOT deposited in TM5 --> the fields will contain zeros
  2078. tmpbud2d = sum(collect4d(:,:,:,iDMS ),3) * xmdms
  2079. mixf(region)%f2d(wetdms)%field = tmpbud2d - wetdepos(region)%f2dslast(:,:,6)
  2080. wetdepos(region)%f2dslast(:,:,6) = tmpbud2d
  2081. ! Seasalt: (ACS + COS)
  2082. tmpbud2d = ( sum(collect4d(:,:,:,iSSacs ),3) + sum(collect4d(:,:,:,iSScos ),3) ) * xmnacl
  2083. mixf(region)%f2d(wetss)%field = tmpbud2d - wetdepos(region)%f2dslast(:,:,7)
  2084. wetdepos(region)%f2dslast(:,:,7) = tmpbud2d
  2085. deallocate( tmpbud2d )
  2086. deallocate( collect4d )
  2087. nullify(dxyp)
  2088. call goLabel() ; status = 0
  2089. end subroutine collect_budgets
  2090. !EOC
  2091. !--------------------------------------------------------------------------
  2092. ! TM5 !
  2093. !--------------------------------------------------------------------------
  2094. !BOP
  2095. !
  2096. ! !IROUTINE: AEROCOM_GET_STATINTP
  2097. !
  2098. ! !DESCRIPTION: This routine provides interpolation coefficients to
  2099. ! (yet another) interpolation routine for the stations.
  2100. ! The interpolation routine is below ( aerocom_do_interp ).
  2101. !\\
  2102. ! !INTERFACE:
  2103. !
  2104. subroutine aerocom_get_statintp( region, status )
  2105. !
  2106. ! !USES:
  2107. !
  2108. use dims, only : dy, dx, yref, xref, xbeg, xend, ybeg, yend, xcyc
  2109. use dims, only : im, jm, lm
  2110. use Meteodata, only : gph_dat
  2111. use partools, only : par_reduce
  2112. !
  2113. ! !INPUT PARAMETERS:
  2114. !
  2115. integer, intent(in) :: region
  2116. !
  2117. ! !OUTPUT PARAMETERS:
  2118. !
  2119. integer, intent(out) :: status
  2120. !
  2121. ! !REVISION HISTORY:
  2122. ! 29 Nov 2010 - Achim Strunk - Creation
  2123. !
  2124. ! !REMARKS:
  2125. !
  2126. !EOP
  2127. !------------------------------------------------------------------------
  2128. !BOC
  2129. character(len=*), parameter :: rname = mname//'/aerocom_get_statintp'
  2130. real :: rt, sheight, dxr, dyr
  2131. real, dimension(0:lm(region)) :: gheight
  2132. integer :: i, l
  2133. integer :: i1, i2, j1, j2
  2134. ! --- begin -------------------------------
  2135. call goLabel(rname)
  2136. call Get_DistGrid( dgrid(region), I_STRT=i1, I_STOP=i2, J_STRT=j1, J_STOP=j2 )
  2137. dyr = dy/yref(region)
  2138. dxr = dx/xref(region)
  2139. do i = 1, nstations
  2140. ! i-coordinates and weights
  2141. rt = (statlist(i)%statlon - float(xbeg(region)))/dxr + 0.5
  2142. sintp(region)%ixl(i) = int(rt)
  2143. sintp(region)%wixr(i) = rt - sintp(region)%ixl(i)
  2144. sintp(region)%wixl(i) = 1.0 - sintp(region)%wixr(i)
  2145. if ( sintp(region)%ixl(i) == 0 ) then
  2146. sintp(region)%ixl(i) = im(region)
  2147. endif
  2148. sintp(region)%ixr(i) = sintp(region)%ixl(i) + 1
  2149. ! j-coordinates and weights
  2150. rt = (statlist(i)%statlat - float(ybeg(region)))/dyr + 0.5
  2151. sintp(region)%jyl(i) = int(rt)
  2152. sintp(region)%jyr(i) = sintp(region)%jyl(i) + 1
  2153. sintp(region)%wjyr(i) = rt - sintp(region)%jyl(i)
  2154. sintp(region)%wjyl(i) = 1.0 - sintp(region)%wjyr(i)
  2155. if ( sintp(region)%jyl(i) == 0 ) sintp(region)%jyl(i) = 1
  2156. if ( sintp(region)%jyr(i) == jm(region)+1 ) sintp(region)%jyr(i) = jm(region)
  2157. ! check if left/lower cell of interpolation calculation is in the processor domain
  2158. ! ensures that each station is handled by a single processor
  2159. if ( (sintp(region)%ixl(i).ge.i1).and.(sintp(region)%ixl(i).le.i2).and. &
  2160. (sintp(region)%jyl(i).ge.j1).and.(sintp(region)%jyl(i).le.j2) ) then
  2161. stat_active(i)=.true.
  2162. if ( (sintp(region)%ixr(i).eq.i2+1).or.(sintp(region)%jyr(i).eq.j2+1) ) then
  2163. stat_halo_loc=1
  2164. endif
  2165. endif
  2166. enddo
  2167. call PAR_REDUCE( stat_halo_loc, 'max', stat_halo_glob, status, all=.true.)
  2168. if (stat_halo_glob.eq.1) then
  2169. CALL UPDATE_HALO( dgrid(region), gph_dat(region)%data, gph_dat(region)%halo, status)
  2170. IF_NOTOK_RETURN(status=1)
  2171. endif
  2172. do i = 1, nstations
  2173. if ( stat_active(i) ) then
  2174. ! --------
  2175. ! interpolate gph to station, use half level (center of box) & surface
  2176. ! gph is from 1 -> lm(region)+1
  2177. ! --------
  2178. gheight(0) = sintp(region)%wixl(i) * sintp(region)%wjyl(i) * gph_dat(region)%data(sintp(region)%ixl(i),sintp(region)%jyl(i),1) + &
  2179. sintp(region)%wixr(i) * sintp(region)%wjyl(i) * gph_dat(region)%data(sintp(region)%ixr(i),sintp(region)%jyl(i),1) + &
  2180. sintp(region)%wixr(i) * sintp(region)%wjyr(i) * gph_dat(region)%data(sintp(region)%ixr(i),sintp(region)%jyr(i),1) + &
  2181. sintp(region)%wixl(i) * sintp(region)%wjyr(i) * gph_dat(region)%data(sintp(region)%ixl(i),sintp(region)%jyr(i),1)
  2182. do l = 1, lm(region)
  2183. gheight(l) = sintp(region)%wixl(i) * sintp(region)%wjyl(i) * sum(gph_dat(region)%data(sintp(region)%ixl(i),sintp(region)%jyl(i),l:l+1))/2. + &
  2184. sintp(region)%wixr(i) * sintp(region)%wjyl(i) * sum(gph_dat(region)%data(sintp(region)%ixr(i),sintp(region)%jyl(i),l:l+1))/2. + &
  2185. sintp(region)%wixr(i) * sintp(region)%wjyr(i) * sum(gph_dat(region)%data(sintp(region)%ixr(i),sintp(region)%jyr(i),l:l+1))/2. + &
  2186. sintp(region)%wixl(i) * sintp(region)%wjyr(i) * sum(gph_dat(region)%data(sintp(region)%ixl(i),sintp(region)%jyr(i),l:l+1))/2.
  2187. end do
  2188. sintp(region)%tght(i) = gheight(0)
  2189. ! --------
  2190. ! determine layer of station
  2191. ! --------
  2192. ! copy temporary the height of station
  2193. sheight = statlist(i)%statalt
  2194. ! do not allow sampleheight below model surface
  2195. ! -> force station height to model surface
  2196. sheight = max(sheight, gheight(0))
  2197. do l = 1, lm(region)
  2198. if( gheight(l) > sheight ) exit
  2199. end do
  2200. ! success??
  2201. if( l > lm(region) ) then
  2202. ! not successful, station higher than model (strange!!!)
  2203. write(gol,'("Error in retrieving vertical layer of station")'); call goErr
  2204. TRACEBACK
  2205. status=1
  2206. return
  2207. endif
  2208. ! restrict lower index to surface
  2209. sintp(region)%lzl(i) = max(l-1,1)
  2210. sintp(region)%lzr(i) = l
  2211. sintp(region)%wlzl(i) = (gheight(l) - sheight) / (gheight(l) - gheight(l-1))
  2212. sintp(region)%wlzr(i) = 1.0 - sintp(region)%wlzl(i)
  2213. endif
  2214. end do
  2215. call goLabel() ; status = 0
  2216. end subroutine aerocom_get_statintp
  2217. !EOC
  2218. !--------------------------------------------------------------------------
  2219. ! TM5 !
  2220. !--------------------------------------------------------------------------
  2221. !BOP
  2222. !
  2223. ! !FUNCTION: AEROCOM_DO_INTERP_1D
  2224. !
  2225. ! !DESCRIPTION: Interpolation of a given 3d field, using module wide
  2226. ! interpolation coeffients and indices for stations (sintp).
  2227. !\\
  2228. !\\
  2229. ! !INTERFACE:
  2230. !
  2231. function aerocom_do_interp_1d( f3d, region, istat )
  2232. !
  2233. ! !INPUT PARAMETERS:
  2234. !
  2235. real, dimension(:,:,:), intent(in) :: f3d
  2236. integer, intent(in) :: region
  2237. integer, intent(in) :: istat
  2238. !
  2239. ! !RETURN VALUE:
  2240. !
  2241. real,dimension (levi%nlev) :: aerocom_do_interp_1d
  2242. !
  2243. ! !REVISION HISTORY:
  2244. ! 6 Feb 2011 - Achim Strunk -
  2245. !
  2246. ! !REMARKS:
  2247. !
  2248. !EOP
  2249. !------------------------------------------------------------------------
  2250. !BOC
  2251. character(len=*), parameter :: rname = mname//'/aerocom_do_interp_1d'
  2252. integer :: i
  2253. integer :: i1, i2, j1, j2
  2254. integer :: il,ir,jl,jr
  2255. ! --- begin -------------------------------
  2256. call Get_DistGrid( dgrid(region), I_STRT=i1, I_STOP=i2, J_STRT=j1, J_STOP=j2 )
  2257. i = istat
  2258. ! shift index in the input array
  2259. il=sintp(region)%ixl(i) - i1 + 1
  2260. ir=sintp(region)%ixr(i) - i1 + 1
  2261. jl=sintp(region)%jyl(i) - j1 + 1
  2262. jr=sintp(region)%jyr(i) - j1 + 1
  2263. ! ordering
  2264. ! i = llllrrrr, j = llrrllrr
  2265. aerocom_do_interp_1d(:) = &
  2266. sintp(region)%wixl(i) * sintp(region)%wjyl(i) * f3d(il,jl,:) + &
  2267. sintp(region)%wixl(i) * sintp(region)%wjyr(i) * f3d(il,jr,:) + &
  2268. sintp(region)%wixr(i) * sintp(region)%wjyl(i) * f3d(ir,jl,:) + &
  2269. sintp(region)%wixr(i) * sintp(region)%wjyr(i) * f3d(ir,jr,:)
  2270. return
  2271. end function aerocom_do_interp_1d
  2272. !EOC
  2273. !--------------------------------------------------------------------------
  2274. ! TM5 !
  2275. !--------------------------------------------------------------------------
  2276. !BOP
  2277. !
  2278. ! !FUNCTION: AEROCOM_DO_INTERP_0D
  2279. !
  2280. ! !DESCRIPTION: Interpolation of a given 3d field, using module wide
  2281. ! interpolation coeffients and indices for stations (sintp).
  2282. !\\
  2283. !\\
  2284. ! !INTERFACE:
  2285. !
  2286. function aerocom_do_interp_0d( f3d, region, istat )
  2287. !
  2288. ! !INPUT PARAMETERS:
  2289. !
  2290. real, dimension(:,:,:), intent(in) :: f3d
  2291. integer, intent(in) :: region
  2292. integer, intent(in) :: istat
  2293. !
  2294. ! !RETURN VALUE:
  2295. !
  2296. real :: aerocom_do_interp_0d
  2297. !
  2298. ! !REVISION HISTORY:
  2299. ! 6 Feb 2011 - Achim Strunk -
  2300. !
  2301. ! !REMARKS:
  2302. !
  2303. !EOP
  2304. !------------------------------------------------------------------------
  2305. !BOC
  2306. character(len=*), parameter :: rname = mname//'/aerocom_do_interp_0d'
  2307. integer :: i
  2308. integer :: i1, i2, j1, j2
  2309. integer :: il,ir,jl,jr
  2310. ! --- begin -------------------------------
  2311. call Get_DistGrid( dgrid(region), I_STRT=i1, I_STOP=i2, J_STRT=j1, J_STOP=j2 )
  2312. i = istat
  2313. ! shift index in the input array
  2314. il=sintp(region)%ixl(i) - i1 + 1
  2315. ir=sintp(region)%ixr(i) - i1 + 1
  2316. jl=sintp(region)%jyl(i) - j1 + 1
  2317. jr=sintp(region)%jyr(i) - j1 + 1
  2318. ! ordering
  2319. ! i = llllrrrr, j = llrrllrr, l = lrlrlrlr
  2320. aerocom_do_interp_0d = &
  2321. sintp(region)%wixl(i) * sintp(region)%wjyl(i) * sintp(region)%wlzl(i) * f3d(il,jl,sintp(region)%lzl(i)) + &
  2322. sintp(region)%wixl(i) * sintp(region)%wjyl(i) * sintp(region)%wlzr(i) * f3d(il,jl,sintp(region)%lzr(i)) + &
  2323. sintp(region)%wixl(i) * sintp(region)%wjyr(i) * sintp(region)%wlzl(i) * f3d(il,jr,sintp(region)%lzl(i)) + &
  2324. sintp(region)%wixl(i) * sintp(region)%wjyr(i) * sintp(region)%wlzr(i) * f3d(il,jr,sintp(region)%lzr(i)) + &
  2325. sintp(region)%wixr(i) * sintp(region)%wjyl(i) * sintp(region)%wlzl(i) * f3d(ir,jl,sintp(region)%lzl(i)) + &
  2326. sintp(region)%wixr(i) * sintp(region)%wjyl(i) * sintp(region)%wlzr(i) * f3d(ir,jl,sintp(region)%lzr(i)) + &
  2327. sintp(region)%wixr(i) * sintp(region)%wjyr(i) * sintp(region)%wlzl(i) * f3d(ir,jr,sintp(region)%lzl(i)) + &
  2328. sintp(region)%wixr(i) * sintp(region)%wjyr(i) * sintp(region)%wlzr(i) * f3d(ir,jr,sintp(region)%lzr(i))
  2329. return
  2330. end function aerocom_do_interp_0d
  2331. !EOC
  2332. !--------------------------------------------------------------------------
  2333. ! TM5 !
  2334. !--------------------------------------------------------------------------
  2335. !BOP
  2336. !
  2337. ! !FUNCTION: AEROCOM_DO_INTERP_SURF
  2338. !
  2339. ! !DESCRIPTION: Interpolation of a given surface field, using module wide
  2340. ! interpolation coeffients and indices for stations (sintp).
  2341. !\\
  2342. !\\
  2343. ! !INTERFACE:
  2344. !
  2345. function aerocom_do_interp_surf( f2d, region, istat )
  2346. !
  2347. ! !INPUT PARAMETERS:
  2348. !
  2349. real, dimension(:,:), intent(in) :: f2d
  2350. integer, intent(in) :: region
  2351. integer, intent(in) :: istat
  2352. !
  2353. ! !RETURN VALUE:
  2354. !
  2355. real :: aerocom_do_interp_surf
  2356. !
  2357. ! !REVISION HISTORY:
  2358. ! 6 Feb 2011 - Achim Strunk -
  2359. !
  2360. ! !REMARKS:
  2361. !
  2362. !EOP
  2363. !------------------------------------------------------------------------
  2364. !BOC
  2365. character(len=*), parameter :: rname = mname//'/aerocom_do_interp_surf'
  2366. integer :: i
  2367. integer :: i1, i2, j1, j2
  2368. integer :: il,ir,jl,jr
  2369. ! --- begin -------------------------------
  2370. call Get_DistGrid( dgrid(region), I_STRT=i1, I_STOP=i2, J_STRT=j1, J_STOP=j2 )
  2371. i = istat
  2372. ! shift index in the input array
  2373. il=sintp(region)%ixl(i) - i1 + 1
  2374. ir=sintp(region)%ixr(i) - i1 + 1
  2375. jl=sintp(region)%jyl(i) - j1 + 1
  2376. jr=sintp(region)%jyr(i) - j1 + 1
  2377. ! ordering
  2378. ! i = llllrrrr, j = llrrllrr
  2379. aerocom_do_interp_surf = &
  2380. sintp(region)%wixl(i) * sintp(region)%wjyl(i) * f2d(il,jl) + &
  2381. sintp(region)%wixl(i) * sintp(region)%wjyr(i) * f2d(il,jr) + &
  2382. sintp(region)%wixr(i) * sintp(region)%wjyl(i) * f2d(ir,jl) + &
  2383. sintp(region)%wixr(i) * sintp(region)%wjyr(i) * f2d(ir,jr)
  2384. return
  2385. end function aerocom_do_interp_surf
  2386. !EOC
  2387. end module user_output_aerocom