-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathACHEM_GridCompMod.F90
3871 lines (2979 loc) · 143 KB
/
ACHEM_GridCompMod.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
#include "MAPL_Generic.h"
!-------------------------------------------------------------------------
! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 !
!-------------------------------------------------------------------------
!BOP
!
! !MODULE: ACHEM_GridCompMod -
!
! !INTERFACE:
!
module ACHEM_GridCompMod
!
! !USES:
!
use ESMF
use MAPL
use m_StrTemplate, only: StrTemplate
use DryDepositionMod, only: DryDepositionGOCART
use GACL_ConstantsMod, only: pi, g_earth, N_avog, R_univ, &
mw_air, mw_S, mw_SO2, mw_SO4, mw_H2SO4, &
mw_DMS, mw_MSA, mw_OH, mw_NO3, mw_N, mw_NH3, mw_NH4, mw_SOAg
use GACL_DryDepositionMod, only: DepositionVelocity
use GACL_EmissionsMod, only: NH3_Emissions, &
SO2_Emissions, &
DMS_Emissions, &
SOAG_Emissions, &
VOC_Emissions
use GACL_ReactionRatesMod, only: henry, &
H_SO2_298, E_R_SO2, &
H_NH3_298, E_R_NH3, &
H_H2O2_298, E_R_H2O2, &
H_O3_298, E_R_O3
implicit none
private
!
! !PUBLIC MEMBER FUNCTIONS:
public SetServices
!
! !DESCRIPTION:
!
! {\tt GEOS\_AChem} is an ESMF gridded component implementing gas and aqueous phase
! chemistry in GEOS-5.
!
! Developed for GEOS-5 release Fortuna 2.0 and later.
!
! !REVISION HISTORY:
!
! 08Aug2012 A. Darmenov Cloned from MAM
!
!EOP
!-------------------------------------------------------------------------
! Legacy state
! ------------
type AChem_State
private
type(ESMF_Config) :: CF ! Private Config
type(ESMF_Grid) :: grid ! Grid
logical :: verbose ! turn on/off more verbose messages
logical :: mam_chem ! aerosol chemistry for MAM and alike
logical :: gas_phase_chem ! enable/disable gas phase chemistry
logical :: aqu_phase_chem ! enable/disable aqueous phase chemistry
logical :: ocs_chem ! enable/disable OCS chemistry mechanism
real :: ocs_surface_vmr = 0.0 ! OCS surface volume mixing ratio
logical :: voc_chem ! voc chemistry ! turn on/off VOCs
real :: voc_BiomassBurnFactor = 0.0 ! conversion factor CO->VOC (BB)
real :: voc_AnthroFactor = 0.0 ! conversion factor CO->VOC (anthro)
real :: voc_MW = 0.0 ! molecular weight of VOC
real :: soa_MW = 0.0 ! molecular weight of SOA
real :: aqu_solver_max_dt ! maximum time step used for integration in the aqueous-phase mechanism
logical :: apply_diurnal_cycle ! flag that indicates if offline oxidant have to be temporally downscaled
real, dimension(4) :: aviation_layers ! heights of the LTO, CDS and CRS layers
integer :: nymd_volcanic_emiss ! nYMD of last volcanic emission update
character(len=1024) :: volcanic_emiss_file ! resource file with volcanic emissions data
integer :: n_volcanoes = 0 ! point wise location, amount, elevation, plume height, cell indexes
real, pointer, dimension(:) :: volc_lat => null(), &
volc_lon => null(), &
volc_SO2 => null(), &
volc_elev => null(), &
volc_cloud => null()
integer, pointer, dimension(:) :: volc_start => null(), &
volc_end => null(), &
volc_i => null(), &
volc_j => null()
real, pointer, dimension(:,:,:) :: h2o2 ! buffer for H2O2 that is being replenished every 3 hours
! if it is from climatology
end type AChem_State
! Hook for the ESMF
! -----------------
type AChem_Wrap
type (AChem_State), pointer :: PTR => null()
end type AChem_Wrap
contains
!-------------------------------------------------------------------------
! NASA/GSFC, Global Modeling and Assimilation Office, Code 910.1 !
!-------------------------------------------------------------------------
!BOP
!
! !IROUTINE: SetServices --- Sets IRF services for the AChem Grid Component
!
! !INTERFACE:
subroutine SetServices(GC, RC)
! !ARGUMENTS:
type(ESMF_GridComp), intent(INOUT) :: GC ! gridded component
integer, optional :: RC ! return code
! !DESCRIPTION: Sets Initialize, Run and Finalize services.
!
! !REVISION HISTORY:
!
! 1Dec2009 da Silva First crack.
!
!EOP
!-------------------------------------------------------------------------
__Iam__('SetServices')
! Local derived type aliases
! --------------------------
type (AChem_State), pointer :: self ! internal state
type (AChem_Wrap) :: wrap
character(len=ESMF_MAXSTR) :: comp_name
! Local variables
! --------------------------
integer :: n
! ------------
! Get my name and set-up traceback handle
! ---------------------------------------
call ESMF_GridCompGet( GC, name=comp_name, __RC__ )
Iam = TRIM(comp_name) // '::' // trim(Iam)
! Wrap internal state for storing in GC; rename legacyState
! -------------------------------------
allocate(self, __STAT__)
wrap%ptr => self
! Load private Config Attributes
! ------------------------------
self%CF = ESMF_ConfigCreate(__RC__)
call ESMF_ConfigLoadFile(self%CF, 'ACHEM_GridComp.rc', __RC__)
call ESMF_ConfigGetAttribute(self%CF, self%verbose, label='verbose:', default=.false., __RC__)
! gas phase options
call ESMF_ConfigGetAttribute(self%CF, self%gas_phase_chem, label='gas_chemistry:', default=.true., __RC__)
! aqueous phase options
call ESMF_ConfigGetAttribute(self%CF, self%aqu_phase_chem, label='aqueous_chemistry:', default=.true., __RC__)
call ESMF_ConfigGetAttribute(self%CF, self%aqu_solver_max_dt, label='aqueous_chemistry_solver_max_dt:', default=60.0, __RC__)
#if (0)
! combo(gas- and aqueous-phase) options
call ESMF_ConfigGetAttribute(self%CF, self%combo_chem, label='combo_chemistry:', default=.true., __RC__)
call ESMF_ConfigGetAttribute(self%CF, self%combo_solver_max_dt, label='combo_chemistry_max_dt:', default=10.0, __RC__)
#endif
! other options
call ESMF_ConfigGetAttribute(self%CF, self%apply_diurnal_cycle, label='apply_diurnal_cycle:', default=.true., __RC__)
! volcanic emissions
call ESMF_ConfigGetAttribute(self%CF, self%volcanic_emiss_file, Label='volcanoes:', default='/dev/null', __RC__)
! heights of aviation layers
self%aviation_layers = 0.0
call ESMF_ConfigFindLabel(self%CF, Label='aviation_vertical_layers:', __RC__)
AVIATION_LAYERS: do n = 1, 4
call ESMF_ConfigGetAttribute(self%CF, self%aviation_layers(n), __RC__)
end do AVIATION_LAYERS
! OCS chemistry
call ESMF_ConfigGetAttribute(self%CF, self%ocs_chem, Label='ocs_chemistry:', default=.false., __RC__)
if (self%ocs_chem) then
call ESMF_ConfigGetAttribute(self%CF, self%ocs_surface_vmr, Label='ocs_surface_vmr:', __RC__)
else
self%ocs_surface_vmr = 0.0
end if
! VOC chemistry
call ESMF_ConfigGetAttribute(self%CF, self%voc_chem, Label='voc_chemistry:', default=.false., __RC__)
if (self%voc_chem) then
call ESMF_ConfigGetAttribute(self%CF, self%voc_BiomassBurnFactor, Label='voc_BiomassBurnFactor:', __RC__)
call ESMF_ConfigGetAttribute(self%CF, self%voc_AnthroFactor, Label='voc_AnthroFactor:', __RC__)
call ESMF_ConfigGetAttribute(self%CF, self%voc_MW, Label='voc_MW:', __RC__)
call ESMF_ConfigGetAttribute(self%CF, self%soa_MW, Label='soa_MW:', __RC__)
end if
! Minimalistic atmospheric mechanism for MAM and alike
if (self%gas_phase_chem .or. self%aqu_phase_chem) then
self%mam_chem = .true.
else
self%mam_chem = .false.
end if
if (MAPL_AM_I_ROOT()) then
print *, trim(Iam)//': Configuration'
print *, trim(Iam)//': gas chemistry = ', self%gas_phase_chem
print *, trim(Iam)//': aqueous chemistry = ', self%aqu_phase_chem
print *, trim(Iam)//': VOC chemistry = ', self%voc_chem
print *, trim(Iam)//': OCS chemistry = ', self%ocs_chem
print *, ''
end if
! ------------------------
! ESMF Functional Services
! ------------------------
! Set the Initialize, Run, Finalize entry points
! ----------------------------------------------
call MAPL_GridCompSetEntryPoint(GC, ESMF_METHOD_INITIALIZE, Initialize_, __RC__)
call MAPL_GridCompSetEntryPoint(GC, ESMF_METHOD_RUN, Run_, __RC__)
call MAPL_GridCompSetEntryPoint(GC, ESMF_METHOD_FINALIZE, Finalize_, __RC__)
! Store internal state in GC
! --------------------------
call ESMF_UserCompSetInternalState(GC, 'AChem_State', wrap, STATUS)
VERIFY_(STATUS)
! ------------------
! MAPL Data Services
! ------------------
!BOS
!
! !IMPORT STATE:
call MAPL_AddImportSpec(GC, &
SHORT_NAME = 'AIRDENS', &
LONG_NAME = 'Air density', &
UNITS = 'kg m-3', &
DIMS = MAPL_DimsHorzVert, &
VLOCATION = MAPL_VLocationCenter, &
__RC__)
call MAPL_AddImportSpec(GC, &
SHORT_NAME = 'DELP', &
LONG_NAME = 'Pressure Thickness', &
UNITS = 'Pa', &
DIMS = MAPL_DimsHorzVert, &
VLOCATION = MAPL_VLocationCenter, &
__RC__)
call MAPL_AddImportSpec(GC, &
SHORT_NAME = 'PLE', &
LONG_NAME = 'Edge pressure', &
UNITS = 'Pa', &
DIMS = MAPL_DimsHorzVert, &
VLOCATION = MAPL_VLocationEdge, &
__RC__)
call MAPL_AddImportSpec(GC, &
SHORT_NAME = 'T', &
LONG_NAME = 'Air Temperature (from Dynamics)', &
UNITS = 'K', &
DIMS = MAPL_DimsHorzVert, &
VLOCATION = MAPL_VLocationCenter, &
__RC__)
OPTIONAL_CHEM_IMPORT: if (self%mam_chem) then
call MAPL_AddImportSpec(GC, &
SHORT_NAME = 'AREA', &
LONG_NAME = 'Cell area', &
UNITS = 'm2', &
DIMS = MAPL_DimsHorzOnly, &
VLOCATION = MAPL_VLocationNone, &
__RC__)
call MAPL_AddImportSpec(GC, &
SHORT_NAME = 'ZLE', &
LONG_NAME = 'Edge heights', &
UNITS = 'm', &
DIMS = MAPL_DimsHorzVert, &
VLOCATION = MAPL_VLocationEdge, &
__RC__)
call MAPL_AddImportSpec(GC, &
SHORT_NAME = 'QLTOT', &
LONG_NAME = 'Mass fraction of cloud liquid water', &
UNITS = 'kg kg-1', &
DIMS = MAPL_DimsHorzVert, &
VLOCATION = MAPL_VLocationCenter, &
__RC__)
call MAPL_AddImportSpec(GC, &
SHORT_NAME = 'FCLD', &
LONG_NAME = 'Cloud fraction for radiation', &
UNITS = '1', &
DIMS = MAPL_DimsHorzVert, &
VLOCATION = MAPL_VLocationCenter, &
__RC__)
call MAPL_AddImportSpec(GC, &
SHORT_NAME = 'U10N', &
LONG_NAME = 'Equivalent neutral 10 meter eastward wind', &
UNITS = 'm s-1', &
DIMS = MAPL_DimsHorzOnly, &
VLOCATION = MAPL_VLocationNone, &
__RC__)
call MAPL_AddImportSpec(GC, &
SHORT_NAME = 'V10N', &
LONG_NAME = 'Equivalent neutral 10 meter northward wind', &
UNITS = 'm s-1', &
DIMS = MAPL_DimsHorzOnly, &
VLOCATION = MAPL_VLocationNone, &
__RC__)
call MAPL_AddImportSpec(GC, &
SHORT_NAME = 'FROCEAN', &
LONG_NAME = 'Fraction of ocean', &
UNITS = '1', &
DIMS = MAPL_DimsHorzOnly, &
VLOCATION = MAPL_VLocationNone, &
__RC__)
call MAPL_AddImportSpec(GC, &
SHORT_NAME = 'LWI', &
LONG_NAME = 'Land-water-ice flags', &
UNITS = '1', &
DIMS = MAPL_DimsHorzOnly, &
VLOCATION = MAPL_VLocationNone, &
__RC__)
call MAPL_AddImportSpec(GC, &
SHORT_NAME = 'USTAR', &
LONG_NAME = 'Surface (friction) velocity scale', &
UNITS = 'm s-1', &
DIMS = MAPL_DimsHorzOnly, &
VLOCATION = MAPL_VLocationNone, &
__RC__)
call MAPL_AddImportSpec(GC, &
SHORT_NAME = 'SH', &
LONG_NAME = 'Sensible heat flux', &
UNITS = 'W/m2', &
DIMS = MAPL_DimsHorzOnly, &
VLOCATION = MAPL_VLocationNone, &
__RC__)
call MAPL_AddImportSpec(GC, &
SHORT_NAME = 'Z0H', &
LONG_NAME = 'Surface roughness for heat', &
UNITS = 'm', &
DIMS = MAPL_DimsHorzOnly, &
VLOCATION = MAPL_VLocationNone, &
__RC__)
call MAPL_AddImportSpec(GC, &
SHORT_NAME = 'ZPBL', &
LONG_NAME = 'Height of PBL', &
UNITS = 'm', &
DIMS = MAPL_DimsHorzOnly, &
VLOCATION = MAPL_VLocationNone, &
__RC__)
call MAPL_AddImportSpec(GC, &
SHORT_NAME = 'TS', &
LONG_NAME = 'Surface skin temperature', &
UNITS = 'K', &
DIMS = MAPL_DimsHorzOnly, &
VLOCATION = MAPL_VLocationNone, &
__RC__)
call MAPL_AddImportSpec(GC, &
SHORT_NAME = 'H2O2', &
LONG_NAME = 'Hydrogen peroxide (H2O2)', &
UNITS = 'mol mol-1', &
DIMS = MAPL_DimsHorzVert, &
VLOCATION = MAPL_VLocationCenter, &
__RC__)
call MAPL_AddImportSpec(GC, &
SHORT_NAME = 'OH', &
LONG_NAME = 'Hydroxyl radical (OH)', &
UNITS = 'mol mol-1', &
DIMS = MAPL_DimsHorzVert, &
VLOCATION = MAPL_VLocationCenter, &
RESTART = MAPL_RestartSkip, &
__RC__)
call MAPL_AddImportSpec(GC, &
SHORT_NAME = 'NO3', &
LONG_NAME = 'Nitrogen trixide (NO3)', &
UNITS = 'mol mol-1', &
DIMS = MAPL_DimsHorzVert, &
VLOCATION = MAPL_VLocationCenter, &
RESTART = MAPL_RestartSkip, &
__RC__)
call MAPL_AddImportSpec(GC, &
SHORT_NAME = 'O3', &
LONG_NAME = 'Ozone (mass mixing ratio)', &
UNITS = 'kg kg-1', &
DIMS = MAPL_DimsHorzVert, &
VLOCATION = MAPL_VLocationCenter, &
RESTART = MAPL_RestartSkip, &
__RC__)
call MAPL_AddImportSpec(GC, &
SHORT_NAME = 'DMS_CONC_OCEAN', &
LONG_NAME = 'Surface seawater concentration of DMS', &
UNITS = 'nmol L-1-1', &
DIMS = MAPL_DimsHorzOnly, &
VLOCATION = MAPL_VLocationNone, &
RESTART = MAPL_RestartSkip, &
__RC__)
call MAPL_AddImportSpec(GC, &
SHORT_NAME = 'SO2_EMIS_FIRES', &
LONG_NAME = 'SO2 emissions from biomass burning', &
UNITS = 'kg m-2 s-1', &
DIMS = MAPL_DimsHorzOnly, &
VLOCATION = MAPL_VLocationNone, &
RESTART = MAPL_RestartSkip, &
__RC__)
call MAPL_AddImportSpec(GC, &
SHORT_NAME = 'SO2_EMIS_NONENERGY', &
LONG_NAME = 'SO2 emissions from non-energy sectors', &
UNITS = 'kg m-2 s-1', &
DIMS = MAPL_DimsHorzOnly, &
VLOCATION = MAPL_VLocationNone, &
RESTART = MAPL_RestartSkip, &
__RC__)
call MAPL_AddImportSpec(GC, &
SHORT_NAME = 'SO2_EMIS_ENERGY', &
LONG_NAME = 'SO2 emissions from energy sector', &
UNITS = 'kg m-2 s-1', &
DIMS = MAPL_DimsHorzOnly, &
VLOCATION = MAPL_VLocationNone, &
RESTART = MAPL_RestartSkip, &
__RC__)
call MAPL_AddImportSpec(GC, &
SHORT_NAME = 'SO2_EMIS_SHIPPING', &
LONG_NAME = 'SO2 emissions from shipping sector', &
UNITS = 'kg m-2 s-1', &
DIMS = MAPL_DimsHorzOnly, &
VLOCATION = MAPL_VLocationNone, &
RESTART = MAPL_RestartSkip, &
__RC__)
call MAPL_AddImportSpec(GC, &
SHORT_NAME = 'SO2_EMIS_AIRCRAFT_LTO', &
LONG_NAME = 'SO2 emissions from aviation (LTO layer)', &
UNITS = 'kg m-2 s-1', &
DIMS = MAPL_DimsHorzOnly, &
VLOCATION = MAPL_VLocationNone, &
RESTART = MAPL_RestartSkip, &
__RC__)
call MAPL_AddImportSpec(GC, &
SHORT_NAME = 'SO2_EMIS_AIRCRAFT_CDS', &
LONG_NAME = 'SO2 emissions from aviation (CDS layer)', &
UNITS = 'kg m-2 s-1', &
DIMS = MAPL_DimsHorzOnly, &
VLOCATION = MAPL_VLocationNone, &
RESTART = MAPL_RestartSkip, &
__RC__)
call MAPL_AddImportSpec(GC, &
SHORT_NAME = 'SO2_EMIS_AIRCRAFT_CRS', &
LONG_NAME = 'SO2 emissions from aviation (CRS layer)', &
UNITS = 'kg m-2 s-1', &
DIMS = MAPL_DimsHorzOnly, &
VLOCATION = MAPL_VLocationNone, &
RESTART = MAPL_RestartSkip, &
__RC__)
call MAPL_AddImportSpec(GC, &
SHORT_NAME = 'NH3_EMIS', &
LONG_NAME = 'NH3 emissions - all sectors excluding biomass burning', &
UNITS = 'kg m-2 s-1', &
DIMS = MAPL_DimsHorzOnly, &
VLOCATION = MAPL_VLocationNone, &
RESTART = MAPL_RestartSkip, &
__RC__)
call MAPL_AddImportSpec(GC, &
SHORT_NAME = 'NH3_EMIS_FIRE', &
LONG_NAME = 'NH3 emissions - biomass burning', &
UNITS = 'kg m-2 s-1', &
DIMS = MAPL_DimsHorzOnly, &
VLOCATION = MAPL_VLocationNone, &
RESTART = MAPL_RestartSkip, &
__RC__)
call MAPL_AddImportSpec(GC, &
SHORT_NAME = 'SOAG_EMIS', &
LONG_NAME = 'SOA(gas) surface emissions', &
UNITS = 'm-2 s-1', &
DIMS = MAPL_DimsHorzOnly, &
VLOCATION = MAPL_VLocationNone, &
RESTART = MAPL_RestartSkip, &
__RC__)
end if OPTIONAL_CHEM_IMPORT
OPTIONAL_VOC_IMPORTS: if (self%voc_chem) then
if (.not. self%mam_chem) then
call MAPL_AddImportSpec(GC, &
SHORT_NAME = 'OH', &
LONG_NAME = 'Hydroxyl radical (OH)', &
UNITS = 'mol mol-1', &
DIMS = MAPL_DimsHorzVert, &
VLOCATION = MAPL_VLocationCenter, &
RESTART = MAPL_RestartSkip, &
__RC__)
end if
call MAPL_AddImportSpec(GC, &
SHORT_NAME = 'CO_BIOMASS_VOC', &
LONG_NAME = 'CO Biomass Burning Emissions', &
UNITS = 'kg m-2 s-1', &
DIMS = MAPL_DimsHorzOnly, &
VLOCATION = MAPL_VLocationNone, &
RESTART = MAPL_RestartSkip, &
__RC__)
call MAPL_AddImportSpec(GC, &
SHORT_NAME = 'CO_BF_VOC', &
LONG_NAME = 'CO Biofuel Emissions', &
UNITS = 'kg m-2 s-1', &
DIMS = MAPL_DimsHorzOnly, &
VLOCATION = MAPL_VLocationNone, &
RESTART = MAPL_RestartSkip, &
__RC__)
call MAPL_AddImportSpec(GC, &
SHORT_NAME = 'CO_FS_VOC', &
LONG_NAME = 'CO Fossil Fuel Emissions', &
UNITS = 'kg m-2 s-1', &
DIMS = MAPL_DimsHorzOnly, &
VLOCATION = MAPL_VLocationNone, &
RESTART = MAPL_RestartSkip, &
__RC__)
end if OPTIONAL_VOC_IMPORTS
OPTIONAL_OCS_IMPORTS: if (self%ocs_chem) then
call MAPL_AddImportSpec(GC, &
SHORT_NAME = 'TROPP', &
LONG_NAME = 'Tropopause pressure based on blended estimate', &
UNITS = 'Pa', &
DIMS = MAPL_DimsHorzOnly, &
VLOCATION = MAPL_VLocationNone, &
__RC__)
call MAPL_AddImportSpec(GC, &
SHORT_NAME = 'OHSTRAT', &
LONG_NAME = 'Hydroxyl radical', &
UNITS = 'mol mol-1', &
DIMS = MAPL_DimsHorzVert, &
VLOCATION = MAPL_VLocationCenter, &
__RC__)
call MAPL_AddImportSpec(GC, &
SHORT_NAME = 'O3P', &
LONG_NAME = 'O triplet P', &
UNITS = 'mol mol-1', &
DIMS = MAPL_DimsHorzVert, &
VLOCATION = MAPL_VLocationCenter, &
__RC__)
call MAPL_AddImportSpec(GC, &
SHORT_NAME = 'OCS_JRATE', &
LONG_NAME = 'OCS photolysis rates', &
UNITS = 's-1', &
DIMS = MAPL_DimsHorzVert, &
VLOCATION = MAPL_VLocationCenter, &
__RC__)
end if OPTIONAL_OCS_IMPORTS
! !INTERNAL STATE:
OPTIONAL_CHEM_INTERNAL: if (self%mam_chem) then
call MAPL_AddInternalSpec(GC, &
SHORT_NAME = trim(comp_name)//'::'//'DMS', &
LONG_NAME = 'Dimethyl sulfide (DMS)', &
UNITS = 'mol mol-1', &
DIMS = MAPL_DimsHorzVert, &
VLOCATION = MAPL_VLocationCenter, &
FRIENDLYTO = 'DYNAMICS:TURBULENCE:MOIST', &
ADD2EXPORT = .true., &
__RC__)
call MAPL_AddInternalSpec(GC, &
SHORT_NAME = trim(comp_name)//'::'//'MSA', &
LONG_NAME = 'Methanesulfonic acid (MSA)', &
UNITS = 'mol mol-1', &
DIMS = MAPL_DimsHorzVert, &
VLOCATION = MAPL_VLocationCenter, &
FRIENDLYTO = 'DYNAMICS:TURBULENCE:MOIST', &
ADD2EXPORT = .true., &
__RC__)
call MAPL_AddInternalSpec(GC, &
SHORT_NAME = trim(comp_name)//'::'//'SO2', &
LONG_NAME = 'Sulfur dioxide (SO2)', &
UNITS = 'mol mol-1', &
DIMS = MAPL_DimsHorzVert, &
VLOCATION = MAPL_VLocationCenter, &
FRIENDLYTO = 'DYNAMICS:TURBULENCE:MOIST:MAM', &
ADD2EXPORT = .true., &
__RC__)
call MAPL_AddInternalSpec(GC, &
SHORT_NAME = trim(comp_name)//'::'//'H2SO4', &
LONG_NAME = 'Sulfuric acid (H2SO4 gas)', &
UNITS = 'mol mol-1', &
DIMS = MAPL_DimsHorzVert, &
VLOCATION = MAPL_VLocationCenter, &
FRIENDLYTO = 'DYNAMICS:TURBULENCE:MOIST:MAM', &
ADD2EXPORT = .true., &
__RC__)
call MAPL_AddInternalSpec(GC, &
SHORT_NAME = trim(comp_name)//'::'//'NH3', &
LONG_NAME = 'Ammonia (NH3)', &
UNITS = 'mol mol-1', &
DIMS = MAPL_DimsHorzVert, &
VLOCATION = MAPL_VLocationCenter, &
FRIENDLYTO = 'DYNAMICS:TURBULENCE:MOIST:MAM', &
ADD2EXPORT = .true., &
__RC__)
call MAPL_AddInternalSpec(GC, &
SHORT_NAME = trim(comp_name)//'::'//'SOAG', &
LONG_NAME = 'Secondary Organic Aerosols (SOA gas)', &
UNITS = 'mol mol-1', &
DIMS = MAPL_DimsHorzVert, &
VLOCATION = MAPL_VLocationCenter, &
FRIENDLYTO = 'DYNAMICS:TURBULENCE:MOIST:MAM', &
ADD2EXPORT = .true., &
__RC__)
end if OPTIONAL_CHEM_INTERNAL
OPTIONAL_OCS_INTERNAL: if (self%ocs_chem) then
call MAPL_AddInternalSpec(GC, &
SHORT_NAME = trim(comp_name)//'::'//'OCS', &
LONG_NAME = 'Carbonyl Sulfide (OCS gas)', &
UNITS = 'mol mol-1', &
DIMS = MAPL_DimsHorzVert, &
VLOCATION = MAPL_VLocationCenter, &
FRIENDLYTO = 'DYNAMICS:TURBULENCE:MOIST:MAM', &
ADD2EXPORT = .true., &
__RC__)
end if OPTIONAL_OCS_INTERNAL
OPTIONAL_VOC_INTERNAL: if (self%voc_chem) then
call MAPL_AddInternalSpec(GC, &
SHORT_NAME = trim(comp_name)//'::'//'VOC', &
LONG_NAME = 'Volatile Organic Compound (VOC) --anthropogenic sources', &
UNITS = 'mol mol-1', &
DIMS = MAPL_DimsHorzVert, &
VLOCATION = MAPL_VLocationCenter, &
FRIENDLYTO = 'DYNAMICS:TURBULENCE:MOIST', &
ADD2EXPORT = .true., &
__RC__)
call MAPL_AddInternalSpec(GC, &
SHORT_NAME = trim(comp_name)//'::'//'VOCbiob', &
LONG_NAME = 'Volatile Organic Compound (VOC) -- biomass burning sources',&
UNITS = 'mol mol-1', &
DIMS = MAPL_DimsHorzVert, &
VLOCATION = MAPL_VLocationCenter, &
FRIENDLYTO = 'DYNAMICS:TURBULENCE:MOIST', &
ADD2EXPORT = .true., &
__RC__)
end if OPTIONAL_VOC_INTERNAL
! !EXTERNAL STATE:
OPTIONAL_CHEM_EXPORT: if (self%mam_chem) then
#include "ACHEM_ExportSpec___.h"
end if OPTIONAL_CHEM_EXPORT
OPTIONAL_VOC_EXPORT: if (self%voc_chem) then
if (.not. self%mam_chem) then
call MAPL_AddExportSpec(GC, &
SHORT_NAME = 'OH', &
LONG_NAME = 'OH with imposed diurnal cycle', &
UNITS = 'mol mol-1', &
DIMS = MAPL_DimsHorzVert, &
VLOCATION = MAPL_VLocationCenter, &
RC=STATUS )
VERIFY_(STATUS)
end if
call MAPL_AddExportSpec(GC, &
SHORT_NAME = 'pSOA_ANTHRO_VOC', &
LONG_NAME = 'Production of SOA from Anthropogenic + Biofuel Burning VOC', &
UNITS = 'kg m-3 s-1', &
DIMS = MAPL_DimsHorzVert, &
VLOCATION = MAPL_VLocationCenter, &
RC=STATUS )
VERIFY_(STATUS)
call MAPL_AddExportSpec(GC, &
SHORT_NAME = 'pSOA_ANTHRO_VOC_MMRday', &
LONG_NAME = 'Production of SOA from Anthropogenic + Biofuel Burning VOC', &
UNITS = 'kg m-3 d-1', &
DIMS = MAPL_DimsHorzVert, &
VLOCATION = MAPL_VLocationCenter, &
RC=STATUS )
VERIFY_(STATUS)
call MAPL_AddExportSpec(GC, &
SHORT_NAME = 'pSOA_BIOB_VOC', &
LONG_NAME = 'Production of SOA from Biomass Burning VOC', &
UNITS = 'kg m-3 s-1', &
DIMS = MAPL_DimsHorzVert, &
VLOCATION = MAPL_VLocationCenter, &
RC=STATUS )
VERIFY_(STATUS)
call MAPL_AddExportSpec(GC, &
SHORT_NAME = 'pSOA_BIOB_VOC_MMRday', &
LONG_NAME = 'Production of SOA from Biomass Burning VOC', &
UNITS = 'kg m-3 d-1', &
DIMS = MAPL_DimsHorzVert, &
VLOCATION = MAPL_VLocationCenter, &
RC=STATUS )
VERIFY_(STATUS)
end if OPTIONAL_VOC_EXPORT
OPTIONAL_OCS_EXPORT: if (self%ocs_chem) then
call MAPL_AddExportSpec(GC, &
SHORT_NAME = 'pSO2_OCS', &
LONG_NAME = 'Production of SO2 from OCS', &
UNITS = 'kg kg-1 s-1', &
DIMS = MAPL_DimsHorzVert, &
VLOCATION = MAPL_VLocationCenter, &
RC=STATUS )
VERIFY_(STATUS)
call MAPL_AddExportSpec(GC, &
SHORT_NAME = 'pSO2_OCS_OH', &
LONG_NAME = 'Production of SO2 from OCS+OH', &
UNITS = 'kg kg-1 s-1', &
DIMS = MAPL_DimsHorzVert, &
VLOCATION = MAPL_VLocationCenter, &
RC=STATUS )
VERIFY_(STATUS)
call MAPL_AddExportSpec(GC, &
SHORT_NAME = 'pSO2_OCS_O3p', &
LONG_NAME = 'Production of SO2 from OCS+O3p', &
UNITS = 'kg kg-1 s-1', &
DIMS = MAPL_DimsHorzVert, &
VLOCATION = MAPL_VLocationCenter, &
RC=STATUS )
VERIFY_(STATUS)
call MAPL_AddExportSpec(GC, &
SHORT_NAME = 'pSO2_OCS_jOCS', &
LONG_NAME = 'Production of SO2 from OCS photolysis', &
UNITS = 'kg kg-1 s-1', &
DIMS = MAPL_DimsHorzVert, &
VLOCATION = MAPL_VLocationCenter, &
RC=STATUS )
VERIFY_(STATUS)
call MAPL_AddExportSpec(GC, &
SHORT_NAME = 'lOCS', &
LONG_NAME = 'Loss rate of OCS (molec cm-3 s-1)', &
UNITS = 'cm-3 s-1', &
DIMS = MAPL_DimsHorzVert, &
VLOCATION = MAPL_VLocationCenter, &
RC=STATUS )
VERIFY_(STATUS)
call MAPL_AddExportSpec(GC, &
SHORT_NAME = 'lOCS_OH', &
LONG_NAME = 'Loss rate of OCS from OCS+OH(molec cm-3 s-1)', &
UNITS = 'cm-3 s-1', &
DIMS = MAPL_DimsHorzVert, &
VLOCATION = MAPL_VLocationCenter, &
RC=STATUS )
VERIFY_(STATUS)
call MAPL_AddExportSpec(GC, &
SHORT_NAME = 'lOCS_O3p', &
LONG_NAME = 'Loss rate of OCS from OCS+O3p(molec cm-3 s-1)', &
UNITS = 'cm-3 s-1', &
DIMS = MAPL_DimsHorzVert, &
VLOCATION = MAPL_VLocationCenter, &
RC=STATUS )
VERIFY_(STATUS)
call MAPL_AddExportSpec(GC, &
SHORT_NAME = 'lOCS_jOCS', &
LONG_NAME = 'Loss rate of OCS from photolysis (molec cm-3 s-1)', &
UNITS = 'cm-3 s-1', &
DIMS = MAPL_DimsHorzVert, &
VLOCATION = MAPL_VLocationCenter, &
RC=STATUS )
VERIFY_(STATUS)
call MAPL_AddExportSpec(GC, &
SHORT_NAME = 'pScl_OCS', &
LONG_NAME = 'Production of SO2 from OCS (column integrated)', &
UNITS = 'kg m-2', &
DIMS = MAPL_DimsHorzOnly, &
VLOCATION = MAPL_VLocationNone, &
RC=STATUS )
VERIFY_(STATUS)
end if OPTIONAL_OCS_EXPORT
!EOS
! Set the Profiling timers
! ------------------------
call MAPL_TimerAdd(GC, name = 'TOTAL', __RC__)
call MAPL_TimerAdd(GC, name = 'RUN', __RC__)
call MAPL_TimerAdd(GC, name = '-EMISSIONS', __RC__)
call MAPL_TimerAdd(GC, name = '-CHEMISTRY', __RC__)
call MAPL_TimerAdd(GC, name = '--CHEMISTRY_GAS', __RC__)
call MAPL_TimerAdd(GC, name = '--CHEMISTRY_AQUEOUS', __RC__)
call MAPL_TimerAdd(GC, name = '--CHEMISTRY_VOC', __RC__)
call MAPL_TimerAdd(GC, name = '--CHEMISTRY_OCS', __RC__)
call MAPL_TimerAdd(GC, name = 'INITIALIZE', __RC__)
! Generic Set Services
! --------------------
call MAPL_GenericSetServices(GC, __RC__)
! All done
! --------
RETURN_(ESMF_SUCCESS)
end subroutine SetServices
!-------------------------------------------------------------------------
! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 !
!-------------------------------------------------------------------------
!BOP
!
! !IROUTINE: Initialize_ --- Initialize AChem
!
! !INTERFACE:
!
subroutine Initialize_(GC, IMPORT, EXPORT, CLOCK, rc)
! !USES:
implicit none
! !INPUT PARAMETERS:
type(ESMF_Clock), intent(inout) :: CLOCK ! The clock
! !OUTPUT PARAMETERS:
type(ESMF_GridComp), intent(inout) :: GC ! Grid Component
type(MAPL_MetaComp), pointer :: mgState ! MAPL generic state
type(ESMF_State), intent(inout) :: IMPORT ! Import State
type(ESMF_State), intent(inout) :: EXPORT ! Export State
integer, intent(out) :: rc ! Error return code:
! 0 - all is well
! 1 -
! !DESCRIPTION: This is a simple ESMF wrapper.
!
! !REVISION HISTORY:
!
! 01Dec2009 da Silva First crack.
!
!EOP
!-------------------------------------------------------------------------
__Iam__('Initialize_')
type(AChem_State), pointer :: self ! Legacy state
type(ESMF_Grid) :: GRID ! Grid
type(ESMF_Config) :: CF ! Universal Config
integer :: i1, i2, im ! 3D Dimensions
integer :: j1, j2, jm !
integer :: km !
integer :: nymd, nhms ! date, time
real :: cdt ! time step in secs
character(len=ESMF_MAXSTR) :: comp_name ! component's name
real, pointer, dimension(:,:,:) :: q_H2O2 ! H2O2
logical, parameter :: using_GMI_H2O2 = .false. ! coupling with GMI is not implemented
! Declare pointers to IMPORT/EXPORT/INTERNAL states
! -------------------------------------------------
#if(0)
#include "ACHEM_DeclarePointer___.h"
#endif
! Get my name and set-up traceback handle
! ---------------------------------------
call ESMF_GridCompGet(GC, name=comp_name, __RC__)
Iam = trim(comp_name) // '::' // trim(Iam)
! --------
if (MAPL_AM_I_ROOT()) then
print *, trim(Iam)//': Starting...'
print *, ''
end if
! Get my internal MAPL_Generic state
! -----------------------------------
call MAPL_GetObjectFromGC(GC, mgState, __RC__)
call MAPL_TimerOn(mgState, 'TOTAL', __RC__)
call MAPL_TimerOn(mgState, 'INITIALIZE', __RC__)
! Initialize MAPL Generic
! -----------------------
call MAPL_GenericInitialize(GC, IMPORT, EXPORT, clock, __RC__)
! Get pointers to IMPORT/EXPORT/INTERNAL states
! ---------------------------------------------
#if(0)
#include "ACHEM_GetPointer___.h"
#endif
! Extract relevant runtime information
! ------------------------------------
call extract_(GC, CLOCK, self, GRID, CF, i1, i2, im, j1, j2, jm, km, nymd, nhms, cdt, __RC__)