Changeset 4188
- Timestamp:
- Dec 19, 2019, 10:51:29 PM (5 years ago)
- Location:
- dynamico_lmdz/simple_physics/phyparam
- Files:
-
- 2 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
dynamico_lmdz/simple_physics/phyparam/param/phyparam.F
r4184 r4188 12 12 USE phys_const 13 13 USE planet 14 USE vdif_mod, ONLY : vdif 14 15 c 15 16 IMPLICIT NONE … … 161 162 162 163 163 EXTERNAL vdif,convadj164 EXTERNAL convadj 164 165 EXTERNAL orbite,mucorr 165 166 EXTERNAL ismin,ismax -
dynamico_lmdz/simple_physics/phyparam/physics/vdif_mod.F90
r4187 r4188 3 3 SAVE 4 4 PRIVATE 5 5 6 6 REAL, PARAMETER :: karman=0.4 7 8 PUBLIC :: vdif _cd, vdif_k7 8 PUBLIC :: vdif 9 9 10 10 CONTAINS 11 11 12 12 SUBROUTINE vdif_cd( ngrid,pz0,pg,pz,pu,pv,pts,ph,pcdv,pcdh) 13 13 !======================================================================= … … 96 96 !----------------------------------------------------------------------- 97 97 98 RETURN99 98 END SUBROUTINE vdif_cd 100 99 … … 149 148 ENDDO 150 149 151 RETURN152 150 END SUBROUTINE vdif_k 151 152 153 SUBROUTINE multipl(n,x1,x2,y) 154 !======================================================================= 155 ! multiplication de deux vecteurs 156 !======================================================================= 157 INTEGER n,i 158 REAL x1(n),x2(n),y(n) 159 160 DO i=1,n 161 y(i)=x1(i)*x2(i) 162 END DO 163 END SUBROUTINE multipl 164 165 SUBROUTINE vdif(ngrid,nlay,ptime, & 166 ptimestep,pcapcal,pz0, & 167 pplay,pplev,pzlay,pzlev, & 168 pu,pv,ph,ptsrf,pemis, & 169 pdufi,pdvfi,pdhfi,pfluxsrf, & 170 pdudif,pdvdif,pdhdif,pdtsrf,pq2,pq2l, & 171 lwrite) 172 USE phys_const 173 174 !======================================================================= 175 ! 176 ! Diffusion verticale 177 ! Shema implicite 178 ! On commence par rajouter au variables x la tendance physique 179 ! et on resoult en fait: 180 ! x(t+1) = x(t) + dt * (dx/dt)phys(t) + dt * (dx/dt)difv(t+1) 181 ! 182 ! arguments: 183 ! ---------- 184 ! 185 ! entree: 186 ! ------- 187 ! 188 ! 189 !======================================================================= 190 191 ! 192 ! arguments: 193 ! ---------- 194 195 INTEGER ngrid,nlay 196 REAL ptime,ptimestep 197 REAL pplay(ngrid,nlay),pplev(ngrid,nlay+1) 198 REAL pzlay(ngrid,nlay),pzlev(ngrid,nlay+1) 199 REAL pu(ngrid,nlay),pv(ngrid,nlay),ph(ngrid,nlay) 200 REAL ptsrf(ngrid),pemis(ngrid) 201 REAL pdufi(ngrid,nlay),pdvfi(ngrid,nlay),pdhfi(ngrid,nlay) 202 REAL pfluxsrf(ngrid) 203 REAL pdudif(ngrid,nlay),pdvdif(ngrid,nlay),pdhdif(ngrid,nlay) 204 REAL pdtsrf(ngrid),pcapcal(ngrid),pz0(ngrid) 205 REAL pq2(ngrid,nlay+1),pq2l(ngrid,nlay+1) 206 LOGICAL lwrite 207 ! 208 ! local: 209 ! ------ 210 211 INTEGER ilev,ig,ilay,nlev 212 INTEGER unit,ierr,it1,it2 213 INTEGER cluvdb,putdat,putvdim,setname,setvdim 214 REAL z4st,zdplanck(ngrid),zu2 215 REAL zkv(ngrid,nlay+1),zkh(ngrid,nlay+1) 216 REAL zcdv(ngrid),zcdh(ngrid) 217 REAL zu(ngrid,nlay),zv(ngrid,nlay) 218 REAL zh(ngrid,nlay) 219 REAL ztsrf2(ngrid) 220 REAL z1(ngrid),z2(ngrid) 221 REAL za(ngrid,nlay),zb(ngrid,nlay) 222 REAL zb0(ngrid,nlay) 223 REAL zc(ngrid,nlay),zd(ngrid,nlay) 224 REAL zcst1 225 226 ! 227 !----------------------------------------------------------------------- 228 ! initialisations: 229 ! ---------------- 230 231 nlev=nlay+1 232 233 ! computation of rho*dz and dt*rho/dz=dt*rho**2 g/dp: 234 ! with rho=p/RT=p/ (R Theta) (p/ps)**kappa 235 ! --------------------------------- 236 237 DO ilay=1,nlay 238 DO ig=1,ngrid 239 za(ig,ilay) = (pplev(ig,ilay)-pplev(ig,ilay+1))/g 240 ENDDO 241 ENDDO 242 243 zcst1=4.*g*ptimestep/(r*r) 244 DO ilev=2,nlev-1 245 DO ig=1,ngrid 246 zb0(ig,ilev)=pplev(ig,ilev) & 247 *(pplev(ig,1)/pplev(ig,ilev))**rcp & 248 /(ph(ig,ilev-1)+ph(ig,ilev)) 249 zb0(ig,ilev)=zcst1*zb0(ig,ilev)*zb0(ig,ilev) & 250 / (pplay(ig,ilev-1)-pplay(ig,ilev)) 251 ENDDO 252 ENDDO 253 DO ig=1,ngrid 254 zb0(ig,1)=ptimestep*pplev(ig,1)/(r*ptsrf(ig)) 255 ENDDO 256 IF(lwrite) THEN 257 ig=ngrid/2+1 258 PRINT*,'Pression (mbar) ,altitude (km),u,v,theta, rho dz' 259 DO ilay=1,nlay 260 WRITE(*,*) .01*pplay(ig,ilay),.001*pzlay(ig,ilay), & 261 pu(ig,ilay),pv(ig,ilay),ph(ig,ilay),za(ig,ilay) 262 ENDDO 263 PRINT*,'Pression (mbar) ,altitude (km),zb' 264 DO ilev=1,nlay 265 WRITE(*,*) .01*pplev(ig,ilev),.001*pzlev(ig,ilev), & 266 zb0(ig,ilev) 267 ENDDO 268 ENDIF 269 270 !----------------------------------------------------------------------- 271 ! 2. ajout des tendances physiques: 272 ! ------------------------------ 273 274 DO ilev=1,nlay 275 DO ig=1,ngrid 276 zu(ig,ilev)=pu(ig,ilev)+pdufi(ig,ilev)*ptimestep 277 zv(ig,ilev)=pv(ig,ilev)+pdvfi(ig,ilev)*ptimestep 278 zh(ig,ilev)=ph(ig,ilev)+pdhfi(ig,ilev)*ptimestep 279 ENDDO 280 ENDDO 281 282 !----------------------------------------------------------------------- 283 ! 3. calcul de cd : 284 ! ---------------- 285 ! 286 CALL vdif_cd( ngrid,pz0,g,pzlay,pu,pv,ptsrf,ph,zcdv,zcdh) 287 CALL vdif_k(ngrid,nlay,ptimestep,g,pzlev,pzlay,pz0,pu,pv,ph,zcdv,zkv,zkh) 288 289 DO ig=1,ngrid 290 zu2=pu(ig,1)*pu(ig,1)+pv(ig,1)*pv(ig,1) 291 zcdv(ig)=zcdv(ig)*sqrt(zu2) 292 zcdh(ig)=zcdh(ig)*sqrt(zu2) 293 ENDDO 294 295 IF(lwrite) THEN 296 PRINT* 297 PRINT*,'Diagnostique diffusion verticale' 298 PRINT*,'coefficients Cd pour v et h' 299 PRINT*,zcdv(ngrid/2+1),zcdh(ngrid/2+1) 300 PRINT*,'coefficients K pour v et h' 301 DO ilev=1,nlay 302 PRINT*,zkv(ngrid/2+1,ilev),zkh(ngrid/2+1,ilev) 303 ENDDO 304 ENDIF 305 306 !----------------------------------------------------------------------- 307 ! integration verticale pour u: 308 ! ----------------------------- 309 310 CALL multipl((nlay-1)*ngrid,zkv(1,2),zb0(1,2),zb(1,2)) 311 CALL multipl(ngrid,zcdv,zb0,zb) 312 DO ig=1,ngrid 313 z1(ig)=1./(za(ig,nlay)+zb(ig,nlay)) 314 zc(ig,nlay)=za(ig,nlay)*zu(ig,nlay)*z1(ig) 315 zd(ig,nlay)=zb(ig,nlay)*z1(ig) 316 ENDDO 317 318 DO ilay=nlay-1,1,-1 319 DO ig=1,ngrid 320 z1(ig) = 1./(za(ig,ilay)+zb(ig,ilay) & 321 + zb(ig,ilay+1)*(1.-zd(ig,ilay+1))) 322 zc(ig,ilay) = (za(ig,ilay)*zu(ig,ilay) & 323 + zb(ig,ilay+1)*zc(ig,ilay+1))*z1(ig) 324 zd(ig,ilay) = zb(ig,ilay)*z1(ig) 325 ENDDO 326 ENDDO 327 328 DO ig=1,ngrid 329 zu(ig,1)=zc(ig,1) 330 ENDDO 331 DO ilay=2,nlay 332 DO ig=1,ngrid 333 zu(ig,ilay)=zc(ig,ilay)+zd(ig,ilay)*zu(ig,ilay-1) 334 ENDDO 335 ENDDO 336 337 !----------------------------------------------------------------------- 338 ! integration verticale pour v: 339 ! ----------------------------- 340 ! 341 DO ig=1,ngrid 342 z1(ig)=1./(za(ig,nlay)+zb(ig,nlay)) 343 zc(ig,nlay)=za(ig,nlay)*zv(ig,nlay)*z1(ig) 344 zd(ig,nlay)=zb(ig,nlay)*z1(ig) 345 ENDDO 346 347 DO ilay=nlay-1,1,-1 348 DO ig=1,ngrid 349 z1(ig)=1./(za(ig,ilay)+zb(ig,ilay) & 350 + zb(ig,ilay+1)*(1.-zd(ig,ilay+1))) 351 zc(ig,ilay)=(za(ig,ilay)*zv(ig,ilay) & 352 + zb(ig,ilay+1)*zc(ig,ilay+1))*z1(ig) 353 zd(ig,ilay)=zb(ig,ilay)*z1(ig) 354 ENDDO 355 ENDDO 356 357 DO ig=1,ngrid 358 zv(ig,1)=zc(ig,1) 359 ENDDO 360 DO ilay=2,nlay 361 DO ig=1,ngrid 362 zv(ig,ilay)=zc(ig,ilay)+zd(ig,ilay)*zv(ig,ilay-1) 363 ENDDO 364 ENDDO 365 366 !----------------------------------------------------------------------- 367 ! integration verticale pour h: 368 ! ----------------------------- 369 ! 370 CALL multipl((nlay-1)*ngrid,zkh(1,2),zb0(1,2),zb(1,2)) 371 CALL multipl(ngrid,zcdh,zb0,zb) 372 DO ig=1,ngrid 373 z1(ig)=1./(za(ig,nlay)+zb(ig,nlay)) 374 zc(ig,nlay)=za(ig,nlay)*zh(ig,nlay)*z1(ig) 375 zd(ig,nlay)=zb(ig,nlay)*z1(ig) 376 ENDDO 377 378 DO ilay=nlay-1,1,-1 379 DO ig=1,ngrid 380 z1(ig)=1./(za(ig,ilay)+zb(ig,ilay) & 381 + zb(ig,ilay+1)*(1.-zd(ig,ilay+1))) 382 zc(ig,ilay)=(za(ig,ilay)*zh(ig,ilay) & 383 + zb(ig,ilay+1)*zc(ig,ilay+1))*z1(ig) 384 zd(ig,ilay)=zb(ig,ilay)*z1(ig) 385 ENDDO 386 ENDDO 387 388 !----------------------------------------------------------------------- 389 ! rajout eventuel de planck dans le shema implicite: 390 ! -------------------------------------------------- 391 392 z4st=4.*5.67e-8*ptimestep 393 DO ig=1,ngrid 394 zdplanck(ig)=z4st*pemis(ig)*ptsrf(ig)*ptsrf(ig)*ptsrf(ig) 395 ENDDO 396 397 !----------------------------------------------------------------------- 398 ! calcul le l'evolution de la temperature du sol: 399 ! ----------------------------------------------- 400 401 DO ig=1,ngrid 402 z1(ig) = pcapcal(ig)*ptsrf(ig)+cpp*zb(ig,1)*zc(ig,1) & 403 + zdplanck(ig)*ptsrf(ig)+ pfluxsrf(ig)*ptimestep 404 z2(ig) = pcapcal(ig)+cpp*zb(ig,1)*(1.-zd(ig,1))+zdplanck(ig) 405 ztsrf2(ig) = z1(ig)/z2(ig) 406 zh(ig,1) = zc(ig,1)+zd(ig,1)*ztsrf2(ig) 407 pdtsrf(ig) = (ztsrf2(ig)-ptsrf(ig))/ptimestep 408 ENDDO 409 410 !----------------------------------------------------------------------- 411 ! integration verticale finale: 412 ! ----------------------------- 413 414 DO ilay=2,nlay 415 DO ig=1,ngrid 416 zh(ig,ilay)=zc(ig,ilay)+zd(ig,ilay)*zh(ig,ilay-1) 417 ENDDO 418 ENDDO 419 420 !----------------------------------------------------------------------- 421 ! calcul final des tendances de la diffusion verticale: 422 ! ----------------------------------------------------- 423 424 DO ilev = 1, nlay 425 DO ig=1,ngrid 426 pdudif(ig,ilev) = ( zu(ig,ilev) & 427 - (pu(ig,ilev)+pdufi(ig,ilev)*ptimestep) )/ptimestep 428 pdvdif(ig,ilev) = ( zv(ig,ilev) & 429 - (pv(ig,ilev)+pdvfi(ig,ilev)*ptimestep) )/ptimestep 430 pdhdif(ig,ilev) = ( zh(ig,ilev) & 431 - (ph(ig,ilev)+pdhfi(ig,ilev)*ptimestep) )/ptimestep 432 ENDDO 433 ENDDO 434 435 IF(lwrite) THEN 436 PRINT* 437 PRINT*,'Diagnostique de la diffusion verticale' 438 PRINT*,'h avant et apres diffusion verticale' 439 PRINT*,ptsrf(ngrid/2+1),ztsrf2(ngrid/2+1) 440 DO ilev=1,nlay 441 PRINT*,ph(ngrid/2+1,ilev),zh(ngrid/2+1,ilev) 442 ENDDO 443 END IF 444 445 END SUBROUTINE vdif 153 446 154 447 END MODULE vdif_mod
Note: See TracChangeset
for help on using the changeset viewer.