Line data Source code
1 : !----------------------------------------------------------------------------------
2 : ! Bulk aerosol implementation
3 : !----------------------------------------------------------------------------------
4 : module sox_cldaero_mod
5 :
6 : use shr_kind_mod, only : r8 => shr_kind_r8
7 : use cam_abortutils, only : endrun
8 : use ppgrid, only : pcols, pver
9 : use mo_chem_utls, only : get_spc_ndx
10 : use cldaero_mod, only : cldaero_conc_t, cldaero_allocate, cldaero_deallocate
11 :
12 : implicit none
13 : private
14 :
15 : public :: sox_cldaero_init
16 : public :: sox_cldaero_create_obj
17 : public :: sox_cldaero_update
18 : public :: sox_cldaero_destroy_obj
19 :
20 : integer :: id_so2, id_so4, id_h2o2
21 :
22 : real(r8), parameter :: small_value = 1.e-20_r8
23 :
24 : contains
25 :
26 : !----------------------------------------------------------------------------------
27 : !----------------------------------------------------------------------------------
28 :
29 0 : subroutine sox_cldaero_init
30 :
31 0 : id_so2 = get_spc_ndx( 'SO2' )
32 0 : id_so4 = get_spc_ndx( 'SO4' )
33 0 : id_h2o2 = get_spc_ndx( 'H2O2' )
34 :
35 0 : if ( id_so2<1 ) then
36 0 : call endrun('sox_cldaero_init: SO2 is not included in chemistry -- should not invoke sox_cldaero_mod...')
37 : endif
38 :
39 0 : end subroutine sox_cldaero_init
40 :
41 : !----------------------------------------------------------------------------------
42 : !----------------------------------------------------------------------------------
43 0 : function sox_cldaero_create_obj(cldfrc, qcw, lwc, cfact, ncol, loffset) result( conc_obj )
44 :
45 : real(r8), intent(in) :: cldfrc(:,:)
46 : real(r8), intent(in) :: qcw(:,:,:)
47 : real(r8), intent(in) :: lwc(:,:)
48 : real(r8), intent(in) :: cfact(:,:)
49 : integer, intent(in) :: ncol
50 : integer, intent(in) :: loffset
51 :
52 : type(cldaero_conc_t), pointer :: conc_obj
53 :
54 0 : conc_obj => cldaero_allocate()
55 :
56 0 : conc_obj%xlwc(:ncol,:) = lwc(:ncol,:)*cfact(:ncol,:) ! cloud water L(water)/L(air)
57 :
58 0 : end function sox_cldaero_create_obj
59 :
60 : !----------------------------------------------------------------------------------
61 : ! Update the mixing ratios
62 : !----------------------------------------------------------------------------------
63 0 : subroutine sox_cldaero_update( &
64 : ncol, lchnk, loffset, dtime, mbar, pdel, press, tfld, cldnum, cldfrc, cfact, xlwc, &
65 0 : delso4_hprxn, xh2so4, xso4, xso4_init, nh3g, hno3g, xnh3, xhno3, xnh4c, xno3c, xmsa, xso2, xh2o2, qcw, qin, &
66 : aqso4, aqh2so4, aqso4_h2o2, aqso4_o3, aqso4_h2o2_3d, aqso4_o3_3d )
67 :
68 : ! args
69 :
70 : integer, intent(in) :: ncol
71 : integer, intent(in) :: lchnk ! chunk id
72 : integer, intent(in) :: loffset
73 :
74 : real(r8), intent(in) :: dtime ! time step (sec)
75 :
76 : real(r8), intent(in) :: mbar(:,:) ! mean wet atmospheric mass ( amu )
77 : real(r8), intent(in) :: pdel(:,:)
78 : real(r8), intent(in) :: press(:,:)
79 : real(r8), intent(in) :: tfld(:,:)
80 :
81 : real(r8), intent(in) :: cldnum(:,:)
82 : real(r8), intent(in) :: cldfrc(:,:)
83 : real(r8), intent(in) :: cfact(:,:)
84 : real(r8), intent(in) :: xlwc(:,:)
85 :
86 : real(r8), intent(in) :: delso4_hprxn(:,:)
87 : real(r8), intent(in) :: xh2so4(:,:)
88 : real(r8), intent(in) :: xso4(:,:)
89 : real(r8), intent(in) :: xso4_init(:,:)
90 : real(r8), intent(in) :: nh3g(:,:)
91 : real(r8), intent(in) :: hno3g(:,:)
92 : real(r8), intent(in) :: xnh3(:,:)
93 : real(r8), intent(in) :: xhno3(:,:)
94 : real(r8), intent(in) :: xnh4c(:,:)
95 : real(r8), intent(in) :: xmsa(:,:)
96 : real(r8), intent(in) :: xso2(:,:)
97 : real(r8), intent(in) :: xh2o2(:,:)
98 : real(r8), intent(in) :: xno3c(:,:)
99 :
100 : real(r8), intent(inout) :: qcw(:,:,:) ! cloud-borne aerosol (vmr)
101 : real(r8), intent(inout) :: qin(:,:,:) ! xported species ( vmr )
102 :
103 : real(r8), intent(out) :: aqso4(:,:) ! aqueous phase chemistry
104 : real(r8), intent(out) :: aqh2so4(:,:) ! aqueous phase chemistry
105 : real(r8), intent(out) :: aqso4_h2o2(:) ! SO4 aqueous phase chemistry due to H2O2 (kg/m2)
106 : real(r8), intent(out) :: aqso4_o3(:) ! SO4 aqueous phase chemistry due to O3 (kg/m2)
107 : real(r8), intent(out), optional :: aqso4_h2o2_3d(:,:) ! SO4 aqueous phase chemistry due to H2O2 (kg/m2)
108 : real(r8), intent(out), optional :: aqso4_o3_3d(:,:) ! SO4 aqueous phase chemistry due to O3 (kg/m2)
109 :
110 : ! local vars ...
111 :
112 : integer :: k
113 :
114 : !==============================================================
115 : ! ... Update the mixing ratios
116 : !==============================================================
117 0 : do k = 1,pver
118 :
119 0 : if (id_so2>0) then
120 0 : qin(:,k,id_so2) = MAX( xso2(:,k), small_value )
121 : endif
122 0 : if (id_h2o2>0) then
123 0 : qin(:,k,id_h2o2)= MAX( xh2o2(:,k), small_value )
124 : endif
125 :
126 0 : qin(:,k,id_so4) = MAX( xso4(:,k), small_value )
127 :
128 : end do
129 :
130 0 : end subroutine sox_cldaero_update
131 :
132 : !----------------------------------------------------------------------------------
133 : !----------------------------------------------------------------------------------
134 0 : subroutine sox_cldaero_destroy_obj( conc_obj )
135 : type(cldaero_conc_t), pointer :: conc_obj
136 :
137 0 : call cldaero_deallocate( conc_obj )
138 :
139 0 : end subroutine sox_cldaero_destroy_obj
140 :
141 : end module sox_cldaero_mod
|