-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfullchem_SulfurChemFuncs.F90
3824 lines (3428 loc) · 137 KB
/
fullchem_SulfurChemFuncs.F90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
!------------------------------------------------------------------------------
! GEOS-Chem Global Chemical Transport Model !
!------------------------------------------------------------------------------
!BOP
!
! !MODULE: fullchem_SulfurChemFuncs
!
! !DESCRIPTION: FlexChem module for multiphase sulfate chemistry, via KPP.
!\\
!\\
! !INTERFACE:
MODULE fullchem_SulfurChemFuncs
!
! !USES:
!
USE PhysConstants
USE Precision_Mod
IMPLICIT NONE
PRIVATE
!
! !PUBLIC MEMBER FUNCTIONS:
!
PUBLIC :: fullchem_ConvertAlkToEquiv
PUBLIC :: fullchem_ConvertEquivToAlk
PUBLIC :: fullchem_HetDropChem
PUBLIC :: fullchem_InitSulfurChem
PUBLIC :: fullchem_SulfurAqChem
PUBLIC :: fullchem_SulfurCldChem
!
! !PUBLIC TYPES:
!
! Species ID flags
INTEGER :: id_ACTA, id_CH2O, id_DMS, id_DST1
INTEGER :: id_DST2, id_DST3, id_DST4, id_H2O2
INTEGER :: id_HCL, id_HCOOH, id_HMS, id_HNO3
INTEGER :: id_MSA, id_NH3, id_NH4, id_NIT
INTEGER :: id_NITs, id_O3, id_OH, id_pFe
INTEGER :: id_SALA, id_SALAAL, id_SALACL, id_SALC
INTEGER :: id_SALCAL, id_SALCCL, id_SO2, id_SO4
INTEGER :: id_SO4s
!
! !DEFINED_PARAMETERS
!
REAL(fp), PARAMETER :: TCVV_S = AIRMW / 32e+0_fp ! hard-coded MW
REAL(fp), PARAMETER :: TCVV_N = AIRMW / 14e+0_fp ! hard-coded MW
REAL(fp), PARAMETER :: SMALLNUM = 1e-20_fp
REAL(fp), PARAMETER :: CM3PERM3 = 1.e6_fp
CONTAINS
!EOC
!------------------------------------------------------------------------------
! GEOS-Chem Global Chemical Transport Model !
!------------------------------------------------------------------------------
!BOP
!
! !IROUTINE: fullchem_ConvertAlkToEquiv
!
! !DESCRIPTION: Converts sea salt alkalinity to equivalents. Abstracted
! out from fullchem_mod.F90 to prevent compilation conflicts for other
! KPP chemical mechanisms
!\\
!\\
! !INTERFACE:
!
SUBROUTINE fullchem_ConvertAlkToEquiv()
!
! !USES:
!
USE gckpp_Global, ONLY : C, MW
USE gckpp_Parameters, ONLY : ind_SALAAL, ind_SALCAL
!EOP
!------------------------------------------------------------------------------
!BOC
C(ind_SALAAL) = C(ind_SALAAL) * ( MW(ind_SALAAL) * 7.0e-5_fp )
C(ind_SALCAL) = C(ind_SALCAL) * ( MW(ind_SALCAL) * 7.0e-5_fp )
END SUBROUTINE fullchem_ConvertAlkToEquiv
!EOC
!------------------------------------------------------------------------------
! GEOS-Chem Global Chemical Transport Model !
!------------------------------------------------------------------------------
!BOP
!
! !IROUTINE: fullchem_ConvertEquivToAlk
!
! !DESCRIPTION: Converts sea salt alkalinity to equivalents. Abstracted
! out from fullchem_mod.F90 to prevent compilation conflicts for other
! KPP chemical mechanisms
!\\
!\\
! !INTERFACE:
!
SUBROUTINE fullchem_ConvertEquivToAlk()
!
! !USES:
!
USE gckpp_Global, ONLY : C, MW
USE gckpp_Parameters, ONLY : ind_SALAAL, ind_SALCAL
!EOP
!------------------------------------------------------------------------------
!BOC
C(ind_SALAAL) = C(ind_SALAAL) / ( MW(ind_SALAAL) * 7.0e-5_fp )
C(ind_SALCAL) = C(ind_SALCAL) / ( MW(ind_SALCAL) * 7.0e-5_fp )
END SUBROUTINE fullchem_ConvertEquivToAlk
!EOC
!------------------------------------------------------------------------------
! GEOS-Chem Global Chemical Transport Model !
!------------------------------------------------------------------------------
!BOP
!
! !IROUTINE: fullchem_SulfurAqchem
!
! !DESCRIPTION: Main aqueous/aerosol chemistry driver routine. Sets up the
! vector of aqueous chemistry rates for the KPP chemistry solver.
!\\
!\\
! !INTERFACE:
!
SUBROUTINE fullchem_SulfurAqChem( I, J, L, &
Input_Opt, State_Chm, State_Grid, &
State_Met, RC )
!
! !USES:
!
USE ErrCode_Mod
USE gckpp_Global
USE gckpp_Parameters
USE Input_Opt_Mod, ONLY : OptInput
USE rateLawUtilFuncs
USE State_Chm_Mod, ONLY : ChmState
USE State_Met_Mod, ONLY : MetState
USE State_Grid_Mod, ONLY : GrdState
!
! !INPUT PARAMETERS:
!
INTEGER, INTENT(IN) :: I, J, L ! Lon, lat, level indices
TYPE(MetState), INTENT(IN) :: State_Met ! Meteorology State object
TYPE(GrdState), INTENT(IN) :: State_Grid ! Grid State object
TYPE(OptInput), INTENT(IN) :: Input_Opt ! Input Options object
!
! !INPUT/OUTPUT PARAMETERS:
!
TYPE(ChmState), INTENT(IN) :: State_Chm ! Chemistry State object
!
! OUTPUT PARAMETERS:
!
INTEGER, INTENT(OUT) :: RC ! Success or failure
!
! !REMARKS:
!
! ! Reaction List (by K_MT() index)
! 1) SO2 + O3 + 2SALAAL --> SO4mm + O2 : From Sulfate_mod - 24 Mar 2021
!
! !REVISION HISTORY:
! 24 Mar 2021 - M. Long - Initial Version
! See https://github.com/geoschem/geos-chem for complete history
!EOP
!------------------------------------------------------------------------------
!BOC
!
! !LOCAL VARIABLES:
! Scalars
LOGICAL :: SALAAL_gt_0_1
LOGICAL :: SALCAL_gt_0_1
LOGICAL :: O3_gt_1e10
REAL(fp) :: k_ex
! Strings
CHARACTER(LEN=255) :: ErrMsg
CHARACTER(LEN=255) :: ThisLoc
!======================================================================
! fullchem_SulfurAqChem begins here!
!======================================================================
! Initialize
RC = GC_SUCCESS
k_ex = 0.0_dp
K_MT = 0.0_dp
!----------------------------------------------------------------------
! In order to prevent div-by-zero errors, we set thresholds
! to skip the SALAAL + SO2 and SALCAL + SO2 reactions if:
!
! (1) SALAAL <= 0.1 molec/cm3
! (2) SALCAL <= 0.1 molec/cm3
! (3) O3 <= 1e10 molec/cm3
!
! An ozone concentration of 1e10 molec/cm3 ~= 0.5 ppbv, which is
! lower than ozone should ever get (according to D. Jacob).
!----------------------------------------------------------------------
SALAAL_gt_0_1 = ( C(ind_SALAAL) > 0.1_dp )
SALCAL_gt_0_1 = ( C(ind_SALCAL) > 0.1_dp )
O3_gt_1e10 = ( C(ind_O3) > 1.0e+10_dp )
!======================================================================
! Reaction rates [1/s] for fine sea salt alkalinity (aka SALAAL)
!
! K_MT(1) : SALAAL + SO2 + O3 = SO4 - SALAAL
! K_MT(2) : SALAAL + HCl = SALACL
! K_MT(3) : SALAAL + HNO3 = NIT
!======================================================================
!------------------------------------------------------------------------
! SALAAL + SO2 + O3 = SO4 - SALAAL
!------------------------------------------------------------------------
IF ( SALAAL_gt_0_1 .AND. O3_gt_1e10 ) THEN
! 1st order uptake
k_ex = Ars_L1K( area = State_Chm%WetAeroArea(I,J,L,11), &
radius = State_Chm%AeroRadi(I,J,L,11), &
gamma = 0.11_dp, &
srMw = SR_MW(ind_SO2) )
! Assume SO2 is limiting, so recompute rxn rate accordingly
K_MT(1) = kIIR1Ltd( C(ind_SO2), C(ind_SALAAL), k_ex ) / C(ind_O3)
ENDIF
!------------------------------------------------------------------------
! SALAAL + HCL = SALACL
!------------------------------------------------------------------------
IF ( SALAAL_gt_0_1 ) THEN
! 1st order uptake
k_ex = Ars_L1K( area = State_Chm%WetAeroArea(I,J,L,11), &
radius = State_Chm%AeroRadi(I,J,L,11), &
gamma = 0.07_dp, &
srMw = SR_MW(ind_HCl) )
! Assume HCl is limiting, so recompute reaction rate accordingly
K_MT(2) = kIIR1Ltd( C(ind_HCl), C(ind_SALAAL), k_ex )
ENDIF
!------------------------------------------------------------------------
! SALAAL + HNO3 = NIT
!------------------------------------------------------------------------
IF ( SALAAL_gt_0_1 ) THEN
! 1st order uptake
k_ex = Ars_L1K( area = State_Chm%WetAeroArea(I,J,L,11), &
radius = State_Chm%AeroRadi(I,J,L,11), &
gamma = 0.5_dp, &
srMw = SR_MW(ind_HNO3) )
! Assume HNO3 is limiting, so recompute reaction rate accordingly
K_MT(3) = kIIR1Ltd( C(ind_HNO3), C(ind_SALAAL), k_ex )
ENDIF
!========================================================================
! Reaction rates [1/s] for coarse sea salt alkalinity (aka SALAAL)
!
! K_MT(4) : SALCAL + SO2 + O3 = SO4s - SALCAL
! K_MT(5) : SALCAL + HCl = SALCCL
! K_MT(6) : SALCAL + HNO3 = NITs
!========================================================================
!------------------------------------------------------------------------
! SALCAL + SO2 + O3 = SO4s - SALCAL
!------------------------------------------------------------------------
IF ( SALCAL_gt_0_1 .AND. O3_gt_1e10 ) THEN
! 1st order uptake
k_ex = Ars_L1K( area = State_Chm%WetAeroArea(I,J,L,12), &
radius = State_Chm%AeroRadi(I,J,L,12), &
gamma = 0.11_dp, &
srMw = SR_MW(ind_SO2) )
! Assume SO2 is limiting, so recompute rxn rate accordingly
K_MT(4) = kIIR1Ltd( C(ind_SO2), C(ind_SALCAL), k_ex ) / C(ind_O3)
ENDIF
!------------------------------------------------------------------------
! SALCAL + HCl = SALCCL
!------------------------------------------------------------------------
IF ( SALCAL_gt_0_1 ) THEN
! 1st order uptake
k_ex = Ars_L1K( area = State_Chm%WetAeroArea(I,J,L,12), &
radius = State_Chm%AeroRadi(I,J,L,12), &
gamma = 0.07_dp, &
srMw = SR_MW(ind_HCl) )
! Assume HCl is limiting, so recompute rxn rate accordingly
K_MT(5) = kIIR1Ltd( C(ind_HCl), C(ind_SALCAL), k_ex )
ENDIF
!------------------------------------------------------------------------
! SALCAL + HNO3 = NITs
!------------------------------------------------------------------------
IF ( SALCAL_gt_0_1 ) THEN
! 1st order uptake
k_ex = Ars_L1K( area = State_Chm%WetAeroArea(I,J,L,12), &
radius = State_Chm%AeroRadi(I,J,L,12), &
gamma = 0.5_dp, &
srMw = SR_MW(ind_HNO3) )
! Assume HNO3 is limiting, so recompute rxn rate accordingly
K_MT(6) = kIIR1Ltd( C(ind_HNO3), C(ind_SALCAL), k_ex )
ENDIF
END SUBROUTINE fullchem_SulfurAqChem
!EOC
!------------------------------------------------------------------------------
! GEOS-Chem Global Chemical Transport Model !
!------------------------------------------------------------------------------
!BOP
!
! !IROUTINE: fullchem_SulfurCldChem
!
! !DESCRIPTION: Routine that compute reaction rates for sulfur chemistry
! in cloud, so that these can be passed to the KPP chemical solver.
!\\
!\\
! !INTERFACE:
!
SUBROUTINE fullchem_SulfurCldChem( I, J, L, &
Input_Opt, State_Chm, State_Diag, &
State_Grid, State_Met, size_res, &
RC )
!
! !USES:
!
USE ErrCode_Mod
USE Input_Opt_Mod, ONLY : OptInput
USE State_Chm_Mod, ONLY : ChmState
USE State_Chm_Mod, ONLY : Ind_
USE State_Diag_Mod, ONLY : DgnState
USE State_Grid_Mod, ONLY : GrdState
USE State_Met_Mod, ONLY : MetState
!
! !INPUT PARAMETERS:
!
TYPE(OptInput), INTENT(IN) :: Input_Opt ! Input Options object
TYPE(GrdState), INTENT(IN) :: State_Grid ! Grid State object
TYPE(MetState), INTENT(IN) :: State_Met ! Meteorology State object
INTEGER, INTENT(IN) :: I, J, L
!
! !INPUT/OUTPUT PARAMETERS:
!
TYPE(ChmState), INTENT(INOUT) :: State_Chm ! Chemistry State object
TYPE(DgnState), INTENT(INOUT) :: State_Diag ! Diagnostics State object
!
! !OUTPUT PARAMETERS:
!
LOGICAL, INTENT(OUT) :: size_res ! Should we call HetDropChem?
INTEGER, INTENT(OUT) :: RC ! Success or failure?
!
! !REVISION HISTORY:
! See https://github.com/geoschem/geos-chem for complete history
!EOP
!------------------------------------------------------------------------------
!BOC
!
! !LOCAL VARIABLES:
!
INTEGER :: N
CHARACTER(LEN=63) :: OrigUnit
! Strings
CHARACTER(LEN=255) :: ErrMsg, ThisLoc
!========================================================================
! fullchem_SulfurCldChem begins here!
!========================================================================
! Initialize
RC = GC_SUCCESS
size_res = .FALSE.
ErrMsg = ''
ThisLoc = &
' -> at fullchem_SulfurCldChem (in KPP/fullchem/fullchem_SulfurChemFuncs.F90'
!------------------------------------------------------------------------
! SO2 chemistry
!------------------------------------------------------------------------
CALL Set_SO2( I = I, &
J = J, &
L = L, &
Input_Opt = Input_Opt, &
State_Chm = State_Chm, &
State_Diag = State_Diag, &
State_Grid = State_Grid, &
State_Met = State_Met, &
size_res = size_res, &
RC = RC )
! Trap potential errors
IF ( RC /= GC_SUCCESS ) THEN
ErrMsg = 'Error encountered in "SET_SO2"!'
CALL GC_Error( ErrMsg, RC, ThisLoc )
RETURN
ENDIF
END SUBROUTINE fullchem_SulfurCldChem
!EOC
!------------------------------------------------------------------------------
! GEOS-Chem Global Chemical Transport Model !
!------------------------------------------------------------------------------
!BOP
!
! !IROUTINE: fullchem_HetDropChem
!
! !DESCRIPTION: Subroutine HET\_DROP\_CHEM estimates the in-cloud sulfate
! production rate in heterogeneous cloud droplets based on the Yuen et al.,
! 1996 parameterization. (bec, 6/16/11)
!\\
!\\
! !INTERFACE:
!
SUBROUTINE fullchem_HetDropChem( I, J, L, &
Input_Opt, State_Met, State_Chm )
!
! !USES:
!
USE fullchem_RateLawFuncs, ONLY : HOBrUptkByHSO3m, HOBrUptkBySO3mm
USE fullchem_RateLawFuncs, ONLY : HOClUptkByHSO3m, HOClUptkBySO3mm
USE gckpp_Global
USE gckpp_Parameters
USE gckpp_Precision
USE Input_Opt_Mod, ONLY : OptInput
USE PhysConstants, ONLY : AIRMW, AVO, PI, g0
USE rateLawUtilFuncs
USE State_Chm_Mod, ONLY : ChmState, IND_
USE State_Met_Mod, ONLY : MetState
USE Time_Mod, ONLY : Get_Ts_Chem
!
! !INPUT PARAMETERS:
!
INTEGER, INTENT(IN) :: I, J, L
TYPE(OptInput), INTENT(IN) :: Input_Opt ! Input Options object
TYPE(MetState), INTENT(IN) :: State_Met ! Meteorology State object
!
! !INPUT/OUTPUT PARAMETERS:
!
TYPE(ChmState), INTENT(INOUT) :: State_Chm ! Chemistry State object
!
! !REVISION HISTORY:
! See https://github.com/geoschem/geos-chem for complete history
!EOP
!------------------------------------------------------------------------------
!BOC
!
! !DEFINED PARAMETERS:
!
! Dry sea-salt density [kg/m3]
REAL(dp), PARAMETER :: SS_DEN = 2200.0_dp
! sigma of the size distribution for sea-salt (Jaegle et al., 2011)
REAL(fp), PARAMETER :: SIG_S = 1.8e+0_dp
! geometric dry mean diameters [m] for computing lognormal size distribution
REAL(dp), PARAMETER :: RG_S = 0.4e-6_dp !(Jaegle et a., 2011)
REAL(dp), PARAMETER :: RG_D2 = 1.5e-6_dp !(Ginoux et al., 2001)
REAL(dp), PARAMETER :: RG_D3 = 2.5e-6_dp
REAL(dp), PARAMETER :: RG_D4 = 4.e-6_dp
! To prevent multiple divisions
REAL(dp), PARAMETER :: THREE_FOURTHS = 3.0_dp / 4.0_dp
REAL(dp), PARAMETER :: NINE_HALVES = 9.0_dp / 2.0_dp
!
! !LOCAL VARIABLES:
!
REAL(dp) :: alpha_NH3, alpha_SO2, alpha_H2O2
REAL(dp) :: alpha_HNO3, alpha_B, alpha_CN
REAL(dp) :: alpha_W, alpha_SO4, sum_gas
REAL(dp) :: H, NDss, CN
REAL(dp) :: W, K, arg
REAL(dp) :: DTCHEM, APV, DSVI
REAL(dp) :: B, NH3, SO2
REAL(dp) :: H2O2, HNO3, SO4
REAL(dp) :: CNss, MW_SO4, MW_SALC
REAL(dp) :: CVF, R1, R2
REAL(dp) :: XX, FC, LST
REAL(dp) :: XX1, XX2, XX3
REAL(dp) :: XX4, XX5, GNH3
REAL(dp) :: SR, DENOM
! Pointers
REAL(fp), POINTER :: AD(:,:,:)
REAL(fp), POINTER :: AIRDEN(:,:,:)
REAL(fp), POINTER :: AIRVOL(:,:,:)
REAL(fp), POINTER :: OMEGA(:,:,:)
REAL(fp), POINTER :: U(:,:,:)
REAL(fp), POINTER :: V(:,:,:)
!=================================================================
! HET_DROP_CHEM begins here!
!=================================================================
! Initialize pointers
AD => State_Met%AD
AIRDEN => State_Met%AIRDEN
AIRVOL => State_Met%AIRVOL
OMEGA => State_Met%OMEGA
U => State_Met%U
V => State_Met%V
! Zero/initialize local variables for safety's sake
arg = 0.0_dp
B = 0.0_dp
CN = 0.0_dp
CVF = 1.0e3_fp * AIRMW / ( AIRDEN(I,J,L) * AVO ) ! molec/cm3 -> v/v
DSVI = 0.0_dp
DTCHEM = GET_TS_CHEM() ! seconds
GNH3 = 0.0_dp
K = 0.0_dp
LST = 0.0_dp
R1 = 0.0_dp
R2 = 0.0_dp
SR = 0.0_dp
SRHOBr = 0.0_dp
SRHOCl = 0.0_dp
SRO3 = 0.0_dp
W = 0.0_dp
XX = 0.0_dp ! All XX* in units of [v/v/timestep]
XX1 = 0.0_dp
XX2 = 0.0_dp
XX3 = 0.0_dp
XX4 = 0.0_dp
XX5 = 0.0_dp
! FC is guaranteed to be > 1e-4, because HET_DROP_CHEM
! is not called otherwise (bmy, 07 Oct 2021)
FC = State_Met%CLDF(I,J,L)
!! <<>> SET THE INPUT UNITS! EITHER CONVERT IN THE ROUTINE OR
!! <<>> CONVERT BEFOREHAND. BUT EVERYTHING IS CURRENTLY mcl/cm3
!! <<>> AND HET_DROP_CHEM EXPECTS V/V
! XX* are calculated below to be consistent with
! Sulfate_Mod(). Values are different when
! computed with KPP-based variables. HET_DROP_CHEM()
! could use some attention to make is consistent with
! KPP.
!
! NOTE: Use function SafeExp, which will prevent the exponential from
! blowing up. Also if the entire expression will evaluate to zero
! then skip the exponential, which is more computationally efficient.
! -- Bob Yantosca, 14 Oct 2021
!
! SO2 + H2O2
R1 = C(ind_SO2) * CVF
R2 = C(ind_H2O2) * CVF
K = K_CLD(1) / CVF/ FC
Arg = ( R1 - R2 ) * ( K * DTCHEM )
IF ( IsSafeExp( Arg ) .and. ABS( Arg ) > 0.0_dp ) THEN
XX = EXP( Arg )
XX1 = ( R1 * R2 ) * ( XX - 1.0_dp ) / ( ( R1 * XX ) - R2 )
ELSE
XX1 = WhenExpCantBeDone( R1, R2, K, DTCHEM )
ENDIF
! SO2 + O3
R2 = C(ind_O3) * CVF
K = K_CLD(2) / CVF / FC
Arg = ( R1 - R2 ) * ( K * DTCHEM )
IF ( IsSafeExp( Arg ) .and. ABS( Arg ) > 0.0_dp ) THEN
XX = EXP( Arg )
XX2 = ( R1 * R2 ) * ( XX - 1.0_dp ) / ( ( R1 * XX ) - R2 )
ELSE
XX2 = WhenExpCantBeDone( R1, R2, K, DTCHEM )
ENDIF
! Metal catalyzed oxidation of SO2 pathway
K = -K_CLD(3) / FC
Arg = K * DTCHEM
XX3 = 0.0_dp
IF ( IsSafeExp( Arg ) ) THEN
XX = EXP( Arg )
XX3 = R1 * ( 1.0_dp - XX )
ENDIF
! HSO3- + HOCl and SO3-- + HOCl
R1 = C(ind_SO2) * CVF * State_Chm%HSO3_aq(I,J,L)
R2 = C(ind_HOCl) * CVF
K = HOClUptkByHSO3m(State_Het) / CVF
Arg = ( R1 - R2 ) * ( K * DTCHEM )
IF ( IsSafeExp( Arg ) .and. ABS( Arg ) > 0.0_dp ) THEN
XX = EXP( Arg )
XX4 = ( R1 * R2 ) * ( XX - 1.0_dp ) / ( ( R1 * XX ) - R2 )
ELSE
XX4 = WhenExpCantBeDone( R1, R2, K, DTCHEM )
ENDIF
! SO3-- + HOCl (add to HSO3- + HOCl rate)
R1 = C(ind_SO2) * CVF * State_Chm%SO3_aq(I,J,L)
K = HOClUptkBySO3mm(State_Het) / CVF
Arg = ( R1 - R2 ) * ( K * DTCHEM )
IF ( IsSafeExp( Arg ) .and. ABS( Arg ) > 0.0_dp ) THEN
XX = EXP( Arg )
XX4 = XX4 + ( ( R1 * R2 ) * ( XX - 1.0_fp ) / ( ( R1 * XX ) - R2 ) )
ELSE
XX4 = XX4 + WhenExpCantBeDone( R1, R2, K, DTCHEM )
ENDIF
! HSO3- + HOBr
R1 = C(ind_SO2) * CVF * State_Chm%HSO3_aq(I,J,L)
R2 = C(ind_HOBr) * CVF
K = HOBrUptkByHSO3m(State_Het) / CVF
Arg = ( R1 - R2 ) * ( K * DTCHEM )
IF ( IsSafeExp( Arg ) .and. ABS( Arg ) > 0.0_dp ) THEN
XX = EXP( Arg )
XX5 = ( R1 * R2 ) * ( XX - 1.0_fp ) / ( ( R1 * XX ) - R2 )
ELSE
XX5 = WhenExpCantBeDone( R1, R2, K, DTCHEM )
ENDIF
! SO3-- + HOBr (add to HSO3- + HOBr rate)
R1 = C(ind_SO2) * CVF * State_Chm%SO3_aq(I,J,L)
K = HOBrUptkBySO3mm(State_Het) / CVF
Arg = ( R1 - R2 ) * ( K * DTCHEM )
IF ( IsSafeExp( Arg ) .and. ABS( Arg ) > 0.0_dp ) THEN
XX = EXP( Arg )
XX5 = XX5 + ( ( R1 * R2 ) * ( XX - 1.0_dp ) / ( ( R1 * XX ) - R2 ) )
ELSE
XX5 = XX5 + WhenExpCantBeDone( R1, R2, K, DTCHEM )
ENDIF
! Sum of all rates
LST = XX1 + XX2 + XX3 + XX4 + XX5
!### Debug print
!IF (I .eq. 12 .and. J .eq. 7 .and. L .eq. 1) THEN
! write(*,*) '<<>> XX: ', XX1, XX2, XX3, XX4, XX5
!ENDIF
IF ( LST > R1 ) THEN
XX1 = ( R1 * XX1 ) / LST
XX2 = ( R1 * XX2 ) / LST
XX3 = ( R1 * XX3 ) / LST
XX4 = ( R1 * XX4 ) / LST
XX5 = ( R1 * XX5 ) / LST
LST = XX1 + XX2 + XX3 + XX4 + XX5
ENDIF
! Convert gas phase concentrations from [v/v] to [pptv]
NH3 = State_Chm%Species(id_NH3)%Conc(I,J,L) * CVF * 1.0e+12_dp
SO2 = MAX( C(ind_SO2) * CVF - ( LST*FC ), 1.0e-20_dp ) * 1.0e+12_dp
H2O2 = C(ind_H2O2)* CVF * 1.0e12_dp
HNO3 = C(ind_HNO3)* CVF * 1.0e12_dp
! Set molecular weight local variables
MW_SO4 = State_Chm%SpcData(id_SO4)%Info%MW_g
MW_SALC = State_Chm%SpcData(id_SALC)%Info%MW_g
! Convert sulfate aerosol concentrations from [v/v] to [ug/m3]
SO4 = ( C(ind_SO4) * CVF * AD(I,J,L) * 1.0e+9_dp ) / &
( ( AIRMW / MW_SO4 ) * AIRVOL(I,J,L) )
! Convert in cloud sulfate production rate from [v/v/timestep] to
! [ug/m3/timestep]
B = ( LST * AD(I,J,L) * 1.0e+9_dp ) / &
( ( AIRMW / MW_SO4 ) * AIRVOL(I,J,L) )
! Convert coarse-mode aerosol concentrations from [v/v] to [#/cm3]
! based on equation in Hofmann, Science, 1990.
! First convert from [v/v] to [kg/m3 air]
CNss = State_Chm%Species(id_SALC)%Conc(I,J,L)*CVF * AD(I,J,L) &
/ ( ( AIRMW / MW_SALC ) * AIRVOL(I,J,L) )
! Now convert from [kg/m3 air] to [#/cm3 air]
! Sea-salt
ARG = NINE_HALVES * ( LOG( SIG_S ) )**2
NDss = ( THREE_FOURTHS * CNss ) &
/ ( PI * SS_DEN * RG_S**3 * SafeExp( Arg, 0.0_dp ) ) &
* 1.e-6_dp
! Total coarse mode number concentration [#/cm3]
CN = NDss ! sea-salt
! Determine regression coefficients based on the local SO2 concentration
IF ( SO2 <= 200.00_fp ) THEN
alpha_B = 0.5318_dp
alpha_NH3 = -1.67e-7_dp
alpha_SO2 = 2.59e-6_dp
alpha_H2O2 = -1.77e-7_dp
alpha_HNO3 = -1.72e-7_dp
alpha_W = 1.22e-6_dp
alpha_CN = 4.58e-6_dp
alpha_SO4 = -1.00e-5_dp
ELSE IF ( SO2 > 200.00_dp .and. SO2 <= 500.0_dp ) THEN
alpha_B = 0.5591_dp
alpha_NH3 = 3.62e-6_dp
alpha_SO2 = 1.66e-6_dp
alpha_H2O2 = 1.06e-7_dp
alpha_HNO3 = -5.45e-7_dp
alpha_W = -5.79e-7_dp
alpha_CN = 1.63e-5_dp
alpha_SO4 = -7.40e-6_dp
ELSE IF ( SO2 > 500.0_dp .and. SO2 < 1000.0_dp ) THEN
alpha_B = 1.1547_dp
alpha_NH3 = -4.28e-8_dp
alpha_SO2 = -1.23e-7_dp
alpha_H2O2 = -9.05e-7_dp
alpha_HNO3 = 1.73e-7_dp
alpha_W = 7.22e-6_dp
alpha_CN = 2.44e-5_dp
alpha_SO4 = 3.25e-5_dp
ELSE ! SO2 > 1000
alpha_B = 1.1795_dp
alpha_NH3 = 2.57e-7_dp
alpha_SO2 = -5.54e-7_dp
alpha_H2O2 = -1.08e-6_dp
alpha_HNO3 = 1.95e-6_dp
alpha_W = 6.14e-6_dp
alpha_CN = 1.64e-5_dp
alpha_SO4 = 2.48e-6_dp
ENDIF
! Updraft velocity over the oceans [cm/s]
! 500 cm/s is too high. Get W from the met field. (qjc, 04/10/16)
!W = 500e+0_fp
W = -OMEGA(I,J,L) / ( AIRDEN(I,J,L) * g0 ) * 100e+0_dp
! Compute H (integration time interval * air parcel velocity) [m]
! DTCHEM is the chemistry timestep in seconds
! Compute air parcel velocity [m/s]
!APV = SQRT( (U(I,J,L) * U(I,J,L)) + (V(I,J,L) * V(I,J,L)) )
!(qjc, 04/10/16)
APV = SQRT( U(I,J,L)**2 + V(I,J,L)**2 ) + ( W**2 * 1.0e-4_dp )
H = DTCHEM * APV ![m]
sum_gas = ( alpha_NH3 * NH3 ) + ( alpha_SO2 * SO2 ) + &
( alpha_H2O2 * H2O2 ) + ( alpha_HNO3 * HNO3 )
DSVI = ( alpha_B * B ) + &
( ( ( alpha_CN * CN) + ( alpha_W * W ) + ( alpha_SO4 * SO4 ) + &
sum_gas ) * H )
! Only calculate SR when air parcel rises, in consistence with
! Yuen et al. (1996) (qjc, 04/10/16)
IF ( W > 0.0_dp .and. C(ind_SO2) > 0.0_dp ) THEN
! additional sulfate production in large, higher pH
! cloud droplets [ug/m3/timestep]
! Don't allow SR to be negative
SR = MAX( ( DSVI - B ), 0.0_dp )
! Skip further computation if SR = 0
IF ( SR > 0.0_dp ) THEN
! Convert SR from [ug/m3/timestep] to [v/v/timestep]
SR = SR * ( AIRMW / MW_SO4 ) * 1.e-9_dp / AIRDEN(I,J,L)
! Don't produce more SO4 than SO2 available after AQCHEM_SO2
! -- SR is dSO4/timestep (v/v) continue onvert
! to 1st order rate
!SR = MIN( SR, SO2 / 1.0e12_dp ) / ( C(ind_SO2) * CVF * DT )
!SR = MIN( SR, SO2 / 1.0e12_dp ) / ( C(ind_SO2) * C(ind_O3) * CVF * DT )
!I think the unit conversion is wrong. There should be another
!CVF and DT here. But I don't know why we need the denominator.
! -- Becky Alexander (30 Jan 2023)
SR = MIN( SR, SO2 / 1.0e12_dp )
ENDIF
ENDIF
! Convert SR from [v/v/timestep] to [mlcl/cm3/s]
SR = SR / CVF / DT
! Split SR between S(IV) oxidation by O3, HOCl, and HOBr
! Make sure division can be done safely
DENOM = XX2 + XX4 + XX5
SRO3 = SR * SafeDiv( XX2, DENOM, 0.0_fp )
SRHOCl = SR * SafeDiv( XX4, DENOM, 0.0_fp )
SRHOBr = SR * SafeDiv( XX5, DENOM, 0.0_fp )
! Convert this rate to a second order rate constant for use in KPP
! Make sure division can be done safely
SRO3 = SafeDiv( SRO3, ( C(ind_SO2) * C(ind_O3 ) ), 0.0_dp )
SRHOCl = SafeDiv( SRHOCl, ( C(ind_SO2) * C(ind_HOCl) ), 0.0_dp )
SRHOBr = SafeDiv( SRHOBr, ( C(ind_SO2) * C(ind_HOBr) ), 0.0_dp )
! Free pointers
AD => NULL()
AIRDEN => NULL()
AIRVOL => NULL()
OMEGA => NULL()
U => NULL()
V => NULL()
END SUBROUTINE fullchem_HetDropChem
!EOC
!------------------------------------------------------------------------------
! GEOS-Chem Global Chemical Transport Model !
!------------------------------------------------------------------------------
!BOP
!
! !IROUTINE: WhenExpCantBeDone
!
! !DESCRIPTION: Prevents floating point errors if exponential terms in routine
! Het_Drop_Chem above can't be done. In the case of a negative XX, R should be
! approximated as R1, instead of R2. In other words,
! R1 * R2 * ( XX - 1.D0 ) / ( ( R1 * XX ) - R2 )
! reaches different limits when XX reaches +Inf and -Inf.
!\\
!\\
! !INTERFACE:
!
FUNCTION WhenExpCantBeDone( R1, R2, K, DT ) RESULT( R )
!
! !USES:
!
USE gckpp_Precision, ONLY : dp
!
! !INPUT PARAMETERS:
!
REAL(dp), INTENT(IN) :: R1 ! 1st term
REAL(dp), INTENT(IN) :: R2 ! 2nd term
REAL(dp), INTENT(IN) :: K ! Rate [1/s]
REAL(dp), INTENT(IN) :: DT ! timesetep [s]
!
! !RETURN VALUE:
!
REAL(dp) :: R ! new rate [1/s]
!EOP
!------------------------------------------------------------------------------
!BOC
!
! !LOCAL VARIABLES
!
REAL(dp) :: DIFF
DIFF = R1 - R2
! R1 < R2
IF ( DIFF < 0.0_dp ) THEN
R = R1
RETURN
ENDIF
! R1 > R2
IF ( DIFF > 0.0_dp ) THEN
R = R2
RETURN
ENDIF
! R1 == R2
R = R1 - 1.0_dp / ( K * DT + ( 1.0_dp / R1 ) )
END FUNCTION WhenExpCantBeDone
!EOC
!------------------------------------------------------------------------------
! GEOS-Chem Global Chemical Transport Model !
!------------------------------------------------------------------------------
!BOP
!
! !IROUTINE: set_so2
!
! !DESCRIPTION: Subroutine SET\_SO2 is the SO2 chemistry subroutine.
! (rjp, bmy, 11/26/02, 8/26/10) Adapted from CHEM_SO2() in SULFATE_MOD
! (MSL - Spring 2021)
!\\
!\\
! !INTERFACE:
!
SUBROUTINE SET_SO2( I, J, L, Input_Opt, &
State_Chm, State_Diag, State_Grid, State_Met, &
Size_Res, RC )
!
! !USES:
!
USE ErrCode_Mod
USE gckpp_Global
USE Input_Opt_Mod, ONLY : OptInput
USE rateLawUtilFuncs
USE Species_Mod, ONLY : SpcConc
USE State_Chm_Mod, ONLY : ChmState
USE State_Diag_Mod, ONLY : DgnState
USE State_Grid_Mod, ONLY : GrdState
USE State_Met_Mod, ONLY : MetState
USE Time_Mod, ONLY : Get_Ts_Chem
!
! !INPUT PARAMETERS:
!
INTEGER, INTENT(IN) :: I, J, L ! Grid box indices
TYPE(OptInput), INTENT(IN) :: Input_Opt ! Input Options object
TYPE(GrdState), INTENT(IN) :: State_Grid ! Grid State object
TYPE(MetState), INTENT(IN) :: State_Met ! Meteorology State object
!
! !INPUT/OUTPUT PARAMETERS:
!
TYPE(ChmState), INTENT(INOUT) :: State_Chm ! Chemistry State object
TYPE(DgnState), INTENT(INOUT) :: State_Diag ! Diagnostics State object
!
! !OUTPUT PARAMETERS:
!
LOGICAL, INTENT(OUT) :: Size_Res ! Should we call HetDropChem?
INTEGER, INTENT(OUT) :: RC ! Success or failure?
!
! !REMARKS:
! Reaction List (by Rokjin Park)
! ============================================================================
! (1 ) SO2 production:
! DMS + OH, DMS + NO3 (saved in CHEM_DMS)
! .
! (2 ) SO2 loss:
! (a) SO2 + OH -> SO4
! (b) SO2 -> drydep
! (c) SO2 + H2O2 or O3 (aq) -> SO4
! .
! (3 ) SO2 = SO2_0 * exp(-bt) + PSO2_DMS/bt * [1-exp(-bt)]
! .
! where b is the sum of the reaction rate of SO2 + OH and the dry
! deposition rate of SO2, PSO2_DMS is SO2 production from DMS in
! MixingRatio/timestep.
! .
! If there is cloud in the gridbox (fraction = fc), then the aqueous
! phase chemistry also takes place in cloud. The amount of SO2 oxidized
! by H2O2 in cloud is limited by the available H2O2; the rest may be
! oxidized due to additional chemistry, e.g, reaction with O3 or O2
! (catalyzed by trace metal).
!
! !REVISION HISTORY:
! See https://github.com/geoschem/geos-chem for complete history
!EOP
!------------------------------------------------------------------------------
!BOC
!
! !DEFINED PARAMETERS:
!
REAL(fp), PARAMETER :: HPLUS_45 = 3.16227766016837953e-5_fp !pH = 4.5
REAL(fp), PARAMETER :: HPLUS_50 = 1.0e-5_fp !pH = 5.0
REAL(fp), PARAMETER :: MINDAT = 1.e-20_fp
!
! !LOCAL VARIABLES:
!
! Scalars
LOGICAL :: IS_OFFLINE
LOGICAL :: IS_FULLCHEM
INTEGER :: BULK
INTEGER :: IBIN
REAL(fp) :: K0, Ki, KK, M, L1
REAL(fp) :: L2, L3, Ld, F, Fc
REAL(fp) :: RK, RKT, DTCHEM, DT_T, TK
REAL(fp) :: F1, RK1, RK3, SO20, AVO_over_LWC
REAL(fp) :: SO2_cd, H2O20, L2S, L3S
REAL(fp) :: LWC, KaqH2O2, KaqO3, PATM, RHO, CNVFAC
REAL(fp) :: ALK, ALK1, ALK2, SO2_AfterSS
REAL(fp) :: AlkA, AlkC
REAL(fp) :: Kt1, Kt2
REAL(fp) :: PSO4E, PSO4F, Kt1N, Kt2N
REAL(fp) :: XX, Kt1L, Kt2L
REAL(fp) :: HPLUS, SO4nss, TNH3, TNO3, GNO3, ANIT
REAL(fp) :: LSTOT, ALKdst, ALKss, ALKds, NH3, CL, TNA
REAL(fp) :: SSCvv, aSO4, SO2_sr, SR, TANIT
REAL(fp) :: TFA, TAA, TDCA ! (jmm, 12/03/2018)
REAL(fp) :: SO2_gas, PH2SO4d_tot
REAL(fp) :: H2SO4_cd, H2SO4_gas
! (qjc, 04/10/16)
REAL(fp) :: L5,L5S
REAL(fp) :: L5_1,L5S_1,L3_1,L3S_1,KaqO3_1
REAL(fp) :: HSO3aq, SO3aq
REAL(fp) :: SO2_AfterSS0, rSIV, fupdateHOBr_0
REAL(fp) :: HCO3, HCHOBr, KO3, KHOBr, f_srhobr, HOBr0
REAL(fp) :: TMP
REAL(fp) :: KaqO2, L4, L4S, MnII, FeIII
REAL(fp) :: DUST, Mn_ant, Mn_nat
REAL(fp) :: Mn_tot, Mn_d, Fe_d
REAL(fp) :: Fe_ant, Fe_nat, Fe_tot
REAL(fp) :: Fe_d_ant, Fe_d_nat
REAL(fp) :: L6,L6S,L6_1,L6S_1 !XW
REAL(fp) :: fupdateHOCl_0 !XW
REAL(fp) :: HCHOCl, KHOCl, f_srhocl, HOCl0 !XW
REAL(fp) :: KaqHCHO, KaqHMS, KaqHMS2, HMSc ! JMM, MSL
! Pointers
TYPE(SpcConc), POINTER :: Spc(:)
REAL(fp), POINTER :: SSAlk(:)
CHARACTER(LEN=255) :: ErrMsg, ThisLoc
#ifdef LUO_WETDEP
! For Luo et al wetdep scheme
LOGICAL :: Is_QQ3D
#endif
!========================================================================
! SET_SO2 begins here!
!========================================================================
IF ( id_H2O2 < 0 .or. id_SO2 < 0 ) RETURN
! Initialize
RC = GC_SUCCESS
size_res = .FALSE.
ErrMsg = ''
ThisLoc = &
' -> at SET_SO2 (in module KPP/fullchem/fullchem_SulfurChemFuncs.F90)'