eqsam_param.F90 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717
  1. !
  2. #include "tm5.inc"
  3. !
  4. module eqsam_param
  5. implicit none
  6. private
  7. public :: eqsam_v03d
  8. contains
  9. subroutine eqsam_v03d(yi,yo,nca,nco,iopt,loop,imax,ipunit,in)
  10. !
  11. implicit none
  12. !___________________________________________________________________________________________________________________________________
  13. ! Written by Swen Metzger 3/11/99. Modified 2002, 2003.
  14. !
  15. ! Department of Atmospheric Chemistry, Max-Planck-Institute for Chemistry.
  16. ! email: metzger@mpch-mainz.mpg.de
  17. ! http://www.mpch-mainz.mpg.de/~metzger
  18. !
  19. ! COPYRIGHT 1999-2003
  20. !
  21. ! purpose
  22. ! -------
  23. ! EQSAM (EQuilibrium Simplified Aerosol Model) is a new and computationally efficient thermodynamic
  24. ! aerosol composition model that allows to calculate the gas/aerosol equilibrium partitioning,
  25. ! including aerosol water, sufficiently fast and accurate for global (or even regional) modeling.
  26. ! EQSAM is based on a number of parameterizations, including single solute molalities and activity
  27. ! coefficients (AC). The thermodynamic framework (domains and subdomains, internally mixed aerosols)
  28. ! is the same as of more sophisticated thermodynamic equilibrium models (EQMs), e.g. of ISORROPIA
  29. ! (Nenes et al., 1998). Details are given in the references below (and the references therein).
  30. !
  31. ! The main assumption on which EQSAM/EQMs are based is thermodynamical and chemical equilibrium.
  32. ! From this assumption it directly follows that the aerosol water activity (aw) equals the ambient
  33. ! relative humidity (RH), if the water vapor pressure is sufficiently larger than the partial vapor
  34. ! pressure of the aerosol compounds. This is approximately true for tropospheric aerosols. Given the
  35. ! large amount of water vapor present, water vapor and aerosol water equilibrate relatively faster
  36. ! compared to all other aerosol compounds. This is subsequently also true for single aerosol compounds.
  37. ! The water activity of single solutes must also equal RH under this assumption. Therefore, the so
  38. ! called ZSR-relation is (and can be) used to calculate the aerosol associated water mass (simply
  39. ! from the sum of all water mass fractions that are derived from measured single solute molalities).
  40. !
  41. ! In contrast to other EQMs, EQSAM utilizes the fact that the RH fixes the water activity
  42. ! (under the above assumptions) and the consequence that any changes in RH also causes changes in
  43. ! the aerosol water mass and, hence, aerosol activity (including activity coefficients). Thus, an decrease
  44. ! (increase) in RH decrease (increases) the aerosol water mass (and water activity). This can change the
  45. ! aerosol composition, e.g. due to condensation (evaporation/crystallization), because the vapor pressure
  46. ! above the aerosol reduces (increases). In turn, a vapor pressure reduction (increase) due to changes
  47. ! in the aerosol composition is compensated by an associated condensation (evaporation) of water vapor
  48. ! to maintain the aerosol molality to remain constant (because aw=RH). Furthermore, the aerosol water
  49. ! mainly depends on the aerosol mass and the type of solute, so that parameterizations of single solute
  50. ! molalities and activity coefficients can be defined, only depending on the type of solute and RH.
  51. ! The advantage of using such parameterizations is that the entire aerosol equilibrium composition
  52. ! can be solved analytically, i.e. non-iteratively, which considerably reduces the amount of CPU time
  53. ! that is usually need for aerosol thermodynamic calculations (especially if an EQM is incorporated in
  54. ! an aerosol dynamical model that is in turn embedded in a high resolution regional or global model).
  55. !
  56. ! However, EQSAM should still be regarded as a starting point for further developments. There is still
  57. ! room for improvements. For instance, this code is not yet numerically optimized (vectorized) and a
  58. ! number of improvements with respect to an explicit treatment of additional equilibrium reactions,
  59. ! missing (or only implicit) dissociation, and a basic parameterization of the water uptake.
  60. !
  61. ! Note that EQSAM was originally developed to calculate the gas/aerosol equilibrium partitioning of the
  62. ! ammonium-sulfate-nitrate-water system for climate models, excluding solid compounds.
  63. ! This version (eqsam_v03d.f90) is extended with respect to sea salt. Solids/hysteresis are treated in a
  64. ! simplified manner. Results of a box model comparison with ISORROPIA will be available from the web page.
  65. ! Please also note that the water uptake is based on additional (unpublished) parameterizations for single
  66. ! solute molalities, which are derived from tabulated measurements used in ISORROPIA. Note further that
  67. ! this extended version (eqsam_v03d.f90) is not yet published. A publication is in progress.
  68. !
  69. ! ToDo:
  70. ! Split ion-pairs into ions for water parameterizations (since info is actually available)
  71. ! Include uptake/dissociation of NH3, HNO3, HCl (mainly to get pH right at near neutral conditions)
  72. ! Extension to K+,Ca++,Mg++, CO2/(CO3)2--/HCO3-,SOA,etc.. (maybe not)
  73. ! Vectorization. Translation of hardcoded formulas in array syntax.
  74. ! I/O Interface and program structure clean up.
  75. ! EQSAM info webpage.
  76. !
  77. ! Version History:
  78. !
  79. ! eqsam_v03d.f90 (MPI-CH, June 2003):
  80. ! - gama parameterizations now according to Metzger 2002 (JGR Appendix)
  81. ! - improved pH calculations (still restricted to strong acids)
  82. ! - removed bug that lead to too high nitrate formation at dry and cold regions (UT/LS)
  83. ! - removed bug in solid/hysteresis calculations
  84. ! (both bugs introduced in eqsam_v03b.f90 by cleaning up eqsam_v02a.f90)
  85. !
  86. ! eqsam_v03c.f90 (MPI-CH, April 2003):
  87. ! - more accurate paramterizations of single solute molalities (Na, Cl species)
  88. ! - cleanded up RHD subdomain structure
  89. ! - improved water uptake (Na, Cl species)
  90. !
  91. ! eqsam_v03b.f90 (MPI-CH, March 2003):
  92. ! System extended to HCl,Cl-/Na+.
  93. ! Parameterization (fit) of additional HNO3 uptake removed.
  94. ! Instead, complete analytical solution of equilibrium reactions, based on the AC-RH relationship.
  95. ! eqsam_v03.f90 (IMAU, October 1999):
  96. ! Test version (included in TM3).
  97. ! eqsam_v02a.f90 (IMAU, April 2000):
  98. ! Box model version.
  99. ! eqsam_v02.f90 (IMAU, October 1999):
  100. ! TM3 version.
  101. ! Version including solids and additional HNO3 uptake on acidic aerosols (parameterized).
  102. ! eqsam_v01b.f90 (MPI-CH, January 2003):
  103. ! Same as eqsam_v01a.f90 (additional lines though uncommented for test purposes only).
  104. ! eqsam_v01a.f90 (IMAU, April 2000):
  105. ! Box model version.
  106. ! eqsam_v01.f90 (IMAU, October 1999):
  107. ! TM3 version.
  108. ! First and most basic version (without solids) for better vectorization (for global modeling).
  109. ! System: NH3,NH4+/H2SO4+,HSO4-,SO4--/HNO3,NO3-, H2O
  110. ! based on equilibrium / internal mixture assumption / aw=rh / ZSR-relation
  111. ! parameterization of activcity coefficients (AC), i.e. an AC-RH relationship
  112. !
  113. !
  114. ! interface
  115. ! ---------
  116. ! call eqsam_v03d(yi,yo,nca,nco,iopt,loop,imax,ipunit,in)
  117. !
  118. ! yi = input array (imax, nca)
  119. ! yo = output array (imax, nco)
  120. ! imax = max loop (e.g. time steps)
  121. ! nca >= 11
  122. ! nco >= 35
  123. ! iopt = 1 metastable
  124. ! iopt = 2 solids
  125. ! iopt = 3 hysteresis (metastable/solids) for online calculations
  126. ! iopt = 31 hysteresis lower branch
  127. ! iopt = 32 hysteresis upper branch
  128. ! ipunit = I/O unit (can be skipped)
  129. ! in = array (can be skipped)
  130. !
  131. ! method
  132. ! ------
  133. ! equilibrium / internal mixture assumption / aw=rh
  134. ! System: NH3,NH4+/H2SO4+,HSO4-,SO4--/HNO3,NO3-, HCl,Cl-/Na+, H2O
  135. ! (K+,Ca++,Mg++)
  136. ! external
  137. ! --------
  138. ! program eqmd.f90 (driver only needed for the box model version)
  139. ! subroutine gribio.f90 (provides diagnostics output in grib/binary/ascii format)
  140. !
  141. ! references
  142. ! ---------
  143. ! Swen Metzger Ph.D Thesis, University Utrecht, 2000.
  144. ! http://www.library.uu.nl/digiarchief/dip/diss/1930853/inhoud.htm
  145. !
  146. ! Metzger, S. M., F. J. Dentener, J. Lelieveld, and S. N. Pandis,
  147. ! GAS/AEROSOL PARTITIONING I: A COMPUTATIONALLY EFFICIENT MODEL,
  148. ! J Geophys. Res., 107, D16, 10.1029/2001JD001102, 2002
  149. ! http://www.agu.org/journals/jd/jd0216/2001JD001102/index.html
  150. ! Metzger, S. M., F. J. Dentener, A. Jeuken, and M. Krol, J. Lelieveld,
  151. ! GAS/AEROSOL PARTITIONING II: GLOBAL MODELING RESULTS,
  152. ! J Geophys. Res., 107, D16, 10.1029/2001JD001103, 2002.
  153. ! http://www.agu.org/journals/jd/jd0216/2001JD001103/index.html
  154. !___________________________________________________________________________________________________________________________________
  155. real,parameter :: RH_HIST_DW=1.50 ! mean value for mixture of wet (2) and dry (1) gridboxes (needed for HYSTERESIS)
  156. real,parameter :: T0=298.15,T1=298.0,AVO=6.03e23,R=82.0567e-6, & ! in cu.m*atm/deg/mole
  157. r_kcal = 1.986E-3 ! Ideal gas constant [kcal K-1.mole-1]
  158. real,parameter :: RHMAX=0.99,RHMIN=0.0001 ! restrict to max / min RH
  159. real,parameter :: MWNH4=18.,MWSO4=96.,MWNO3=62.,MWCl=35.5 ! mole mass of species considered
  160. real,parameter :: MWNa=23.0,MWCa=40.1,MWN=14.0, MWS=32.1
  161. real,parameter :: MWH20=55.51*18.01,ZERO=0.0
  162. real,parameter :: GF1=0.25,GF2=0.50,GF3=0.40,GF4=1.00,K=2. ! exponents of AC-RH functions
  163. !______________________________________________
  164. integer,parameter :: NPAIR=10
  165. !
  166. integer :: ii,il,IHYST
  167. integer,intent(in) :: nca,nco,imax,loop,ipunit
  168. integer,intent(inout) :: iopt
  169. !______________________________________________
  170. integer,dimension(6),intent(in) :: in
  171. !______________________________________________
  172. real :: T0T,TT,RH,PX,RHD,KAN,KAC,ZIONIC,RH_HIST,GAMA,GG,GF,GFN
  173. real :: X00,X01,X02,X03,X04,X05,X08,X09,X10,X11
  174. real :: X0,X1,X2,X3,X4,X5,X6,XK10,XK6
  175. real :: ZFLAG,ZKAN,ZKAC,PH,COEF,HPLUS,AKW,XKW,MOLAL
  176. real :: TNH4,TSO4,TNO3,TNa,TCl,TPo,TCa,TMg
  177. real :: PNH4,PSO4,PNO3,PCl,PNa,GNO3,GNH3,GSO4,GHCl
  178. real :: ASO4,ANO3,ANH4,ACl,ANa,SNH4,SSO4,SNO3,SCl,SNa
  179. real :: WH2O,PM,PMs,PMt,RINC,DON,RATIONS,GR,NO3P,NH4P
  180. Real :: H2O_NO3
  181. !_______________________________________________
  182. real,dimension(imax,nca),intent(in) :: yi
  183. real,dimension(imax,nco),intent(out) :: yo
  184. real,dimension(8) :: w1,w2
  185. real,dimension(8) :: RHDA,RHDE,RHDX,RHDZ ! RHD / MRHD arrays for different aerosol types
  186. real,dimension(NPAIR) :: M0,MW,NW,ZW ! arrays of ion pairs
  187. !
  188. ! salt solutes:
  189. ! 1 = NACl, 2 = (NA)2SO4, 3 = NANO3, 4 = (NH4)2SO4, 5 = NH4NO3, 6 = NH4CL, 7 = 2H-SO4
  190. ! 8 = NH4HSO4, 9 = NAHSO4, 10 = (NH4)3H(SO4)2
  191. !
  192. DATA MW(1:NPAIR)/ 58.5, 142.0, 88.0, 132.0, 80.0, 53.5, 98.0, 115.0, 120.0, 247.0/ ! mole mass of the salt solute
  193. DATA NW(1:NPAIR)/ 2.0, 2.5, 2.5, 2.5, 3.5, 1.0, 4.5, 2.0, 2.0, 2.5/ ! square of max. dissocation number (not consistent)
  194. DATA ZW(1:NPAIR)/ 0.67, 1.0, 1.0, 1.0, 1.0, 1.0, 0.5, 1.0, 1.0, 1.0/ ! exponents of water activity functions
  195. !
  196. DATA RHDA(1:8)/0.32840, 0.4906, 0.6183, 0.7997, 0.67500, 0.5000, 0.4000, 0.0000/ ! RHD / MRHD values as of ISORROPIA / SCAPE (T=298.15K)
  197. DATA RHDE(1:8)/-1860.0, -431.0, 852.00, 80.000, 262.000, 3951.0, 384.00, 0.0000/ ! Temp. coeff.
  198. !___________________________________________________________________________________________________________________________________
  199. IHYST=2
  200. IF(IOPT.EQ.31) THEN ! SOLID HYSTORY
  201. IHYST=1
  202. IOPT=3
  203. ELSEIF(IOPT.EQ.32) THEN ! WET HISTORY
  204. IHYST=2
  205. IOPT=3
  206. ENDIF
  207. !kt write(ipunit,*)'eqsam_v03d ...'
  208. !kt print*,' '
  209. !kt print*,' EQuilibrium Simplified Aerosol Model (EQSAM)'
  210. !kt print*,' for global modeling '
  211. !kt print*,' by '
  212. !kt print*,' Swen Metzger, MPI-CH '
  213. !kt print*,' Copyright 1999-2003 '
  214. !kt print*,' >> metzger@mpch-mainz.mpg.de << '
  215. !kt print*,' last change: 04. June, 2003 '
  216. !kt print*,' (version 3.0d) '
  217. !kt print*,' gas/aerosol calculations assuming '
  218. !kt print*,' System: NH3,NH4+/H2SO4+,HSO4-,SO4-- '
  219. !kt print*,' HNO3,NO3-, HCl,Cl-/Na+, H2O '
  220. !kt if(iopt.eq.1) then
  221. !kt print*,' metastable aeorsols '
  222. !kt elseif(iopt.eq.2) then
  223. !kt print*,' solid aeorsols '
  224. !kt elseif(iopt.eq.3) then
  225. !kt print*,' hysteresis '
  226. !kt print*,' (metastable/solids) '
  227. !kt if(IHYST.eq.1) then
  228. !kt print*,' solid hystory '
  229. !kt elseif(IHYST.eq.2) then
  230. !kt print*,' wet hystory '
  231. !kt endif
  232. !kt endif
  233. !kt print*,' '
  234. !kt print*,'loop over ',loop,' data sets'
  235. !kt print*,' '
  236. !___________________________________________________________________________________________________________________________________
  237. yo=0.;w1=0.;w2=0. ! init/reset
  238. !___________________________________________________________________________________________________________________________________
  239. do il=1,loop
  240. ! get old relative humidity to calculate aerosol hysteresis (online only)
  241. RH_HIST = 2. ! WET HISTORY (DEFAULT)
  242. IF(IHYST.EQ.1.OR.IOPT.EQ.2) RH_HIST = 1. ! SET TO SOLIDS
  243. ! meteorology
  244. TT = yi(il,1) ! T [K]
  245. RH = yi(il,2) ! RH [0-1]
  246. PX = yi(il,11) ! p [hPa]
  247. !
  248. ! gas+aerosol:
  249. w1(1) = yi(il,6) ! Na+ (ss + xsod) (a) [umol/m^3 air]
  250. w1(2) = yi(il,4) ! H2SO4 + SO4-- (p) [umol/m^3 air]
  251. w1(3) = yi(il,3) ! NH3 (g) + NH4+ (p) [umol/m^3 air]
  252. w1(4) = yi(il,5) ! HNO3 (g) + NO3- (p) [umol/m^3 air]
  253. w1(5) = yi(il,7) ! HCl (g) + Cl- (p) [umol/m^3 air]
  254. w1(6) = yi(il, 8) ! K+ (p) from Dust [umol/m^3 air]
  255. w1(7) = yi(il, 9) ! Ca++ (p) from Dust [umol/m^3 air]
  256. w1(8) = yi(il,10) ! Mg++ (p) from Dust [umol/m^3 air]
  257. !______________________________________________
  258. zflag=1.
  259. w1=w1*1.0e-6 ! [mol/m^3 air]
  260. TNa = w1(1) ! total input sodium (g+p)
  261. TSO4 = w1(2) ! total input sulfate (g+p)
  262. TNH4 = w1(3) ! total input ammonium (g+p)
  263. TNO3 = w1(4) ! total input nitrate (g+p)
  264. TCl = w1(5) ! total input chloride (g+p)
  265. TPo = w1(6) ! total input potasium (g+p)
  266. TCa = w1(7) ! total input calcium (g+p)
  267. TMg = w1(8) ! total input magnesium(g+p)
  268. ! SULFATE RICH
  269. if((w1(1)+w1(3)+w1(6)+2.*(w1(7)+w1(8))).le.(2.*w1(2))) then
  270. zflag=3.
  271. endif
  272. ! SULFATE VERY RICH CASE if (NH4+Na+K+2(Ca+Mg))/SO4 < 1
  273. if((w1(1)+w1(3)+w1(6)+2.*(w1(7)+w1(8))).le.w1(2)) then
  274. zflag=4.
  275. endif
  276. ! SULFATE NEUTRAL CASE
  277. if((w1(1)+w1(3)+w1(6)+2.*(w1(7)+w1(8))).gt.(2.*w1(2))) then
  278. zflag=2.
  279. endif
  280. ! SULFATE POOR AND CATION POOR CASE
  281. if((w1(1)+w1(6)+2.*(w1(7)+w1(8))).gt.(2.*w1(2))) then
  282. zflag=1.
  283. endif
  284. IF ( RH .LT. RHMIN ) RH=RHMIN
  285. IF ( RH .GT. RHMAX ) RH=RHMAX
  286. ! CALCULATE TEMPERATURE DEPENDENCY FOR SOME RHDs
  287. RHDX(:)=RHDA(:)*exp(RHDE(:)*(1./TT-1./T0))
  288. RHDZ(:)=RHDX(:)
  289. ! ACCOUNT FOR VARIOUS AMMOMIUM/SODIUM SULFATE SALTS ACCORDING TO MEAN VALUE AS OF ISORROPIA
  290. GG=2.0 ! (Na)2SO4 / (NH4)2SO4 IS THE PREFFERED SPECIES FOR SULFATE DEFICIENT CASES
  291. IF(ZFLAG.EQ.3.) THEN
  292. IF(RH.LE.RHDZ(7)) THEN ! ACCOUNT FOR MIXTURE OF (NH4)2SO4(s) & NH4HSO4(s) & (NH4)3H(SO4)2(s)
  293. GG=1.677 ! (Na)2SO4 & NaHSO4
  294. ! GG=1.5
  295. ELSEIF(RH.GT.RHDZ(7).AND.RH.LE.RHDZ(5)) THEN ! MAINLY (Na)2SO4 / (NH4)2SO4(s) & (NH4)3H(SO4)2(s)
  296. GG=1.75
  297. ! GG=1.5
  298. ELSEIF(RH.GE.RHDZ(5)) THEN ! (NH4)2SO4(S) & NH4HSO4(S) & SO4-- & HSO4-
  299. GG=1.5 ! (Na)2SO4 & NaHSO4
  300. ENDIF
  301. ENDIF
  302. IF(ZFLAG.EQ.4.) GG=1.0 ! IF SO4 NEUTRALIZED, THEN ONLY AS NaHSO4 / NH4HSO4(S) OR HSO4- / H2SO4
  303. RHD=RH
  304. IF(IOPT.EQ.2.OR.RH_HIST.LT.RH_HIST_DW) THEN ! GET RHD FOR SOLIDS / HYSTERESIS
  305. !
  306. ! GET LOWEST DELIQUESCENCE RELATIVE HUMIDITIES ACCORDING TO THE CONCENTRATION DOMAIN (APROXIMATION)
  307. ! BASED ON RHD / MRHD ISORROPIA/SCAPE
  308. !
  309. w2(:)=1.
  310. do ii=1,8
  311. if(w1(ii).le.1.e-12) w2(ii)=0. ! skip compound in RHD calculation if value is concentration is zero or rather small
  312. enddo
  313. ! GET LOWEST RHD ACCORDING TO THE CONCENTRATION DOMAIN
  314. ! zflag=1. (cation rich) ...
  315. ! 1. sea salt aerosol : RHDX(1)=MgCl2
  316. ! 2. mineral dust aerosol : RHDX(2)=Ca(NO3)2
  317. !
  318. ! zflag=2. (sulfate neutral) ...
  319. ! 3. ammonium + nitrate : RHDX(3)= NH4NO3
  320. ! 4. ammonium + sulfate : RHDX(4)=(NH4)2SO4
  321. ! 5. ammonium + sulfate mixed salt : RHDX(5)=(NH4)3H(SO4)2, (NH4)2SO4
  322. ! 6. ammonium + nitrate + sulfate : RHDX(6)=(NH4)2SO4, NH4NO3, NA2SO4, NH4CL
  323. !
  324. ! zflag=3. (sulfate poor) ...
  325. ! 7. ammonium + sulfate (1:1,1.5) : RHDX(7)= NH4HSO4
  326. !
  327. ! zflag=4. (sulfate very poor) ...
  328. ! 8. sulfuric acid : RHDX(8)= H2SO4
  329. IF(ZFLAG.EQ.1.)THEN
  330. RHD=W2(1)+W2(5) ! Na+ dependency
  331. IF(RHD.EQ.0.) RHDX(1)=1.
  332. RHD=W2(6)+W2(7)+W2(8) ! K+/Ca++/Mg++ dependency (incl. ss)
  333. IF(RHD.EQ.0.) RHDX(2)=1.
  334. RHD=MINVAL(RHDX(1:2))
  335. ELSEIF(ZFLAG.EQ.2.)THEN
  336. RHD=W2(3)*W2(4) ! NH4+ & NO3- dependency
  337. IF(RHD.EQ.0.) RHDX(3)=1.
  338. RHD=W2(2)+W2(3) ! NH4+ & SO4-- dependency
  339. IF(GG.NE.2.) RHD=0. ! account only for pure (NH4)2SO4
  340. IF(RHD.EQ.0.) RHDX(4)=1.
  341. RHD=W2(2)+W2(3) ! NH4+ & SO4-- dependency
  342. IF(RHD.EQ.0.) RHDX(5)=1.
  343. RHD=W2(2)+W2(3)+W2(4)+W2(5) ! (NH4)2SO4, NH4NO3, NA2SO4, NH4CL dependency
  344. IF(RHD.EQ.0.) RHDX(6)=1.
  345. ! RHD=MINVAL(RHDX(3:4))
  346. RHD=MINVAL(RHDX(3:6))
  347. ELSEIF(ZFLAG.EQ.3.)THEN
  348. RHD=W2(2)+W2(3) ! NH4+ & SO4-- dependency
  349. IF(RHD.EQ.0.) RHDX(7)=1.
  350. RHD=RHDX(7)
  351. ELSEIF(ZFLAG.EQ.4.)THEN
  352. RHD=W2(2) ! H2SO4 dependency (assume no dry aerosol)
  353. IF(RHD.EQ.0.) RHDX(8)=1.
  354. RHD=RHDX(8)
  355. ENDIF ! ZFLAG
  356. ENDIF ! SOLIDS
  357. ! GET WATER ACTIVITIES ACCORDING TO METZGER, 2000.
  358. ! FUNCTION DERIVED FROM ZSR RELATIONSHIP DATA (AS USED IN ISORROPIA)
  359. M0(:) = ((NW(:)*MWH20/MW(:)*(1./RH-1.)))**ZW(:)
  360. ! CALCULATE TEMPERATURE DEPENDENT EQUILIBRIUM CONSTANTS
  361. T0T=T0/TT
  362. COEF=1.0+LOG(T0T)-T0T
  363. ! EQUILIBRIUM CONSTANT NH4NO3(s) <==> NH3(g) + HNO3(g) [atm^2] (ISORROPIA)
  364. XK10 = 5.746e-17
  365. XK10= XK10 * EXP(-74.38*(T0T-1.0) + 6.120*COEF)
  366. KAN = XK10/(R*TT)/(R*TT)
  367. ! EQUILIBRIUM CONSTANT NH4CL(s) <==> NH3(g) + HCL(g) [atm^2] (ISORROPIA)
  368. XK6 = 1.086e-16
  369. XK6 = XK6 * EXP(-71.00*(T0T-1.0) + 2.400*COEF)
  370. KAC = XK6/(R*TT)/(R*TT)
  371. !
  372. ! CALCULATE AUTODISSOCIATION CONSTANT (KW) FOR WATER H2O <==> H(aq) + OH(aq) [mol^2/kg^2] (ISORROPIA)
  373. XKW = 1.010e-14
  374. XKW = XKW *EXP(-22.52*(T0T-1.0) + 26.920*COEF)
  375. ! GET MEAN MOLAL IONIC ACTIVITY COEFF ACCORDING TO METZGER, 2002.
  376. GAMA=0.0
  377. IF(RH.GE.RHD) GAMA=(RH**ZFLAG/(1000./ZFLAG*(1.-RH)+ZFLAG))
  378. GAMA = GAMA**GF1 ! ONLY GAMA TYPE OF NH4NO3, NaCl, etc. NEEDED SO FAR
  379. GAMA=0.0
  380. GFN=K*K ! K=2, i.e. condensation of 2 water molecules per 1 mole ion pair
  381. GF=GFN*GF1 ! = GFN[=Nw=4] * GF1[=(1*1^1+1*1^1)/2/Nw=1/4] = 1
  382. ! ONLY GAMA TYPE OF NH4NO3, NH4Cl, etc. needed so far
  383. IF(RH.GE.RHD) GAMA=RH**GF/((GFN*MWH20*(1./RH-1.)))**GF1
  384. GAMA = min(GAMA,1.0) ! FOCUS ON 0-1 SCALE
  385. GAMA = max(GAMA,0.0)
  386. GAMA = (1.-GAMA)**K ! transplate into aqueous phase equillibrium and account for
  387. ! enhanced uptake of aerosol precursor gases with increasing RH
  388. ! (to match the results of ISORROPIA)
  389. ! CALCULATE RHD DEPENDENT EQ: IF RH < RHD => NH4NO3(s) <==> NH3 (g) + HNO3(g) (ISORROPIA)
  390. ! IF RH >> RHD => HNO3 (g) -> NO3 (aq)
  391. X00 = MAX(ZERO,MIN(TNa,GG*TSO4)) ! MAX SODIUM SULFATE
  392. X0 = MAX(ZERO,MIN(TNH4,GG*TSO4-X00)) ! MAX AMMOMIUM SULFATE
  393. X01 = MAX(ZERO,MIN(TNa-X00, TNO3)) ! MAX SODIUM NITRATE
  394. X1 = MAX(ZERO,MIN(TNH4-X0,TNO3-X01)) ! MAX AMMOMIUM NITRATE
  395. !
  396. X02 = MAX(ZERO,MIN(TNa-X01-X00,TCl)) ! MAX SODIUM CHLORIDE
  397. X03 = MAX(ZERO,MIN(TNH4-X0-X1,TCl-X02))! MAX AMMOMIUM CHLORIDE
  398. X2 = MAX(TNH4-X1-X0-X03,ZERO) ! INTERIM RESIDUAL NH3
  399. X3 = MAX(TNO3-X1-X01,ZERO) ! INTERIM RESIDUAL HNO3
  400. X04 = MAX(TSO4-(X0+X00)/GG,ZERO) ! INTERIM RESIDUAL H2SO4
  401. X05 = MAX(TCl-X03-X02,ZERO) ! INTERIM RESIDUAL HCl
  402. ! X06 = MAX(TNa-X02-X01-X00,ZERO) ! INTERIM RESIDUAL Na (should be zero for electro-neutrality in input data)
  403. !
  404. ZKAN=2.
  405. IF(RH.GE.RHD) ZKAN=ZKAN*GAMA
  406. X4 = X2 + X3
  407. X5 = SQRT(X4*X4+KAN*ZKAN*ZKAN)
  408. X6 = 0.5*(-X4+X5)
  409. X6 = MIN(X1,X6)
  410. GHCl = X05 ! INTERIM RESIDUAl HCl
  411. GNH3 = X2 + X6 ! INTERIM RESIDUAl NH3
  412. GNO3 = X3 + X6 ! RESIDUAl HNO3
  413. GSO4 = X04 ! RESIDUAl H2SO4
  414. PNa = X02 + X01 + X00 ! RESIDUAl Na (neutralized)
  415. ZKAC=2.
  416. IF(RH.GE.RHD) ZKAC=ZKAC*GAMA
  417. X08 = GNH3 + GHCl
  418. X09 = SQRT(X08*X08+KAC*ZKAC*ZKAC)
  419. X10 = 0.5*(-X08+X09)
  420. X11 = MIN(X03,X10)
  421. GHCl = GHCl + X11 ! RESIDUAL HCl
  422. GNH3 = GNH3 + X11 ! RESIDUAL NH3
  423. ! GO SAVE ...
  424. IF(GHCl.LT.0.) GHCl=0.
  425. IF(GSO4.LT.0.) GSO4=0.
  426. IF(GNH3.LT.0.) GNH3=0.
  427. IF(GNO3.LT.0.) GNO3=0.
  428. IF(PNa.LT.0.) PNa=0.
  429. IF(GSO4.GT.TSO4) GSO4=TSO4
  430. IF(GNH3.GT.TNH4) GNH3=TNH4
  431. IF(GNO3.GT.TNO3) GNO3=TNO3
  432. IF(GHCl.GT.TCl) GHCl=TCl
  433. IF(PNa.GT.TNa) PNa=TNa
  434. ! IF(PNa.LT.TNa) print*,il,' PNa.LT.TNa => no electro-neutrality in input data! ',PNa,TNa
  435. ! DEFINE AQUEOUSE PHASE (NO SOLID NH4NO3 IF NO3/SO4>1, TEN BRINK, ET AL., 1996, ATMOS ENV, 24, 4251-4261)
  436. ! IF(TSO4.EQ.ZERO.AND.TNO3.GT.ZERO.OR.TNO3/TSO4.GE.1.) RHD=RH
  437. ! IF(IOPT.EQ.2.AND.RH.LT.RHD.OR.IOPT.EQ.2.AND.RH_HIST.LT.RH_HIST_DW) THEN ! SOLIDS / HYSTERESIS
  438. IF(RH_HIST.EQ.1.AND.RH.LT.RHD) THEN ! SOLIDS / HYSTERESIS
  439. ! EVERYTHING DRY, ONLY H2SO4 (GSO4) REMAINS IN THE AQUEOUSE PHASE
  440. ANH4 = 0.
  441. ASO4 = 0.
  442. ANO3 = 0.
  443. ACl = 0.
  444. ANa = 0.
  445. ELSE ! SUPERSATURATED SOLUTIONS NO SOLID FORMATION
  446. ASO4 = TSO4 - GSO4
  447. ANH4 = TNH4 - GNH3
  448. ANO3 = TNO3 - GNO3
  449. ACl = TCl - GHCl
  450. ANa = PNa
  451. ENDIF ! SOLIDS / HYSTERESIS
  452. ! CALCULATE AEROSOL WATER [kg/m^3(air)]
  453. !
  454. ! salt solutes:
  455. ! 1 = NACl, 2 = (NA)2SO4, 3 = NANO3, 4 = (NH4)2SO4, 5 = NH4NO3, 6 = NH4CL, 7 = 2H-SO4
  456. ! 8 = NH4HSO4, 9 = NAHSO4, 10 = (NH4)3H(SO4)2
  457. !
  458. IF(ZFLAG.EQ.1.) WH2O = ASO4/M0( 2) + ANO3/M0(3) + ACl/M0(6)
  459. IF(ZFLAG.EQ.2.) WH2O = ASO4/M0( 9) + ANO3/M0(5) + ACl/M0(6)
  460. IF(ZFLAG.EQ.3.) WH2O = ASO4/M0( 8) + ANO3/M0(5) + ACl/M0(6)
  461. IF(ZFLAG.EQ.4.) WH2O = ASO4/M0( 8) + GSO4/M0(7)
  462. ! H2O_NO3
  463. IF(ZFLAG.EQ.1.) H2O_NO3 = ANO3/M0(3)
  464. IF(ZFLAG.EQ.2.) H2O_NO3 = ANO3/M0(5)
  465. IF(ZFLAG.EQ.3.) H2O_NO3 = ANO3/M0(5)
  466. IF(ZFLAG.EQ.4.) H2O_NO3 = 0.0
  467. ! CALCULATE AQUEOUS PHASE PROPERTIES
  468. ! PH = 9999.
  469. PH = 7.
  470. MOLAL = 0.
  471. HPLUS = 0.
  472. ZIONIC= 0.
  473. IF(WH2O.GT.0.) THEN
  474. ! CALCULATE AUTODISSOCIATION CONSTANT (KW) FOR WATER
  475. AKW=XKW*RH*WH2O*WH2O ! H2O <==> H+ + OH- with kw [mol^2/kg^2]
  476. AKW=AKW**0.5 ! [OH-] = [H+] [mol]
  477. ! trap zero [OH-] due to round-off:
  478. if ( AKW > 0.0 ) then
  479. ! Calculate hydrogen molality [mol/kg], i.e. H+ of the ions:
  480. ! Na+, NH4+, NO3-, Cl-, SO4--, HH-SO4- [mol/kg(water)]
  481. ! with [OH-] = kw/[H+]
  482. HPLUS = (-ANa/WH2O-ANH4/WH2O+ANO3/WH2O+ACl/WH2O+GG*ASO4/WH2O+GG*GSO4/WH2O+ &
  483. SQRT(( ANa/WH2O+ANH4/WH2O-ANO3/WH2O-ACl/WH2O-GG*ASO4/WH2O-GG*GSO4/WH2O)**2+XKW/AKW*WH2O))/2.
  484. ! trip zero [H+] due to round-off:
  485. if ( HPLUS > 0.0 ) then
  486. ! Calculate pH
  487. PH = -ALOG10(HPLUS) ! aerosol pH
  488. ! Calculate ionic strength [mol/kg]
  489. ZIONIC=0.5*(ANa+ANH4+ANO3+ACl+ASO4*GG*GG+GSO4*GG*GG+XKW/AKW*WH2O*WH2O)
  490. ZIONIC=ZIONIC/WH2O ! ionic strength [mol/kg]
  491. ! ZIONIC=min(ZIONIC,200.0) ! limit for output
  492. ! ZIONIC=max(ZIONIC,0.0)
  493. end if
  494. end if ! [OH-] > 0.0
  495. ENDIF ! AQUEOUS PHASE
  496. !
  497. !-------------------------------------------------------
  498. ! calculate diagnostic output consistent with other EQMs ...
  499. !
  500. ASO4 = ASO4 + GSO4 ! assuming H2SO4 remains aqueous
  501. TNa = TNa * 1.e6 ! total input sodium (g+p) [umol/m^3]
  502. TSO4 = TSO4 * 1.e6 ! total input sulfate (g+p) [umol/m^3]
  503. TNH4 = TNH4 * 1.e6 ! total input ammonium (g+p) [umol/m^3]
  504. TNO3 = TNO3 * 1.e6 ! total input nitrate (g+p) [umol/m^3]
  505. TCl = TCl * 1.e6 ! total input chloride (g+p) [umol/m^3]
  506. TPo = TPo * 1.e6 ! total input potasium (g+p) [umol/m^3]
  507. TCa = TCa * 1.e6 ! total input calcium (g+p) [umol/m^3]
  508. TMg = TMg * 1.e6 ! total input magnesium(g+p) [umol/m^3]
  509. !
  510. ! residual gas:
  511. GNH3 = GNH3 * 1.e6 ! residual NH3
  512. GSO4 = GSO4 * 1.e6 ! residual H2SO4
  513. GNO3 = GNO3 * 1.e6 ! residual HNO3
  514. GHCl = GHCl * 1.e6 ! residual HCl
  515. ! total particulate matter (neutralized)
  516. PNH4=TNH4-GNH3 ! particulate ammonium [umol/m^3]
  517. !kt PNO3=TNO3-GNO3 ! particulate nitrate [umol/m^3]
  518. PNO3=max(0.,TNO3-GNO3) ! particulate nitrate [umol/m^3]
  519. PCl =TCl -GHCl ! particulate chloride [umol/m^3]
  520. PNa =TNa ! particulate sodium [umol/m^3]
  521. PSO4=TSO4 ! particulate sulfate [umol/m^3]
  522. ! liquid matter
  523. ASO4 = ASO4 * 1.e6 ! aqueous phase sulfate [umol/m^3]
  524. ANH4 = ANH4 * 1.e6 ! aqueous phase ammonium [umol/m^3]
  525. ANO3 = ANO3 * 1.e6 ! aqueous phase nitrate [umol/m^3]
  526. ACl = ACl * 1.e6 ! aqueous phase chloride [umol/m^3]
  527. ANa = ANa * 1.e6 ! aqueous phase sodium [umol/m^3]
  528. ! solid matter
  529. SNH4=PNH4-ANH4 ! solid phase ammonium [umol/m^3]
  530. SSO4=PSO4-ASO4 ! solid phase sulfate [umol/m^3]
  531. SNO3=PNO3-ANO3 ! solid phase nitrate [umol/m^3]
  532. SCl =PCl -ACl ! solid phase chloride [umol/m^3]
  533. SNa =PNa -ANa ! solid phase sodium [umol/m^3]
  534. ! GO SAVE ...
  535. IF(SNH4.LT.0.) SNH4=0.
  536. IF(SSO4.LT.0.) SSO4=0.
  537. IF(SNO3.LT.0.) SNO3=0.
  538. IF(SCl.LT.0.) SCl=0.
  539. IF(SNa.LT.0.) SNa=0.
  540. PM=SNH4+SSO4+SNO3+SNH4+SCl+SNa+ANH4+ASO4+ANO3+ACl+ANa ! total PM [umol/m^3]
  541. PMs=SNH4*MWNH4+SSO4*MWSO4+SNO3*MWNO3+SCl*MWCl+SNa*MWNa ! dry particulate matter (PM) [ug/m^3]
  542. PMt=PMs+ANH4*MWNH4+ASO4*MWSO4+ANO3*MWNO3+ACl*MWCl+ &
  543. ANa*MWNa ! total (dry + wet) PM, excl. H20 [ug/m^3]
  544. WH2O = WH2O * 1.e9 ! convert aerosol water from [kg/m^3] to [ug/m^3]
  545. H2O_NO3 = H2O_NO3 * 1.e9 ! convert NO3 water from [kg/m^3] to [ug/m^3]
  546. IF(WH2O.LT.1.e-3) WH2O=0.
  547. ! UPDATE HISTORY RH FOR HYSTERESIS (ONLINE CALCULATIONS ONLY)
  548. RH_HIST=2. ! wet
  549. IF(WH2O.EQ.0.) RH_HIST=1. ! dry
  550. RINC = 1.
  551. IF(PMt.GT.0.) RINC = (WH2O/PMt+1)**(1./3.) ! approx. radius increase due to water uptake
  552. IF(RINC.EQ.0.) RINC = 1.
  553. RATIONS = 0.
  554. IF(PSO4.GT.0.) RATIONS = PNO3/PSO4 ! nitrate / sulfate mol ratio
  555. GR = 0.
  556. IF(GNO3.GT.0.) GR = GNH3/GNO3 ! gas ratio = residual NH3 / residual HNO3 [-]
  557. DON = 0.
  558. IF((PNO3+2.*PSO4).GT.0.) DON = 100.*PNH4/(PNO3+2.*PSO4)! degree of neutralization by ammonia : ammonium / total nitrate + sulfate [%]
  559. NO3P = 0.
  560. IF(TNO3.GT.0.) NO3P = 100.*PNO3/TNO3 ! nitrate partitioning = nitrate / total nitrate [%]
  561. NH4P = 0.
  562. IF(TNH4.GT.0.) NH4P = 100.*PNH4/TNH4 ! ammonium partitioning = ammonium / total ammonium [%]
  563. !
  564. ! store aerosol species for diagnostic output:
  565. !______________________________________________________________
  566. ! Input values:
  567. yo(il, 1) = TT - 273.15 ! T [degC]
  568. yo(il, 2) = RH * 100.00 ! RH [%]
  569. yo(il, 3) = TNH4 ! total input ammonium (g+p) [umol/m^3]
  570. yo(il, 4) = TSO4 ! total input sulfate (g+p) [umol/m^3]
  571. yo(il, 5) = TNO3 ! total input nitrate (g+p) [umol/m^3]
  572. yo(il, 6) = TNa ! total input sodium (p) [umol/m^3]
  573. yo(il,33) = TCl ! total input chloride (g+p) [umol/m^3]
  574. yo(il, 7) = TPo ! total input potasium (p) [umol/m^3]
  575. yo(il,34) = TCa ! total input calcium (p) [umol/m^3]
  576. yo(il,35) = TMg ! total input magnesium(p) [umol/m^3]
  577. yo(il,25) = PX ! atmospheric pressure [hPa]
  578. ! Output values:
  579. yo(il, 8) = GHCL ! residual HCl (g) [umol/m^3]
  580. yo(il, 9) = GNO3 ! residual HNO3 (g) [umol/m^3]
  581. yo(il,10) = GNH3 ! residual NH3 (g) [umol/m^3]
  582. yo(il,11) = GSO4 ! residual H2SO4 (aq) [umol/m^3]
  583. yo(il,12) = WH2O ! aerosol Water (aq) [ug/m^3]
  584. yo(il,13) = PH ! aerosol pH [log]
  585. yo(il,14) = ZFLAG ! concnetration domain [1=SP,2=SN,3=SR,4=SVR]
  586. yo(il,15) = PM ! total particulate matter [umol/m^3]
  587. yo(il,16) = SNH4 ! solid ammonium (s) [umol/m^3]
  588. yo(il,17) = SNO3 ! solid nitrate (s) [umol/m^3]
  589. yo(il,18) = SSO4 ! solid sulfate (s) [umol/m^3]
  590. yo(il,19) = PNH4 ! particulate ammonium (p=a+s) [umol/m^3]
  591. yo(il,20) = PNO3 ! particulate nitrate (p=a+s) [umol/m^3]
  592. yo(il,21) = PSO4 ! particulate sulfate (p=a+s) [umol/m^3]
  593. yo(il,22) = RATIONS ! mol ratio Nitrate/Sulfate (p) [-]
  594. yo(il,23) = GAMA ! activity coefficient (e.g. NH4NO3) [-]
  595. yo(il,24) = ZIONIC ! ionic strength (aq) [mol/kg]
  596. yo(il,26) = PMt ! total PM (liquids & solids) [ug/m^3]
  597. yo(il,27) = PMs ! total PM (solid) [ug/m^3]
  598. yo(il,28) = RINC ! radius increase (H2O/PMt+1)**(1/3) [-]
  599. yo(il,29) = SCl ! solid chloride (s) [umol/m^3]
  600. yo(il,30) = SNa ! solid sodium (s) [umol/m^3]
  601. yo(il,31) = PCl ! particulate chloride (p=a+s) [umol/m^3]
  602. yo(il,32) = PNa ! particulate sodium (p=a+s) [umol/m^3]
  603. yo(il,36) = GG
  604. yo(il,37) = H2O_NO3 ! Water associated with nitrate [ug/m^3]
  605. enddo
  606. !
  607. end subroutine eqsam_v03d
  608. end module eqsam_param