Line data Source code
1 : ! Include shortname defintions, so that the F77 code does not have to be modified to
2 : ! reference the CARMA structure.
3 : #include "carma_globaer.h"
4 :
5 : !! This routine calculates the dry deposition velocity, vd [cm s^-1]
6 : !! Method: Zhang et al., 2001
7 : !! vd = vf(pver) + 1./ (rs + ra)
8 : !! rs is the surface resistance, which is calculated in here
9 : !! ra is the aerodynamic resistance, which is from parent dynamic model, like CAM
10 : !! use carma_do_drydep flag optionally to decide if the CARMA or the parent model does the dry deposition
11 : !! @author Tianyi Fan
12 : !! @version Nov-2010
13 1050624 : subroutine setupvdry(carma, cstate, lndfv, ocnfv, icefv, lndram, ocnram, iceram, lndfrac, ocnfrac, icefrac, rc)
14 : ! types
15 : use carma_precision_mod
16 : use carma_enums_mod
17 : use carma_constants_mod
18 : use carma_types_mod
19 : use carmastate_mod
20 : use carma_mod
21 :
22 : implicit none
23 :
24 : type(carma_type), intent(in) :: carma !! the carma object
25 : type(carmastate_type), intent(inout) :: cstate !! the carma state object
26 : real(kind=f), intent(in) :: lndfv !! the surface friction velocity over land [cm/s]
27 : real(kind=f), intent(in) :: ocnfv !! the surface friction velocity over ocean [cm/s]
28 : real(kind=f), intent(in) :: icefv !! the surface friction velocity over ice [cm/s]
29 : real(kind=f), intent(in) :: lndram !! the aerodynamic resistance over land [s/cm]
30 : real(kind=f), intent(in) :: ocnram !! the aerodynamic resistance over ocean [s/cm]
31 : real(kind=f), intent(in) :: iceram !! the aerodynamic resistance over ice [s/cm]
32 : real(kind=f), intent(in) :: lndfrac !! land fraction
33 : real(kind=f), intent(in) :: ocnfrac !! ocn fraction
34 : real(kind=f), intent(in) :: icefrac !! ice fraction
35 : integer, intent(inout) :: rc !! return code, negative indicates failure
36 :
37 : ! Local declarations
38 : integer :: ielem, igroup, ibin, icnst, k
39 : real(kind=f) :: vd_lnd, vd_ocn, vd_ice ! the deposition velocity of land,ocean and sea ice
40 : real(kind=f) :: rs ! surface resistance [s/m]
41 2101248 : real(kind=f) :: vfall(NBIN, NGROUP) ! fall velocity [m/s]
42 : integer :: cnsttype ! if constituent is prognostic
43 : integer :: maxbin ! last prognostic bin
44 : integer :: ibot, ibotp1 ! index of bottom layer
45 :
46 :
47 1050624 : if (do_drydep) then
48 :
49 1050624 : if (igridv .eq. I_CART) then
50 0 : ibot = 1
51 0 : ibotp1 = 1
52 0 : vfall(:,:) = vf(ibotp1, :, :) ![cm/s]
53 : else
54 1050624 : ibot = NZ
55 1050624 : ibotp1 = NZP1
56 45176832 : vfall(:,:) = -vf(ibotp1, :, :) * zmetl(ibotp1) ! [z_unit/s] -> [cm/s]
57 : end if
58 :
59 8404992 : do ielem = 1, NELEM
60 7354368 : igroup = igelem(ielem)
61 :
62 8404992 : if (grp_do_drydep(igroup)) then
63 154441728 : do ibin = 1, NBIN
64 147087360 : vd_lnd = 0._f
65 147087360 : vd_ocn = 0._f
66 147087360 : vd_ice = 0._f
67 :
68 : ! land
69 147087360 : if (lndfrac > 0._f) then
70 0 : call calcrs(carma, cstate, lndfv, t(ibot), r_wet(ibot, ibin, igroup), &
71 55894580 : bpm(ibot, ibin, igroup), vfall(ibin,igroup), rs, 1, rc)
72 55894580 : vd_lnd = vfall(ibin, igroup) + 1._f / (lndram + rs)
73 : end if
74 :
75 : ! ocean
76 147087360 : if (ocnfrac > 0._f) then
77 0 : call calcrs(carma, cstate, ocnfv, t(ibot), r_wet(ibot, ibin, igroup), &
78 98570500 : bpm(ibot, ibin, igroup), vfall(ibin,igroup), rs, 2, rc)
79 98570500 : vd_ocn = vfall(ibin, igroup) + 1._f / (ocnram + rs)
80 : end if
81 :
82 : ! sea ice
83 147087360 : if (icefrac > 0._f) then
84 0 : call calcrs(carma, cstate, icefv, t(ibot), r_wet(ibot, ibin, igroup), &
85 20774320 : bpm(ibot, ibin, igroup), vfall(ibin,igroup), rs, 3, rc)
86 20774320 : vd_ice = vfall(ibin, igroup) + 1._f / (iceram + rs)
87 : end if
88 :
89 154441728 : vd(ibin, igroup) = (lndfrac * vd_lnd + ocnfrac * vd_ocn + icefrac * vd_ice) ![cm/s]
90 : end do ! ibin
91 : else
92 0 : vd(:, igroup) = vfall(:, igroup) ! [cm/s]
93 : end if ! if grp_do_drydep
94 : end do ! ielem
95 :
96 : ! change scale for non-catesian vertical coordinate
97 : ! Scale cartesian fallspeeds to the appropriate vertical coordinate system.
98 : ! Non--cartesion coordinates are assumed to be positive downward, but
99 : ! vertical velocities in this model are always assumed to be positive upward.
100 : if( igridv /= I_CART )then
101 1050624 : vd(:,:) = -vd(:,:) / zmetl(NZP1)
102 45176832 : end if
103 : end if
104 :
105 : return
106 1050624 : end
|