CCPP SciDoc v7.0.0  v7.0.0
Common Community Physics Package Developed at DTC
 
Loading...
Searching...
No Matches
progsigma_calc.f90
1
2
7 module progsigma
8
9 implicit none
10
11 public progsigma_calc
12
13 contains
14
20 subroutine progsigma_calc (im,km,flag_init,flag_restart,flag_shallow,&
21 flag_mid,del,tmf,qmicro,dbyo1,zdqca,omega_u,zeta,hvap, &
22 delt,qadv,kbcon1,ktcon,cnvflg,betascu,betamcu,betadcu, &
23 sigmind,sigminm,sigmins,sigmain,sigmaout,sigmab)
24!
25!
26 use machine, only : kind_phys
27 use funcphys, only : fpvs
28
29 implicit none
30
31! intent in
32 integer, intent(in) :: im,km,kbcon1(im),ktcon(im)
33 real(kind=kind_phys), intent(in) :: hvap,delt,betascu,betamcu,betadcu, &
34 sigmind,sigminm,sigmins
35 real(kind=kind_phys), intent(in) :: qadv(im,km),del(im,km), &
36 qmicro(im,km),tmf(im,km),dbyo1(im,km),zdqca(im,km), &
37 omega_u(im,km),zeta(im,km)
38 logical, intent(in) :: flag_init,flag_restart,cnvflg(im),flag_shallow,flag_mid
39 real(kind=kind_phys), intent(in) :: sigmain(im,km)
40
41! intent out
42 real(kind=kind_phys), intent(out) :: sigmaout(im,km)
43 real(kind=kind_phys), intent(out) :: sigmab(im)
44
45
46! Local variables
47 integer :: i,k,km1
48 real(kind=kind_phys) :: terma(im),termb(im),termc(im),termd(im)
49 real(kind=kind_phys) :: mcons(im),fdqa(im),form(im,km), &
50 dp(im,km),inbu(im,km)
51
52
53 real(kind=kind_phys) :: gcvalmx,epsilon,zz,cvg,mcon,buy2, &
54 fdqb,dtdyn,dxlim,rmulacvg,tem, &
55 den,dp1,invdelt
56
57 !Parameters
58 gcvalmx = 0.1
59 rmulacvg=10.
60 epsilon=1.e-11
61 km1=km-1
62 invdelt = 1./delt
63
64 !Initialization 2D
65 do k = 1,km
66 do i = 1,im
67 inbu(i,k)=0.
68 form(i,k)=0.
69 dp(i,k)=0.
70 enddo
71 enddo
72
73 !Initialization 1D
74 do i=1,im
75 sigmab(i)=0.
76 terma(i)=0.
77 termb(i)=0.
78 termc(i)=0.
79 termd(i)=0.
80 fdqa(i)=0.
81 mcons(i)=0.
82 enddo
83
84 do k = 2,km1
85 do i = 1,im
86 if(cnvflg(i))then
87 dp(i,k) = 1000. * del(i,k)
88 endif
89 enddo
90 enddo
91
92 !Initial computations, place maximum sigmain in sigmab
93 do i=1,im
94 if(cnvflg(i))then
95 do k=2,km
96 if(sigmain(i,k)>sigmab(i))then
97 sigmab(i)=sigmain(i,k)
98 endif
99 enddo
100 endif
101 enddo
102
103 do i=1,im
104 if(cnvflg(i))then
105 if(sigmab(i) < 1.e-5)then !after advection
106 sigmab(i)=0.
107 endif
108 endif
109 enddo
110
111 !compute termD "The vertical integral of the latent heat convergence is limited to the
112 !buoyant layers with positive moisture convergence (accumulated from the surface).
113 !Lowest level:
114 do i = 1,im
115 dp1 = 1000. * del(i,1)
116 mcons(i)=(hvap*(qadv(i,1)+tmf(i,1)+qmicro(i,1))*dp1)
117 enddo
118 !Levels above:
119 do k = 2,km1
120 do i = 1,im
121 if(cnvflg(i))then
122 mcon = (hvap*(qadv(i,k)+tmf(i,k)+qmicro(i,k))*dp(i,k))
123 buy2 = termd(i)+mcon+mcons(i)
124! Do the integral over buoyant layers with positive mcon acc from surface
125 if(dbyo1(i,k)>0 .and. buy2 > 0.)then
126 inbu(i,k)=1.
127 endif
128 inbu(i,k-1)=max(inbu(i,k-1),inbu(i,k))
129 termd(i) = termd(i) + inbu(i,k-1)*mcons(i)
130 mcons(i)=mcon
131 endif
132 enddo
133 enddo
134
135 !termA
136 do k = 2,km1
137 do i = 1,im
138 if(cnvflg(i))then
139 tem=sigmab(i)*zeta(i,k)*inbu(i,k)*dbyo1(i,k)*dp(i,k)
140 terma(i)=terma(i)+tem
141 endif
142 enddo
143 enddo
144
145 !termB
146 do k = 2,km1
147 do i = 1,im
148 if(cnvflg(i))then
149 tem=zeta(i,k)*dbyo1(i,k)*inbu(i,k)*dp(i,k)
150 termb(i)=termb(i)+tem
151 endif
152 enddo
153 enddo
154
155 !termC
156 do k = 2,km1
157 do i = 1,im
158 if(cnvflg(i))then
159 form(i,k)=-1.0*inbu(i,k)*(omega_u(i,k)*delt)
160 fdqb=0.5*((form(i,k)*zdqca(i,k)))
161 termc(i)=termc(i)+inbu(i,k)* &
162 (fdqb+fdqa(i))*hvap*zeta(i,k)
163 fdqa(i)=fdqb
164 endif
165 enddo
166 enddo
167
168 !sigmab
169 if(flag_init .and. .not. flag_restart)then
170 do i = 1,im
171 if(cnvflg(i))then
172 sigmab(i)=0.03
173 endif
174 enddo
175 else
176 do i = 1,im
177 if(cnvflg(i))then
178 den=min(termc(i)+termb(i),1.e8)
179 cvg=termd(i)*delt
180 zz=max(0.0,sign(1.0,terma(i))) &
181 *max(0.0,sign(1.0,termb(i))) &
182 *max(0.0,sign(1.0,termc(i)-epsilon))
183 cvg=max(0.0,cvg)
184 sigmab(i)=(zz*(terma(i)+cvg))/(den+(1.0-zz))
185 if(sigmab(i)>0.)then
186 sigmab(i)=min(sigmab(i),0.95)
187 sigmab(i)=max(sigmab(i),0.01)
188 endif
189 endif!cnvflg
190 enddo
191 endif
192
193 do k=1,km
194 do i=1,im
195 if(cnvflg(i))then
196 sigmaout(i,k)=sigmab(i)
197 endif
198 enddo
199 enddo
200
201 !Reduce area fraction before coupling back to mass-flux computation.
202 if(flag_shallow)then
203 do i= 1, im
204 if(cnvflg(i)) then
205 sigmab(i)=sigmab(i)/betascu
206 sigmab(i)=max(sigmins,sigmab(i))
207 endif
208 enddo
209 elseif(flag_mid)then
210 do i= 1, im
211 if(cnvflg(i)) then
212 sigmab(i)=sigmab(i)/betamcu
213 sigmab(i)=max(sigminm,sigmab(i))
214 endif
215 enddo
216 else
217 do i= 1, im
218 if(cnvflg(i)) then
219 sigmab(i)=sigmab(i)/betadcu
220 sigmab(i)=max(sigmind,sigmab(i))
221 endif
222 enddo
223 endif
224 do i= 1, im
225 sigmab(i) = min(0.95,sigmab(i))
226 enddo
227
228 end subroutine progsigma_calc
229
230end module progsigma
This module contains the subroutine that calculates the prognostic updraft area fraction that is used...