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 8850 for branches/2017/dev_r7881_ENHANCE09_RK3/NEMOGCM/NEMO – NEMO

Ignore:
Timestamp:
2017-11-30T09:30:44+01:00 (7 years ago)
Author:
gm
Message:

#1911 (ENHANCE-09): PART I.3 - phasing with trunk: tracer trends output (see #1877 trunk change from 86666 to 8698)

Location:
branches/2017/dev_r7881_ENHANCE09_RK3/NEMOGCM/NEMO
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/2017/dev_r7881_ENHANCE09_RK3/NEMOGCM/NEMO/OPA_SRC/IOM/iom.F90

    r8817 r8850  
    205205      ! end file definition 
    206206      dtime%second = rdt 
    207       CALL xios_set_timestep(dtime) 
     207      CALL xios_set_timestep( dtime ) 
    208208      CALL xios_close_context_definition() 
    209        
    210       CALL xios_update_calendar(0) 
     209      CALL xios_update_calendar( 0 ) 
    211210      ! 
    212211      DEALLOCATE( zt_bnds, zw_bnds ) 
     
    253252      LOGICAL         , INTENT(in   ), OPTIONAL ::   ldiof    ! Interp On the Fly, needed for AGRIF (default = .FALSE.) 
    254253      INTEGER         , INTENT(in   ), OPTIONAL ::   kdlev    ! number of vertical levels 
    255  
     254      ! 
    256255      CHARACTER(LEN=256)    ::   clname    ! the name of the file based on cdname [[+clcpu]+clcpu] 
    257256      CHARACTER(LEN=256)    ::   cltmpn    ! tempory name to store clname (in writting mode) 
     
    645644      INTEGER , DIMENSION(:)     , INTENT(in   ), OPTIONAL ::   kcount     ! number of points to be read in each axis 
    646645      LOGICAL                    , INTENT(in   ), OPTIONAL ::   lrowattr   ! logical flag telling iom_get to 
    647                                                                            ! look for and use a file attribute 
    648                                                                            ! called open_ocean_jstart to set the start 
    649                                                                            ! value for the 2nd dimension (netcdf only) 
     646      !                                                                    ! look for and use a file attribute 
     647      !                                                                    ! called open_ocean_jstart to set the start 
     648      !                                                                    ! value for the 2nd dimension (netcdf only) 
    650649      ! 
    651650      LOGICAL                        ::   llnoov      ! local definition to read overlap 
     
    780779         IF( PRESENT(kstart) .AND. .NOT. ll_depth_spec ) THEN  
    781780            istart(1:idmspc) = kstart(1:idmspc)  
    782             icnt(1:idmspc) = kcount(1:idmspc) 
     781            icnt  (1:idmspc) = kcount(1:idmspc) 
    783782         ELSE 
    784783            IF(idom == jpdom_unknown ) THEN 
     
    806805                  ENDIF 
    807806                  IF( PRESENT(pv_r3d) ) THEN 
    808                      IF( idom == jpdom_data ) THEN                                  ; icnt(3) = inlev 
    809                      ELSE IF( ll_depth_spec .AND. PRESENT(kstart) ) THEN            ; istart(3) = kstart(3); icnt(3) = kcount(3) 
    810                      ELSE                                                           ; icnt(3) = inlev 
     807                     IF( idom == jpdom_data ) THEN                        ;                              icnt(3) = inlev 
     808                     ELSEIF( ll_depth_spec .AND. PRESENT(kstart) ) THEN   ;   istart(3) = kstart(3)   ;  icnt(3) = kcount(3) 
     809                     ELSE                                                 ;                              icnt(3) = inlev 
    811810                     ENDIF 
    812811                  ENDIF 
     
    12511250 
    12521251#if defined key_iomput 
    1253  
    12541252   !!---------------------------------------------------------------------- 
    12551253   !!   'key_iomput'                                         IOM  interface 
     
    14131411      REAL(wp), DIMENSION(jpi,jpj), INTENT(in) ::   plat 
    14141412      ! 
    1415       INTEGER  :: ni,nj 
     1413      INTEGER  :: ni, nj 
    14161414      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zmask 
    14171415      !!---------------------------------------------------------------------- 
    14181416      ! 
    1419       ni=nlei-nldi+1 ; nj=nlej-nldj+1 
     1417      ni = nlei-nldi+1 
     1418      nj = nlej-nldj+1 
    14201419      ! 
    14211420      CALL iom_set_domain_attr("grid_"//cdgrd, ni_glo=jpiglo, nj_glo=jpjglo, ibegin=nimpp+nldi-2, jbegin=njmpp+nldj-2, ni=ni, nj=nj) 
     
    14681467      END SELECT 
    14691468      ! 
    1470       ni = nlei-nldi+1 ; nj = nlej-nldj+1  ! Dimensions of subdomain interior 
     1469      ni = nlei-nldi+1   ! Dimensions of subdomain interior 
     1470      nj = nlej-nldj+1 
    14711471      ! 
    14721472      z_fld(:,:) = 1._wp 
     
    15531553      REAL(wp), DIMENSION(jpi,jpj), INTENT(in) ::   plat 
    15541554      ! 
     1555      INTEGER  :: ni, nj, ix, iy 
    15551556      REAL(wp), DIMENSION(:), ALLOCATABLE  ::   zlon 
    1556       INTEGER  :: ni,nj, ix, iy 
    1557       !!---------------------------------------------------------------------- 
    1558       ! 
    1559       ni=nlei-nldi+1 ; nj=nlej-nldj+1            ! define zonal mean domain (jpj*jpk) 
    1560       ALLOCATE( zlon(ni*nj) )       ;       zlon(:) = 0. 
     1557      !!---------------------------------------------------------------------- 
     1558      ! 
     1559      ni=nlei-nldi+1       ! define zonal mean domain (jpj*jpk) 
     1560      nj=nlej-nldj+1 
     1561      ALLOCATE( zlon(ni*nj) )       ;       zlon(:) = 0._wp 
    15611562      ! 
    15621563      CALL dom_ngb( -168.53, 65.03, ix, iy, 'T' ) !  i-line that passes through Bering Strait: Reference latitude (used in plots) 
     
    16161617      !  
    16171618      ! frequency of the call of iom_put (attribut: freq_op) 
    1618       f_op%timestep = 1        ;  f_of%timestep = 0  ; CALL iom_set_field_attr('field_definition', freq_op=f_op, freq_offset=f_of) 
    1619       f_op%timestep = nn_fsbc  ;  f_of%timestep = 0  ; CALL iom_set_field_attr('SBC'             , freq_op=f_op, freq_offset=f_of) 
    1620       f_op%timestep = nn_fsbc  ;  f_of%timestep = 0  ; CALL iom_set_field_attr('SBC_scalar'      , freq_op=f_op, freq_offset=f_of) 
    1621       f_op%timestep = nn_dttrc ;  f_of%timestep = 0  ; CALL iom_set_field_attr('ptrc_T'          , freq_op=f_op, freq_offset=f_of) 
    1622       f_op%timestep = nn_dttrc ;  f_of%timestep = 0  ; CALL iom_set_field_attr('diad_T'          , freq_op=f_op, freq_offset=f_of) 
     1619      f_op%timestep = 1        ;  f_of%timestep =  0  ; CALL iom_set_field_attr('field_definition', freq_op=f_op, freq_offset=f_of) 
     1620      f_op%timestep = 2        ;  f_of%timestep =  0  ; CALL iom_set_field_attr('trendT_even'     , freq_op=f_op, freq_offset=f_of) 
     1621      f_op%timestep = 2        ;  f_of%timestep = -1  ; CALL iom_set_field_attr('trendT_odd'      , freq_op=f_op, freq_offset=f_of) 
     1622      f_op%timestep = nn_fsbc  ;  f_of%timestep =  0  ; CALL iom_set_field_attr('SBC'             , freq_op=f_op, freq_offset=f_of) 
     1623      f_op%timestep = nn_fsbc  ;  f_of%timestep =  0  ; CALL iom_set_field_attr('SBC_scalar'      , freq_op=f_op, freq_offset=f_of) 
     1624      f_op%timestep = nn_dttrc ;  f_of%timestep =  0  ; CALL iom_set_field_attr('ptrc_T'          , freq_op=f_op, freq_offset=f_of) 
     1625      f_op%timestep = nn_dttrc ;  f_of%timestep =  0  ; CALL iom_set_field_attr('diad_T'          , freq_op=f_op, freq_offset=f_of) 
    16231626 
    16241627      ! output file names (attribut: name) 
     
    17531756      TYPE(xios_duration)   ::   output_freq  
    17541757      !!---------------------------------------------------------------------- 
    1755  
    1756       DO jn = 1,2 
    1757  
     1758      ! 
     1759      DO jn = 1, 2 
     1760         ! 
    17581761         output_freq = xios_duration(0,0,0,0,0,0) 
    17591762         IF( jn == 1 )   CALL iom_get_file_attr( cdid, name        = clname, output_freq = output_freq ) 
    17601763         IF( jn == 2 )   CALL iom_get_file_attr( cdid, name_suffix = clname ) 
    1761  
     1764         ! 
    17621765         IF ( TRIM(clname) /= '' ) THEN  
    1763  
     1766            ! 
    17641767            idx = INDEX(clname,'@expname@') + INDEX(clname,'@EXPNAME@') 
    17651768            DO WHILE ( idx /= 0 )  
     
    17671770               idx = INDEX(clname,'@expname@') + INDEX(clname,'@EXPNAME@') 
    17681771            END DO 
    1769  
     1772            ! 
    17701773            idx = INDEX(clname,'@freq@') + INDEX(clname,'@FREQ@') 
    17711774            DO WHILE ( idx /= 0 )  
     
    17981801              idx = INDEX(clname,'@freq@') + INDEX(clname,'@FREQ@') 
    17991802            END DO 
    1800  
     1803            ! 
    18011804            idx = INDEX(clname,'@startdate@') + INDEX(clname,'@STARTDATE@') 
    18021805            DO WHILE ( idx /= 0 )  
     
    18051808               idx = INDEX(clname,'@startdate@') + INDEX(clname,'@STARTDATE@') 
    18061809            END DO 
    1807  
     1810            ! 
    18081811            idx = INDEX(clname,'@startdatefull@') + INDEX(clname,'@STARTDATEFULL@') 
    18091812            DO WHILE ( idx /= 0 )  
     
    18121815               idx = INDEX(clname,'@startdatefull@') + INDEX(clname,'@STARTDATEFULL@') 
    18131816            END DO 
    1814  
     1817            ! 
    18151818            idx = INDEX(clname,'@enddate@') + INDEX(clname,'@ENDDATE@') 
    18161819            DO WHILE ( idx /= 0 )  
     
    18441847      !! ** Purpose :   send back the date corresponding to the given julian day 
    18451848      !!---------------------------------------------------------------------- 
    1846       REAL(wp), INTENT(in   )           ::   pjday         ! julian day 
    1847       LOGICAL , INTENT(in   ), OPTIONAL ::   ld24          ! true to force 24:00 instead of 00:00 
    1848       LOGICAL , INTENT(in   ), OPTIONAL ::   ldfull        ! true to get the compleate date: yyyymmdd_hh:mm:ss 
     1849      REAL(wp), INTENT(in   )           ::   pjday    ! julian day 
     1850      LOGICAL , INTENT(in   ), OPTIONAL ::   ld24     ! true to force 24:00 instead of 00:00 
     1851      LOGICAL , INTENT(in   ), OPTIONAL ::   ldfull   ! true to get the compleate date: yyyymmdd_hh:mm:ss 
    18491852      ! 
    18501853      CHARACTER(LEN=20) ::   iom_sdate 
     
    18921895 
    18931896#else 
     1897   !!---------------------------------------------------------------------- 
     1898   !!   NOT 'key_iomput'                               a few dummy routines 
     1899   !!---------------------------------------------------------------------- 
    18941900 
    18951901   SUBROUTINE iom_setkt( kt, cdname ) 
     
    19071913 
    19081914   LOGICAL FUNCTION iom_use( cdname ) 
     1915      !!---------------------------------------------------------------------- 
     1916      !!---------------------------------------------------------------------- 
    19091917      CHARACTER(LEN=*), INTENT(in) ::   cdname 
     1918      !!---------------------------------------------------------------------- 
    19101919#if defined key_iomput 
    19111920      iom_use = xios_field_is_active( cdname ) 
  • branches/2017/dev_r7881_ENHANCE09_RK3/NEMOGCM/NEMO/OPA_SRC/TRA/tranxt.F90

    r8568 r8850  
    113113  
    114114      ! set time step size (Euler/Leapfrog) 
    115       IF( neuler == 0 .AND. kt == nit000 ) THEN   ;   r2dt =     rdt      ! at nit000             (Euler) 
     115      IF( neuler == 0 .AND. kt == nit000 ) THEN   ;   r2dt =        rdt   ! at nit000             (Euler) 
    116116      ELSEIF( kt <= nit000 + 1 )           THEN   ;   r2dt = 2._wp* rdt   ! at nit000 or nit000+1 (Leapfrog) 
    117117      ENDIF 
     
    120120      IF( l_trdtra )   THEN                     
    121121         ALLOCATE( ztrdt(jpi,jpj,jpk) , ztrds(jpi,jpj,jpk) ) 
    122          ztrdt(:,:,jk) = 0._wp 
    123          ztrds(:,:,jk) = 0._wp 
     122         ztrdt(:,:,jpk) = 0._wp 
     123         ztrds(:,:,jpk) = 0._wp 
    124124         IF( ln_traldf_iso ) THEN              ! diagnose the "pure" Kz diffusive trend  
    125125            CALL trd_tra( kt, 'TRA', jp_tem, jptra_zdfp, ztrdt ) 
     
    127127         ENDIF 
    128128         ! total trend for the non-time-filtered variables.  
    129             zfact = 1.0 / rdt 
     129         zfact = 1.0 / rdt 
     130         ! G Nurser 23 Mar 2017. Recalculate trend as Delta(e3t*T)/e3tn; e3tn cancel from tsn terms 
    130131         DO jk = 1, jpkm1 
    131             ztrdt(:,:,jk) = ( tsa(:,:,jk,jp_tem) - tsn(:,:,jk,jp_tem) ) * zfact  
    132             ztrds(:,:,jk) = ( tsa(:,:,jk,jp_sal) - tsn(:,:,jk,jp_sal) ) * zfact  
     132            ztrdt(:,:,jk) = ( tsa(:,:,jk,jp_tem)*e3t_a(:,:,jk) / e3t_n(:,:,jk) - tsn(:,:,jk,jp_tem)) * zfact 
     133            ztrds(:,:,jk) = ( tsa(:,:,jk,jp_sal)*e3t_a(:,:,jk) / e3t_n(:,:,jk) - tsn(:,:,jk,jp_sal)) * zfact 
    133134         END DO 
    134135         CALL trd_tra( kt, 'TRA', jp_tem, jptra_tot, ztrdt ) 
    135136         CALL trd_tra( kt, 'TRA', jp_sal, jptra_tot, ztrds ) 
    136          ! Store now fields before applying the Asselin filter  
    137          ! in order to calculate Asselin filter trend later. 
    138          ztrdt(:,:,:) = tsn(:,:,:,jp_tem)  
    139          ztrds(:,:,:) = tsn(:,:,:,jp_sal) 
     137         IF( ln_linssh ) THEN       ! linear sea surface height only 
     138            ! Store now fields before applying the Asselin filter  
     139            ! in order to calculate Asselin filter trend later. 
     140            ztrdt(:,:,:) = tsn(:,:,:,jp_tem)  
     141            ztrds(:,:,:) = tsn(:,:,:,jp_sal) 
     142         ENDIF 
    140143      ENDIF 
    141144 
     
    146149            END DO 
    147150         END DO 
     151         IF (l_trdtra .AND. .NOT. ln_linssh ) THEN   ! Zero Asselin filter contribution must be explicitly written out since for vvl 
     152            !                                        ! Asselin filter is output by tra_nxt_vvl that is not called on this time step 
     153            ztrdt(:,:,:) = 0._wp 
     154            ztrds(:,:,:) = 0._wp 
     155            CALL trd_tra( kt, 'TRA', jp_tem, jptra_atf, ztrdt ) 
     156            CALL trd_tra( kt, 'TRA', jp_sal, jptra_atf, ztrds ) 
     157         END IF 
    148158         ! 
    149159      ELSE                                            ! Leap-Frog + Asselin filter time stepping 
     
    161171      ENDIF      
    162172      ! 
    163       IF( l_trdtra ) THEN      ! trend of the Asselin filter (tb filtered - tb)/dt      
     173      IF( l_trdtra .AND. ln_linssh ) THEN      ! trend of the Asselin filter (tb filtered - tb)/dt      
     174         zfact = 1._wp / r2dt              
    164175         DO jk = 1, jpkm1 
    165             zfact = 1._wp / r2dt              
    166176            ztrdt(:,:,jk) = ( tsb(:,:,jk,jp_tem) - ztrdt(:,:,jk) ) * zfact 
    167177            ztrds(:,:,jk) = ( tsb(:,:,jk,jp_sal) - ztrds(:,:,jk) ) * zfact 
     
    169179         CALL trd_tra( kt, 'TRA', jp_tem, jptra_atf, ztrdt ) 
    170180         CALL trd_tra( kt, 'TRA', jp_sal, jptra_atf, ztrds ) 
    171          DEALLOCATE( ztrdt , ztrds ) 
    172181      END IF 
     182      IF( l_trdtra )   DEALLOCATE( ztrdt , ztrds ) 
    173183      ! 
    174184      !                        ! control print 
     
    258268      LOGICAL  ::   ll_traqsr, ll_rnf, ll_isf   ! local logical 
    259269      INTEGER  ::   ji, jj, jk, jn              ! dummy loop indices 
    260       REAL(wp) ::   zfact1, ztc_a , ztc_n , ztc_b , ztc_f , ztc_d    ! local scalar 
     270      REAL(wp) ::   zfact, zfact1, ztc_a , ztc_n , ztc_b , ztc_f , ztc_d    ! local scalar 
    261271      REAL(wp) ::   zfact2, ze3t_b, ze3t_n, ze3t_a, ze3t_f, ze3t_d   !   -      - 
     272      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:) ::   ztrd_atf 
    262273      !!---------------------------------------------------------------------- 
    263274      ! 
     
    278289      ENDIF 
    279290      ! 
     291      IF( ( l_trdtra .AND. cdtype == 'TRA' ) .OR. ( l_trdtrc .AND. cdtype == 'TRC' ) )   THEN 
     292         ALLOCATE( ztrd_atf(jpi,jpj,jpk,kjpt) ) 
     293         ztrd_atf(:,:,:,:) = 0.0_wp 
     294      ENDIF 
     295      zfact = 1._wp / r2dt 
     296      zfact1 = atfp * p2dt 
     297      zfact2 = zfact1 * r1_rau0 
    280298      DO jn = 1, kjpt       
    281299         DO jk = 1, jpkm1 
    282             zfact1 = atfp * p2dt 
    283             zfact2 = zfact1 * r1_rau0 
    284300            DO jj = 2, jpjm1 
    285301               DO ji = fs_2, fs_jpim1 
     
    330346                  ptn(ji,jj,jk,jn) = pta(ji,jj,jk,jn)     ! ptn <-- pta 
    331347                  ! 
     348                  IF( ( l_trdtra .and. cdtype == 'TRA' ) .OR. ( l_trdtrc .and. cdtype == 'TRC' ) ) THEN 
     349                     ztrd_atf(ji,jj,jk,jn) = (ztc_f - ztc_n) * zfact/ze3t_n 
     350                  ENDIF 
     351                  ! 
    332352               END DO 
    333353            END DO 
     
    336356      END DO 
    337357      ! 
     358      IF( ( l_trdtra .AND. cdtype == 'TRA' ) .OR. ( l_trdtrc .AND. cdtype == 'TRC' ) )   THEN 
     359         IF( l_trdtra .AND. cdtype == 'TRA' ) THEN  
     360            CALL trd_tra( kt, cdtype, jp_tem, jptra_atf, ztrd_atf(:,:,:,jp_tem) ) 
     361            CALL trd_tra( kt, cdtype, jp_sal, jptra_atf, ztrd_atf(:,:,:,jp_sal) ) 
     362         ENDIF 
     363         IF( l_trdtrc .AND. cdtype == 'TRC' ) THEN 
     364            DO jn = 1, kjpt 
     365               CALL trd_tra( kt, cdtype, jn, jptra_atf, ztrd_atf(:,:,:,jn) ) 
     366            END DO 
     367         ENDIF 
     368         DEALLOCATE( ztrd_atf ) 
     369      ENDIF 
     370      ! 
    338371   END SUBROUTINE tra_nxt_vvl 
    339372 
  • branches/2017/dev_r7881_ENHANCE09_RK3/NEMOGCM/NEMO/OPA_SRC/TRA/trazdf.F90

    r8586 r8850  
    5858      IF( ln_timing )   CALL timing_start('tra_zdf') 
    5959      ! 
    60       IF( neuler == 0 .AND. kt == nit000 ) THEN     ! at nit000 
    61          r2dt =  rdt                                     ! = rdt (restarting with Euler time stepping) 
    62       ELSEIF( kt <= nit000 + 1) THEN                ! at nit000 or nit000+1 
    63          r2dt = 2. * rdt                                 ! = 2 rdt (leapfrog) 
     60      IF( neuler == 0 .AND. kt == nit000 ) THEN   ;   r2dt =      rdt   ! at nit000, =   rdt (restarting with Euler time stepping) 
     61      ELSEIF( kt <= nit000 + 1           ) THEN   ;   r2dt = 2. * rdt   ! otherwise, = 2 rdt (leapfrog) 
    6462      ENDIF 
    6563      ! 
     
    8280      IF( l_trdtra )   THEN                      ! save the vertical diffusive trends for further diagnostics 
    8381         DO jk = 1, jpkm1 
    84             ztrdt(:,:,jk) = ( ( tsa(:,:,jk,jp_tem) - tsb(:,:,jk,jp_tem) ) / r2dt ) - ztrdt(:,:,jk) 
    85             ztrds(:,:,jk) = ( ( tsa(:,:,jk,jp_sal) - tsb(:,:,jk,jp_sal) ) / r2dt ) - ztrds(:,:,jk) 
     82            ztrdt(:,:,jk) = ( ( tsa(:,:,jk,jp_tem)*e3t_a(:,:,jk) - tsb(:,:,jk,jp_tem)*e3t_b(:,:,jk) ) & 
     83               &          / (e3t_n(:,:,jk)*r2dt) ) - ztrdt(:,:,jk) 
     84            ztrds(:,:,jk) = ( ( tsa(:,:,jk,jp_sal)*e3t_a(:,:,jk) - tsb(:,:,jk,jp_sal)*e3t_b(:,:,jk) ) & 
     85              &           / (e3t_n(:,:,jk)*r2dt) ) - ztrds(:,:,jk) 
    8686         END DO 
    8787!!gm this should be moved in trdtra.F90 and done on all trends 
  • branches/2017/dev_r7881_ENHANCE09_RK3/NEMOGCM/NEMO/OPA_SRC/TRD/trdtra.F90

    r8215 r8850  
    3131   USE iom            ! I/O manager library 
    3232   USE lib_mpp        ! MPP library 
    33    USE wrk_nemo       ! Memory allocation 
    3433 
    3534   IMPLICIT NONE 
     
    8281      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in), OPTIONAL ::   ptra    ! now tracer variable 
    8382      ! 
    84       INTEGER  ::   jk   ! loop indices 
    85       REAL(wp), POINTER, DIMENSION(:,:,:)  ::   zwt, zws, ztrdt, ztrds   ! 3D workspace 
    86       !!---------------------------------------------------------------------- 
    87       ! 
    88       CALL wrk_alloc( jpi, jpj, jpk, ztrds ) 
     83      INTEGER ::   jk   ! loop indices 
     84      REAL(wp),        DIMENSION(jpi,jpj,jpk) ::   ztrds             ! 3D workspace 
     85      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) ::   zwt, zws, ztrdt   ! 3D workspace 
     86      !!---------------------------------------------------------------------- 
    8987      !       
    9088      IF( .NOT. ALLOCATED( trdtx ) ) THEN      ! allocate trdtra arrays 
     
    103101                                 ztrds(:,:,:) = 0._wp 
    104102                                 CALL trd_tra_mng( trdt, ztrds, ktrd, kt ) 
     103 !!gm Gurvan, verify the jptra_evd trend please ! 
     104         CASE( jptra_evd )   ;   avt_evd(:,:,:) = ptrd(:,:,:) * tmask(:,:,:) 
    105105         CASE DEFAULT                 ! other trends: masked trends 
    106106            trdt(:,:,:) = ptrd(:,:,:) * tmask(:,:,:)              ! mask & store 
     
    122122         CASE( jptra_zdfp )           ! diagnose the "PURE" Kz trend (here: just before the swap) 
    123123            !                         ! iso-neutral diffusion case otherwise jptra_zdf is "PURE" 
    124             CALL wrk_alloc( jpi, jpj, jpk, zwt, zws, ztrdt ) 
     124            ALLOCATE( zwt(jpi,jpj,jpk), zws(jpi,jpj,jpk), ztrdt(jpi,jpj,jpk) ) 
    125125            ! 
    126126            zwt(:,:, 1 ) = 0._wp   ;   zws(:,:, 1 ) = 0._wp            ! vertical diffusive fluxes 
     
    152152            CALL trd_tra_mng( ztrdt, ztrds, jptra_evd, kt )   
    153153            ! 
    154             CALL wrk_dealloc( jpi, jpj, jpk, zwt, zws, ztrdt ) 
     154            DEALLOCATE( zwt, zws, ztrdt ) 
    155155            ! 
    156156         CASE DEFAULT                 ! other trends: mask and send T & S trends to trd_tra_mng 
     
    174174         ! 
    175175      ENDIF 
    176       ! 
    177       CALL wrk_dealloc( jpi, jpj, jpk, ztrds ) 
    178176      ! 
    179177   END SUBROUTINE trd_tra 
     
    305303      INTEGER ::   ji, jj, jk   ! dummy loop indices 
    306304      INTEGER ::   ikbu, ikbv   ! local integers 
    307       REAL(wp), POINTER, DIMENSION(:,:)   ::   z2dx, z2dy   ! 2D workspace  
     305      REAL(wp), ALLOCATABLE, DIMENSION(:,:)   ::   z2dx, z2dy   ! 2D workspace  
    308306      !!---------------------------------------------------------------------- 
    309307      ! 
    310308!!gm Rq: mask the trends already masked in trd_tra, but lbc_lnk should probably be added 
    311309      ! 
     310      ! Trends evaluated every time step that could go to the standard T file and can be output every ts into a 1ts file if 1ts output is selected 
    312311      SELECT CASE( ktrd ) 
    313       CASE( jptra_xad  )   ;   CALL iom_put( "ttrd_xad" , ptrdx )        ! x- horizontal advection 
    314                                CALL iom_put( "strd_xad" , ptrdy ) 
    315       CASE( jptra_yad  )   ;   CALL iom_put( "ttrd_yad" , ptrdx )        ! y- horizontal advection 
    316                                CALL iom_put( "strd_yad" , ptrdy ) 
    317       CASE( jptra_zad  )   ;   CALL iom_put( "ttrd_zad" , ptrdx )        ! z- vertical   advection 
    318                                CALL iom_put( "strd_zad" , ptrdy ) 
    319                                IF( ln_linssh ) THEN                   ! cst volume : adv flux through z=0 surface 
    320                                   CALL wrk_alloc( jpi, jpj, z2dx, z2dy ) 
    321                                   z2dx(:,:) = wn(:,:,1) * tsn(:,:,1,jp_tem) / e3t_n(:,:,1) 
    322                                   z2dy(:,:) = wn(:,:,1) * tsn(:,:,1,jp_sal) / e3t_n(:,:,1) 
    323                                   CALL iom_put( "ttrd_sad", z2dx ) 
    324                                   CALL iom_put( "strd_sad", z2dy ) 
    325                                   CALL wrk_dealloc( jpi, jpj, z2dx, z2dy ) 
    326                                ENDIF 
    327       CASE( jptra_totad  ) ;   CALL iom_put( "ttrd_totad" , ptrdx )      ! total   advection 
    328                                CALL iom_put( "strd_totad" , ptrdy ) 
    329       CASE( jptra_ldf  )   ;   CALL iom_put( "ttrd_ldf" , ptrdx )        ! lateral diffusion 
    330                                CALL iom_put( "strd_ldf" , ptrdy ) 
    331       CASE( jptra_zdf  )   ;   CALL iom_put( "ttrd_zdf" , ptrdx )        ! vertical diffusion (including Kz contribution) 
    332                                CALL iom_put( "strd_zdf" , ptrdy ) 
    333       CASE( jptra_zdfp )   ;   CALL iom_put( "ttrd_zdfp", ptrdx )        ! PURE vertical diffusion (no isoneutral contribution) 
    334                                CALL iom_put( "strd_zdfp", ptrdy ) 
    335       CASE( jptra_evd )    ;   CALL iom_put( "ttrd_evd", ptrdx )         ! EVD trend (convection) 
    336                                CALL iom_put( "strd_evd", ptrdy ) 
    337       CASE( jptra_dmp  )   ;   CALL iom_put( "ttrd_dmp" , ptrdx )        ! internal restoring (damping) 
    338                                CALL iom_put( "strd_dmp" , ptrdy ) 
    339       CASE( jptra_bbl  )   ;   CALL iom_put( "ttrd_bbl" , ptrdx )        ! bottom boundary layer 
    340                                CALL iom_put( "strd_bbl" , ptrdy ) 
    341       CASE( jptra_npc  )   ;   CALL iom_put( "ttrd_npc" , ptrdx )        ! static instability mixing 
    342                                CALL iom_put( "strd_npc" , ptrdy ) 
    343       CASE( jptra_nsr  )   ;   CALL iom_put( "ttrd_qns" , ptrdx(:,:,1) )        ! surface forcing + runoff (ln_rnf=T) 
    344                                CALL iom_put( "strd_cdt" , ptrdy(:,:,1) )        ! output as 2D surface fields 
    345       CASE( jptra_qsr  )   ;   CALL iom_put( "ttrd_qsr" , ptrdx )        ! penetrative solar radiat. (only on temperature) 
    346       CASE( jptra_bbc  )   ;   CALL iom_put( "ttrd_bbc" , ptrdx )        ! geothermal heating   (only on temperature) 
    347       CASE( jptra_atf  )   ;   CALL iom_put( "ttrd_atf" , ptrdx )        ! asselin time Filter 
    348                                CALL iom_put( "strd_atf" , ptrdy ) 
    349       CASE( jptra_tot  )   ;   CALL iom_put( "ttrd_tot" , ptrdx )        ! model total trend 
     312      ! This total trend is done every time step 
     313      CASE( jptra_tot  )   ;   CALL iom_put( "ttrd_tot" , ptrdx )           ! model total trend 
    350314                               CALL iom_put( "strd_tot" , ptrdy ) 
    351315      END SELECT 
    352316      ! 
     317      ! These trends are done every second time step. When 1ts output is selected must go different (2ts) file from standard T-file 
     318      IF( MOD( kt, 2 ) == 0 ) THEN 
     319         SELECT CASE( ktrd ) 
     320         CASE( jptra_xad  )   ;   CALL iom_put( "ttrd_xad"  , ptrdx )         ! x- horizontal advection 
     321                                  CALL iom_put( "strd_xad"  , ptrdy ) 
     322         CASE( jptra_yad  )   ;   CALL iom_put( "ttrd_yad"  , ptrdx )         ! y- horizontal advection 
     323                                  CALL iom_put( "strd_yad"  , ptrdy ) 
     324         CASE( jptra_zad  )   ;   CALL iom_put( "ttrd_zad"  , ptrdx )         ! z- vertical   advection 
     325                                  CALL iom_put( "strd_zad"  , ptrdy ) 
     326                                  IF( ln_linssh ) THEN                   ! cst volume : adv flux through z=0 surface 
     327                                     ALLOCATE( z2dx(jpi,jpj) , z2dy(jpi,jpj) ) 
     328                                     z2dx(:,:) = wn(:,:,1) * tsn(:,:,1,jp_tem) / e3t_n(:,:,1) 
     329                                     z2dy(:,:) = wn(:,:,1) * tsn(:,:,1,jp_sal) / e3t_n(:,:,1) 
     330                                     CALL iom_put( "ttrd_sad", z2dx ) 
     331                                     CALL iom_put( "strd_sad", z2dy ) 
     332                                     DEALLOCATE( z2dx, z2dy ) 
     333                                  ENDIF 
     334         CASE( jptra_totad  ) ;   CALL iom_put( "ttrd_totad", ptrdx )         ! total   advection 
     335                                  CALL iom_put( "strd_totad", ptrdy ) 
     336         CASE( jptra_ldf  )   ;   CALL iom_put( "ttrd_ldf"  , ptrdx )         ! lateral diffusion 
     337                                  CALL iom_put( "strd_ldf"  , ptrdy ) 
     338         CASE( jptra_zdf  )   ;   CALL iom_put( "ttrd_zdf"  , ptrdx )         ! vertical diffusion (including Kz contribution) 
     339                                  CALL iom_put( "strd_zdf"  , ptrdy ) 
     340         CASE( jptra_zdfp )   ;   CALL iom_put( "ttrd_zdfp" , ptrdx )         ! PURE vertical diffusion (no isoneutral contribution) 
     341                                  CALL iom_put( "strd_zdfp" , ptrdy ) 
     342         CASE( jptra_evd )    ;   CALL iom_put( "ttrd_evd"  , ptrdx )         ! EVD trend (convection) 
     343                                  CALL iom_put( "strd_evd"  , ptrdy ) 
     344         CASE( jptra_dmp  )   ;   CALL iom_put( "ttrd_dmp"  , ptrdx )         ! internal restoring (damping) 
     345                                  CALL iom_put( "strd_dmp"  , ptrdy ) 
     346         CASE( jptra_bbl  )   ;   CALL iom_put( "ttrd_bbl"  , ptrdx )         ! bottom boundary layer 
     347                                  CALL iom_put( "strd_bbl"  , ptrdy ) 
     348         CASE( jptra_npc  )   ;   CALL iom_put( "ttrd_npc"  , ptrdx )         ! static instability mixing 
     349                                  CALL iom_put( "strd_npc"  , ptrdy ) 
     350         CASE( jptra_bbc  )   ;   CALL iom_put( "ttrd_bbc"  , ptrdx )         ! geothermal heating   (only on temperature) 
     351         CASE( jptra_nsr  )   ;   CALL iom_put( "ttrd_qns"  , ptrdx(:,:,1) )  ! surface forcing + runoff (ln_rnf=T) 
     352                                  CALL iom_put( "strd_cdt"  , ptrdy(:,:,1) )        ! output as 2D surface fields 
     353         CASE( jptra_qsr  )   ;   CALL iom_put( "ttrd_qsr"  , ptrdx )         ! penetrative solar radiat. (only on temperature) 
     354         END SELECT 
     355         ! the Asselin filter trend  is also every other time step but needs to be lagged one time step 
     356         ! Even when 1ts output is selected can go to the same (2ts) file as the trends plotted every even time step. 
     357      ELSEIF( MOD( kt, 2 ) == 1 ) THEN 
     358         SELECT CASE( ktrd ) 
     359         CASE( jptra_atf  )   ;   CALL iom_put( "ttrd_atf" , ptrdx )        ! asselin time Filter 
     360                                  CALL iom_put( "strd_atf" , ptrdy ) 
     361         END SELECT 
     362      ENDIF 
     363      ! 
    353364   END SUBROUTINE trd_tra_iom 
    354365 
  • branches/2017/dev_r7881_ENHANCE09_RK3/NEMOGCM/NEMO/TOP_SRC/TRP/trcnxt.F90

    r7881 r8850  
    2828   USE oce_trc         ! ocean dynamics and tracers variables 
    2929   USE trc             ! ocean passive tracers variables 
    30    USE lbclnk          ! ocean lateral boundary conditions (or mpp link) 
    31    USE prtctl_trc      ! Print control for debbuging 
    3230   USE trd_oce 
    3331   USE trdtra 
     
    3836   USE agrif_top_interp 
    3937# endif 
     38   ! 
     39   USE lbclnk          ! ocean lateral boundary conditions (or mpp link) 
     40   USE prtctl_trc      ! Print control for debbuging 
    4041 
    4142   IMPLICIT NONE 
    4243   PRIVATE 
    4344 
    44    PUBLIC   trc_nxt          ! routine called by step.F90 
     45   PUBLIC   trc_nxt   ! routine called by step.F90 
    4546 
    4647   REAL(wp) ::   rfact1, rfact2 
     
    8283      REAL(wp) ::   zfact            ! temporary scalar 
    8384      CHARACTER (len=22) :: charout 
    84       REAL(wp), POINTER, DIMENSION(:,:,:,:) ::  ztrdt  
     85      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:) ::   ztrdt    ! 4D workspace 
    8586      !!---------------------------------------------------------------------- 
    8687      ! 
     
    102103 
    103104      IF( l_trdtrc )  THEN             ! trends: store now fields before the Asselin filter application 
    104          CALL wrk_alloc( jpi, jpj, jpk, jptra, ztrdt ) 
     105         ALLOCATE( ztrdt(jpi,jpj,jpk,jptra) ) 
    105106         ztrdt(:,:,:,:)  = trn(:,:,:,:) 
    106107      ENDIF 
     
    137138            END DO 
    138139         END DO 
    139          CALL wrk_dealloc( jpi, jpj, jpk, jptra, ztrdt )  
     140         DEALLOCATE( ztrdt )  
    140141      END IF 
    141142      ! 
Note: See TracChangeset for help on using the changeset viewer.