[1647] | 1 | subroutine vdifc(ngrid,nlay,nq,ppopsk, |
---|
[253] | 2 | & ptimestep,pcapcal,lecrit, |
---|
| 3 | & pplay,pplev,pzlay,pzlev,pz0, |
---|
| 4 | & pu,pv,ph,pq,ptsrf,pemis,pqsurf, |
---|
[1477] | 5 | & pdhfi,pdqfi,pfluxsrf, |
---|
[594] | 6 | & pdudif,pdvdif,pdhdif,pdtsrf,sensibFlux,pq2, |
---|
[303] | 7 | & pdqdif,pdqsdif,lastcall) |
---|
[135] | 8 | |
---|
[600] | 9 | use radcommon_h, only : sigma |
---|
[787] | 10 | USE surfdat_h |
---|
| 11 | USE tracer_h |
---|
[1384] | 12 | use comcstfi_mod, only: g, r, cpp, rcp |
---|
[1647] | 13 | use callkeys_mod, only: tracer,nosurf |
---|
[2743] | 14 | use turb_mod, only: ustar |
---|
[135] | 15 | |
---|
| 16 | implicit none |
---|
| 17 | |
---|
[253] | 18 | !================================================================== |
---|
| 19 | ! |
---|
| 20 | ! Purpose |
---|
| 21 | ! ------- |
---|
| 22 | ! Turbulent diffusion (mixing) for pot. T, U, V and tracers |
---|
| 23 | ! |
---|
| 24 | ! Implicit scheme |
---|
| 25 | ! We start by adding to variables x the physical tendencies |
---|
| 26 | ! already computed. We resolve the equation: |
---|
| 27 | ! |
---|
| 28 | ! x(t+1) = x(t) + dt * (dx/dt)phys(t) + dt * (dx/dt)difv(t+1) |
---|
| 29 | ! |
---|
| 30 | ! Authors |
---|
| 31 | ! ------- |
---|
| 32 | ! F. Hourdin, F. Forget, R. Fournier (199X) |
---|
| 33 | ! R. Wordsworth, B. Charnay (2010) |
---|
| 34 | ! |
---|
| 35 | !================================================================== |
---|
[135] | 36 | |
---|
[253] | 37 | !----------------------------------------------------------------------- |
---|
| 38 | ! declarations |
---|
| 39 | ! ------------ |
---|
[135] | 40 | |
---|
| 41 | |
---|
[253] | 42 | ! arguments |
---|
| 43 | ! --------- |
---|
[135] | 44 | INTEGER ngrid,nlay |
---|
| 45 | REAL ptimestep |
---|
| 46 | REAL pplay(ngrid,nlay),pplev(ngrid,nlay+1) |
---|
| 47 | REAL pzlay(ngrid,nlay),pzlev(ngrid,nlay+1) |
---|
| 48 | REAL pu(ngrid,nlay),pv(ngrid,nlay),ph(ngrid,nlay) |
---|
| 49 | REAL ptsrf(ngrid),pemis(ngrid) |
---|
[1477] | 50 | REAL pdhfi(ngrid,nlay) |
---|
[135] | 51 | REAL pfluxsrf(ngrid) |
---|
| 52 | REAL pdudif(ngrid,nlay),pdvdif(ngrid,nlay),pdhdif(ngrid,nlay) |
---|
[594] | 53 | REAL pdtsrf(ngrid),sensibFlux(ngrid),pcapcal(ngrid) |
---|
[135] | 54 | REAL pq2(ngrid,nlay+1) |
---|
[1647] | 55 | |
---|
[135] | 56 | |
---|
[253] | 57 | ! Arguments added for condensation |
---|
[135] | 58 | REAL ppopsk(ngrid,nlay) |
---|
| 59 | logical lecrit |
---|
| 60 | REAL pz0 |
---|
| 61 | |
---|
[253] | 62 | ! Tracers |
---|
| 63 | ! -------- |
---|
[135] | 64 | integer nq |
---|
[253] | 65 | real pqsurf(ngrid,nq) |
---|
[135] | 66 | real pq(ngrid,nlay,nq), pdqfi(ngrid,nlay,nq) |
---|
| 67 | real pdqdif(ngrid,nlay,nq) |
---|
| 68 | real pdqsdif(ngrid,nq) |
---|
| 69 | |
---|
[253] | 70 | ! local |
---|
| 71 | ! ----- |
---|
| 72 | integer ilev,ig,ilay,nlev |
---|
[135] | 73 | |
---|
[787] | 74 | REAL z4st,zdplanck(ngrid) |
---|
[1308] | 75 | REAL zkv(ngrid,nlay+1),zkh(ngrid,nlay+1) |
---|
[787] | 76 | REAL zcdv(ngrid),zcdh(ngrid) |
---|
| 77 | REAL zcdv_true(ngrid),zcdh_true(ngrid) |
---|
[1308] | 78 | REAL zu(ngrid,nlay),zv(ngrid,nlay) |
---|
| 79 | REAL zh(ngrid,nlay) |
---|
[787] | 80 | REAL ztsrf2(ngrid) |
---|
| 81 | REAL z1(ngrid),z2(ngrid) |
---|
[1308] | 82 | REAL za(ngrid,nlay),zb(ngrid,nlay) |
---|
| 83 | REAL zb0(ngrid,nlay) |
---|
| 84 | REAL zc(ngrid,nlay),zd(ngrid,nlay) |
---|
[135] | 85 | REAL zcst1 |
---|
[253] | 86 | REAL zu2!, a |
---|
[1308] | 87 | REAL zcq(ngrid,nlay),zdq(ngrid,nlay) |
---|
[787] | 88 | REAL evap(ngrid) |
---|
| 89 | REAL zcq0(ngrid),zdq0(ngrid) |
---|
| 90 | REAL zx_alf1(ngrid),zx_alf2(ngrid) |
---|
[135] | 91 | |
---|
| 92 | LOGICAL firstcall |
---|
| 93 | SAVE firstcall |
---|
[1315] | 94 | !$OMP THREADPRIVATE(firstcall) |
---|
[303] | 95 | |
---|
| 96 | LOGICAL lastcall |
---|
[135] | 97 | |
---|
[253] | 98 | ! variables added for CO2 condensation |
---|
| 99 | ! ------------------------------------ |
---|
[1668] | 100 | REAL hh |
---|
[135] | 101 | |
---|
[253] | 102 | ! Tracers |
---|
| 103 | ! ------- |
---|
[135] | 104 | INTEGER iq |
---|
[1308] | 105 | REAL zq(ngrid,nlay,nq) |
---|
[787] | 106 | REAL zq1temp(ngrid) |
---|
| 107 | REAL rho(ngrid) ! near-surface air density |
---|
| 108 | REAL qsat(ngrid) |
---|
[135] | 109 | DATA firstcall/.true./ |
---|
| 110 | REAL kmixmin |
---|
| 111 | |
---|
[253] | 112 | real, parameter :: karman=0.4 |
---|
| 113 | real cd0, roughratio |
---|
[135] | 114 | |
---|
[253] | 115 | real masse, Wtot, Wdiff |
---|
[135] | 116 | |
---|
[253] | 117 | real dqsdif_total(ngrid) |
---|
| 118 | real zq0(ngrid) |
---|
[135] | 119 | |
---|
| 120 | |
---|
[253] | 121 | ! Coherence test |
---|
| 122 | ! -------------- |
---|
[135] | 123 | |
---|
[253] | 124 | IF (firstcall) THEN |
---|
| 125 | firstcall=.false. |
---|
| 126 | ENDIF |
---|
| 127 | |
---|
| 128 | !----------------------------------------------------------------------- |
---|
| 129 | ! 1. Initialisation |
---|
| 130 | ! ----------------- |
---|
| 131 | |
---|
[135] | 132 | nlev=nlay+1 |
---|
| 133 | |
---|
[253] | 134 | ! Calculate rho*dz and dt*rho/dz=dt*rho**2 g/dp |
---|
| 135 | ! with rho=p/RT=p/ (R Theta) (p/ps)**kappa |
---|
| 136 | ! --------------------------------------------- |
---|
[135] | 137 | |
---|
| 138 | DO ilay=1,nlay |
---|
| 139 | DO ig=1,ngrid |
---|
| 140 | za(ig,ilay)=(pplev(ig,ilay)-pplev(ig,ilay+1))/g |
---|
| 141 | ENDDO |
---|
| 142 | ENDDO |
---|
| 143 | |
---|
[253] | 144 | zcst1=4.*g*ptimestep/(R*R) |
---|
[135] | 145 | DO ilev=2,nlev-1 |
---|
| 146 | DO ig=1,ngrid |
---|
| 147 | zb0(ig,ilev)=pplev(ig,ilev)* |
---|
[253] | 148 | s (pplev(ig,1)/pplev(ig,ilev))**rcp / |
---|
| 149 | s (ph(ig,ilev-1)+ph(ig,ilev)) |
---|
[135] | 150 | zb0(ig,ilev)=zcst1*zb0(ig,ilev)*zb0(ig,ilev)/ |
---|
[253] | 151 | s (pplay(ig,ilev-1)-pplay(ig,ilev)) |
---|
[135] | 152 | ENDDO |
---|
| 153 | ENDDO |
---|
| 154 | DO ig=1,ngrid |
---|
[253] | 155 | zb0(ig,1)=ptimestep*pplev(ig,1)/(R*ptsrf(ig)) |
---|
[135] | 156 | ENDDO |
---|
| 157 | |
---|
[253] | 158 | dqsdif_total(:)=0.0 |
---|
[135] | 159 | |
---|
[253] | 160 | !----------------------------------------------------------------------- |
---|
| 161 | ! 2. Add the physical tendencies computed so far |
---|
| 162 | ! ---------------------------------------------- |
---|
[135] | 163 | |
---|
| 164 | DO ilev=1,nlay |
---|
| 165 | DO ig=1,ngrid |
---|
[1477] | 166 | zu(ig,ilev)=pu(ig,ilev) |
---|
| 167 | zv(ig,ilev)=pv(ig,ilev) |
---|
[135] | 168 | zh(ig,ilev)=ph(ig,ilev)+pdhfi(ig,ilev)*ptimestep |
---|
| 169 | ENDDO |
---|
| 170 | ENDDO |
---|
| 171 | if(tracer) then |
---|
[253] | 172 | DO iq =1, nq |
---|
| 173 | DO ilev=1,nlay |
---|
| 174 | DO ig=1,ngrid |
---|
| 175 | zq(ig,ilev,iq)=pq(ig,ilev,iq) + |
---|
| 176 | & pdqfi(ig,ilev,iq)*ptimestep |
---|
| 177 | ENDDO |
---|
| 178 | ENDDO |
---|
[135] | 179 | ENDDO |
---|
| 180 | end if |
---|
| 181 | |
---|
[253] | 182 | !----------------------------------------------------------------------- |
---|
| 183 | ! 3. Turbulence scheme |
---|
| 184 | ! -------------------- |
---|
| 185 | ! |
---|
| 186 | ! Source of turbulent kinetic energy at the surface |
---|
| 187 | ! ------------------------------------------------- |
---|
| 188 | ! Formula is Cd_0 = (karman / log[1+z1/z0])^2 |
---|
[135] | 189 | |
---|
[253] | 190 | DO ig=1,ngrid |
---|
| 191 | roughratio = 1.E+0 + pzlay(ig,1)/pz0 |
---|
| 192 | cd0 = karman/log(roughratio) |
---|
| 193 | cd0 = cd0*cd0 |
---|
| 194 | zcdv_true(ig) = cd0 |
---|
| 195 | zcdh_true(ig) = cd0 |
---|
[952] | 196 | if (nosurf) then |
---|
| 197 | zcdv_true(ig) = 0. !! disable sensible momentum flux |
---|
| 198 | zcdh_true(ig) = 0. !! disable sensible heat flux |
---|
| 199 | endif |
---|
[253] | 200 | ENDDO |
---|
[135] | 201 | |
---|
| 202 | DO ig=1,ngrid |
---|
[253] | 203 | zu2=pu(ig,1)*pu(ig,1)+pv(ig,1)*pv(ig,1) |
---|
| 204 | zcdv(ig)=zcdv_true(ig)*sqrt(zu2) |
---|
| 205 | zcdh(ig)=zcdh_true(ig)*sqrt(zu2) |
---|
[2743] | 206 | ustar(ig)=sqrt(zcdv_true(ig))*sqrt(zu2) |
---|
[135] | 207 | ENDDO |
---|
| 208 | |
---|
[253] | 209 | ! Turbulent diffusion coefficients in the boundary layer |
---|
| 210 | ! ------------------------------------------------------ |
---|
[135] | 211 | |
---|
[1308] | 212 | call vdif_kc(ngrid,nlay,ptimestep,g,pzlev,pzlay |
---|
[253] | 213 | & ,pu,pv,ph,zcdv_true |
---|
| 214 | & ,pq2,zkv,zkh) |
---|
[135] | 215 | |
---|
[253] | 216 | ! Adding eddy mixing to mimic 3D general circulation in 1D |
---|
| 217 | ! R. Wordsworth & F. Forget (2010) |
---|
[135] | 218 | if ((ngrid.eq.1)) then |
---|
[253] | 219 | kmixmin = 1.0e-2 ! minimum eddy mix coeff in 1D |
---|
| 220 | do ilev=1,nlay |
---|
| 221 | do ig=1,ngrid |
---|
| 222 | !zkh(ig,ilev) = 1.0 |
---|
| 223 | zkh(ig,ilev) = max(kmixmin,zkh(ig,ilev)) |
---|
| 224 | zkv(ig,ilev) = max(kmixmin,zkv(ig,ilev)) |
---|
| 225 | end do |
---|
| 226 | end do |
---|
[135] | 227 | end if |
---|
| 228 | |
---|
[253] | 229 | !----------------------------------------------------------------------- |
---|
| 230 | ! 4. Implicit inversion of u |
---|
| 231 | ! -------------------------- |
---|
[135] | 232 | |
---|
[253] | 233 | ! u(t+1) = u(t) + dt * {(du/dt)phys}(t) + dt * {(du/dt)difv}(t+1) |
---|
| 234 | ! avec |
---|
| 235 | ! /zu/ = u(t) + dt * {(du/dt)phys}(t) (voir paragraphe 2.) |
---|
| 236 | ! et |
---|
| 237 | ! dt * {(du/dt)difv}(t+1) = dt * {(d/dz)[ Ku (du/dz) ]}(t+1) |
---|
| 238 | ! donc les entrees sont /zcdv/ pour la condition a la limite sol |
---|
| 239 | ! et /zkv/ = Ku |
---|
| 240 | |
---|
[135] | 241 | CALL multipl((nlay-1)*ngrid,zkv(1,2),zb0(1,2),zb(1,2)) |
---|
| 242 | CALL multipl(ngrid,zcdv,zb0,zb) |
---|
| 243 | |
---|
| 244 | DO ig=1,ngrid |
---|
| 245 | z1(ig)=1./(za(ig,nlay)+zb(ig,nlay)) |
---|
| 246 | zc(ig,nlay)=za(ig,nlay)*zu(ig,nlay)*z1(ig) |
---|
| 247 | zd(ig,nlay)=zb(ig,nlay)*z1(ig) |
---|
| 248 | ENDDO |
---|
| 249 | |
---|
| 250 | DO ilay=nlay-1,1,-1 |
---|
| 251 | DO ig=1,ngrid |
---|
| 252 | z1(ig)=1./(za(ig,ilay)+zb(ig,ilay)+ |
---|
[253] | 253 | $ zb(ig,ilay+1)*(1.-zd(ig,ilay+1))) |
---|
[135] | 254 | zc(ig,ilay)=(za(ig,ilay)*zu(ig,ilay)+ |
---|
[253] | 255 | $ zb(ig,ilay+1)*zc(ig,ilay+1))*z1(ig) |
---|
[135] | 256 | zd(ig,ilay)=zb(ig,ilay)*z1(ig) |
---|
| 257 | ENDDO |
---|
| 258 | ENDDO |
---|
| 259 | |
---|
| 260 | DO ig=1,ngrid |
---|
| 261 | zu(ig,1)=zc(ig,1) |
---|
| 262 | ENDDO |
---|
| 263 | DO ilay=2,nlay |
---|
| 264 | DO ig=1,ngrid |
---|
| 265 | zu(ig,ilay)=zc(ig,ilay)+zd(ig,ilay)*zu(ig,ilay-1) |
---|
| 266 | ENDDO |
---|
| 267 | ENDDO |
---|
| 268 | |
---|
[253] | 269 | !----------------------------------------------------------------------- |
---|
| 270 | ! 5. Implicit inversion of v |
---|
| 271 | ! -------------------------- |
---|
[135] | 272 | |
---|
[253] | 273 | ! v(t+1) = v(t) + dt * {(dv/dt)phys}(t) + dt * {(dv/dt)difv}(t+1) |
---|
| 274 | ! avec |
---|
| 275 | ! /zv/ = v(t) + dt * {(dv/dt)phys}(t) (voir paragraphe 2.) |
---|
| 276 | ! et |
---|
| 277 | ! dt * {(dv/dt)difv}(t+1) = dt * {(d/dz)[ Kv (dv/dz) ]}(t+1) |
---|
| 278 | ! donc les entrees sont /zcdv/ pour la condition a la limite sol |
---|
| 279 | ! et /zkv/ = Kv |
---|
[135] | 280 | |
---|
| 281 | DO ig=1,ngrid |
---|
| 282 | z1(ig)=1./(za(ig,nlay)+zb(ig,nlay)) |
---|
| 283 | zc(ig,nlay)=za(ig,nlay)*zv(ig,nlay)*z1(ig) |
---|
| 284 | zd(ig,nlay)=zb(ig,nlay)*z1(ig) |
---|
| 285 | ENDDO |
---|
| 286 | |
---|
| 287 | DO ilay=nlay-1,1,-1 |
---|
| 288 | DO ig=1,ngrid |
---|
| 289 | z1(ig)=1./(za(ig,ilay)+zb(ig,ilay)+ |
---|
[253] | 290 | $ zb(ig,ilay+1)*(1.-zd(ig,ilay+1))) |
---|
[135] | 291 | zc(ig,ilay)=(za(ig,ilay)*zv(ig,ilay)+ |
---|
[253] | 292 | $ zb(ig,ilay+1)*zc(ig,ilay+1))*z1(ig) |
---|
[135] | 293 | zd(ig,ilay)=zb(ig,ilay)*z1(ig) |
---|
| 294 | ENDDO |
---|
| 295 | ENDDO |
---|
| 296 | |
---|
| 297 | DO ig=1,ngrid |
---|
| 298 | zv(ig,1)=zc(ig,1) |
---|
| 299 | ENDDO |
---|
| 300 | DO ilay=2,nlay |
---|
| 301 | DO ig=1,ngrid |
---|
| 302 | zv(ig,ilay)=zc(ig,ilay)+zd(ig,ilay)*zv(ig,ilay-1) |
---|
| 303 | ENDDO |
---|
| 304 | ENDDO |
---|
| 305 | |
---|
[253] | 306 | !---------------------------------------------------------------------------- |
---|
| 307 | ! 6. Implicit inversion of h, not forgetting the coupling with the ground |
---|
[135] | 308 | |
---|
[253] | 309 | ! h(t+1) = h(t) + dt * {(dh/dt)phys}(t) + dt * {(dh/dt)difv}(t+1) |
---|
| 310 | ! avec |
---|
| 311 | ! /zh/ = h(t) + dt * {(dh/dt)phys}(t) (voir paragraphe 2.) |
---|
| 312 | ! et |
---|
| 313 | ! dt * {(dh/dt)difv}(t+1) = dt * {(d/dz)[ Kh (dh/dz) ]}(t+1) |
---|
| 314 | ! donc les entrees sont /zcdh/ pour la condition de raccord au sol |
---|
| 315 | ! et /zkh/ = Kh |
---|
[135] | 316 | |
---|
[253] | 317 | ! Using the wind modified by friction for lifting and sublimation |
---|
| 318 | ! --------------------------------------------------------------- |
---|
| 319 | DO ig=1,ngrid |
---|
| 320 | zu2 = zu(ig,1)*zu(ig,1)+zv(ig,1)*zv(ig,1) |
---|
| 321 | zcdv(ig) = zcdv_true(ig)*sqrt(zu2) |
---|
| 322 | zcdh(ig) = zcdh_true(ig)*sqrt(zu2) |
---|
| 323 | ENDDO |
---|
| 324 | |
---|
[135] | 325 | CALL multipl((nlay-1)*ngrid,zkh(1,2),zb0(1,2),zb(1,2)) |
---|
| 326 | CALL multipl(ngrid,zcdh,zb0,zb) |
---|
| 327 | |
---|
| 328 | DO ig=1,ngrid |
---|
| 329 | z1(ig)=1./(za(ig,nlay)+zb(ig,nlay)) |
---|
| 330 | zc(ig,nlay)=za(ig,nlay)*zh(ig,nlay)*z1(ig) |
---|
| 331 | zd(ig,nlay)=zb(ig,nlay)*z1(ig) |
---|
| 332 | ENDDO |
---|
| 333 | |
---|
[253] | 334 | DO ilay=nlay-1,2,-1 |
---|
[135] | 335 | DO ig=1,ngrid |
---|
| 336 | z1(ig)=1./(za(ig,ilay)+zb(ig,ilay)+ |
---|
[253] | 337 | & zb(ig,ilay+1)*(1.-zd(ig,ilay+1))) |
---|
[135] | 338 | zc(ig,ilay)=(za(ig,ilay)*zh(ig,ilay)+ |
---|
[253] | 339 | & zb(ig,ilay+1)*zc(ig,ilay+1))*z1(ig) |
---|
[135] | 340 | zd(ig,ilay)=zb(ig,ilay)*z1(ig) |
---|
| 341 | ENDDO |
---|
| 342 | ENDDO |
---|
| 343 | |
---|
| 344 | DO ig=1,ngrid |
---|
[253] | 345 | z1(ig)=1./(za(ig,1)+zb(ig,1)+ |
---|
| 346 | & zb(ig,2)*(1.-zd(ig,2))) |
---|
| 347 | zc(ig,1)=(za(ig,1)*zh(ig,1)+ |
---|
| 348 | & zb(ig,2)*zc(ig,2))*z1(ig) |
---|
| 349 | zd(ig,1)=zb(ig,1)*z1(ig) |
---|
[135] | 350 | ENDDO |
---|
| 351 | |
---|
[253] | 352 | ! Calculate (d Planck / dT) at the interface temperature |
---|
| 353 | ! ------------------------------------------------------ |
---|
[135] | 354 | |
---|
[253] | 355 | z4st=4.0*sigma*ptimestep |
---|
[135] | 356 | DO ig=1,ngrid |
---|
[253] | 357 | zdplanck(ig)=z4st*pemis(ig)*ptsrf(ig)*ptsrf(ig)*ptsrf(ig) |
---|
[135] | 358 | ENDDO |
---|
| 359 | |
---|
[253] | 360 | ! Calculate temperature tendency at the interface (dry case) |
---|
| 361 | ! ---------------------------------------------------------- |
---|
| 362 | ! Sum of fluxes at interface at time t + \delta t gives change in T: |
---|
| 363 | ! radiative fluxes |
---|
| 364 | ! turbulent convective (sensible) heat flux |
---|
| 365 | ! flux (if any) from subsurface |
---|
[135] | 366 | |
---|
[253] | 367 | |
---|
[135] | 368 | DO ig=1,ngrid |
---|
[253] | 369 | |
---|
| 370 | z1(ig) = pcapcal(ig)*ptsrf(ig) + cpp*zb(ig,1)*zc(ig,1) |
---|
| 371 | & + zdplanck(ig)*ptsrf(ig) + pfluxsrf(ig)*ptimestep |
---|
| 372 | z2(ig) = pcapcal(ig) + cpp*zb(ig,1)*(1.-zd(ig,1)) |
---|
| 373 | & +zdplanck(ig) |
---|
| 374 | ztsrf2(ig) = z1(ig) / z2(ig) |
---|
| 375 | pdtsrf(ig) = (ztsrf2(ig) - ptsrf(ig))/ptimestep |
---|
| 376 | zh(ig,1) = zc(ig,1) + zd(ig,1)*ztsrf2(ig) |
---|
[135] | 377 | ENDDO |
---|
| 378 | |
---|
[253] | 379 | ! Recalculate temperature to top of atmosphere, starting from ground |
---|
| 380 | ! ------------------------------------------------------------------ |
---|
[135] | 381 | |
---|
[253] | 382 | DO ilay=2,nlay |
---|
| 383 | DO ig=1,ngrid |
---|
| 384 | hh = zh(ig,ilay-1) |
---|
| 385 | zh(ig,ilay)=zc(ig,ilay)+zd(ig,ilay)*hh |
---|
| 386 | ENDDO |
---|
| 387 | ENDDO |
---|
[135] | 388 | |
---|
| 389 | |
---|
[253] | 390 | !----------------------------------------------------------------------- |
---|
| 391 | ! TRACERS (no vapour) |
---|
| 392 | ! ------- |
---|
[135] | 393 | |
---|
[253] | 394 | if(tracer) then |
---|
[135] | 395 | |
---|
[253] | 396 | ! Calculate vertical flux from the bottom to the first layer (dust) |
---|
| 397 | ! ----------------------------------------------------------------- |
---|
[787] | 398 | do ig=1,ngrid |
---|
[253] | 399 | rho(ig) = zb0(ig,1) /ptimestep |
---|
| 400 | end do |
---|
[135] | 401 | |
---|
[253] | 402 | call zerophys(ngrid*nq,pdqsdif) |
---|
[135] | 403 | |
---|
[253] | 404 | ! Implicit inversion of q |
---|
| 405 | ! ----------------------- |
---|
| 406 | do iq=1,nq |
---|
[135] | 407 | |
---|
| 408 | DO ig=1,ngrid |
---|
[253] | 409 | z1(ig)=1./(za(ig,nlay)+zb(ig,nlay)) |
---|
| 410 | zcq(ig,nlay)=za(ig,nlay)*zq(ig,nlay,iq)*z1(ig) |
---|
| 411 | zdq(ig,nlay)=zb(ig,nlay)*z1(ig) |
---|
| 412 | ENDDO |
---|
| 413 | |
---|
| 414 | DO ilay=nlay-1,2,-1 |
---|
| 415 | DO ig=1,ngrid |
---|
| 416 | z1(ig)=1./(za(ig,ilay)+zb(ig,ilay)+ |
---|
| 417 | & zb(ig,ilay+1)*(1.-zdq(ig,ilay+1))) |
---|
| 418 | zcq(ig,ilay)=(za(ig,ilay)*zq(ig,ilay,iq)+ |
---|
| 419 | & zb(ig,ilay+1)*zcq(ig,ilay+1))*z1(ig) |
---|
| 420 | zdq(ig,ilay)=zb(ig,ilay)*z1(ig) |
---|
| 421 | ENDDO |
---|
[135] | 422 | ENDDO |
---|
| 423 | |
---|
[1647] | 424 | |
---|
| 425 | |
---|
[253] | 426 | DO ig=1,ngrid |
---|
| 427 | z1(ig)=1./(za(ig,1)+ |
---|
| 428 | & zb(ig,2)*(1.-zdq(ig,2))) |
---|
| 429 | zcq(ig,1)=(za(ig,1)*zq(ig,1,iq)+ |
---|
| 430 | & zb(ig,2)*zcq(ig,2) |
---|
| 431 | & +(-pdqsdif(ig,iq))*ptimestep)*z1(ig) |
---|
| 432 | ! tracer flux from surface |
---|
| 433 | ! currently pdqsdif always zero here, |
---|
| 434 | ! so last line is superfluous |
---|
| 435 | enddo |
---|
[135] | 436 | |
---|
| 437 | |
---|
[253] | 438 | ! Starting upward calculations for simple tracer mixing (e.g., dust) |
---|
| 439 | do ig=1,ngrid |
---|
| 440 | zq(ig,1,iq)=zcq(ig,1) |
---|
| 441 | end do |
---|
[135] | 442 | |
---|
[253] | 443 | do ilay=2,nlay |
---|
| 444 | do ig=1,ngrid |
---|
| 445 | zq(ig,ilay,iq)=zcq(ig,ilay)+ |
---|
| 446 | $ zdq(ig,ilay)*zq(ig,ilay-1,iq) |
---|
| 447 | end do |
---|
| 448 | end do |
---|
[135] | 449 | |
---|
| 450 | |
---|
[253] | 451 | end do ! of do iq=1,nq |
---|
| 452 | endif ! traceur |
---|
| 453 | |
---|
| 454 | |
---|
| 455 | !----------------------------------------------------------------------- |
---|
| 456 | ! 8. Final calculation of the vertical diffusion tendencies |
---|
| 457 | ! ----------------------------------------------------------------- |
---|
| 458 | |
---|
| 459 | do ilev = 1, nlay |
---|
| 460 | do ig=1,ngrid |
---|
| 461 | pdudif(ig,ilev)=(zu(ig,ilev)- |
---|
[1477] | 462 | & (pu(ig,ilev)))/ptimestep |
---|
[253] | 463 | pdvdif(ig,ilev)=(zv(ig,ilev)- |
---|
[1477] | 464 | & (pv(ig,ilev)))/ptimestep |
---|
[253] | 465 | hh = ph(ig,ilev)+pdhfi(ig,ilev)*ptimestep |
---|
| 466 | |
---|
[135] | 467 | pdhdif(ig,ilev)=( zh(ig,ilev)- hh )/ptimestep |
---|
[253] | 468 | enddo |
---|
| 469 | enddo |
---|
[594] | 470 | |
---|
| 471 | DO ig=1,ngrid ! computing sensible heat flux (atm => surface) |
---|
| 472 | sensibFlux(ig)=cpp*zb(ig,1)/ptimestep*(zh(ig,1)-ztsrf2(ig)) |
---|
| 473 | ENDDO |
---|
| 474 | |
---|
[253] | 475 | if (tracer) then |
---|
| 476 | do iq = 1, nq |
---|
| 477 | do ilev = 1, nlay |
---|
| 478 | do ig=1,ngrid |
---|
| 479 | pdqdif(ig,ilev,iq)=(zq(ig,ilev,iq)- |
---|
| 480 | & (pq(ig,ilev,iq)+pdqfi(ig,ilev,iq)*ptimestep))/ |
---|
| 481 | & ptimestep |
---|
| 482 | enddo |
---|
| 483 | enddo |
---|
| 484 | enddo |
---|
[135] | 485 | |
---|
[253] | 486 | endif |
---|
[135] | 487 | |
---|
[303] | 488 | ! if(lastcall)then |
---|
| 489 | ! if(ngrid.eq.1)then |
---|
| 490 | ! print*,'Saving k.out...' |
---|
| 491 | ! OPEN(12,file='k.out',form='formatted') |
---|
| 492 | ! DO ilay=1,nlay |
---|
| 493 | ! write(12,*) zkh(1,ilay), pplay(1,ilay) |
---|
| 494 | ! ENDDO |
---|
| 495 | ! CLOSE(12) |
---|
| 496 | ! endif |
---|
| 497 | ! endif |
---|
| 498 | |
---|
| 499 | |
---|
[253] | 500 | return |
---|
| 501 | end |
---|