photolysis.F90 182 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407
  1. #define TRACEBACK write (gol,'("in ",a," (",a,", line",i5,")")') rname, __FILE__, __LINE__; call goErr
  2. #define IF_NOTOK_RETURN(action) if (status/=0) then; TRACEBACK; action; return; end if
  3. #define IF_ERROR_RETURN(action) if (status> 0) then; TRACEBACK; action; return; end if
  4. !
  5. #include "tm5.inc"
  6. #include "output.inc"
  7. !
  8. !----------------------------------------------------------------------------
  9. ! TM5 !
  10. !----------------------------------------------------------------------------
  11. !BOP
  12. !
  13. ! !MODULE: PHOTOLYSIS
  14. !
  15. ! !DESCRIPTION: <add description>
  16. !\\
  17. !\\
  18. ! !INTERFACE:
  19. !
  20. MODULE PHOTOLYSIS
  21. !
  22. ! !USES:
  23. !
  24. use GO, only : gol, goPr, goErr
  25. use tm5_distgrid, only : dgrid, Get_DistGrid, gather
  26. use photolysis_data
  27. #ifdef with_optics
  28. use optics, only : wavelendep
  29. #endif
  30. IMPLICIT NONE
  31. PRIVATE
  32. !
  33. ! !PUBLIC MEMBER FUNCTIONS:
  34. !
  35. public :: photolysis_init, photolysis_done ! life cycle
  36. public :: ozone_info_online ! calculate the overhead ozone
  37. public :: aerosol_info ! aerosol optical depths
  38. public :: slingo ! cloud optical properties
  39. public :: update_csqy ! update ...
  40. public :: daysim ! calculate solar zenith angles
  41. public :: get_sza ! return solar zenith angle (function)
  42. public :: photo_flux ! calculates radiation fields
  43. public :: photorates_tropo ! calculates photolysis and heating rates
  44. #ifdef with_optics
  45. public :: aerosol_info_m7 ! aerosol optical depths
  46. #endif
  47. !
  48. ! !PUBLIC DATA MEMBERS:
  49. !
  50. public :: phot_dat ! type defined in photolysis_data
  51. !
  52. ! !PRIVATE DATA MEMBERS:
  53. !
  54. character(len=*), parameter :: mname = 'photolysis'
  55. real, parameter :: todu = 3.767e-17 ! from #/cm2 --> du
  56. real, parameter :: to_m = 3.767e-22 ! from #/cm2 --> m (for o2)
  57. real, parameter :: sp = 6.022e23*1.e-4*0.2095/(28.964*1e-3*9.81) ! sp from pa ---> #o2/cm2
  58. logical :: with_o3du
  59. real,dimension(122,34) :: xs_o3_look
  60. real,dimension( 65,34) :: xs_hno3_look,xs_pan_look,qy_o3_look
  61. real,dimension( 45,34) :: xs_h2o2_look
  62. real,dimension( 55,34) :: xs_n2o5_look
  63. real,dimension( 89,34) :: xs_no2_look,qy_no2_look,qy_co_look
  64. real,dimension( 62,34) :: xs_no3_look
  65. real,dimension(105,34) :: xs_ch2o_look ! local
  66. ! constants for acetone qy
  67. real,dimension(89,34) :: a1_acet,a2_acet,a3_acet,a4_acet
  68. integer :: l
  69. real :: wl,x, ww
  70. #ifdef with_optics
  71. type(wavelendep),dimension(:),allocatable :: wdep
  72. #endif
  73. !
  74. ! !REVISION HISTORY:
  75. ! 16 Jun 2011 - P. Le Sager - new version from JEW
  76. ! 21 Mar 2012 - P. Le Sager - adapted for lon-lat MPI domain decomposition
  77. ! 3 Oct 2012 - P. Le Sager - separate Init into true init and monthly update
  78. ! 4 Mar 2013 - P. Le Sager - changes for optics feedback from NB
  79. !
  80. ! !REMARKS:
  81. !
  82. !EOP
  83. !--------------------------------------------------------------------------
  84. CONTAINS
  85. ! Trap overflow
  86. function safe_div(n,d,altv) result(q)
  87. real, intent(in) :: n, d, altv
  88. real :: q
  89. if ( exponent(n)-exponent(d) >= maxexponent(n) .OR. d==0) then
  90. q=altv
  91. else
  92. q=n/d
  93. end if
  94. end function safe_div
  95. !--------------------------------------------------------------------------
  96. ! TM5 !
  97. !--------------------------------------------------------------------------
  98. !BOP
  99. !
  100. ! !IROUTINE: INIT_PHOTOLYSIS
  101. !
  102. ! !DESCRIPTION: read reference tables for photolysis, allocate photolysis
  103. ! data. Called from sources_sinks/Trace0 at the run start and
  104. ! at beginning of every month.
  105. !\\
  106. !\\
  107. ! !INTERFACE:
  108. !
  109. SUBROUTINE PHOTOLYSIS_INIT( first, iunit, o3du )
  110. !
  111. ! !USES:
  112. !
  113. use dims, only : im, jm, lm, nregions, newsrun
  114. use ParTools, only : isRoot, par_broadcast
  115. use global_types, only : d23_data
  116. use global_data, only : rcfile
  117. use MeteoData, only : Set
  118. use MeteoData, only : sp_dat, temper_dat, lsmask_dat, phlb_dat
  119. use MeteoData, only : lwc_dat, iwc_dat, cc_dat, humid_dat, gph_dat
  120. use GO, only : TrcFile, Init, Done, ReadRc
  121. #ifdef with_optics
  122. use optics, only : Optics_Init
  123. #endif
  124. !
  125. ! !INPUT PARAMETERS:
  126. !
  127. logical, intent(in) :: first ! true init for a new run?
  128. integer, intent(in) :: iunit
  129. type(d23_data), dimension(nregions), optional, intent(in) :: o3du
  130. !
  131. ! !REVISION HISTORY:
  132. ! 21 Mar 2012 - P. Le Sager - adapted for lon-lat MPI domain decomposition
  133. !
  134. ! !REMARKS:
  135. !
  136. !EOP
  137. !------------------------------------------------------------------------
  138. !BOC
  139. integer :: i,j,l,m,n,region,imr,jmr,lmr,i1, i2, j1, j2
  140. real :: lat
  141. integer :: status, wav
  142. type(TrcFile) :: rcF
  143. character(len=256) :: photodir
  144. character(len=*), parameter :: rname = mname//'/photolysis_init'
  145. ! --- begin -------------------------
  146. with_o3du = present(o3du)
  147. !--------------------------------------------------
  148. ! ** TRUE INIT : only once
  149. !--------------------------------------------------
  150. if (first) then
  151. REG: do region = 1, nregions
  152. call Set( sp_dat(region), status, used=.true. )
  153. call Set( temper_dat(region), status, used=.true. )
  154. call Set( humid_dat(region), status, used=.true. )
  155. call Set( gph_dat(region), status, used=.true. )
  156. call Set( phlb_dat(region), status, used=.true. )
  157. call Set( lwc_dat(region), status, used=.true. )
  158. call Set( iwc_dat(region), status, used=.true. )
  159. call Set( cc_dat(region), status, used=.true. )
  160. call Set( lsmask_dat(region), status, used=.true. )
  161. ! allocate memory photolysis and initialise:
  162. call Get_DistGrid( dgrid(region), I_STRT=i1, I_STOP=i2, J_STRT=j1, J_STOP=j2 )
  163. lmr=lm(region)
  164. if (with_o3du) allocate( phot_dat(region)%o3klim_top(j1:j2) )
  165. allocate(phot_dat(region)%albedo (i1:i2, j1:j2)) ; phot_dat(region)%albedo = 0.05
  166. allocate(phot_dat(region)%ags_av (i1:i2, j1:j2)) ; phot_dat(region)%ags_av = 0.0
  167. allocate(phot_dat(region)%sza_av (i1:i2, j1:j2)) ; phot_dat(region)%sza_av = 0.0
  168. allocate(phot_dat(region)%lwp_av (i1:i2, j1:j2,lmr)) ; phot_dat(region)%lwp_av = 0.0
  169. allocate(phot_dat(region)%cfr_av (i1:i2, j1:j2,lmr)) ; phot_dat(region)%cfr_av = 0.0
  170. allocate(phot_dat(region)%reff_av (i1:i2, j1:j2,lmr)) ; phot_dat(region)%reff_av = 0.0
  171. allocate(phot_dat(region)%aero_surface_clim(i1:i2, j1:j2)) ; phot_dat(region)%aero_surface_clim = 0
  172. phot_dat(region)%nalb_av = 0.
  173. phot_dat(region)%ncloud_av = 0.
  174. phot_dat(region)%naer_av = 0.
  175. allocate(phot_dat(region)%cloud_reff(i1:i2, j1:j2, lmr )) ; phot_dat(region)%cloud_reff = 0.0
  176. allocate(phot_dat(region)%pmcld (i1:i2, j1:j2, lmr )) ; phot_dat(region)%pmcld = 0.0
  177. allocate(phot_dat(region)%taus_cld (i1:i2, j1:j2, lmr )) ; phot_dat(region)%taus_cld = 0.0
  178. allocate(phot_dat(region)%taua_cld (i1:i2, j1:j2, lmr )) ; phot_dat(region)%taua_cld = 0.0
  179. allocate(phot_dat(region)%pmaer (i1:i2, j1:j2, lmr, nbands_trop, ngrid )) ; phot_dat(region)%pmaer = 0.0
  180. allocate(phot_dat(region)%taus_aer (i1:i2, j1:j2, lmr, nbands_trop, ngrid )) ; phot_dat(region)%taus_aer = 0.0
  181. allocate(phot_dat(region)%taua_aer (i1:i2, j1:j2, lmr, nbands_trop, ngrid )) ; phot_dat(region)%taua_aer = 0.0
  182. allocate(phot_dat(region)%pmcld_av (i1:i2, j1:j2, lmr )) ; phot_dat(region)%pmcld_av = 0.0
  183. allocate(phot_dat(region)%taus_cld_av (i1:i2, j1:j2, lmr )) ; phot_dat(region)%taus_cld_av = 0.0
  184. allocate(phot_dat(region)%taua_cld_av (i1:i2, j1:j2, lmr )) ; phot_dat(region)%taua_cld_av = 0.0
  185. allocate(phot_dat(region)%pmaer_av (i1:i2, j1:j2, lmr, nbands_trop,ngrid )) ; phot_dat(region)%pmaer_av = 0.0
  186. allocate(phot_dat(region)%taus_aer_av (i1:i2, j1:j2, lmr, nbands_trop,ngrid )) ; phot_dat(region)%taus_aer_av = 0.0
  187. allocate(phot_dat(region)%taua_aer_av (i1:i2, j1:j2, lmr, nbands_trop,ngrid )) ; phot_dat(region)%taua_aer_av = 0.0
  188. allocate(phot_dat(region)%jo3 (i1:i2, j1:j2, lmr )) ; phot_dat(region)%jo3 = 0.0
  189. allocate(phot_dat(region)%jno2 (i1:i2, j1:j2, lmr )) ; phot_dat(region)%jno2 = 0.0
  190. allocate(phot_dat(region)%jo3_av (i1:i2, j1:j2, lmr )) ; phot_dat(region)%jo3_av = 0.0
  191. allocate(phot_dat(region)%jno2_av (i1:i2, j1:j2, lmr )) ; phot_dat(region)%jno2_av = 0.0
  192. allocate(phot_dat(region)%jhno2 (i1:i2, j1:j2, lmr )) ; phot_dat(region)%jhno2 = 0.0
  193. allocate(phot_dat(region)%jhno2_av (i1:i2, j1:j2, lmr )) ; phot_dat(region)%jhno2_av = 0.0
  194. allocate(phot_dat(region)%jch2oa (i1:i2, j1:j2, lmr )) ; phot_dat(region)%jch2oa = 0.0
  195. allocate(phot_dat(region)%jch2oa_av(i1:i2, j1:j2, lmr )) ; phot_dat(region)%jch2oa_av = 0.0
  196. allocate(phot_dat(region)%jch2ob (i1:i2, j1:j2, lmr )) ; phot_dat(region)%jch2ob = 0.0
  197. allocate(phot_dat(region)%jch2ob_av(i1:i2, j1:j2, lmr )) ; phot_dat(region)%jch2ob_av = 0.0
  198. phot_dat(region)%nj_av = 0
  199. ! absorption cross-sections
  200. allocate(phot_dat(region)%v2 (i1:i2, j1:j2, lmr+1 )) ; phot_dat(region)%v2 = 0.0
  201. allocate(phot_dat(region)%v3 (i1:i2, j1:j2, lmr+1 )) ; phot_dat(region)%v3 = 0.0
  202. allocate(phot_dat(region)%v3_surf (i1:i2, j1:j2 )) ; phot_dat(region)%v3_surf = 0.0
  203. allocate(phot_dat(region)%qy_ch3cocho(i1:i2, j1:j2, lmr, 52)) ; phot_dat(region)%qy_ch3cocho = 0.0
  204. allocate(phot_dat(region)%qy_c2o3 (i1:i2, j1:j2, lmr, 89)) ; phot_dat(region)%qy_c2o3 = 0.0
  205. ! SAD fields
  206. phot_dat(region)%nsad_av = 0
  207. allocate(phot_dat(region)%sad_cld (i1:i2, j1:j2, lmr)) ; phot_dat(region)%sad_cld = 0.0
  208. allocate(phot_dat(region)%sad_ice (i1:i2, j1:j2, lmr)) ; phot_dat(region)%sad_ice = 0.0
  209. allocate(phot_dat(region)%sad_aer (i1:i2, j1:j2, lmr)) ; phot_dat(region)%sad_aer = 0.0
  210. allocate(phot_dat(region)%sad_cld_av (i1:i2, j1:j2, lmr)) ; phot_dat(region)%sad_cld_av = 0.0
  211. allocate(phot_dat(region)%sad_ice_av (i1:i2, j1:j2, lmr)) ; phot_dat(region)%sad_ice_av = 0.0
  212. allocate(phot_dat(region)%sad_aer_av (i1:i2, j1:j2, lmr)) ; phot_dat(region)%sad_aer_av = 0.0
  213. end do REG
  214. ! read settings from rcfile:
  215. call Init( rcF, rcfile, status )
  216. call ReadRc( rcF, 'input.photo', photodir, status )
  217. !--------------------------------------------------------------------
  218. ! wavelengths in the middle of the intervals
  219. !--------------------------------------------------------------------
  220. ! see: C. Bruehl, P.J. Crutzen, Scenarios of possible changes in ...
  221. ! Climate Dynamics (1988)2: 173-203
  222. ! ONLINE TUNING : first 13 wavelength bins are now ignored. Grid also shortened above 690nm.
  223. do l=1,13
  224. wave_full(l)=1./(56250.-500.*l)
  225. end do
  226. do l=14,45
  227. wave_full(l)=1./(49750.-(l-13)*500.)
  228. end do
  229. do l=46,68
  230. wave_full(l)=(266.+(l-13))*1.e-7
  231. end do
  232. do l=69,71
  233. wave_full(l)=(320.5+2.*(l-68))*1.e-7
  234. end do
  235. do l=72,176
  236. wave_full(l)=(325.+5.*(l-71))*1.e-7
  237. end do
  238. do l=2,maxwav-1
  239. dwave_full(l)=0.5*(wave_full(l+1)-wave_full(l-1))
  240. end do
  241. dwave_full(1) = dwave_full(2)
  242. dwave_full(maxwav) = dwave_full(maxwav-1)
  243. ! select a subset from the full spctral grid to remove the first band
  244. wave=wave_full(14:135)
  245. dwave=dwave_full(14:135)
  246. !---------------------------------------------------------------------
  247. ! Rayleigh scattering cross sections
  248. ! emp. formula of Nicolet plan. space sci.32, 1467f (1984)
  249. !---------------------------------------------------------------------
  250. do l=1,maxwav
  251. wl=wave(l)*1.e4
  252. x=0.389*wl+0.09426/wl-0.3228
  253. cs_ray(l)=4.02e-28/wl**(4.+x)
  254. end do
  255. !--------------------------------------------------------------
  256. ! Read and store temperature dependent cross-section values
  257. !--------------------------------------------------------------
  258. open(unit=7, file=trim(photodir)//'/tropo_look_up_modified_cb05.dat', status='old')
  259. read(7,*)
  260. read(7,*)
  261. read(7,*)
  262. do i=1,34
  263. read(7,'(176(1Pe10.3))') (xs_o3_look(wav,i),wav=1,122)
  264. enddo
  265. read(7,*)
  266. do i=1,34
  267. read(7,*) (xs_no2_look(wav,i),wav=1,89)
  268. enddo
  269. read(7,*)
  270. do i=1,34
  271. read(7,*) (xs_hno3_look(wav,i),wav=1,65)
  272. enddo
  273. read(7,*)
  274. do i=1,34
  275. read(7,*) (xs_h2o2_look(wav,i),wav=1,45)
  276. enddo
  277. read(7,*)
  278. do i=1,34
  279. read(7,*) (xs_n2o5_look(wav,i),wav=1,55)
  280. enddo
  281. read(7,*)
  282. do i=1,34
  283. read(7,*) (xs_ch2o_look(wav,i),wav=1,90)
  284. enddo
  285. read(7,*)
  286. do i=1,34
  287. read(7,*) (xs_pan_look(wav,i),wav=1,65)
  288. enddo
  289. read(7,*)
  290. do i=1,34
  291. read(7,*) (xs_no3_look(wav,i),wav=1,62)
  292. enddo
  293. read(7,*)
  294. do i=1,34
  295. read(7,*) (qy_o3_look(wav,i),wav=1,65)
  296. enddo
  297. read(7,*)
  298. do i=1,34
  299. read(7,*)(qy_no2_look(wav,i),wav=1,89)
  300. enddo
  301. read(7,*)
  302. do i=1,34
  303. read(7,*)(qy_co_look(wav,i),wav=1,89)
  304. enddo
  305. read(7,*)
  306. do i=1,34
  307. read(7,*)(a1_acet(wav,i),wav=1,89)
  308. enddo
  309. read(7,*)
  310. do i=1,34
  311. read(7,*)(a2_acet(wav,i),wav=1,89)
  312. enddo
  313. read(7,*)
  314. do i=1,34
  315. read(7,*)(a3_acet(wav,i),wav=1,89)
  316. enddo
  317. read(7,*)
  318. do i=1,34
  319. read(7,*)(a4_acet(wav,i),wav=1,89)
  320. enddo
  321. close(7)
  322. ! put constants in correct units
  323. a1_acet=a1_acet*1e-18
  324. a2_acet=a2_acet*1e-17
  325. a4_acet=a4_acet*1e-15
  326. !--------------------------------------------------------------
  327. ! Read and store temperature dependent cross-section values
  328. !------------------ extraterrestrial flux from input file ------------------
  329. ! open(unit=7, file=trim(photodir)//'/OMI.data.reduce',status='old')
  330. ! read(7,*)
  331. ! read(7,'(1p7e10.2)') flux
  332. ! close(7)
  333. ! Cannot be read for some unknown reason on cca@ecmwf with cray compiler.
  334. ! Just set it here:
  335. flux=(/ 2.351E+12, 2.414E+12, 2.360E+12, 3.004E+12, 8.861E+12, 4.475E+12, 9.005E+12, &
  336. 1.607E+13, 1.556E+13, 1.221E+13, 2.061E+13, 2.070E+13, 1.047E+13, 7.497E+12, &
  337. 1.729E+13, 9.523E+12, 2.018E+13, 2.265E+13, 1.275E+13, 1.750E+13, 2.590E+13, &
  338. 8.777E+13, 2.193E+13, 5.449E+13, 1.074E+14, 6.856E+13, 7.875E+13, 2.275E+13, &
  339. 1.488E+14, 2.166E+14, 2.518E+14, 3.504E+14, 1.493E+14, 5.366E+13, 4.045E+13, &
  340. 2.054E+13, 6.274E+13, 9.589E+13, 1.326E+14, 1.307E+13, 1.332E+14, 1.729E+14, &
  341. 1.349E+14, 5.685E+13, 1.342E+14, 1.391E+14, 8.107E+13, 1.459E+14, 1.965E+14, &
  342. 5.681E+13, 1.349E+14, 6.819E+13, 2.137E+14, 1.564E+14, 1.334E+14, 3.559E+14, &
  343. 2.593E+14, 4.187E+14, 7.893E+14, 1.610E+14, 1.021E+15, 9.119E+14, 1.056E+15, &
  344. 8.424E+14, 6.622E+14, 9.387E+14, 1.463E+15, 3.382E+14, 1.076E+15, 9.586E+14, &
  345. 1.783E+15, 8.718E+14, 1.864E+15, 1.661E+15, 1.938E+15, 2.101E+15, 2.058E+15, &
  346. 1.738E+15, 9.227E+14, 2.404E+15, 2.176E+15, 2.625E+15, 2.167E+15, 1.741E+15, &
  347. 2.424E+15, 1.531E+15, 1.819E+15, 2.625E+15, 2.293E+15, 2.570E+15, 2.619E+15, &
  348. 2.663E+15, 2.705E+15, 2.542E+15, 1.331E+15, 2.633E+15, 2.575E+15, 2.744E+15, &
  349. 1.958E+15, 2.642E+15, 2.691E+15, 2.646E+15, 2.720E+15, 2.703E+15, 1.188E+15, &
  350. 2.720E+15, 2.271E+15, 2.405E+15, 2.723E+15, 2.690E+15, 2.550E+15, 2.670E+15, &
  351. 2.665E+15, 2.702E+15, 2.653E+15, 2.658E+15, 2.691E+15, 2.593E+15, 2.646E+15, &
  352. 2.653E+15, 2.636E+15, 2.648E+15 /)
  353. #ifdef with_optics
  354. ! define wavelengths for optics calculations
  355. nwdep = nbands_trop + count(lmid.ne.lmid_gridA)
  356. wav_grid = 0
  357. wav_gridA = 0
  358. allocate(photo_wavelengths(nwdep))
  359. l=1
  360. do i=1,nbands_trop
  361. if (lmid(i)==lmid_gridA(i)) then
  362. photo_wavelengths(l) = wave(lmid(i))*1.e4 ! cm to um
  363. wav_grid(i) = l
  364. wav_gridA(i) = l
  365. l=l+1
  366. else
  367. photo_wavelengths(l) = wave(lmid(i))*1.e4 ! cm to um
  368. photo_wavelengths(l+1) = wave(lmid_gridA(i))*1.e4 ! cm to um
  369. wav_grid(i) = l
  370. wav_gridA(i) = l+1
  371. l=l+2
  372. endif
  373. enddo
  374. allocate(wdep(nwdep))
  375. wdep(:)%wl = photo_wavelengths
  376. wdep(:)%split = .false.
  377. wdep(:)%insitu = .false.
  378. call Done( rcF, status )
  379. IF_NOTOK_RETURN(status=1)
  380. CALL OPTICS_INIT( nwdep, wdep, status )
  381. IF_NOTOK_RETURN(status=1)
  382. deallocate(photo_wavelengths)
  383. #else
  384. !**************************************************************************
  385. ! aerosol data from: "Models for Aerosols of the Lower Atmosphere
  386. ! and the Effects of Humidity Variations on their Optical Properties
  387. ! E. P. Shettle and R. W. Fenn (1979), Environmental Research Paper
  388. ! No. 676
  389. !**************************************************************************
  390. open(unit=7, file=trim(photodir)//'/aerosol_reduce.dat',status='old')
  391. do l = 1,4
  392. read(7,*)
  393. do i = 1,8
  394. read(7,*)
  395. read(7,20)(ext(wav,i,l),wav=1,maxwav)
  396. read(7,20)(abs_eff(wav,i,l),wav=1,maxwav)
  397. read(7,20)(g(wav,i,l),wav=1,maxwav)
  398. do wav=1,maxwav
  399. sca(wav,i,l) = ext(wav,i,l) - abs_eff(wav,i,l)
  400. enddo
  401. enddo
  402. enddo
  403. close(7)
  404. 20 format(6(1X,F7.5))
  405. do l=1,maxwav
  406. do i=1,8
  407. do j=1,4
  408. sca(l,i,j) = sca(l,i,j)/pn_ref(j)*1.E-5
  409. abs_eff(l,i,j) = abs_eff(l,i,j)/pn_ref(j)*1.E-5
  410. end do
  411. end do
  412. end do
  413. ! close rc file
  414. call Done( rcF, status )
  415. #endif
  416. ELSE ! NEWSRUN
  417. !--------------------------------------------------
  418. ! ** MONTHLY UPDATE
  419. !--------------------------------------------------
  420. if (with_o3du) then
  421. do region = 1, nregions
  422. call Get_DistGrid( dgrid(region), J_STRT=j1, J_STOP=j2 )
  423. phot_dat(region)%o3klim_top(:) = o3du(region)%d23(j1:j2,lm(region))
  424. end do
  425. end if
  426. ENDIF
  427. END SUBROUTINE PHOTOLYSIS_INIT
  428. !EOC
  429. !--------------------------------------------------------------------------
  430. ! TM5 !
  431. !--------------------------------------------------------------------------
  432. !BOP
  433. !
  434. ! !IROUTINE: DAYSIM
  435. !
  436. ! !DESCRIPTION: Get all solar zenith angles (THA) for a given Julian day
  437. ! (DAYNR) at 1/6, 3/6(=center), and 5/6 of each grid box.
  438. ! THA is three times oversampled.
  439. ! The longitudinal variation is equal to the simulation of
  440. ! one day, and covers the [-180,180] range for all regions.
  441. !\\
  442. !\\
  443. ! !INTERFACE:
  444. !
  445. SUBROUTINE DAYSIM(region, daynr, is, i1,i2,j1, j2, tha)
  446. !
  447. ! !USES:
  448. !
  449. use dims, only : im, jm, xbeg, xend
  450. use binas, only : pi
  451. use meteodata, only : lli
  452. !
  453. ! !INPUT PARAMETERS:
  454. !
  455. integer, intent(in) :: daynr, region, is, j1, j2,i1,i2
  456. !
  457. ! !OUTPUT PARAMETERS:
  458. !
  459. real, intent(out) :: tha( im(region)*3, j1:j2)
  460. !
  461. ! !REVISION HISTORY:
  462. ! 26 Apr 2012 - P. Le Sager - adapted for lon-lat MPI domain decomposition
  463. !
  464. ! !REMARKS:
  465. ! (1) The regions are artificially expanded to cover all longitudes, in
  466. ! order to keep the correspondance b/w time and longitude.
  467. ! (2) Need to be called once a day only. Hence separated from GET_SZA,
  468. ! and the need to have 'im_alt' and 'shift' defined module wide.
  469. ! (3) Input 'is' is not i1=I_START from the distributed grid, but: (i1-1)*3+1
  470. ! It is not used yet. To delete?
  471. ! (4) Considering the cshift functions used on THA in GET_SZA, it is
  472. ! assumed that THA covers the entire longitude range.
  473. !EOP
  474. !------------------------------------------------------------------------
  475. !BOC
  476. real, dimension(j1:j2) :: lat
  477. real :: houra, rdecl, sinhh, eqr, ut
  478. real :: piby, lon, tz, sintz, costz
  479. real :: sin2tz, cos2tz, sin3tz, cos3tz
  480. integer :: i, j, k
  481. !
  482. !call Get_DistGrid( dgrid(region), I_STOP=i2, J_STOP=j2 )
  483. piby = pi/180.
  484. !
  485. ! latitude range in radian
  486. lat = lli(region)%lat
  487. !
  488. tz = 2.*pi*daynr/365.
  489. !
  490. ! Solar declination approximation
  491. !(p.97, Brasseur et al, Atmospheric Chemistry and Global Change, 1999)
  492. !
  493. rdecl = -0.4*cos(2.*pi*real(daynr+10)/365.)
  494. !
  495. sintz = sin(tz)
  496. costz = cos(tz)
  497. sin2tz = 2.*sintz*costz
  498. cos2tz = costz*costz-sintz*sintz
  499. eqr = 0.000075 + 0.001868*costz - 0.032077*sintz &
  500. - 0.014615*cos2tz - 0.040849*sin2tz
  501. !
  502. ! the sza variation over longitude [-180,180] at ut=12 equals
  503. ! a with variation of ut over [0,24] at longitude 0:
  504. ! houra = 15.*(ut-12. + eqr*24./(2.*pi) + lon*24./360)*piby
  505. !
  506. ! THA (sampled at 1/6, 3/6, and 5/6 of each box). As follow for 6 degree resolution:
  507. !
  508. ! -180---+---+---177---+---+---174---+---+---171---+---+---168 .......etc...
  509. ! | | |
  510. ! | box #1 | box #2 |
  511. ! | | |
  512. ! +---------------------------+---------------------------+ .......etc.....
  513. ! 0 1 2 3 4 5 0 1 2 3 4 5
  514. ! * * * * * * <---- samples (lon,THA)
  515. do j=j1,j2
  516. do i=1,im(region)*3
  517. lon = -180. + (real(i)-0.5)*360./real(im(region)*3)
  518. !lon = xbeg(region) + (real(i)-0.5)*(xend(region)-xbeg(region))/real(im(region)*3)
  519. houra = -pi + lon*piby + eqr
  520. sinhh = sin(rdecl)*sin(lat(j)) &
  521. + cos(rdecl)*cos(lat(j))*cos(houra)
  522. tha(i,j) = acos(sinhh)/piby
  523. enddo
  524. enddo
  525. END SUBROUTINE DAYSIM
  526. !EOC
  527. !--------------------------------------------------------------------------
  528. ! TM5 !
  529. !--------------------------------------------------------------------------
  530. !BOP
  531. !
  532. ! !IROUTINE: GET_SZA
  533. !
  534. ! !DESCRIPTION:
  535. !\\
  536. !\\
  537. ! !INTERFACE:
  538. !
  539. SUBROUTINE GET_SZA(region, i1, j1, i2, j2, tstart, deltat, tha, sza)
  540. !
  541. ! !USES:
  542. !
  543. use dims, only : im, jm
  544. !
  545. ! !INPUT PARAMETERS:
  546. !
  547. integer, intent(in) :: region, i1, j1, i2, j2
  548. real, intent(in) :: tstart ! start time of chemistry timestep
  549. real, intent(in) :: deltat ! chemistry timestep in hours
  550. real, intent(in) :: tha(im(region)*3,j1:j2) ! three times oversampled zenith angles
  551. !
  552. ! !OUTPUT PARAMETERS:
  553. !
  554. real, intent(out) :: sza(i1:i2,j1:j2) ! effective solar zenith angles for this timestep
  555. !
  556. ! !REVISION HISTORY:
  557. ! 26 Apr 2012 - P. Le Sager - adapted for lon-lat MPI domain decomposition
  558. !
  559. ! !REMARKS:
  560. !
  561. !EOP
  562. !------------------------------------------------------------------------
  563. !BOC
  564. real, dimension(im(region)*3,j1:j2) :: mu3
  565. real :: dt
  566. integer :: it, i, ii
  567. !
  568. mu3 = 0.0
  569. !
  570. ! split chemistry timestep in intervals and calculate mu at 1/6, 3/6
  571. ! and 5/6 of timestep chemistry. Interpolate in time using the
  572. ! longitudinal dependence of tha and take the average.
  573. !
  574. do ii=1,5,2
  575. dt = ( tstart + ii*deltat/6. ) * (real(im(region)*3)/24.)
  576. it = int(dt)
  577. dt = dt-it
  578. mu3 = mu3 + (1-dt)*cshift(tha,it,1)+dt*cshift(tha,it+1,1)
  579. enddo
  580. !
  581. ! average over three angles at three times resolution
  582. !
  583. do i=i1,i2
  584. sza(i,:) = (mu3(i*3-2,:) + mu3(i*3-1,:) + mu3(i*3,:))/9.0
  585. enddo
  586. END SUBROUTINE GET_SZA
  587. !EOC
  588. !--------------------------------------------------------------------------
  589. ! TM5 !
  590. !--------------------------------------------------------------------------
  591. !BOP
  592. !
  593. ! !IROUTINE: PHOTO_FLUX
  594. !
  595. ! !DESCRIPTION:
  596. !\\
  597. !\\
  598. ! !INTERFACE:
  599. !
  600. SUBROUTINE PHOTO_FLUX( region, is, js, sza, rj_new)
  601. !**********************************************************************
  602. ! *
  603. ! contact: *
  604. ! *
  605. ! Jason Williams *
  606. ! Koninklijk Nederlands Meteorologisch instituut (KNMI) *
  607. ! Postbus 201 *
  608. ! 3730 AE De Bilt *
  609. ! tel +31 (0)30 2206748 *
  610. ! e-mail : williams@knmi.nl *
  611. ! *
  612. !**********************************************************************
  613. ! purpose:
  614. !
  615. ! The calculation of the radiation fields using input from TM5 and ECMWF meteo.
  616. !
  617. ! method:
  618. !
  619. ! Optical properties (optical thickness,cross sections, quantum yields)
  620. ! are calculated for lm(region) layers. Radiation fluxes are derived for 0:lm(region)
  621. ! levels, including the surface and top of atmosphere. Thus, level l overlays layer l.
  622. ! Photolysis rates in a layer are evaluated by taking the average of the
  623. ! photolysis rates evaluated at the upper and lower boundaries of the layer.
  624. !
  625. ! First, spectral calculations are performed for an atmosphere with absorption
  626. ! only, including gaseous absorption by O2 and O3 and aerosol absorption.
  627. ! Second, a correction is applied for scattering and surface reflection, per
  628. ! scattering band and using radiative transfer calculations at representative
  629. ! wavelengths
  630. !
  631. ! This photolysis module is based on:
  632. !
  633. ! Landgraf and Crutzen, 1998, J. Atmos. Sci, 55, 863-878.
  634. ! Williams et al., 2006, Atmos.Chem.Phys., 6, 4137-4161.
  635. !
  636. !------------------------------------------------------------------
  637. !
  638. ! Albedo field
  639. ! ------------
  640. !
  641. ! In older TM photolysis code, an adhoc uv-vis albedo was computed
  642. ! from land cover fields:
  643. !
  644. ! module dry_deposition
  645. ! dd_surface_fields
  646. ! if(root_k)then
  647. ! dd_calc_inisurf
  648. ! compute ags on glb1x1 from land cover, on root_k only
  649. ! dd_coarsen_vd
  650. ! coarsen ags to vd_temp, copy into phot_dat(region)%albedo
  651. ! endif
  652. ! broadcast phot_dat(region)%albedo to all other processors
  653. !
  654. ! In the first stratospheric codes, the same adhoc albedo computed in
  655. ! drydepos was written over the albedo meteo field, and then this one was used.
  656. ! To avoid this obscure destruction of ecmwf data, we use the phot_dat version here.
  657. ! In future, this should be replaced by ECMWF field:
  658. ! UV visible albedo for direct radiation ALUVP (0 - 1) 15 128
  659. !
  660. !------------------------------------------------------------------
  661. ! subroutine to calculate direct flux and actinic flux
  662. !*******************************************************************
  663. !
  664. ! !USES:
  665. !
  666. use dims, only : lm, idate, ndyn, ndyn_max
  667. use MeteoData, only : temper_dat, gph_dat, cc_dat
  668. !
  669. ! !INPUT PARAMETERS:
  670. !
  671. integer, intent(in) :: region
  672. integer, intent(in) :: is, js
  673. real, intent(in) :: sza(is:,js:)
  674. !
  675. ! !OUTPUT PARAMETERS:
  676. !
  677. ! photolysis rates for this time-step
  678. real, dimension(is:,js:,:,:), intent(out) :: rj_new ! (i1:i2,j1:j2,lm(region),nj)
  679. !
  680. ! !REVISION HISTORY:
  681. ! 26 Apr 2012 - P. Le Sager - adapted for lon-lat MPI domain decomposition
  682. !
  683. !EOP
  684. !------------------------------------------------------------------------
  685. !BOC
  686. integer :: i, j, l, k, n, table_pos
  687. real :: zangle, alb, esrm2
  688. real, dimension(lm(region)+1) :: levels
  689. logical :: clear, cloudy, debug_flag
  690. ! temperature index array for the lookup table
  691. integer, parameter :: n_ind =34 ! number of increments in the look-up table
  692. integer, parameter :: jindex=9
  693. integer, parameter :: latindex=21
  694. real, parameter :: incr = 5. ! 5deg C intervals in look-up table (optimised value)
  695. real, dimension(n_ind) :: temp_ind
  696. real, dimension(:), allocatable :: v2_col, v3_col, dv2_col, dv3_col, t_lay, ly_a, column_cloud
  697. real, dimension(:,:), allocatable :: cst_o3_col
  698. real, dimension(:,:), allocatable :: cst_no2_col, qy_no2_col
  699. real, dimension(:,:), allocatable :: cst_hno3_col
  700. real, dimension(:,:), allocatable :: cst_h2o2_col
  701. real, dimension(:,:), allocatable :: cst_n2o5_col
  702. real, dimension(:,:), allocatable :: cst_ch2o_col
  703. real, dimension(:,:), allocatable :: cst_pan_col
  704. real, dimension(:,:), allocatable :: cst_no3_col
  705. real, dimension(:,:), allocatable :: qy_o1d_col
  706. real, dimension(:,:), allocatable :: qy_ch3cocho_col
  707. real, dimension(:,:), allocatable :: qy_co_col,qy_c2o3_col
  708. real, dimension(:,:), allocatable :: fdir, fact
  709. real, dimension(:), allocatable :: taua_cld_col, taus_cld_col
  710. real, dimension(:,:,:),allocatable :: taus_aer_col, taua_aer_col
  711. real, dimension(:,:), allocatable :: ts_pi_clr_col, ta_pi_clr_col, g_pi_clr_col, g_pi_cld_col
  712. real, dimension(:), allocatable :: ts_pi_cld, ta_pi_cld
  713. real, dimension(:,:,:),allocatable :: pm_aer_col
  714. real, dimension(:), allocatable :: pm_cld_col
  715. real, dimension(:,:), allocatable :: ds
  716. real, dimension(:,:), allocatable :: rj_column
  717. real, dimension(:,:,:),pointer :: temperature
  718. ! additional diagnostic array to compare old/new jvalue input
  719. real, dimension(:), allocatable :: vo3s_col
  720. real :: zangle_in, rdif_szalims
  721. integer :: i1, j1, i2, j2
  722. call Get_DistGrid( dgrid(region), I_STRT=i1, I_STOP=i2, J_STRT=j1, J_STOP=j2 )
  723. allocate( v2_col (lm(region)+1) )
  724. allocate( v3_col (lm(region)+1) )
  725. allocate( dv2_col (lm(region) ) )
  726. allocate( dv3_col (lm(region) ) )
  727. allocate( t_lay (lm(region) ) )
  728. allocate( cst_o3_col (lm(region),maxwav) )
  729. allocate( cst_no2_col (lm(region),89) )
  730. allocate( qy_no2_col (lm(region),89) )
  731. allocate( qy_co_col (lm(region),89) )
  732. allocate( qy_c2o3_col (lm(region),89) )
  733. allocate( cst_hno3_col (lm(region),65) )
  734. allocate( cst_h2o2_col (lm(region),45) )
  735. allocate( cst_n2o5_col (lm(region),55) )
  736. allocate( cst_ch2o_col (lm(region),105) )
  737. allocate( cst_pan_col (lm(region),65) )
  738. allocate( cst_no3_col (lm(region),62) )
  739. allocate( qy_o1d_col (lm(region),65) )
  740. allocate( qy_ch3cocho_col(lm(region),52) )
  741. allocate( fdir (lm(region),maxw) ) ; fdir(:,:) = 0.
  742. allocate( taus_aer_col (lm(region),nbands_trop,ngrid))
  743. allocate( taua_aer_col (lm(region),nbands_trop,ngrid))
  744. allocate( taus_cld_col (lm(region)))
  745. allocate( taua_cld_col (lm(region)))
  746. allocate( ts_pi_clr_col (lm(region),nbands_trop))
  747. allocate( ta_pi_clr_col (lm(region),nbands_trop))
  748. allocate( g_pi_clr_col (lm(region),nbands_trop))
  749. allocate( g_pi_cld_col (lm(region),nbands_trop))
  750. allocate( pm_aer_col (lm(region),nbands_trop,ngrid))
  751. allocate( pm_cld_col (lm(region)))
  752. allocate( fact (lm(region),nbands_trop)) ; fact(:,:) = 0.
  753. allocate( column_cloud (lm(region)))
  754. allocate( ds (lm(region)+1,lm(region)))
  755. allocate( rj_column (lm(region),nj)) ; rj_column = 0.
  756. allocate(vo3s_col(lm(region)+1))
  757. temperature => temper_dat(region)%data
  758. clear = .false.
  759. cloudy = .true.
  760. debug_flag = .false.
  761. ! define temperature index array from the lookup table
  762. do i = 1, 34
  763. temp_ind(i) = 182.5 + (i-1) * 5.0
  764. enddo
  765. ! Inverse of SZA difference in limits,i.e. 1./(94-85)
  766. rdif_szalims = 1.0 / ( sza_widelimit - sza_limit )
  767. do j = j1, j2
  768. do i = i1, i2
  769. zangle = sza(i,j)
  770. ! Limit value used by photolysis computation to 'sza_limit' ...
  771. zangle_in = min( sza_limit, zangle )
  772. t_lay = temperature(i,j,:)
  773. rj_new(i,j,:,:) = 0.
  774. if ( zangle <= sza_widelimit ) then
  775. ! initialise
  776. fdir = 0. ; dv2_col = 0. ; dv3_col = 0. ; fact = 0.
  777. v2_col(:) = phot_dat(region)%v2(i,j,:)
  778. v3_col(:) = phot_dat(region)%v3(i,j,:)
  779. qy_ch3cocho_col(:,:) = phot_dat(region)%qy_ch3cocho(i,j,:,:)
  780. qy_c2o3_col(:,:) = phot_dat(region)%qy_c2o3(i,j,:,:)
  781. column_cloud(:) = cc_dat(region)%data(i,j,:)
  782. levels=gph_dat(region)%data(i,j,:)
  783. ! set optical depths parameters
  784. taus_cld_col = phot_dat(region)%taus_cld(i,j,:)
  785. taua_cld_col = phot_dat(region)%taua_cld(i,j,:)
  786. taus_aer_col = phot_dat(region)%taus_aer(i,j,:,:,:)
  787. taua_aer_col = phot_dat(region)%taua_aer(i,j,:,:,:)
  788. pm_cld_col = phot_dat(region)%pmcld(i,j,:)
  789. pm_aer_col = phot_dat(region)%pmaer(i,j,:,:,:)
  790. !
  791. ! assign the cross-sections here to avoid the exporting of large arrays
  792. !
  793. do k=1,lm(region)
  794. table_pos=int((t_lay(k) - (temp_ind(1)-0.5*5)) / 5) + 1
  795. table_pos=min(max(1,table_pos),34) ! bug fix for temperatures below 175.5
  796. cst_o3_col(k,:) = xs_o3_look(:,table_pos)
  797. cst_no2_col(k,:) = xs_no2_look(:,table_pos)
  798. cst_hno3_col(k,:) = xs_hno3_look(:,table_pos)
  799. cst_h2o2_col(k,:) = xs_h2o2_look(:,table_pos)
  800. cst_ch2o_col(k,:) = xs_ch2o_look(:,table_pos)
  801. cst_n2o5_col(k,:) = xs_n2o5_look(:,table_pos)
  802. cst_pan_col(k,:) = xs_pan_look(:,table_pos)
  803. cst_no3_col(k,:) = xs_no3_look(:,table_pos)
  804. qy_o1d_col(k,:) = qy_o3_look(:,table_pos)
  805. qy_no2_col(k,:) = qy_no2_look(:,table_pos)
  806. qy_co_col(k,:) = qy_co_look(:,table_pos)
  807. enddo
  808. ! slant column, lyman-alpha and direct flux ; all are zenith angle dependent
  809. call directflux(region,zangle_in,v2_col,v3_col,cst_o3_col,t_lay,fdir,dv2_col,dv3_col,taua_cld_col, &
  810. taua_aer_col,levels,ds,vo3s_col,debug_flag)
  811. ! now do radiative transfer calculation, calculate actinic flux
  812. ! set albedo
  813. alb = phot_dat(region)%albedo(i,j)
  814. ! Now call the PIFM RT solver for the online calculation ; both clear and cloudy conditions can be used
  815. if (clear) call pifm(region,zangle_in,alb,cst_o3_col,dv2_col,dv3_col, &
  816. taua_aer_col,taus_aer_col,pm_aer_col,fact)
  817. if (cloudy) call pifm_ran( region,zangle_in,alb,cst_o3_col,dv2_col,dv3_col, &
  818. taua_cld_col,taus_cld_col,pm_cld_col,taua_aer_col,taus_aer_col,pm_aer_col,fact,column_cloud)
  819. rj_column=0.
  820. call photorates_tropo(region,zangle_in,cst_o3_col,cst_no2_col,cst_hno3_col,cst_h2o2_col,cst_ch2o_col,&
  821. cst_n2o5_col,cst_pan_col,cst_no3_col,qy_no2_col,qy_o1d_col,qy_ch3cocho_col,qy_co_col,qy_c2o3_col, &
  822. fact,fdir,rj_column,t_lay,debug_flag)
  823. if ( zangle <= sza_limit) then
  824. ! If actual SZA is below 85 deg then use values as such...
  825. rj_new(i,j,:,:) = rj_column
  826. else
  827. ! Otherwise, with SZA is between 85 deg and 95 then use interpolated values
  828. rj_new(i,j,:,:) = rj_column * (sza_widelimit - zangle) * rdif_szalims
  829. end if
  830. elseif(zangle > sza_widelimit) then
  831. vo3s_col = 0.
  832. do k=1,lm(region)
  833. table_pos=int((t_lay(k) - (temp_ind(1)-0.5*5)) / 5) + 1
  834. table_pos=min(max(1,table_pos),34) ! max(...) == temperatures below 175.5 used like 180.5
  835. cst_o3_col(k,:) = xs_o3_look(:,table_pos)
  836. enddo
  837. debug_flag=.false.
  838. endif ! sza_limit
  839. enddo ! i
  840. enddo ! j
  841. ! Correction photolysis for distance sun-earth
  842. esrm2 = sundis(idate(2),idate(3))
  843. rj_new = rj_new *esrm2
  844. ! Store
  845. phot_dat(region)%jo3 (:,:,:) = rj_new(:,:,:,jo3d)
  846. phot_dat(region)%jno2 (:,:,:) = rj_new(:,:,:,jno2)
  847. phot_dat(region)%jhno2 (:,:,:) = rj_new(:,:,:,jhono)
  848. phot_dat(region)%jch2oa (:,:,:) = rj_new(:,:,:,jach2o)
  849. phot_dat(region)%jch2ob (:,:,:) = rj_new(:,:,:,jbch2o)
  850. ! Averages
  851. phot_dat(region)%nj_av = phot_dat(region)%nj_av + float(ndyn)/float(ndyn_max)
  852. phot_dat(region)%nalb_av = phot_dat(region)%nalb_av + float(ndyn)/float(ndyn_max)
  853. phot_dat(region)%jo3_av = phot_dat(region)%jo3_av + float(ndyn)/float(ndyn_max) * rj_new(:,:,:,jo3d)
  854. phot_dat(region)%jno2_av = phot_dat(region)%jno2_av + float(ndyn)/float(ndyn_max) * rj_new(:,:,:,jno2)
  855. phot_dat(region)%jhno2_av = phot_dat(region)%jhno2_av + float(ndyn)/float(ndyn_max) * rj_new(:,:,:,jhono)
  856. phot_dat(region)%jch2oa_av = phot_dat(region)%jch2oa_av + float(ndyn)/float(ndyn_max) * rj_new(:,:,:,jach2o)
  857. phot_dat(region)%jch2ob_av = phot_dat(region)%jch2ob_av + float(ndyn)/float(ndyn_max) * rj_new(:,:,:,jbch2o)
  858. phot_dat(region)%ags_av = phot_dat(region)%ags_av + float(ndyn)/float(ndyn_max) * phot_dat(region)%albedo
  859. phot_dat(region)%sza_av = phot_dat(region)%sza_av + float(ndyn)/float(ndyn_max) * sza
  860. ! Done
  861. nullify(temperature)
  862. deallocate(v2_col)
  863. deallocate(v3_col)
  864. deallocate(dv2_col)
  865. deallocate(dv3_col)
  866. deallocate(cst_o3_col)
  867. deallocate(cst_no2_col)
  868. deallocate(qy_no2_col)
  869. deallocate(qy_co_col)
  870. deallocate(qy_c2o3_col)
  871. deallocate(cst_hno3_col)
  872. deallocate(cst_h2o2_col)
  873. deallocate(cst_n2o5_col)
  874. deallocate(cst_ch2o_col)
  875. deallocate(cst_pan_col)
  876. deallocate(cst_no3_col)
  877. deallocate(qy_o1d_col)
  878. deallocate(qy_ch3cocho_col)
  879. deallocate(fdir)
  880. deallocate(t_lay)
  881. deallocate(taus_aer_col)
  882. deallocate(taua_aer_col)
  883. deallocate(pm_aer_col)
  884. deallocate(taus_cld_col)
  885. deallocate(taua_cld_col)
  886. deallocate(pm_cld_col)
  887. deallocate(ts_pi_clr_col)
  888. deallocate(ta_pi_clr_col)
  889. deallocate(g_pi_clr_col)
  890. deallocate(g_pi_cld_col)
  891. deallocate(fact)
  892. deallocate(column_cloud)
  893. deallocate(ds)
  894. deallocate(rj_column)
  895. deallocate(vo3s_col)
  896. END SUBROUTINE PHOTO_FLUX
  897. !EOC
  898. !--------------------------------------------------------------------------
  899. ! TM5 !
  900. !--------------------------------------------------------------------------
  901. !BOP
  902. !
  903. ! !IROUTINE: DIRECTFLUX
  904. !
  905. ! !DESCRIPTION:
  906. ! Schumann-Runge parameterization
  907. ! Koppers GAA, Murtagh DP, Ann. Geophysicae 14, 68-79
  908. !\\
  909. !\\
  910. ! !INTERFACE:
  911. !
  912. subroutine directflux(region,zangle,v2_col,v3_col,cst_o3_col,t_lay,&
  913. fdir,dv2_col,dv3_col,taua_cld_col,taua_aer_col,&
  914. levels,ds,vo3s_col,debug_flag)
  915. !
  916. ! !USES:
  917. !
  918. use dims, only : lm
  919. use binas, only : pi, avog, grav, xmair, ae
  920. !
  921. ! !INPUT PARAMETERS:
  922. !
  923. integer, intent(in) :: region
  924. real,intent(in) :: zangle
  925. ! oxygen and ozone column
  926. real,dimension(lm(region)+1),intent(in) :: v2_col,v3_col
  927. real,dimension(lm(region)),intent(in) :: taua_cld_col
  928. real,dimension(lm(region),nbands_trop,ngrid),intent(in) :: taua_aer_col
  929. !
  930. ! !OUTPUT PARAMETERS:
  931. !
  932. real,dimension(lm(region)+1),intent(out) :: vo3s_col
  933. ! temperature
  934. real,dimension(lm(region)),intent(in) :: t_lay
  935. ! temperature dependent cs of ozone
  936. real,dimension(lm(region),maxwav),intent(in) :: cst_o3_col
  937. ! flux through pure absorbing atmosphere
  938. real,dimension(lm(region),maxw),intent(out) :: fdir
  939. real,dimension(lm(region)),intent(out) :: dv2_col,dv3_col
  940. ! levels for ds calculation
  941. real,dimension(lm(region)+1) :: levels
  942. real,dimension(lm(region)+1,lm(region)),intent(out) :: ds
  943. logical,intent(in) :: debug_flag
  944. !
  945. ! !REVISION HISTORY:
  946. !
  947. !EOP
  948. !------------------------------------------------------------------------
  949. !BOC
  950. real,dimension(:),allocatable :: t_lev
  951. real,dimension(:),allocatable :: v2s,v3s,dv2s, dv3s
  952. integer :: l, li, i, j, k, k1, k2, id, n, h, bandno
  953. real :: dl_o2,u0
  954. real,dimension(20) :: coeff_a, coeff_b
  955. real :: a,b,c, gamma
  956. real,dimension(maxw) :: fdir_top
  957. real :: fdir_bot
  958. real :: ta_o2, ta_o3, tau
  959. real :: sp, const, press, alp, alv2, sln, ck, sf
  960. !-----------------------------------------------------------------
  961. ! declarations for the calculation of DS
  962. real,dimension(0:lm(region)) :: ze
  963. real,dimension(0:lm(region),lm(region)) :: ds_tmp
  964. real :: rpsinz,rj,rjp1,diffj,height1,height2
  965. real :: zenrad,sm,re,dsj,dummy
  966. allocate(t_lev(lm(region)+1)) ; t_lev=0.
  967. allocate(dv2s(lm(region))) ; dv2s = 0.
  968. allocate(dv3s(lm(region))) ; dv3s = 0.
  969. allocate(v2s(1:lm(region)+1)) ; v2s = 0.
  970. allocate(v3s(1:lm(region)+1)) ; v3s = 0.
  971. ! initialise all output
  972. fdir = 0. ; dv2_col = 0 ; dv3_col = 0. ; ds = 0. ; ds_tmp = 0.
  973. ! define temperature on grid levels. Note temperature on layers now has reversed vertical grid
  974. do k = 2,lm(region)
  975. t_lev(k) = (t_lay(k) + t_lay(k-1) ) * 0.5
  976. enddo
  977. ! boundaries
  978. t_lev(1) = t_lay(1)
  979. t_lev(lm(region)+1) = t_lay(lm(region))
  980. a = 0.50572 ; b = 6.07995 ; c = 1.63640
  981. dv2_col(lm(region)) = v2_col(lm(region))
  982. dv3_col(lm(region)) = v3_col(lm(region))
  983. do l=lm(region)-1,1,-1
  984. dv2_col(l) = v2_col(l)-v2_col(l+1)
  985. dv3_col(l) = v3_col(l)-v3_col(l+1)
  986. end do
  987. !-----correction of the air mass factor---------------------------------
  988. ! F. Kasten and T. Young, Revised optical air mass tabels and
  989. ! approximation formula (1989) Aplied Optics Vol 28, No. 22 P. 4735
  990. ! and J. Lenoble, atmospheric radiative transfer (1993), P. 236
  991. ! define air mass factor in mu
  992. gamma = 90. - zangle
  993. u0 = sin(gamma*pi/180.) + a *(gamma+b)**(-c)
  994. u0 = min(1.,u0)
  995. if(zangle <= 75.) then
  996. ds = 1/u0
  997. elseif(zangle >75. .and. zangle <=sza_limit) then
  998. levels(1:lm(region)+1)=levels(lm(region)+1:1:-1)
  999. re = (ae+levels(lm(region)+1))*1.e-3
  1000. do k=lm(region)+1,1,-1
  1001. ze(k-1) = (levels(k)/1.e3)-(levels(lm(region)+1)/1.e3)
  1002. enddo
  1003. zenrad=acos(u0)
  1004. do k=0,lm(region)
  1005. rpsinz = (re+ze(k))*sin(zenrad)
  1006. id = k
  1007. do n=1,id
  1008. sm = 1.0
  1009. rj = re + ze(n-1)
  1010. rjp1 = re + ze(n)
  1011. diffj = ze(n-1) - ze(n)
  1012. height1 = rj**2 - rpsinz**2
  1013. height2 = rjp1**2 - rpsinz**2
  1014. height1=max(0.0,height1)
  1015. height2=max(0.0,height2)
  1016. if(id>k .and. n==id) then
  1017. dsj=sqrt(height1)
  1018. else
  1019. dsj=sqrt(height1)-sm*sqrt(height2)
  1020. endif
  1021. ds_tmp(k,n) = dsj/diffj
  1022. enddo ! n
  1023. enddo !k
  1024. ! invert matrix to be compatible with lm(region)+1 being tOA
  1025. ds(1:lm(region)+1,1:lm(region))=ds_tmp(lm(region):0:-1,lm(region):1:-1)
  1026. ENDIF ! sza_rad
  1027. ! slant column : calculate in different way depending on zangle
  1028. if(zangle <=75.) then
  1029. v2s(lm(region)+1)=ds(lm(region),lm(region))*v2_col(lm(region)+1)
  1030. v3s(lm(region)+1)=ds(lm(region),lm(region))*v3_col(lm(region)+1)
  1031. do k1=lm(region)+1,1,-1
  1032. v2s(k1) = v2s(lm(region)+1)
  1033. v3s(k1) = v3s(lm(region)+1)
  1034. do k2=lm(region),k1,-1
  1035. v2s(k1) = v2s(k1) + ds(k1,k2)*dv2_col(k2)
  1036. v3s(k1) = v3s(k1) + ds(k1,k2)*dv3_col(k2)
  1037. end do
  1038. end do
  1039. elseif(zangle>75. .and. zangle<=85.) then
  1040. v2s(lm(region)+1) = ds(lm(region),lm(region))*v2_col(lm(region)+1)
  1041. v3s(lm(region)+1) = ds(lm(region),lm(region))*v3_col(lm(region)+1)
  1042. do k1=lm(region)+1,1,-1
  1043. v2s(k1) = v2s(lm(region)+1)
  1044. v3s(k1) = v3s(lm(region)+1)
  1045. do k2=lm(region),1,-1
  1046. v2s(k1) = v2s(k1) + ds(k1,k2)*dv2_col(k2)
  1047. v3s(k1) = v3s(k1) + ds(k1,k2)*dv3_col(k2)
  1048. enddo
  1049. enddo
  1050. endif
  1051. do k1=lm(region)+1,1,-1
  1052. vo3s_col(k1)=v3s(k1)
  1053. enddo
  1054. ! differential slant column
  1055. dv2s(lm(region)) = v2s(lm(region))-v2s(lm(region)+1)
  1056. dv3s(lm(region)) = v3s(lm(region))-v3s(lm(region)+1)
  1057. do k = lm(region)-1,1,-1
  1058. dv2s(k) = v2s(k)-v2s(k+1)
  1059. dv3s(k) = v3s(k)-v3s(k+1)
  1060. if(dv2s(k)<0.) dv2s(k)=-1.0*dv2s(k)
  1061. if(dv3s(k)<0.) dv3s(k)=-1.0*dv3s(k)
  1062. enddo
  1063. ! intialise direct flux
  1064. fdir_top(1:maxw) = flux(1:maxw)
  1065. ! direct flux = actinic flux for a purely abs. atmosphere
  1066. ! here, layer averaged quantity
  1067. bandno=1
  1068. if(zangle <=85.) then
  1069. do l = 1,maxw
  1070. do k = lm(region),1,-1
  1071. if(l<18) then
  1072. ta_o2 = cross_o2(l)*dv2s(k)
  1073. else
  1074. ta_o2 = 0.
  1075. endif
  1076. ta_o3 = cst_o3_col(k,l)*dv3s(k)
  1077. fdir_bot = fdir_top(l) * exp(-ta_o2-ta_o3-taua_cld_col(k)-taua_aer_col(k,bandno,1))
  1078. fdir(k,l) = (fdir_top(l) + fdir_bot)/2.
  1079. fdir_top(l) = fdir_bot
  1080. if(l>lfin(bandno)) bandno=bandno+1
  1081. enddo
  1082. enddo
  1083. endif
  1084. deallocate(t_lev)
  1085. deallocate(v2s)
  1086. deallocate(v3s)
  1087. deallocate(dv2s)
  1088. deallocate(dv3s)
  1089. END SUBROUTINE DIRECTFLUX
  1090. !EOC
  1091. #ifdef with_optics
  1092. ! only define when coupling with photolysis is turned on
  1093. !--------------------------------------------------------------------------
  1094. ! TM5 !
  1095. !--------------------------------------------------------------------------
  1096. !BOP
  1097. !
  1098. ! !IROUTINE: AEROSOL_INFO_M7
  1099. !
  1100. ! !DESCRIPTION: assignment of aerosol optical depths calculated in M7
  1101. !\\
  1102. !\\
  1103. ! !INTERFACE:
  1104. !
  1105. SUBROUTINE AEROSOL_INFO_M7(region, status)
  1106. !
  1107. ! !USES:
  1108. !
  1109. USE TM5_DISTGRID, ONLY : dgrid, Get_DistGrid
  1110. USE DIMS, ONLY : isr,ier,jsr,jer, ndyn_max, ndyn
  1111. USE METEODATA, ONLY : gph_dat
  1112. USE DIMS, ONLY : im, jm, lm
  1113. USE OPTICS, ONLY : optics_aop_get
  1114. !
  1115. ! !INPUT PARAMETERS:
  1116. !
  1117. integer, intent(in) :: region
  1118. !
  1119. ! !OUTPUT PARAMETERS:
  1120. !
  1121. integer, intent(out) :: status
  1122. !
  1123. ! !REVISION HISTORY:
  1124. ! Aug 2012 - NB
  1125. ! 5 Mar 2013 - Ph. Le Sager - TM5-MP version
  1126. !
  1127. ! !REMARKS:
  1128. !
  1129. !EOP
  1130. !------------------------------------------------------------------------
  1131. !BOC
  1132. character(len=*), parameter :: rname = mname//'/aerosol_info_m7'
  1133. integer :: i,j,l,lvec, nsend, igrid, i1, i2, j1, j2, lmr
  1134. real, dimension(:,:,:), pointer :: gph
  1135. real, dimension(:,:,:,:), allocatable :: taus_aer, taua_aer, pmaer
  1136. ! Optics output fields (to be used and allocated by methods using the optics)
  1137. real, dimension(:,:,:), allocatable :: aop_out_ext ! extinctions
  1138. real, dimension(:,:), allocatable :: aop_out_a ! single scattering albedo
  1139. real, dimension(:,:), allocatable :: aop_out_g ! assymetry factor
  1140. ! ------------ begin -----------------
  1141. ! count lvec, tile grid size
  1142. CALL GET_DISTGRID( dgrid(region), I_STRT=i1, I_STOP=i2, J_STRT=j1, J_STOP=j2 )
  1143. lmr=lm(region)
  1144. lvec = (i2-i1+1)*(j2-j1+1)*lmr
  1145. allocate( aop_out_ext(lvec, nwdep, 1))
  1146. allocate( aop_out_a (lvec, nwdep) )
  1147. allocate( aop_out_g (lvec, nwdep) )
  1148. CALL OPTICS_AOP_GET(lvec, region, nwdep, wdep, 1, .false., &
  1149. aop_out_ext, aop_out_a, aop_out_g, status)
  1150. IF_NOTOK_RETURN(status=1)
  1151. gph => gph_dat(region)%data
  1152. allocate(taus_aer (i1:i2, j1:j2, lmr,nwdep)); taus_aer = 0.0
  1153. allocate(taua_aer (i1:i2, j1:j2, lmr,nwdep)); taua_aer = 0.0
  1154. allocate(pmaer (i1:i2, j1:j2, lmr,nwdep)); pmaer = 0.0
  1155. ! ---------------------------------
  1156. ! unpack results from calculate_aop
  1157. ! ---------------------------------
  1158. lvec = 0
  1159. do l = 1, lmr
  1160. do j = j1,j2
  1161. do i = i1,i2
  1162. lvec = lvec + 1
  1163. taus_aer(i,j,l,1:nwdep) = aop_out_ext(lvec,1:nwdep,1) * aop_out_a(lvec,1:nwdep) * (gph(i,j,l+1) - gph(i,j,l)) ! from 1/m to nondim
  1164. taua_aer(i,j,l,1:nwdep) = aop_out_ext(lvec,1:nwdep,1) * (1.-aop_out_a(lvec,1:nwdep)) * (gph(i,j,l+1) - gph(i,j,l))
  1165. pmaer (i,j,l,1:nwdep) = aop_out_g (lvec,1:nwdep)
  1166. enddo
  1167. enddo
  1168. enddo
  1169. nullify(gph)
  1170. do i=1, nbands_trop
  1171. phot_dat(region)%taus_aer(:,:,:,i,1) = taus_aer(:,:,:,wav_grid(i))
  1172. phot_dat(region)%taua_aer(:,:,:,i,1) = taua_aer(:,:,:,wav_grid(i))
  1173. phot_dat(region)%pmaer (:,:,:,i,1) = pmaer (:,:,:,wav_grid(i))
  1174. phot_dat(region)%taus_aer(:,:,:,i,2) = taus_aer(:,:,:,wav_gridA(i))
  1175. phot_dat(region)%taua_aer(:,:,:,i,2) = taua_aer(:,:,:,wav_gridA(i))
  1176. phot_dat(region)%pmaer (:,:,:,i,2) = pmaer (:,:,:,wav_gridA(i))
  1177. enddo
  1178. phot_dat(region)%naer_av = phot_dat(region)%naer_av + float(ndyn)/float(ndyn_max)
  1179. phot_dat(region)%pmaer_av = phot_dat(region)%pmaer_av + float(ndyn)/float(ndyn_max) * phot_dat(region)%pmaer
  1180. phot_dat(region)%taus_aer_av = phot_dat(region)%taus_aer_av + float(ndyn)/float(ndyn_max) * phot_dat(region)%taus_aer
  1181. phot_dat(region)%taua_aer_av = phot_dat(region)%taua_aer_av + float(ndyn)/float(ndyn_max) * phot_dat(region)%taua_aer
  1182. deallocate(taus_aer)
  1183. deallocate(taua_aer)
  1184. deallocate(pmaer)
  1185. Deallocate(aop_out_ext)
  1186. Deallocate(aop_out_a )
  1187. Deallocate(aop_out_g )
  1188. status = 0
  1189. END SUBROUTINE AEROSOL_INFO_M7
  1190. !EOC
  1191. #endif
  1192. !--------------------------------------------------------------------------
  1193. ! TM5 !
  1194. !--------------------------------------------------------------------------
  1195. !BOP
  1196. !
  1197. ! !IROUTINE: AEROSOL_INFO
  1198. !
  1199. ! !DESCRIPTION: assignment of aerosol optical depths
  1200. !
  1201. ! This is a crude method to provide some average values for the absorption and scattering
  1202. ! terms by background aerosol choice of values defined according to the relative humidity.
  1203. ! Absorption component can be set to zero throughout (M.van Weele, private comm.,2005).
  1204. ! Scattering component chosen to be representative of background aerosol
  1205. ! Moreover there is a choice as the whether the values defined by shettle and fenn are used
  1206. ! This will require a look up table on 1x1,60 layers with indexes 1->4 with respect to
  1207. ! location. At the moment background aerosol is chosen throughout
  1208. !\\
  1209. !\\
  1210. ! !INTERFACE:
  1211. !
  1212. SUBROUTINE AEROSOL_INFO( region )
  1213. !
  1214. ! !USES:
  1215. !
  1216. use dims, only : im, jm, lm, newsrun, ndyn, ndyn_max
  1217. use binas, only : xm_air, xm_h2o,grav
  1218. use global_data, only : mass_dat
  1219. use MeteoData, only : temper_dat, humid_dat, gph_dat, cc_dat, iwc_dat, lwc_dat, phlb_dat
  1220. use MeteoData, only : lsmask_dat
  1221. !
  1222. ! !INPUT PARAMETERS:
  1223. !
  1224. integer, intent(in) :: region
  1225. !
  1226. ! !REVISION HISTORY:
  1227. ! Jun 2005 - JEW -
  1228. ! 26 Apr 2012 - P. Le Sager - adapted for lon-lat MPI domain decomposition
  1229. !
  1230. !EOP
  1231. !------------------------------------------------------------------------
  1232. !BOC
  1233. real, dimension(:,:,:,:,:), allocatable :: taus_aer, taua_aer
  1234. real, dimension(:,:,:,:,:), allocatable :: pmaer
  1235. real, dimension(:,:,:), allocatable :: rhum, dens, part, dz, press_lay
  1236. real, dimension(:,:,:), pointer :: q, phlb, temp, gph, frac, xland
  1237. real :: a_sc, b_sc, a_ab, b_ab, a_g, b_g
  1238. real :: bsa, baa, ga
  1239. integer :: i_type
  1240. integer, dimension(:,:), pointer :: aero_clim
  1241. real :: wv, tr, scale_aero, lay1, lay2
  1242. integer :: i, j, l, k, kboun, i_ref, b, wav, ll, n
  1243. integer :: i1, j1, i2, j2, lmr
  1244. logical :: aerosol, shettle_and_fenn
  1245. real, dimension(8) :: rh_ref = (/0., 50., 70., 80., 90., 95., 98., 99./)
  1246. real, dimension(4) :: pn_ref = (/ 15000., 4000., 20000., 5000./)
  1247. !
  1248. ! different aerosol types:
  1249. ! 1 = rural aerosol
  1250. ! 2 = maritime aerosol
  1251. ! 3 = urban aerosol
  1252. ! 4 = free troposphere aerosol
  1253. !-----------------------------------------------------------------------
  1254. aerosol = .false.
  1255. shettle_and_fenn = .true.
  1256. call Get_DistGrid( dgrid(region), I_STRT=i1, I_STOP=i2, J_STRT=j1, J_STOP=j2 )
  1257. lmr = lm(region)
  1258. allocate(taus_aer(i1:i2, j1:j2, lmr, nbands_trop, ngrid))
  1259. allocate(taua_aer(i1:i2, j1:j2, lmr, nbands_trop, ngrid))
  1260. allocate(pmaer (i1:i2, j1:j2, lmr, nbands_trop, ngrid))
  1261. allocate(rhum (i1:i2, j1:j2, lmr))
  1262. allocate(dens (i1:i2, j1:j2, lmr))
  1263. allocate(part (i1:i2, j1:j2, lmr))
  1264. allocate(dz (i1:i2, j1:j2, lmr))
  1265. allocate(press_lay(i1:i2, j1:j2, lmr))
  1266. ! Initialize values
  1267. taus_aer=0.
  1268. taua_aer=0.
  1269. pmaer =0.
  1270. ! read in met. data
  1271. temp => temper_dat(region)%data ! (i1:i2, j1:j2, 1:lmr)
  1272. q => humid_dat(region)%data ! (i1:i2, j1:j2, 1:lmr)
  1273. phlb => phlb_dat(region)%data !
  1274. gph => gph_dat(region)%data ! (i1:i2, j1:j2, 1:lmr+1)
  1275. frac => cc_dat(region)%data ! (i1:i2, j1:j2, 1:lmr)
  1276. xland => lsmask_dat(region)%data ! (i1:i2, j1:j2, 1)
  1277. aero_clim => phot_dat(region)%aero_surface_clim ! (i1:i2, j1:j2)
  1278. ! initialize values
  1279. scale_aero = 1.0
  1280. ! the land-sea mask is used to ascribe either marine or rural aerosol for the bottom layers
  1281. dz = 0. ; dens = 0. ; rhum = 0.
  1282. phot_dat(region)%taus_aer = 0.
  1283. phot_dat(region)%taua_aer = 0.
  1284. phot_dat(region)%pmaer = 0.
  1285. if (shettle_and_fenn) then
  1286. if(newsrun) then
  1287. do j=j1,j2
  1288. do i=i1,i2
  1289. if(j<=10 .or. j>=80) then
  1290. aero_clim(i,j)=4
  1291. else
  1292. if(xland(i,j,1) < 30.) aero_clim(i,j)=2
  1293. if(xland(i,j,1) >= 30.) aero_clim(i,j)=1
  1294. endif
  1295. enddo
  1296. enddo
  1297. endif
  1298. do l=1,lm(region)
  1299. do j=j1,j2
  1300. do i=i1,i2
  1301. dz(i,j,l) = (gph(i,j,l+1) - gph(i,j,l))
  1302. press_lay(i,j,l) = (phlb(i,j,l) + phlb(i,j,l+1)) * 0.01 * 0.5 ! hPa
  1303. dens(i,j,l) = 7.2427e18 * press_lay(i,j,l)/temp(i,j,l)
  1304. tr=1.-373.15/temp(i,j,l)
  1305. wv=exp((((-.1299*tr-.6445)*tr-1.976)*tr+13.3185)*tr)
  1306. if(frac(i,j,l)<0.95) rhum(i,j,l)=q(i,j,l)*dens(i,j,l)*xm_air/xm_h2o*temp(i,j,l)/(1013.25*wv*7.24e16)
  1307. ! JEW assume saturation when cloud fraction is very high.
  1308. if(frac(i,j,l)>=0.95) rhum(i,j,l)=98.0
  1309. rhum(i,j,l)=min(98.,rhum(i,j,l))
  1310. enddo
  1311. enddo
  1312. enddo
  1313. !
  1314. ! use land-sea mask to ascribe either marine or rural aerosol for different grid cells
  1315. ! in the lower few KM
  1316. !
  1317. do l=1,lm(region)
  1318. do j=j1,j2
  1319. do i=i1,i2
  1320. if(l<5) then
  1321. i_type=aero_clim(i,j)
  1322. elseif(l>=5) then
  1323. i_type=4
  1324. endif
  1325. kboun = 1
  1326. lay1 = (phlb(i,j,l)/phlb(i,j,kboun))**3
  1327. lay2 = (phlb(i,j,l+1)/phlb(i,j,kboun))**3
  1328. if(i_type<4) then
  1329. part(i,j,l) = scale_aero*pn_ref(i_type)*dz(i,j,l)*100.
  1330. kboun = l
  1331. else
  1332. part(i,j,l) = scale_aero*pn_ref(i_type)*0.5*(lay1+lay2)*dz(i,j,l)*100.
  1333. endif
  1334. i_ref = 8
  1335. do k = 1,8
  1336. if(rh_ref(k) < rhum(i,j,l)) i_ref = k
  1337. enddo
  1338. do n=1,ngrid
  1339. do b=1,nbands_trop
  1340. if (n==1) wav=lmid(b)
  1341. if (n==2) wav=lmid_gridA(b)
  1342. a_sc = (sca(wav,i_ref,i_type)-sca(wav,i_ref+1,i_type))/(rh_ref(i_ref)-rh_ref(i_ref+1))
  1343. b_sc = sca(wav,i_ref,i_type)- a_sc*rh_ref(i_ref)
  1344. a_ab = (abs_eff(wav,i_ref,i_type)-abs_eff(wav,i_ref+1,i_type))/(rh_ref(i_ref)-rh_ref(i_ref+1))
  1345. b_ab = abs_eff(wav,i_ref,i_type)- a_ab*rh_ref(i_ref)
  1346. a_g =(g(wav,i_ref,i_type)-g(wav,i_ref+1,i_type))/(rh_ref(i_ref)-rh_ref(i_ref+1))
  1347. b_g =g(wav,i_ref,i_type) - a_g*rh_ref(i_ref)
  1348. bsa = a_sc*rhum(i,j,l) + b_sc
  1349. baa = a_ab*rhum(i,j,l) + b_ab
  1350. ga = a_g*rhum(i,j,l) + b_g
  1351. taus_aer(i,j,l,b,n) = bsa*part(i,j,l)
  1352. taua_aer(i,j,l,b,n) = baa*part(i,j,l)
  1353. if(taus_aer(i,j,l,n,1)>0.) then
  1354. ! do k = 1,nmom
  1355. pmaer(i,j,l,b,n)=ga
  1356. ! enddo
  1357. else
  1358. pmaer(i,j,l,b,n) = 0.
  1359. endif
  1360. enddo !nbands_trop
  1361. enddo !ngrid
  1362. enddo ! l
  1363. enddo ! j
  1364. enddo ! i
  1365. phot_dat(region)%taus_aer = taus_aer
  1366. phot_dat(region)%taua_aer = taua_aer
  1367. phot_dat(region)%pmaer = pmaer
  1368. endif ! shettle and fenn switch
  1369. ! JEW switch for the aerosol absorption and scattering properties
  1370. if (aerosol) then
  1371. do l=1,lm(region)
  1372. do j=j1,j2
  1373. do i=i1,i2
  1374. dens(i,j,l) = 7.2427e18 * press_lay(i,j,l)/temp(i,j,l)
  1375. tr=1.-373.15/temp(i,j,l)
  1376. wv=exp((((-.1299*tr-.6445)*tr-1.976)*tr+13.3185)*tr)
  1377. rhum(i,j,l)=q(i,j,l)*dens(i,j,l)*xm_air/xm_h2o*temp(i,j,l)/(1013.25*wv*7.24e16)
  1378. if(rhum(i,j,l)>40. .and. rhum(i,j,l)<80.) pmaer(i,j,l,:,:) = 0.65
  1379. if(rhum(i,j,l)>=80.) pmaer(i,j,l,:,:) = 0.85
  1380. enddo
  1381. enddo
  1382. enddo
  1383. phot_dat(region)%taus_aer = 3.0e-3
  1384. phot_dat(region)%taua_aer = 1.5e-4
  1385. phot_dat(region)%pmaer = 0.7
  1386. endif
  1387. ! Averages
  1388. phot_dat(region)%naer_av = phot_dat(region)%naer_av + (float(ndyn)/float(ndyn_max))
  1389. phot_dat(region)%pmaer_av = phot_dat(region)%pmaer_av + (float(ndyn)/float(ndyn_max)) * phot_dat(region)%pmaer
  1390. phot_dat(region)%taus_aer_av = phot_dat(region)%taus_aer_av + (float(ndyn)/float(ndyn_max)) * phot_dat(region)%taus_aer
  1391. phot_dat(region)%taua_aer_av = phot_dat(region)%taua_aer_av + (float(ndyn)/float(ndyn_max)) * phot_dat(region)%taua_aer
  1392. ! Done
  1393. deallocate(taus_aer)
  1394. deallocate(taua_aer)
  1395. deallocate(pmaer)
  1396. deallocate(rhum)
  1397. deallocate(dens)
  1398. deallocate(part)
  1399. deallocate(dz)
  1400. deallocate(press_lay)
  1401. nullify(q)
  1402. nullify(temp)
  1403. nullify(phlb)
  1404. nullify(gph)
  1405. nullify(frac)
  1406. nullify(xland)
  1407. nullify(aero_clim)
  1408. END SUBROUTINE AEROSOL_INFO
  1409. !EOC
  1410. !--------------------------------------------------------------------------
  1411. ! TM5 !
  1412. !--------------------------------------------------------------------------
  1413. !BOP
  1414. !
  1415. ! !IROUTINE: SLINGO
  1416. !
  1417. ! !DESCRIPTION: A. Slingo's data for cloud particle radiative properties
  1418. ! (from 'A GCM Parameterization for the Shortwave Properties of Water Clouds'
  1419. ! JAS vol. 46 may 1989 pp 1419-1427)
  1420. !
  1421. ! Called everytime the meteo data is updated to calculate new
  1422. ! cloud optical properties
  1423. !\\
  1424. !\\
  1425. ! !INTERFACE:
  1426. !
  1427. SUBROUTINE SLINGO( region )
  1428. !
  1429. ! !USES:
  1430. !
  1431. use binas, only : xmair, Avog
  1432. use dims, only : im, jm, lm, lmax_conv
  1433. use global_data, only : mass_dat
  1434. use MeteoData, only : gph_dat, lwc_dat, iwc_dat, cc_dat, phlb_dat, temper_dat, lsmask_dat
  1435. !
  1436. ! !INPUT PARAMETERS:
  1437. !
  1438. integer, intent(in) :: region
  1439. !
  1440. ! !REVISION HISTORY:
  1441. ! 26 Apr 2012 - P. Le Sager - adapted for lon-lat MPI domain decomposition
  1442. !
  1443. !EOP
  1444. !------------------------------------------------------------------------
  1445. !BOC
  1446. real :: eff_rad ! effective radius no longer fixed but linked to LWP
  1447. real :: rhodz, tau_c, xsa, press, airn, D_ge
  1448. real :: rclf ! inverse cloud fraction
  1449. real :: clwc, ciwc ! [g/m3]
  1450. real :: lfrac, sfrac ! scaled components due to land and sea fraction
  1451. real,dimension(:,:,:),allocatable :: taua_cld
  1452. real,dimension(:,:,:),allocatable :: taus_cld
  1453. !total scattering optical depth for cloud layer (liquid+cirrus)
  1454. !total absorption optical depth for cloud layer (liquid_cirrus)
  1455. real,dimension(:,:,:),allocatable :: pmcld !phase function (HG)
  1456. !----------------------------Local------------------------------------------
  1457. real,dimension(:,:,:),allocatable :: lwp !cloud liquid water path [g/m^2]
  1458. real,dimension(:,:,:),pointer :: frac, lwc, iwc, gph, phlb, temp, xland
  1459. real, parameter :: factor = 7.24e16*1.e6*xmair*29.2605/avog
  1460. real,dimension(:,:,:), allocatable :: dz, totalwc, global_cloud_reff
  1461. real, dimension(4) :: abar, bbar, cbar, dbar, ebar, fbar
  1462. ! A coefficient for extinction optical depth
  1463. ! B coefficiant for extinction optical depth
  1464. ! C coefficiant for single particle scat albedo
  1465. ! D coefficiant for single particle scat albedo
  1466. ! E coefficiant for asymmetry parameter
  1467. ! F coefficiant for asymmetry parameter
  1468. data abar/ 2.817e-02, 2.682e-02,2.264e-02,1.281e-02/
  1469. data bbar/ 1.305 , 1.346 ,1.454 ,1.641 /
  1470. data cbar/-5.62e-08 ,-6.94e-06 ,4.64e-04 ,0.201 /
  1471. data dbar/ 1.63e-07 , 2.35e-05 ,1.24e-03 ,7.56e-03 /
  1472. data ebar/ 0.829 , 0.794 ,0.754 ,0.826 /
  1473. data fbar/ 2.482e-03, 4.226e-03,6.560e-03,4.353e-03/
  1474. real :: abari, bbari, cbari, dbari, ebari, fbari
  1475. ! A coefficiant for current spectral interval
  1476. ! B coefficiant for current spectral interval
  1477. ! C coefficiant for current spectral interval
  1478. ! D coefficiant for current spectral interval
  1479. ! E coefficiant for current spectral interval
  1480. ! F coefficiant for current spectral interval
  1481. real :: gc, wc, tot, tmp1 ,tmp2, tmp3
  1482. !asymmetry factor
  1483. !single scattering albedo
  1484. !total optical depth of cloud layer
  1485. ! constants for scattering parameterization of Fu (1996)
  1486. real, dimension(7) :: a0, a1
  1487. data a0/-.236447E-03,-.236447E-03,-.266955E-03,-.266955E-03,-.266955E-03,-.258858E-03,.982244E-04/
  1488. data a1/.253817E+01 ,.253817E+01 ,.254719E+01 ,.254719E+01 ,.254719E+01 ,.253815E+01,.250875E+01/
  1489. ! Parameters for computing cloud effective radius according to Martin et al. (JAS 1994)
  1490. real :: denom,numerator
  1491. real, parameter :: d_land=0.43
  1492. real, parameter :: d_sea=0.33
  1493. integer :: i,j,l,k, indxsl, n, i1, i2, j1, j2, lmr
  1494. !----------- START----------
  1495. call Get_DistGrid( dgrid(region), I_STRT=i1, I_STOP=i2, J_STRT=j1, J_STOP=j2 )
  1496. lmr = lm(region)
  1497. !-------------------------------------------------------------------------
  1498. ! Set index for cloud particle properties based on the wavelength,
  1499. ! according to A. Slingo (1989) equations 1-3:
  1500. ! Use index 1 (0.25 to 0.69 micrometers) for visible
  1501. ! Use index 2 (0.69 - 1.19 micrometers) for near-infrared
  1502. ! Use index 3 (1.19 to 2.38 micrometers) for near-infrared
  1503. ! Use index 4 (2.38 to 4.00 micrometers) for near-infrared
  1504. indxsl = 1
  1505. ! Set cloud extinction optical depth, single scatter albedo,
  1506. ! asymmetry parameter, and forward scattered fraction:
  1507. abari = abar(indxsl)
  1508. bbari = bbar(indxsl)
  1509. cbari = cbar(indxsl)
  1510. dbari = dbar(indxsl)
  1511. ebari = ebar(indxsl)
  1512. fbari = fbar(indxsl)
  1513. !
  1514. !--------------------------------------------------------------------------
  1515. ! In the parameterization of Fu(1996) wavelength dependant extinction maybe
  1516. ! calculated using a set of pre-defined constants:
  1517. !
  1518. ! nm a0 a1
  1519. ! 250-300 -.236447E-03 .253817E+01
  1520. ! 300-330 -.266955E-03 .254719E+01
  1521. ! 330-360 -.293599E-03 .254540E+01
  1522. ! 360-400 -.258858E-03 .253815E+01
  1523. ! 400-440 -.106451E-03 .252684E+01
  1524. ! 440-480 .129121E-03 .250410E+01
  1525. ! 480-520 -.954458E-04 .252061E+01
  1526. ! 520-570 -.303108E-04 .251805E+01
  1527. ! 570-640 .982244E-04 .250875E+01
  1528. !
  1529. ! used in Beta=IWC(a0+a1/Dg)
  1530. !--------------------------------------------------------------------------
  1531. allocate(taua_cld(i1:i2, j1:j2, lm(region)))
  1532. allocate(taus_cld(i1:i2, j1:j2, lm(region)))
  1533. allocate(pmcld (i1:i2, j1:j2, lm(region)))
  1534. allocate(lwp (i1:i2, j1:j2, lm(region)))
  1535. allocate(dz (i1:i2, j1:j2, lm(region) ))
  1536. allocate(totalwc (i1:i2, j1:j2, lm(region) ))
  1537. allocate(global_cloud_reff(i1:i2, j1:j2, lm(region) ))
  1538. ! Initialize values
  1539. taua_cld = 0. ; taus_cld = 0. ; pmcld = 0. ; lwp = 0.
  1540. ! assume a baseline cloud radius, required for heterogeneous chemistry
  1541. global_cloud_reff = 6.
  1542. !JEW The ice and water particles are now treated seperately. For cloud the values are taken from slingo
  1543. !JEW the refractive index for ICE is very low below 750nm therefore T~T(scatt).
  1544. iwc => iwc_dat (region)%data ! (i1:i2, j1:j2, 1:lmr)
  1545. frac => cc_dat (region)%data ! (i1:i2, j1:j2, 1:lmr)
  1546. gph => gph_dat (region)%data ! (i1:i2, j1:j2, 1:lmr+1)
  1547. lwc => lwc_dat (region)%data ! (i1:i2, j1:j2, 1:lmr)
  1548. phlb => phlb_dat (region)%data !
  1549. temp => temper_dat(region)%data ! (i1:i2, j1:j2, 1:lmr)
  1550. xland => lsmask_dat(region)%data ! (i1:i2, j1:j2, 1)
  1551. ! No negative input
  1552. lwc=max(0.,lwc)
  1553. iwc=max(0.,iwc)
  1554. ! read in new cloud data to feed into the slingo routine. The values of lwc are zero in top levels so limit layer loop
  1555. do l=1,lmax_conv
  1556. do j=j1,j2
  1557. do i=i1,i2
  1558. press = (phlb(i,j,l) + phlb(i,j,l+1)) * 0.5 ! Pa
  1559. dz(i,j,l) = ( gph(i,j,l+1) - gph(i,j,l) )
  1560. ! We have replaced the parameterization of McFarlane et al. (1992) with that of Martin et al. (1994).
  1561. ! In the IFS a crude filter of 0.5 for the land fraction is used with the CNN(Marine) = 40.
  1562. ! and CNN(Land) = 900. Here we weight the final CCN with the actual land fraction so as to introduce
  1563. ! more variability.
  1564. ! JEW : there is a potential problem in that nonzero cloud fractions may occur with no associated lwc value
  1565. ! on TM5 vertical resolutions, therefore a filter w.r.t. both fraction and cloud liquid path are included.
  1566. if( lwc(i,j,l) > 1.e-10 .and. frac(i,j,l) > 0.02 ) then
  1567. ! JEW calculate total water path locally : convert to g/m(2) for slingo input
  1568. ! following the conversion procedure for LWC from ECMWF input from old cloud subroutine.
  1569. ! Included comments from old code to explain the prefactor in rhodz:
  1570. ! rho = airn*1e6*xmair/avo ! g/m3
  1571. ! dz = 29.2605*temp(i,j,l)* alog(phlb(i,j,l)/(1.0+phlb(i,j,l+1)))
  1572. rclf=1./frac(i,j,l)
  1573. rhodz = factor*press*alog(phlb(i,j,l)/(1.0+phlb(i,j,l+1)))
  1574. ! VH - scale lwc and lwp with cloud fraction, to compute cloud optical properties
  1575. ! and droplet radius representative for cloudy part only
  1576. lwp(i,j,l) = rhodz*lwc(i,j,l)*rclf
  1577. airn=7.24e16*press/temp(i,j,l) !#/cm3
  1578. clwc=lwc(i,j,l)*xmair*airn*1.e6/avog ! g/m3
  1579. ! Effective radius: Martin et al. (JAS 1994) parametrization
  1580. !if (xland(i,j,l) > 50.) then
  1581. ! Above land use ccn of ~900
  1582. ! D_land = 0.43
  1583. ! CCNLND = 900
  1584. ! NTOT=-2.10E-04*CCNLAND*CCNLAND+0.568*CCNLAND-27.9
  1585. ! DENOM=4.0*pi*rho_w*NTOT*(1.0+D_land*D_land)**3
  1586. ! with rho_w in g/m3.
  1587. denom = 6547.52*1.e6
  1588. numerator=3.0*clwc*rclf*(1.0+3.0*D_land*D_land)**2
  1589. lfrac=0.
  1590. if((numerator/denom) > 1.e-20) lfrac=1.e4*exp(0.333*LOG(numerator/denom))
  1591. !else
  1592. ! Maritime air mass
  1593. ! D_sea = 0.333
  1594. ! CCNSEA = 40
  1595. ! NTOT=-1.15E-03*CCNSEA*CCNSEA+0.963*CCNSEA+5.30
  1596. ! DENOM=4.0*pi*rho_w*NTOT*(1.0+D_sea*D_sea)**3
  1597. denom = 723.210*1.e6
  1598. numerator=3.0*clwc*rclf*(1.0+3.0*D_sea*D_sea)**2
  1599. sfrac=0.
  1600. if((numerator/denom) > 1.e-20) sfrac=1.e4*exp(0.333*LOG(numerator/denom))
  1601. !endif
  1602. ! TvN: Is this the best way to average land and sea?
  1603. eff_rad=(xland(i,j,1)/100.*lfrac)+(1.0-xland(i,j,1)/100.)*sfrac
  1604. ! prevent the radius of non-precipitation clouds being too big
  1605. ! these size limits are equal to those chosen in the IFS
  1606. eff_rad=min(16.0,max(eff_rad, 4.0))
  1607. tmp1 = abari + bbari/eff_rad
  1608. tmp2 = 1. - cbari - dbari*eff_rad
  1609. tmp3 = fbari*eff_rad
  1610. ! Do not let single scatter albedo be 1; delta-eddington solution
  1611. ! for non-conservative case:
  1612. wc = min(tmp2,.999999)
  1613. tot = lwp(i,j,l)*tmp1
  1614. gc = ebari + tmp3
  1615. ! JEW : no wavelength dependence for the absorption or scattering effects due to liquid clouds !!!!!
  1616. taua_cld(i,j,l) = (1.-wc)*tot
  1617. taus_cld(i,j,l) = wc*tot
  1618. ! avoid possible negatives due to input data
  1619. taua_cld(i,j,l)=max(0.0,taua_cld(i,j,l))
  1620. global_cloud_reff(i,j,l) = eff_rad
  1621. ! JEW : for calculating the scattering component due to ice
  1622. if(iwc(i,j,l) > 1.e-10) then
  1623. airn=7.24e16*press/temp(i,j,l)
  1624. ! iwc in g/m3 from TM5 definition
  1625. ciwc=iwc(i,j,l)*xmair*airn*1.e6/avog
  1626. ! Following Eq. (5) of Heymsfield and McFarquhar (JAS, 1996),
  1627. ! the cross-sectional surface area A (km^-1)
  1628. ! can be approximated by:
  1629. ! 10*IWC^0.9, where IWC in g/m3.
  1630. ! Thus, A in m^2/m^3 = m^-1 is given by 0.01 IWC^0.9,
  1631. ! which implies that xsa is in cm^-1.
  1632. xsa=1.0e-4*ciwc**0.9
  1633. !
  1634. ! calculate D_ge using the relationship in Fu (1996) where Beta=extinction co-efficient (m-1)
  1635. !
  1636. ! D_ge = 2(3)**0.5/(3 Rho)*(IWC/xsa)
  1637. !
  1638. ! The above relationship is for instance given in Table 1
  1639. ! in McFarquhar and Heymsfield (JAS, 1997).
  1640. ! Below an ice density in units g/cm^3 and
  1641. ! IWC in g/m^3 are used.
  1642. ! The conversion of IWC from g/m^3 to g/cm^3
  1643. ! gives a factor 10^6, which together with
  1644. ! the division by 100 converts from cm to um.
  1645. !
  1646. D_ge=(2.*1.73205/(3.*0.917))*(ciwc/xsa)
  1647. ! convert to uM
  1648. D_ge=D_ge/100.
  1649. !
  1650. ! Cirrus scattering has a wavelength dependancy
  1651. !
  1652. taus_cld(i,j,l)=taus_cld(i,j,l)+((ciwc*(a0(3)+(a1(3)/D_ge)))*dz(i,j,l))
  1653. endif
  1654. if (taus_cld(i,j,l) > 0.) then
  1655. pmcld(i,j,l)=gc
  1656. else
  1657. pmcld(i,j,l)=0.
  1658. end if
  1659. end if
  1660. enddo
  1661. enddo
  1662. enddo
  1663. ! Store optical depths and phase functions
  1664. phot_dat(region)%pmcld = pmcld
  1665. phot_dat(region)%taus_cld = taus_cld
  1666. phot_dat(region)%taua_cld = taua_cld
  1667. phot_dat(region)%cloud_reff = global_cloud_reff
  1668. ! Averages
  1669. phot_dat(region)%lwp_av = lwp
  1670. phot_dat(region)%cfr_av = phot_dat(region)%cfr_av + frac
  1671. phot_dat(region)%reff_av = global_cloud_reff
  1672. phot_dat(region)%ncloud_av = phot_dat(region)%ncloud_av + 1
  1673. phot_dat(region)%pmcld_av = phot_dat(region)%pmcld_av + pmcld
  1674. phot_dat(region)%taus_cld_av = phot_dat(region)%taus_cld_av + taus_cld
  1675. phot_dat(region)%taua_cld_av = phot_dat(region)%taua_cld_av + taua_cld
  1676. nullify(lwc)
  1677. nullify(frac)
  1678. nullify(iwc)
  1679. nullify(gph)
  1680. nullify(phlb)
  1681. nullify(temp,xland)
  1682. deallocate(taua_cld)
  1683. deallocate(taus_cld)
  1684. deallocate(pmcld)
  1685. deallocate(lwp)
  1686. deallocate(dz)
  1687. deallocate(totalwc)
  1688. deallocate(global_cloud_reff)
  1689. END SUBROUTINE SLINGO
  1690. !EOC
  1691. !--------------------------------------------------------------------------
  1692. ! TM5 !
  1693. !--------------------------------------------------------------------------
  1694. !BOP
  1695. !
  1696. ! !IROUTINE: UPDATE_CSQY
  1697. !
  1698. ! !DESCRIPTION:
  1699. !\\
  1700. !\\
  1701. ! !INTERFACE:
  1702. !
  1703. SUBROUTINE UPDATE_CSQY( region )
  1704. !
  1705. ! !USES:
  1706. !
  1707. use dims
  1708. use binas, only: Avog, xmair, grav
  1709. use global_data, only: mass_dat
  1710. use MeteoData, only: phlb_dat, temper_dat, m_dat
  1711. use chem_param, only: xmo3, fscale, iacet
  1712. !
  1713. ! !INPUT PARAMETERS:
  1714. !
  1715. integer, intent(in) :: region
  1716. !
  1717. ! !REVISION HISTORY:
  1718. ! 26 Apr 2012 - P. Le Sager - adapted for lon-lat MPI domain decomposition
  1719. !
  1720. !EOP
  1721. !------------------------------------------------------------------------
  1722. !BOC
  1723. integer :: i,j,l
  1724. real,dimension(:,:,:),pointer :: temperature
  1725. real,dimension(:,:,:),pointer :: phlb
  1726. real,dimension(:,:,:),pointer :: mass
  1727. real,dimension(:,:,:,:),pointer :: qyacet
  1728. real,dimension(:,:,:),allocatable :: density
  1729. real,dimension(:,:,:),allocatable :: pressure
  1730. integer :: k, m, table_pos, i1, j1, i2, j2, lmr
  1731. real :: xa, xb, te, chix, ww, temper, ptorr
  1732. real :: phi, qy, tt, alpha, delta_t
  1733. real,dimension(maxwav) :: rd, phi0
  1734. real :: a0, b0, a1, b1, a2, b2, a3, b3, c3, a4, b4
  1735. real :: term,term1,term2,t_scale
  1736. real :: airn,aird
  1737. integer,parameter :: n_ind =34 ! number of increments in the look-up table
  1738. real,dimension(n_ind) :: temp_ind
  1739. phlb => phlb_dat(region)%data
  1740. temperature => temper_dat(region)%data
  1741. qyacet => phot_dat(region)%qy_c2o3
  1742. mass => m_dat(region)%data
  1743. call Get_DistGrid( dgrid(region), I_STRT=i1, I_STOP=i2, J_STRT=j1, J_STOP=j2 )
  1744. lmr = lm(region)
  1745. allocate(density (i1:i2, j1:j2, lmr))
  1746. allocate(pressure(i1:i2, j1:j2, lmr))
  1747. !---------------------------------------------------------------------------------
  1748. ! Only update the temperature sensitive regions of the spectral
  1749. ! grids. That is, initialize values values to either zero or cs_ values for selected
  1750. ! species.
  1751. !---------------------------------------------------------------------------------
  1752. do k = 1,lm(region)
  1753. do j = j1,j2
  1754. do i = i1,i2
  1755. ! define air pressure
  1756. pressure(i,j,k) = (phlb(i,j,k) + phlb(i,j,k+1))/2
  1757. enddo
  1758. enddo
  1759. enddo
  1760. ! define air density
  1761. density = 7.24e16*pressure/temperature(i1:i2, j1:j2, 1:lmr)
  1762. ! define temperature index array from the lookup table
  1763. do i = 1, 34
  1764. temp_ind(i) = 182.5 + (i-1) * 5.0
  1765. enddo
  1766. !---------------------------------------------------------------------
  1767. ! QUANTUM YIELD OF METHYGLYOXAL S. KOCH and G. K. MOORTGAT
  1768. ! J Phys Chem, 102, 9142-9153, 1998.
  1769. !
  1770. ! JEW: the qy_ch3cocho array has been reduced to 52 bins to represent the pressure.
  1771. ! dep. spectral bins ONLY !!
  1772. !---------------------------------------------------------------------
  1773. ! Calculate co-efficients for METHYGLYOXAL qy outside loop
  1774. phi0 = 1. ; rd = 0.
  1775. ! for wave < 380nm qy is essentially = 1.0.
  1776. do l = 1,39
  1777. if(l<32) then
  1778. phi0(l) = 1
  1779. elseif(l>=32) then
  1780. phi0(l) = 8.15e-9 * exp(7131./wave(l+37)*1.e-7)
  1781. endif
  1782. rd(l) = 7.34e-9 * exp(8793./wave(l+37)*1.e-7)
  1783. enddo
  1784. do l = 40,52
  1785. phi0(l) = 3.63e-7 * exp(5693./wave(l+37)*1.e-7)
  1786. rd(l) = 1.93e4*exp(-5639./wave(l+37)*1.e-7)
  1787. enddo
  1788. do k = 1,lm(region)
  1789. do j = j1,j2
  1790. do i = i1,i2
  1791. ! QUANTUM YIELD OF METHYGLYOXAL JPL 2006 P4-71
  1792. ! CH3COCHO -> CH3C(O)O2 + HO2 + CO (1)
  1793. ! -> CH4 + 2CO (2)
  1794. ! -> CH3CHO + CO (3)
  1795. ! the predominant products are from channel(1) for wav 240-480nm
  1796. ! Pa -> Torr
  1797. !ptorr= (pressure(i,j,k)/100.)*760./1.013*1e-3
  1798. ptorr= (pressure(i,j,k))*0.0075006
  1799. !second absorption band
  1800. do l = 1,39
  1801. qy = (phi0(l) * rd(l))/(rd(l) + ptorr*phi0(l))
  1802. phot_dat(region)%qy_ch3cocho(i,j,k,l) = min(1.0,qy)
  1803. end do
  1804. ! switch to the formulation by Chen et al, JPC, 104, 11126-11131, 2000 for wav > 420nm
  1805. do l = 40,52
  1806. qy = phi0(l)/(1.+(phi0(l)*rd(l)*ptorr))
  1807. phot_dat(region)%qy_ch3cocho(i,j,k,l) = min(1.0,qy)
  1808. enddo
  1809. !
  1810. ! calculate the second photolysis channel for acetone
  1811. !
  1812. do l=26,35
  1813. table_pos=int((temperature(i,j,k)-(temp_ind(1)-0.0*5))/5)+1
  1814. table_pos=min(max(1,table_pos),34) ! bug fix for temperatures below 175.5
  1815. qy=(1-qy_co_look(l,table_pos))/(1.0+a1_acet(l,table_pos)*density(i,j,k))
  1816. qyacet(i,j,k,l)=max(0.0,qy)
  1817. enddo
  1818. do l=36,89
  1819. ! determine constants for calculating qy
  1820. table_pos=int((temperature(i,j,k)-(temp_ind(1)-0.0*5))/5)+1
  1821. table_pos=min(max(1,table_pos),34) ! bug fix for temperatures below 175.5
  1822. a1=1.0+(density(i,j,k)*a4_acet(l,table_pos))+a3_acet(l,table_pos)
  1823. a2=1.0+(density(i,j,k)*a2_acet(l,table_pos))+a3_acet(l,table_pos)
  1824. a4=1.0+(density(i,j,k)*a4_acet(l,table_pos))
  1825. qy=(1-qy_co_look(l,table_pos))*(a1/(a2*a4))
  1826. qyacet(i,j,k,l)=max(0.0,qy)
  1827. enddo
  1828. end do ! longitude
  1829. end do ! latitude
  1830. end do ! level
  1831. deallocate(density)
  1832. deallocate(pressure)
  1833. nullify(temperature)
  1834. nullify(mass)
  1835. nullify(phlb)
  1836. nullify(qyacet)
  1837. END SUBROUTINE UPDATE_CSQY
  1838. !EOC
  1839. !--------------------------------------------------------------------------
  1840. ! TM5 !
  1841. !--------------------------------------------------------------------------
  1842. !BOP
  1843. !
  1844. ! !IROUTINE: PIFM
  1845. !
  1846. ! !DESCRIPTION:
  1847. ! *
  1848. ! PRACTICAL IMPROVED FLUX METHOD (PIFM) *
  1849. ! to calculate actinic fluxes *
  1850. ! Zdunkowski,Welch,Korb: Beitr. Phys. Atmosph. vol. 53, p. 147 ff *
  1851. ! *
  1852. ! This version is not suitable for calculation for conserving *
  1853. ! scattering (W0=1). W0 is limited to W0 <= 1. - 1.E-15. *
  1854. ! For W0 = 1, AL(4) and AL(5) has to be calculated differently. *
  1855. !\\
  1856. !\\
  1857. ! !INTERFACE:
  1858. !
  1859. SUBROUTINE PIFM(region, zangle, alb, cst_o3_col, dv2, dv3, taua_aer_col, taus_aer_col, paer_col, fact)
  1860. !
  1861. ! !USES:
  1862. !
  1863. use dims, only : lm
  1864. use binas, only : pi
  1865. !
  1866. ! !INPUT PARAMETERS:
  1867. !
  1868. integer, intent(in) :: region
  1869. real, intent(in) :: zangle ! zenith angle
  1870. real, intent(in) :: alb ! albedo
  1871. real, dimension(lm(region),maxwav) :: cst_o3_col ! temp dep o3 cross sections
  1872. real, dimension(lm(region)) :: dv2, dv3 ! differential column info
  1873. real, dimension(lm(region),nbands_trop,ngrid) :: taua_aer_col, taus_aer_col ! optical depth aerosols
  1874. real, dimension(lm(region),nbands_trop,ngrid) :: paer_col
  1875. real, dimension(lm(region),nbands_trop) :: fact !actinic flux
  1876. !
  1877. ! !REVISION HISTORY:
  1878. !
  1879. !EOP
  1880. !------------------------------------------------------------------------
  1881. !BOC
  1882. real, dimension(3*(lm(region)+1)) :: rw, & !flux array for cloudy sky
  1883. rf !flux array for clear sky
  1884. real, dimension(lm(region)) :: tu1, & !parallel solar flux
  1885. tu2 !matrix coefficient
  1886. real, dimension(lm(region),5) :: al
  1887. real, dimension(lm(region)+1,nbands_trop):: sd, fd, fu
  1888. real, dimension(0:nmom) :: pray ! phase functions
  1889. real :: taus, taua, tautot, g
  1890. real, dimension(lm(region),nbands_trop) :: taua_clr, taus_clr ! optical depth clear sky
  1891. ! diffusivity factor
  1892. real, parameter :: u = 2., delu0 = 1.e-3, resonc = 1.e-6
  1893. integer :: grid, l, k, n, nl, k3, maxlev, maxlay2, maxlev3
  1894. real :: p1, w0, f, b0, bu0
  1895. real :: eps, factor, ueps2, smooth1, smooth2
  1896. real :: alph1, alph2, alph3, alph4
  1897. real :: gam1, gam2, e, rm, tds1, td1, td2
  1898. real :: fact_bot, fact_top, arg
  1899. !downward diffuse flux
  1900. !upward diffuse flux
  1901. real :: a, b, c, gamma, u0
  1902. real :: cs_o2
  1903. ! internal integer variable
  1904. maxlev = lm(region) + 1
  1905. maxlay2 = 2 * lm(region)
  1906. maxlev3 = 3 * maxlev
  1907. ! intitialise arrays
  1908. al = 0. ; fd = 0. ; sd = 0. ; fu = 0. ; tu1 = 0. ; tu2 = 0. ; rw = 0. ; rf = 0.
  1909. !initialise output (actinic flux)
  1910. fact = 0.
  1911. !-----correction of the air mass factor---------------------------------
  1912. ! F. Kasten and T. Young, Revised optical air mass tabels and
  1913. ! approximation formula (1989) Aplied Optics Vol 28, No. 22 P. 4735
  1914. ! and J. Lenoble, atmospheric radiative transfer (1993), P. 236
  1915. a = 0.50572 ; b = 6.07995 ; c = 1.63640
  1916. ! define air mass factor in mu
  1917. gamma = 90. - zangle
  1918. u0 = sin(gamma*pi/180.) + a *(gamma+b)**(-c)
  1919. u0 = min(1.,u0)
  1920. !===================================================================
  1921. ! calculation of the matrix coefficients a1,...,a5
  1922. !===================================================================
  1923. ! determine phase functions
  1924. pray(0) = 1. ; pray(1) = 0. ; pray(2)=0.1 ; pray(3:nmom) = 0.
  1925. ! reverse order for input parameters
  1926. dv2(1:lm(region)) = dv2(lm(region):1:-1)
  1927. dv3(1:lm(region)) = dv3(lm(region):1:-1)
  1928. ! do not calculate for band #1
  1929. do l = 1,nbands_trop
  1930. if (zangle <= 71.) then
  1931. nl = lmid(l)
  1932. grid = 1
  1933. cs_o2 = 7.322e-24
  1934. elseif (zangle > 71. .and. zangle<=sza_limit) then
  1935. nl = lmid_gridA(l)
  1936. grid = 2
  1937. cs_o2 = 6.608e-24
  1938. endif
  1939. ! reverse order for input parameters
  1940. cst_o3_col(1:lm(region),nl) = cst_o3_col(lm(region):1:-1,nl)
  1941. taus_aer_col(1:lm(region),l,grid) = taus_aer_col(lm(region):1:-1,l,grid)
  1942. taua_aer_col(1:lm(region),l,grid) = taua_aer_col(lm(region):1:-1,l,grid)
  1943. paer_col(1:lm(region),l,grid) = paer_col(lm(region):1:-1,l,grid)
  1944. do k = 1,lm(region)
  1945. ! Calculate optical depth (clear-sky)
  1946. if(nl<18) then
  1947. taua_clr(k,l) = cs_o2*dv2(k) + cst_o3_col(k,nl)*dv3(k)
  1948. else
  1949. taua_clr(k,l) = cst_o3_col(k,nl)*dv3(k)
  1950. endif
  1951. taus_clr(k,l) = cs_ray(nl)*1./0.2095*dv2(k)
  1952. taus = taus_clr(k,l) + taus_aer_col(k,l,grid)
  1953. taua = taua_clr(k,l) + taua_aer_col(k,l,grid)
  1954. tautot = taus + taua
  1955. g = 0.
  1956. if (taus > 0.) &
  1957. g = (paer_col(k,l,grid)* taus_aer_col(k,l,grid) + pray(1)* taus_clr(k,l) )/taus
  1958. if (tautot .ne. 0.) then
  1959. w0=taus / tautot
  1960. else
  1961. w0=0.
  1962. end if
  1963. w0 = min(w0,1.-1.e-15)
  1964. ! P1: first expansion coefficient of the phase function
  1965. p1=3.*g
  1966. ! F: fraction of radiation contained in diffraction peak
  1967. f=g**2
  1968. ! B0: fractional mean backward scattering coefficient
  1969. ! of diffuse light
  1970. ! BU0: backward scattering coefficient of primary scattered
  1971. ! parallel solar light
  1972. ! for small P1 SMOOTH1,SMOOTH2 manage the smooth change of B0
  1973. ! BU0 to 0
  1974. if (p1 <= 0.1) then
  1975. smooth1=1.33333333-p1*3.3333333
  1976. smooth2=10.*p1
  1977. else
  1978. smooth1=1.
  1979. smooth2=1.
  1980. end if
  1981. b0=(3.-p1)/8. *smooth1
  1982. bu0=0.5-u0/4.*(p1-3.*f)/(1.-f) *smooth2
  1983. ! alpha coefficient
  1984. alph1=u*(1.-(1.-b0)*w0)
  1985. alph2=u*b0*w0
  1986. alph3=w0*bu0*(1-f)
  1987. alph4=w0*(1.-bu0)*(1-f)
  1988. ! epsilon and gamma coefficient
  1989. eps=sqrt(alph1**2-alph2**2)
  1990. factor=1.-w0*f
  1991. ! check for resonance condition in GAM1 and GAM2, if fulfil th
  1992. ! chance U0(J) and calculate UEPS2, BU0, ALPH3, ALPH4 again.
  1993. ueps2=(u0 *eps)**2
  1994. arg = ueps2-factor**2
  1995. if (arg < 0.) arg = -1. * arg
  1996. if (arg < resonc) then
  1997. if (ueps2.lt.factor**2) then
  1998. u0 = u0 - delu0
  1999. else
  2000. u0 = u0 + delu0
  2001. end if
  2002. ueps2=(u0 * eps)**2
  2003. bu0=0.5-u0/4.*(p1-3.*f)/(1.-f) *smooth2
  2004. alph3=w0*bu0*(1-f)
  2005. alph4=w0*(1.-bu0)*(1-f)
  2006. end if
  2007. gam1=( factor*alph3-u0 * (alph1*alph3+alph2*alph4) ) * &
  2008. 1/(factor**2-ueps2)
  2009. gam2=(-factor*alph4-u0 * (alph1*alph4+alph2*alph3) ) * &
  2010. 1/(factor**2-ueps2)
  2011. e=exp(-eps*tautot)
  2012. rm=alph2/(alph1+eps)
  2013. al(k,4)=e*(1.-rm**2.)/(1.-e**2. * rm**2.)
  2014. al(k,5)=rm*(1.-e**2.)/(1.-e**2. * rm**2.)
  2015. al(k,1)=exp(-factor*tautot/u0)
  2016. al(k,2)=-al(k,4)*gam2-al(k,5)*gam1*al(k,1) + gam2*al(k,1)
  2017. al(k,3)=-al(k,5)*gam2-al(k,4)*gam1*al(k,1) + gam1
  2018. enddo
  2019. !====================================================================
  2020. ! matrix inversion
  2021. !====================================================================
  2022. ! direct solution of the first four equations
  2023. rf(1) = u0 * flux(nl)
  2024. rf(2) = 0.
  2025. ! 5th to 10th equation: bring matrix elements on the left of the m
  2026. ! diagonal to the rhs: save elements on the right of the main
  2027. ! diagonal in array -tu(l,1)
  2028. rf(3) = al(1,3) * rf(1)
  2029. rf(4) = al(1,1) * rf(1)
  2030. rf(5) = al(1,2) * rf(1)
  2031. tu1(1) = al(1,4)
  2032. tu2(1) = al(1,5)
  2033. ! blocks of 6 equations: eliminate left matrix elements, save righ
  2034. ! matrix elements in array -tu(l,i),
  2035. ! calculate rhs.
  2036. do k=2,lm(region)
  2037. k3=3*k
  2038. td1 = 1./(1.-al(k,5)*tu2(k-1))
  2039. td2 = al(k,4)*tu2(k-1)
  2040. tu1(k) = td1*al(k,4)
  2041. tu2(k) = al(k,5) + td2*tu1(k)
  2042. rf(k3) = td1 * (al(k,3)*rf(k3-2) + al(k,5)*rf(k3-1))
  2043. rf(k3+1)= al(k,1)*rf(k3-2)
  2044. rf(k3+2)= al(k,2)*rf(k3-2) + al(k,4)*rf(k3-1)+td2*rf(k3)
  2045. end do
  2046. ! last two equations: the same as before
  2047. tds1 = 1. / (1.-alb*tu2(lm(region)))
  2048. rf(maxlev3) = tds1 * (alb * rf(maxlev3-2)+ &
  2049. alb * rf(maxlev3-1))
  2050. ! now we have created an upper triangular matrix the elements of
  2051. ! are -tu(l,i), 0, or 1 (in the main diagonal). the 0 and 1 eleme
  2052. ! are not stored in an array. let us solve the system now and sto
  2053. ! results in the arrays rf (fluxes clear sky) and rw (fluxes clou
  2054. do k=lm(region),1,-1
  2055. k3=3*k
  2056. rf(k3+2) = rf(k3+2) + tu2(k)*rf(k3+3)
  2057. rf(k3) = rf(k3) + tu1(k)*rf(k3+3)
  2058. sd(k+1,l) = rf(k3+1)
  2059. fd(k+1,l) = rf(k3+2)
  2060. fu(k+1,l) = rf(k3+3)
  2061. end do
  2062. sd(1,l) = rf(1)
  2063. fd(1,l) = rf(2)
  2064. fu(1,l) = rf(3)
  2065. ! calculate the actinic flux
  2066. fact_top = sd(1,l)/u0 + u * fd(1,l) + u * fu(1,l)
  2067. do k = 1,lm(region)
  2068. fact_bot = sd(k+1,l)/u0 + &
  2069. u * fd(k+1,l) + u * fu(k+1,l)
  2070. fact(k,l) = max(0. ,(fact_top + fact_bot)/2.)
  2071. fact_top = fact_bot
  2072. end do
  2073. ! swap vertical levels to the default order of the model
  2074. fact(1:lm(region),l) = fact(lm(region):1:-1,l)
  2075. cst_o3_col(1:lm(region),nl) = cst_o3_col(lm(region):1:-1,nl)
  2076. enddo ! spectral bands (nbands)
  2077. END SUBROUTINE PIFM
  2078. !EOC
  2079. !--------------------------------------------------------------------------
  2080. ! TM5 !
  2081. !--------------------------------------------------------------------------
  2082. !BOP
  2083. !
  2084. ! !IROUTINE: PIFM_RAN
  2085. !
  2086. ! !DESCRIPTION: Pifm method including random overlap method for clouds
  2087. !
  2088. !************************************************************************
  2089. !* PRACTICAL IMPROVED FLUX METHOD (PIFM) *
  2090. !* to calculate actinic fluxes *
  2091. !* Zdunkowski,Welch,Korb: Beitr. Phys. Atmosph. vol. 53, p. 147 ff *
  2092. !* *
  2093. !* Cloud effects added using the method of : *
  2094. !* Geleyn and Hollingworth, Contribs. Atms.Phys,52(1),1979 *
  2095. !* *
  2096. !************************************************************************
  2097. !* This version is not suitable for calculation for conserving *
  2098. !* scattering (W0=1). W0 is limited to W0 .le. 1. - 1.E-15. *
  2099. !* For W0 = 1, AL(4) and AL(5) has to be calculated differently. *
  2100. !************************************************************************
  2101. !\\
  2102. !\\
  2103. ! !INTERFACE:
  2104. !
  2105. SUBROUTINE PIFM_RAN(region, zangle, alb, cst_o3_col, dv2, dv3, &
  2106. taua_cld_col, taus_cld_col, pcld_col, &
  2107. taua_aer_col, taus_aer_col, paer_col, fact, frac )
  2108. !
  2109. ! !USES:
  2110. !
  2111. use dims, only : lm
  2112. use binas, only : pi
  2113. !
  2114. ! !INPUT PARAMETERS:
  2115. !
  2116. integer, intent(in) :: region
  2117. real, intent(in) :: zangle ! zenith angle
  2118. real, intent(in) :: alb ! albedo
  2119. real,dimension(lm(region)) :: frac ! cloud fraction per layer (0->1)
  2120. real,dimension(lm(region),maxwav) :: cst_o3_col ! o3 cross sections
  2121. real,dimension(lm(region)) :: dv2, dv3 ! differential column info
  2122. real,dimension(lm(region)) :: taua_cld_col, taus_cld_col ! optical depth clouds
  2123. real,dimension(lm(region),nbands_trop) :: taua_clr_col, taus_clr_col ! optical depth clear sky
  2124. real,dimension(lm(region),nbands_trop,ngrid) :: taua_aer_col, taus_aer_col ! optical depth aerosols
  2125. real,dimension(lm(region),nbands_trop) :: fact ! actinic flux
  2126. real,dimension(lm(region),nbands_trop,ngrid) :: paer_col ! aerosol phase functions
  2127. real,dimension(lm(region)) :: pcld_col ! cloud phase functions
  2128. real,dimension(0:nmom) :: pray ! rayleigh phase function
  2129. !
  2130. ! !REVISION HISTORY:
  2131. !
  2132. !EOP
  2133. !------------------------------------------------------------------------
  2134. !BOC
  2135. real,dimension(3*(lm(region)+1)) :: rw, & ! flux array for cloudy sky
  2136. rf ! flux array for clear sky
  2137. real,dimension(lm(region)) :: tu1, & ! parallel solar flux
  2138. tu2 ! matrix coefficient
  2139. real,dimension(lm(region),5) :: al
  2140. real,dimension(lm(region)+1,nbands_trop):: sd, fd, fu
  2141. real,dimension(lm(region),nbands_trop) :: TS_PI_CLR,TA_PI_CLR, G_PI_CLR, TS_PI_CLD
  2142. real,dimension(lm(region)) :: TA_PI_CLD, G_PI_CLD
  2143. real :: U,DELU0,RESONC,a,b,c,gamma,u0,cs_o2
  2144. integer :: grid,j,k,l,maxlev,maxlay2,maxlev3,nl,k3
  2145. real :: w0,p1,F,smooth1,smooth2,b0,bu0,alph1,alph2,alph3,alph4,tautot,eps,factor
  2146. real :: rm,gam1,gam2,e,tauscat,td1,td2,tds1,ueps2,g,arg,fact_bot, fact_top
  2147. ! diffusivity factor
  2148. DATA U / 2./
  2149. DATA DELU0 /1.E-3/
  2150. DATA RESONC /1.E-6/
  2151. real :: AL_CLR_1,AL_CLR_2,AL_CLR_3,AL_CLR_4,AL_CLR_5 !matrix coefficient for clear sky
  2152. real :: AL_CLD_1,AL_CLD_2,AL_CLD_3,AL_CLD_4,AL_CLD_5 !matrix coefficient for cloudy sky
  2153. !-----correction of the air mass factor---------------------------------
  2154. ! F. Kasten and T. Young, Revised optical air mass tables and
  2155. ! approximation formula (1989) Aplied Optics Vol 28, No. 22 P. 4735
  2156. ! and J. Lenoble, atmospheric radiative transfer (1993), P. 236
  2157. a = 0.50572 ; b = 6.07995 ; c = 1.63640
  2158. ! define air mass factor in mu
  2159. gamma = 90. - zangle
  2160. u0 = sin(gamma*pi/180.) + a *(gamma+b)**(-c)
  2161. u0 = min(1.,u0)
  2162. !---------------------------------------------------------------------
  2163. ! internal integer variable
  2164. MAXLEV = lm(region) + 1
  2165. MAXLAY2 = 2 * lm(region)
  2166. MAXLEV3 = 3 * MAXLEV
  2167. ! initialize
  2168. fact = 0. ; sd = 0 ; fd = 0. ; fu = 0. ; td1 = 0.
  2169. rf = 0. ; rw = 0. ; al = 0. ; tu1 = 0. ; tu2 = 0.
  2170. ! determine phase functions
  2171. pray(0) = 1. ; pray(1) = 0. ; pray(2)=0.1 ; pray(3:nmom) = 0.
  2172. dv2(1:lm(region)) = dv2(lm(region):1:-1)
  2173. dv3(1:lm(region)) = dv3(lm(region):1:-1)
  2174. frac(1:lm(region)) = frac(lm(region):1:-1)
  2175. taua_cld_col(1:lm(region)) = taua_cld_col(lm(region):1:-1)
  2176. taus_cld_col(1:lm(region)) = taus_cld_col(lm(region):1:-1)
  2177. pcld_col(1:lm(region)) = pcld_col(lm(region):1:-1)
  2178. do l = 1,nbands_trop
  2179. if (zangle <= 71.) then
  2180. nl = lmid(l)
  2181. grid = 1
  2182. cs_o2 = 7.322e-24
  2183. elseif (zangle > 71. .and. zangle<=sza_limit) then
  2184. nl = lmid_gridA(l)
  2185. grid = 2
  2186. cs_o2 = 6.608e-24
  2187. endif
  2188. ! reverse order for input parameters
  2189. cst_o3_col(1:lm(region),nl) = cst_o3_col(lm(region):1:-1,nl)
  2190. taus_aer_col(1:lm(region),l,grid) = taus_aer_col(lm(region):1:-1,l,grid)
  2191. taua_aer_col(1:lm(region),l,grid) = taua_aer_col(lm(region):1:-1,l,grid)
  2192. paer_col(1:lm(region),l,grid) = paer_col(lm(region):1:-1,l,grid)
  2193. ! fill array for absorption and scattering components before performing
  2194. ! calculations.
  2195. do K = 1,lm(region)
  2196. taus_clr_col(k,l) = cs_ray(nl)*1./0.2095*dv2(k)
  2197. if(nl<18) then
  2198. taua_clr_col(k,l) = cs_o2*dv2(k) + cst_o3_col(k,nl)*dv3(k)
  2199. else
  2200. taua_clr_col(k,l) = cst_o3_col(k,nl)*dv3(k)
  2201. endif
  2202. TS_PI_CLR(K,L) = TAUS_CLR_col(K,L)+TAUS_AER_col(K,L,grid)
  2203. TA_PI_CLR(K,L) = TAUA_CLR_col(K,L)+TAUA_AER_col(K,L,grid)
  2204. TS_PI_CLD(K,L) = TAUS_CLD_col(K)
  2205. TA_PI_CLD(K) = TAUA_CLD_col(K)
  2206. IF (TAUS_CLR_col(K,L)+TAUS_AER_col(K,L,grid)>0.) THEN
  2207. G_PI_CLR(K,L) = (PRAY(1)*TAUS_CLR_col(K,L) + &
  2208. PAER_col(k,l,grid)*TAUS_AER_col(K,L,grid))/ &
  2209. (TAUS_CLR_col(K,L)+TAUS_AER_col(K,L,grid))
  2210. ELSE
  2211. G_PI_CLR(K,L) = 0.
  2212. ENDIF
  2213. G_PI_CLD(K) = PCLD_col(k)
  2214. enddo
  2215. do K = 1,lm(region)
  2216. !***** first: clear sky *******************************************
  2217. TAUTOT = TS_PI_CLR(K,L)+TA_PI_CLR(K,L)
  2218. if (tautot /= 0.) then
  2219. W0=TS_PI_CLR(K,L) / TAUTOT
  2220. ELSE
  2221. W0=0.
  2222. ENDIF
  2223. W0 = MIN(W0,1.-1e-15)
  2224. ! P1: first expansion coefficient of the phase function
  2225. P1=3.*G_PI_CLR(K,L)
  2226. ! F: fraction of radiation contained in diffraction peak
  2227. F=G_PI_CLR(K,L)**2
  2228. ! B0: fractional mean backward scattering coefficient of diffuse light
  2229. ! BU0: backward scattering coefficient of primary scattered parallel solar light
  2230. ! for small P1 SMOOTH1,SMOOTH2 manage the smooth change of B0 and
  2231. ! BU0 to 0
  2232. IF (P1<=0.1) THEN
  2233. SMOOTH1=1.33333333-P1*3.3333333
  2234. SMOOTH2=10.*P1
  2235. ELSE
  2236. SMOOTH1=1
  2237. SMOOTH2=1
  2238. ENDIF
  2239. B0=(3.-P1)/8. *SMOOTH1
  2240. BU0=0.5-U0/4.*(P1-3.*F)/(1.-F) *SMOOTH2
  2241. ! alpha coefficient
  2242. ALPH1=U*(1.-(1.-B0)*W0)
  2243. ALPH2=U*B0*W0
  2244. ALPH3=W0*BU0*(1-F)
  2245. ALPH4=W0*(1.-BU0)*(1-F)
  2246. ! epsilon and gamma coefficient
  2247. EPS=SQRT(ALPH1**2-ALPH2**2)
  2248. FACTOR=1.-W0*F
  2249. ! check for resonance condition in GAM1 and GAM2, if fulfil then
  2250. ! chance U0 and calculate UEPS2, BU0, ALPH3, ALPH4 again.
  2251. UEPS2=(U0*EPS)**2
  2252. arg = ueps2-factor**2
  2253. if (arg < 0.) then
  2254. arg = -1. * arg
  2255. endif
  2256. if (arg < resonc) then
  2257. IF(UEPS2.LT.FACTOR**2) THEN
  2258. U0=U0-DELU0
  2259. ELSE
  2260. U0=U0+DELU0
  2261. ENDIF
  2262. UEPS2=(U0*EPS)**2
  2263. BU0=0.5-U0/4.*(P1-3.*F)/(1.-F) *SMOOTH2
  2264. ALPH3=W0*BU0*(1-F)
  2265. ALPH4=W0*(1.-BU0)*(1-F)
  2266. ENDIF
  2267. GAM1=( FACTOR*ALPH3-U0*(ALPH1*ALPH3+ALPH2*ALPH4) ) * &
  2268. & 1/(FACTOR**2-UEPS2)
  2269. GAM2=(-FACTOR*ALPH4-U0*(ALPH1*ALPH4+ALPH2*ALPH3) ) * &
  2270. & 1/(FACTOR**2-UEPS2)
  2271. E=EXP(-EPS*TAUTOT)
  2272. RM=ALPH2/(ALPH1+EPS)
  2273. AL_CLR_4= E*(1-RM**2)/(1-E**2 * RM**2)
  2274. AL_CLR_5= RM*(1-E**2)/(1-E**2 * RM**2)
  2275. AL_CLR_1= EXP(-FACTOR*TAUTOT/U0)
  2276. AL_CLR_2=-AL_CLR_4*GAM2-AL_CLR_5*GAM1* &
  2277. & AL_CLR_1+GAM2*AL_CLR_1
  2278. AL_CLR_3=-AL_CLR_5*GAM2-AL_CLR_4*GAM1* &
  2279. & AL_CLR_1+GAM1
  2280. !******************* second: cloudy sky *****************************
  2281. ! For ECMWF input there is the possibility that cloud fraction occurs without a
  2282. ! corresponding value for lwc
  2283. IF( FRAC(K) > 0.02 .and. TS_PI_CLD(K,L) > 1.e-5 ) THEN
  2284. TAUSCAT = TS_PI_CLR(K,L) + TAUS_CLD_col(K)
  2285. TAUTOT = TA_PI_CLR(K,L) + TAUA_CLD_col(K)+TAUSCAT
  2286. G = G_PI_CLD(K)*TAUS_CLD_col(K)/TAUSCAT
  2287. IF (TAUTOT > 0.) THEN
  2288. W0=TAUSCAT/TAUTOT
  2289. ELSE
  2290. W0=0.
  2291. ENDIF
  2292. W0 = MIN(W0,1.-1e-15)
  2293. P1=3.*G
  2294. F=G**2
  2295. IF (P1<0.1) THEN
  2296. SMOOTH1=1.33333333-P1*3.3333333
  2297. SMOOTH2=10.*P1
  2298. ELSE
  2299. SMOOTH1=1
  2300. SMOOTH2=1
  2301. ENDIF
  2302. B0=(3.-P1)/8. *SMOOTH1
  2303. BU0=0.5-U0/4.*(P1-3.*F)/(1.-F) *SMOOTH2
  2304. ALPH1=U*(1.-(1.-B0)*W0)
  2305. ALPH2=U*B0*W0
  2306. ALPH3=W0*BU0*(1-F)
  2307. ALPH4=W0*(1.-BU0)*(1-F)
  2308. EPS=SQRT(ALPH1**2-ALPH2**2)
  2309. FACTOR=1.-W0*F
  2310. UEPS2=(U0*EPS)**2
  2311. arg = ueps2-factor**2
  2312. if (arg < 0.) then
  2313. arg = -1. * arg
  2314. endif
  2315. if (arg < resonc) then
  2316. IF(UEPS2.LT.FACTOR**2) THEN
  2317. U0=U0-DELU0
  2318. ELSE
  2319. U0=U0+DELU0
  2320. ENDIF
  2321. UEPS2=(U0*EPS)**2
  2322. BU0=0.5-U0/4.*(P1-3.*F)/(1.-F) *SMOOTH2
  2323. ALPH3=W0*BU0*(1-F)
  2324. ALPH4=W0*(1.-BU0)*(1-F)
  2325. ENDIF
  2326. GAM1=( FACTOR*ALPH3-U0*(ALPH1*ALPH3+ALPH2*ALPH4) ) * 1/(FACTOR**2-UEPS2)
  2327. GAM2=(-FACTOR*ALPH4-U0*(ALPH1*ALPH4+ALPH2*ALPH3) ) * 1/(FACTOR**2-UEPS2)
  2328. E=EXP(-EPS*TAUTOT)
  2329. RM=ALPH2/(ALPH1+EPS)
  2330. AL_CLD_4=E*(1-RM**2)/(1-E**2 * RM**2)
  2331. AL_CLD_5=RM*(1-E**2)/(1-E**2 * RM**2)
  2332. AL_CLD_1=EXP(-FACTOR*TAUTOT/U0)
  2333. AL_CLD_2=-AL_CLD_4*GAM2-AL_CLD_5*GAM1*AL_CLD_1+GAM2*AL_CLD_1
  2334. AL_CLD_3=-AL_CLD_5*GAM2-AL_CLD_4*GAM1*AL_CLD_1+GAM1
  2335. AL(K,1) =(1-FRAC(K))*AL_CLR_1 + FRAC(K)*AL_CLD_1
  2336. AL(K,2) =(1-FRAC(K))*AL_CLR_2 + FRAC(K)*AL_CLD_2
  2337. AL(K,3) =(1-FRAC(K))*AL_CLR_3 + FRAC(K)*AL_CLD_3
  2338. AL(K,4) =(1-FRAC(K))*AL_CLR_4 + FRAC(K)*AL_CLD_4
  2339. AL(K,5) =(1-FRAC(K))*AL_CLR_5 + FRAC(K)*AL_CLD_5
  2340. ELSE
  2341. AL(K,1) = AL_CLR_1
  2342. AL(K,2) = AL_CLR_2
  2343. AL(K,3) = AL_CLR_3
  2344. AL(K,4) = AL_CLR_4
  2345. AL(K,5) = AL_CLR_5
  2346. ENDIF
  2347. enddo !k
  2348. !====================================================================
  2349. ! matrix inversion
  2350. !====================================================================
  2351. ! direct solution of the first four equations
  2352. RF(1) = U0*FLUX(NL)
  2353. RF(2) = 0.
  2354. ! 5th to 10th equation: bring matrix elements on the left of the main
  2355. ! diagonal to the rhs: save elements on the right of the main
  2356. ! diagonal in array -tu(l,1)
  2357. RF(3) = AL(1,3) * RF(1)
  2358. RF(4) = AL(1,1) * RF(1)
  2359. RF(5) = AL(1,2) * RF(1)
  2360. TU1(1) = AL(1,4)
  2361. TU2(1) = AL(1,5)
  2362. ! blocks of 6 equations: eliminate left matrix elements, save right
  2363. ! matrix elements in array -tu(l,i),
  2364. ! calculate rhs.
  2365. DO K=2,lm(region)
  2366. K3=3*K
  2367. TD1 = 1./(1.-AL(K,5)*TU2(K-1))
  2368. TD2 = AL(K,4)*TU2(K-1)
  2369. TU1(K) = TD1*AL(K,4)
  2370. TU2(K) = AL(K,5) + TD2*TU1(K)
  2371. RF(K3) = TD1 * (AL(K,3)*RF(K3-2) + AL(K,5)*RF(K3-1))
  2372. RF(K3+1)= AL(K,1)*RF(K3-2)
  2373. RF(K3+2)= AL(K,2)*RF(K3-2) + AL(K,4)*RF(K3-1)+TD2*RF(K3)
  2374. enddo
  2375. ! last two equations: the same as before
  2376. TDS1 = 1. / (1.-ALB*TU2(lm(region)))
  2377. rf(maxlev3) = tds1 * (alb * rf(maxlev3-2)+ &
  2378. alb * rf(maxlev3-1))
  2379. ! now we have created an upper triangular matrix the elements of which
  2380. ! are -tu(l,i), 0, or 1 (in the main diagonal). the 0 and 1 elements
  2381. ! are not stored in an array. let us solve the system now and store the
  2382. ! results in the arrays rf (fluxes clear sky) and rw (fluxes cloudy sky)
  2383. DO K=lm(region),1,-1
  2384. K3=3*K
  2385. RF(K3+2) = RF(K3+2) + TU2(K)*RF(K3+3)
  2386. RF(K3) = RF(K3) + TU1(K)*RF(K3+3)
  2387. SD(K+1,L) = RF(K3+1)
  2388. FD(K+1,L) = RF(K3+2)
  2389. FU(K+1,L) = RF(K3+3)
  2390. enddo ! K
  2391. SD(1,L) = RF(1)
  2392. FD(1,L) = RF(2)
  2393. FU(1,L) = RF(3)
  2394. ! calculate the actinic flux
  2395. fact_top = sd(1,l)/u0 + u * fd(1,l) + u * fu(1,l)
  2396. do k = 1,lm(region)
  2397. fact_bot = sd(k+1,l)/u0 + u * fd(k+1,l) + u * fu(k+1,l)
  2398. fact(k,l) = max(0. ,(fact_top + fact_bot)/2.)
  2399. fact_top = fact_bot
  2400. end do ! K
  2401. ! swap vertical levels to the default order of the model
  2402. fact(1:lm(region),l) = fact(lm(region):1:-1,l)
  2403. cst_o3_col(1:lm(region),nl) = cst_o3_col(lm(region):1:-1,nl)
  2404. enddo ! wavelength
  2405. return
  2406. END SUBROUTINE PIFM_RAN
  2407. !EOC
  2408. !------------------------------------------------------------------------------
  2409. ! TM5 !
  2410. !------------------------------------------------------------------------------
  2411. !BOP
  2412. !
  2413. ! !IROUTINE: SUNDIS
  2414. !
  2415. ! !DESCRIPTION:
  2416. !-----------------------------------------------------------------------------*
  2417. != purpose: =*
  2418. != calculate earth-sun distance variation for a given date. based on =*
  2419. != fourier coefficients originally from: spencer, j.w., 1971, fourier =*
  2420. != series representation of the position of the sun, search, 2:172 =*
  2421. !-----------------------------------------------------------------------------*
  2422. != parameters: =*
  2423. != idate - integer, specification of the date, from yymmdd (i)=*
  2424. != esrm2 - real, variation of the earth-sun distance (o)=*
  2425. != esrm2 = (average e/s dist)^2 / (e/s dist on day idate)^2 =*
  2426. !-----------------------------------------------------------------------------*
  2427. != edit history: =*
  2428. != 01/95 changed computation of trig function values =*
  2429. !-----------------------------------------------------------------------------*
  2430. != this program is free software; you can redistribute it and/or modify =*
  2431. != it under the terms of the gnu general public license as published by the =*
  2432. != free software foundation; either version 2 of the license, or (at your =*
  2433. != option) any later version. =*
  2434. != the tuv package is distributed in the hope that it will be useful, but =*
  2435. != without any warranty; without even the implied warranty of merchantibi- =*
  2436. != lity or fitness for a particular purpose. see the gnu general public =*
  2437. != license for more details. =*
  2438. != to obtain a copy of the gnu general public license, write to: =*
  2439. != free software foundation, inc., 675 mass ave, cambridge, ma 02139, usa. =*
  2440. !-----------------------------------------------------------------------------*
  2441. != to contact the authors, please mail to: =*
  2442. != sasha madronich, ncar/acd, p.o.box 3000, boulder, co, 80307-3000, usa or =*
  2443. != send email to: sasha@ucar.edu =*
  2444. !-----------------------------------------------------------------------------*
  2445. != copyright (c) 1994,95,96 university corporation for atmospheric research =*
  2446. !-----------------------------------------------------------------------------*
  2447. !\\
  2448. !\\
  2449. ! !INTERFACE:
  2450. !
  2451. REAL FUNCTION SUNDIS( imonth, iday)
  2452. !
  2453. ! !USES:
  2454. !
  2455. use binas, only : pi
  2456. !
  2457. ! !INPUT PARAMETERS:
  2458. !
  2459. integer, intent(in) :: iday, imonth
  2460. !
  2461. ! !REVISION HISTORY:
  2462. !
  2463. !EOP
  2464. !------------------------------------------------------------------------------
  2465. !BOC
  2466. ! internal:
  2467. integer mday, month, jday
  2468. real dayn, thet0
  2469. real sinth, costh, sin2th, cos2th
  2470. integer,dimension(12) ::imn=(/ 31,28,31,30,31,30,31,31,30,31,30,31 /)
  2471. ! start
  2472. ! parse date to find day number (julian day)
  2473. mday = 0
  2474. do month = 1, imonth-1
  2475. mday = mday + imn(month)
  2476. end do
  2477. jday = mday + iday
  2478. dayn = float(jday - 1) + 0.5
  2479. ! define angular day number and compute esrm2:
  2480. thet0 = 2.*pi*dayn/365.
  2481. ! calculate sin(2*thet0), cos(2*thet0) from
  2482. ! addition theoremes for trig functions for better
  2483. ! performance; the computation of sin2th, cos2th
  2484. ! is about 5-6 times faster than the evaluation
  2485. ! of the intrinsic functions sin and cos
  2486. !
  2487. sinth = sin(thet0)
  2488. costh = cos(thet0)
  2489. sin2th = 2.*sinth*costh
  2490. cos2th = costh*costh - sinth*sinth
  2491. sundis = 1.000110 + 0.034221*costh + 0.001280*sinth + &
  2492. 0.000719*cos2th + 0.000077*sin2th
  2493. !
  2494. END FUNCTION SUNDIS
  2495. !EOC
  2496. !--------------------------------------------------------------------------
  2497. ! TM5 !
  2498. !--------------------------------------------------------------------------
  2499. !BOP
  2500. !
  2501. ! !IROUTINE: OZONE_INFO_ONLINE
  2502. !
  2503. ! !DESCRIPTION: calculate, from an ozone field, the overhead ozone at all
  2504. ! grid points.
  2505. ! Optical depth clear sky conditions
  2506. ! upper values are given by the ozone climatology above the
  2507. ! highest model mid-level
  2508. !\\
  2509. !\\
  2510. ! !INTERFACE:
  2511. !
  2512. SUBROUTINE OZONE_INFO_ONLINE( region )
  2513. !
  2514. ! !USES:
  2515. !
  2516. use binas, only : Avog, xm_air, grav
  2517. use dims
  2518. ! use photolysis_data, only : phot_dat
  2519. use global_data, only : region_dat, mass_dat
  2520. use chem_param, only : xmo3, io3
  2521. use meteodata, only : phlb_dat
  2522. !
  2523. ! !INPUT PARAMETERS:
  2524. !
  2525. integer, intent(in) :: region
  2526. !
  2527. ! !REVISION HISTORY:
  2528. ! Jan 2003 - MK - adapted for new TM5 memory structure.
  2529. ! Jul 2008 - JEW - new ozone info unit coupled for online calculations
  2530. ! 26 Apr 2012 - P. Le Sager - adapted for lon-lat MPI domain decomposition
  2531. !
  2532. !EOP
  2533. !------------------------------------------------------------------------
  2534. !BOC
  2535. real, parameter :: conv = 0.1*Avog/xmo3 ! from kg/m2 --> #/cm2
  2536. real, parameter :: sp = Avog*1.e-4*0.2095/(xm_air*grav)
  2537. integer :: i, j, l, lmr, i1, i2, j1, j2
  2538. real,dimension(:,:,:),allocatable :: o3_overhead_online, o2_overhead ! #/cm2
  2539. real,dimension(:), pointer :: ozone_klimtop !in #cm-2
  2540. real,dimension(:,:), pointer :: v3_surf ! #/cm2
  2541. real,dimension(:,:,:),pointer :: v2, v3 ! #/cm2
  2542. real,dimension(:,:,:,:),pointer :: o3 ! #/cm2
  2543. real,dimension(:,:,:),pointer :: phlb
  2544. real,dimension(:), pointer :: area
  2545. call Get_DistGrid( dgrid(region), I_STRT=i1, I_STOP=i2, J_STRT=j1, J_STOP=j2 )
  2546. lmr = lm(region)
  2547. ! allocate on all prcessors so result maybe scattered
  2548. allocate(o3_overhead_online(i1:i2, j1:j2, lm(region))) ; o3_overhead_online = 0.0
  2549. allocate(o2_overhead (i1:i2, j1:j2, lm(region))) ; o2_overhead = 0.0
  2550. v2 => phot_dat(region)%v2
  2551. v3 => phot_dat(region)%v3
  2552. v3_surf => phot_dat(region)%v3_surf
  2553. area => region_dat(region)%dxyp
  2554. phlb => phlb_dat(region)%data
  2555. o3 => mass_dat(region)%rm ! (i1:i2, j1:j2, 1:lmr, io3)
  2556. ! CALCULATE COLUMNS
  2557. ! -----------------
  2558. ! (1) top
  2559. ! --------
  2560. ! o3du is not used anymore, except in cases where stratosphere is not resolved (EC-EARTH)
  2561. if (with_o3du) then ! use fortuin-kelder
  2562. ozone_klimtop => phot_dat(region)%o3klim_top
  2563. do j=j1,j2
  2564. do i=i1,i2
  2565. o3_overhead_online(i,j,lm(region)) = ozone_klimtop(j)
  2566. end do
  2567. end do
  2568. else ! from TM4-routine
  2569. do j=j1,j2
  2570. do i=i1,i2
  2571. o3_overhead_online(i,j,lm(region)) = 0.5*conv*o3(i,j,lm(region),io3)/area(j)
  2572. end do
  2573. end do
  2574. endif
  2575. ! (2) rest
  2576. ! --------
  2577. do l = lm(region)-1,1,-1
  2578. do j = j1,j2
  2579. do i = i1,i2
  2580. o3_overhead_online(i,j,l) = o3_overhead_online(i,j,l+1) + &
  2581. 0.5*conv*(o3(i,j,l,io3)+o3(i,j,l+1,io3))/area(j)
  2582. enddo
  2583. enddo
  2584. enddo
  2585. ! Define surface ozone column field for diagnostic purposes
  2586. do j=j1,j2
  2587. do i=i1,i2
  2588. v3_surf(i,j) = o3_overhead_online(i,j,1) + 0.5*conv*o3(i,j,1,io3)/area(j)
  2589. end do
  2590. end do
  2591. ! Boundaries
  2592. v3(:,:,1) = o3_overhead_online(:,:,1)
  2593. ! now transform o3 column from layers to levels
  2594. do l = 2,lm(region)
  2595. v3(:,:,l) = ( o3_overhead_online(:,:,l) + o3_overhead_online(:,:,l-1) ) * 0.5
  2596. enddo
  2597. ! TOA
  2598. do j=j1,j2
  2599. do i=i1,i2
  2600. v3(i,j,lm(region)+1) = 0.5*v3(i,j,lm(region))
  2601. enddo
  2602. enddo
  2603. ! determine oxygen columns (can directly be calculated on levels)
  2604. do l = 1,lm(region)
  2605. do j = j1,j2
  2606. do i = i1,i2
  2607. v2(i,j,l) = phlb(i,j,l)*sp
  2608. enddo
  2609. enddo
  2610. enddo
  2611. ! top boundary for v2
  2612. v2(:,:,lm(region)+1) = 0.5*v2(:,:,lm(region))
  2613. nullify(o3)
  2614. nullify(ozone_klimtop)
  2615. nullify(area)
  2616. nullify(phlb)
  2617. nullify(v2)
  2618. nullify(v3)
  2619. nullify(v3_surf)
  2620. deallocate(o3_overhead_online)
  2621. deallocate(o2_overhead)
  2622. END SUBROUTINE OZONE_INFO_ONLINE
  2623. !EOC
  2624. !--------------------------------------------------------------------------
  2625. ! TM5 !
  2626. !--------------------------------------------------------------------------
  2627. !BOP
  2628. !
  2629. ! !IROUTINE: PHOTORATES_TROPO
  2630. !
  2631. ! !DESCRIPTION: calculation of photolysis and heating rates
  2632. !
  2633. ! References:
  2634. ! J. Landgraf and P.J. Crutzen, 1998:
  2635. ! An Efficient Methode for Online Calculation of Photolysis and
  2636. ! Heating Rates, J. Atmos. Sci., 55, 863-878
  2637. !
  2638. ! Expanded for high angles and online:
  2639. ! J.E.Williams, J. Landgraf, B. Bregman and H. H. Walter, A modified band
  2640. ! approach for the accurate calculation of online photolysis rates in
  2641. ! stratospheric-tropospheric Chemistry Transport Models, Atms. Chem. Phys.,
  2642. ! 6, 4137-4161, 2006.
  2643. !\\
  2644. !\\
  2645. ! !INTERFACE:
  2646. !
  2647. SUBROUTINE PHOTORATES_TROPO(region, zangle, cst_o3_col, cst_no2_col, cst_hno3_col, cst_h2o2_col, &
  2648. cst_ch2o_col, cst_n2o5_col, cst_pan_col, cst_no3_col, qy_no2_col, qy_o1d_col, &
  2649. qy_ch3cocho_col, qy_co_col, qy_c2o3_col, fact, fdir, rj, t_lay, debug_flag)
  2650. !
  2651. ! !USES:
  2652. !
  2653. use Dims, only : im, jm, lm, idate
  2654. use global_data, only : mass_dat
  2655. !
  2656. ! !INPUT PARAMETERS:
  2657. !
  2658. integer, intent(in) :: region
  2659. real, intent(in) :: zangle
  2660. real,dimension(lm(region),nbands_trop), intent(in) :: fact !actinic flux
  2661. real,dimension(lm(region),maxw), intent(in) :: fdir !flux o2-o3 abs.
  2662. logical, intent(in) :: debug_flag
  2663. real :: tscale
  2664. real,dimension(lm(region)),intent(in) :: t_lay
  2665. real,dimension(lm(region),maxwav), intent(in) :: cst_o3_col
  2666. real,dimension(lm(region),89), intent(in) :: cst_no2_col, qy_no2_col, qy_co_col, qy_c2o3_col
  2667. real,dimension(lm(region),65), intent(in) :: cst_hno3_col, qy_o1d_col
  2668. real,dimension(lm(region),55), intent(in) :: cst_n2o5_col
  2669. real,dimension(lm(region),45), intent(in) :: cst_h2o2_col
  2670. real,dimension(lm(region),105), intent(in) :: cst_ch2o_col
  2671. real,dimension(lm(region),65), intent(in) :: cst_pan_col
  2672. real,dimension(lm(region),62), intent(in) :: cst_no3_col
  2673. real,dimension(lm(region),52), intent(in) :: qy_ch3cocho_col
  2674. !
  2675. ! !OUTPUT PARAMETERS:
  2676. !
  2677. real,dimension(lm(region),nj), intent(out) :: rj !photolysis rates
  2678. !
  2679. ! !REVISION HISTORY:
  2680. !
  2681. !EOP
  2682. !------------------------------------------------------------------------
  2683. !BOC
  2684. real,dimension(nbands_trop) :: bjo1d, bjno2, bjhno3, bjcoh2, bjchoh, bjn2o5a, bjn2o5b, &
  2685. bjhno4, bjpana, bjpanb, bjno2o, bjnoo2, bjh2o2, bjch3ooh, bjald2, bjch3o2co, &
  2686. bjch3cocho,bjch3ono2,bjo2 , bjispd, bj_a_acet,bj_b_acet,bjhono
  2687. !=================================================================================================
  2688. !First tropospheric band is temperature independent for H2O2.N2O5,HCHO and NO2 therefore remove from large temp dep. arrays.
  2689. real,dimension(17) :: cs_h2o2, cs_n2o5,cs_ch2o,cs_no2, cs_o2
  2690. data cs_h2o2 /4.34E-19, 4.07E-19, 3.85E-19, 3.63E-19, 3.41E-19, 3.18E-19, 2.95E-19, &
  2691. 2.72E-19, 2.50E-19, 2.30E-19, 2.10E-19, 1.92E-19, 1.74E-19, 1.57E-19, &
  2692. 1.41E-19, 1.26E-19, 1.13E-19/
  2693. data cs_n2o5 /8.049E-18, 7.208E-18, 6.212E-18, 4.853E-18, 3.925E-18, 3.248E-18, 2.619E-18, &
  2694. 2.087E-18, 1.661E-18, 1.349E-18, 1.131E-18, 9.549E-19, 8.353E-18, 7.427E-19, &
  2695. 6.762E-19, 6.095E-19, 5.229E-19/
  2696. data cs_ch2o /0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, &
  2697. 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 1.844E-22, 3.311E-22, 3.198E-22, &
  2698. 6.982E-22, 7.341E-22, 1.383E-21/
  2699. data cs_o2 /7.448E-24, 7.322E-24, 7.002E-24, 6.608E-24, 6.118E-24, 5.736E-24, 5.302E-24,&
  2700. 4.741E-24, 4.261E-24, 3.788E-24, 3.213E-24, 2.69E-24, 2.218E-24, 1.793E-24,&
  2701. 1.384E-24, 1.054E-24, 6.318E-25/
  2702. real,dimension(62) :: cs_hno4 !
  2703. ! Reference : JPL 2006, 4-40
  2704. data cs_hno4 /4.43E-18, 3.64E-18, 3.09E-18, 2.54E-18, 2.13E-18, 1.78E-18, 1.51E-18, &
  2705. 1.30E-18, 1.13E-18, 1.01E-18, 9.07E-19, 8.33E-19, 7.65E-19, 7.06E-19, &
  2706. 6.48E-19, 5.91E-19, 5.36E-19, 4.83E-19, 4.36E-19, 3.93E-19, 3.53E-19, &
  2707. 3.10E-19, 2.69E-19, 2.31E-19, 1.96E-19, 1.61E-19, 1.27E-19, 9.53E-20, &
  2708. 7.01E-20, 4.93E-20, 3.31E-20, 2.14E-20, 1.60E-20, 1.40E-20, 1.30E-20, &
  2709. 1.20E-20, 1.10E-20, 1.00E-20, 9.00E-21, 8.20E-21, 7.40E-21, 6.60E-21, &
  2710. 5.80E-21, 5.00E-21, 4.60E-21, 4.20E-21, 3.80E-21, 3.40E-21, 3.00E-21, &
  2711. 2.80E-21, 2.60E-21, 2.40E-21, 2.20E-21, 2.00E-21, 1.80E-21, 1.50E-21, &
  2712. 1.10E-21, 7.00E-22, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00/
  2713. ! Reference : IUPAC, P21
  2714. real,dimension(65) :: qy_pan
  2715. data qy_pan / 7.589E-01, 7.589E-01, 7.589E-01, 7.589E-01, 7.589E-01, 7.589E-01, 7.589E-01, &
  2716. 7.589E-01, 7.589E-01, 7.589E-01, 7.589E-01, 7.589E-01, 7.589E-01, 7.589E-01, &
  2717. 7.589E-01, 7.589E-01, 7.589E-01, 7.589E-01, 7.589E-01, 7.511E-01, 7.431E-01, &
  2718. 7.348E-01, 7.264E-01, 7.177E-01, 7.089E-01, 6.997E-01, 6.903E-01, 6.807E-01, &
  2719. 6.708E-01, 6.606E-01, 6.501E-01, 6.393E-01, 6.325E-01, 6.300E-01, 6.275E-01, &
  2720. 6.250E-01, 6.225E-01, 6.200E-01, 6.175E-01, 6.150E-01, 6.125E-01, 6.100E-01, &
  2721. 5.995E-01, 5.890E-01, 5.785E-01, 5.680E-01, 5.575E-01, 5.470E-01, 5.365E-01, &
  2722. 5.260E-01, 5.155E-01, 5.050E-01, 4.945E-01, 4.840E-01, 4.735E-01, 4.577E-01, &
  2723. 4.367E-01, 4.157E-01, 3.800E-01, 3.300E-01, 2.800E-01, 2.300E-01, 0.000E+00, &
  2724. 0.000E+00, 0.000E+00/
  2725. real, dimension(89) :: cs_hono
  2726. ! Reference : IUPAC 2001, datasheet PNOx1
  2727. data cs_hono /2.110E-18, 2.198E-18, 2.173E-18, 2.147E-18, 2.025E-18, 1.867E-18, 1.710E-18, &
  2728. 1.554E-18, 1.408E-18, 1.280E-18, 1.133E-18, 9.571E-19, 8.147E-19, 7.137E-19, &
  2729. 6.104E-19, 5.046E-19, 3.962E-19, 2.908E-19, 2.207E-19, 1.685E-19, 1.348E-19, &
  2730. 1.003E-19, 7.195E-20, 5.256E-20, 3.956E-20, 3.020E-20, 2.069E-20, 1.399E-21, &
  2731. 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, 1.400E-21, &
  2732. 2.800E-21, 4.200E-21, 5.600E-21, 7.000E-21, 8.800E-21, 1.060E-20, 1.240E-20, &
  2733. 1.420E-20, 1.600E-20, 1.780E-20, 1.960E-20, 2.140E-20, 2.320E-20, 2.500E-20, &
  2734. 2.880E-20, 3.260E-20, 3.640E-20, 4.020E-20, 4.400E-20, 4.520E-20, 4.700E-20, &
  2735. 4.940E-20, 6.290E-20, 9.300E-20, 1.305E-19, 1.680E-19, 9.600E-20, 1.150E-19, &
  2736. 2.360E-19, 8.000E-20, 1.610E-19, 2.050E-19, 4.900E-20, 9.200E-20, 1.450E-19, &
  2737. 2.400E-20, 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, &
  2738. 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, &
  2739. 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00/
  2740. real, dimension(89) :: cs_ch3ooh
  2741. ! Reference : JPL 2011, D9
  2742. data cs_ch3ooh / 2.782E-19, 2.782E-19, 2.782E-19, 2.782E-19, 2.782E-19, 2.316E-19, 1.956E-19, &
  2743. 1.696E-19, 1.476E-19, 1.318E-19, 1.169E-19, 1.036E-19, 9.132E-20, 8.045E-20, &
  2744. 7.084E-20, 6.199E-20, 5.483E-20, 4.808E-20, 4.260E-20, 3.744E-20, 3.263E-20, &
  2745. 2.819E-20, 2.431E-20, 2.119E-20, 1.827E-20, 1.569E-20, 1.338E-20, 1.107E-20, &
  2746. 9.226E-21, 7.677E-21, 6.358E-21, 5.152E-21, 4.406E-21, 4.130E-21, 3.930E-21, &
  2747. 3.730E-21, 3.530E-21, 3.330E-21, 3.130E-21, 2.982E-21, 2.834E-21, 2.686E-21, &
  2748. 2.538E-21, 2.390E-21, 2.276E-21, 2.162E-21, 2.048E-21, 1.934E-21, 1.820E-21, &
  2749. 1.730E-21, 1.640E-21, 1.550E-21, 1.460E-21, 1.370E-21, 1.306E-21, 1.210E-21, &
  2750. 1.082E-21, 9.720E-22, 7.900E-22, 6.100E-22, 4.700E-22, 3.500E-22, 2.700E-22, &
  2751. 2.100E-22, 1.600E-22, 1.200E-22, 7.500E-23, 5.200E-23, 4.000E-23, 4.050E-23, &
  2752. 4.100E-23, 1.000E-23, 6.000E-24, 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, &
  2753. 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, &
  2754. 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00/
  2755. real, dimension(120) :: cs_ch3cocho
  2756. ! Reference : JPL 2006, P 4-71
  2757. data cs_ch3cocho /2.280E-19, 1.489E-19, 9.624E-20, 6.968E-20, 5.036E-20, 3.627E-20, 2.581E-20, &
  2758. 1.729E-20, 1.440E-20, 1.435E-20, 1.460E-20, 1.521E-20, 1.619E-20, 1.743E-20, &
  2759. 1.908E-20, 2.036E-20, 2.207E-20, 2.312E-20, 2.509E-20, 2.697E-20, 2.807E-20, &
  2760. 3.175E-20, 3.343E-20, 3.580E-20, 4.070E-20, 4.234E-20, 4.473E-20, 4.906E-20, &
  2761. 4.782E-20, 4.712E-20, 4.813E-20, 4.120E-20, 3.760E-20, 3.690E-20, 3.700E-20, &
  2762. 3.740E-20, 3.740E-20, 3.620E-20, 3.380E-20, 3.150E-20, 2.920E-20, 2.710E-20, &
  2763. 2.520E-20, 2.340E-20, 2.180E-20, 2.060E-20, 1.970E-20, 1.900E-20, 1.860E-20, &
  2764. 1.860E-20, 1.870E-20, 1.820E-20, 1.680E-20, 1.500E-20, 1.340E-20, 1.180E-20, &
  2765. 9.670E-21, 8.110E-21, 6.470E-21, 4.950E-21, 3.220E-21, 2.950E-21, 3.850E-21, &
  2766. 5.560E-21, 7.650E-21, 1.080E-20, 1.470E-20, 1.900E-20, 2.420E-20, 3.200E-20, &
  2767. 4.030E-20, 4.670E-20, 5.620E-20, 6.920E-20, 8.520E-20, 9.690E-20, 1.020E-19, &
  2768. 1.030E-19, 1.040E-19, 1.080E-19, 9.940E-20, 9.620E-20, 8.680E-20, 3.690E-20, &
  2769. 9.140E-21, 2.680E-21, 1.080E-21, 6.270E-22, 3.920E-22, 2.430E-22, 1.740E-22, &
  2770. 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, &
  2771. 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, &
  2772. 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, &
  2773. 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, &
  2774. 0.000E+00/
  2775. real,dimension(62) :: cs_orgn
  2776. ! Reference : average 1-C4H9ONO2 & 2-C4H9ONO2 (IUPAC data sheet P18 and P19)
  2777. ! JEW: The absorption spectrum of 2-C4H9ONO2 is mirrored around the maxiumum.
  2778. data cs_orgn / 5.250E-018, 4.398E-018, 3.609E-018, 2.804E-018, 2.172E-018, 1.595E-018, 1.130E-018, &
  2779. 7.710E-019, 5.025E-019, 3.714E-019, 2.623E-019, 1.900E-019, 1.342E-019, 9.905E-020, &
  2780. 7.285E-020, 5.245E-020, 4.052E-020, 3.110E-020, 2.806E-020, 5.649E-020, 5.136E-020, &
  2781. 4.886E-020, 4.635E-020, 4.358E-020, 3.970E-020, 3.610E-020, 3.247E-020, 2.784E-020, &
  2782. 2.308E-020, 1.846E-020, 1.401E-020, 9.810E-021, 7.430E-021, 6.550E-021, 6.080E-021, &
  2783. 5.610E-021, 5.140E-021, 4.670E-021, 4.200E-021, 3.840E-021, 3.480E-021, 3.120E-021, &
  2784. 2.760E-021, 2.400E-021, 2.170E-021, 1.940E-021, 1.710E-021, 1.480E-021, 1.250E-021, &
  2785. 1.131E-021, 1.012E-021, 8.930E-022, 7.740E-022, 2.550E-022, 2.350E-022, 2.050E-022, &
  2786. 1.650E-022, 1.400E-022, 1.050E-022, 8.000E-023, 0.000E+000, 0.000E+000/
  2787. real, dimension(89) :: cs_ald2
  2788. ! Reference : average CH3CHO & C2H5CHO (JPL and IUPAC data sheet, respectively)
  2789. data cs_ald2 /5.211E-022, 5.133E-022, 5.163E-022, 5.272E-022, 5.526E-022, 5.837E-022, 6.266E-022, &
  2790. 6.774E-022, 7.498E-022, 8.806E-022, 1.054E-021, 1.387E-021, 1.849E-021, 2.472E-021, &
  2791. 3.444E-021, 4.679E-021, 6.217E-021, 8.229E-021, 1.074E-020, 1.376E-020, 1.729E-020, &
  2792. 2.131E-020, 2.584E-020, 3.082E-020, 3.565E-020, 4.055E-020, 4.482E-020, 4.809E-020, &
  2793. 5.184E-020, 5.155E-020, 5.245E-020, 4.795E-020, 4.640E-020, 4.600E-020, 4.540E-020, &
  2794. 4.465E-020, 4.330E-020, 4.085E-020, 3.870E-020, 3.730E-020, 3.585E-020, 3.490E-020, &
  2795. 3.380E-020, 3.265E-020, 3.145E-020, 3.015E-020, 2.895E-020, 2.750E-020, 2.485E-020, &
  2796. 2.235E-020, 2.125E-020, 1.990E-020, 1.869E-020, 1.777E-020, 1.631E-020, 1.471E-020, &
  2797. 1.254E-020, 1.014E-020, 6.315E-021, 3.375E-021, 1.525E-021, 2.300E-022, 9.000E-023, &
  2798. 3.000E-023, 1.500E-023, 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000, &
  2799. 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000, &
  2800. 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000, &
  2801. 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000/
  2802. real, dimension(89) :: cs_ispd
  2803. ! Reference : average MACR and MVK (IUPAC data sheets) 1st two bins are estimates
  2804. data cs_ispd /0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000, &
  2805. 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000, &
  2806. 0.000E+000, 0.000E+000, 0.000E+000, 1.700E-021, 1.900E-021, 2.107E-021, 2.157E-021, &
  2807. 2.403E-021, 2.928E-021, 3.713E-021, 4.854E-021, 6.439E-021, 8.562E-021, 1.147E-020, &
  2808. 1.496E-020, 1.942E-020, 2.471E-020, 3.088E-020, 3.480E-020, 3.655E-020, 3.825E-020, &
  2809. 3.980E-020, 4.130E-020, 4.275E-020, 4.425E-020, 4.610E-020, 4.770E-020, 4.920E-020, &
  2810. 5.055E-020, 5.180E-020, 5.355E-020, 5.540E-020, 5.685E-020, 5.815E-020, 5.920E-020, &
  2811. 6.075E-020, 6.230E-020, 6.365E-020, 6.455E-020, 6.485E-020, 6.470E-020, 6.558E-020, &
  2812. 6.788E-020, 6.880E-020, 7.215E-020, 6.510E-020, 6.340E-020, 6.380E-020, 4.680E-020, &
  2813. 4.145E-020, 4.365E-020, 2.680E-020, 1.650E-020, 1.144E-020, 1.175E-020, 5.440E-021, &
  2814. 2.455E-021, 1.525E-021, 2.300E-022, 9.000E-023, 0.000E+000, 0.000E+000, 0.000E+000, &
  2815. 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000, &
  2816. 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000/
  2817. ! Reference : 5 abs. spectra at 5 different temperatures for acetone (235,254,263,280,298)
  2818. real, dimension(77) :: cs_ch3coch3_235
  2819. data cs_ch3coch3_235 /1.185E-018, 9.785E-019, 7.682E-019, 5.534E-019, 3.341E-019, 1.102E-019, 1.875E-21, &
  2820. 2.253E-021, 2.749E-021, 3.370E-021, 4.256E-021, 5.246E-021, 6.592E-021, 8.226E-21, &
  2821. 1.025E-020, 1.277E-020, 1.562E-020, 1.898E-020, 2.278E-020, 2.694E-020, 3.129E-20, &
  2822. 3.568E-020, 3.973E-020, 4.352E-020, 4.592E-020, 4.791E-020, 4.753E-020, 4.708E-20, &
  2823. 4.391E-020, 4.018E-020, 3.524E-020, 2.906E-020, 2.510E-020, 2.370E-020, 2.280E-20, &
  2824. 2.160E-020, 2.020E-020, 1.910E-020, 1.790E-020, 1.640E-020, 1.500E-020, 1.360E-20, &
  2825. 1.250E-020, 1.130E-020, 1.020E-020, 9.320E-021, 8.620E-021, 7.630E-021, 6.710E-21, &
  2826. 6.030E-021, 5.370E-021, 4.610E-021, 3.940E-021, 3.330E-021, 2.890E-021, 2.130E-21, &
  2827. 1.390E-021, 8.720E-022, 3.550E-022, 1.200E-022, 5.110E-023, 1.590E-023, 0.000E+00, &
  2828. 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+00, &
  2829. 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+00/
  2830. real, dimension(77) :: cs_ch3coch3_254
  2831. data cs_ch3coch3_254 /1.177E-018, 9.719E-019, 7.630E-019, 5.497E-019, 3.319E-019, 1.095E-019, 1.892E-021, &
  2832. 2.257E-021, 2.729E-021, 3.321E-021, 4.176E-021, 5.134E-021, 6.450E-021, 8.067E-021, &
  2833. 1.005E-020, 1.252E-020, 1.532E-020, 1.868E-020, 2.248E-020, 2.660E-020, 3.089E-020, &
  2834. 3.537E-020, 3.937E-020, 4.321E-020, 4.567E-020, 4.772E-020, 4.761E-020, 4.723E-020, &
  2835. 4.428E-020, 4.068E-020, 3.584E-020, 2.986E-020, 2.590E-020, 2.450E-020, 2.360E-020, &
  2836. 2.240E-020, 2.100E-020, 1.990E-020, 1.860E-020, 1.710E-020, 1.570E-020, 1.440E-020, &
  2837. 1.320E-020, 1.200E-020, 1.090E-020, 9.940E-021, 9.190E-021, 8.150E-021, 7.190E-021, &
  2838. 6.480E-021, 5.790E-021, 4.990E-021, 4.300E-021, 3.670E-021, 3.240E-021, 2.430E-021, &
  2839. 1.630E-021, 1.056E-021, 4.500E-022, 1.450E-022, 5.400E-023, 1.810E-023, 0.000E+000, &
  2840. 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000, &
  2841. 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000/
  2842. real, dimension(77) :: cs_ch3coch3_263
  2843. data cs_ch3coch3_263 /1.177E-018, 9.719E-019, 7.630E-019, 5.497E-019, 3.319E-019, 1.095E-019, 1.892E-021, &
  2844. 2.257E-021, 2.729E-021, 3.321E-021, 4.176E-021, 5.134E-021, 6.450E-021, 8.067E-021, &
  2845. 1.005E-020, 1.252E-020, 1.532E-020, 1.868E-020, 2.248E-020, 2.660E-020, 3.089E-020, &
  2846. 3.537E-020, 3.937E-020, 4.321E-020, 4.567E-020, 4.772E-020, 4.761E-020, 4.723E-020, &
  2847. 4.428E-020, 4.068E-020, 3.584E-020, 2.986E-020, 2.590E-020, 2.450E-020, 2.360E-020, &
  2848. 2.240E-020, 2.100E-020, 1.990E-020, 1.860E-020, 1.710E-020, 1.570E-020, 1.440E-020, &
  2849. 1.320E-020, 1.200E-020, 1.090E-020, 9.940E-021, 9.190E-021, 8.150E-021, 7.190E-021, &
  2850. 6.480E-021, 5.790E-021, 4.990E-021, 4.300E-021, 3.670E-021, 3.240E-021, 2.430E-021, &
  2851. 1.630E-021, 1.056E-021, 4.500E-022, 1.450E-022, 5.400E-023, 1.810E-023, 0.000E+000, &
  2852. 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000, &
  2853. 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000/
  2854. real, dimension(77) :: cs_ch3coch3_280
  2855. data cs_ch3coch3_280 /1.196E-018, 9.883E-019, 7.759E-019, 5.590E-019, 3.375E-019, 1.112E-019, 1.855E-021, &
  2856. 2.233E-021, 2.719E-021, 3.340E-021, 4.225E-021, 5.200E-021, 6.540E-021, 8.166E-021, &
  2857. 1.015E-020, 1.262E-020, 1.542E-020, 1.878E-020, 2.258E-020, 2.674E-020, 3.109E-020, &
  2858. 3.558E-020, 3.967E-020, 4.361E-020, 4.627E-020, 4.843E-020, 4.851E-020, 4.823E-020, &
  2859. 4.541E-020, 4.188E-020, 3.714E-020, 3.106E-020, 2.710E-020, 2.570E-020, 2.480E-020, &
  2860. 2.350E-020, 2.200E-020, 2.080E-020, 1.960E-020, 1.800E-020, 1.660E-020, 1.530E-020, &
  2861. 1.410E-020, 1.280E-020, 1.170E-020, 1.070E-020, 9.930E-021, 8.820E-021, 7.790E-021, &
  2862. 7.040E-021, 6.310E-021, 5.480E-021, 4.760E-021, 4.100E-021, 3.650E-021, 2.795E-021, &
  2863. 1.940E-021, 1.305E-021, 5.880E-022, 1.930E-022, 7.200E-023, 2.380E-023, 0.000E+000, &
  2864. 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000, &
  2865. 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000/
  2866. real, dimension(77) :: cs_ch3coch3_298
  2867. data cs_ch3coch3_298 /1.246E-019, 1.032E-019, 8.135E-020, 5.903E-020, 3.623E-020, 1.295E-020, 1.835E-021, &
  2868. 2.213E-021, 2.699E-021, 3.310E-021, 4.186E-021, 5.166E-021, 6.490E-021, 8.097E-021, &
  2869. 1.007E-020, 1.257E-020, 1.542E-020, 1.878E-020, 2.258E-020, 2.680E-020, 3.125E-020, &
  2870. 3.578E-020, 3.997E-020, 4.401E-020, 4.677E-020, 4.913E-020, 4.931E-020, 4.913E-020, &
  2871. 4.648E-020, 4.298E-020, 3.824E-020, 3.216E-020, 2.820E-020, 2.670E-020, 2.580E-020, &
  2872. 2.450E-020, 2.300E-020, 2.180E-020, 2.050E-020, 1.890E-020, 1.750E-020, 1.610E-020, &
  2873. 1.490E-020, 1.360E-020, 1.240E-020, 1.140E-020, 1.060E-020, 9.440E-021, 8.370E-021, &
  2874. 7.600E-021, 6.840E-021, 5.980E-021, 5.230E-021, 4.550E-021, 4.110E-021, 3.210E-021, &
  2875. 2.290E-021, 1.575E-021, 7.400E-022, 2.480E-022, 9.120E-023, 3.010E-023, 0.000E+000, &
  2876. 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000, &
  2877. 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000, 0.000E+000/
  2878. real, dimension(77) :: cs_ch3coch3
  2879. !==========================================================================================================
  2880. ! Similar procedure for quantum yields for : HCHO and NO3. A quantum yield of 0.8 is adopted for JN2O5 below 305nm
  2881. ! as recommended in JPL 2006 - JEW 2009
  2882. real,dimension(90) :: qyh_hco,qyh2_co
  2883. real,dimension(62) :: qyno2_o,qyno_o2
  2884. data qyh_hco /0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, &
  2885. 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, &
  2886. 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, 3.087E-01, 3.087E-01, 3.030E-01, &
  2887. 3.113E-01, 3.325E-01, 3.649E-01, 4.059E-01, 4.535E-01, 5.061E-01, 5.611E-01, &
  2888. 6.159E-01, 6.662E-01, 7.097E-01, 7.418E-01, 7.550E-01, 7.580E-01, 7.610E-01, &
  2889. 7.620E-01, 7.620E-01, 7.620E-01, 7.600E-01, 7.580E-01, 7.540E-01, 7.490E-01, &
  2890. 7.440E-01, 7.370E-01, 7.290E-01, 7.200E-01, 7.090E-01, 6.980E-01, 6.850E-01, &
  2891. 6.710E-01, 6.560E-01, 6.390E-01, 6.220E-01, 6.030E-01, 5.830E-01, 5.500E-01, &
  2892. 5.020E-01, 4.490E-01, 3.430E-01, 1.650E-01, 0.000E+00, 0.000E+00, 0.000E+00, &
  2893. 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, &
  2894. 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, &
  2895. 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, &
  2896. 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00/ !(JPL 2006, p4-47)
  2897. data qyh2_co /0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, &
  2898. 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, &
  2899. 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, 4.913E-01, 4.913E-01, 4.970E-01, &
  2900. 4.887E-01, 4.697E-01, 4.546E-01, 4.313E-01, 4.020E-01, 3.682E-01, 3.440E-01, &
  2901. 3.152E-01, 2.922E-01, 2.662E-01, 2.547E-01, 2.450E-01, 2.420E-01, 2.390E-01, &
  2902. 2.380E-01, 2.380E-01, 2.380E-01, 2.400E-01, 2.420E-01, 2.460E-01, 2.510E-01, &
  2903. 2.560E-01, 2.630E-01, 2.710E-01, 2.800E-01, 2.910E-01, 3.020E-01, 3.150E-01, &
  2904. 3.290E-01, 3.440E-01, 3.610E-01, 3.780E-01, 3.970E-01, 4.170E-01, 4.500E-01, &
  2905. 4.980E-01, 5.510E-01, 6.570E-01, 7.350E-01, 6.500E-01, 5.000E-01, 3.800E-01, &
  2906. 2.200E-01, 4.000E-03, 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, &
  2907. 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, &
  2908. 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, &
  2909. 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00, 0.000E+00/
  2910. data qyno2_o /0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, &
  2911. 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, &
  2912. 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 1.00, &
  2913. 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, &
  2914. 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, &
  2915. 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, &
  2916. 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, &
  2917. 1.00, 0.83, 0.65, 0.58, 0.51, 0.43, 0.36, &
  2918. 0.29, 0.22, 0.14, 0.07, 0.0, 0.0/
  2919. data qyno_o2 /0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, &
  2920. 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, &
  2921. 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, &
  2922. 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, &
  2923. 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, &
  2924. 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, &
  2925. 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, &
  2926. 0.0, 0.18, 0.35, 0.31, 0.27, 0.23, 0.19, &
  2927. 0.16, 0.12, 0.08, 0.04, 0.0, 0.0/
  2928. !========================================================================================================
  2929. integer :: i, j, l, k, c
  2930. real :: delta1, delta2, delta3, delta4, delta5, delta6, delta7, delta1_spec, delta3_spec
  2931. integer, dimension(7) :: band_start, band_middle, band_end
  2932. logical :: daylight
  2933. ! ==============================================================
  2934. ! CALCULATION PHOTOLYSIS RATES FOR SCATTERING ATMOSPHERE
  2935. ! ==============================================================
  2936. ! the check for daylight is skipped as the calculation of rj is only called within the photo_flux loop
  2937. ! where a filter already applies
  2938. rj(:,:) = 0.
  2939. ! choose the grid settings dependent on the SZA for the column
  2940. if(zangle<=71.) then
  2941. band_start(:)=lini(:)
  2942. band_middle(:)=lmid(:)
  2943. band_end(:)=lfin(:)
  2944. elseif(zangle>71. .and. zangle<=sza_limit) then
  2945. band_start(:)=lini_gridA(:)
  2946. band_middle(:)=lmid_gridA(:)
  2947. band_end(:)=lfin_gridA(:)
  2948. endif
  2949. do k = 1,lm(region)
  2950. ! re-initialize bj values
  2951. do l = 1,nbands_trop
  2952. bjo1d(l) = 0.0
  2953. bjno2(l) = 0.0
  2954. bjhno3(l) = 0.0
  2955. bjcoh2(l) = 0.0
  2956. bjchoh(l) = 0.0
  2957. bjn2o5a(l) = 0.0
  2958. bjn2o5b(l) = 0.0
  2959. bjhno4(l) = 0.0
  2960. bjhono(l) = 0.0
  2961. bjno2o(l) = 0.0
  2962. bjnoo2(l) = 0.0
  2963. bjh2o2(l) = 0.0
  2964. bjch3ooh(l) = 0.0
  2965. bjpana(l) = 0.0
  2966. bjpanb(l) = 0.0
  2967. bjald2(l) = 0.0
  2968. bjch3cocho(l) = 0.0
  2969. bjch3ono2(l) = 0.0
  2970. bjo2(l) = 0.0
  2971. bjispd(l) = 0.0
  2972. bj_a_acet(l) = 0.0
  2973. bj_b_acet(l) = 0.0
  2974. end do
  2975. !
  2976. ! assign cs_ch3coch3 w/ a good value
  2977. !
  2978. ! linearly interpolate to try and improve on J values
  2979. !
  2980. if(t_lay(k)<=235.) cs_ch3coch3=cs_ch3coch3_235
  2981. if(t_lay(k)>235. .and. t_lay(k)<=254.) then
  2982. tscale=(t_lay(k)-235.)/19.0
  2983. cs_ch3coch3=((1.0-tscale)*cs_ch3coch3_235)+(tscale*cs_ch3coch3_254)
  2984. endif
  2985. if(t_lay(k)>254. .and. t_lay(k)<=263.) then
  2986. tscale=(t_lay(k)-254.)/9.0
  2987. cs_ch3coch3=((1.0-tscale)*cs_ch3coch3_254)+(tscale*cs_ch3coch3_263)
  2988. endif
  2989. if(t_lay(k)>263. .and. t_lay(k)<=280.) then
  2990. tscale=(t_lay(k)-264.)/16.0
  2991. cs_ch3coch3=((1.0-tscale)*cs_ch3coch3_263)+(tscale*cs_ch3coch3_280)
  2992. endif
  2993. if(t_lay(k)>280.) then
  2994. tscale=(t_lay(k)-280.)/18.0
  2995. cs_ch3coch3=((1.0-tscale)*cs_ch3coch3_280)+(tscale*cs_ch3coch3_298)
  2996. endif
  2997. !==============================================================================================
  2998. ! re-initialize the temporary arrays for the next layer
  2999. !===============================================================================================
  3000. delta1 = 0. ; delta2 = 0. ;delta3 = 0. ; delta4 = 0. ; delta5 = 0. ; delta6 = 0. ; delta7 = 0.
  3001. delta1_spec = 0. ; delta3_spec = 0.
  3002. ! =====================================================================================
  3003. ! Tropo band 1
  3004. ! =====================================================================================
  3005. ! temp indep species for this band: no2,h2o2,n2o5,hno4,ch2o,ch3ooh,ald2,orgntr
  3006. do l = band_start(1),band_end(1)
  3007. bjo1d(1) = bjo1d(1) + cst_o3_col(k,l)*qy_o1d_col(k,l)*fdir(k,l)
  3008. bjno2(1) = bjno2(1) + cst_no2_col(k,l)*qy_no2_col(k,l)*fdir(k,l)
  3009. bjh2o2(1) = bjh2o2(1) + cs_h2o2(l)*fdir(k,l)
  3010. bjhno3(1) = bjhno3(1) + cst_hno3_col(k,l)*fdir(k,l)
  3011. bjhno4(1) = bjhno4(1) + cs_hno4(l)*fdir(k,l)
  3012. bjhono(1) = bjhono(1) + cs_hono(l)*fdir(k,l)
  3013. bjn2o5a(1)= bjn2o5a(1) + 0.8*cs_n2o5(l)*fdir(k,l)
  3014. bjn2o5b(1)= bjn2o5b(1) + 0.2*cs_n2o5(l)*fdir(k,l)
  3015. bjchoh(1) = bjchoh(1) + cs_ch2o(l)*qyh_hco(l)*fdir(k,l)
  3016. bjch3ooh(1) = bjch3ooh(1) + cs_ch3ooh(l)*fdir(k,l)
  3017. bjald2(1) = bjald2(1) + cs_ald2(l)*fdir(k,l)
  3018. bjpana(1) = bjpana(1) + cst_pan_col(k,l)*qy_pan(l)*fdir(k,l)
  3019. bjpanb(1) = bjpanb(1) + cst_pan_col(k,l)*(1.0-qy_pan(l))*fdir(k,l)
  3020. bjch3ono2(1) = bjch3ono2(1) + cs_orgn(l) * fdir(k,l)
  3021. bjo2(1) = bjo2(1) + cs_o2(l) * fdir(k,l)
  3022. end do
  3023. ! =====================================================================================
  3024. ! Tropo band 2
  3025. ! =====================================================================================
  3026. ! temp indep species for this band: hno4,ch3ooh,ald2,orgntr
  3027. do l = band_start(2),band_end(2) ! temp indep for : no2,hno4,ch2o,ch3ooh,orgntr
  3028. bjo1d(2) = bjo1d(2) + cst_o3_col(k,l)*qy_o1d_col(k,l)*fdir(k,l)
  3029. bjno2(2) = bjno2(2) + cst_no2_col(k,l)*qy_no2_col(k,l)*fdir(k,l)
  3030. bjh2o2(2) = bjh2o2(2) + cst_h2o2_col(k,l-17)*fdir(k,l)
  3031. bjhno3(2) = bjhno3(2) + cst_hno3_col(k,l)*fdir(k,l)
  3032. bjhno4(2) = bjhno4(2) + cs_hno4(l)*fdir(k,l)
  3033. bjhono(2) = bjhono(2) + cs_hono(l)*fdir(k,l)
  3034. bjn2o5a(2) = bjn2o5a(2) + 0.8*cst_n2o5_col(k,l-17)*fdir(k,l)
  3035. bjn2o5b(2) = bjn2o5b(2) + 0.2*cst_n2o5_col(k,l-17)*fdir(k,l)
  3036. bjcoh2(2) = bjcoh2(2) + cst_ch2o_col(k,l-17)*qyh2_co(l)*fdir(k,l)
  3037. bjchoh(2) = bjchoh(2) + cst_ch2o_col(k,l-17)*qyh_hco(l)*fdir(k,l)
  3038. bjch3ooh(2) = bjch3ooh(5) + cs_ch3ooh(l)*fdir(k,l)
  3039. bjpana(2) = bjpana(2) + cst_pan_col(k,l)*qy_pan(l)*fdir(k,l)
  3040. bjpanb(2) = bjpanb(2) + cst_pan_col(k,l)*(1.0-qy_pan(l))*fdir(k,l)
  3041. bjald2(2) = bjald2(2) + cs_ald2(l)*fdir(k,l)
  3042. bjch3cocho(2) = bjch3cocho(2) + cs_ch3cocho(l)*fdir(k,l)
  3043. bjch3ono2(2) = bjch3ono2(2) + cs_orgn(l) * fdir(k,l)
  3044. bjispd(2) = bjispd(2) + cs_ispd(l) * fdir(k,l)
  3045. bj_a_acet(2) = bj_a_acet(2) + cs_ch3coch3(l)*qy_co_col(k,l)*fdir(k,l)
  3046. bj_b_acet(2) = bj_b_acet(2) + cs_ch3coch3(l)*qy_c2o3_col(k,l)*fdir(k,l)
  3047. end do
  3048. ! =======================================================================================
  3049. ! Tropo band 3
  3050. ! =======================================================================================
  3051. ! temp indep species for this band: hno4,ch3ooh,ald2,mgly,orgntr
  3052. do l = band_start(3),band_end(3)
  3053. bjo1d(3) = bjo1d(3) + cst_o3_col(k,l)*qy_o1d_col(k,l)*fdir(k,l)
  3054. bjno2(3) = bjno2(3) + cst_no2_col(k,l)*qy_no2_col(k,l)*fdir(k,l)
  3055. bjh2o2(3) = bjh2o2(3) + cst_h2o2_col(k,l-17)*fdir(k,l)
  3056. bjhno3(3) = bjhno3(3) + cst_hno3_col(k,l)*fdir(k,l)
  3057. bjhno4(3) = bjhno4(3) + cs_hno4(l)*fdir(k,l)
  3058. bjhono(3) = bjhono(3) + cs_hono(l)*fdir(k,l)
  3059. bjn2o5a(3) = bjn2o5a(3) + 0.9*cst_n2o5_col(k,l-17)*fdir(k,l)
  3060. bjn2o5b(3) = bjn2o5b(3) + 0.1*cst_n2o5_col(k,l-17)*fdir(k,l)
  3061. bjcoh2(3) = bjcoh2(3) + cst_ch2o_col(k,l-17)*qyh2_co(l)*fdir(k,l)
  3062. bjchoh(3) = bjchoh(3) + cst_ch2o_col(k,l-17)*qyh_hco(l)*fdir(k,l)
  3063. bjch3ooh(3) = bjch3ooh(3) + cs_ch3ooh(l)*fdir(k,l)
  3064. bjpana(3) = bjpana(3) + cst_pan_col(k,l)*qy_pan(l)*fdir(k,l)
  3065. bjpanb(3) = bjpanb(3) + cst_pan_col(k,l)*(1.0-qy_pan(l))*fdir(k,l)
  3066. bjald2(3) = bjald2(3) + cs_ald2(l)*fdir(k,l)
  3067. bjch3cocho(3) = bjch3cocho(3) + cs_ch3cocho(l)*fdir(k,l)
  3068. bjch3ono2(3) = bjch3ono2(3) + cs_orgn(l)*fdir(k,l)
  3069. bjispd(3) = bjispd(3) + cs_ispd(l) * fdir(k,l)
  3070. bj_a_acet(3) = bj_a_acet(3) + cs_ch3coch3(l)*qy_co_col(k,l)*fdir(k,l)
  3071. bj_b_acet(3) = bj_b_acet(3) + cs_ch3coch3(l)*qy_c2o3_col(k,l)*fdir(k,l)
  3072. end do
  3073. ! ================================================================================
  3074. ! Tropo band 4
  3075. ! ================================================================================
  3076. ! temp indep species for this band: hno4,ch3ooh,ald2,orgntr
  3077. do l = band_start(4),band_end(4)
  3078. bjo1d(4) = bjo1d(4)+cst_o3_col(k,l)*qy_o1d_col(k,l)*fdir(k,l)
  3079. bjno2(4) = bjno2(4) + cst_no2_col(k,l)*qy_no2_col(k,l)*fdir(k,l)
  3080. bjh2o2(4) = bjh2o2(4) + cst_h2o2_col(k,l-17)*fdir(k,l)
  3081. bjhno3(4) = bjhno3(4) + cst_hno3_col(k,l)*fdir(k,l)
  3082. bjhno4(4) = bjhno4(4) + cs_hno4(l)*fdir(k,l)
  3083. bjhono(4) = bjhono(4) + cs_hono(l)*fdir(k,l)
  3084. bjn2o5a(4) = bjn2o5a(4) + cst_n2o5_col(k,l-17)*fdir(k,l)
  3085. bjcoh2(4) = bjcoh2(4) + cst_ch2o_col(k,l-17)*qyh2_co(l)*fdir(k,l)
  3086. bjchoh(4) = bjchoh(4) + cst_ch2o_col(k,l-17)*qyh_hco(l)*fdir(k,l)
  3087. bjch3ooh(4) = bjch3ooh(4) + cs_ch3ooh(l)*fdir(k,l)
  3088. bjpana(4) = bjpana(4) + cst_pan_col(k,l)*qy_pan(l)*fdir(k,l)
  3089. bjpanb(4) = bjpanb(4) + cst_pan_col(k,l)*(1.0-qy_pan(l))*fdir(k,l)
  3090. bjald2(4) = bjald2(4) + cs_ald2(l)*fdir(k,l)
  3091. bjch3cocho(4) = bjch3cocho(4) + cs_ch3cocho(l)*qy_ch3cocho_col(k,l-37)*fdir(k,l)
  3092. bjch3ono2(4) = bjch3ono2(4) + cs_orgn(l)*fdir(k,l)
  3093. bjispd(4) = bjispd(4) + cs_ispd(l) * fdir(k,l)
  3094. bj_a_acet(4) = bj_a_acet(4) + cs_ch3coch3(l)*qy_co_col(k,l)*fdir(k,l)
  3095. bj_b_acet(4) = bj_b_acet(4) + cs_ch3coch3(l)*qy_c2o3_col(k,l)*fdir(k,l)
  3096. end do
  3097. ! ========================================================================================
  3098. ! Tropo band 5
  3099. ! ========================================================================================
  3100. ! temp indep species for this band: hno4,ch3ooh,ald2,orgntr
  3101. do l = band_start(5),band_end(5)
  3102. bjo1d(5) = bjo1d(5)+cst_o3_col(k,l)*qy_o1d_col(k,l)*fdir(k,l)
  3103. bjno2(5) = bjno2(5)+cst_no2_col(k,l)*qy_no2_col(k,l)*fdir(k,l)
  3104. bjh2o2(5) = bjh2o2(5)+cst_h2o2_col(k,l-17)*fdir(k,l)
  3105. bjhno3(5) = bjhno3(5)+cst_hno3_col(k,l)*fdir(k,l)
  3106. bjhno4(5) = bjhno4(5)+cs_hno4(l)*fdir(k,l)
  3107. bjhono(5) = bjhono(5)+cs_hono(l)*fdir(k,l)
  3108. bjn2o5a(5) = bjn2o5a(5)+cst_n2o5_col(k,l-17)*fdir(k,l)
  3109. bjcoh2(5) = bjcoh2(5)+cst_ch2o_col(k,l-17)*qyh2_co(l)*fdir(k,l)
  3110. bjchoh(5) = bjchoh(5)+cst_ch2o_col(k,l-17)*qyh_hco(l)*fdir(k,l)
  3111. bjch3ooh(5) = bjch3ooh(5)+cs_ch3ooh(l)*fdir(k,l)
  3112. bjpana(5) = bjpana(5) + cst_pan_col(k,l)*qy_pan(l)*fdir(k,l)
  3113. bjpanb(5) = bjpanb(5) + cst_pan_col(k,l)*(1.0-qy_pan(l))*fdir(k,l)
  3114. bjald2(5) = bjald2(5) + cs_ald2(l)*fdir(k,l)
  3115. bjch3cocho(5) = bjch3cocho(5)+cs_ch3cocho(l)*qy_ch3cocho_col(k,l-37)*fdir(k,l)
  3116. bjch3ono2(5) = bjch3ono2(5)+cs_orgn(l)*fdir(k,l)
  3117. bjispd(5) = bjispd(5) + cs_ispd(l) * fdir(k,l)
  3118. end do
  3119. !=========================================================================================
  3120. ! Tropo band 6
  3121. !=========================================================================================
  3122. do l = band_start(6),band_end(6)
  3123. bjno2(6) = bjno2(6) +cst_no2_col(k,l)*qy_no2_col(k,l)*fdir(k,l)
  3124. bjcoh2(6) = bjcoh2(6)+cst_ch2o_col(k,l-17)*qyh2_co(l)*fdir(k,l)
  3125. bjch3ooh(6) = bjch3ooh(6)+cs_ch3ooh(l)*fdir(k,l)
  3126. bjno2o(6) = bjno2o(6)+cst_no3_col(k,l-60)*qyno2_o(l-60)*fdir(k,l)
  3127. bjch3cocho(6) = bjch3cocho(6)+cs_ch3cocho(l)*qy_ch3cocho_col(k,l-37)*fdir(k,l)
  3128. bjispd(6) = bjispd(6) + cs_ispd(l) * fdir(k,l)
  3129. end do
  3130. ! Add the contribution from band 6 separately for H2O2, N2O5 and HNO3 for high angle grid to allow reducion in cst arrays
  3131. ! This has been tested using a box model to ensure that no errors are introduced compared to using main array
  3132. if(zangle>71.) then
  3133. bjh2o2(6) = bjh2o2(6)+cst_h2o2_col(k,44)*fdir(k,61)
  3134. bjh2o2(6) = bjh2o2(6)+cst_h2o2_col(k,45)*fdir(k,62)
  3135. do c=63,68
  3136. bjn2o5a(6) = bjn2o5a(6)+cst_n2o5_col(k,c-17)*fdir(k,c)
  3137. enddo
  3138. bjhno3(6) = bjhno3(6)+cst_hno3_col(k,63)*fdir(k,63)
  3139. bjpana(6) = 0.
  3140. bjpanb(6) = 0.
  3141. elseif(zangle<=71.) then
  3142. do c=61,63
  3143. bjhno3(6) = bjhno3(6)+cst_hno3_col(k,c)*fdir(k,c)
  3144. enddo
  3145. do c=61,69
  3146. bjn2o5a(6) = bjn2o5a(6)+cst_n2o5_col(k,c-17)*fdir(k,c)
  3147. enddo
  3148. do c=61,62
  3149. bjpana(6) = bjpana(6)+cst_pan_col(k,c)*qy_pan(c)*fdir(k,c)
  3150. bjpanb(6) = bjpanb(6)+cst_pan_col(k,c)*(1.0-qy_pan(c))*fdir(k,c)
  3151. enddo
  3152. endif
  3153. !========================================================================================
  3154. ! Tropo band 7
  3155. !=========================================================================================
  3156. do l = band_start(7),band_end(7)-2
  3157. bjno2o(7) = bjno2o(7)+cst_no3_col(k,l-60)*qyno2_o(l-60)*fdir(k,l)
  3158. bjnoo2(7) = bjnoo2(7)+cst_no3_col(k,l-60)*qyno_o2(l-60)*fdir(k,l)
  3159. end do
  3160. ! only set a scaling ratio for the first band once the sza > 71.
  3161. ! only calculate limits to bands 2 and 4 for high sza
  3162. if(zangle<=71.) then
  3163. delta1 = fact(k,1)/fdir(k,band_middle(1))
  3164. delta2 = fact(k,2)/fdir(k,band_middle(2))
  3165. delta3 = fact(k,3)/fdir(k,band_middle(3))
  3166. delta4 = fact(k,4)/fdir(k,band_middle(4))
  3167. delta5 = fact(k,5)/fdir(k,band_middle(5))
  3168. delta6 = fact(k,6)/fdir(k,band_middle(6))
  3169. delta7 = fact(k,7)/fdir(k,band_middle(7))
  3170. elseif(zangle>71. .and. zangle<=sza_limit) then
  3171. delta1 = safe_div( fact(k,1), fdir(k,band_middle(1)), huge(1.))
  3172. delta2 = safe_div( fact(k,2), fdir(k,band_middle(2)), huge(1.))
  3173. delta3 = safe_div( fact(k,3), fdir(k,band_middle(3)), huge(1.))
  3174. delta4 = safe_div( fact(k,4), fdir(k,band_middle(4)), huge(1.))
  3175. delta5 = safe_div( fact(k,5), fdir(k,band_middle(5)), huge(1.))
  3176. delta6 = safe_div( fact(k,6), fdir(k,band_middle(6)), huge(1.))
  3177. delta7 = safe_div( fact(k,7), fdir(k,band_middle(7)), huge(1.))
  3178. if(fdir(k,band_middle(1))>5.e9) delta1_spec = fact(k,1)/fdir(k,band_middle(1))
  3179. if(fdir(k,band_middle(3))>1.e9) delta3_spec = fact(k,3)/fdir(k,band_middle(3))
  3180. endif
  3181. ! ============================================================
  3182. ! CALCULATION PHOTOLYSIS RATES FOR SCATTERING ATMOSPHERE
  3183. ! ============================================================
  3184. ! O2 -> O3P
  3185. rj(k,jo2) = bjo2(1)*delta1
  3186. ! O3 -> 2OH
  3187. rj(k,jo3d) = bjo1d(1)*delta1 + bjo1d(2)*delta2 &
  3188. + bjo1d(3)*delta3 + bjo1d(4)*delta4 &
  3189. + bjo1d(5)*delta5
  3190. ! NO2 -> O3
  3191. rj(k,jno2) = bjno2(1)*delta1 + bjno2(2)*delta2 + &
  3192. bjno2(3)*delta3 + bjno2(4)*delta4 + &
  3193. bjno2(5)*delta5 + bjno2(6)*delta6
  3194. ! HNO3 -> OH + NO2
  3195. rj(k,jhno3) = bjhno3(1)*delta1 + bjhno3(2)*delta2 + &
  3196. bjhno3(3)*delta3 + bjhno3(4)*delta4 + &
  3197. bjhno3(5)*delta5 + bjhno3(6)*delta6
  3198. ! HNO4 -> HO2 + NO2
  3199. rj(k,jhno4) = bjhno4(1)*delta1 + bjhno4(2)*delta2 + &
  3200. bjhno4(3)*delta3 + bjhno4(4)*delta4 + &
  3201. bjhno4(5)*delta5
  3202. ! HONO -> OH + NO
  3203. rj(k,jhono) = bjhono(1)*delta1 + bjhono(2)*delta2 + &
  3204. bjhono(3)*delta3 + bjhono(4)*delta4 + &
  3205. bjhono(5)*delta5
  3206. ! N2O5 -> NO3 + NO2
  3207. rj(k,jn2o5a) = bjn2o5a(1)*delta1 + bjn2o5a(2)*delta2 + &
  3208. bjn2o5a(3)*delta3 + bjn2o5a(4)*delta4 + &
  3209. bjn2o5a(5)*delta5 + bjn2o5a(6)*delta6
  3210. ! N2O5 -> NO3 + NO
  3211. rj(k,jn2o5b) = bjn2o5b(1)*delta1 + bjn2o5b(2)*delta2 + &
  3212. bjn2o5b(3)*delta3
  3213. ! PAN -> NO2 + C2O3
  3214. rj(k,jpana) = bjpana(1)*delta1 + bjpana(2)*delta2 + &
  3215. bjpana(3)*delta3 + bjpana(4)*delta4 + &
  3216. bjpana(5)*delta5 + bjpana(6)*delta6
  3217. ! PAN -> NO3 + CH3O2
  3218. rj(k,jpanb) = bjpanb(1)*delta1 + bjpanb(2)*delta2 + &
  3219. bjpanb(3)*delta3 + bjpanb(4)*delta4 + &
  3220. bjpanb(5)*delta5 + bjpanb(6)*delta6
  3221. ! CH2O -> CO
  3222. rj(k,jach2o) = bjcoh2(2)*delta2 + bjcoh2(3)*delta3 &
  3223. + bjcoh2(4)*delta4 + bjcoh2(5)*delta5 &
  3224. + bjcoh2(6)*delta6
  3225. ! CH2O -> COH + H
  3226. rj(k,jbch2o) = bjchoh(1)*delta1 + bjchoh(2)*delta2 &
  3227. + bjchoh(3)*delta3 + bjchoh(4)*delta4 &
  3228. + bjchoh(5)*delta5 + bjchoh(6)*delta6
  3229. ! H2O2 -> 2OH
  3230. rj(k,jh2o2) = bjh2o2(1)*delta1 + bjh2o2(2)*delta2 &
  3231. + bjh2o2(3)*delta3 + bjh2o2(4)*delta4 &
  3232. + bjh2o2(5)*delta5 + bjh2o2(6)*delta6
  3233. ! NO3 -> NO2 + O
  3234. rj(k,jano3) = bjno2o(6)*delta6 + bjno2o(7)*delta7
  3235. ! NO3 -> NO
  3236. rj(k,jbno3) = bjnoo2(7)*delta7
  3237. ! CH3OOH -> HCHO + HO2 + OH
  3238. rj(k,jmepe) = bjch3ooh(1)*delta1 + bjch3ooh(2)*delta2 + &
  3239. bjch3ooh(3)*delta3 + bjch3ooh(4)*delta4 + &
  3240. bjch3ooh(5)*delta5 + bjch3ooh(6)*delta6
  3241. ! ALD2 -> 2HO2 + CO + CH3O2
  3242. rj(k,jald2) = bjald2(1)*delta1 + bjald2(2)*delta2 + &
  3243. bjald2(3)*delta3 + bjald2(4)*delta4 + &
  3244. bjald2(5)*delta5
  3245. ! CH3ONO2 -> HO2 + NO2
  3246. rj(k,jorgn) = bjch3ono2(1)*delta1 + bjch3ono2(2)*delta2 + &
  3247. bjch3ono2(3)*delta3 + bjch3ono2(4)*delta4 + &
  3248. bjch3ono2(5)*delta5
  3249. ! CH3COCHO -> C2O3 + HO2 + CO
  3250. rj(k,jmgly) = bjch3cocho(2)*delta2 + bjch3cocho(3)*delta3 + &
  3251. bjch3cocho(4)*delta4 + bjch3cocho(5)*delta5 + &
  3252. bjch3cocho(6)*delta6 + bjch3cocho(7)*delta7
  3253. ! ISPD -> 0.333CO + 0.067ALD2 + 0.9CH2O + 0.832PAR + 1.033HO2 + 0.7XO2 + 0.967C2O3
  3254. rj(k,jispd) = bjispd(2)*delta2 + bjispd(3)*delta3 + &
  3255. bjispd(4)*delta4 + bjispd(5)*delta5 + &
  3256. bjispd(6)*delta6
  3257. !ch3coch3 -> 2CH3O2 + CO
  3258. rj(k,ja_acet) = bj_a_acet(2)*delta2 + bj_a_acet(3)*delta3 + bj_a_acet(4)*delta4
  3259. rj(k,jb_acet) = bj_b_acet(2)*delta2 + bj_b_acet(3)*delta3 + bj_b_acet(4)*delta4
  3260. if(zangle>80. .and. zangle<=85.) then
  3261. rj(k,jo3d) = 0. ; rj(k,jhno3) = 0. ; rj(k,jhno4) = 0. ; rj(k,jn2o5a) = 0. ; rj(k,jn2o5b) = 0.
  3262. rj(k,jhono) = 0. ; rj(k,jh2o2) = 0. ; rj(k,jach2o) = 0. ; rj(k,jpana) = 0. ; rj(k,jpanb) = 0.
  3263. rj(k,jald2) = 0. ; rj(k,jorgn) = 0. ; rj(k,jbch2o) = 0. ; rj(k,jmgly) = 0.
  3264. rj(k,jo2) = 0. ; rj(k,jispd) = 0. ; rj(k,ja_acet) = 0. ; rj(k,jb_acet) = 0.
  3265. ! O2 -> 2O3P
  3266. rj(k,jo2) = bjo2(1)*delta1_spec
  3267. ! O3 -> O(1D) + O2
  3268. rj(k,jo3d) = bjo1d(1)*delta1_spec + bjo1d(2)*delta2 + &
  3269. bjo1d(3)*delta3_spec + bjo1d(4)*delta4 + &
  3270. bjo1d(5)*delta5
  3271. ! HNO3 -> OH + NO2
  3272. rj(k,jhno3) = bjhno3(1)*delta1_spec + bjhno3(2)*delta2 + &
  3273. bjhno3(3)*delta3_spec + bjhno3(4)*delta4 + &
  3274. bjhno3(5)*delta5 + bjhno3(6)*delta6
  3275. ! N2O5 -> NO3 + NO2
  3276. rj(k,jn2o5a) = bjn2o5a(1)*delta1_spec + bjn2o5a(2)*delta2 + &
  3277. bjn2o5a(3)*delta3_spec + bjn2o5a(4)*delta4 + &
  3278. bjn2o5a(5)*delta5 + bjn2o5a(6)*delta6
  3279. ! N2O5 -> NO3 + NO
  3280. rj(k,jn2o5b) = bjn2o5b(1)*delta1_spec + bjn2o5b(2)*delta2 + &
  3281. bjn2o5b(3)*delta3_spec
  3282. ! PAN
  3283. rj(k,jpana) = bjpana(1)*delta1_spec + bjpana(2)*delta2 + &
  3284. bjpana(3)*delta3_spec + bjpana(4)*delta4 + &
  3285. bjpana(5)*delta5 + bjpana(6)*delta6
  3286. rj(k,jpanb) = bjpanb(1)*delta1_spec + bjpanb(2)*delta2 + &
  3287. bjpanb(3)*delta3_spec + bjpanb(4)*delta4 + &
  3288. bjpanb(5)*delta5 + bjpanb(6)*delta6
  3289. ! ORGNTR -> HO2 + NO2
  3290. rj(k,jorgn) = bjch3ono2(1)*delta1_spec + bjch3ono2(2)*delta2 + &
  3291. bjch3ono2(3)*delta3_spec + bjch3ono2(4)*delta4 + &
  3292. bjch3ono2(5)*delta5
  3293. ! ALD2 -> 2HO2 + CO + CH3O2
  3294. rj(k,jald2) = bjald2(1)*delta1_spec + bjald2(2)*delta2 + &
  3295. bjald2(3)*delta3_spec + bjald2(4)*delta4 + &
  3296. bjald2(5)*delta5
  3297. ! NO2 -> O3
  3298. rj(k,jno2) = bjno2(1)*delta1_spec + bjno2(2)*delta2 + &
  3299. bjno2(3)*delta3_spec + bjno2(4)*delta4 + &
  3300. bjno2(5)*delta5 + bjno2(6)*delta6
  3301. ! CH2O -> CO
  3302. rj(k,jach2o) = bjcoh2(2)*delta2 + bjcoh2(3)*delta3_spec + &
  3303. bjcoh2(4)*delta4 + bjcoh2(5)*delta5 + &
  3304. bjcoh2(6)*delta6
  3305. ! CH2O -> COH + H
  3306. rj(k,jbch2o) = bjchoh(1)*delta1_spec + bjchoh(2)*delta2 + &
  3307. bjchoh(3)*delta3_spec + bjchoh(4)*delta4 + &
  3308. bjchoh(5)*delta5 + bjchoh(6)*delta6
  3309. rj(k,jhno4) = bjhno4(1)*delta1_spec + bjhno4(2)*delta2 + &
  3310. bjhno4(3)*delta3_spec + bjhno4(4)*delta4 + &
  3311. bjhno4(5)*delta5
  3312. rj(k,jhono) = bjhono(1)*delta1_spec + bjhono(2)*delta2 + &
  3313. bjhono(3)*delta3_spec + bjhono(4)*delta4 + &
  3314. bjhono(5)*delta5
  3315. ! H2O2 -> 2OH
  3316. rj(k,jh2o2) = bjh2o2(1)*delta1_spec + bjh2o2(2)*delta2 + &
  3317. bjh2o2(3)*delta3_spec + bjh2o2(4)*delta4 + &
  3318. bjh2o2(5)*delta5 + bjh2o2(6)*delta6
  3319. ! CH3OOH -> HCHO + HO2 + OH
  3320. rj(k,jmepe) = bjch3ooh(1)*delta1_spec + bjch3ooh(2)*delta2 + &
  3321. bjch3ooh(3)*delta3_spec + bjch3ooh(4)*delta4 + &
  3322. bjch3ooh(5)*delta5 + bjch3ooh(6)*delta6
  3323. ! CH3COCHO -> C2O3 + HO2 + CO
  3324. rj(k,jmgly) = bjch3cocho(2)*delta2 + bjch3cocho(3)*delta3_spec + &
  3325. bjch3cocho(4)*delta4 + bjch3cocho(5)*delta5 + &
  3326. bjch3cocho(6)*delta6 + bjch3cocho(7)*delta7
  3327. ! ispd -> 0.333CO + 0.067ALD2 + 0.9CH2O + 0.832PAR + 1.033HO2 + 0.7XO2 + 0.967C2O3
  3328. rj(k,jispd) = bjispd(2)*delta2 + bjispd(3)*delta3_spec + &
  3329. bjispd(4)*delta4 + bjispd(5)*delta5 + &
  3330. bjispd(6)*delta6
  3331. rj(k,ja_acet) = bj_a_acet(2)*delta2 + bj_a_acet(3)*delta3_spec + bj_a_acet(4)*delta4
  3332. rj(k,jb_acet) = bj_b_acet(2)*delta2 + bj_b_acet(3)*delta3_spec + bj_b_acet(4)*delta4
  3333. endif ! sza > 80.
  3334. rj(k,jrooh) = rj(k,jmepe)
  3335. !
  3336. ! take the upper limit for the photolysis rate i.e. qy=0.05
  3337. !
  3338. rj(k,jispd) = 0.05*rj(k,jispd)
  3339. !
  3340. ! Two channels of CH3O2NO2 photo-dissociation equal to HNO4 photolysis
  3341. ! Taken from Browne et al, ACP, 2011
  3342. !
  3343. rj(k,jmo2no2a) = rj(k,jhno4)
  3344. rj(k,jmo2no2b) = rj(k,jhno4)
  3345. enddo ! layers
  3346. END SUBROUTINE PHOTORATES_TROPO
  3347. !EOC
  3348. !------------------------------------------------------------------------------
  3349. ! TM5 !
  3350. !------------------------------------------------------------------------------
  3351. !BOP
  3352. !
  3353. ! !IROUTINE: PHOTOLYSIS_DONE
  3354. !
  3355. ! !DESCRIPTION: Deallocates photolysis data, and writes photolysis statistics:
  3356. ! output (e.g. monthly) averaged photolysis jo3, jno2 and
  3357. ! surface data of: albedo, cloud-cover, cloud optical thickness
  3358. ! total ozone
  3359. !\\
  3360. !\\
  3361. ! !INTERFACE:
  3362. !
  3363. SUBROUTINE PHOTOLYSIS_DONE( status )
  3364. !
  3365. ! !USES:
  3366. !
  3367. use dims, only : im, jm, lm, nregions
  3368. use dims, only : idatei, idatee
  3369. use global_data, only : outdir
  3370. #ifdef with_hdf4
  3371. use file_hdf, only : THdfFile, TSds
  3372. use file_hdf, only : Init, Done, WriteAttribute, Init, Done, WriteData
  3373. #endif
  3374. use partools, only : isRoot
  3375. !
  3376. ! !OUTPUT PARAMETERS:
  3377. !
  3378. integer, intent(out) :: status
  3379. !
  3380. ! !REVISION HISTORY:
  3381. ! 21 Mar 2012 - P. Le Sager - adapted for lon-lat MPI domain decomposition
  3382. !
  3383. ! !REMARKS:
  3384. ! (1) Called from SOURCES_SINKS/TRACE_END
  3385. !
  3386. !EOP
  3387. !------------------------------------------------------------------------------
  3388. !BOC
  3389. character(len=*), parameter :: rname = mname//'/end_photolysis'
  3390. integer :: region
  3391. integer :: n
  3392. integer :: k,iret,imr,jmr,lmr
  3393. real, allocatable :: average_field(:,:,:), average_field_2d(:,:), average_field_5d(:,:,:,:,:)
  3394. #ifdef with_hdf4
  3395. type(THdfFile) :: io
  3396. type(TSds) :: sds
  3397. #endif
  3398. character(len=256) :: fname
  3399. ! --- begin --------------------------------
  3400. if (isRoot) then
  3401. write (fname,'(a,"/j_statistics_",i4.4,3i2.2,"_",i4.4,3i2.2,".hdf")') &
  3402. trim(outdir), idatei(1:4), idatee(1:4)
  3403. #ifdef with_hdf4
  3404. call Init(io,fname,'create',status)
  3405. IF_ERROR_RETURN(status=1)
  3406. #endif
  3407. end if
  3408. REG: do region=1,nregions
  3409. if(isRoot) then
  3410. imr=im(region)
  3411. jmr=jm(region)
  3412. lmr=lm(region)
  3413. else
  3414. imr=1; jmr=1; lmr=1
  3415. end if
  3416. allocate(average_field(imr,jmr,lmr))
  3417. ! Assume that the nav is the same on all proc
  3418. write (gol,*) 'end_photolysis: j_statistics ', &
  3419. '(region, nj_av, nvo3s_av, ncloud_av)', region, &
  3420. phot_dat(region)%nj_av, phot_dat(region)%nvo3s_av; call goPr
  3421. #ifdef with_hdf4
  3422. !---- 3D fields
  3423. if ( phot_dat(region)%nj_av > 0 ) then
  3424. call gather(dgrid(region), phot_dat(region)%jo3_av, average_field, 0, status)
  3425. if ( isRoot ) then
  3426. average_field = average_field/phot_dat(region)%nj_av
  3427. call Init(Sds,io,'jo3_av',(/imr,jmr,lmr/),'real(4)',status)
  3428. IF_ERROR_RETURN(status=1)
  3429. call WriteAttribute(Sds,'Unit','1/s',status)
  3430. IF_ERROR_RETURN(status=1)
  3431. call WriteData(Sds,average_field,status)
  3432. IF_ERROR_RETURN(status=1)
  3433. call Done(Sds,status)
  3434. IF_ERROR_RETURN(status=1)
  3435. end if
  3436. call gather(dgrid(region), phot_dat(region)%jno2_av, average_field, 0, status)
  3437. if ( isRoot ) then
  3438. average_field = average_field/phot_dat(region)%nj_av
  3439. call Init(Sds,io,'jno2_av',(/imr,jmr,lmr/),'real(4)',status)
  3440. IF_ERROR_RETURN(status=1)
  3441. call WriteAttribute(Sds,'Unit','1/s',status)
  3442. IF_ERROR_RETURN(status=1)
  3443. call WriteData(Sds,average_field,status)
  3444. IF_ERROR_RETURN(status=1)
  3445. call Done(Sds,status)
  3446. IF_ERROR_RETURN(status=1)
  3447. end if
  3448. call gather(dgrid(region), phot_dat(region)%jhno2_av, average_field, 0, status)
  3449. if ( isRoot ) then
  3450. average_field = average_field/phot_dat(region)%nj_av
  3451. call Init(Sds,io,'jhno2_av',(/imr,jmr,lmr/),'real(4)',status)
  3452. IF_ERROR_RETURN(status=1)
  3453. call WriteAttribute(Sds,'Unit','1/s',status)
  3454. IF_ERROR_RETURN(status=1)
  3455. call WriteData(Sds,average_field,status)
  3456. IF_ERROR_RETURN(status=1)
  3457. call Done(Sds,status)
  3458. IF_ERROR_RETURN(status=1)
  3459. end if
  3460. call gather(dgrid(region), phot_dat(region)%jch2oa_av, average_field, 0, status)
  3461. if ( isRoot ) then
  3462. average_field = average_field/phot_dat(region)%nj_av
  3463. call Init(Sds,io,'jch2oa_av',(/imr,jmr,lmr/),'real(4)',status)
  3464. IF_ERROR_RETURN(status=1)
  3465. call WriteAttribute(Sds,'Unit','1/s',status)
  3466. IF_ERROR_RETURN(status=1)
  3467. call WriteData(Sds,average_field,status)
  3468. IF_ERROR_RETURN(status=1)
  3469. call Done(Sds,status)
  3470. IF_ERROR_RETURN(status=1)
  3471. end if
  3472. call gather(dgrid(region), phot_dat(region)%jch2ob_av, average_field, 0, status)
  3473. if ( isRoot ) then
  3474. average_field = average_field/phot_dat(region)%nj_av
  3475. call Init(Sds,io,'jch2ob_av',(/imr,jmr,lmr/),'real(4)',status)
  3476. IF_ERROR_RETURN(status=1)
  3477. call WriteAttribute(Sds,'Unit','1/s',status)
  3478. IF_ERROR_RETURN(status=1)
  3479. call WriteData(Sds,average_field,status)
  3480. IF_ERROR_RETURN(status=1)
  3481. call Done(Sds,status)
  3482. IF_ERROR_RETURN(status=1)
  3483. end if
  3484. call gather(dgrid(region), phot_dat(region)%reff_av, average_field, 0, status)
  3485. if ( isRoot ) then
  3486. call Init(Sds,io,'reff_av',(/imr,jmr,lmr/),'real(4)',status)
  3487. IF_ERROR_RETURN(status=1)
  3488. call WriteAttribute(Sds,'Unit','um',status)
  3489. IF_ERROR_RETURN(status=1)
  3490. call WriteData(Sds,average_field,status)
  3491. IF_ERROR_RETURN(status=1)
  3492. call Done(Sds,status)
  3493. IF_ERROR_RETURN(status=1)
  3494. end if
  3495. call gather(dgrid(region), phot_dat(region)%lwp_av, average_field, 0, status)
  3496. if ( isRoot ) then
  3497. call Init(Sds,io,'lwp_av',(/imr,jmr,lmr/),'real(4)',status)
  3498. IF_ERROR_RETURN(status=1)
  3499. call WriteAttribute(Sds,'Unit','g/m2',status)
  3500. IF_ERROR_RETURN(status=1)
  3501. call WriteData(Sds,average_field,status)
  3502. IF_ERROR_RETURN(status=1)
  3503. call Done(Sds,status)
  3504. IF_ERROR_RETURN(status=1)
  3505. end if
  3506. end if
  3507. ! ---- 2D fields
  3508. if ( phot_dat(region)%nalb_av > 0 ) then
  3509. allocate(average_field_2d(imr,jmr))
  3510. call gather(dgrid(region), phot_dat(region)%ags_av, average_field_2d, 0, status)
  3511. if(isRoot) then
  3512. average_field_2d = average_field_2d / phot_dat(region)%nalb_av
  3513. call Init(Sds,io,'ags_av',(/imr,jmr/),'real(4)',status)
  3514. IF_ERROR_RETURN(status=1)
  3515. call WriteAttribute(Sds,'Unit','Fraction',status)
  3516. IF_ERROR_RETURN(status=1)
  3517. call WriteData(Sds,average_field_2d,status)
  3518. IF_ERROR_RETURN(status=1)
  3519. call Done(Sds,status)
  3520. IF_ERROR_RETURN(status=1)
  3521. end if
  3522. call gather(dgrid(region), phot_dat(region)%sza_av, average_field_2d, 0, status)
  3523. if ( isRoot ) then
  3524. average_field_2d = average_field_2d / phot_dat(region)%nalb_av
  3525. call Init(Sds,io,'sza_av',(/imr,jmr/),'real(4)',status)
  3526. IF_ERROR_RETURN(status=1)
  3527. call WriteAttribute(Sds,'Unit','Zenith Angle',status)
  3528. IF_ERROR_RETURN(status=1)
  3529. call WriteData(Sds,average_field_2d,status)
  3530. IF_ERROR_RETURN(status=1)
  3531. call Done(Sds,status)
  3532. IF_ERROR_RETURN(status=1)
  3533. end if
  3534. deallocate(average_field_2d)
  3535. end if ! any 2D field
  3536. ! Clouds data (3D)
  3537. if ( phot_dat(region)%ncloud_av > 0 ) then
  3538. call gather(dgrid(region), phot_dat(region)%pmcld_av, average_field, 0, status)
  3539. if ( isRoot ) then
  3540. average_field = average_field/phot_dat(region)%ncloud_av
  3541. call Init(Sds,io,'pmcld_av',(/imr,jmr,lmr/),'real(4)',status)
  3542. IF_ERROR_RETURN(status=1)
  3543. call WriteAttribute(Sds,'Unit',' ',status)
  3544. IF_ERROR_RETURN(status=1)
  3545. call WriteData(Sds,average_field,status)
  3546. IF_ERROR_RETURN(status=1)
  3547. call Done(Sds,status)
  3548. IF_ERROR_RETURN(status=1)
  3549. endif
  3550. call gather(dgrid(region), phot_dat(region)%taus_cld_av, average_field, 0, status)
  3551. if ( isRoot ) then
  3552. average_field = average_field/phot_dat(region)%ncloud_av
  3553. call Init(Sds,io,'taus_cld_av',(/imr,jmr,lmr/),'real(4)',status)
  3554. IF_ERROR_RETURN(status=1)
  3555. call WriteAttribute(Sds,'Unit',' ',status)
  3556. IF_ERROR_RETURN(status=1)
  3557. call WriteData(Sds,average_field,status)
  3558. IF_ERROR_RETURN(status=1)
  3559. call Done(Sds,status)
  3560. IF_ERROR_RETURN(status=1)
  3561. end if
  3562. call gather(dgrid(region), phot_dat(region)%taua_cld_av, average_field, 0, status)
  3563. if ( isRoot ) then
  3564. average_field = average_field/phot_dat(region)%ncloud_av
  3565. call Init(Sds,io,'taua_cld_av',(/imr,jmr,lmr/),'real(4)',status)
  3566. IF_ERROR_RETURN(status=1)
  3567. call WriteAttribute(Sds,'Unit',' ',status)
  3568. IF_ERROR_RETURN(status=1)
  3569. call WriteData(Sds,average_field,status)
  3570. IF_ERROR_RETURN(status=1)
  3571. call Done(Sds,status)
  3572. IF_ERROR_RETURN(status=1)
  3573. end if
  3574. end if
  3575. ! Aerosols info (5D)
  3576. if ( phot_dat(region)%naer_av > 0 ) then
  3577. allocate(average_field_5d(imr,jmr,lmr,nbands_trop,ngrid))
  3578. call gather(dgrid(region), phot_dat(region)%pmaer_av, average_field_5d, 0, status)
  3579. if ( isRoot ) then
  3580. average_field_5d = average_field_5d/phot_dat(region)%naer_av
  3581. call Init(Sds,io,'pmaer_av',(/imr,jmr,lmr,nbands_trop,ngrid/),'real(4)',status)
  3582. IF_ERROR_RETURN(status=1)
  3583. call WriteAttribute(Sds,'Unit',' ',status)
  3584. IF_ERROR_RETURN(status=1)
  3585. call WriteData(Sds,average_field_5d,status)
  3586. IF_ERROR_RETURN(status=1)
  3587. call Done(Sds,status)
  3588. IF_ERROR_RETURN(status=1)
  3589. end if
  3590. call gather(dgrid(region), phot_dat(region)%taus_aer_av, average_field_5d, 0, status)
  3591. if ( isRoot ) then
  3592. average_field_5d = average_field_5d/phot_dat(region)%naer_av
  3593. call Init(Sds,io,'taus_aer_av',(/imr,jmr,lmr,nbands_trop,ngrid/),'real(4)',status)
  3594. IF_ERROR_RETURN(status=1)
  3595. call WriteAttribute(Sds,'Unit',' ',status)
  3596. IF_ERROR_RETURN(status=1)
  3597. call WriteData(Sds,average_field_5d,status)
  3598. IF_ERROR_RETURN(status=1)
  3599. call Done(Sds,status)
  3600. IF_ERROR_RETURN(status=1)
  3601. end if
  3602. call gather(dgrid(region), phot_dat(region)%taua_aer_av, average_field_5d, 0, status)
  3603. if ( isRoot ) then
  3604. average_field_5d = average_field_5d/phot_dat(region)%naer_av
  3605. call Init(Sds,io,'taua_aer_av',(/imr,jmr,lmr,nbands_trop,ngrid/),'real(4)',status)
  3606. IF_ERROR_RETURN(status=1)
  3607. call WriteAttribute(Sds,'Unit',' ',status)
  3608. IF_ERROR_RETURN(status=1)
  3609. call WriteData(Sds,average_field_5d,status)
  3610. IF_ERROR_RETURN(status=1)
  3611. call Done(Sds,status)
  3612. IF_ERROR_RETURN(status=1)
  3613. end if
  3614. deallocate(average_field_5d)
  3615. end if
  3616. if ( phot_dat(region)%nsad_av >0 ) then
  3617. call gather(dgrid(region), phot_dat(region)%sad_cld_av, average_field, 0, status)
  3618. if ( isRoot ) then
  3619. average_field = average_field/phot_dat(region)%nsad_av
  3620. call Init(Sds,io,'sad_cld',(/imr,jmr,lmr/),'real(4)',status)
  3621. IF_ERROR_RETURN(status=1)
  3622. call WriteAttribute(Sds,'Unit','cm^2/cm^3 ',status)
  3623. call WriteAttribute(Sds,'long_name','average water cloud surface area density',status)
  3624. IF_ERROR_RETURN(status=1)
  3625. call WriteData(Sds,average_field,status)
  3626. IF_ERROR_RETURN(status=1)
  3627. call Done(Sds,status)
  3628. IF_ERROR_RETURN(status=1)
  3629. endif
  3630. call gather(dgrid(region), phot_dat(region)%sad_ice_av, average_field, 0, status)
  3631. if ( isRoot ) then
  3632. average_field = average_field/phot_dat(region)%nsad_av
  3633. call Init(Sds,io,'sad_ice',(/imr,jmr,lmr/),'real(4)',status)
  3634. IF_ERROR_RETURN(status=1)
  3635. call WriteAttribute(Sds,'Unit','cm^2/cm^3 ',status)
  3636. call WriteAttribute(Sds,'long_name','average ice cloud surface area density',status)
  3637. IF_ERROR_RETURN(status=1)
  3638. call WriteData(Sds,average_field,status)
  3639. IF_ERROR_RETURN(status=1)
  3640. call Done(Sds,status)
  3641. IF_ERROR_RETURN(status=1)
  3642. endif
  3643. call gather(dgrid(region), phot_dat(region)%sad_aer_av, average_field, 0, status)
  3644. if ( isRoot ) then
  3645. average_field = average_field/phot_dat(region)%nsad_av
  3646. call Init(Sds,io,'sad_aer',(/imr,jmr,lmr/),'real(4)',status)
  3647. IF_ERROR_RETURN(status=1)
  3648. call WriteAttribute(Sds,'Unit','cm^2/cm^3 ',status)
  3649. call WriteAttribute(Sds,'long_name','average aerosol surface area density',status)
  3650. IF_ERROR_RETURN(status=1)
  3651. call WriteData(Sds,average_field,status)
  3652. IF_ERROR_RETURN(status=1)
  3653. call Done(Sds,status)
  3654. IF_ERROR_RETURN(status=1)
  3655. endif
  3656. end if
  3657. #endif
  3658. deallocate(average_field)
  3659. end do REG
  3660. #ifdef with_hdf4
  3661. if ( isRoot ) then
  3662. call Done(io, status)
  3663. IF_ERROR_RETURN(status=1)
  3664. endif
  3665. #endif
  3666. do region = 1,nregions
  3667. if (associated( phot_dat(region)%o3klim_top)) deallocate(phot_dat(region)%o3klim_top )
  3668. deallocate(phot_dat(region)%albedo )
  3669. deallocate(phot_dat(region)%aero_surface_clim)
  3670. deallocate(phot_dat(region)%cloud_reff )
  3671. deallocate(phot_dat(region)%pmcld )
  3672. deallocate(phot_dat(region)%taus_cld )
  3673. deallocate(phot_dat(region)%taua_cld )
  3674. deallocate(phot_dat(region)%pmaer )
  3675. deallocate(phot_dat(region)%taus_aer )
  3676. deallocate(phot_dat(region)%taua_aer )
  3677. deallocate(phot_dat(region)%lwp_av )
  3678. deallocate(phot_dat(region)%cfr_av )
  3679. deallocate(phot_dat(region)%reff_av )
  3680. deallocate(phot_dat(region)%ags_av )
  3681. deallocate(phot_dat(region)%sza_av )
  3682. deallocate(phot_dat(region)%jo3 )
  3683. deallocate(phot_dat(region)%jno2 )
  3684. deallocate(phot_dat(region)%jhno2 )
  3685. deallocate(phot_dat(region)%jch2oa )
  3686. deallocate(phot_dat(region)%jch2ob )
  3687. deallocate(phot_dat(region)%jo3_av )
  3688. deallocate(phot_dat(region)%jno2_av )
  3689. deallocate(phot_dat(region)%jhno2_av )
  3690. deallocate(phot_dat(region)%jch2oa_av )
  3691. deallocate(phot_dat(region)%jch2ob_av )
  3692. deallocate(phot_dat(region)%taua_aer_av)
  3693. deallocate(phot_dat(region)%taus_aer_av)
  3694. deallocate(phot_dat(region)%pmaer_av )
  3695. deallocate(phot_dat(region)%taua_cld_av)
  3696. deallocate(phot_dat(region)%taus_cld_av)
  3697. deallocate(phot_dat(region)%pmcld_av )
  3698. deallocate(phot_dat(region)%v2 )
  3699. deallocate(phot_dat(region)%v3 )
  3700. deallocate(phot_dat(region)%v3_surf )
  3701. deallocate(phot_dat(region)%qy_ch3cocho)
  3702. deallocate(phot_dat(region)%qy_c2o3 )
  3703. deallocate(phot_dat(region)%sad_cld )
  3704. deallocate(phot_dat(region)%sad_ice )
  3705. deallocate(phot_dat(region)%sad_aer )
  3706. deallocate(phot_dat(region)%sad_cld_av )
  3707. deallocate(phot_dat(region)%sad_ice_av )
  3708. deallocate(phot_dat(region)%sad_aer_av )
  3709. end do
  3710. #ifdef with_optics
  3711. deallocate( wdep ) !NB optics_done
  3712. #endif
  3713. ! ok
  3714. status = 0
  3715. END SUBROUTINE PHOTOLYSIS_DONE
  3716. !EOC
  3717. END MODULE PHOTOLYSIS