1 !=======================================================================
4 ! *** SUBROUTINE ISOROPIA
5 ! *** THIS SUBROUTINE IS THE MASTER ROUTINE FOR THE ISORROPIA
6 ! THERMODYNAMIC EQUILIBRIUM AEROSOL MODEL (VERSION 1.1 and above)
8 ! ======================== ARGUMENTS / USAGE ===========================
12 ! DOUBLE PRECISION array of length [5].
13 ! Concentrations, expressed in moles/m3. Depending on the type of
14 ! problem solved (specified in CNTRL(1)), WI contains either
15 ! GAS+AEROSOL or AEROSOL only concentratios.
23 ! DOUBLE PRECISION variable.
24 ! Ambient relative humidity expressed on a (0,1) scale.
27 ! DOUBLE PRECISION variable.
28 ! Ambient temperature expressed in Kelvins.
31 ! DOUBLE PRECISION array of length [2].
32 ! Parameters that control the type of problem solved.
34 ! CNTRL(1): Defines the type of problem solved.
35 ! 0 - Forward problem is solved. In this case, array WI contains
36 ! GAS and AEROSOL concentrations together.
37 ! 1 - Reverse problem is solved. In this case, array WI contains
38 ! AEROSOL concentrations only.
40 ! CNTRL(2): Defines the state of the aerosol
41 ! 0 - The aerosol can have both solid+liquid phases (deliquescent)
42 ! 1 - The aerosol is in only liquid state (metastable aerosol)
46 ! DOUBLE PRECISION array of length [5].
47 ! Total concentrations (GAS+AEROSOL) of species, expressed in moles/m3.
48 ! If the foreward probelm is solved (CNTRL(1)=0), array WT is
49 ! identical to array WI.
50 ! WT(1) - total sodium
51 ! WT(2) - total sulfate
52 ! WT(3) - total ammonium
53 ! WT(4) - total nitrate
54 ! WT(5) - total chloride
57 ! DOUBLE PRECISION array of length [03].
58 ! Gaseous species concentrations, expressed in moles/m3.
64 ! DOUBLE PRECISION array of length [11].
65 ! Liquid aerosol species concentrations, expressed in moles/m3.
67 ! AERLIQ(02) - Na+(aq)
68 ! AERLIQ(03) - NH4+(aq)
69 ! AERLIQ(04) - Cl-(aq)
70 ! AERLIQ(05) - SO4--(aq)
71 ! AERLIQ(06) - HSO4-(aq)
72 ! AERLIQ(07) - NO3-(aq)
74 ! AERLIQ(09) - NH3(aq) (undissociated)
75 ! AERLIQ(10) - HNCl(aq) (undissociated)
76 ! AERLIQ(11) - HNO3(aq) (undissociated)
77 ! AERLIQ(12) - OH-(aq)
80 ! DOUBLE PRECISION array of length [09].
81 ! Solid aerosol species concentrations, expressed in moles/m3.
82 ! AERSLD(01) - NaNO3(s)
83 ! AERSLD(02) - NH4NO3(s)
84 ! AERSLD(03) - NaCl(s)
85 ! AERSLD(04) - NH4Cl(s)
86 ! AERSLD(05) - Na2SO4(s)
87 ! AERSLD(06) - (NH4)2SO4(s)
88 ! AERSLD(07) - NaHSO4(s)
89 ! AERSLD(08) - NH4HSO4(s)
90 ! AERSLD(09) - (NH4)4H(SO4)2(s)
93 ! CHARACTER*15 variable.
94 ! Returns the subcase which the input corresponds to.
97 ! DOUBLE PRECISION array of length [6].
98 ! Returns solution information.
100 ! OTHER(1): Shows if aerosol water exists.
104 ! OTHER(2): Aerosol Sulfate ratio, defined as (in moles/m3) :
105 ! (total ammonia + total Na) / (total sulfate)
107 ! OTHER(3): Sulfate ratio based on aerosol properties that defines
108 ! a sulfate poor system:
109 ! (aerosol ammonia + aerosol Na) / (aerosol sulfate)
111 ! OTHER(4): Aerosol sodium ratio, defined as (in moles/m3) :
112 ! (total Na) / (total sulfate)
114 ! OTHER(5): Ionic strength of the aqueous aerosol (if it exists).
116 ! OTHER(6): Total number of calls to the activity coefficient
117 ! calculation subroutine.
119 ! *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY,
120 ! *** GEORGIA INSTITUTE OF TECHNOLOGY
121 ! *** WRITTEN BY ATHANASIOS NENES
122 ! *** UPDATED BY CHRISTOS FOUNTOUKIS
124 !=======================================================================
126 SUBROUTINE ISOROPIA (WI, RHI, TEMPI, CNTRL, &
127 WT, GAS, AERLIQ, AERSLD, SCASI, OTHER)
129 IMPLICIT DOUBLE PRECISION (A-H, O-Z)
130 ! INCLUDE 'ISRPIA.INC'
131 PARAMETER (NCTRL=2,NOTHER=6)
133 DIMENSION WI(NCOMP), WT(NCOMP), GAS(NGASAQ), AERSLD(NSLDS), &
134 AERLIQ(NIONS+NGASAQ+2), CNTRL(NCTRL), OTHER(NOTHER)
136 ! *** PROBLEM TYPE (0=FOREWARD, 1=REVERSE) ******************************
138 IPROB = NINT(CNTRL(1))
140 ! *** AEROSOL STATE (0=SOLID+LIQUID, 1=METASTABLE) **********************
142 METSTBL = NINT(CNTRL(2))
144 ! *** SOLVE FOREWARD PROBLEM ********************************************
146 50 IF (IPROB.EQ.0) THEN
147 IF (WI(1)+WI(2)+WI(3)+WI(4)+WI(5) .LE. TINY) THEN ! Everything=0
148 CALL INIT1 (WI, RHI, TEMPI)
149 ELSE IF (WI(1)+WI(4)+WI(5) .LE. TINY) THEN ! Na,Cl,NO3=0
150 CALL ISRP1F (WI, RHI, TEMPI)
151 ELSE IF (WI(1)+WI(5) .LE. TINY) THEN ! Na,Cl=0
152 CALL ISRP2F (WI, RHI, TEMPI)
154 CALL ISRP3F (WI, RHI, TEMPI)
157 ! *** SOLVE REVERSE PROBLEM *********************************************
160 IF (WI(1)+WI(2)+WI(3)+WI(4)+WI(5) .LE. TINY) THEN ! Everything=0
161 CALL INIT1 (WI, RHI, TEMPI)
162 ELSE IF (WI(1)+WI(4)+WI(5) .LE. TINY) THEN ! Na,Cl,NO3=0
163 CALL ISRP1R (WI, RHI, TEMPI)
164 ELSE IF (WI(1)+WI(5) .LE. TINY) THEN ! Na,Cl=0
165 CALL ISRP2R (WI, RHI, TEMPI)
167 CALL ISRP3R (WI, RHI, TEMPI)
171 ! *** ADJUST MASS BALANCE ***********************************************
173 IF (NADJ.EQ.1) CALL ADJUST (WI)
175 !cC *** IF METASTABLE AND NO WATER - RESOLVE AS NORMAL ********************
177 !c IF (WATER.LE.TINY .AND. METSTBL.EQ.1) THEN
182 ! *** SAVE RESULTS TO ARRAYS (units = mole/m3) ****************************
184 GAS(1) = GNH3 ! Gaseous aerosol species
188 DO 10 I=1,NIONS ! Liquid aerosol species
192 AERLIQ(NIONS+1+I) = GASAQ(I)
194 AERLIQ(NIONS+1) = WATER*1.0D3/18.0D0
195 AERLIQ(NIONS+NGASAQ+2) = COH
197 AERSLD(1) = CNANO3 ! Solid aerosol species
207 IF(WATER.LE.TINY) THEN ! Dry flag
213 OTHER(2) = SULRAT ! Other stuff
221 WT(1) = WI(1) ! Total gas+aerosol phase
226 IF (IPROB.GT.0 .AND. WATER.GT.TINY) THEN
228 WT(4) = WT(4) + GHNO3
234 ! *** END OF SUBROUTINE ISOROPIA ******************************************
237 !=======================================================================
240 ! *** SUBROUTINE SETPARM
241 ! *** THIS SUBROUTINE REDEFINES THE SOLUTION PARAMETERS OF ISORROPIA
243 ! ======================== ARGUMENTS / USAGE ===========================
245 ! *** NOTE: IF NEGATIVE VALUES ARE GIVEN FOR A PARAMETER, IT IS
246 ! IGNORED AND THE CURRENT VALUE IS USED INSTEAD.
251 ! Defines the type of weighting algorithm for the solution in Mutual
252 ! Deliquescence Regions (MDR's):
253 ! 0 - MDR's are assumed dry. This is equivalent to the approach
255 ! 1 - The solution is assumed "half" dry and "half" wet throughout
257 ! 2 - The solution is a relative-humidity weighted mean of the
258 ! dry and wet solutions (as defined in Nenes et al., 1998)
262 ! Method of activity coefficient calculation:
263 ! 0 - Calculate coefficients during runtime
264 ! 1 - Use precalculated tables
267 ! DOUBLE PRECITION variable.
268 ! Defines the convergence criterion for all iterative processes
269 ! in ISORROPIA, except those for activity coefficient calculations
270 ! (EPSACTI controls that).
274 ! Defines the maximum number of iterations for all iterative
275 ! processes in ISORROPIA, except for activity coefficient calculations
276 ! (NSWEEPI controls that).
280 ! Defines the maximum number of iterations for activity coefficient
284 ! DOUBLE PRECISION variable.
285 ! Defines the convergence criterion for activity coefficient
290 ! Defines the number of subdivisions needed for the initial root
291 ! tracking for the bisection method. Usually this parameter should
292 ! not be altered, but is included for completeness.
296 ! Forces the solution obtained to satisfy total mass balance
297 ! to machine precision
298 ! 0 - No adjustment done (default)
301 ! *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY,
302 ! *** GEORGIA INSTITUTE OF TECHNOLOGY
303 ! *** WRITTEN BY ATHANASIOS NENES
304 ! *** UPDATED BY CHRISTOS FOUNTOUKIS
306 !=======================================================================
308 SUBROUTINE SETPARM (WFTYPI, IACALCI, EPSI, MAXITI, NSWEEPI, &
309 EPSACTI, NDIVI, NADJI)
311 IMPLICIT DOUBLE PRECISION (A-H, O-Z)
312 ! INCLUDE 'ISRPIA.INC'
315 ! *** SETUP SOLUTION PARAMETERS *****************************************
317 IF (WFTYPI .GE. 0) WFTYP = WFTYPI
318 IF (IACALCI.GE. 0) IACALC = IACALCI
319 IF (EPSI .GE.ZERO) EPS = EPSI
320 IF (MAXITI .GT. 0) MAXIT = MAXITI
321 IF (NSWEEPI.GT. 0) NSWEEP = NSWEEPI
322 IF (EPSACTI.GE.ZERO) EPSACT = EPSACTI
323 IF (NDIVI .GT. 0) NDIV = NDIVI
324 IF (NADJI .GE. 0) NADJ = NADJI
326 ! *** END OF SUBROUTINE SETPARM *****************************************
334 !=======================================================================
337 ! *** SUBROUTINE GETPARM
338 ! *** THIS SUBROUTINE OBTAINS THE CURRENT VAULES OF THE SOLUTION
339 ! PARAMETERS OF ISORROPIA
341 ! ======================== ARGUMENTS / USAGE ===========================
343 ! *** THE PARAMETERS ARE THOSE OF SUBROUTINE SETPARM
345 ! *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY,
346 ! *** GEORGIA INSTITUTE OF TECHNOLOGY
347 ! *** WRITTEN BY ATHANASIOS NENES
348 ! *** UPDATED BY CHRISTOS FOUNTOUKIS
350 !=======================================================================
352 SUBROUTINE GETPARM (WFTYPI, IACALCI, EPSI, MAXITI, NSWEEPI, &
353 EPSACTI, NDIVI, NADJI)
355 IMPLICIT DOUBLE PRECISION (A-H, O-Z)
356 ! INCLUDE 'ISRPIA.INC'
359 ! *** GET SOLUTION PARAMETERS *******************************************
370 ! *** END OF SUBROUTINE GETPARM *****************************************
375 !=======================================================================
378 ! *** BLOCK DATA BLKISO
379 ! *** THIS SUBROUTINE PROVIDES INITIAL (DEFAULT) VALUES TO PROGRAM
380 ! PARAMETERS VIA DATA STATEMENTS
382 ! *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY,
383 ! *** GEORGIA INSTITUTE OF TECHNOLOGY
384 ! *** WRITTEN BY ATHANASIOS NENES
385 ! *** UPDATED BY CHRISTOS FOUNTOUKIS
387 ! *** ZSR RELATIONSHIP PARAMETERS MODIFIED BY DOUGLAS WALDRON
389 ! *** BASED ON AIM MODEL III (http://mae.ucdavis.edu/wexler/aim)
391 !=======================================================================
395 IMPLICIT DOUBLE PRECISION (A-H, O-Z)
396 ! INCLUDE 'ISRPIA.INC'
398 ! *** DEFAULT VALUES *************************************************
399 ! *** OTHER PARAMETERS ***********************************************
401 ! *** ZSR RELATIONSHIP PARAMETERS **************************************
402 ! *** END OF BLOCK DATA SUBPROGRAM *************************************
405 !=======================================================================
408 ! *** SUBROUTINE INIT1
409 ! *** THIS SUBROUTINE INITIALIZES ALL GLOBAL VARIABLES FOR AMMONIUM
410 ! SULFATE AEROSOL SYSTEMS (SUBROUTINE ISRP1)
412 ! *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY,
413 ! *** GEORGIA INSTITUTE OF TECHNOLOGY
414 ! *** WRITTEN BY ATHANASIOS NENES
415 ! *** UPDATED BY CHRISTOS FOUNTOUKIS
417 !=======================================================================
419 SUBROUTINE INIT1 (WI, RHI, TEMPI)
421 IMPLICIT DOUBLE PRECISION (A-H, O-Z)
422 ! INCLUDE 'ISRPIA.INC'
424 REAL IC,GII,GI0,XX,LN10
425 PARAMETER (LN10=2.3025851)
427 ! *** SAVE INPUT VARIABLES IN COMMON BLOCK ******************************
429 IF (IPROB.EQ.0) THEN ! FORWARD CALCULATION
431 W(I) = MAX(WI(I), TINY)
434 DO 15 I=1,NCOMP ! REVERSE CALCULATION
435 WAER(I) = MAX(WI(I), TINY)
442 ! *** CALCULATE EQUILIBRIUM CONSTANTS ***********************************
444 XK1 = 1.015e-2 ! HSO4(aq) <==> H(aq) + SO4(aq)
445 XK21 = 57.639 ! NH3(g) <==> NH3(aq)
446 XK22 = 1.805e-5 ! NH3(aq) <==> NH4(aq) + OH(aq)
447 XK7 = 1.817 ! (NH4)2SO4(s) <==> 2*NH4(aq) + SO4(aq)
448 XK12 = 1.382e2 ! NH4HSO4(s) <==> NH4(aq) + HSO4(aq)
449 XK13 = 29.268 ! (NH4)3H(SO4)2(s) <==> 3*NH4(aq) + HSO4(aq) + SO4(aq)
450 XKW = 1.010e-14 ! H2O <==> H(aq) + OH(aq)
452 IF (INT(TEMP) .NE. 298) THEN ! FOR T != 298K or 298.15K
455 COEF= 1.0+LOG(T0T)-T0T
456 XK1 = XK1 *EXP( 8.85*(T0T-1.0) + 25.140*COEF)
457 XK21= XK21*EXP( 13.79*(T0T-1.0) - 5.393*COEF)
458 XK22= XK22*EXP( -1.50*(T0T-1.0) + 26.920*COEF)
459 XK7 = XK7 *EXP( -2.65*(T0T-1.0) + 38.570*COEF)
460 XK12= XK12*EXP( -2.87*(T0T-1.0) + 15.830*COEF)
461 XK13= XK13*EXP( -5.19*(T0T-1.0) + 54.400*COEF)
462 XKW = XKW *EXP(-22.52*(T0T-1.0) + 26.920*COEF)
466 ! *** CALCULATE DELIQUESCENCE RELATIVE HUMIDITIES (UNICOMPONENT) ********
472 IF (INT(TEMP) .NE. 298) THEN
474 TCF = 1.0/TEMP - 1.0/T0
475 DRNH42S4 = DRNH42S4*EXP( 80.*TCF)
476 DRNH4HS4 = DRNH4HS4*EXP(384.*TCF)
477 DRLC = DRLC *EXP(186.*TCF)
480 ! *** CALCULATE MUTUAL DELIQUESCENCE RELATIVE HUMIDITIES ****************
482 DRMLCAB = 0.3780D0 ! (NH4)3H(SO4)2 & NH4HSO4
483 DRMLCAS = 0.6900D0 ! (NH4)3H(SO4)2 & (NH4)2SO4
484 !CC IF (INT(TEMP) .NE. 298) THEN ! For the time being.
486 !CC TCF = 1.0/TEMP - 1.0/T0
487 !CC DRMLCAB = DRMLCAB*EXP(507.506*TCF)
488 !CC DRMLCAS = DRMLCAS*EXP(133.865*TCF)
491 ! *** LIQUID PHASE ******************************************************
520 ! *** SOLID PHASE *******************************************************
532 ! *** GAS PHASE *********************************************************
538 ! *** CALCULATE ZSR PARAMETERS ******************************************
540 IRH = MIN (INT(RH*NZSR+0.5),NZSR) ! Position in ZSR arrays
543 ! M0(01) = AWSC(IRH) ! NACl
544 ! IF (M0(01) .LT. 100.0) THEN
546 ! CALL KMTAB(IC,298.0, GI0,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX)
547 ! CALL KMTAB(IC,SNGL(TEMP),GII,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX)
548 ! M0(01) = M0(01)*EXP(LN10*(GI0-GII))
551 ! M0(02) = AWSS(IRH) ! (NA)2SO4
552 ! IF (M0(02) .LT. 100.0) THEN
554 ! CALL KMTAB(IC,298.0, XX,GI0,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX)
555 ! CALL KMTAB(IC,SNGL(TEMP),XX,GII,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX)
556 ! M0(02) = M0(02)*EXP(LN10*(GI0-GII))
559 ! M0(03) = AWSN(IRH) ! NANO3
560 ! IF (M0(03) .LT. 100.0) THEN
562 ! CALL KMTAB(IC,298.0, XX,XX,GI0,XX,XX,XX,XX,XX,XX,XX,XX,XX)
563 ! CALL KMTAB(IC,SNGL(TEMP),XX,XX,GII,XX,XX,XX,XX,XX,XX,XX,XX,XX)
564 ! M0(03) = M0(03)*EXP(LN10*(GI0-GII))
567 M0(04) = AWAS(IRH) ! (NH4)2SO4
568 ! IF (M0(04) .LT. 100.0) THEN
570 ! CALL KMTAB(IC,298.0, XX,XX,XX,GI0,XX,XX,XX,XX,XX,XX,XX,XX)
571 ! CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,GII,XX,XX,XX,XX,XX,XX,XX,XX)
572 ! M0(04) = M0(04)*EXP(LN10*(GI0-GII))
575 ! M0(05) = AWAN(IRH) ! NH4NO3
576 ! IF (M0(05) .LT. 100.0) THEN
578 ! CALL KMTAB(IC,298.0, XX,XX,XX,XX,GI0,XX,XX,XX,XX,XX,XX,XX)
579 ! CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,XX,GII,XX,XX,XX,XX,XX,XX,XX)
580 ! M0(05) = M0(05)*EXP(LN10*(GI0-GII))
583 ! M0(06) = AWAC(IRH) ! NH4CL
584 ! IF (M0(06) .LT. 100.0) THEN
586 ! CALL KMTAB(IC,298.0, XX,XX,XX,XX,XX,GI0,XX,XX,XX,XX,XX,XX)
587 ! CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,XX,XX,GII,XX,XX,XX,XX,XX,XX)
588 ! M0(06) = M0(06)*EXP(LN10*(GI0-GII))
591 M0(07) = AWSA(IRH) ! 2H-SO4
592 ! IF (M0(07) .LT. 100.0) THEN
594 ! CALL KMTAB(IC,298.0, XX,XX,XX,XX,XX,XX,GI0,XX,XX,XX,XX,XX)
595 ! CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,XX,XX,XX,GII,XX,XX,XX,XX,XX)
596 ! M0(07) = M0(07)*EXP(LN10*(GI0-GII))
599 M0(08) = AWSA(IRH) ! H-HSO4
600 !CC IF (M0(08) .LT. 100.0) THEN ! These are redundant, because M0(8) is not used
602 !CC CALL KMTAB(IC,298.0, XX,XX,XX,XX,XX,XX,XX,GI0,XX,XX,XX,XX)
603 !CC CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,XX,XX,XX,XX,GI0,XX,XX,XX,XX)
604 !CCCCC CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,XX,XX,XX,XX,GII,XX,XX,XX,XX)
605 !CC M0(08) = M0(08)*EXP(LN10*(GI0-GII))
608 M0(09) = AWAB(IRH) ! NH4HSO4
609 ! IF (M0(09) .LT. 100.0) THEN
611 ! CALL KMTAB(IC,298.0, XX,XX,XX,XX,XX,XX,XX,XX,GI0,XX,XX,XX)
612 ! CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,XX,XX,XX,XX,XX,GII,XX,XX,XX)
613 ! M0(09) = M0(09)*EXP(LN10*(GI0-GII))
616 ! M0(12) = AWSB(IRH) ! NAHSO4
617 ! IF (M0(12) .LT. 100.0) THEN
619 ! CALL KMTAB(IC,298.0, XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,GI0)
620 ! CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,GII)
621 ! M0(12) = M0(12)*EXP(LN10*(GI0-GII))
624 M0(13) = AWLC(IRH) ! (NH4)3H(SO4)2
625 ! IF (M0(13) .LT. 100.0) THEN
627 ! CALL KMTAB(IC,298.0, XX,XX,XX,GI0,XX,XX,XX,XX,GII,XX,XX,XX)
628 ! G130 = 0.2*(3.0*GI0+2.0*GII)
629 ! CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,GI0,XX,XX,XX,XX,GII,XX,XX,XX)
630 ! G13I = 0.2*(3.0*GI0+2.0*GII)
631 ! M0(13) = M0(13)*EXP(LN10*SNGL(G130-G13I))
634 ! *** OTHER INITIALIZATIONS *********************************************
647 ERRMSG(I) = 'MESSAGE N/A'
650 ! *** END OF SUBROUTINE INIT1 *******************************************
656 !=======================================================================
659 ! *** SUBROUTINE INIT2
660 ! *** THIS SUBROUTINE INITIALIZES ALL GLOBAL VARIABLES FOR AMMONIUM,
661 ! NITRATE, SULFATE AEROSOL SYSTEMS (SUBROUTINE ISRP2)
663 ! *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY,
664 ! *** GEORGIA INSTITUTE OF TECHNOLOGY
665 ! *** WRITTEN BY ATHANASIOS NENES
666 ! *** UPDATED BY CHRISTOS FOUNTOUKIS
668 !=======================================================================
670 SUBROUTINE INIT2 (WI, RHI, TEMPI)
672 IMPLICIT DOUBLE PRECISION (A-H, O-Z)
673 ! INCLUDE 'ISRPIA.INC'
675 REAL IC,GII,GI0,XX,LN10
676 PARAMETER (LN10=2.3025851)
678 ! *** SAVE INPUT VARIABLES IN COMMON BLOCK ******************************
680 IF (IPROB.EQ.0) THEN ! FORWARD CALCULATION
682 W(I) = MAX(WI(I), TINY)
685 DO 15 I=1,NCOMP ! REVERSE CALCULATION
686 WAER(I) = MAX(WI(I), TINY)
693 ! *** CALCULATE EQUILIBRIUM CONSTANTS ***********************************
695 XK1 = 1.015e-2 ! HSO4(aq) <==> H(aq) + SO4(aq)
696 XK21 = 57.639 ! NH3(g) <==> NH3(aq)
697 XK22 = 1.805e-5 ! NH3(aq) <==> NH4(aq) + OH(aq)
698 XK4 = 2.511e6 ! HNO3(g) <==> H(aq) + NO3(aq) ! ISORR
699 !CC XK4 = 3.638e6 ! HNO3(g) <==> H(aq) + NO3(aq) ! SEQUIL
700 XK41 = 2.100e5 ! HNO3(g) <==> HNO3(aq)
701 XK7 = 1.817 ! (NH4)2SO4(s) <==> 2*NH4(aq) + SO4(aq)
702 XK10 = 5.746e-17 ! NH4NO3(s) <==> NH3(g) + HNO3(g) ! ISORR
703 !CC XK10 = 2.985e-17 ! NH4NO3(s) <==> NH3(g) + HNO3(g) ! SEQUIL
704 XK12 = 1.382e2 ! NH4HSO4(s) <==> NH4(aq) + HSO4(aq)
705 XK13 = 29.268 ! (NH4)3H(SO4)2(s) <==> 3*NH4(aq) + HSO4(aq) + SO4(aq)
706 XKW = 1.010e-14 ! H2O <==> H(aq) + OH(aq)
708 IF (INT(TEMP) .NE. 298) THEN ! FOR T != 298K or 298.15K
711 COEF= 1.0+LOG(T0T)-T0T
712 XK1 = XK1 *EXP( 8.85*(T0T-1.0) + 25.140*COEF)
713 XK21= XK21*EXP( 13.79*(T0T-1.0) - 5.393*COEF)
714 XK22= XK22*EXP( -1.50*(T0T-1.0) + 26.920*COEF)
715 XK4 = XK4 *EXP( 29.17*(T0T-1.0) + 16.830*COEF) !ISORR
716 !CC XK4 = XK4 *EXP( 29.47*(T0T-1.0) + 16.840*COEF) ! SEQUIL
717 XK41= XK41*EXP( 29.17*(T0T-1.0) + 16.830*COEF)
718 XK7 = XK7 *EXP( -2.65*(T0T-1.0) + 38.570*COEF)
719 XK10= XK10*EXP(-74.38*(T0T-1.0) + 6.120*COEF) ! ISORR
720 !CC XK10= XK10*EXP(-75.11*(T0T-1.0) + 13.460*COEF) ! SEQUIL
721 XK12= XK12*EXP( -2.87*(T0T-1.0) + 15.830*COEF)
722 XK13= XK13*EXP( -5.19*(T0T-1.0) + 54.400*COEF)
723 XKW = XKW *EXP(-22.52*(T0T-1.0) + 26.920*COEF)
728 ! *** CALCULATE DELIQUESCENCE RELATIVE HUMIDITIES (UNICOMPONENT) ********
735 IF (INT(TEMP) .NE. 298) THEN
737 TCF = 1.0/TEMP - 1.0/T0
738 DRNH4NO3 = DRNH4NO3*EXP(852.*TCF)
739 DRNH42S4 = DRNH42S4*EXP( 80.*TCF)
740 DRNH4HS4 = DRNH4HS4*EXP(384.*TCF)
741 DRLC = DRLC *EXP(186.*TCF)
742 DRNH4NO3 = MIN (DRNH4NO3,DRNH42S4) ! ADJUST FOR DRH CROSSOVER AT T<271K
745 ! *** CALCULATE MUTUAL DELIQUESCENCE RELATIVE HUMIDITIES ****************
747 DRMLCAB = 0.3780D0 ! (NH4)3H(SO4)2 & NH4HSO4
748 DRMLCAS = 0.6900D0 ! (NH4)3H(SO4)2 & (NH4)2SO4
749 DRMASAN = 0.6000D0 ! (NH4)2SO4 & NH4NO3
750 !CC IF (INT(TEMP) .NE. 298) THEN ! For the time being
752 !CC TCF = 1.0/TEMP - 1.0/T0
753 !CC DRMLCAB = DRMLCAB*EXP( 507.506*TCF)
754 !CC DRMLCAS = DRMLCAS*EXP( 133.865*TCF)
755 !CC DRMASAN = DRMASAN*EXP(1269.068*TCF)
758 ! *** LIQUID PHASE ******************************************************
787 ! *** SOLID PHASE *******************************************************
799 ! *** GAS PHASE *********************************************************
805 ! *** CALCULATE ZSR PARAMETERS ******************************************
807 IRH = MIN (INT(RH*NZSR+0.5),NZSR) ! Position in ZSR arrays
810 ! M0(01) = AWSC(IRH) ! NACl
811 ! IF (M0(01) .LT. 100.0) THEN
813 ! CALL KMTAB(IC,298.0, GI0,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX)
814 ! CALL KMTAB(IC,SNGL(TEMP),GII,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX)
815 ! M0(01) = M0(01)*EXP(LN10*(GI0-GII))
818 ! M0(02) = AWSS(IRH) ! (NA)2SO4
819 ! IF (M0(02) .LT. 100.0) THEN
821 ! CALL KMTAB(IC,298.0, XX,GI0,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX)
822 ! CALL KMTAB(IC,SNGL(TEMP),XX,GII,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX)
823 ! M0(02) = M0(02)*EXP(LN10*(GI0-GII))
826 ! M0(03) = AWSN(IRH) ! NANO3
827 ! IF (M0(03) .LT. 100.0) THEN
829 ! CALL KMTAB(IC,298.0, XX,XX,GI0,XX,XX,XX,XX,XX,XX,XX,XX,XX)
830 ! CALL KMTAB(IC,SNGL(TEMP),XX,XX,GII,XX,XX,XX,XX,XX,XX,XX,XX,XX)
831 ! M0(03) = M0(03)*EXP(LN10*(GI0-GII))
834 M0(04) = AWAS(IRH) ! (NH4)2SO4
835 ! IF (M0(04) .LT. 100.0) THEN
837 ! CALL KMTAB(IC,298.0, XX,XX,XX,GI0,XX,XX,XX,XX,XX,XX,XX,XX)
838 ! CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,GII,XX,XX,XX,XX,XX,XX,XX,XX)
839 ! M0(04) = M0(04)*EXP(LN10*(GI0-GII))
842 M0(05) = AWAN(IRH) ! NH4NO3
843 ! IF (M0(05) .LT. 100.0) THEN
845 ! CALL KMTAB(IC,298.0, XX,XX,XX,XX,GI0,XX,XX,XX,XX,XX,XX,XX)
846 ! CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,XX,GII,XX,XX,XX,XX,XX,XX,XX)
847 ! M0(05) = M0(05)*EXP(LN10*(GI0-GII))
850 ! M0(06) = AWAC(IRH) ! NH4CL
851 ! IF (M0(06) .LT. 100.0) THEN
853 ! CALL KMTAB(IC,298.0, XX,XX,XX,XX,XX,GI0,XX,XX,XX,XX,XX,XX)
854 ! CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,XX,XX,GII,XX,XX,XX,XX,XX,XX)
855 ! M0(06) = M0(06)*EXP(LN10*(GI0-GII))
858 M0(07) = AWSA(IRH) ! 2H-SO4
859 ! IF (M0(07) .LT. 100.0) THEN
861 ! CALL KMTAB(IC,298.0, XX,XX,XX,XX,XX,XX,GI0,XX,XX,XX,XX,XX)
862 ! CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,XX,XX,XX,GII,XX,XX,XX,XX,XX)
863 ! M0(07) = M0(07)*EXP(LN10*(GI0-GII))
866 M0(08) = AWSA(IRH) ! H-HSO4
867 !CC IF (M0(08) .LT. 100.0) THEN ! These are redundant, because M0(8) is not used
869 !CC CALL KMTAB(IC,298.0, XX,XX,XX,XX,XX,XX,XX,GI0,XX,XX,XX,XX)
870 !CC CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,XX,XX,XX,XX,GI0,XX,XX,XX,XX)
871 !CCCCC CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,XX,XX,XX,XX,GII,XX,XX,XX,XX)
872 !CC M0(08) = M0(08)*EXP(LN10*(GI0-GII))
875 M0(09) = AWAB(IRH) ! NH4HSO4
876 ! IF (M0(09) .LT. 100.0) THEN
878 ! CALL KMTAB(IC,298.0, XX,XX,XX,XX,XX,XX,XX,XX,GI0,XX,XX,XX)
879 ! CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,XX,XX,XX,XX,XX,GII,XX,XX,XX)
880 ! M0(09) = M0(09)*EXP(LN10*(GI0-GII))
883 ! M0(12) = AWSB(IRH) ! NAHSO4
884 ! IF (M0(12) .LT. 100.0) THEN
886 ! CALL KMTAB(IC,298.0, XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,GI0)
887 ! CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,GII)
888 ! M0(12) = M0(12)*EXP(LN10*(GI0-GII))
891 M0(13) = AWLC(IRH) ! (NH4)3H(SO4)2
892 ! IF (M0(13) .LT. 100.0) THEN
894 ! CALL KMTAB(IC,298.0, XX,XX,XX,GI0,XX,XX,XX,XX,GII,XX,XX,XX)
895 ! G130 = 0.2*(3.0*GI0+2.0*GII)
896 ! CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,GI0,XX,XX,XX,XX,GII,XX,XX,XX)
897 ! G13I = 0.2*(3.0*GI0+2.0*GII)
898 ! M0(13) = M0(13)*EXP(LN10*SNGL(G130-G13I))
901 ! *** OTHER INITIALIZATIONS *********************************************
914 ERRMSG(I) = 'MESSAGE N/A'
917 ! *** END OF SUBROUTINE INIT2 *******************************************
925 !=======================================================================
928 ! *** SUBROUTINE ISOINIT3
929 ! *** THIS SUBROUTINE INITIALIZES ALL GLOBAL VARIABLES FOR AMMONIUM,
930 ! SODIUM, CHLORIDE, NITRATE, SULFATE AEROSOL SYSTEMS (SUBROUTINE
933 ! *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY,
934 ! *** GEORGIA INSTITUTE OF TECHNOLOGY
935 ! *** WRITTEN BY ATHANASIOS NENES
936 ! *** UPDATED BY CHRISTOS FOUNTOUKIS
938 !=======================================================================
940 SUBROUTINE ISOINIT3 (WI, RHI, TEMPI)
942 IMPLICIT DOUBLE PRECISION (A-H, O-Z)
943 ! INCLUDE 'ISRPIA.INC'
945 REAL IC,GII,GI0,XX,LN10
946 PARAMETER (LN10=2.3025851)
948 ! *** SAVE INPUT VARIABLES IN COMMON BLOCK ******************************
950 IF (IPROB.EQ.0) THEN ! FORWARD CALCULATION
952 W(I) = MAX(WI(I), TINY)
955 DO 15 I=1,NCOMP ! REVERSE CALCULATION
956 WAER(I) = MAX(WI(I), TINY)
963 ! *** CALCULATE EQUILIBRIUM CONSTANTS ***********************************
965 XK1 = 1.015D-2 ! HSO4(aq) <==> H(aq) + SO4(aq)
966 XK21 = 57.639D0 ! NH3(g) <==> NH3(aq)
967 XK22 = 1.805D-5 ! NH3(aq) <==> NH4(aq) + OH(aq)
968 XK3 = 1.971D6 ! HCL(g) <==> H(aq) + CL(aq)
969 XK31 = 2.500e3 ! HCL(g) <==> HCL(aq)
970 XK4 = 2.511e6 ! HNO3(g) <==> H(aq) + NO3(aq) ! ISORR
971 !CC XK4 = 3.638e6 ! HNO3(g) <==> H(aq) + NO3(aq) ! SEQUIL
972 XK41 = 2.100e5 ! HNO3(g) <==> HNO3(aq)
973 XK5 = 0.4799D0 ! NA2SO4(s) <==> 2*NA(aq) + SO4(aq)
974 XK6 = 1.086D-16 ! NH4CL(s) <==> NH3(g) + HCL(g)
975 XK7 = 1.817D0 ! (NH4)2SO4(s) <==> 2*NH4(aq) + SO4(aq)
976 XK8 = 37.661D0 ! NACL(s) <==> NA(aq) + CL(aq)
977 XK10 = 5.746D-17 ! NH4NO3(s) <==> NH3(g) + HNO3(g) ! ISORR
978 !CC XK10 = 2.985e-17 ! NH4NO3(s) <==> NH3(g) + HNO3(g) ! SEQUIL
979 XK11 = 2.413D4 ! NAHSO4(s) <==> NA(aq) + HSO4(aq)
980 XK12 = 1.382D2 ! NH4HSO4(s) <==> NH4(aq) + HSO4(aq)
981 XK13 = 29.268D0 ! (NH4)3H(SO4)2(s) <==> 3*NH4(aq) + HSO4(aq) + SO4(aq)
982 XK14 = 22.05D0 ! NH4CL(s) <==> NH4(aq) + CL(aq)
983 XKW = 1.010D-14 ! H2O <==> H(aq) + OH(aq)
984 XK9 = 11.977D0 ! NANO3(s) <==> NA(aq) + NO3(aq)
986 IF (INT(TEMP) .NE. 298) THEN ! FOR T != 298K or 298.15K
989 COEF= 1.0+LOG(T0T)-T0T
990 XK1 = XK1 *EXP( 8.85*(T0T-1.0) + 25.140*COEF)
991 XK21= XK21*EXP( 13.79*(T0T-1.0) - 5.393*COEF)
992 XK22= XK22*EXP( -1.50*(T0T-1.0) + 26.920*COEF)
993 XK3 = XK3 *EXP( 30.20*(T0T-1.0) + 19.910*COEF)
994 XK31= XK31*EXP( 30.20*(T0T-1.0) + 19.910*COEF)
995 XK4 = XK4 *EXP( 29.17*(T0T-1.0) + 16.830*COEF) !ISORR
996 !CC XK4 = XK4 *EXP( 29.47*(T0T-1.0) + 16.840*COEF) ! SEQUIL
997 XK41= XK41*EXP( 29.17*(T0T-1.0) + 16.830*COEF)
998 XK5 = XK5 *EXP( 0.98*(T0T-1.0) + 39.500*COEF)
999 XK6 = XK6 *EXP(-71.00*(T0T-1.0) + 2.400*COEF)
1000 XK7 = XK7 *EXP( -2.65*(T0T-1.0) + 38.570*COEF)
1001 XK8 = XK8 *EXP( -1.56*(T0T-1.0) + 16.900*COEF)
1002 XK9 = XK9 *EXP( -8.22*(T0T-1.0) + 16.010*COEF)
1003 XK10= XK10*EXP(-74.38*(T0T-1.0) + 6.120*COEF) ! ISORR
1004 !CC XK10= XK10*EXP(-75.11*(T0T-1.0) + 13.460*COEF) ! SEQUIL
1005 XK11= XK11*EXP( 0.79*(T0T-1.0) + 14.746*COEF)
1006 XK12= XK12*EXP( -2.87*(T0T-1.0) + 15.830*COEF)
1007 XK13= XK13*EXP( -5.19*(T0T-1.0) + 54.400*COEF)
1008 XK14= XK14*EXP( 24.55*(T0T-1.0) + 16.900*COEF)
1009 XKW = XKW *EXP(-22.52*(T0T-1.0) + 26.920*COEF)
1015 ! *** CALCULATE DELIQUESCENCE RELATIVE HUMIDITIES (UNICOMPONENT) ********
1027 IF (INT(TEMP) .NE. 298) THEN
1029 TCF = 1.0/TEMP - 1.0/T0
1030 DRNACL = DRNACL *EXP( 25.*TCF)
1031 DRNANO3 = DRNANO3 *EXP(304.*TCF)
1032 DRNA2SO4 = DRNA2SO4*EXP( 80.*TCF)
1033 DRNH4NO3 = DRNH4NO3*EXP(852.*TCF)
1034 DRNH42S4 = DRNH42S4*EXP( 80.*TCF)
1035 DRNH4HS4 = DRNH4HS4*EXP(384.*TCF)
1036 DRLC = DRLC *EXP(186.*TCF)
1037 DRNH4CL = DRNH4Cl *EXP(239.*TCF)
1038 DRNAHSO4 = DRNAHSO4*EXP(-45.*TCF)
1040 ! *** ADJUST FOR DRH "CROSSOVER" AT LOW TEMPERATURES
1042 DRNH4NO3 = MIN (DRNH4NO3, DRNH4CL, DRNH42S4, DRNANO3, DRNACL)
1043 DRNANO3 = MIN (DRNANO3, DRNACL)
1044 DRNH4CL = MIN (DRNH4Cl, DRNH42S4)
1048 ! *** CALCULATE MUTUAL DELIQUESCENCE RELATIVE HUMIDITIES ****************
1050 DRMLCAB = 0.378D0 ! (NH4)3H(SO4)2 & NH4HSO4
1051 DRMLCAS = 0.690D0 ! (NH4)3H(SO4)2 & (NH4)2SO4
1052 DRMASAN = 0.600D0 ! (NH4)2SO4 & NH4NO3
1053 DRMG1 = 0.460D0 ! (NH4)2SO4, NH4NO3, NA2SO4, NH4CL
1054 DRMG2 = 0.691D0 ! (NH4)2SO4, NA2SO4, NH4CL
1055 DRMG3 = 0.697D0 ! (NH4)2SO4, NA2SO4
1056 DRMH1 = 0.240D0 ! NA2SO4, NANO3, NACL, NH4NO3, NH4CL
1057 DRMH2 = 0.596D0 ! NA2SO4, NANO3, NACL, NH4CL
1058 DRMI1 = 0.240D0 ! LC, NAHSO4, NH4HSO4, NA2SO4, (NH4)2SO4
1059 DRMI2 = 0.363D0 ! LC, NAHSO4, NA2SO4, (NH4)2SO4 - NO DATA -
1060 DRMI3 = 0.610D0 ! LC, NA2SO4, (NH4)2SO4
1061 DRMQ1 = 0.494D0 ! (NH4)2SO4, NH4NO3, NA2SO4
1062 DRMR1 = 0.663D0 ! NA2SO4, NANO3, NACL
1063 DRMR2 = 0.735D0 ! NA2SO4, NACL
1064 DRMR3 = 0.673D0 ! NANO3, NACL
1065 DRMR4 = 0.694D0 ! NA2SO4, NACL, NH4CL
1066 DRMR5 = 0.731D0 ! NA2SO4, NH4CL
1067 DRMR6 = 0.596D0 ! NA2SO4, NANO3, NH4CL
1068 DRMR7 = 0.380D0 ! NA2SO4, NANO3, NACL, NH4NO3
1069 DRMR8 = 0.380D0 ! NA2SO4, NACL, NH4NO3
1070 DRMR9 = 0.494D0 ! NA2SO4, NH4NO3
1071 DRMR10 = 0.476D0 ! NA2SO4, NANO3, NH4NO3
1072 DRMR11 = 0.340D0 ! NA2SO4, NACL, NH4NO3, NH4CL
1073 DRMR12 = 0.460D0 ! NA2SO4, NH4NO3, NH4CL
1074 DRMR13 = 0.438D0 ! NA2SO4, NANO3, NH4NO3, NH4CL
1075 !CC IF (INT(TEMP) .NE. 298) THEN
1077 !CC TCF = 1.0/TEMP - 1.0/T0
1078 !CC DRMLCAB = DRMLCAB*EXP( 507.506*TCF)
1079 !CC DRMLCAS = DRMLCAS*EXP( 133.865*TCF)
1080 !CC DRMASAN = DRMASAN*EXP(1269.068*TCF)
1081 !CC DRMG1 = DRMG1 *EXP( 572.207*TCF)
1082 !CC DRMG2 = DRMG2 *EXP( 58.166*TCF)
1083 !CC DRMG3 = DRMG3 *EXP( 22.253*TCF)
1084 !CC DRMH1 = DRMH1 *EXP(2116.542*TCF)
1085 !CC DRMH2 = DRMH2 *EXP( 650.549*TCF)
1086 !CC DRMI1 = DRMI1 *EXP( 565.743*TCF)
1087 !CC DRMI2 = DRMI2 *EXP( 91.745*TCF)
1088 !CC DRMI3 = DRMI3 *EXP( 161.272*TCF)
1089 !CC DRMQ1 = DRMQ1 *EXP(1616.621*TCF)
1090 !CC DRMR1 = DRMR1 *EXP( 292.564*TCF)
1091 !CC DRMR2 = DRMR2 *EXP( 14.587*TCF)
1092 !CC DRMR3 = DRMR3 *EXP( 307.907*TCF)
1093 !CC DRMR4 = DRMR4 *EXP( 97.605*TCF)
1094 !CC DRMR5 = DRMR5 *EXP( 98.523*TCF)
1095 !CC DRMR6 = DRMR6 *EXP( 465.500*TCF)
1096 !CC DRMR7 = DRMR7 *EXP( 324.425*TCF)
1097 !CC DRMR8 = DRMR8 *EXP(2660.184*TCF)
1098 !CC DRMR9 = DRMR9 *EXP(1617.178*TCF)
1099 !CC DRMR10 = DRMR10 *EXP(1745.226*TCF)
1100 !CC DRMR11 = DRMR11 *EXP(3691.328*TCF)
1101 !CC DRMR12 = DRMR12 *EXP(1836.842*TCF)
1102 !CC DRMR13 = DRMR13 *EXP(1967.938*TCF)
1105 ! *** LIQUID PHASE ******************************************************
1134 ! *** SOLID PHASE *******************************************************
1146 ! *** GAS PHASE *********************************************************
1152 ! *** CALCULATE ZSR PARAMETERS ******************************************
1154 IRH = MIN (INT(RH*NZSR+0.5),NZSR) ! Position in ZSR arrays
1157 M0(01) = AWSC(IRH) ! NACl
1158 ! IF (M0(01) .LT. 100.0) THEN
1160 ! CALL KMTAB(IC,298.0, GI0,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX)
1161 ! CALL KMTAB(IC,SNGL(TEMP),GII,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX)
1162 ! M0(01) = M0(01)*EXP(LN10*(GI0-GII))
1165 M0(02) = AWSS(IRH) ! (NA)2SO4
1166 ! IF (M0(02) .LT. 100.0) THEN
1168 ! CALL KMTAB(IC,298.0, XX,GI0,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX)
1169 ! CALL KMTAB(IC,SNGL(TEMP),XX,GII,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX)
1170 ! M0(02) = M0(02)*EXP(LN10*(GI0-GII))
1173 M0(03) = AWSN(IRH) ! NANO3
1174 ! IF (M0(03) .LT. 100.0) THEN
1176 ! CALL KMTAB(IC,298.0, XX,XX,GI0,XX,XX,XX,XX,XX,XX,XX,XX,XX)
1177 ! CALL KMTAB(IC,SNGL(TEMP),XX,XX,GII,XX,XX,XX,XX,XX,XX,XX,XX,XX)
1178 ! M0(03) = M0(03)*EXP(LN10*(GI0-GII))
1181 M0(04) = AWAS(IRH) ! (NH4)2SO4
1182 ! IF (M0(04) .LT. 100.0) THEN
1184 ! CALL KMTAB(IC,298.0, XX,XX,XX,GI0,XX,XX,XX,XX,XX,XX,XX,XX)
1185 ! CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,GII,XX,XX,XX,XX,XX,XX,XX,XX)
1186 ! M0(04) = M0(04)*EXP(LN10*(GI0-GII))
1189 M0(05) = AWAN(IRH) ! NH4NO3
1190 ! IF (M0(05) .LT. 100.0) THEN
1192 ! CALL KMTAB(IC,298.0, XX,XX,XX,XX,GI0,XX,XX,XX,XX,XX,XX,XX)
1193 ! CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,XX,GII,XX,XX,XX,XX,XX,XX,XX)
1194 ! M0(05) = M0(05)*EXP(LN10*(GI0-GII))
1197 M0(06) = AWAC(IRH) ! NH4CL
1198 ! IF (M0(06) .LT. 100.0) THEN
1200 ! CALL KMTAB(IC,298.0, XX,XX,XX,XX,XX,GI0,XX,XX,XX,XX,XX,XX)
1201 ! CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,XX,XX,GII,XX,XX,XX,XX,XX,XX)
1202 ! M0(06) = M0(06)*EXP(LN10*(GI0-GII))
1205 M0(07) = AWSA(IRH) ! 2H-SO4
1206 ! IF (M0(07) .LT. 100.0) THEN
1208 ! CALL KMTAB(IC,298.0, XX,XX,XX,XX,XX,XX,GI0,XX,XX,XX,XX,XX)
1209 ! CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,XX,XX,XX,GII,XX,XX,XX,XX,XX)
1210 ! M0(07) = M0(07)*EXP(LN10*(GI0-GII))
1213 M0(08) = AWSA(IRH) ! H-HSO4
1214 !CC IF (M0(08) .LT. 100.0) THEN ! These are redundant, because M0(8) is not used
1216 !CC CALL KMTAB(IC,298.0, XX,XX,XX,XX,XX,XX,XX,GI0,XX,XX,XX,XX)
1217 !CC CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,XX,XX,XX,XX,GI0,XX,XX,XX,XX)
1218 !CCCCC CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,XX,XX,XX,XX,GII,XX,XX,XX,XX)
1219 !CC M0(08) = M0(08)*EXP(LN10*(GI0-GII))
1222 M0(09) = AWAB(IRH) ! NH4HSO4
1223 ! IF (M0(09) .LT. 100.0) THEN
1225 ! CALL KMTAB(IC,298.0, XX,XX,XX,XX,XX,XX,XX,XX,GI0,XX,XX,XX)
1226 ! CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,XX,XX,XX,XX,XX,GII,XX,XX,XX)
1227 ! M0(09) = M0(09)*EXP(LN10*(GI0-GII))
1230 M0(12) = AWSB(IRH) ! NAHSO4
1231 ! IF (M0(12) .LT. 100.0) THEN
1233 ! CALL KMTAB(IC,298.0, XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,GI0)
1234 ! CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,GII)
1235 ! M0(12) = M0(12)*EXP(LN10*(GI0-GII))
1238 M0(13) = AWLC(IRH) ! (NH4)3H(SO4)2
1239 ! IF (M0(13) .LT. 100.0) THEN
1241 ! CALL KMTAB(IC,298.0, XX,XX,XX,GI0,XX,XX,XX,XX,GII,XX,XX,XX)
1242 ! G130 = 0.2*(3.0*GI0+2.0*GII)
1243 ! CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,GI0,XX,XX,XX,XX,GII,XX,XX,XX)
1244 ! G13I = 0.2*(3.0*GI0+2.0*GII)
1245 ! M0(13) = M0(13)*EXP(LN10*SNGL(G130-G13I))
1248 ! *** OTHER INITIALIZATIONS *********************************************
1260 ERRMSG(I) = 'MESSAGE N/A'
1263 ! *** END OF SUBROUTINE ISOINIT3 *******************************************
1267 !=======================================================================
1269 ! *** ISORROPIA CODE
1270 ! *** SUBROUTINE ADJUST
1271 ! *** ADJUSTS FOR MASS BALANCE BETWEEN VOLATILE SPECIES AND SULFATE
1272 ! FIRST CALCULATE THE EXCESS OF EACH PRECURSOR, AND IF IT EXISTS, THEN
1273 ! ADJUST SEQUENTIALY AEROSOL PHASE SPECIES WHICH CONTAIN THE EXCESS
1276 ! *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY,
1277 ! *** GEORGIA INSTITUTE OF TECHNOLOGY
1278 ! *** WRITTEN BY ATHANASIOS NENES
1279 ! *** UPDATED BY CHRISTOS FOUNTOUKIS
1281 !=======================================================================
1283 SUBROUTINE ADJUST (WI)
1285 IMPLICIT DOUBLE PRECISION (A-H, O-Z)
1286 ! INCLUDE 'ISRPIA.INC'
1287 DOUBLE PRECISION WI(*)
1289 ! *** FOR AMMONIUM *****************************************************
1291 IF (IPROB.EQ.0) THEN ! Calculate excess (solution - input)
1292 EXNH4 = GNH3 + MOLAL(3) + CNH4CL + CNH4NO3 + CNH4HS4 &
1293 + 2D0*CNH42S4 + 3D0*CLC &
1296 EXNH4 = MOLAL(3) + CNH4CL + CNH4NO3 + CNH4HS4 + 2D0*CNH42S4 &
1301 EXNH4 = MAX(EXNH4,ZERO)
1302 IF (EXNH4.LT.TINY) GOTO 20 ! No excess NH4, go to next precursor
1304 IF (MOLAL(3).GT.EXNH4) THEN ! Adjust aqueous phase NH4
1305 MOLAL(3) = MOLAL(3) - EXNH4
1308 EXNH4 = EXNH4 - MOLAL(3)
1312 IF (CNH4CL.GT.EXNH4) THEN ! Adjust NH4Cl(s)
1313 CNH4CL = CNH4CL - EXNH4 ! more solid than excess
1314 GHCL = GHCL + EXNH4 ! evaporate Cl to gas phase
1316 ELSE ! less solid than excess
1317 GHCL = GHCL + CNH4CL ! evaporate into gas phase
1318 EXNH4 = EXNH4 - CNH4CL ! reduce excess
1319 CNH4CL = ZERO ! zero salt concentration
1322 IF (CNH4NO3.GT.EXNH4) THEN ! Adjust NH4NO3(s)
1323 CNH4NO3 = CNH4NO3- EXNH4 ! more solid than excess
1324 GHNO3 = GHNO3 + EXNH4 ! evaporate NO3 to gas phase
1326 ELSE ! less solid than excess
1327 GHNO3 = GHNO3 + CNH4NO3! evaporate into gas phase
1328 EXNH4 = EXNH4 - CNH4NO3! reduce excess
1329 CNH4NO3 = ZERO ! zero salt concentration
1332 IF (CLC.GT.3d0*EXNH4) THEN ! Adjust (NH4)3H(SO4)2(s)
1333 CLC = CLC - EXNH4/3d0 ! more solid than excess
1335 ELSE ! less solid than excess
1336 EXNH4 = EXNH4 - 3d0*CLC ! reduce excess
1337 CLC = ZERO ! zero salt concentration
1340 IF (CNH4HS4.GT.EXNH4) THEN ! Adjust NH4HSO4(s)
1341 CNH4HS4 = CNH4HS4- EXNH4 ! more solid than excess
1343 ELSE ! less solid than excess
1344 EXNH4 = EXNH4 - CNH4HS4! reduce excess
1345 CNH4HS4 = ZERO ! zero salt concentration
1348 IF (CNH42S4.GT.EXNH4) THEN ! Adjust (NH4)2SO4(s)
1349 CNH42S4 = CNH42S4- EXNH4 ! more solid than excess
1351 ELSE ! less solid than excess
1352 EXNH4 = EXNH4 - CNH42S4! reduce excess
1353 CNH42S4 = ZERO ! zero salt concentration
1356 ! *** FOR NITRATE ******************************************************
1358 20 IF (IPROB.EQ.0) THEN ! Calculate excess (solution - input)
1359 EXNO3 = GHNO3 + MOLAL(7) + CNH4NO3 &
1362 EXNO3 = MOLAL(7) + CNH4NO3 &
1365 EXNO3 = MAX(EXNO3,ZERO)
1366 IF (EXNO3.LT.TINY) GOTO 30 ! No excess NO3, go to next precursor
1368 IF (MOLAL(7).GT.EXNO3) THEN ! Adjust aqueous phase NO3
1369 MOLAL(7) = MOLAL(7) - EXNO3
1372 EXNO3 = EXNO3 - MOLAL(7)
1376 IF (CNH4NO3.GT.EXNO3) THEN ! Adjust NH4NO3(s)
1377 CNH4NO3 = CNH4NO3- EXNO3 ! more solid than excess
1378 GNH3 = GNH3 + EXNO3 ! evaporate NO3 to gas phase
1380 ELSE ! less solid than excess
1381 GNH3 = GNH3 + CNH4NO3! evaporate into gas phase
1382 EXNO3 = EXNO3 - CNH4NO3! reduce excess
1383 CNH4NO3 = ZERO ! zero salt concentration
1386 ! *** FOR CHLORIDE *****************************************************
1388 30 IF (IPROB.EQ.0) THEN ! Calculate excess (solution - input)
1389 EXCl = GHCL + MOLAL(4) + CNH4CL &
1392 EXCl = MOLAL(4) + CNH4CL &
1395 EXCl = MAX(EXCl,ZERO)
1396 IF (EXCl.LT.TINY) GOTO 40 ! No excess Cl, go to next precursor
1398 IF (MOLAL(4).GT.EXCL) THEN ! Adjust aqueous phase Cl
1399 MOLAL(4) = MOLAL(4) - EXCL
1402 EXCL = EXCL - MOLAL(4)
1406 IF (CNH4CL.GT.EXCL) THEN ! Adjust NH4Cl(s)
1407 CNH4CL = CNH4CL - EXCL ! more solid than excess
1408 GHCL = GHCL + EXCL ! evaporate Cl to gas phase
1410 ELSE ! less solid than excess
1411 GHCL = GHCL + CNH4CL ! evaporate into gas phase
1412 EXCL = EXCL - CNH4CL ! reduce excess
1413 CNH4CL = ZERO ! zero salt concentration
1416 ! *** FOR SULFATE ******************************************************
1418 40 EXS4 = MOLAL(5) + MOLAL(6) + 2.d0*CLC + CNH42S4 + CNH4HS4 + &
1419 CNA2SO4 + CNAHSO4 - WI(2)
1420 EXS4 = MAX(EXS4,ZERO) ! Calculate excess (solution - input)
1421 IF (EXS4.LT.TINY) GOTO 50 ! No excess SO4, return
1423 IF (MOLAL(6).GT.EXS4) THEN ! Adjust aqueous phase HSO4
1424 MOLAL(6) = MOLAL(6) - EXS4
1427 EXS4 = EXS4 - MOLAL(6)
1431 IF (MOLAL(5).GT.EXS4) THEN ! Adjust aqueous phase SO4
1432 MOLAL(5) = MOLAL(5) - EXS4
1435 EXS4 = EXS4 - MOLAL(5)
1439 IF (CLC.GT.2d0*EXS4) THEN ! Adjust (NH4)3H(SO4)2(s)
1440 CLC = CLC - EXS4/2d0 ! more solid than excess
1441 GNH3 = GNH3 +1.5d0*EXS4! evaporate NH3 to gas phase
1443 ELSE ! less solid than excess
1444 GNH3 = GNH3 + 1.5d0*CLC! evaporate NH3 to gas phase
1445 EXS4 = EXS4 - 2d0*CLC ! reduce excess
1446 CLC = ZERO ! zero salt concentration
1449 IF (CNH4HS4.GT.EXS4) THEN ! Adjust NH4HSO4(s)
1450 CNH4HS4 = CNH4HS4 - EXS4 ! more solid than excess
1451 GNH3 = GNH3 + EXS4 ! evaporate NH3 to gas phase
1453 ELSE ! less solid than excess
1454 GNH3 = GNH3 + CNH4HS4 ! evaporate NH3 to gas phase
1455 EXS4 = EXS4 - CNH4HS4 ! reduce excess
1456 CNH4HS4 = ZERO ! zero salt concentration
1459 IF (CNH42S4.GT.EXS4) THEN ! Adjust (NH4)2SO4(s)
1460 CNH42S4 = CNH42S4- EXS4 ! more solid than excess
1461 GNH3 = GNH3 + 2.d0*EXS4! evaporate NH3 to gas phase
1463 ELSE ! less solid than excess
1464 GNH3 = GNH3+2.d0*CNH42S4 ! evaporate NH3 to gas phase
1465 EXS4 = EXS4 - CNH42S4 ! reduce excess
1466 CNH42S4 = ZERO ! zero salt concentration
1469 ! *** RETURN **********************************************************
1474 !=======================================================================
1476 ! *** ISORROPIA CODE
1477 ! *** FUNCTION GETASR
1478 ! *** CALCULATES THE LIMITING NH4+/SO4 RATIO OF A SULFATE POOR SYSTEM
1479 ! (i.e. SULFATE RATIO = 2.0) FOR GIVEN SO4 LEVEL AND RH
1481 ! *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY,
1482 ! *** GEORGIA INSTITUTE OF TECHNOLOGY
1483 ! *** WRITTEN BY ATHANASIOS NENES
1484 ! *** UPDATED BY CHRISTOS FOUNTOUKIS
1486 !=======================================================================
1488 DOUBLE PRECISION FUNCTION GETASR (SO4I, RHI)
1490 PARAMETER (NSO4S=14, NRHS=20, NASRD=NSO4S*NRHS)
1491 ! COMMON /ASRC/ ASRAT(NASRD), ASSO4(NSO4S)
1492 DOUBLE PRECISION SO4I, RHI
1494 !CC *** SOLVE USING FULL COMPUTATIONS, NOT LOOK-UP TABLES **************
1497 !CC W(3) = WAER(2)*2.0001D0
1499 !CC SULRATW = MOLAL(3)/WAER(2)
1500 !CC CALL INIT1 (WI, RHI, TEMPI) ! Re-initialize COMMON BLOCK
1502 ! *** CALCULATE INDICES ************************************************
1505 A1 = INT(ALOG10(RAT)) ! Magnitude of RAT
1506 IA1 = INT(RAT/2.5/10.0**A1)
1508 INDS = 4.0*A1 + MIN(IA1,4)
1509 INDS = MIN(MAX(0, INDS), NSO4S-1) + 1 ! SO4 component of IPOS
1511 INDR = INT(99.0-RHI*100.0) + 1
1512 INDR = MIN(MAX(1, INDR), NRHS) ! RH component of IPOS
1514 ! *** GET VALUE AND RETURN *********************************************
1517 INDSH = MIN(INDSL+1, NSO4S)
1518 IPOSL = (INDSL-1)*NRHS + INDR ! Low position in array
1519 IPOSH = (INDSH-1)*NRHS + INDR ! High position in array
1521 WF = (SO4I-ASSO4(INDSL))/(ASSO4(INDSH)-ASSO4(INDSL) + 1e-7)
1522 WF = MIN(MAX(WF, 0.0), 1.0)
1524 GETASR = WF*ASRAT(IPOSH) + (1.0-WF)*ASRAT(IPOSL)
1526 ! *** END OF FUNCTION GETASR *******************************************
1533 !=======================================================================
1535 ! *** ISORROPIA CODE
1536 ! *** BLOCK DATA AERSR
1537 ! *** CONTAINS DATA FOR AEROSOL SULFATE RATIO ARRAY NEEDED IN FUNCTION
1540 ! *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY,
1541 ! *** GEORGIA INSTITUTE OF TECHNOLOGY
1542 ! *** WRITTEN BY ATHANASIOS NENES
1543 ! *** UPDATED BY CHRISTOS FOUNTOUKIS
1545 !=======================================================================
1549 PARAMETER (NSO4S=14, NRHS=20, NASRD=NSO4S*NRHS)
1550 ! COMMON /ASRC/ ASRAT(NASRD), ASSO4(NSO4S)
1552 ! DATA ASSO4/1.0E-9, 2.5E-9, 5.0E-9, 7.5E-9, 1.0E-8, &
1553 ! 2.5E-8, 5.0E-8, 7.5E-8, 1.0E-7, 2.5E-7, &
1554 ! 5.0E-7, 7.5E-7, 1.0E-6, 5.0E-6/
1556 ! DATA (ASRAT(I), I=1,100)/ &
1557 ! 1.020464, 0.9998130, 0.9960167, 0.9984423, 1.004004, &
1558 ! 1.010885, 1.018356, 1.026726, 1.034268, 1.043846, &
1559 ! 1.052933, 1.062230, 1.062213, 1.080050, 1.088350, &
1560 ! 1.096603, 1.104289, 1.111745, 1.094662, 1.121594, &
1561 ! 1.268909, 1.242444, 1.233815, 1.232088, 1.234020, &
1562 ! 1.238068, 1.243455, 1.250636, 1.258734, 1.267543, &
1563 ! 1.276948, 1.286642, 1.293337, 1.305592, 1.314726, &
1564 ! 1.323463, 1.333258, 1.343604, 1.344793, 1.355571, &
1565 ! 1.431463, 1.405204, 1.395791, 1.393190, 1.394403, &
1566 ! 1.398107, 1.403811, 1.411744, 1.420560, 1.429990, &
1567 ! 1.439742, 1.449507, 1.458986, 1.468403, 1.477394, &
1568 ! 1.487373, 1.495385, 1.503854, 1.512281, 1.520394, &
1569 ! 1.514464, 1.489699, 1.480686, 1.478187, 1.479446, &
1570 ! 1.483310, 1.489316, 1.497517, 1.506501, 1.515816, &
1571 ! 1.524724, 1.533950, 1.542758, 1.551730, 1.559587, &
1572 ! 1.568343, 1.575610, 1.583140, 1.590440, 1.596481, &
1573 ! 1.567743, 1.544426, 1.535928, 1.533645, 1.535016, &
1574 ! 1.539003, 1.545124, 1.553283, 1.561886, 1.570530, &
1575 ! 1.579234, 1.587813, 1.595956, 1.603901, 1.611349, &
1576 ! 1.618833, 1.625819, 1.632543, 1.639032, 1.645276/
1578 ! DATA (ASRAT(I), I=101,200)/ &
1579 ! 1.707390, 1.689553, 1.683198, 1.681810, 1.683490, &
1580 ! 1.687477, 1.693148, 1.700084, 1.706917, 1.713507, &
1581 ! 1.719952, 1.726190, 1.731985, 1.737544, 1.742673, &
1582 ! 1.747756, 1.752431, 1.756890, 1.761141, 1.765190, &
1583 ! 1.785657, 1.771851, 1.767063, 1.766229, 1.767901, &
1584 ! 1.771455, 1.776223, 1.781769, 1.787065, 1.792081, &
1585 ! 1.796922, 1.801561, 1.805832, 1.809896, 1.813622, &
1586 ! 1.817292, 1.820651, 1.823841, 1.826871, 1.829745, &
1587 ! 1.822215, 1.810497, 1.806496, 1.805898, 1.807480, &
1588 ! 1.810684, 1.814860, 1.819613, 1.824093, 1.828306, &
1589 ! 1.832352, 1.836209, 1.839748, 1.843105, 1.846175, &
1590 ! 1.849192, 1.851948, 1.854574, 1.857038, 1.859387, &
1591 ! 1.844588, 1.834208, 1.830701, 1.830233, 1.831727, &
1592 ! 1.834665, 1.838429, 1.842658, 1.846615, 1.850321, &
1593 ! 1.853869, 1.857243, 1.860332, 1.863257, 1.865928, &
1594 ! 1.868550, 1.870942, 1.873208, 1.875355, 1.877389, &
1595 ! 1.899556, 1.892637, 1.890367, 1.890165, 1.891317, &
1596 ! 1.893436, 1.896036, 1.898872, 1.901485, 1.903908, &
1597 ! 1.906212, 1.908391, 1.910375, 1.912248, 1.913952, &
1598 ! 1.915621, 1.917140, 1.918576, 1.919934, 1.921220/
1600 ! DATA (ASRAT(I), I=201,280)/ &
1601 ! 1.928264, 1.923245, 1.921625, 1.921523, 1.922421, &
1602 ! 1.924016, 1.925931, 1.927991, 1.929875, 1.931614, &
1603 ! 1.933262, 1.934816, 1.936229, 1.937560, 1.938769, &
1604 ! 1.939951, 1.941026, 1.942042, 1.943003, 1.943911, &
1605 ! 1.941205, 1.937060, 1.935734, 1.935666, 1.936430, &
1606 ! 1.937769, 1.939359, 1.941061, 1.942612, 1.944041, &
1607 ! 1.945393, 1.946666, 1.947823, 1.948911, 1.949900, &
1608 ! 1.950866, 1.951744, 1.952574, 1.953358, 1.954099, &
1609 ! 1.948985, 1.945372, 1.944221, 1.944171, 1.944850, &
1610 ! 1.946027, 1.947419, 1.948902, 1.950251, 1.951494, &
1611 ! 1.952668, 1.953773, 1.954776, 1.955719, 1.956576, &
1612 ! 1.957413, 1.958174, 1.958892, 1.959571, 1.960213, &
1613 ! 1.977193, 1.975540, 1.975023, 1.975015, 1.975346, &
1614 ! 1.975903, 1.976547, 1.977225, 1.977838, 1.978401, &
1615 ! 1.978930, 1.979428, 1.979879, 1.980302, 1.980686, &
1616 ! 1.981060, 1.981401, 1.981722, 1.982025, 1.982312/
1618 ! *** END OF BLOCK DATA AERSR ******************************************
1623 !=======================================================================
1625 ! *** ISORROPIA CODE
1626 ! *** SUBROUTINE CALCHA
1627 ! *** CALCULATES CHLORIDES SPECIATION
1629 ! HYDROCHLORIC ACID IN THE LIQUID PHASE IS ASSUMED A MINOR SPECIES,
1630 ! AND DOES NOT SIGNIFICANTLY PERTURB THE HSO4-SO4 EQUILIBRIUM. THE
1631 ! HYDROCHLORIC ACID DISSOLVED IS CALCULATED FROM THE
1632 ! HCL(G) <-> (H+) + (CL-)
1633 ! EQUILIBRIUM, USING THE (H+) FROM THE SULFATES.
1635 ! *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY,
1636 ! *** GEORGIA INSTITUTE OF TECHNOLOGY
1637 ! *** WRITTEN BY ATHANASIOS NENES
1638 ! *** UPDATED BY CHRISTOS FOUNTOUKIS
1640 !=======================================================================
1644 IMPLICIT DOUBLE PRECISION (A-H, O-Z)
1645 ! INCLUDE 'ISRPIA.INC'
1646 DOUBLE PRECISION KAPA
1647 !C CHARACTER ERRINF*40
1649 ! *** CALCULATE HCL DISSOLUTION *****************************************
1653 IF (WATER.GT.TINY) THEN
1655 ALFA = XK3*R*TEMP*(WATER/GAMA(11))**2.0
1656 DIAK = SQRT( (KAPA+ALFA)**2.0 + 4.0*ALFA*X)
1657 DELT = 0.5*(-(KAPA+ALFA) + DIAK)
1658 !C IF (DELT/KAPA.GT.0.1d0) THEN
1659 !C WRITE (ERRINF,'(1PE10.3)') DELT/KAPA*100.0
1660 !C CALL PUSHERR (0033, ERRINF)
1664 ! *** CALCULATE HCL SPECIATION IN THE GAS PHASE *************************
1666 GHCL = MAX(X-DELT, 0.0d0) ! GAS HCL
1668 ! *** CALCULATE HCL SPECIATION IN THE LIQUID PHASE **********************
1670 MOLAL(4) = DELT ! CL-
1671 MOLAL(1) = MOLAL(1) + DELT ! H+
1675 ! *** END OF SUBROUTINE CALCHA ******************************************
1683 !=======================================================================
1685 ! *** ISORROPIA CODE
1686 ! *** SUBROUTINE CALCHAP
1687 ! *** CALCULATES CHLORIDES SPECIATION
1689 ! HYDROCHLORIC ACID IN THE LIQUID PHASE IS ASSUMED A MINOR SPECIES,
1690 ! THAT DOES NOT SIGNIFICANTLY PERTURB THE HSO4-SO4 EQUILIBRIUM.
1691 ! THE HYDROCHLORIC ACID DISSOLVED IS CALCULATED FROM THE
1692 ! HCL(G) -> HCL(AQ) AND HCL(AQ) -> (H+) + (CL-)
1693 ! EQUILIBRIA, USING (H+) FROM THE SULFATES.
1695 ! THIS IS THE VERSION USED BY THE INVERSE PROBLEM SOVER
1697 ! *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY,
1698 ! *** GEORGIA INSTITUTE OF TECHNOLOGY
1699 ! *** WRITTEN BY ATHANASIOS NENES
1700 ! *** UPDATED BY CHRISTOS FOUNTOUKIS
1702 !=======================================================================
1706 IMPLICIT DOUBLE PRECISION (A-H, O-Z)
1707 ! INCLUDE 'ISRPIA.INC'
1709 ! *** IS THERE A LIQUID PHASE? ******************************************
1711 IF (WATER.LE.TINY) RETURN
1713 ! *** CALCULATE HCL SPECIATION IN THE GAS PHASE *************************
1715 CALL CALCCLAQ (MOLAL(4), MOLAL(1), DELT)
1716 ALFA = XK3*R*TEMP*(WATER/GAMA(11))**2.0
1718 MOLAL(1) = MOLAL(1) - DELT
1719 MOLAL(4) = MOLAL(4) - DELT
1720 GHCL = MOLAL(1)*MOLAL(4)/ALFA
1724 ! *** END OF SUBROUTINE CALCHAP *****************************************
1729 !=======================================================================
1731 ! *** ISORROPIA CODE
1732 ! *** SUBROUTINE CALCNA
1733 ! *** CALCULATES NITRATES SPECIATION
1735 ! NITRIC ACID IN THE LIQUID PHASE IS ASSUMED A MINOR SPECIES, THAT
1736 ! DOES NOT SIGNIFICANTLY PERTURB THE HSO4-SO4 EQUILIBRIUM. THE NITRIC
1737 ! ACID DISSOLVED IS CALCULATED FROM THE HNO3(G) -> (H+) + (NO3-)
1738 ! EQUILIBRIUM, USING THE (H+) FROM THE SULFATES.
1740 ! *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY,
1741 ! *** GEORGIA INSTITUTE OF TECHNOLOGY
1742 ! *** WRITTEN BY ATHANASIOS NENES
1743 ! *** UPDATED BY CHRISTOS FOUNTOUKIS
1745 !=======================================================================
1749 IMPLICIT DOUBLE PRECISION (A-H, O-Z)
1750 ! INCLUDE 'ISRPIA.INC'
1751 DOUBLE PRECISION KAPA
1752 !C CHARACTER ERRINF*40
1754 ! *** CALCULATE HNO3 DISSOLUTION ****************************************
1758 IF (WATER.GT.TINY) THEN
1760 ALFA = XK4*R*TEMP*(WATER/GAMA(10))**2.0
1761 DIAK = SQRT( (KAPA+ALFA)**2.0 + 4.0*ALFA*X)
1762 DELT = 0.5*(-(KAPA+ALFA) + DIAK)
1763 !C IF (DELT/KAPA.GT.0.1d0) THEN
1764 !C WRITE (ERRINF,'(1PE10.3)') DELT/KAPA*100.0
1765 !C CALL PUSHERR (0019, ERRINF) ! WARNING ERROR: NO SOLUTION
1769 ! *** CALCULATE HNO3 SPECIATION IN THE GAS PHASE ************************
1771 GHNO3 = MAX(X-DELT, 0.0d0) ! GAS HNO3
1773 ! *** CALCULATE HNO3 SPECIATION IN THE LIQUID PHASE *********************
1775 MOLAL(7) = DELT ! NO3-
1776 MOLAL(1) = MOLAL(1) + DELT ! H+
1780 ! *** END OF SUBROUTINE CALCNA ******************************************
1786 !=======================================================================
1788 ! *** ISORROPIA CODE
1789 ! *** SUBROUTINE CALCNAP
1790 ! *** CALCULATES NITRATES SPECIATION
1792 ! NITRIC ACID IN THE LIQUID PHASE IS ASSUMED A MINOR SPECIES, THAT
1793 ! DOES NOT SIGNIFICANTLY PERTURB THE HSO4-SO4 EQUILIBRIUM. THE NITRIC
1794 ! ACID DISSOLVED IS CALCULATED FROM THE HNO3(G) -> HNO3(AQ) AND
1795 ! HNO3(AQ) -> (H+) + (CL-) EQUILIBRIA, USING (H+) FROM THE SULFATES.
1797 ! THIS IS THE VERSION USED BY THE INVERSE PROBLEM SOVER
1799 ! *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY,
1800 ! *** GEORGIA INSTITUTE OF TECHNOLOGY
1801 ! *** WRITTEN BY ATHANASIOS NENES
1802 ! *** UPDATED BY CHRISTOS FOUNTOUKIS
1804 !=======================================================================
1808 IMPLICIT DOUBLE PRECISION (A-H, O-Z)
1809 ! INCLUDE 'ISRPIA.INC'
1811 ! *** IS THERE A LIQUID PHASE? ******************************************
1813 IF (WATER.LE.TINY) RETURN
1815 ! *** CALCULATE HNO3 SPECIATION IN THE GAS PHASE ************************
1817 CALL CALCNIAQ (MOLAL(7), MOLAL(1), DELT)
1818 ALFA = XK4*R*TEMP*(WATER/GAMA(10))**2.0
1820 MOLAL(1) = MOLAL(1) - DELT
1821 MOLAL(7) = MOLAL(7) - DELT
1822 GHNO3 = MOLAL(1)*MOLAL(7)/ALFA
1824 ! write (*,*) ALFA, MOLAL(1), MOLAL(7), GHNO3, DELT
1828 ! *** END OF SUBROUTINE CALCNAP *****************************************
1832 !=======================================================================
1834 ! *** ISORROPIA CODE
1835 ! *** SUBROUTINE CALCNH3
1836 ! *** CALCULATES AMMONIA IN GAS PHASE
1838 ! AMMONIA IN THE GAS PHASE IS ASSUMED A MINOR SPECIES, THAT
1839 ! DOES NOT SIGNIFICANTLY PERTURB THE AEROSOL EQUILIBRIUM.
1840 ! AMMONIA GAS IS CALCULATED FROM THE NH3(g) + (H+)(l) <==> (NH4+)(l)
1841 ! EQUILIBRIUM, USING (H+), (NH4+) FROM THE AEROSOL SOLUTION.
1843 ! THIS IS THE VERSION USED BY THE DIRECT PROBLEM
1845 ! *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY,
1846 ! *** GEORGIA INSTITUTE OF TECHNOLOGY
1847 ! *** WRITTEN BY ATHANASIOS NENES
1848 ! *** UPDATED BY CHRISTOS FOUNTOUKIS
1850 !=======================================================================
1854 IMPLICIT DOUBLE PRECISION (A-H, O-Z)
1855 ! INCLUDE 'ISRPIA.INC'
1857 ! *** IS THERE A LIQUID PHASE? ******************************************
1859 IF (WATER.LE.TINY) RETURN
1861 ! *** CALCULATE NH3 SUBLIMATION *****************************************
1863 A1 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2.0
1867 BB =(CHI2 + ONE/A1) ! a=1; b!=1; c!=1
1869 DIAK = SQRT(BB*BB - 4.D0*CC) ! Always > 0
1870 PSI = 0.5*(-BB + DIAK) ! One positive root
1871 PSI = MAX(TINY, MIN(PSI,CHI1))! Constrict in acceptible range
1873 ! *** CALCULATE NH3 SPECIATION IN THE GAS PHASE *************************
1875 GNH3 = PSI ! GAS HNO3
1877 ! *** CALCULATE NH3 AFFECT IN THE LIQUID PHASE **************************
1879 MOLAL(3) = CHI1 - PSI ! NH4+
1880 MOLAL(1) = CHI2 + PSI ! H+
1884 ! *** END OF SUBROUTINE CALCNH3 *****************************************
1890 !=======================================================================
1892 ! *** ISORROPIA CODE
1893 ! *** SUBROUTINE CALCNH3P
1894 ! *** CALCULATES AMMONIA IN GAS PHASE
1896 ! AMMONIA GAS IS CALCULATED FROM THE NH3(g) + (H+)(l) <==> (NH4+)(l)
1897 ! EQUILIBRIUM, USING (H+), (NH4+) FROM THE AEROSOL SOLUTION.
1899 ! THIS IS THE VERSION USED BY THE INVERSE PROBLEM SOLVER
1901 ! *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY,
1902 ! *** GEORGIA INSTITUTE OF TECHNOLOGY
1903 ! *** WRITTEN BY ATHANASIOS NENES
1904 ! *** UPDATED BY CHRISTOS FOUNTOUKIS
1906 !=======================================================================
1910 IMPLICIT DOUBLE PRECISION (A-H, O-Z)
1911 ! INCLUDE 'ISRPIA.INC'
1913 ! *** IS THERE A LIQUID PHASE? ******************************************
1915 IF (WATER.LE.TINY) RETURN
1917 ! *** CALCULATE NH3 GAS PHASE CONCENTRATION *****************************
1919 A1 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2.0
1920 GNH3 = MOLAL(3)/MOLAL(1)/A1
1924 ! *** END OF SUBROUTINE CALCNH3P ****************************************
1929 !=======================================================================
1931 ! *** ISORROPIA CODE
1932 ! *** SUBROUTINE CALCNHA
1934 ! THIS SUBROUTINE CALCULATES THE DISSOLUTION OF HCL, HNO3 AT
1935 ! THE PRESENCE OF (H,SO4). HCL, HNO3 ARE CONSIDERED MINOR SPECIES,
1936 ! THAT DO NOT SIGNIFICANTLY AFFECT THE EQUILIBRIUM POINT.
1938 ! *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY,
1939 ! *** GEORGIA INSTITUTE OF TECHNOLOGY
1940 ! *** WRITTEN BY ATHANASIOS NENES
1941 ! *** UPDATED BY CHRISTOS FOUNTOUKIS
1943 !=======================================================================
1947 IMPLICIT DOUBLE PRECISION (A-H, O-Z)
1948 ! INCLUDE 'ISRPIA.INC'
1949 DOUBLE PRECISION M1, M2, M3
1952 ! *** SPECIAL CASE; WATER=ZERO ******************************************
1954 IF (WATER.LE.TINY) THEN
1957 ! *** SPECIAL CASE; HCL=HNO3=ZERO ***************************************
1959 ELSEIF (W(5).LE.TINY .AND. W(4).LE.TINY) THEN
1962 ! *** SPECIAL CASE; HCL=ZERO ********************************************
1964 ELSE IF (W(5).LE.TINY) THEN
1965 CALL CALCNA ! CALL HNO3 DISSOLUTION ROUTINE
1968 ! *** SPECIAL CASE; HNO3=ZERO *******************************************
1970 ELSE IF (W(4).LE.TINY) THEN
1971 CALL CALCHA ! CALL HCL DISSOLUTION ROUTINE
1975 ! *** CALCULATE EQUILIBRIUM CONSTANTS ***********************************
1977 A3 = XK4*R*TEMP*(WATER/GAMA(10))**2.0 ! HNO3
1978 A4 = XK3*R*TEMP*(WATER/GAMA(11))**2.0 ! HCL
1980 ! *** CALCULATE CUBIC EQUATION COEFFICIENTS *****************************
1985 OMEGA = MOLAL(1) ! H+
1993 M1 = (C1 + C2 + (OMEGA+A4)*C3)/C3
1994 M2 = ((OMEGA+A4)*C2 - A4*C3*CHI4)/C3
1997 ! *** CALCULATE ROOTS ***************************************************
1999 CALL POLY3 (M1, M2, M3, DELCL, ISLV) ! HCL DISSOLUTION
2001 DELCL = TINY ! TINY AMOUNTS OF HCL ASSUMED WHEN NO ROOT
2002 WRITE (ERRINF,'(1PE7.1)') TINY
2003 CALL PUSHERR (0022, ERRINF) ! WARNING ERROR: NO SOLUTION
2005 DELCL = MIN(DELCL, CHI4)
2007 DELNO = C1*DELCL/(C2 + C3*DELCL)
2008 DELNO = MIN(DELNO, CHI3)
2010 IF (DELCL.LT.ZERO .OR. DELNO.LT.ZERO .OR. &
2011 DELCL.GT.CHI4 .OR. DELNO.GT.CHI3 ) THEN
2012 DELCL = TINY ! TINY AMOUNTS OF HCL ASSUMED WHEN NO ROOT
2014 WRITE (ERRINF,'(1PE7.1)') TINY
2015 CALL PUSHERR (0022, ERRINF) ! WARNING ERROR: NO SOLUTION
2018 !CC *** COMPARE DELTA TO TOTAL H+ ; ESTIMATE EFFECT TO HSO4 ***************
2020 !C IF ((DELCL+DELNO)/MOLAL(1).GT.0.1d0) THEN
2021 !C WRITE (ERRINF,'(1PE10.3)') (DELCL+DELNO)/MOLAL(1)*100.0
2022 !C CALL PUSHERR (0021, ERRINF)
2025 ! *** EFFECT ON LIQUID PHASE ********************************************
2027 50 MOLAL(1) = MOLAL(1) + (DELNO+DELCL) ! H+ CHANGE
2028 MOLAL(4) = MOLAL(4) + DELCL ! CL- CHANGE
2029 MOLAL(7) = MOLAL(7) + DELNO ! NO3- CHANGE
2031 ! *** EFFECT ON GAS PHASE ***********************************************
2033 55 GHCL = MAX(W(5) - MOLAL(4), TINY)
2034 GHNO3 = MAX(W(4) - MOLAL(7), TINY)
2038 ! *** END OF SUBROUTINE CALCNHA *****************************************
2044 !=======================================================================
2046 ! *** ISORROPIA CODE
2047 ! *** SUBROUTINE CALCNHP
2049 ! THIS SUBROUTINE CALCULATES THE GAS PHASE NITRIC AND HYDROCHLORIC
2050 ! ACID. CONCENTRATIONS ARE CALCULATED FROM THE DISSOLUTION
2051 ! EQUILIBRIA, USING (H+), (Cl-), (NO3-) IN THE AEROSOL PHASE.
2053 ! THIS IS THE VERSION USED BY THE INVERSE PROBLEM SOLVER
2055 ! *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY,
2056 ! *** GEORGIA INSTITUTE OF TECHNOLOGY
2057 ! *** WRITTEN BY ATHANASIOS NENES
2058 ! *** UPDATED BY CHRISTOS FOUNTOUKIS
2060 !=======================================================================
2064 IMPLICIT DOUBLE PRECISION (A-H, O-Z)
2065 ! INCLUDE 'ISRPIA.INC'
2067 ! *** IS THERE A LIQUID PHASE? ******************************************
2069 IF (WATER.LE.TINY) RETURN
2071 ! *** CALCULATE EQUILIBRIUM CONSTANTS ***********************************
2073 A3 = XK3*R*TEMP*(WATER/GAMA(11))**2.0
2074 A4 = XK4*R*TEMP*(WATER/GAMA(10))**2.0
2075 MOLAL(1) = MOLAL(1) + WAER(4) + WAER(5) ! H+ increases because NO3, Cl are added.
2077 ! *** CALCULATE CONCENTRATIONS ******************************************
2078 ! *** ASSUME THAT 'DELT' FROM HNO3 >> 'DELT' FROM HCL
2080 CALL CALCNIAQ (WAER(4), MOLAL(1)+MOLAL(7)+MOLAL(4), DELT)
2081 MOLAL(1) = MOLAL(1) - DELT
2082 MOLAL(7) = WAER(4) - DELT ! NO3- = Waer(4) minus any turned into (HNO3aq)
2085 CALL CALCCLAQ (WAER(5), MOLAL(1)+MOLAL(7)+MOLAL(4), DELT)
2086 MOLAL(1) = MOLAL(1) - DELT
2087 MOLAL(4) = WAER(5) - DELT ! Cl- = Waer(4) minus any turned into (HNO3aq)
2090 GHNO3 = MOLAL(1)*MOLAL(7)/A4
2091 GHCL = MOLAL(1)*MOLAL(4)/A3
2095 ! *** END OF SUBROUTINE CALCNHP *****************************************
2099 !=======================================================================
2101 ! *** ISORROPIA CODE
2102 ! *** SUBROUTINE CALCAMAQ
2103 ! *** THIS SUBROUTINE CALCULATES THE NH3(aq) GENERATED FROM (H,NH4+).
2105 ! *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY,
2106 ! *** GEORGIA INSTITUTE OF TECHNOLOGY
2107 ! *** WRITTEN BY ATHANASIOS NENES
2108 ! *** UPDATED BY CHRISTOS FOUNTOUKIS
2110 !=======================================================================
2112 SUBROUTINE CALCAMAQ (NH4I, OHI, DELT)
2114 IMPLICIT DOUBLE PRECISION (A-H, O-Z)
2115 ! INCLUDE 'ISRPIA.INC'
2116 DOUBLE PRECISION NH4I
2117 !C CHARACTER ERRINF*40
2119 ! *** EQUILIBRIUM CONSTANTS
2121 A22 = XK22/XKW/WATER*(GAMA(8)/GAMA(9))**2. ! GAMA(NH3) ASSUMED 1
2122 AKW = XKW *RH*WATER*WATER
2128 BB =-(OM1+OM2+A22*AKW)
2130 DD = SQRT(BB*BB-4.D0*CC)
2132 DEL1 = 0.5D0*(-BB - DD)
2133 DEL2 = 0.5D0*(-BB + DD)
2135 ! *** GET APPROPRIATE ROOT.
2137 IF (DEL1.LT.ZERO) THEN
2138 IF (DEL2.GT.NH4I .OR. DEL2.GT.OHI) THEN
2147 !C *** COMPARE DELTA TO TOTAL NH4+ ; ESTIMATE EFFECT *********************
2149 !C IF (DELTA/HYD.GT.0.1d0) THEN
2150 !C WRITE (ERRINF,'(1PE10.3)') DELTA/HYD*100.0
2151 !C CALL PUSHERR (0020, ERRINF)
2156 ! *** END OF SUBROUTINE CALCAMAQ ****************************************
2162 !=======================================================================
2164 ! *** ISORROPIA CODE
2165 ! *** SUBROUTINE CALCAMAQ2
2167 ! THIS SUBROUTINE CALCULATES THE NH3(aq) GENERATED FROM (H,NH4+).
2169 ! *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY,
2170 ! *** GEORGIA INSTITUTE OF TECHNOLOGY
2171 ! *** WRITTEN BY ATHANASIOS NENES
2172 ! *** UPDATED BY CHRISTOS FOUNTOUKIS
2174 !=======================================================================
2176 SUBROUTINE CALCAMAQ2 (GGNH3, NH4I, OHI, NH3AQ)
2178 IMPLICIT DOUBLE PRECISION (A-H, O-Z)
2179 ! INCLUDE 'ISRPIA.INC'
2180 DOUBLE PRECISION NH4I, NH3AQ
2182 ! *** EQUILIBRIUM CONSTANTS
2184 A22 = XK22/XKW/WATER*(GAMA(8)/GAMA(9))**2. ! GAMA(NH3) ASSUMED 1
2185 AKW = XKW *RH*WATER*WATER
2193 DEL = 0.5D0*(-BB + SQRT(BB*BB-4.D0*CC))
2195 ! *** ADJUST CONCENTRATIONS
2199 IF (OHI.LE.TINY) OHI = SQRT(AKW) ! If solution is neutral.
2204 ! *** END OF SUBROUTINE CALCAMAQ2 ****************************************
2210 !=======================================================================
2212 ! *** ISORROPIA CODE
2213 ! *** SUBROUTINE CALCCLAQ
2215 ! THIS SUBROUTINE CALCULATES THE HCL(aq) GENERATED FROM (H+,CL-).
2217 ! *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY,
2218 ! *** GEORGIA INSTITUTE OF TECHNOLOGY
2219 ! *** WRITTEN BY ATHANASIOS NENES
2220 ! *** UPDATED BY CHRISTOS FOUNTOUKIS
2222 !=======================================================================
2224 SUBROUTINE CALCCLAQ (CLI, HI, DELT)
2226 IMPLICIT DOUBLE PRECISION (A-H, O-Z)
2227 ! INCLUDE 'ISRPIA.INC'
2228 DOUBLE PRECISION CLI
2230 ! *** EQUILIBRIUM CONSTANTS
2232 A32 = XK32*WATER/(GAMA(11))**2. ! GAMA(HCL) ASSUMED 1
2240 DD = SQRT(BB*BB-4.D0*CC)
2242 DEL1 = 0.5D0*(-BB - DD)
2243 DEL2 = 0.5D0*(-BB + DD)
2245 ! *** GET APPROPRIATE ROOT.
2247 IF (DEL1.LT.ZERO) THEN
2248 IF (DEL2.LT.ZERO .OR. DEL2.GT.CLI .OR. DEL2.GT.HI) THEN
2259 ! *** END OF SUBROUTINE CALCCLAQ ****************************************
2265 !=======================================================================
2267 ! *** ISORROPIA CODE
2268 ! *** SUBROUTINE CALCCLAQ2
2270 ! THIS SUBROUTINE CALCULATES THE HCL(aq) GENERATED FROM (H+,CL-).
2272 ! *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY,
2273 ! *** GEORGIA INSTITUTE OF TECHNOLOGY
2274 ! *** WRITTEN BY ATHANASIOS NENES
2275 ! *** UPDATED BY CHRISTOS FOUNTOUKIS
2277 !=======================================================================
2279 SUBROUTINE CALCCLAQ2 (GGCL, CLI, HI, CLAQ)
2281 IMPLICIT DOUBLE PRECISION (A-H, O-Z)
2282 ! INCLUDE 'ISRPIA.INC'
2283 DOUBLE PRECISION CLI
2285 ! *** EQUILIBRIUM CONSTANTS
2287 A32 = XK32*WATER/(GAMA(11))**2. ! GAMA(HCL) ASSUMED 1
2288 AKW = XKW *RH*WATER*WATER
2295 DEL1 = 0.5*(-COEF + SQRT(COEF*COEF+4.D0*A32*ALF2))
2297 ! *** CORRECT CONCENTRATIONS
2301 IF (HI.LE.TINY) HI = SQRT(AKW) ! If solution is neutral.
2306 ! *** END OF SUBROUTINE CALCCLAQ2 ****************************************
2312 !=======================================================================
2314 ! *** ISORROPIA CODE
2315 ! *** SUBROUTINE CALCNIAQ
2317 ! THIS SUBROUTINE CALCULATES THE HNO3(aq) GENERATED FROM (H,NO3-).
2319 ! *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY,
2320 ! *** GEORGIA INSTITUTE OF TECHNOLOGY
2321 ! *** WRITTEN BY ATHANASIOS NENES
2322 ! *** UPDATED BY CHRISTOS FOUNTOUKIS
2324 !=======================================================================
2326 SUBROUTINE CALCNIAQ (NO3I, HI, DELT)
2328 IMPLICIT DOUBLE PRECISION (A-H, O-Z)
2329 ! INCLUDE 'ISRPIA.INC'
2330 DOUBLE PRECISION NO3I, HI, DELT
2332 ! *** EQUILIBRIUM CONSTANTS
2334 A42 = XK42*WATER/(GAMA(10))**2. ! GAMA(HNO3) ASSUMED 1
2342 DD = SQRT(BB*BB-4.D0*CC)
2344 DEL1 = 0.5D0*(-BB - DD)
2345 DEL2 = 0.5D0*(-BB + DD)
2347 ! *** GET APPROPRIATE ROOT.
2349 IF (DEL1.LT.ZERO .OR. DEL1.GT.HI .OR. DEL1.GT.NO3I) THEN
2357 IF (DEL2.LT.ZERO .OR. DEL2.GT.NO3I .OR. DEL2.GT.HI) THEN
2365 ! *** END OF SUBROUTINE CALCNIAQ ****************************************
2371 !=======================================================================
2373 ! *** ISORROPIA CODE
2374 ! *** SUBROUTINE CALCNIAQ2
2376 ! THIS SUBROUTINE CALCULATES THE UNDISSOCIATED HNO3(aq)
2378 ! *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY,
2379 ! *** GEORGIA INSTITUTE OF TECHNOLOGY
2380 ! *** WRITTEN BY ATHANASIOS NENES
2381 ! *** UPDATED BY CHRISTOS FOUNTOUKIS
2383 !=======================================================================
2385 SUBROUTINE CALCNIAQ2 (GGNO3, NO3I, HI, NO3AQ)
2387 IMPLICIT DOUBLE PRECISION (A-H, O-Z)
2388 ! INCLUDE 'ISRPIA.INC'
2389 DOUBLE PRECISION NO3I, NO3AQ
2391 ! *** EQUILIBRIUM CONSTANTS
2393 A42 = XK42*WATER/(GAMA(10))**2. ! GAMA(HNO3) ASSUMED 1
2394 AKW = XKW *RH*WATER*WATER
2402 BB = ALF3 + ALF1 + A42
2403 CC = ALF3*ALF1 - A42*ALF2
2404 DEL1 = 0.5*(-BB + SQRT(BB*BB-4.D0*CC))
2406 ! *** CORRECT CONCENTRATIONS
2410 IF (HI.LE.TINY) HI = SQRT(AKW) ! If solution is neutral.
2415 ! *** END OF SUBROUTINE CALCNIAQ2 ****************************************
2420 !=======================================================================
2422 ! *** ISORROPIA CODE
2423 ! *** SUBROUTINE CALCMR
2424 ! *** THIS SUBROUTINE CALCULATES:
2425 ! 1. ION PAIR CONCENTRATIONS (FROM [MOLAR] ARRAY)
2426 ! 2. WATER CONTENT OF LIQUID AEROSOL PHASE (FROM ZSR CORRELATION)
2428 ! *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY,
2429 ! *** GEORGIA INSTITUTE OF TECHNOLOGY
2430 ! *** WRITTEN BY ATHANASIOS NENES
2431 ! *** UPDATED BY CHRISTOS FOUNTOUKIS
2433 !=======================================================================
2438 IMPLICIT DOUBLE PRECISION (A-H, O-Z)
2439 ! INCLUDE 'ISRPIA.INC'
2440 ! COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, &
2441 ! PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, PSI7, PSI8, &
2442 ! A1, A2, A3, A4, A5, A6, A7, A8
2445 ! *** CALCULATE ION PAIR CONCENTRATIONS ACCORDING TO SPECIFIC CASE ****
2447 SC =SCASE(1:1) ! SULRAT & SODRAT case
2449 ! *** NH4-SO4 SYSTEM ; SULFATE POOR CASE
2452 MOLALR(4) = MOLAL(5)+MOLAL(6) ! (NH4)2SO4 - CORRECT FOR SO4 TO HSO4
2454 ! *** NH4-SO4 SYSTEM ; SULFATE RICH CASE ; NO FREE ACID
2456 ELSE IF (SC.EQ.'B') THEN
2457 SO4I = MOLAL(5)-MOLAL(1) ! CORRECT FOR HSO4 DISSOCIATION
2458 HSO4I = MOLAL(6)+MOLAL(1)
2459 IF (SO4I.LT.HSO4I) THEN
2460 MOLALR(13) = SO4I ! [LC] = [SO4]
2461 MOLALR(9) = MAX(HSO4I-SO4I, ZERO) ! NH4HSO4
2463 MOLALR(13) = HSO4I ! [LC] = [HSO4]
2464 MOLALR(4) = MAX(SO4I-HSO4I, ZERO) ! (NH4)2SO4
2467 ! *** NH4-SO4 SYSTEM ; SULFATE RICH CASE ; FREE ACID
2469 ELSE IF (SC.EQ.'C') THEN
2470 MOLALR(9) = MOLAL(3) ! NH4HSO4
2471 MOLALR(7) = MAX(W(2)-W(3), ZERO) ! H2SO4
2473 ! *** NH4-SO4-NO3 SYSTEM ; SULFATE POOR CASE
2475 ELSE IF (SC.EQ.'D') THEN
2476 MOLALR(4) = MOLAL(5) + MOLAL(6) ! (NH4)2SO4
2477 AML5 = MOLAL(3)-2.D0*MOLALR(4) ! "free" NH4
2478 MOLALR(5) = MAX(MIN(AML5,MOLAL(7)), ZERO)! NH4NO3 = MIN("free", NO3)
2480 ! *** NH4-SO4-NO3 SYSTEM ; SULFATE RICH CASE ; NO FREE ACID
2482 ELSE IF (SC.EQ.'E') THEN
2483 SO4I = MAX(MOLAL(5)-MOLAL(1),ZERO) ! FROM HSO4 DISSOCIATION
2484 HSO4I = MOLAL(6)+MOLAL(1)
2485 IF (SO4I.LT.HSO4I) THEN
2486 MOLALR(13) = SO4I ! [LC] = [SO4]
2487 MOLALR(9) = MAX(HSO4I-SO4I, ZERO) ! NH4HSO4
2489 MOLALR(13) = HSO4I ! [LC] = [HSO4]
2490 MOLALR(4) = MAX(SO4I-HSO4I, ZERO) ! (NH4)2SO4
2493 ! *** NH4-SO4-NO3 SYSTEM ; SULFATE RICH CASE ; FREE ACID
2495 ELSE IF (SC.EQ.'F') THEN
2496 MOLALR(9) = MOLAL(3) ! NH4HSO4
2497 MOLALR(7) = MAX(MOLAL(5)+MOLAL(6)-MOLAL(3),ZERO) ! H2SO4
2499 ! *** NA-NH4-SO4-NO3-CL SYSTEM ; SULFATE POOR ; SODIUM POOR CASE
2501 ELSE IF (SC.EQ.'G') THEN
2502 MOLALR(2) = 0.5*MOLAL(2) ! NA2SO4
2503 TOTS4 = MOLAL(5)+MOLAL(6) ! Total SO4
2504 MOLALR(4) = MAX(TOTS4 - MOLALR(2), ZERO) ! (NH4)2SO4
2505 FRNH4 = MAX(MOLAL(3) - 2.D0*MOLALR(4), ZERO)
2506 MOLALR(5) = MIN(MOLAL(7),FRNH4) ! NH4NO3
2507 FRNH4 = MAX(FRNH4 - MOLALR(5), ZERO)
2508 MOLALR(6) = MIN(MOLAL(4), FRNH4) ! NH4CL
2510 ! *** NA-NH4-SO4-NO3-CL SYSTEM ; SULFATE POOR ; SODIUM RICH CASE
2511 ! *** RETREIVE DISSOLVED SALTS DIRECTLY FROM COMMON BLOCK /SOLUT/
2513 ELSE IF (SC.EQ.'H') THEN
2514 MOLALR(1) = PSI7 ! NACL
2515 MOLALR(2) = PSI1 ! NA2SO4
2516 MOLALR(3) = PSI8 ! NANO3
2517 MOLALR(4) = ZERO ! (NH4)2SO4
2518 FRNO3 = MAX(MOLAL(7) - MOLALR(3), ZERO) ! "FREE" NO3
2519 FRCL = MAX(MOLAL(4) - MOLALR(1), ZERO) ! "FREE" CL
2520 MOLALR(5) = MIN(MOLAL(3),FRNO3) ! NH4NO3
2521 FRNH4 = MAX(MOLAL(3) - MOLALR(5), ZERO) ! "FREE" NH3
2522 MOLALR(6) = MIN(FRCL, FRNH4) ! NH4CL
2524 ! *** NA-NH4-SO4-NO3-CL SYSTEM ; SULFATE RICH CASE ; NO FREE ACID
2525 ! *** RETREIVE DISSOLVED SALTS DIRECTLY FROM COMMON BLOCK /SOLUT/
2527 ELSE IF (SC.EQ.'I') THEN
2528 MOLALR(04) = PSI5 ! (NH4)2SO4
2529 MOLALR(02) = PSI4 ! NA2SO4
2530 MOLALR(09) = PSI1 ! NH4HSO4
2531 MOLALR(12) = PSI3 ! NAHSO4
2532 MOLALR(13) = PSI2 ! LC
2534 ! *** NA-NH4-SO4-NO3-CL SYSTEM ; SULFATE RICH CASE ; FREE ACID
2536 ELSE IF (SC.EQ.'J') THEN
2537 MOLALR(09) = MOLAL(3) ! NH4HSO4
2538 MOLALR(12) = MOLAL(2) ! NAHSO4
2539 MOLALR(07) = MOLAL(5)+MOLAL(6)-MOLAL(3)-MOLAL(2) ! H2SO4
2540 MOLALR(07) = MAX(MOLALR(07),ZERO)
2542 ! ======= REVERSE PROBLEMS ===========================================
2544 ! *** NH4-SO4-NO3 SYSTEM ; SULFATE POOR CASE
2546 ELSE IF (SC.EQ.'N') THEN
2547 MOLALR(4) = MOLAL(5) + MOLAL(6) ! (NH4)2SO4
2548 AML5 = WAER(3)-2.D0*MOLALR(4) ! "free" NH4
2549 MOLALR(5) = MAX(MIN(AML5,WAER(4)), ZERO) ! NH4NO3 = MIN("free", NO3)
2551 ! *** NH4-SO4-NO3-NA-CL SYSTEM ; SULFATE POOR, SODIUM POOR CASE
2553 ELSE IF (SC.EQ.'Q') THEN
2554 MOLALR(2) = PSI1 ! NA2SO4
2555 MOLALR(4) = PSI6 ! (NH4)2SO4
2556 MOLALR(5) = PSI5 ! NH4NO3
2557 MOLALR(6) = PSI4 ! NH4CL
2559 ! *** NH4-SO4-NO3-NA-CL SYSTEM ; SULFATE POOR, SODIUM RICH CASE
2561 ELSE IF (SC.EQ.'R') THEN
2562 MOLALR(1) = PSI3 ! NACL
2563 MOLALR(2) = PSI1 ! NA2SO4
2564 MOLALR(3) = PSI2 ! NANO3
2565 MOLALR(4) = ZERO ! (NH4)2SO4
2566 MOLALR(5) = PSI5 ! NH4NO3
2567 MOLALR(6) = PSI4 ! NH4CL
2572 CALL PUSHERR (1001, ' ') ! FATAL ERROR: CASE NOT SUPPORTED
2575 ! *** CALCULATE WATER CONTENT ; ZSR CORRELATION ***********************
2579 WATER = WATER + MOLALR(I)/M0(I)
2581 WATER = MAX(WATER, TINY)
2585 ! *** END OF SUBROUTINE CALCMR ******************************************
2588 !=======================================================================
2590 ! *** ISORROPIA CODE
2591 ! *** SUBROUTINE CALCMDRH
2593 ! THIS IS THE CASE WHERE THE RELATIVE HUMIDITY IS IN THE MUTUAL
2594 ! DRH REGION. THE SOLUTION IS ASSUMED TO BE THE SUM OF TWO WEIGHTED
2595 ! SOLUTIONS ; THE 'DRY' SOLUTION (SUBROUTINE DRYCASE) AND THE
2596 ! 'SATURATED LIQUID' SOLUTION (SUBROUTINE LIQCASE).
2598 ! *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY,
2599 ! *** GEORGIA INSTITUTE OF TECHNOLOGY
2600 ! *** WRITTEN BY ATHANASIOS NENES
2601 ! *** UPDATED BY CHRISTOS FOUNTOUKIS
2603 !=======================================================================
2605 SUBROUTINE CALCMDRH (RHI, RHDRY, RHLIQ, DRYCASE, LIQCASE)
2607 IMPLICIT DOUBLE PRECISION (A-H, O-Z)
2608 ! INCLUDE 'ISRPIA.INC'
2609 EXTERNAL DRYCASE, LIQCASE
2611 ! *** FIND WEIGHT FACTOR **********************************************
2613 IF (WFTYP.EQ.0) THEN
2615 ELSEIF (WFTYP.EQ.1) THEN
2618 WF = (RHLIQ-RHI)/(RHLIQ-RHDRY)
2622 ! *** FIND FIRST SECTION ; DRY ONE ************************************
2625 IF (ABS(ONEMWF).LE.1D-5) GOTO 200 ! DRY AEROSOL
2627 CNH42SO = CNH42S4 ! FIRST (DRY) SOLUTION
2640 ! *** FIND SECOND SECTION ; DRY & LIQUID ******************************
2654 CALL LIQCASE ! SECOND (LIQUID) SOLUTION
2656 ! *** ADJUST THINGS FOR THE CASE THAT THE LIQUID SUB PREDICTS DRY AEROSOL
2658 IF (WATER.LE.TINY) THEN
2660 MOLAL(I)= ZERO ! Aqueous phase
2664 CNH42S4 = CNH42SO ! Solid phase
2674 GNH3 = GNH3O ! Gas phase
2681 ! *** FIND SALT DISSOLUTIONS BETWEEN DRY & LIQUID SOLUTIONS.
2683 DAMSUL = CNH42SO - CNH42S4
2684 DSOSUL = CNA2SO - CNA2SO4
2685 DAMBIS = CNH4HSO - CNH4HS4
2686 DSOBIS = CNAHSO - CNAHSO4
2688 DAMNIT = CNH4N3O - CNH4NO3
2689 DAMCHL = CNH4CLO - CNH4CL
2690 DSONIT = CNANO - CNANO3
2691 DSOCHL = CNACLO - CNACL
2693 ! *** FIND GAS DISSOLUTIONS BETWEEN DRY & LIQUID SOLUTIONS.
2697 DNAG = GHNO3O - GHNO3
2699 ! *** FIND SOLUTION AT MDRH BY WEIGHTING DRY & LIQUID SOLUTIONS.
2703 MOLAL(1)= ONEMWF*MOLAL(1) ! H+
2704 MOLAL(2)= ONEMWF*(2.D0*DSOSUL + DSOBIS + DSONIT + DSOCHL) ! NA+
2705 MOLAL(3)= ONEMWF*(2.D0*DAMSUL + DAMG + DAMBIS + DAMCHL + &
2706 3.D0*DLC + DAMNIT ) ! NH4+
2707 MOLAL(4)= ONEMWF*( DAMCHL + DSOCHL + DHAG) ! CL-
2708 MOLAL(5)= ONEMWF*( DAMSUL + DSOSUL + DLC - MOLAL(6)) ! SO4-- !VB 17 Sept 2001
2709 MOLAL(6)= ONEMWF*( MOLAL(6) + DSOBIS + DAMBIS + DLC) ! HSO4-
2710 MOLAL(7)= ONEMWF*( DAMNIT + DSONIT + DNAG) ! NO3-
2711 WATER = ONEMWF*WATER
2715 CNH42S4 = WF*CNH42SO + ONEMWF*CNH42S4
2716 CNA2SO4 = WF*CNA2SO + ONEMWF*CNA2SO4
2717 CNAHSO4 = WF*CNAHSO + ONEMWF*CNAHSO4
2718 CNH4HS4 = WF*CNH4HSO + ONEMWF*CNH4HS4
2719 CLC = WF*CLCO + ONEMWF*CLC
2720 CNH4NO3 = WF*CNH4N3O + ONEMWF*CNH4NO3
2721 CNANO3 = WF*CNANO + ONEMWF*CNANO3
2722 CNACL = WF*CNACLO + ONEMWF*CNACL
2723 CNH4CL = WF*CNH4CLO + ONEMWF*CNH4CL
2727 GNH3 = WF*GNH3O + ONEMWF*GNH3
2728 GHNO3 = WF*GHNO3O + ONEMWF*GHNO3
2729 GHCL = WF*GHCLO + ONEMWF*GHCL
2735 ! *** END OF SUBROUTINE CALCMDRH ****************************************
2744 !=======================================================================
2746 ! *** ISORROPIA CODE
2747 ! *** SUBROUTINE CALCMDRP
2749 ! THIS IS THE CASE WHERE THE RELATIVE HUMIDITY IS IN THE MUTUAL
2750 ! DRH REGION. THE SOLUTION IS ASSUMED TO BE THE SUM OF TWO WEIGHTED
2751 ! SOLUTIONS ; THE 'DRY' SOLUTION (SUBROUTINE DRYCASE) AND THE
2752 ! 'SATURATED LIQUID' SOLUTION (SUBROUTINE LIQCASE).
2754 ! *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY,
2755 ! *** GEORGIA INSTITUTE OF TECHNOLOGY
2756 ! *** WRITTEN BY ATHANASIOS NENES
2757 ! *** UPDATED BY CHRISTOS FOUNTOUKIS
2759 !=======================================================================
2761 SUBROUTINE CALCMDRP (RHI, RHDRY, RHLIQ, DRYCASE, LIQCASE)
2763 IMPLICIT DOUBLE PRECISION (A-H, O-Z)
2764 ! INCLUDE 'ISRPIA.INC'
2765 EXTERNAL DRYCASE, LIQCASE
2767 ! *** FIND WEIGHT FACTOR **********************************************
2769 IF (WFTYP.EQ.0) THEN
2771 ELSEIF (WFTYP.EQ.1) THEN
2774 WF = (RHLIQ-RHI)/(RHLIQ-RHDRY)
2778 ! *** FIND FIRST SECTION ; DRY ONE ************************************
2781 IF (ABS(ONEMWF).LE.1D-5) GOTO 200 ! DRY AEROSOL
2783 CNH42SO = CNH42S4 ! FIRST (DRY) SOLUTION
2793 ! *** FIND SECOND SECTION ; DRY & LIQUID ******************************
2807 CALL LIQCASE ! SECOND (LIQUID) SOLUTION
2809 ! *** ADJUST THINGS FOR THE CASE THAT THE LIQUID SUB PREDICTS DRY AEROSOL
2811 IF (WATER.LE.TINY) THEN
2820 ! *** FIND SALT DISSOLUTIONS BETWEEN DRY & LIQUID SOLUTIONS.
2822 DAMBIS = CNH4HSO - CNH4HS4
2823 DSOBIS = CNAHSO - CNAHSO4
2826 ! *** FIND SOLUTION AT MDRH BY WEIGHTING DRY & LIQUID SOLUTIONS.
2830 CNH42S4 = WF*CNH42SO + ONEMWF*CNH42S4
2831 CNA2SO4 = WF*CNA2SO + ONEMWF*CNA2SO4
2832 CNAHSO4 = WF*CNAHSO + ONEMWF*CNAHSO4
2833 CNH4HS4 = WF*CNH4HSO + ONEMWF*CNH4HS4
2834 CLC = WF*CLCO + ONEMWF*CLC
2835 CNH4NO3 = WF*CNH4N3O + ONEMWF*CNH4NO3
2836 CNANO3 = WF*CNANO + ONEMWF*CNANO3
2837 CNACL = WF*CNACLO + ONEMWF*CNACL
2838 CNH4CL = WF*CNH4CLO + ONEMWF*CNH4CL
2842 WATER = ONEMWF*WATER
2844 MOLAL(2)= WAER(1) - 2.D0*CNA2SO4 - CNAHSO4 - CNANO3 - &
2846 MOLAL(3)= WAER(3) - 2.D0*CNH42S4 - CNH4HS4 - CNH4CL - &
2847 3.D0*CLC - CNH4NO3 ! NH4+
2848 MOLAL(4)= WAER(5) - CNACL - CNH4CL ! CL-
2849 MOLAL(7)= WAER(4) - CNANO3 - CNH4NO3 ! NO3-
2850 MOLAL(6)= ONEMWF*(MOLAL(6) + DSOBIS + DAMBIS + DLC) ! HSO4-
2851 MOLAL(5)= WAER(2) - MOLAL(6) - CLC - CNH42S4 - CNA2SO4 ! SO4--
2853 A8 = XK1*WATER/GAMA(7)*(GAMA(8)/GAMA(7))**2.
2854 IF (MOLAL(5).LE.TINY) THEN
2855 HIEQ = SQRT(XKW *RH*WATER*WATER) ! Neutral solution
2857 HIEQ = A8*MOLAL(6)/MOLAL(5)
2859 HIEN = MOLAL(4) + MOLAL(7) + MOLAL(6) + 2.D0*MOLAL(5) - &
2861 MOLAL(1)= MAX (HIEQ, HIEN) ! H+
2863 ! *** GAS (ACTIVITY COEFS FROM LIQUID SOLUTION)
2865 A2 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2. ! NH3 <==> NH4+
2866 A3 = XK4 *R*TEMP*(WATER/GAMA(10))**2. ! HNO3 <==> NO3-
2867 A4 = XK3 *R*TEMP*(WATER/GAMA(11))**2. ! HCL <==> CL-
2869 GNH3 = MOLAL(3)/MAX(MOLAL(1),TINY)/A2
2870 GHNO3 = MOLAL(1)*MOLAL(7)/A3
2871 GHCL = MOLAL(1)*MOLAL(4)/A4
2875 ! *** END OF SUBROUTINE CALCMDRP ****************************************
2878 !=======================================================================
2880 ! *** ISORROPIA CODE
2881 ! *** SUBROUTINE CALCHS4
2882 ! *** THIS SUBROUTINE CALCULATES THE HSO4 GENERATED FROM (H,SO4).
2884 ! *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY,
2885 ! *** GEORGIA INSTITUTE OF TECHNOLOGY
2886 ! *** WRITTEN BY ATHANASIOS NENES
2887 ! *** UPDATED BY CHRISTOS FOUNTOUKIS
2889 !=======================================================================
2891 SUBROUTINE CALCHS4 (HI, SO4I, HSO4I, DELTA)
2893 IMPLICIT DOUBLE PRECISION (A-H, O-Z)
2894 ! INCLUDE 'ISRPIA.INC'
2895 !C CHARACTER ERRINF*40
2897 ! *** IF TOO LITTLE WATER, DONT SOLVE
2899 IF (WATER.LE.1d1*TINY) THEN
2904 ! *** CALCULATE HSO4 SPECIATION *****************************************
2906 A8 = XK1*WATER/GAMA(7)*(GAMA(8)/GAMA(7))**2.
2908 BB =-(HI + SO4I + A8)
2909 CC = HI*SO4I - HSO4I*A8
2910 DD = BB*BB - 4.D0*CC
2912 IF (DD.GE.ZERO) THEN
2914 DELTA1 = 0.5*(-BB + SQDD)
2915 DELTA2 = 0.5*(-BB - SQDD)
2916 IF (HSO4I.LE.TINY) THEN
2918 ELSEIF( HI*SO4I .GE. A8*HSO4I ) THEN
2920 ELSEIF( HI*SO4I .LT. A8*HSO4I ) THEN
2929 !CC *** COMPARE DELTA TO TOTAL H+ ; ESTIMATE EFFECT OF HSO4 ***************
2931 !C HYD = MAX(HI, MOLAL(1))
2932 !C IF (HYD.GT.TINY) THEN
2933 !C IF (DELTA/HYD.GT.0.1d0) THEN
2934 !C WRITE (ERRINF,'(1PE10.3)') DELTA/HYD*100.0
2935 !C CALL PUSHERR (0020, ERRINF)
2941 ! *** END OF SUBROUTINE CALCHS4 *****************************************
2946 !=======================================================================
2948 ! *** ISORROPIA CODE
2949 ! *** SUBROUTINE CALCPH
2951 ! *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY,
2952 ! *** GEORGIA INSTITUTE OF TECHNOLOGY
2953 ! *** WRITTEN BY ATHANASIOS NENES
2954 ! *** UPDATED BY CHRISTOS FOUNTOUKIS
2956 !=======================================================================
2958 SUBROUTINE CALCPH (GG, HI, OHI)
2960 IMPLICIT DOUBLE PRECISION (A-H, O-Z)
2961 ! INCLUDE 'ISRPIA.INC'
2963 AKW = XKW *RH*WATER*WATER
2966 ! *** GG = (negative charge) - (positive charge)
2968 IF (GG.GT.TINY) THEN ! H+ in excess
2971 DD = BB*BB - 4.D0*CC
2972 HI = MAX(0.5D0*(-BB + SQRT(DD)),CN)
2974 ELSE ! OH- in excess
2977 DD = BB*BB - 4.D0*CC
2978 OHI= MAX(0.5D0*(-BB + SQRT(DD)),CN)
2984 ! *** END OF SUBROUTINE CALCPH ******************************************
2988 !=======================================================================
2990 ! *** ISORROPIA CODE
2991 ! *** SUBROUTINE CALCACT
2992 ! *** CALCULATES MULTI-COMPONENET ACTIVITY COEFFICIENTS FROM BROMLEYS
2993 ! METHOD. THE BINARY ACTIVITY COEFFICIENTS ARE CALCULATED BY
2994 ! KUSIK-MEISNER RELATION (SUBROUTINE KMTAB or SUBROUTINE KMFUL).
2996 ! *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY,
2997 ! *** GEORGIA INSTITUTE OF TECHNOLOGY
2998 ! *** WRITTEN BY ATHANASIOS NENES
2999 ! *** UPDATED BY CHRISTOS FOUNTOUKIS
3001 !=======================================================================
3005 IMPLICIT DOUBLE PRECISION (A-H, O-Z)
3006 ! INCLUDE 'ISRPIA.INC'
3009 REAL G0(3,4),ZPL,ZMI,AGAMA,SION,H,CH,F1(3),F2(4)
3010 DOUBLE PRECISION MPL, XIJ, YJI
3011 ! PARAMETER (URF=0.5)
3012 PARAMETER (LN10=2.30258509299404568402D0)
3014 G(I,J)= (F1(I)/Z(I) + F2(J)/Z(J+3)) / (Z(I)+Z(J+3)) - H
3016 ! *** SAVE ACTIVITIES IN OLD ARRAY *************************************
3018 IF (FRST) THEN ! Outer loop
3024 DO 20 I=1,NPAIR ! Inner loop
3028 ! *** CALCULATE IONIC ACTIVITY OF SOLUTION *****************************
3032 IONIC=IONIC + MOLAL(I)*Z(I)*Z(I)
3034 IONIC = MAX(MIN(0.5*IONIC/WATER,500.d0), TINY)
3036 ! *** CALCULATE BINARY ACTIVITY COEFFICIENTS ***************************
3038 ! G0(1,1)=G11;G0(1,2)=G07;G0(1,3)=G08;G0(1,4)=G10;G0(2,1)=G01;G0(2,2)=G02
3039 ! G0(2,3)=G12;G0(2,4)=G03;G0(3,1)=G06;G0(3,2)=G04;G0(3,3)=G09;G0(3,4)=G05
3041 IF (IACALC.EQ.0) THEN ! K.M.; FULL
3042 CALL KMFUL (IONIC, SNGL(TEMP),G0(2,1),G0(2,2),G0(2,4), &
3043 G0(3,2),G0(3,4),G0(3,1),G0(1,2),G0(1,3),G0(3,3), &
3044 G0(1,4),G0(1,1),G0(2,3))
3045 ELSE ! K.M.; TABULATED
3046 CALL KMTAB (IONIC, SNGL(TEMP),G0(2,1),G0(2,2),G0(2,4), &
3047 G0(3,2),G0(3,4),G0(3,1),G0(1,2),G0(1,3),G0(3,3), &
3048 G0(1,4),G0(1,1),G0(2,3))
3051 ! *** CALCULATE MULTICOMPONENT ACTIVITY COEFFICIENTS *******************
3053 AGAMA = 0.511*(298.0/TEMP)**1.5 ! Debye Huckel const. at T
3055 H = AGAMA*SION/(1+SION)
3065 MPL = MOLAL(I)/WATER
3068 CH = 0.25*(ZPL+ZMI)*(ZPL+ZMI)/IONIC
3070 YJI = CH*MOLAL(J+3)/WATER
3071 F1(I) = F1(I) + SNGL(YJI*(G0(I,J) + ZPL*ZMI*H))
3072 F2(J) = F2(J) + SNGL(XIJ*(G0(I,J) + ZPL*ZMI*H))
3075 ! *** LOG10 OF ACTIVITY COEFFICIENTS ***********************************
3077 GAMA(01) = G(2,1)*ZZ(01) ! NACL
3078 GAMA(02) = G(2,2)*ZZ(02) ! NA2SO4
3079 GAMA(03) = G(2,4)*ZZ(03) ! NANO3
3080 GAMA(04) = G(3,2)*ZZ(04) ! (NH4)2SO4
3081 GAMA(05) = G(3,4)*ZZ(05) ! NH4NO3
3082 GAMA(06) = G(3,1)*ZZ(06) ! NH4CL
3083 GAMA(07) = G(1,2)*ZZ(07) ! 2H-SO4
3084 GAMA(08) = G(1,3)*ZZ(08) ! H-HSO4
3085 GAMA(09) = G(3,3)*ZZ(09) ! NH4HSO4
3086 GAMA(10) = G(1,4)*ZZ(10) ! HNO3
3087 GAMA(11) = G(1,1)*ZZ(11) ! HCL
3088 GAMA(12) = G(2,3)*ZZ(12) ! NAHSO4
3089 GAMA(13) = 0.20*(3.0*GAMA(04)+2.0*GAMA(09)) ! LC ; SCAPE
3090 !C GAMA(13) = 0.50*(GAMA(04)+GAMA(09)) ! LC ; SEQUILIB
3091 !C GAMA(13) = 0.25*(3.0*GAMA(04)+GAMA(07)) ! LC ; AIM
3093 ! *** CONVERT LOG (GAMA) COEFFICIENTS TO GAMA **************************
3096 GAMA(I)=MAX(-11.0d0, MIN(GAMA(I),11.0d0) ) ! F77 LIBRARY ROUTINE
3097 ! GAMA(I)=10.0**GAMA(I)
3098 GAMA(I)=EXP(LN10*GAMA(I))
3099 !C GAMA(I)=EX10(SNGL(GAMA(I)), 5.0) ! CUTOFF SET TO [-5,5]
3100 ! GAMA(I) = GAMIN(I)*(1.0-URF) + URF*GAMA(I) ! Under-relax GAMA's
3103 ! *** SETUP ACTIVITY CALCULATION FLAGS *********************************
3105 ! OUTER CALCULATION LOOP ; ONLY IF FRST=.TRUE.
3108 ERROU = ZERO ! CONVERGENCE CRITERION
3110 ERROU=MAX(ERROU, ABS((GAMOU(I)-GAMA(I))/GAMOU(I)))
3112 CALAOU = ERROU .GE. EPSACT ! SETUP FLAGS
3116 ! INNER CALCULATION LOOP ; ALWAYS
3118 ERRIN = ZERO ! CONVERGENCE CRITERION
3120 ERRIN = MAX (ERRIN, ABS((GAMIN(I)-GAMA(I))/GAMIN(I)))
3122 CALAIN = ERRIN .GE. EPSACT
3124 ICLACT = ICLACT + 1 ! Increment ACTIVITY call counter
3126 ! *** END OF SUBROUTINE ACTIVITY ****************************************
3132 !=======================================================================
3134 ! *** ISORROPIA CODE
3135 ! *** SUBROUTINE RSTGAM
3136 ! *** RESETS ACTIVITY COEFFICIENT ARRAYS TO DEFAULT VALUE OF 0.1
3138 ! *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY,
3139 ! *** GEORGIA INSTITUTE OF TECHNOLOGY
3140 ! *** WRITTEN BY ATHANASIOS NENES
3141 ! *** UPDATED BY CHRISTOS FOUNTOUKIS
3143 !=======================================================================
3147 IMPLICIT DOUBLE PRECISION (A-H, O-Z)
3148 ! INCLUDE 'ISRPIA.INC'
3154 ! *** END OF SUBROUTINE RSTGAM ******************************************
3158 !=======================================================================
3160 ! *** ISORROPIA CODE
3161 ! *** SUBROUTINE KMFUL
3162 ! *** CALCULATES BINARY ACTIVITY COEFFICIENTS BY KUSIK-MEISSNER METHOD.
3164 ! *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY,
3165 ! *** GEORGIA INSTITUTE OF TECHNOLOGY
3166 ! *** WRITTEN BY ATHANASIOS NENES
3167 ! *** UPDATED BY CHRISTOS FOUNTOUKIS
3169 !=======================================================================
3171 SUBROUTINE KMFUL (IONIC,TEMP,G01,G02,G03,G04,G05,G06,G07,G08,G09, &
3174 DATA Z01,Z02,Z03,Z04,Z05,Z06,Z07,Z08,Z10,Z11 &
3175 /1, 2, 1, 2, 1, 1, 2, 1, 1, 1/
3179 ! *** Coefficients at 25 oC
3181 CALL MKBI(2.230, IONIC, SION, Z01, G01)
3182 CALL MKBI(-0.19, IONIC, SION, Z02, G02)
3183 CALL MKBI(-0.39, IONIC, SION, Z03, G03)
3184 CALL MKBI(-0.25, IONIC, SION, Z04, G04)
3185 CALL MKBI(-1.15, IONIC, SION, Z05, G05)
3186 CALL MKBI(0.820, IONIC, SION, Z06, G06)
3187 CALL MKBI(-.100, IONIC, SION, Z07, G07)
3188 CALL MKBI(8.000, IONIC, SION, Z08, G08)
3189 CALL MKBI(2.600, IONIC, SION, Z10, G10)
3190 CALL MKBI(6.000, IONIC, SION, Z11, G11)
3192 ! *** Correct for T other than 298 K
3196 IF (ABS(TC) .GT. 1.0) THEN
3197 CF1 = 1.125-0.005*TI
3198 CF2 = (0.125-0.005*TI)*(0.039*IONIC**0.92-0.41*SION/(1.+SION))
3199 G01 = CF1*G01 - CF2*Z01
3200 G02 = CF1*G02 - CF2*Z02
3201 G03 = CF1*G03 - CF2*Z03
3202 G04 = CF1*G04 - CF2*Z04
3203 G05 = CF1*G05 - CF2*Z05
3204 G06 = CF1*G06 - CF2*Z06
3205 G07 = CF1*G07 - CF2*Z07
3206 G08 = CF1*G08 - CF2*Z08
3207 G10 = CF1*G10 - CF2*Z10
3208 G11 = CF1*G11 - CF2*Z11
3211 G09 = G06 + G08 - G11
3212 G12 = G01 + G08 - G11
3214 ! *** Return point ; End of subroutine
3220 !=======================================================================
3222 ! *** ISORROPIA CODE
3223 ! *** SUBROUTINE MKBI
3224 ! *** CALCULATES BINARY ACTIVITY COEFFICIENTS BY KUSIK-MEISSNER METHOD.
3226 ! *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY,
3227 ! *** GEORGIA INSTITUTE OF TECHNOLOGY
3228 ! *** WRITTEN BY ATHANASIOS NENES
3229 ! *** UPDATED BY CHRISTOS FOUNTOUKIS
3231 !=======================================================================
3233 SUBROUTINE MKBI(Q,IONIC,SION,ZIP,BI)
3239 IF (IONIC.LT.6.0) C=1.+.055*Q*EXP(-.023*IONIC*IONIC*IONIC)
3240 XX=-0.5107*SION/(1.+C*SION)
3241 BI=(1.+B*(1.+.1*IONIC)**Q-B)
3242 BI=ZIP*ALOG10(BI) + ZIP*XX
3246 !=======================================================================
3248 ! *** ISORROPIA CODE
3249 ! *** SUBROUTINE KMTAB
3250 ! *** CALCULATES BINARY ACTIVITY COEFFICIENTS BY KUSIK-MEISSNER METHOD.
3251 ! THE COMPUTATIONS HAVE BEEN PERFORMED AND THE RESULTS ARE STORED IN
3252 ! LOOKUP TABLES. THE IONIC ACTIVITY 'IONIC' IS INPUT, AND THE ARRAY
3253 ! 'BINARR' IS RETURNED WITH THE BINARY COEFFICIENTS.
3255 ! *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY,
3256 ! *** GEORGIA INSTITUTE OF TECHNOLOGY
3257 ! *** WRITTEN BY ATHANASIOS NENES
3258 ! *** UPDATED BY CHRISTOS FOUNTOUKIS
3260 !=======================================================================
3262 SUBROUTINE KMTAB (IN,TEMP,G01,G02,G03,G04,G05,G06,G07,G08,G09,G10, &
3266 ! *** Find temperature range
3268 IND = NINT((TEMP-198.0)/25.0) + 1
3269 IND = MIN(MAX(IND,1),6)
3271 ! *** Call appropriate routine
3274 CALL KM198 (IN,G01,G02,G03,G04,G05,G06,G07,G08,G09,G10,G11,G12)
3275 ELSEIF (IND.EQ.2) THEN
3276 CALL KM223 (IN,G01,G02,G03,G04,G05,G06,G07,G08,G09,G10,G11,G12)
3277 ELSEIF (IND.EQ.3) THEN
3278 CALL KM248 (IN,G01,G02,G03,G04,G05,G06,G07,G08,G09,G10,G11,G12)
3279 ELSEIF (IND.EQ.4) THEN
3280 CALL KM273 (IN,G01,G02,G03,G04,G05,G06,G07,G08,G09,G10,G11,G12)
3281 ELSEIF (IND.EQ.5) THEN
3282 CALL KM298 (IN,G01,G02,G03,G04,G05,G06,G07,G08,G09,G10,G11,G12)
3284 CALL KM323 (IN,G01,G02,G03,G04,G05,G06,G07,G08,G09,G10,G11,G12)
3287 ! *** Return point; End of subroutine
3293 INTEGER FUNCTION IBACPOS(IN)
3295 ! Compute the index in the binary activity coefficient array
3296 ! based on the input ionic strength.
3298 ! Chris Nolte, 6/16/05
3302 IF (IN .LE. 0.300000E+02) THEN
3303 ibacpos = MIN(NINT( 0.200000E+02*IN) + 1, 600)
3305 ibacpos = 600+NINT( 0.200000E+01*IN- 0.600000E+02)
3307 ibacpos = min(ibacpos, 741)
3311 !=======================================================================
3313 ! *** ISORROPIA CODE
3314 ! *** SUBROUTINE KM198
3315 ! *** CALCULATES BINARY ACTIVITY COEFFICIENTS BY KUSIK-MEISSNER METHOD.
3316 ! THE COMPUTATIONS HAVE BEEN PERFORMED AND THE RESULTS ARE STORED IN
3317 ! LOOKUP TABLES. THE IONIC ACTIVITY 'IN' IS INPUT, AND THE ARRAY
3318 ! 'BINARR' IS RETURNED WITH THE BINARY COEFFICIENTS.
3320 ! TEMPERATURE IS 198K
3322 ! *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY,
3323 ! *** GEORGIA INSTITUTE OF TECHNOLOGY
3324 ! *** WRITTEN BY ATHANASIOS NENES
3325 ! *** UPDATED BY CHRISTOS FOUNTOUKIS
3327 !=======================================================================
3329 SUBROUTINE KM198 (IN,G01,G02,G03,G04,G05,G06,G07,G08,G09,G10, &
3333 ! *** Common block definition
3336 ! BNC01M( 741),BNC02M( 741),BNC03M( 741),BNC04M( 741), &
3337 ! BNC05M( 741),BNC06M( 741),BNC07M( 741),BNC08M( 741), &
3338 ! BNC09M( 741),BNC10M( 741),BNC11M( 741),BNC12M( 741), &
3342 ! *** Find position in arrays for binary activity coefficients
3346 ! *** Assign values to return array
3361 ! *** Return point ; End of subroutine
3367 !=======================================================================
3369 ! *** ISORROPIA CODE
3370 ! *** SUBROUTINE KM223
3371 ! *** CALCULATES BINARY ACTIVITY COEFFICIENTS BY KUSIK-MEISSNER METHOD.
3372 ! THE COMPUTATIONS HAVE BEEN PERFORMED AND THE RESULTS ARE STORED IN
3373 ! LOOKUP TABLES. THE IONIC ACTIVITY 'IN' IS INPUT, AND THE ARRAY
3374 ! 'BINARR' IS RETURNED WITH THE BINARY COEFFICIENTS.
3376 ! TEMPERATURE IS 223K
3378 ! *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY,
3379 ! *** GEORGIA INSTITUTE OF TECHNOLOGY
3380 ! *** WRITTEN BY ATHANASIOS NENES
3381 ! *** UPDATED BY CHRISTOS FOUNTOUKIS
3383 !=======================================================================
3385 SUBROUTINE KM223 (IN,G01,G02,G03,G04,G05,G06,G07,G08,G09,G10, &
3389 ! *** Common block definition
3392 ! BNC01M( 741),BNC02M( 741),BNC03M( 741),BNC04M( 741), &
3393 ! BNC05M( 741),BNC06M( 741),BNC07M( 741),BNC08M( 741), &
3394 ! BNC09M( 741),BNC10M( 741),BNC11M( 741),BNC12M( 741), &
3398 ! *** Find position in arrays for binary activity coefficients
3402 ! *** Assign values to return array
3417 ! *** Return point ; End of subroutine
3424 !=======================================================================
3426 ! *** ISORROPIA CODE
3427 ! *** SUBROUTINE KM248
3428 ! *** CALCULATES BINARY ACTIVITY COEFFICIENTS BY KUSIK-MEISSNER METHOD.
3429 ! THE COMPUTATIONS HAVE BEEN PERFORMED AND THE RESULTS ARE STORED IN
3430 ! LOOKUP TABLES. THE IONIC ACTIVITY 'IN' IS INPUT, AND THE ARRAY
3431 ! 'BINARR' IS RETURNED WITH THE BINARY COEFFICIENTS.
3433 ! TEMPERATURE IS 248K
3435 ! *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY,
3436 ! *** GEORGIA INSTITUTE OF TECHNOLOGY
3437 ! *** WRITTEN BY ATHANASIOS NENES
3438 ! *** UPDATED BY CHRISTOS FOUNTOUKIS
3440 !=======================================================================
3442 SUBROUTINE KM248 (IN,G01,G02,G03,G04,G05,G06,G07,G08,G09,G10, &
3446 ! *** Common block definition
3449 ! BNC01M( 741),BNC02M( 741),BNC03M( 741),BNC04M( 741), &
3450 ! BNC05M( 741),BNC06M( 741),BNC07M( 741),BNC08M( 741), &
3451 ! BNC09M( 741),BNC10M( 741),BNC11M( 741),BNC12M( 741), &
3455 ! *** Find position in arrays for binary activity coefficients
3459 ! *** Assign values to return array
3474 ! *** Return point ; End of subroutine
3480 !=======================================================================
3482 ! *** ISORROPIA CODE
3483 ! *** SUBROUTINE KM273
3484 ! *** CALCULATES BINARY ACTIVITY COEFFICIENTS BY KUSIK-MEISSNER METHOD.
3485 ! THE COMPUTATIONS HAVE BEEN PERFORMED AND THE RESULTS ARE STORED IN
3486 ! LOOKUP TABLES. THE IONIC ACTIVITY 'IN' IS INPUT, AND THE ARRAY
3487 ! 'BINARR' IS RETURNED WITH THE BINARY COEFFICIENTS.
3489 ! TEMPERATURE IS 273K
3491 ! *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY,
3492 ! *** GEORGIA INSTITUTE OF TECHNOLOGY
3493 ! *** WRITTEN BY ATHANASIOS NENES
3494 ! *** UPDATED BY CHRISTOS FOUNTOUKIS
3496 !=======================================================================
3498 SUBROUTINE KM273 (IN,G01,G02,G03,G04,G05,G06,G07,G08,G09,G10, &
3502 ! *** Common block definition
3505 ! BNC01M( 741),BNC02M( 741),BNC03M( 741),BNC04M( 741), &
3506 ! BNC05M( 741),BNC06M( 741),BNC07M( 741),BNC08M( 741), &
3507 ! BNC09M( 741),BNC10M( 741),BNC11M( 741),BNC12M( 741), &
3511 ! *** Find position in arrays for binary activity coefficients
3515 ! *** Assign values to return array
3530 ! *** Return point ; End of subroutine
3536 !=======================================================================
3538 ! *** ISORROPIA CODE
3539 ! *** SUBROUTINE KM298
3540 ! *** CALCULATES BINARY ACTIVITY COEFFICIENTS BY KUSIK-MEISSNER METHOD.
3541 ! THE COMPUTATIONS HAVE BEEN PERFORMED AND THE RESULTS ARE STORED IN
3542 ! LOOKUP TABLES. THE IONIC ACTIVITY 'IN' IS INPUT, AND THE ARRAY
3543 ! 'BINARR' IS RETURNED WITH THE BINARY COEFFICIENTS.
3545 ! TEMPERATURE IS 298K
3547 ! *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY,
3548 ! *** GEORGIA INSTITUTE OF TECHNOLOGY
3549 ! *** WRITTEN BY ATHANASIOS NENES
3550 ! *** UPDATED BY CHRISTOS FOUNTOUKIS
3552 !=======================================================================
3554 SUBROUTINE KM298 (IN,G01,G02,G03,G04,G05,G06,G07,G08,G09,G10, &
3558 ! *** Common block definition
3561 ! BNC01M( 741),BNC02M( 741),BNC03M( 741),BNC04M( 741), &
3562 ! BNC05M( 741),BNC06M( 741),BNC07M( 741),BNC08M( 741), &
3563 ! BNC09M( 741),BNC10M( 741),BNC11M( 741),BNC12M( 741), &
3567 ! *** Find position in arrays for binary activity coefficients
3571 ! *** Assign values to return array
3586 ! *** Return point ; End of subroutine
3592 !=======================================================================
3594 ! *** ISORROPIA CODE
3595 ! *** SUBROUTINE KM323
3596 ! *** CALCULATES BINARY ACTIVITY COEFFICIENTS BY KUSIK-MEISSNER METHOD.
3597 ! THE COMPUTATIONS HAVE BEEN PERFORMED AND THE RESULTS ARE STORED IN
3598 ! LOOKUP TABLES. THE IONIC ACTIVITY 'IN' IS INPUT, AND THE ARRAY
3599 ! 'BINARR' IS RETURNED WITH THE BINARY COEFFICIENTS.
3601 ! TEMPERATURE IS 323K
3603 ! *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY,
3604 ! *** GEORGIA INSTITUTE OF TECHNOLOGY
3605 ! *** WRITTEN BY ATHANASIOS NENES
3606 ! *** UPDATED BY CHRISTOS FOUNTOUKIS
3608 !=======================================================================
3610 SUBROUTINE KM323 (IN,G01,G02,G03,G04,G05,G06,G07,G08,G09,G10, &
3614 ! *** Common block definition
3617 ! BNC01M( 741),BNC02M( 741),BNC03M( 741),BNC04M( 741), &
3618 ! BNC05M( 741),BNC06M( 741),BNC07M( 741),BNC08M( 741), &
3619 ! BNC09M( 741),BNC10M( 741),BNC11M( 741),BNC12M( 741), &
3623 ! *** Find position in arrays for binary activity coefficients
3627 ! *** Assign values to return array
3642 ! *** Return point ; End of subroutine
3654 ! *** Common block definition
3657 ! BNC01M( 741),BNC02M( 741),BNC03M( 741),BNC04M( 741), &
3658 ! BNC05M( 741),BNC06M( 741),BNC07M( 741),BNC08M( 741), &
3659 ! BNC09M( 741),BNC10M( 741),BNC11M( 741),BNC12M( 741), &
3669 ! *** Common block definition
3672 ! BNC01M( 741),BNC02M( 741),BNC03M( 741),BNC04M( 741), &
3673 ! BNC05M( 741),BNC06M( 741),BNC07M( 741),BNC08M( 741), &
3674 ! BNC09M( 741),BNC10M( 741),BNC11M( 741),BNC12M( 741), &
3684 ! *** Common block definition
3687 ! BNC01M( 741),BNC02M( 741),BNC03M( 741),BNC04M( 741), &
3688 ! BNC05M( 741),BNC06M( 741),BNC07M( 741),BNC08M( 741), &
3689 ! BNC09M( 741),BNC10M( 741),BNC11M( 741),BNC12M( 741), &
3698 ! *** Common block definition
3701 ! BNC01M( 741),BNC02M( 741),BNC03M( 741),BNC04M( 741), &
3702 ! BNC05M( 741),BNC06M( 741),BNC07M( 741),BNC08M( 741), &
3703 ! BNC09M( 741),BNC10M( 741),BNC11M( 741),BNC12M( 741), &
3712 ! *** Common block definition
3715 ! BNC01M( 741),BNC02M( 741),BNC03M( 741),BNC04M( 741), &
3716 ! BNC05M( 741),BNC06M( 741),BNC07M( 741),BNC08M( 741), &
3717 ! BNC09M( 741),BNC10M( 741),BNC11M( 741),BNC12M( 741), &
3726 ! *** Common block definition
3729 ! BNC01M( 741),BNC02M( 741),BNC03M( 741),BNC04M( 741), &
3730 ! BNC05M( 741),BNC06M( 741),BNC07M( 741),BNC08M( 741), &
3731 ! BNC09M( 741),BNC10M( 741),BNC11M( 741),BNC12M( 741), &
3735 !C*************************************************************************
3737 !C TOOLBOX LIBRARY v.1.0 (May 1995)
3739 !C Program unit : SUBROUTINE CHRBLN
3740 !C Purpose : Position of last non-blank character in a string
3741 !C Author : Athanasios Nenes
3743 !C ======================= ARGUMENTS / USAGE =============================
3745 !C STR is the CHARACTER variable containing the string examined
3746 !C IBLK is a INTEGER variable containing the position of last non
3747 !C blank character. If string is all spaces (ie ' '), then
3748 !C the value returned is 1.
3751 !C STR = 'TEST1.DAT '
3752 !C CALL CHRBLN (STR, IBLK)
3754 !C after execution of this code segment, "IBLK" has the value "9", which
3755 !C is the position of the last non-blank character of "STR".
3757 !C***********************************************************************
3759 SUBROUTINE CHRBLN (STR, IBLK)
3761 !C***********************************************************************
3764 IBLK = 1 ! Substring pointer (default=1)
3765 ILEN = LEN(STR) ! Length of string
3767 IF (STR(i:i).NE.' ' .AND. STR(i:i).NE.CHAR(0)) THEN
3777 !C*************************************************************************
3779 !C TOOLBOX LIBRARY v.1.0 (May 1995)
3781 !C Program unit : SUBROUTINE SHFTRGHT
3782 !C Purpose : RIGHT-JUSTIFICATION FUNCTION ON A STRING
3783 !C Author : Athanasios Nenes
3785 !C ======================= ARGUMENTS / USAGE =============================
3787 !C STRING is the CHARACTER variable with the string to be justified
3791 !C CALL SHFTRGHT (STRING)
3793 !C after execution of this code segment, STRING contains the value
3796 !C*************************************************************************
3798 SUBROUTINE SHFTRGHT (CHR)
3800 !C***********************************************************************
3803 I1 = LEN(CHR) ! Total length of string
3804 CALL CHRBLN(CHR,I2) ! Position of last non-blank character
3805 IF (I2.EQ.I1) RETURN
3807 DO 10 I=I2,1,-1 ! Shift characters
3808 CHR(I1+I-I2:I1+I-I2) = CHR(I:I)
3818 !C*************************************************************************
3820 !C TOOLBOX LIBRARY v.1.0 (May 1995)
3822 !C Program unit : SUBROUTINE RPLSTR
3823 !C Purpose : REPLACE CHARACTERS OCCURING IN A STRING
3824 !C Author : Athanasios Nenes
3826 !C ======================= ARGUMENTS / USAGE =============================
3828 !C STRING is the CHARACTER variable with the string to be edited
3829 !C OLD is the old character which is to be replaced
3830 !C NEW is the new character which OLD is to be replaced with
3831 !C IERR is 0 if everything went well, is 1 if 'NEW' contains 'OLD'.
3832 !C In this case, this is invalid, and no change is done.
3838 !C CALL RPLSTR (STRING, OLD, NEW)
3840 !C after execution of this code segment, STRING contains the value
3843 !C*************************************************************************
3845 SUBROUTINE RPLSTR (STRING, OLD, NEW, IERR)
3847 !C***********************************************************************
3848 CHARACTER STRING*(*), OLD*(*), NEW*(*)
3850 ! *** INITIALIZE ********************************************************
3854 ! *** CHECK AND SEE IF 'NEW' CONTAINS 'OLD', WHICH CANNOT ***************
3864 ! *** PROCEED WITH REPLACING *******************************************
3866 10 IP = INDEX(STRING,OLD) ! SEE IF 'OLD' EXISTS IN 'STRING'
3867 IF (IP.EQ.0) RETURN ! 'OLD' DOES NOT EXIST ; RETURN
3868 STRING(IP:IP+ILO-1) = NEW ! REPLACE SUBSTRING 'OLD' WITH 'NEW'
3869 GOTO 10 ! GO FOR NEW OCCURANCE OF 'OLD'
3874 !C*************************************************************************
3876 !C TOOLBOX LIBRARY v.1.0 (May 1995)
3878 !C Program unit : SUBROUTINE INPTD
3879 !C Purpose : Prompts user for a value (DOUBLE). A default value
3880 !C is provided, so if user presses <Enter>, the default
3882 !C Author : Athanasios Nenes
3884 !C ======================= ARGUMENTS / USAGE =============================
3886 !C VAR is the DOUBLE PRECISION variable which value is to be saved
3887 !C DEF is a DOUBLE PRECISION variable, with the default value of VAR.
3888 !C PROMPT is a CHARACTER varible containing the prompt string.
3889 !C PRFMT is a CHARACTER variable containing the FORMAT specifier
3890 !C for the default value DEF.
3891 !C IERR is an INTEGER error flag, and has the values:
3892 !C 0 - No error detected.
3893 !C 1 - Invalid FORMAT and/or Invalid default value.
3894 !C 2 - Bad value specified by user
3897 !C CALL INPTD (VAR, 1.0D0, 'Give value for A ', '*', Ierr)
3899 !C after execution of this code segment, the user is prompted for the
3900 !C value of variable VAR. If <Enter> is pressed (ie no value is specified)
3901 !C then 1.0 is assigned to VAR. The default value is displayed in free-
3902 !C format. The error status is specified by variable Ierr
3904 !C***********************************************************************
3906 SUBROUTINE INPTD (VAR, DEF, PROMPT, PRFMT, IERR)
3908 !C***********************************************************************
3909 CHARACTER PROMPT*(*), PRFMT*(*), BUFFER*128
3910 DOUBLE PRECISION DEF, VAR
3915 ! *** WRITE DEFAULT VALUE TO WORK BUFFER *******************************
3917 WRITE (BUFFER, FMT=PRFMT, ERR=10) DEF
3918 CALL CHRBLN (BUFFER, IEND)
3920 ! *** PROMPT USER FOR INPUT AND READ IT ********************************
3922 WRITE (*,*) PROMPT,' [',BUFFER(1:IEND),']: '
3923 READ (*, '(A)', ERR=20, END=20) BUFFER
3924 CALL CHRBLN (BUFFER,IEND)
3926 ! *** READ DATA OR SET DEFAULT ? ****************************************
3928 IF (IEND.EQ.1 .AND. BUFFER(1:1).EQ.' ') THEN
3931 READ (BUFFER, *, ERR=20, END=20) VAR
3934 ! *** RETURN POINT ******************************************************
3938 ! *** ERROR HANDLER *****************************************************
3940 10 IERR = 1 ! Bad FORMAT and/or bad default value
3943 20 IERR = 2 ! Bad number given by user
3949 !C*************************************************************************
3951 !C TOOLBOX LIBRARY v.1.0 (May 1995)
3953 !C Program unit : SUBROUTINE Pushend
3954 !C Purpose : Positions the pointer of a sequential file at its end
3955 !C Simulates the ACCESS='APPEND' clause of a F77L OPEN
3956 !C statement with Standard Fortran commands.
3958 !C ======================= ARGUMENTS / USAGE =============================
3960 !C Iunit is a INTEGER variable, the file unit which the file is
3964 !C CALL PUSHEND (10)
3966 !C after execution of this code segment, the pointer of unit 10 is
3967 !C pushed to its end.
3969 !C***********************************************************************
3971 SUBROUTINE Pushend (Iunit)
3973 !C***********************************************************************
3977 ! *** INQUIRE IF Iunit CONNECTED TO FILE ********************************
3979 INQUIRE (UNIT=Iunit, OPENED=OPNED)
3980 IF (.NOT.OPNED) GOTO 25
3982 ! *** Iunit CONNECTED, PUSH POINTER TO END ******************************
3984 10 READ (Iunit,'()', ERR=20, END=20)
3987 ! *** RETURN POINT ******************************************************
3989 20 BACKSPACE (Iunit)
3995 !C*************************************************************************
3997 !C TOOLBOX LIBRARY v.1.0 (May 1995)
3999 !C Program unit : SUBROUTINE APPENDEXT
4000 !C Purpose : Fix extension in file name string
4002 !C ======================= ARGUMENTS / USAGE =============================
4004 !C Filename is the CHARACTER variable with the file name
4005 !C Defext is the CHARACTER variable with extension (including '.',
4007 !C Overwrite is a LOGICAL value, .TRUE. overwrites any existing extension
4008 !C in "Filename" with "Defext", .FALSE. puts "Defext" only if
4009 !C there is no extension in "Filename".
4012 !C FILENAME1 = 'TEST.DAT'
4013 !C FILENAME2 = 'TEST.DAT'
4014 !C CALL APPENDEXT (FILENAME1, '.TXT', .FALSE.)
4015 !C CALL APPENDEXT (FILENAME2, '.TXT', .TRUE. )
4017 !C after execution of this code segment, "FILENAME1" has the value
4018 !C 'TEST.DAT', while "FILENAME2" has the value 'TEST.TXT'
4020 !C***********************************************************************
4022 SUBROUTINE Appendext (Filename, Defext, Overwrite)
4024 !C***********************************************************************
4025 CHARACTER*(*) Filename, Defext
4028 CALL CHRBLN (Filename, Iend)
4029 IF (Filename(1:1).EQ.' ' .AND. Iend.EQ.1) RETURN ! Filename empty
4030 Idot = INDEX (Filename, '.') ! Append extension ?
4031 IF (Idot.EQ.0) Filename = Filename(1:Iend)//Defext
4032 IF (Overwrite .AND. Idot.NE.0) &
4033 Filename = Filename(:Idot-1)//Defext
4041 !=======================================================================
4043 ! *** ISORROPIA CODE
4044 ! *** SUBROUTINE POLY3
4045 ! *** FINDS THE REAL ROOTS OF THE THIRD ORDER ALGEBRAIC EQUATION:
4046 ! X**3 + A1*X**2 + A2*X + A3 = 0.0
4047 ! THE EQUATION IS SOLVED ANALYTICALLY.
4049 ! PARAMETERS A1, A2, A3 ARE SPECIFIED BY THE USER. THE MINIMUM
4050 ! NONEGATIVE ROOT IS RETURNED IN VARIABLE 'ROOT'. IF NO ROOT IS
4051 ! FOUND (WHICH IS GREATER THAN ZERO), ROOT HAS THE VALUE 1D30.
4052 ! AND THE FLAG ISLV HAS A VALUE GREATER THAN ZERO.
4054 ! SOLUTION FORMULA IS FOUND IN PAGE 32 OF:
4055 ! MATHEMATICAL HANDBOOK OF FORMULAS AND TABLES
4056 ! SCHAUM'S OUTLINE SERIES
4057 ! MURRAY SPIEGER, McGRAW-HILL, NEW YORK, 1968
4058 ! (GREEK TRANSLATION: BY SOTIRIOS PERSIDES, ESPI, ATHENS, 1976)
4060 ! A SPECIAL CASE IS CONSIDERED SEPERATELY ; WHEN A3 = 0, THEN
4061 ! ONE ROOT IS X=0.0, AND THE OTHER TWO FROM THE SOLUTION OF THE
4062 ! QUADRATIC EQUATION X**2 + A1*X + A2 = 0.0
4063 ! THIS SPECIAL CASE IS CONSIDERED BECAUSE THE ANALYTICAL FORMULA
4064 ! DOES NOT YIELD ACCURATE RESULTS (DUE TO NUMERICAL ROUNDOFF ERRORS)
4066 ! *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY,
4067 ! *** GEORGIA INSTITUTE OF TECHNOLOGY
4068 ! *** WRITTEN BY ATHANASIOS NENES
4069 ! *** UPDATED BY CHRISTOS FOUNTOUKIS
4071 !=======================================================================
4073 SUBROUTINE POLY3 (A1, A2, A3, ROOT, ISLV)
4075 IMPLICIT DOUBLE PRECISION (A-H, O-Z)
4076 PARAMETER (EXPON=1.D0/3.D0, ZERO=0.D0, THET1=120.D0/180.D0, &
4077 THET2=240.D0/180.D0, PI=3.14159265358932, EPS=1D-50)
4078 DOUBLE PRECISION X(3)
4080 ! *** SPECIAL CASE : QUADRATIC*X EQUATION *****************************
4082 IF (ABS(A3).LE.EPS) THEN
4090 X(2) = 0.5*(-A1+SQD)
4091 X(3) = 0.5*(-A1-SQD)
4095 ! *** NORMAL CASE : CUBIC EQUATION ************************************
4097 ! DEFINE PARAMETERS Q, R, S, T, D
4100 Q = (3.D0*A2 - A1*A1)/9.D0
4101 R = (9.D0*A1*A2 - 27.D0*A3 - 2.D0*A1*A1*A1)/54.D0
4104 ! *** CALCULATE ROOTS *************************************************
4106 ! D < 0, THREE REAL ROOTS
4108 IF (D.LT.-EPS) THEN ! D < -EPS : D < ZERO
4110 THET = EXPON*ACOS(R/SQRT(-Q*Q*Q))
4111 COEF = 2.D0*SQRT(-Q)
4112 X(1) = COEF*COS(THET) - EXPON*A1
4113 X(2) = COEF*COS(THET + THET1*PI) - EXPON*A1
4114 X(3) = COEF*COS(THET + THET2*PI) - EXPON*A1
4116 ! D = 0, THREE REAL (ONE DOUBLE) ROOTS
4118 ELSE IF (D.LE.EPS) THEN ! -EPS <= D <= EPS : D = ZERO
4120 SSIG = SIGN (1.D0, R)
4121 S = SSIG*(ABS(R))**EXPON
4122 X(1) = 2.D0*S - EXPON*A1
4123 X(2) = -S - EXPON*A1
4125 ! D > 0, ONE REAL ROOT
4127 ELSE ! D > EPS : D > ZERO
4130 SSIG = SIGN (1.D0, R+SQD) ! TRANSFER SIGN TO SSIG
4131 TSIG = SIGN (1.D0, R-SQD)
4132 S = SSIG*(ABS(R+SQD))**EXPON ! EXPONENTIATE ABS()
4133 T = TSIG*(ABS(R-SQD))**EXPON
4134 X(1) = S + T - EXPON*A1
4138 ! *** SELECT APPROPRIATE ROOT *****************************************
4142 IF (X(I).GT.ZERO) THEN
4143 ROOT = MIN (ROOT, X(I))
4148 ! *** END OF SUBROUTINE POLY3 *****************************************
4156 !=======================================================================
4158 ! *** ISORROPIA CODE
4159 ! *** SUBROUTINE POLY3B
4160 ! *** FINDS A REAL ROOT OF THE THIRD ORDER ALGEBRAIC EQUATION:
4161 ! X**3 + A1*X**2 + A2*X + A3 = 0.0
4162 ! THE EQUATION IS SOLVED NUMERICALLY (BISECTION).
4164 ! PARAMETERS A1, A2, A3 ARE SPECIFIED BY THE USER. THE MINIMUM
4165 ! NONEGATIVE ROOT IS RETURNED IN VARIABLE 'ROOT'. IF NO ROOT IS
4166 ! FOUND (WHICH IS GREATER THAN ZERO), ROOT HAS THE VALUE 1D30.
4167 ! AND THE FLAG ISLV HAS A VALUE GREATER THAN ZERO.
4169 ! RTLW, RTHI DEFINE THE INTERVAL WHICH THE ROOT IS LOOKED FOR.
4171 !=======================================================================
4173 SUBROUTINE POLY3B (A1, A2, A3, RTLW, RTHI, ROOT, ISLV)
4175 IMPLICIT DOUBLE PRECISION (A-H, O-Z)
4176 PARAMETER (ZERO=0.D0, EPS=1D-15, MAXIT=100, NDIV=5)
4178 FUNC(X) = X**3.d0 + A1*X**2.0 + A2*X + A3
4180 ! *** INITIAL VALUES FOR BISECTION *************************************
4184 IF (ABS(Y1).LE.EPS) THEN ! Is low a root?
4189 ! *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO ***********************
4191 DX = (RTHI-RTLW)/REAL(NDIV)
4195 IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2) .LT. ZERO) GOTO 20 ! (Y1*Y2.LT.ZERO)
4200 ! *** NO SUBDIVISION WITH SOLUTION FOUND
4202 IF (ABS(Y2) .LT. EPS) THEN ! X2 is a root
4210 ! *** BISECTION *******************************************************
4215 IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y3) .LE. ZERO) THEN ! (Y1*Y3 .LE. ZERO)
4222 IF (ABS(X2-X1) .LE. EPS*X1) GOTO 40
4225 ! *** CONVERGED ; RETURN ***********************************************
4234 ! *** END OF SUBROUTINE POLY3B *****************************************
4241 !cc DOUBLE PRECISION ROOT
4243 !cc CALL POLY3 (-1.d0, 1.d0, -1.d0, ROOT, ISLV)
4244 !cc IF (ISLV.NE.0) STOP 'Error in POLY3'
4245 !cc WRITE (*,*) 'Root=', ROOT
4247 !cc CALL POLY3B (-1.d0, 1.d0, -1.d0, -10.d0, 10.d0, ROOT, ISLV)
4248 !cc IF (ISLV.NE.0) STOP 'Error in POLY3B'
4249 !cc WRITE (*,*) 'Root=', ROOT
4252 !=======================================================================
4254 ! *** ISORROPIA CODE
4256 ! *** 10^X FUNCTION ; ALTERNATE OF LIBRARY ROUTINE ; USED BECAUSE IT IS
4257 ! MUCH FASTER BUT WITHOUT GREAT LOSS IN ACCURACY. ,
4258 ! MAXIMUM ERROR IS 2%, EXECUTION TIME IS 42% OF THE LIBRARY ROUTINE
4259 ! (ON A 80286/80287 MACHINE, using Lahey FORTRAN 77 v.3.0).
4261 ! EXPONENT RANGE IS BETWEEN -K AND K (K IS THE REAL ARGUMENT 'K')
4262 ! MAX VALUE FOR K: 9.999
4263 ! IF X < -K, X IS SET TO -K, IF X > K, X IS SET TO K
4265 ! THE EXPONENT IS CALCULATED BY THE PRODUCT ADEC*AINT, WHERE ADEC
4266 ! IS THE MANTISSA AND AINT IS THE MAGNITUDE (EXPONENT). BOTH
4267 ! MANTISSA AND MAGNITUDE ARE PRE-CALCULATED AND STORED IN LOOKUP
4268 ! TABLES ; THIS LEADS TO THE INCREASED SPEED.
4270 ! *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY,
4271 ! *** GEORGIA INSTITUTE OF TECHNOLOGY
4272 ! *** WRITTEN BY ATHANASIOS NENES
4273 ! *** UPDATED BY CHRISTOS FOUNTOUKIS
4275 !=======================================================================
4281 ! COMMON /EXPNC/ AINT10(20), ADEC10(200)
4283 ! *** LIMIT X TO [-K, K] RANGE *****************************************
4285 Y = MAX(-K, MIN(X,K)) ! MIN: -9.999, MAX: 9.999
4287 ! *** GET INTEGER AND DECIMAL PART *************************************
4290 K2 = INT(100*(Y-K1))
4292 ! *** CALCULATE EXP FUNCTION *******************************************
4294 EX10 = AINT10(K1+10)*ADEC10(K2+100)
4296 ! *** END OF EXP FUNCTION **********************************************
4302 !=======================================================================
4304 ! *** ISORROPIA CODE
4305 ! *** BLOCK DATA EXPON
4306 ! *** CONTAINS DATA FOR EXPONENT ARRAYS NEEDED IN FUNCTION EXP10
4308 ! *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY,
4309 ! *** GEORGIA INSTITUTE OF TECHNOLOGY
4310 ! *** WRITTEN BY ATHANASIOS NENES
4311 ! *** UPDATED BY CHRISTOS FOUNTOUKIS
4313 !=======================================================================
4317 ! *** Common block definition
4320 ! REAL AINT10, ADEC10
4321 ! COMMON /EXPNC/ AINT10(20), ADEC10(200)
4326 ! 0.1000E-08, 0.1000E-07, 0.1000E-06, 0.1000E-05, 0.1000E-04, &
4327 ! 0.1000E-03, 0.1000E-02, 0.1000E-01, 0.1000E+00, 0.1000E+01, &
4328 ! 0.1000E+02, 0.1000E+03, 0.1000E+04, 0.1000E+05, 0.1000E+06, &
4329 ! 0.1000E+07, 0.1000E+08, 0.1000E+09, 0.1000E+10, 0.1000E+11 &
4334 ! DATA (ADEC10(I),I=1,100)/ &
4335 ! 0.1023E+00, 0.1047E+00, 0.1072E+00, 0.1096E+00, 0.1122E+00, &
4336 ! 0.1148E+00, 0.1175E+00, 0.1202E+00, 0.1230E+00, 0.1259E+00, &
4337 ! 0.1288E+00, 0.1318E+00, 0.1349E+00, 0.1380E+00, 0.1413E+00, &
4338 ! 0.1445E+00, 0.1479E+00, 0.1514E+00, 0.1549E+00, 0.1585E+00, &
4339 ! 0.1622E+00, 0.1660E+00, 0.1698E+00, 0.1738E+00, 0.1778E+00, &
4340 ! 0.1820E+00, 0.1862E+00, 0.1905E+00, 0.1950E+00, 0.1995E+00, &
4341 ! 0.2042E+00, 0.2089E+00, 0.2138E+00, 0.2188E+00, 0.2239E+00, &
4342 ! 0.2291E+00, 0.2344E+00, 0.2399E+00, 0.2455E+00, 0.2512E+00, &
4343 ! 0.2570E+00, 0.2630E+00, 0.2692E+00, 0.2754E+00, 0.2818E+00, &
4344 ! 0.2884E+00, 0.2951E+00, 0.3020E+00, 0.3090E+00, 0.3162E+00, &
4345 ! 0.3236E+00, 0.3311E+00, 0.3388E+00, 0.3467E+00, 0.3548E+00, &
4346 ! 0.3631E+00, 0.3715E+00, 0.3802E+00, 0.3890E+00, 0.3981E+00, &
4347 ! 0.4074E+00, 0.4169E+00, 0.4266E+00, 0.4365E+00, 0.4467E+00, &
4348 ! 0.4571E+00, 0.4677E+00, 0.4786E+00, 0.4898E+00, 0.5012E+00, &
4349 ! 0.5129E+00, 0.5248E+00, 0.5370E+00, 0.5495E+00, 0.5623E+00, &
4350 ! 0.5754E+00, 0.5888E+00, 0.6026E+00, 0.6166E+00, 0.6310E+00, &
4351 ! 0.6457E+00, 0.6607E+00, 0.6761E+00, 0.6918E+00, 0.7079E+00, &
4352 ! 0.7244E+00, 0.7413E+00, 0.7586E+00, 0.7762E+00, 0.7943E+00, &
4353 ! 0.8128E+00, 0.8318E+00, 0.8511E+00, 0.8710E+00, 0.8913E+00, &
4354 ! 0.9120E+00, 0.9333E+00, 0.9550E+00, 0.9772E+00, 0.1000E+01/
4356 ! DATA (ADEC10(I),I=101,200)/ &
4357 ! 0.1023E+01, 0.1047E+01, 0.1072E+01, 0.1096E+01, 0.1122E+01, &
4358 ! 0.1148E+01, 0.1175E+01, 0.1202E+01, 0.1230E+01, 0.1259E+01, &
4359 ! 0.1288E+01, 0.1318E+01, 0.1349E+01, 0.1380E+01, 0.1413E+01, &
4360 ! 0.1445E+01, 0.1479E+01, 0.1514E+01, 0.1549E+01, 0.1585E+01, &
4361 ! 0.1622E+01, 0.1660E+01, 0.1698E+01, 0.1738E+01, 0.1778E+01, &
4362 ! 0.1820E+01, 0.1862E+01, 0.1905E+01, 0.1950E+01, 0.1995E+01, &
4363 ! 0.2042E+01, 0.2089E+01, 0.2138E+01, 0.2188E+01, 0.2239E+01, &
4364 ! 0.2291E+01, 0.2344E+01, 0.2399E+01, 0.2455E+01, 0.2512E+01, &
4365 ! 0.2570E+01, 0.2630E+01, 0.2692E+01, 0.2754E+01, 0.2818E+01, &
4366 ! 0.2884E+01, 0.2951E+01, 0.3020E+01, 0.3090E+01, 0.3162E+01, &
4367 ! 0.3236E+01, 0.3311E+01, 0.3388E+01, 0.3467E+01, 0.3548E+01, &
4368 ! 0.3631E+01, 0.3715E+01, 0.3802E+01, 0.3890E+01, 0.3981E+01, &
4369 ! 0.4074E+01, 0.4169E+01, 0.4266E+01, 0.4365E+01, 0.4467E+01, &
4370 ! 0.4571E+01, 0.4677E+01, 0.4786E+01, 0.4898E+01, 0.5012E+01, &
4371 ! 0.5129E+01, 0.5248E+01, 0.5370E+01, 0.5495E+01, 0.5623E+01, &
4372 ! 0.5754E+01, 0.5888E+01, 0.6026E+01, 0.6166E+01, 0.6310E+01, &
4373 ! 0.6457E+01, 0.6607E+01, 0.6761E+01, 0.6918E+01, 0.7079E+01, &
4374 ! 0.7244E+01, 0.7413E+01, 0.7586E+01, 0.7762E+01, 0.7943E+01, &
4375 ! 0.8128E+01, 0.8318E+01, 0.8511E+01, 0.8710E+01, 0.8913E+01, &
4376 ! 0.9120E+01, 0.9333E+01, 0.9550E+01, 0.9772E+01, 0.1000E+02 &
4379 ! *** END OF BLOCK DATA EXPON ******************************************
4382 !=======================================================================
4384 ! *** ISORROPIA CODE
4385 ! *** SUBROUTINE ISOPLUS
4386 ! *** THIS SUBROUTINE IS THE MASTER ROUTINE FOR THE ISORROPIA-PLUS
4387 ! THERMODYNAMIC EQUILIBRIUM AEROSOL MODEL (VERSION 1.0)
4389 ! *** NOTE: THIS SUBROUTINE IS INCLUDED FOR BACKWARD COMPATABILITY ONLY.
4390 ! A PROGRAMMER SHOULD USE THE MORE COMPLETE SUBROUTINE ISOROPIA INSTEAD
4392 ! ======================== ARGUMENTS / USAGE ===========================
4396 ! DOUBLE PRECISION array of length [5].
4397 ! Concentrations, expressed in moles/m3. Depending on the type of
4398 ! problem solved, WI contains either GAS+AEROSOL or AEROSOL only
4407 ! DOUBLE PRECISION variable.
4408 ! Ambient relative humidity expressed in a (0,1) scale.
4411 ! DOUBLE PRECISION variable.
4412 ! Ambient temperature expressed in Kelvins.
4416 ! The type of problem solved.
4417 ! IPROB = 0 - Forward problem is solved. In this case, array WI
4418 ! contains GAS and AEROSOL concentrations together.
4419 ! IPROB = 1 - Reverse problem is solved. In this case, array WI
4420 ! contains AEROSOL concentrations only.
4424 ! DOUBLE PRECISION array of length [03].
4425 ! Gaseous species concentrations, expressed in moles/m3.
4431 ! DOUBLE PRECISION array of length [11].
4432 ! Liquid aerosol species concentrations, expressed in moles/m3.
4433 ! AERLIQ(01) - H+(aq)
4434 ! AERLIQ(02) - Na+(aq)
4435 ! AERLIQ(03) - NH4+(aq)
4436 ! AERLIQ(04) - Cl-(aq)
4437 ! AERLIQ(05) - SO4--(aq)
4438 ! AERLIQ(06) - HSO4-(aq)
4439 ! AERLIQ(07) - NO3-(aq)
4441 ! AERLIQ(09) - NH3(aq) (undissociated)
4442 ! AERLIQ(10) - HNCl(aq) (undissociated)
4443 ! AERLIQ(11) - HNO3(aq) (undissociated)
4446 ! DOUBLE PRECISION array of length [09].
4447 ! Solid aerosol species concentrations, expressed in moles/m3.
4448 ! AERSLD(01) - NaNO3(s)
4449 ! AERSLD(02) - NH4NO3(s)
4450 ! AERSLD(03) - NaCl(s)
4451 ! AERSLD(04) - NH4Cl(s)
4452 ! AERSLD(05) - Na2SO4(s)
4453 ! AERSLD(06) - (NH4)2SO4(s)
4454 ! AERSLD(07) - NaHSO4(s)
4455 ! AERSLD(08) - NH4HSO4(s)
4456 ! AERSLD(09) - (NH4)4H(SO4)2(s)
4460 ! Contains information about the physical state of the system.
4461 ! .TRUE. - There is no aqueous phase present
4462 ! .FALSE.- There is an aqueous phase present
4464 ! *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY,
4465 ! *** GEORGIA INSTITUTE OF TECHNOLOGY
4466 ! *** WRITTEN BY ATHANASIOS NENES
4467 ! *** UPDATED BY CHRISTOS FOUNTOUKIS
4469 !=======================================================================
4471 SUBROUTINE ISOPLUS (WI, RHI, TEMPI, IPROBI, &
4472 GAS, AERLIQ, AERSLD, DRYI )
4474 IMPLICIT DOUBLE PRECISION (A-H, O-Z)
4475 ! INCLUDE 'ISRPIA.INC'
4476 DIMENSION WI(NCOMP), GAS(NGASAQ), AERLIQ(NIONS+NGASAQ+1), &
4480 ! *** PROBLEM TYPE (0=FOREWARD, 1=REVERSE) ******************************
4484 ! *** SOLVE FOREWARD PROBLEM ********************************************
4486 IF (IPROB.EQ.0) THEN
4487 IF (WI(1)+WI(2)+WI(3)+WI(4)+WI(5) .LE. TINY) THEN ! Everything=0
4488 CALL INIT1 (WI, RHI, TEMPI)
4489 ELSE IF (WI(1)+WI(4)+WI(5) .LE. TINY) THEN ! Na,Cl,NO3=0
4490 CALL ISRP1F (WI, RHI, TEMPI)
4491 ELSE IF (WI(1)+WI(5) .LE. TINY) THEN ! Na,Cl=0
4492 CALL ISRP2F (WI, RHI, TEMPI)
4494 CALL ISRP3F (WI, RHI, TEMPI)
4497 ! *** SOLVE REVERSE PROBLEM *********************************************
4500 IF (WI(1)+WI(2)+WI(3)+WI(4)+WI(5) .LE. TINY) THEN ! Everything=0
4501 CALL INIT1 (WI, RHI, TEMPI)
4502 ELSE IF (WI(1)+WI(4)+WI(5) .LE. TINY) THEN ! Na,Cl,NO3=0
4503 CALL ISRP1R (WI, RHI, TEMPI)
4504 ELSE IF (WI(1)+WI(5) .LE. TINY) THEN ! Na,Cl=0
4505 CALL ISRP2R (WI, RHI, TEMPI)
4507 CALL ISRP3R (WI, RHI, TEMPI)
4511 ! *** SAVE RESULTS TO ARRAYS (units = mole/m3, kg/m3 for water) *********
4518 AERLIQ(I) = MOLAL(I)
4520 AERLIQ(NIONS+1) = WATER*1.0D3/18.0D0
4522 AERLIQ(NIONS+1+I) = GASAQ(I)
4535 DRYI = WATER.LE.TINY
4539 ! *** END OF SUBROUTINE ISOPLUS ******************************************
4546 !=======================================================================
4548 ! *** ISORROPIA CODE
4549 ! *** SUBROUTINE ISRPIA
4550 ! *** THIS SUBROUTINE IS THE MASTER ROUTINE FOR THE ISORROPIA-PLUS
4551 ! THERMODYNAMIC EQUILIBRIUM AEROSOL MODEL (VERSIONS 0.x)
4553 ! *** NOTE: THIS SUBROUTINE IS INCLUDED FOR BACKWARD COMPATABILITY ONLY.
4554 ! A PROGRAMMER SHOULD USE THE MORE COMPLETE SUBROUTINE ISOROPIA INSTEAD
4557 ! DEPENDING ON THE INPUT VALUES PROVIDED, THE FOLLOWING MODEL
4558 ! SUBVERSIONS ARE CALLED:
4560 ! FOREWARD PROBLEM (IPROB=0):
4561 ! Na SO4 NH4 NO3 CL SUBROUTINE CALLED
4562 ! ---- ---- ---- ---- ---- -----------------
4563 ! 0.0 >0.0 >0.0 0.0 0.0 SUBROUTINE ISRP1F
4564 ! 0.0 >0.0 >0.0 >0.0 0.0 SUBROUTINE ISRP2F
4565 ! >0.0 >0.0 >0.0 >0.0 >0.0 SUBROUTINE ISRP3F
4567 ! REVERSE PROBLEM (IPROB=1):
4568 ! Na SO4 NH4 NO3 CL SUBROUTINE CALLED
4569 ! ---- ---- ---- ---- ---- -----------------
4570 ! 0.0 >0.0 >0.0 0.0 0.0 SUBROUTINE ISRP1R
4571 ! 0.0 >0.0 >0.0 >0.0 0.0 SUBROUTINE ISRP2R
4572 ! >0.0 >0.0 >0.0 >0.0 >0.0 SUBROUTINE ISRP3R
4574 ! *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY,
4575 ! *** GEORGIA INSTITUTE OF TECHNOLOGY
4576 ! *** WRITTEN BY ATHANASIOS NENES
4577 ! *** UPDATED BY CHRISTOS FOUNTOUKIS
4579 !=======================================================================
4581 ! SUBROUTINE ISRPIA (WI, RHI, TEMPI, IPROBI)
4582 SUBROUTINE ISRPIAA (WI, RHI, TEMPI, IPROBI)
4584 IMPLICIT DOUBLE PRECISION (A-H, O-Z)
4585 ! INCLUDE 'ISRPIA.INC'
4588 ! *** PROBLEM TYPE (0=FOREWARD, 1=REVERSE) ******************************
4592 ! *** SOLVE FOREWARD PROBLEM ********************************************
4594 IF (IPROB.EQ.0) THEN
4595 IF (WI(1)+WI(2)+WI(3)+WI(4)+WI(5) .LE. TINY) THEN ! Everything=0
4596 CALL INIT1 (WI, RHI, TEMPI)
4597 ELSE IF (WI(1)+WI(4)+WI(5) .LE. TINY) THEN ! Na,Cl,NO3=0
4598 CALL ISRP1F (WI, RHI, TEMPI)
4599 ELSE IF (WI(1)+WI(5) .LE. TINY) THEN ! Na,Cl=0
4600 CALL ISRP2F (WI, RHI, TEMPI)
4602 CALL ISRP3F (WI, RHI, TEMPI)
4605 ! *** SOLVE REVERSE PROBLEM *********************************************
4608 IF (WI(1)+WI(2)+WI(3)+WI(4)+WI(5) .LE. TINY) THEN ! Everything=0
4609 CALL INIT1 (WI, RHI, TEMPI)
4610 ELSE IF (WI(1)+WI(4)+WI(5) .LE. TINY) THEN ! Na,Cl,NO3=0
4611 CALL ISRP1R (WI, RHI, TEMPI)
4612 ELSE IF (WI(1)+WI(5) .LE. TINY) THEN ! Na,Cl=0
4613 CALL ISRP2R (WI, RHI, TEMPI)
4615 CALL ISRP3R (WI, RHI, TEMPI)
4619 ! *** SETUP 'DRY' FLAG ***************************************************
4621 DRYF = WATER.LE.TINY
4623 ! *** FIND TOTALS *******************************************************
4625 IF (IPROB.EQ.0) THEN
4643 ! *** END OF SUBROUTINE ISRPIA *******************************************
4646 !=======================================================================
4648 ! *** ISORROPIA CODE
4649 ! *** SUBROUTINE PUSHERR
4650 ! *** THIS SUBROUTINE SAVES AN ERROR MESSAGE IN THE ERROR STACK
4652 ! *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY,
4653 ! *** GEORGIA INSTITUTE OF TECHNOLOGY
4654 ! *** WRITTEN BY ATHANASIOS NENES
4655 ! *** UPDATED BY CHRISTOS FOUNTOUKIS
4657 !=======================================================================
4659 SUBROUTINE PUSHERR (IERR,ERRINF)
4661 IMPLICIT DOUBLE PRECISION (A-H, O-Z)
4662 ! INCLUDE 'ISRPIA.INC'
4663 CHARACTER ERRINF*(*)
4665 ! *** SAVE ERROR CODE IF THERE IS ANY SPACE ***************************
4667 IF (NOFER.LT.NERRMX) THEN
4669 ERRSTK(NOFER) = IERR
4670 ERRMSG(NOFER) = ERRINF
4673 STKOFL =.TRUE. ! STACK OVERFLOW
4676 ! *** END OF SUBROUTINE PUSHERR ****************************************
4682 !=======================================================================
4684 ! *** ISORROPIA CODE
4685 ! *** SUBROUTINE ISERRINF
4686 ! *** THIS SUBROUTINE OBTAINS A COPY OF THE ERROR STACK (& MESSAGES)
4688 ! *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY,
4689 ! *** GEORGIA INSTITUTE OF TECHNOLOGY
4690 ! *** WRITTEN BY ATHANASIOS NENES
4691 ! *** UPDATED BY CHRISTOS FOUNTOUKIS
4693 !=======================================================================
4695 SUBROUTINE ISERRINF (ERRSTKI, ERRMSGI, NOFERI, STKOFLI)
4697 IMPLICIT DOUBLE PRECISION (A-H, O-Z)
4698 ! INCLUDE 'ISRPIA.INC'
4699 CHARACTER ERRMSGI*40
4702 DIMENSION ERRMSGI(NERRMX), ERRSTKI(NERRMX)
4704 ! *** OBTAIN WHOLE ERROR STACK ****************************************
4706 DO 10 I=1,NOFER ! Error messages & codes
4707 ERRSTKI(I) = ERRSTK(I)
4708 ERRMSGI(I) = ERRMSG(I)
4716 ! *** END OF SUBROUTINE ISERRINF ***************************************
4722 !=======================================================================
4724 ! *** ISORROPIA CODE
4725 ! *** SUBROUTINE ERRSTAT
4726 ! *** THIS SUBROUTINE REPORTS ERROR MESSAGES TO UNIT 'IO'
4728 ! *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY,
4729 ! *** GEORGIA INSTITUTE OF TECHNOLOGY
4730 ! *** WRITTEN BY ATHANASIOS NENES
4731 ! *** UPDATED BY CHRISTOS FOUNTOUKIS
4733 !=======================================================================
4735 SUBROUTINE ERRSTAT (IO,IERR,ERRINF)
4737 IMPLICIT DOUBLE PRECISION (A-H, O-Z)
4738 ! INCLUDE 'ISRPIA.INC'
4739 CHARACTER CER*4, NCIS*29, NCIF*27, NSIS*26, NSIF*24, ERRINF*(*)
4740 DATA NCIS /'NO CONVERGENCE IN SUBROUTINE '/, &
4741 NCIF /'NO CONVERGENCE IN FUNCTION ' /, &
4742 NSIS /'NO SOLUTION IN SUBROUTINE ' /, &
4743 NSIF /'NO SOLUTION IN FUNCTION ' /
4745 ! *** WRITE ERROR IN CHARACTER *****************************************
4747 WRITE (CER,'(I4)') IERR
4748 CALL RPLSTR (CER, ' ', '0',IOK) ! REPLACE BLANKS WITH ZEROS
4749 CALL CHRBLN (ERRINF, IEND) ! LAST POSITION OF ERRINF CHAR
4751 ! *** WRITE ERROR TYPE (FATAL, WARNING ) *******************************
4754 WRITE (IO,1000) 'NO ERRORS DETECTED '
4757 ELSE IF (IERR.LT.0) THEN
4758 WRITE (IO,1000) 'ERROR STACK EXHAUSTED '
4761 ELSE IF (IERR.GT.1000) THEN
4762 WRITE (IO,1100) 'FATAL',CER
4765 WRITE (IO,1100) 'WARNING',CER
4768 ! *** WRITE ERROR MESSAGE **********************************************
4772 IF (IERR.EQ.1001) THEN
4773 CALL CHRBLN (SCASE, IEND)
4774 WRITE (IO,1000) 'CASE NOT SUPPORTED IN CALCMR ['//SCASE(1:IEND) &
4777 ELSEIF (IERR.EQ.1002) THEN
4778 CALL CHRBLN (SCASE, IEND)
4779 WRITE (IO,1000) 'CASE NOT SUPPORTED ['//SCASE(1:IEND)//']'
4783 ELSEIF (IERR.EQ.0001) THEN
4784 WRITE (IO,1000) NSIS,ERRINF
4786 ELSEIF (IERR.EQ.0002) THEN
4787 WRITE (IO,1000) NCIS,ERRINF
4789 ELSEIF (IERR.EQ.0003) THEN
4790 WRITE (IO,1000) NSIF,ERRINF
4792 ELSEIF (IERR.EQ.0004) THEN
4793 WRITE (IO,1000) NCIF,ERRINF
4795 ELSE IF (IERR.EQ.0019) THEN
4796 WRITE (IO,1000) 'HNO3(aq) AFFECTS H+, WHICH '// &
4797 'MIGHT AFFECT SO4/HSO4 RATIO'
4798 WRITE (IO,1000) 'DIRECT INCREASE IN H+ [',ERRINF(1:IEND),'] %'
4800 ELSE IF (IERR.EQ.0020) THEN
4801 IF (W(4).GT.TINY .AND. W(5).GT.TINY) THEN
4802 WRITE (IO,1000) 'HSO4-SO4 EQUILIBRIUM MIGHT AFFECT HNO3,' &
4805 WRITE (IO,1000) 'HSO4-SO4 EQUILIBRIUM MIGHT AFFECT NH3 ' &
4808 WRITE (IO,1000) 'DIRECT DECREASE IN H+ [',ERRINF(1:IEND),'] %'
4810 ELSE IF (IERR.EQ.0021) THEN
4811 WRITE (IO,1000) 'HNO3(aq),HCL(aq) AFFECT H+, WHICH '// &
4812 'MIGHT AFFECT SO4/HSO4 RATIO'
4813 WRITE (IO,1000) 'DIRECT INCREASE IN H+ [',ERRINF(1:IEND),'] %'
4815 ELSE IF (IERR.EQ.0022) THEN
4816 WRITE (IO,1000) 'HCL(g) EQUILIBRIUM YIELDS NONPHYSICAL '// &
4818 WRITE (IO,1000) 'A TINY AMOUNT [',ERRINF(1:IEND),'] IS '// &
4819 'ASSUMED TO BE DISSOLVED'
4821 ELSEIF (IERR.EQ.0033) THEN
4822 WRITE (IO,1000) 'HCL(aq) AFFECTS H+, WHICH '// &
4823 'MIGHT AFFECT SO4/HSO4 RATIO'
4824 WRITE (IO,1000) 'DIRECT INCREASE IN H+ [',ERRINF(1:IEND),'] %'
4826 ELSEIF (IERR.EQ.0050) THEN
4827 WRITE (IO,1000) 'TOO MUCH SODIUM GIVEN AS INPUT.'
4828 WRITE (IO,1000) 'REDUCED TO COMPLETELY NEUTRALIZE SO4,Cl,NO3.'
4829 WRITE (IO,1000) 'EXCESS SODIUM IS IGNORED.'
4832 WRITE (IO,1000) 'NO DIAGNOSTIC MESSAGE AVAILABLE'
4837 ! *** FORMAT STATEMENTS *************************************
4839 1000 FORMAT (1X,A:A:A:A:A)
4840 1100 FORMAT (1X,A,' ERROR [',A4,']:')
4842 ! *** END OF SUBROUTINE ERRSTAT *****************************
4845 !=======================================================================
4847 ! *** ISORROPIA CODE
4848 ! *** SUBROUTINE ISORINF
4849 ! *** THIS SUBROUTINE PROVIDES INFORMATION ABOUT ISORROPIA
4851 ! ======================== ARGUMENTS / USAGE ===========================
4855 ! CHARACTER*15 variable.
4856 ! Contains version-date information of ISORROPIA
4860 ! The number of components needed in input array WI
4861 ! (or, the number of major species accounted for by ISORROPIA)
4865 ! The number of ions considered in the aqueous phase
4869 ! The number of undissociated species found in aqueous aerosol
4874 ! The number of solids considered in the solid aerosol phase
4878 ! The size of the error stack (maximum number of errors that can
4879 ! be stored before the stack exhausts).
4882 ! DOUBLE PRECISION variable
4883 ! The value used for a very small number.
4886 ! DOUBLE PRECISION variable
4887 ! The value used for a very large number.
4889 ! *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY,
4890 ! *** GEORGIA INSTITUTE OF TECHNOLOGY
4891 ! *** WRITTEN BY ATHANASIOS NENES
4892 ! *** UPDATED BY CHRISTOS FOUNTOUKIS
4894 !=======================================================================
4896 SUBROUTINE ISORINF (VERSI, NCMP, NION, NAQGAS, NSOL, NERR, TIN, &
4899 IMPLICIT DOUBLE PRECISION (A-H, O-Z)
4900 ! INCLUDE 'ISRPIA.INC'
4903 ! *** ASSIGN INFO *******************************************************
4916 ! *** END OF SUBROUTINE ISORINF *******************************************