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 : state, 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 : use physics_types, only: physics_state
68 :
69 : ! args
70 :
71 : type(physics_state), intent(in) :: state ! Physics state variables
72 : integer, intent(in) :: ncol
73 : integer, intent(in) :: lchnk ! chunk id
74 : integer, intent(in) :: loffset
75 :
76 : real(r8), intent(in) :: dtime ! time step (sec)
77 :
78 : real(r8), intent(in) :: mbar(:,:) ! mean wet atmospheric mass ( amu )
79 : real(r8), intent(in) :: pdel(:,:)
80 : real(r8), intent(in) :: press(:,:)
81 : real(r8), intent(in) :: tfld(:,:)
82 :
83 : real(r8), intent(in) :: cldnum(:,:)
84 : real(r8), intent(in) :: cldfrc(:,:)
85 : real(r8), intent(in) :: cfact(:,:)
86 : real(r8), intent(in) :: xlwc(:,:)
87 :
88 : real(r8), intent(in) :: delso4_hprxn(:,:)
89 : real(r8), intent(in) :: xh2so4(:,:)
90 : real(r8), intent(in) :: xso4(:,:)
91 : real(r8), intent(in) :: xso4_init(:,:)
92 : real(r8), intent(in) :: nh3g(:,:)
93 : real(r8), intent(in) :: hno3g(:,:)
94 : real(r8), intent(in) :: xnh3(:,:)
95 : real(r8), intent(in) :: xhno3(:,:)
96 : real(r8), intent(in) :: xnh4c(:,:)
97 : real(r8), intent(in) :: xmsa(:,:)
98 : real(r8), intent(in) :: xso2(:,:)
99 : real(r8), intent(in) :: xh2o2(:,:)
100 : real(r8), intent(in) :: xno3c(:,:)
101 :
102 : real(r8), intent(inout) :: qcw(:,:,:) ! cloud-borne aerosol (vmr)
103 : real(r8), intent(inout) :: qin(:,:,:) ! xported species ( vmr )
104 :
105 : real(r8), intent(out) :: aqso4(:,:) ! aqueous phase chemistry
106 : real(r8), intent(out) :: aqh2so4(:,:) ! aqueous phase chemistry
107 : real(r8), intent(out) :: aqso4_h2o2(:) ! SO4 aqueous phase chemistry due to H2O2 (kg/m2)
108 : real(r8), intent(out) :: aqso4_o3(:) ! SO4 aqueous phase chemistry due to O3 (kg/m2)
109 : real(r8), intent(out), optional :: aqso4_h2o2_3d(:,:) ! SO4 aqueous phase chemistry due to H2O2 (kg/m2)
110 : real(r8), intent(out), optional :: aqso4_o3_3d(:,:) ! SO4 aqueous phase chemistry due to O3 (kg/m2)
111 :
112 : ! local vars ...
113 :
114 : integer :: k
115 :
116 : !==============================================================
117 : ! ... Update the mixing ratios
118 : !==============================================================
119 0 : do k = 1,pver
120 :
121 0 : if (id_so2>0) then
122 0 : qin(:,k,id_so2) = MAX( xso2(:,k), small_value )
123 : endif
124 0 : if (id_h2o2>0) then
125 0 : qin(:,k,id_h2o2)= MAX( xh2o2(:,k), small_value )
126 : endif
127 :
128 0 : qin(:,k,id_so4) = MAX( xso4(:,k), small_value )
129 :
130 : end do
131 :
132 0 : end subroutine sox_cldaero_update
133 :
134 : !----------------------------------------------------------------------------------
135 : !----------------------------------------------------------------------------------
136 0 : subroutine sox_cldaero_destroy_obj( conc_obj )
137 : type(cldaero_conc_t), pointer :: conc_obj
138 :
139 0 : call cldaero_deallocate( conc_obj )
140 :
141 0 : end subroutine sox_cldaero_destroy_obj
142 :
143 : end module sox_cldaero_mod
|