Changeset 3002 for LMDZ5/trunk/libf/phylmd/ocean_slab_mod.F90
- Timestamp:
- Oct 3, 2017, 8:18:41 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
LMDZ5/trunk/libf/phylmd/ocean_slab_mod.F90
r2656 r3002 1 ! 1 !Completed 2 2 MODULE ocean_slab_mod 3 3 ! … … 40 40 REAL, ALLOCATABLE, DIMENSION(:,:), PUBLIC, SAVE :: dt_hdiff 41 41 !$OMP THREADPRIVATE(dt_hdiff) 42 ! heat flux convergence due to GM eddy advection 43 REAL, ALLOCATABLE, DIMENSION(:,:), PUBLIC, SAVE :: dt_gm 44 !$OMP THREADPRIVATE(dt_gm) 45 ! Heat Flux correction 46 REAL, ALLOCATABLE, DIMENSION(:,:), PUBLIC, SAVE :: dt_qflux 47 !$OMP THREADPRIVATE(dt_qflux) 42 48 ! fraction of ocean covered by sea ice (sic / (oce+sic)) 43 49 REAL, ALLOCATABLE, DIMENSION(:), PUBLIC, SAVE :: fsic … … 50 56 !$OMP THREADPRIVATE(seaice) 51 57 ! net surface heat flux, weighted by open ocean fraction 52 REAL, ALLOCATABLE, DIMENSION(:), PUBLIC, SAVE :: slab_bils53 !$OMP THREADPRIVATE(slab_bils)54 58 ! slab_bils accumulated over cpl_pas timesteps 55 59 REAL, ALLOCATABLE, DIMENSION(:), PRIVATE, SAVE :: bils_cum … … 108 112 LOGICAL, PUBLIC, SAVE :: slab_hdiff 109 113 !$OMP THREADPRIVATE(slab_hdiff) 114 LOGICAL, PUBLIC, SAVE :: slab_gm 115 !$OMP THREADPRIVATE(slab_gm) 110 116 REAL, PRIVATE, SAVE :: coef_hdiff ! coefficient for horizontal diffusion 111 117 !$OMP THREADPRIVATE(coef_hdiff) … … 155 161 ENDIF 156 162 slabh(1)=50. 163 CALL getin_p('slab_depth',slabh(1)) 157 164 IF (nslay.GT.1) THEN 158 165 slabh(2)=150. … … 176 183 slab_ekman=0 177 184 CALL getin_p('slab_ekman',slab_ekman) 185 ! GM eddy advection (2-layers only) 186 slab_gm=.FALSE. 187 CALL getin_p('slab_gm',slab_gm) 188 IF (slab_ekman.LT.2) THEN 189 slab_gm=.FALSE. 190 ENDIF 178 191 ! Convective adjustment 179 192 IF (nslay.EQ.1) THEN … … 205 218 (modname,'pb allocation tslab', 1) 206 219 207 ALLOCATE(slab_bils(klon), stat = error)208 IF (error /= 0) THEN209 abort_message='Pb allocation slab_bils'210 CALL abort_physic(modname,abort_message,1)211 ENDIF212 slab_bils(:) = 0.0213 220 ALLOCATE(bils_cum(klon), stat = error) 214 221 IF (error /= 0) THEN … … 252 259 ENDIF 253 260 261 ALLOCATE(dt_qflux(klon,nslay), stat = error) 262 IF (error /= 0) THEN 263 abort_message='Pb allocation dt_qflux' 264 CALL abort_physic(modname,abort_message,1) 265 ENDIF 266 dt_qflux(:,:) = 0.0 267 268 IF (slab_gm) THEN !GM advection 269 ALLOCATE(dt_gm(klon,nslay), stat = error) 270 IF (error /= 0) THEN 271 abort_message='Pb allocation dt_gm' 272 CALL abort_physic(modname,abort_message,1) 273 ENDIF 274 dt_gm(:,:) = 0.0 275 ENDIF 276 254 277 IF (slab_ekman.GT.0) THEN ! ekman transport 255 278 ALLOCATE(dt_ekman(klon,nslay), stat = error) … … 276 299 IF (slab_hdiff.OR.(slab_ekman.GT.0)) THEN 277 300 CALL gather(zmasq,zmasq_glo) 278 !$OMP MASTER ! Only master thread 301 ! Master thread/process only 302 !$OMP MASTER 279 303 IF (is_mpi_root) THEN 280 304 CALL ini_slab_transp(zmasq_glo) … … 317 341 radsol, snow, & 318 342 qsurf, evap, fluxsens, fluxlat, flux_u1, flux_v1, & 319 tsurf_new, dflux_s, dflux_l, qflux)343 tsurf_new, dflux_s, dflux_l, slab_bils) 320 344 321 345 USE calcul_fluxs_mod 322 USE slab_heat_transp_mod, ONLY: divgrad_phy, slab_ekman1, slab_ekman2346 USE slab_heat_transp_mod, ONLY: divgrad_phy,slab_ekman1,slab_ekman2,slab_gmdiff 323 347 USE mod_phys_lmdz_para 324 348 … … 369 393 REAL, DIMENSION(klon), INTENT(OUT) :: tsurf_new ! new surface tempearture 370 394 REAL, DIMENSION(klon), INTENT(OUT) :: dflux_s, dflux_l 371 REAL, DIMENSION(klon), INTENT(OUT) :: qflux395 REAL, DIMENSION(klon), INTENT(OUT) :: slab_bils 372 396 373 397 ! Local variables … … 378 402 REAL, DIMENSION(klon) :: cal, beta, dif_grnd 379 403 ! for Q-Flux computation: d/dt SST, d/dt ice volume (kg/m2), surf fluxes 380 REAL, DIMENSION(klon) :: diff_sst, diff_siv, lmt_bils 404 REAL, DIMENSION(klon) :: diff_sst, diff_siv 405 REAL, DIMENSION(klon,nslay) :: lmt_bils 381 406 ! for surface wind stress 382 407 REAL, DIMENSION(klon) :: u0, v0 … … 386 411 ! horizontal diffusion and Ekman local vars 387 412 ! dimension = global domain (klon_glo) instead of // subdomains 388 REAL, DIMENSION(klon_glo,nslay) :: dt_hdiff_glo, dt_ekman_glo413 REAL, DIMENSION(klon_glo,nslay) :: dt_hdiff_glo,dt_ekman_glo,dt_gm_glo 389 414 ! dt_ekman_glo saved for diagnostic, dt_ekman_tmp used for time loop 390 415 REAL, DIMENSION(klon_glo,nslay) :: dt_hdiff_tmp, dt_ekman_tmp … … 444 469 ! 445 470 !**************************************************************************************** 446 lmt_bils(:)=0.447 471 CALL limit_slab(itime, dtime, jour, lmt_bils, diff_sst, diff_siv) 448 472 ! lmt_bils and diff_sst,siv saved by limit_slab 449 qflux(:)=lmt_bils(:)+diff_sst(:)/cyang/86400.-diff_siv(:)*ice_den*ice_lat/86400.450 473 ! qflux = total QFlux correction (in W/m2) 474 dt_qflux(:,1)=lmt_bils(:,1)+diff_sst(:)/cyang/86400.-diff_siv(:)*ice_den*ice_lat/86400. 475 IF (nslay.GT.1) THEN 476 dt_qflux(:,2:nslay)=lmt_bils(:,2:nslay) 477 END IF 451 478 452 479 !**************************************************************************************** … … 469 496 CALL gather(tslab,tslab_glo) 470 497 ! Compute horiz transport on one process only 471 !$OMP MASTER ! Only master thread 472 IF (is_mpi_root) THEN ! Only master processus 498 IF (is_mpi_root .AND. is_omp_root) THEN ! Only master processus 473 499 IF (slab_hdiff) THEN 474 500 dt_hdiff_glo(:,:)=0. … … 476 502 IF (slab_ekman.GT.0) THEN 477 503 dt_ekman_glo(:,:)=0. 504 END IF 505 IF (slab_gm) THEN 506 dt_gm_glo(:,:)=0. 478 507 END IF 479 508 DO i=1,cpl_pas ! time splitting for numerical stability … … 483 512 CALL slab_ekman1(taux_glo,tauy_glo,tslab_glo,dt_ekman_tmp) 484 513 CASE (2) 485 CALL slab_ekman2(taux_glo,tauy_glo,tslab_glo,dt_ekman_tmp )514 CALL slab_ekman2(taux_glo,tauy_glo,tslab_glo,dt_ekman_tmp,dt_hdiff_tmp,slab_gm) 486 515 CASE DEFAULT 487 516 dt_ekman_tmp(:,:)=0. … … 493 522 ENDDO 494 523 tslab_glo=tslab_glo+dt_ekman_tmp*dtime 524 IF (slab_gm) THEN ! Gent-McWilliams eddy advection 525 dt_gm_glo(:,:)=dt_gm_glo(:,:)+ dt_hdiff_tmp(:,:) 526 ! convert dt from K.s-1.(kg.m-2) to K.s-1 527 DO k=1,nslay 528 dt_hdiff_tmp(:,k)=dt_hdiff_tmp(:,k)/(slabh(k)*sea_den) 529 END DO 530 tslab_glo=tslab_glo+dt_hdiff_tmp*dtime 531 END IF 495 532 ENDIF 533 ! GM included in Ekman_2 534 ! IF (slab_gm) THEN ! Gent-McWilliams eddy advection 535 ! CALL slab_gmdiff(tslab_glo,dt_hdiff_tmp) 536 ! ! convert dt_gm from K.m.s-1 to K.s-1 537 ! DO k=1,nslay 538 ! dt_hdiff_tmp(:,k)=dt_hdiff_tmp(:,k)/slabh(k) 539 ! END DO 540 ! tslab_glo=tslab_glo+dt_hdiff_tmp*dtime 541 ! dt_gm_glo(:,:)=dt_gm_glo(:,:)+ dt_hdiff_tmp(:,:) 542 ! END IF 496 543 IF (slab_hdiff) THEN ! horizontal diffusion 497 544 ! laplacian of slab T … … 509 556 END DO 510 557 END IF 558 IF (slab_gm) THEN 559 !dt_hdiff_glo saved in W/m2 560 dt_gm_glo(:,:)=dt_gm_glo(:,:)*sea_cap/cpl_pas 561 END IF 511 562 IF (slab_ekman.GT.0) THEN 512 563 ! dt_ekman_glo saved in W/m2 513 564 dt_ekman_glo(:,:)=dt_ekman_glo(:,:)*sea_cap/cpl_pas 514 565 END IF 515 END IF ! is_mpi_root 516 !$OMP END MASTER 566 END IF ! master process 517 567 !$OMP BARRIER 518 568 ! Send new fields back to all processes … … 520 570 IF (slab_hdiff) THEN 521 571 CALL Scatter(dt_hdiff_glo,dt_hdiff) 572 END IF 573 IF (slab_gm) THEN 574 CALL Scatter(dt_gm_glo,dt_gm) 522 575 END IF 523 576 IF (slab_ekman.GT.0) THEN … … 533 586 ! *********************************** 534 587 ! Add read QFlux 535 tslab(:,1)=tslab(:,1)+qflux(:)*cyang*dtime*cpl_pas 588 DO k=1,nslay 589 tslab(:,k)=tslab(:,k)+dt_qflux(:,k)*cyang*dtime*cpl_pas & 590 *slabh(1)/slabh(k) 591 END DO 536 592 ! Add cumulated surface fluxes 537 593 tslab(:,1)=tslab(:,1)+bils_cum(:)*cyang*dtime … … 913 969 IF (ALLOCATED(tice)) DEALLOCATE(tice) 914 970 IF (ALLOCATED(seaice)) DEALLOCATE(seaice) 915 IF (ALLOCATED(slab_bils)) DEALLOCATE(slab_bils)916 971 IF (ALLOCATED(slab_bilg)) DEALLOCATE(slab_bilg) 917 972 IF (ALLOCATED(bilg_cum)) DEALLOCATE(bilg_cum) … … 921 976 IF (ALLOCATED(dt_ekman)) DEALLOCATE(dt_ekman) 922 977 IF (ALLOCATED(dt_hdiff)) DEALLOCATE(dt_hdiff) 978 IF (ALLOCATED(dt_gm)) DEALLOCATE(dt_gm) 979 IF (ALLOCATED(dt_qflux)) DEALLOCATE(dt_qflux) 923 980 924 981 END SUBROUTINE ocean_slab_final
Note: See TracChangeset
for help on using the changeset viewer.