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 2613 for branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/TRD – NEMO

Ignore:
Timestamp:
2011-02-25T11:45:57+01:00 (13 years ago)
Author:
gm
Message:

dynamic mem: #785 ; move the allocation of ice in iceini_2/iceini module + bug fixes (define key_esopa)

Location:
branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/TRD
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/TRD/trdmld.F90

    r2590 r2613  
    7272      INTEGER :: trd_mld_alloc 
    7373      !!---------------------------------------------------------------------- 
    74  
     74      ! 
    7575      ALLOCATE(ndextrd1(jpi*jpj), Stat=trd_mld_alloc) 
    76  
    77       IF(trd_mld_alloc /= 0)THEN 
    78          CALL ctl_warn('trd_mld_alloc: failed to allocate array ndextrd1.') 
    79       END IF 
    80  
     76      ! 
     77      IF( trd_mld_alloc /= 0 )   CALL ctl_warn('trd_mld_alloc: failed to allocate array ndextrd1.') 
     78      ! 
    8179   END FUNCTION trd_mld_alloc 
     80 
    8281 
    8382   SUBROUTINE trd_mld_zint( pttrdmld, pstrdmld, ktrd, ctype ) 
     
    262261      USE wrk_nemo, ONLY: ztmltot2 => wrk_2d_7, ztmlres2 => wrk_2d_8, ztmltrdm2 => wrk_2d_9    ! \  working arrays to diagnose the trends 
    263262      USE wrk_nemo, ONLY: zsmltot2 => wrk_2d_10, zsmlres2 => wrk_2d_11, zsmltrdm2 => wrk_2d_12 !  > associated with the time meaned ML T & S 
    264       USE wrk_nemo, ONLY: ztmlatf2 => wrk_2d_13, zsmlatf2 => wrk_2d_14                         ! / 
     263      USE wrk_nemo, ONLY: ztmlatf2 => wrk_2d_13, zsmlatf2 => wrk_2d_14     
     264      USE wrk_nemo, ONLY: wrk_3d_1, wrk_3d_2                     ! / 
    265265      !! 
    266266      INTEGER, INTENT( in ) ::   kt   ! ocean time-step index 
     
    269269      LOGICAL :: lldebug = .TRUE. 
    270270      REAL(wp) :: zavt, zfn, zfn2 
    271       REAL(wp), POINTER, DIMENSION(:,:,:) ::  & 
    272            ztmltrd2, zsmltrd2               ! only needed for mean diagnostics 
     271      REAL(wp), POINTER, DIMENSION(:,:,:) ::  ztmltrd2, zsmltrd2   ! only needed for mean diagnostics 
    273272#if defined key_dimgout 
    274273      INTEGER ::  iyear,imon,iday 
     
    282281         CALL ctl_stop('trd_mld : requested workspace arrays unavailable.') 
    283282         RETURN 
    284       ELSE IF(jpltrd > jpk) 
     283      ELSE IF(jpltrd > jpk) THEN 
    285284         ! ARPDBG, is this reasonable or will this cause trouble in the future? 
    286285         CALL ctl_stop('trd_mld : no. of mixed-layer trends (jpltrd) exceeds no. of model levels so cannot use 3D workspaces.') 
     
    288287      END IF 
    289288      ! Set-up pointers into sub-arrays of 3d-workspaces 
    290       ztmltrd2 => wrk_3d_1(:,:,1:jpltrd) 
    291       zsmltrd2 => wrk_3d_2(:,:,1:jpltrd) 
     289      ztmltrd2 => wrk_3d_1(1:,:,1:jpltrd) 
     290      zsmltrd2 => wrk_3d_2(1:,:,1:jpltrd) 
    292291 
    293292      ! ====================================================================== 
  • branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/TRD/trdmld_oce.F90

    r2590 r2613  
    7171      tmlatfm, smlatfm                !: accumulator for Asselin trends (needed for storage only) 
    7272 
    73    REAL(wp), PUBLIC, DIMENSION(:,:,:) ::  & 
     73   REAL(wp), PUBLIC, ALLOCATABLE, DIMENSION(:,:,:) ::  & 
    7474      tmltrd,                       & !: \ physical contributions to the total trend (for T/S), 
    7575      smltrd,                       & !: / cumulated over the current analysis window 
     
    8282#endif 
    8383   !!---------------------------------------------------------------------- 
    84    !! NEMO/OPA 3.3 , NEMO Consortium (2010) 
     84   !! NEMO/OPA 4.0 , NEMO Consortium (2011) 
    8585   !! $Id$  
    8686   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 
    87    !!====================================================================== 
     87   !!---------------------------------------------------------------------- 
    8888CONTAINS 
    8989 
     
    9292     !!---------------------------------------------------------------------- 
    9393     USE in_out_manager, ONLY: ctl_warn 
    94      IMPLICIT none 
    9594     INTEGER :: trdmld_oce_alloc 
    9695     INTEGER :: ierr(5) 
     
    104103 
    105104#if   defined  key_trdmld   ||   defined key_esopa 
    106      ALLOCATE(nmld(jpi,jpj), nbol(jpi,jpj),       & 
    107               wkx(jpi,jpj,jpk), rmld(jpi,jpj),    &  
    108               tml(jpi,jpj)    , sml(jpi,jpj),     &  
    109               tmlb(jpi,jpj)   , smlb(jpi,jpj) ,   & 
    110               tmlbb(jpi,jpj)  , smlbb(jpi,jpj),   & 
    111               Stat = ierr(1)) 
     105     ALLOCATE( nmld(jpi,jpj), nbol(jpi,jpj),       & 
     106        &      wkx(jpi,jpj,jpk), rmld(jpi,jpj),    &  
     107        &      tml(jpi,jpj)    , sml(jpi,jpj),     &  
     108        &      tmlb(jpi,jpj)   , smlb(jpi,jpj) ,   & 
     109        &      tmlbb(jpi,jpj)  , smlbb(jpi,jpj),   & 
     110        &      Stat = ierr(1)) 
    112111 
    113      ALLOCATE(tmlbn(jpi,jpj)  , smlbn(jpi,jpj),   & 
    114               tmltrdm(jpi,jpj), smltrdm(jpi,jpj), & 
    115               tml_sum(jpi,jpj), tml_sumb(jpi,jpj),& 
    116               tmltrd_atf_sumb(jpi,jpj), Stat=ierr(2)) 
     112     ALLOCATE( tmlbn(jpi,jpj)  , smlbn(jpi,jpj),   & 
     113        &      tmltrdm(jpi,jpj), smltrdm(jpi,jpj), & 
     114        &      tml_sum(jpi,jpj), tml_sumb(jpi,jpj),& 
     115        &      tmltrd_atf_sumb(jpi,jpj), Stat=ierr(2)) 
    117116 
    118      ALLOCATE(sml_sum(jpi,jpj), sml_sumb(jpi,jpj), & 
    119               smltrd_atf_sumb(jpi,jpj),            & 
    120               rmld_sum(jpi,jpj), rmldbn(jpi,jpj),  & 
    121               tmlatfb(jpi,jpj), tmlatfn(jpi,jpj),  &  
    122               Stat = ierr(3)) 
     117     ALLOCATE( sml_sum(jpi,jpj), sml_sumb(jpi,jpj), & 
     118        &      smltrd_atf_sumb(jpi,jpj),            & 
     119        &      rmld_sum(jpi,jpj), rmldbn(jpi,jpj),  & 
     120        &      tmlatfb(jpi,jpj), tmlatfn(jpi,jpj),  &  
     121        &      Stat = ierr(3)) 
    123122 
    124      ALLOCATE(smlatfb(jpi,jpj), smlatfn(jpi,jpj), &  
    125               tmlatfm(jpi,jpj), smlatfm(jpi,jpj), & 
    126               tmltrd(jpi,jpj,jpltrd),   smltrd(jpi,jpj,jpltrd), & 
    127               Stat=ierr(4)) 
     123     ALLOCATE( smlatfb(jpi,jpj), smlatfn(jpi,jpj), &  
     124        &      tmlatfm(jpi,jpj), smlatfm(jpi,jpj), & 
     125        &      tmltrd(jpi,jpj,jpltrd),   smltrd(jpi,jpj,jpltrd), & 
     126        &      Stat=ierr(4)) 
    128127 
    129      ALLOCATE(tmltrd_sum(jpi,jpj,jpltrd),tmltrd_csum_ln(jpi,jpj,jpltrd),      & 
    130               tmltrd_csum_ub(jpi,jpj,jpltrd), smltrd_sum(jpi,jpj,jpltrd),     & 
    131               smltrd_csum_ln(jpi,jpj,jpltrd), smltrd_csum_ub(jpi,jpj,jpltrd), & 
    132               Stat=ierr(5)) 
     128     ALLOCATE( tmltrd_sum(jpi,jpj,jpltrd),tmltrd_csum_ln(jpi,jpj,jpltrd),      & 
     129        &      tmltrd_csum_ub(jpi,jpj,jpltrd), smltrd_sum(jpi,jpj,jpltrd),     & 
     130        &      smltrd_csum_ln(jpi,jpj,jpltrd), smltrd_csum_ub(jpi,jpj,jpltrd), & 
     131        &      Stat=ierr(5)) 
    133132#endif 
     133      ! 
     134      trdmld_oce_alloc = MAXVAL(ierr) 
     135      ! 
     136      IF( trdmld_oce_alloc /= 0 )   CALL ctl_warn('trdmld_oce_alloc: failed to allocate arrays.') 
     137      ! 
     138   END FUNCTION trdmld_oce_alloc 
    134139 
    135      trdmld_oce_alloc = MAXVAL(ierr) 
    136  
    137     IF(trdmld_oce_alloc /= 0)THEN 
    138        CALL ctl_warn('trdmld_oce_alloc: failed to allocate arrays.') 
    139     END IF 
    140  
    141   END FUNCTION trdmld_oce_alloc 
    142  
     140   !!====================================================================== 
    143141END MODULE trdmld_oce 
  • branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/TRD/trdmod.F90

    r2590 r2613  
    5858                          z2dx  => wrk_2d_5,  & 
    5959                          z2dy  => wrk_2d_6 
    60       IMPLICIT none 
    61       INTEGER, INTENT( in ) ::   kt                                ! time step 
    62       INTEGER, INTENT( in ) ::   ktrd                              ! tracer trend index 
    63       CHARACTER(len=3), INTENT( in ) ::   ctype                    ! momentum or tracers trends type 'DYN'/'TRA' 
    64       REAL(wp), DIMENSION(:,:,:), INTENT( inout ) ::   ptrdx ! Temperature or U trend  
    65       REAL(wp), DIMENSION(:,:,:), INTENT( inout ) ::   ptrdy ! Salinity    or V trend 
     60      ! 
     61      REAL(wp), DIMENSION(:,:,:), INTENT(inout) ::   ptrdx   ! Temperature or U trend  
     62      REAL(wp), DIMENSION(:,:,:), INTENT(inout) ::   ptrdy   ! Salinity    or V trend 
     63      CHARACTER(len=3)          , INTENT(in   ) ::   ctype   ! momentum or tracers trends type 'DYN'/'TRA' 
     64      INTEGER                   , INTENT(in   ) ::   kt      ! time step 
     65      INTEGER                   , INTENT(in   ) ::   ktrd    ! tracer trend index 
    6666      !! 
    67       INTEGER ::   ji, jj 
     67      INTEGER ::   ji, jj   ! dummy loop indices 
    6868      !!---------------------------------------------------------------------- 
    6969 
    7070      IF(.not. wrk_use(2, 1,2,3,4,5,6))THEN 
    71          CALL ctl_error('trd_mod: Requested workspace arrays already in use.') 
    72          RETURN 
     71         CALL ctl_warn('trd_mod: Requested workspace arrays already in use.')   ;   RETURN 
    7372      END IF 
    7473 
    75       z2dx(:,:)   = 0.e0   ;   z2dy(:,:)   = 0.e0                  ! initialization of workspace arrays 
    76  
    77       IF( neuler == 0 .AND. kt == nit000    ) THEN   ;   r2dt =      rdt      ! = rdtra (restarting with Euler time stepping) 
    78       ELSEIF(               kt <= nit000 + 1) THEN   ;   r2dt = 2. * rdt      ! = 2 rdttra (leapfrog) 
     74      z2dx(:,:) = 0._wp   ;   z2dy(:,:) = 0._wp                            ! initialization of workspace arrays 
     75 
     76      IF( neuler == 0 .AND. kt == nit000    ) THEN   ;   r2dt =      rdt   ! = rdtra (restart with Euler time stepping) 
     77      ELSEIF(               kt <= nit000 + 1) THEN   ;   r2dt = 2. * rdt   ! = 2 rdttra (leapfrog) 
    7978      ENDIF 
    8079 
     
    9493            CASE ( jptra_trd_dmp )   ;   CALL trd_icp( ptrdx, ptrdy, jpicpt_dmp, ctype )   ! damping 
    9594            CASE ( jptra_trd_qsr )   ;   CALL trd_icp( ptrdx, ptrdy, jpicpt_qsr, ctype )   ! penetrative solar radiat. 
    96             CASE ( jptra_trd_nsr )    
    97                z2dx(:,:) = ptrdx(:,:,1)   ;   z2dy(:,:) = ptrdy(:,:,1) 
    98                CALL trd_icp( z2dx, z2dy, jpicpt_nsr, ctype )                               ! non solar radiation 
     95            CASE ( jptra_trd_nsr )   ;   z2dx(:,:) = ptrdx(:,:,1)    
     96                                         z2dy(:,:) = ptrdy(:,:,1) 
     97                                         CALL trd_icp( z2dx , z2dy , jpicpt_nsr, ctype )   ! non solar radiation 
    9998            CASE ( jptra_trd_xad )   ;   CALL trd_icp( ptrdx, ptrdy, jpicpt_xad, ctype )   ! x- horiz adv 
    10099            CASE ( jptra_trd_yad )   ;   CALL trd_icp( ptrdx, ptrdy, jpicpt_yad, ctype )   ! y- horiz adv 
    101             CASE ( jptra_trd_zad )                                                         ! z- vertical adv  
    102                CALL trd_icp( ptrdx, ptrdy, jpicpt_zad, ctype )    
    103                ! compute the surface flux condition wn(:,:,1)*tn(:,:,1) 
    104                z2dx(:,:) = wn(:,:,1)*tn(:,:,1)/fse3t(:,:,1) 
    105                z2dy(:,:) = wn(:,:,1)*sn(:,:,1)/fse3t(:,:,1) 
    106                CALL trd_icp( z2dx , z2dy , jpicpt_zl1, ctype )                             ! 1st z- vertical adv  
     100            CASE ( jptra_trd_zad )   ;   CALL trd_icp( ptrdx, ptrdy, jpicpt_zad, ctype )   ! z- vertical adv  
     101                                         CALL trd_icp( ptrdx, ptrdy, jpicpt_zad, ctype )    
     102                                         ! compute the surface flux condition wn(:,:,1)*tn(:,:,1) 
     103                                         z2dx(:,:) = wn(:,:,1)*tn(:,:,1)/fse3t(:,:,1) 
     104                                         z2dy(:,:) = wn(:,:,1)*sn(:,:,1)/fse3t(:,:,1) 
     105                                         CALL trd_icp( z2dx , z2dy , jpicpt_zl1, ctype )   ! 1st z- vertical adv  
    107106            END SELECT 
    108107         END IF 
     
    123122               ! subtract surface forcing/bottom friction trends  
    124123               ! from vertical diffusive momentum trends 
    125                ztswu(:,:) = 0.e0   ;   ztswv(:,:) = 0.e0 
    126                ztbfu(:,:) = 0.e0   ;   ztbfv(:,:) = 0.e0  
     124               ztswu(:,:) = 0._wp   ;   ztswv(:,:) = 0._wp 
     125               ztbfu(:,:) = 0._wp   ;   ztbfv(:,:) = 0._wp  
    127126               DO jj = 2, jpjm1    
    128127                  DO ji = fs_2, fs_jpim1   ! vector opt. 
     
    131130                     ztswv(ji,jj) = vtau(ji,jj) / ( fse3v(ji,jj,1)*rau0 ) 
    132131                     ! bottom friction contribution now handled explicitly 
    133                      ! 
    134                      ptrdx(ji,jj,1     ) = ptrdx(ji,jj,1     ) - ztswu(ji,jj) 
    135                      ptrdy(ji,jj,1     ) = ptrdy(ji,jj,1     ) - ztswv(ji,jj) 
     132                     ptrdx(ji,jj,1) = ptrdx(ji,jj,1) - ztswu(ji,jj) 
     133                     ptrdy(ji,jj,1) = ptrdy(ji,jj,1) - ztswv(ji,jj) 
    136134                  END DO 
    137135               END DO 
     
    228226      ENDIF 
    229227      ! 
    230       IF(.not. wrk_release(2, 1,2,3,4,5,6))THEN 
    231          CALL ctl_error('trd_mod: Failed to release workspace arrays.') 
    232       END IF 
     228      IF( .not. wrk_release(2, 1,2,3,4,5,6) )   CALL ctl_warn('trd_mod: Failed to release workspace arrays.') 
    233229      ! 
    234230   END SUBROUTINE trd_mod 
     
    242238   USE trdicp          ! ocean bassin integral constraints properties 
    243239   USE trdmld          ! ocean active mixed layer tracers trends  
    244  
     240   !!---------------------------------------------------------------------- 
    245241CONTAINS 
    246242   SUBROUTINE trd_mod(ptrd3dx, ptrd3dy, ktrd , ctype, kt )   ! Empty routine 
Note: See TracChangeset for help on using the changeset viewer.