New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Changeset 2590 for branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/TRA/trabbl.F90 – NEMO

Ignore:
Timestamp:
2011-02-18T13:49:27+01:00 (13 years ago)
Author:
trackstand2
Message:

Merge branch 'dynamic_memory' into master-svn-dyn

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/TRA/trabbl.F90

    r2528 r2590  
    4242   PUBLIC   tra_bbl_adv   !  -          -          -              - 
    4343   PUBLIC   bbl           !  routine called by trcbbl.F90 and dtadyn.F90 
     44   PUBLIC   tra_bbl_alloc !  routine called by nemogcm.F90 
    4445 
    4546   LOGICAL, PUBLIC, PARAMETER ::   lk_trabbl = .TRUE.    !: bottom boundary layer flag 
     
    5354   REAL(wp), PUBLIC ::   rn_gambbl  = 10.0_wp   !: lateral coeff. for bottom boundary layer scheme [s] 
    5455 
    55    REAL(wp), DIMENSION(jpi,jpj), PUBLIC ::   utr_bbl  , vtr_bbl   ! u- (v-) transport in the bottom boundary layer 
    56    REAL(wp), DIMENSION(jpi,jpj), PUBLIC ::   ahu_bbl  , ahv_bbl   ! masked diffusive bbl coefficients at u and v-points 
    57  
    58    INTEGER , DIMENSION(jpi,jpj) ::   mbku_d   , mbkv_d      ! vertical index of the "lower" bottom ocean U/V-level 
    59    INTEGER , DIMENSION(jpi,jpj) ::   mgrhu    , mgrhv       ! = +/-1, sign of grad(H) in u-(v-)direction 
    60    REAL(wp), DIMENSION(jpi,jpj) ::   ahu_bbl_0, ahv_bbl_0   ! diffusive bbl flux coefficients at u and v-points 
    61    REAL(wp), DIMENSION(jpi,jpj) ::   e3u_bbl_0, e3v_bbl_0   ! thichness of the bbl (e3) at u and v-points 
    62    REAL(wp), DIMENSION(jpi,jpj) ::   e1e2t_r   ! thichness of the bbl (e3) at u and v-points 
     56   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:), PUBLIC ::   utr_bbl  , vtr_bbl   ! u- (v-) transport in the bottom boundary layer 
     57   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:), PUBLIC ::   ahu_bbl  , ahv_bbl   ! masked diffusive bbl coefficients at u and v-points 
     58 
     59   INTEGER , ALLOCATABLE, SAVE, DIMENSION(:,:) ::   mbku_d   , mbkv_d      ! vertical index of the "lower" bottom ocean U/V-level 
     60   INTEGER , ALLOCATABLE, SAVE, DIMENSION(:,:) ::   mgrhu    , mgrhv       ! = +/-1, sign of grad(H) in u-(v-)direction 
     61   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   ahu_bbl_0, ahv_bbl_0   ! diffusive bbl flux coefficients at u and v-points 
     62   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   e3u_bbl_0, e3v_bbl_0   ! thichness of the bbl (e3) at u and v-points 
     63   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   e1e2t_r   ! thichness of the bbl (e3) at u and v-points 
    6364   LOGICAL, PUBLIC              ::   l_bbl                    !: flag to compute bbl diffu. flux coef and transport 
    6465 
     
    7273   !!---------------------------------------------------------------------- 
    7374CONTAINS 
     75 
     76   FUNCTION tra_bbl_alloc() 
     77      IMPLICIT none 
     78      INTEGER :: tra_bbl_alloc 
     79 
     80      ALLOCATE(utr_bbl(jpi,jpj),   vtr_bbl(jpi,jpj),   & 
     81               ahu_bbl(jpi,jpj),   ahv_bbl(jpi,jpj),   & 
     82               mbku_d(jpi,jpj),    mbkv_d(jpi,jpj),    & 
     83               mgrhu(jpi,jpj),     mgrhv(jpi,jpj),     & 
     84               ahu_bbl_0(jpi,jpj), ahv_bbl_0(jpi,jpj), & 
     85               e3u_bbl_0(jpi,jpj), e3v_bbl_0(jpi,jpj), & 
     86               e1e2t_r(jpi,jpj),                       & 
     87               Stat=tra_bbl_alloc) 
     88 
     89      IF(tra_bbl_alloc > 0)THEN 
     90         CALL ctl_warn('tra_bbl_alloc: allocation of arrays failed.') 
     91      END IF 
     92 
     93   END FUNCTION tra_bbl_alloc 
    7494 
    7595   SUBROUTINE tra_bbl( kt ) 
     
    153173      !!              Campin, J.-M., and H. Goosse, 1999, Tellus, 412-430. 
    154174      !!----------------------------------------------------------------------   
     175      USE wrk_nemo, ONLY: wrk_use, wrk_release 
     176      USE wrk_nemo, ONLY: zptb => wrk_2d_1 
     177      !! 
    155178      INTEGER                              , INTENT(in   ) ::   kjpt    ! number of tracers 
    156179      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(in   ) ::   ptb   ! before and now tracer fields 
     
    160183      INTEGER  ::   ik           ! local integers 
    161184      REAL(wp) ::   zbtr         ! local scalars 
    162       REAL(wp), DIMENSION(jpi,jpj) ::   zptb   ! tracer trend  
    163       !!---------------------------------------------------------------------- 
     185      !!---------------------------------------------------------------------- 
     186      ! 
     187      IF(.not. wrk_use(2,1))THEN 
     188         CALL ctl_stop('tra_bbl_dif: ERROR: requested workspace array unavailable') 
     189         RETURN 
     190      END IF 
    164191      ! 
    165192      DO jn = 1, kjpt                                     ! tracer loop 
     
    196223      END DO                                                ! end tracer 
    197224      !                                                     ! =========== 
     225      IF(.not. wrk_release(2,1))THEN 
     226         CALL ctl_stop('tra_bbl_dif: ERROR: failed to release workspace array') 
     227      END IF 
     228      ! 
    198229   END SUBROUTINE tra_bbl_dif 
    199230    
     
    314345      !!              Campin, J.-M., and H. Goosse, 1999, Tellus, 412-430. 
    315346      !!----------------------------------------------------------------------   
     347      USE wrk_nemo, ONLY: wrk_use, wrk_release 
     348      USE wrk_nemo, ONLY: zub => wrk_2d_1, zvb => wrk_2d_2, ztb => wrk_2d_3, & 
     349                          zsb => wrk_2d_4, zdep => wrk_2d_5 
    316350      INTEGER         , INTENT(in   ) ::   kt       ! ocean time-step index 
    317351      CHARACTER(len=3), INTENT(in   ) ::   cdtype   ! =TRA or TRC (tracer indicator) 
     
    323357      REAL(wp) ::   zsign, zsigna, zgbbl      ! local scalars 
    324358      REAL(wp) ::   zgdrho, zt, zs, zh        !   -      - 
    325       REAL(wp), DIMENSION(jpi,jpj) ::   zub, zvb, ztb, zsb, zdep  !  2D workspace 
    326359      !! 
    327360      REAL(wp) ::   fsalbt, fsbeta, pft, pfs, pfh   ! statement function 
     
    357390                                          - 0.121555e-07 ) * pfh 
    358391      !!---------------------------------------------------------------------- 
    359        
     392 
     393      IF(.not. wrk_use(2, 1,2,3,4,5))THEN 
     394         CALL ctl_stop('bbl: ERROR: requested workspace arrays unavailable') 
     395         RETURN 
     396      END IF 
     397      
    360398      IF( kt == nit000 )  THEN 
    361399         IF(lwp)  WRITE(numout,*) 
     
    494532      ENDIF 
    495533      ! 
     534      IF(.not. wrk_release(2, 1,2,3,4,5))THEN 
     535         CALL ctl_stop('bbl: ERROR: failed to release workspace arrays') 
     536      END IF 
     537      ! 
    496538   END SUBROUTINE bbl 
    497539 
     
    506548      !!              called by tra_bbl at the first timestep (nit000) 
    507549      !!---------------------------------------------------------------------- 
     550      USE wrk_nemo, ONLY: wrk_use, wrk_release 
     551      USE wrk_nemo, ONLY: zmbk => wrk_2d_1 
    508552      INTEGER ::   ji, jj               ! dummy loop indices 
    509553      INTEGER ::   ii0, ii1, ij0, ij1   ! temporary integer 
    510       REAL(wp), DIMENSION(jpi,jpj) ::   zmbk   ! 2D workspace  
    511554      !! 
    512555      NAMELIST/nambbl/ nn_bbl_ldf, nn_bbl_adv, rn_ahtbbl, rn_gambbl 
    513556      !!---------------------------------------------------------------------- 
     557 
     558      IF(.not. wrk_use(2,1))THEN 
     559         CALL ctl_stop('tra_bbl_init: ERROR: requested workspace array unavailable') 
     560         RETURN 
     561      END IF 
    514562 
    515563      REWIND ( numnam )              !* Read Namelist nambbl : bottom boundary layer scheme 
     
    594642      ENDIF 
    595643      ! 
     644      IF(.not. wrk_release(2,1))THEN 
     645         CALL ctl_stop('tra_bbl_init: ERROR: failed to release workspace array') 
     646      END IF 
     647      ! 
    596648   END SUBROUTINE tra_bbl_init 
    597649 
Note: See TracChangeset for help on using the changeset viewer.