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 12377 for NEMO/trunk/tests/CANAL/MY_SRC/diawri.F90 – NEMO

Ignore:
Timestamp:
2020-02-12T15:39:06+01:00 (4 years ago)
Author:
acc
Message:

The big one. Merging all 2019 developments from the option 1 branch back onto the trunk.

This changeset reproduces 2019/dev_r11943_MERGE_2019 on the trunk using a 2-URL merge
onto a working copy of the trunk. I.e.:

svn merge --ignore-ancestry \

svn+ssh://acc@forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/NEMO/trunk \
svn+ssh://acc@forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/NEMO/branches/2019/dev_r11943_MERGE_2019 ./

The --ignore-ancestry flag avoids problems that may otherwise arise from the fact that
the merge history been trunk and branch may have been applied in a different order but
care has been taken before this step to ensure that all applicable fixes and updates
are present in the merge branch.

The trunk state just before this step has been branched to releases/release-4.0-HEAD
and that branch has been immediately tagged as releases/release-4.0.2. Any fixes
or additions in response to tickets on 4.0, 4.0.1 or 4.0.2 should be done on
releases/release-4.0-HEAD. From now on future 'point' releases (e.g. 4.0.2) will
remain unchanged with periodic releases as needs demand. Note release-4.0-HEAD is a
transitional naming convention. Future full releases, say 4.2, will have a release-4.2
branch which fulfills this role and the first point release (e.g. 4.2.0) will be made
immediately following the release branch creation.

2020 developments can be started from any trunk revision later than this one.

Location:
NEMO/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • NEMO/trunk

    • Property svn:externals
      •  

        old new  
        33^/utils/build/mk@HEAD         mk 
        44^/utils/tools@HEAD            tools 
        5 ^/vendors/AGRIF/dev@HEAD      ext/AGRIF 
         5^/vendors/AGRIF/dev_r11615_ENHANCE-04_namelists_as_internalfiles_agrif@HEAD      ext/AGRIF 
        66^/vendors/FCM@HEAD            ext/FCM 
        77^/vendors/IOIPSL@HEAD         ext/IOIPSL 
  • NEMO/trunk/tests/CANAL/MY_SRC/diawri.F90

    r12206 r12377  
    5656   USE lib_mpp         ! MPP library 
    5757   USE timing          ! preformance summary 
    58    USE diurnal_bulk    ! diurnal warm layer 
    59    USE cool_skin       ! Cool skin 
     58   USE diu_bulk        ! diurnal warm layer 
     59   USE diu_coolskin    ! Cool skin 
    6060 
    6161   IMPLICIT NONE 
     
    7676   INTEGER, SAVE, ALLOCATABLE, DIMENSION(:) :: ndex_bT 
    7777 
    78    !! * Substitutions 
    79 #  include "vectopt_loop_substitute.h90" 
    8078   !!---------------------------------------------------------------------- 
    8179   !! NEMO/OCE 4.0 , NEMO Consortium (2018) 
     
    9694 
    9795    
    98    SUBROUTINE dia_wri( kt ) 
     96   SUBROUTINE dia_wri( kt, Kmm ) 
    9997      !!--------------------------------------------------------------------- 
    10098      !!                  ***  ROUTINE dia_wri  *** 
     
    106104      !!---------------------------------------------------------------------- 
    107105      INTEGER, INTENT( in ) ::   kt      ! ocean time-step index 
     106      INTEGER, INTENT( in ) ::   Kmm     ! ocean time level index 
    108107      !! 
    109108      INTEGER ::   ji, jj, jk       ! dummy loop indices 
     
    114113      REAL(wp), DIMENSION(jpi,jpj)     ::   z2d   ! 2D workspace 
    115114      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   z3d   ! 3D workspace 
    116       REAL(wp), DIMENSION(jpi,jpj,jpk) ::   bu, bv   ! volume of u- and v-boxes 
    117       REAL(wp), DIMENSION(jpi,jpj,jpk) ::   r1_bt    ! inverse of t-box volume 
    118115      !!---------------------------------------------------------------------- 
    119116      !  
     
    122119      ! Output the initial state and forcings 
    123120      IF( ninist == 1 ) THEN                        
    124          CALL dia_wri_state( 'output.init' ) 
     121         CALL dia_wri_state( Kmm, 'output.init' ) 
    125122         ninist = 0 
    126123      ENDIF 
     
    131128      CALL iom_put("e3v_0", e3v_0(:,:,:) ) 
    132129      ! 
    133       CALL iom_put( "e3t" , e3t_n(:,:,:) ) 
    134       CALL iom_put( "e3u" , e3u_n(:,:,:) ) 
    135       CALL iom_put( "e3v" , e3v_n(:,:,:) ) 
    136       CALL iom_put( "e3w" , e3w_n(:,:,:) ) 
     130      CALL iom_put( "e3t" , e3t(:,:,:,Kmm) ) 
     131      CALL iom_put( "e3u" , e3u(:,:,:,Kmm) ) 
     132      CALL iom_put( "e3v" , e3v(:,:,:,Kmm) ) 
     133      CALL iom_put( "e3w" , e3w(:,:,:,Kmm) ) 
    137134      IF( iom_use("e3tdef") )   & 
    138          CALL iom_put( "e3tdef"  , ( ( e3t_n(:,:,:) - e3t_0(:,:,:) ) / e3t_0(:,:,:) * 100 * tmask(:,:,:) ) ** 2 ) 
     135         CALL iom_put( "e3tdef"  , ( ( e3t(:,:,:,Kmm) - e3t_0(:,:,:) ) / e3t_0(:,:,:) * 100 * tmask(:,:,:) ) ** 2 ) 
    139136 
    140137      IF( ll_wd ) THEN 
    141          CALL iom_put( "ssh" , (sshn+ssh_ref)*tmask(:,:,1) )   ! sea surface height (brought back to the reference used for wetting and drying) 
     138         CALL iom_put( "ssh" , (ssh(:,:,Kmm)+ssh_ref)*tmask(:,:,1) )   ! sea surface height (brought back to the reference used for wetting and drying) 
    142139      ELSE 
    143          CALL iom_put( "ssh" , sshn )              ! sea surface height 
     140         CALL iom_put( "ssh" , ssh(:,:,Kmm) )              ! sea surface height 
    144141      ENDIF 
    145142 
    146143      IF( iom_use("wetdep") )   &                  ! wet depth 
    147          CALL iom_put( "wetdep" , ht_0(:,:) + sshn(:,:) ) 
     144         CALL iom_put( "wetdep" , ht_0(:,:) + ssh(:,:,Kmm) ) 
    148145       
    149       CALL iom_put( "toce", tsn(:,:,:,jp_tem) )    ! 3D temperature 
    150       CALL iom_put(  "sst", tsn(:,:,1,jp_tem) )    ! surface temperature 
     146      CALL iom_put( "toce", ts(:,:,:,jp_tem,Kmm) )    ! 3D temperature 
     147      CALL iom_put(  "sst", ts(:,:,1,jp_tem,Kmm) )    ! surface temperature 
    151148      IF ( iom_use("sbt") ) THEN 
    152149         DO jj = 1, jpj 
    153150            DO ji = 1, jpi 
    154151               ikbot = mbkt(ji,jj) 
    155                z2d(ji,jj) = tsn(ji,jj,ikbot,jp_tem) 
     152               z2d(ji,jj) = ts(ji,jj,ikbot,jp_tem,Kmm) 
    156153            END DO 
    157154         END DO 
     
    159156      ENDIF 
    160157       
    161       CALL iom_put( "soce", tsn(:,:,:,jp_sal) )    ! 3D salinity 
    162       CALL iom_put(  "sss", tsn(:,:,1,jp_sal) )    ! surface salinity 
     158      CALL iom_put( "soce", ts(:,:,:,jp_sal,Kmm) )    ! 3D salinity 
     159      CALL iom_put(  "sss", ts(:,:,1,jp_sal,Kmm) )    ! surface salinity 
    163160      IF ( iom_use("sbs") ) THEN 
    164161         DO jj = 1, jpj 
    165162            DO ji = 1, jpi 
    166163               ikbot = mbkt(ji,jj) 
    167                z2d(ji,jj) = tsn(ji,jj,ikbot,jp_sal) 
     164               z2d(ji,jj) = ts(ji,jj,ikbot,jp_sal,Kmm) 
    168165            END DO 
    169166         END DO 
     
    176173         DO jj = 2, jpjm1 
    177174            DO ji = fs_2, fs_jpim1   ! vector opt. 
    178                zztmp2 = (  ( rCdU_bot(ji+1,jj)+rCdU_bot(ji  ,jj) ) * un(ji  ,jj,mbku(ji  ,jj))  )**2   & 
    179                   &   + (  ( rCdU_bot(ji  ,jj)+rCdU_bot(ji-1,jj) ) * un(ji-1,jj,mbku(ji-1,jj))  )**2   & 
    180                   &   + (  ( rCdU_bot(ji,jj+1)+rCdU_bot(ji,jj  ) ) * vn(ji,jj  ,mbkv(ji,jj  ))  )**2   & 
    181                   &   + (  ( rCdU_bot(ji,jj  )+rCdU_bot(ji,jj-1) ) * vn(ji,jj-1,mbkv(ji,jj-1))  )**2 
     175               zztmp2 = (  ( rCdU_bot(ji+1,jj)+rCdU_bot(ji  ,jj) ) * uu(ji  ,jj,mbku(ji  ,jj),Kmm)  )**2   & 
     176                  &   + (  ( rCdU_bot(ji  ,jj)+rCdU_bot(ji-1,jj) ) * uu(ji-1,jj,mbku(ji-1,jj),Kmm)  )**2   & 
     177                  &   + (  ( rCdU_bot(ji,jj+1)+rCdU_bot(ji,jj  ) ) * vv(ji,jj  ,mbkv(ji,jj  ),Kmm)  )**2   & 
     178                  &   + (  ( rCdU_bot(ji,jj  )+rCdU_bot(ji,jj-1) ) * vv(ji,jj-1,mbkv(ji,jj-1),Kmm)  )**2 
    182179               z2d(ji,jj) = zztmp * SQRT( zztmp2 ) * tmask(ji,jj,1)  
    183180               ! 
     
    188185      ENDIF 
    189186          
    190       CALL iom_put( "uoce", un(:,:,:) )            ! 3D i-current 
    191       CALL iom_put(  "ssu", un(:,:,1) )            ! surface i-current 
     187      CALL iom_put( "uoce", uu(:,:,:,Kmm) )            ! 3D i-current 
     188      CALL iom_put(  "ssu", uu(:,:,1,Kmm) )            ! surface i-current 
    192189      IF ( iom_use("sbu") ) THEN 
    193190         DO jj = 1, jpj 
    194191            DO ji = 1, jpi 
    195192               ikbot = mbku(ji,jj) 
    196                z2d(ji,jj) = un(ji,jj,ikbot) 
     193               z2d(ji,jj) = uu(ji,jj,ikbot,Kmm) 
    197194            END DO 
    198195         END DO 
     
    200197      ENDIF 
    201198       
    202       CALL iom_put( "voce", vn(:,:,:) )            ! 3D j-current 
    203       CALL iom_put(  "ssv", vn(:,:,1) )            ! surface j-current 
     199      CALL iom_put( "voce", vv(:,:,:,Kmm) )            ! 3D j-current 
     200      CALL iom_put(  "ssv", vv(:,:,1,Kmm) )            ! surface j-current 
    204201      IF ( iom_use("sbv") ) THEN 
    205202         DO jj = 1, jpj 
    206203            DO ji = 1, jpi 
    207204               ikbot = mbkv(ji,jj) 
    208                z2d(ji,jj) = vn(ji,jj,ikbot) 
     205               z2d(ji,jj) = vv(ji,jj,ikbot,Kmm) 
    209206            END DO 
    210207         END DO 
     
    212209      ENDIF 
    213210 
    214       CALL iom_put( "woce", wn )                   ! vertical velocity 
     211      CALL iom_put( "woce", ww )                   ! vertical velocity 
    215212      IF( iom_use('w_masstr') .OR. iom_use('w_masstr2') ) THEN   ! vertical mass transport & its square value 
    216213         ! Caution: in the VVL case, it only correponds to the baroclinic mass transport. 
    217214         z2d(:,:) = rau0 * e1e2t(:,:) 
    218215         DO jk = 1, jpk 
    219             z3d(:,:,jk) = wn(:,:,jk) * z2d(:,:) 
     216            z3d(:,:,jk) = ww(:,:,jk) * z2d(:,:) 
    220217         END DO 
    221218         CALL iom_put( "w_masstr" , z3d )   
     
    235232            DO jj = 2, jpjm1                                    ! sal gradient 
    236233               DO ji = fs_2, fs_jpim1   ! vector opt. 
    237                   zztmp  = tsn(ji,jj,jk,jp_sal) 
    238                   zztmpx = ( tsn(ji+1,jj,jk,jp_sal) - zztmp ) * r1_e1u(ji,jj) + ( zztmp - tsn(ji-1,jj  ,jk,jp_sal) ) * r1_e1u(ji-1,jj) 
    239                   zztmpy = ( tsn(ji,jj+1,jk,jp_sal) - zztmp ) * r1_e2v(ji,jj) + ( zztmp - tsn(ji  ,jj-1,jk,jp_sal) ) * r1_e2v(ji,jj-1) 
     234                  zztmp  = ts(ji,jj,jk,jp_sal,Kmm) 
     235                  zztmpx = ( ts(ji+1,jj,jk,jp_sal,Kmm) - zztmp ) * r1_e1u(ji,jj) + ( zztmp - ts(ji-1,jj  ,jk,jp_sal,Kmm) ) * r1_e1u(ji-1,jj) 
     236                  zztmpy = ( ts(ji,jj+1,jk,jp_sal,Kmm) - zztmp ) * r1_e2v(ji,jj) + ( zztmp - ts(ji  ,jj-1,jk,jp_sal,Kmm) ) * r1_e2v(ji,jj-1) 
    240237                  z3d(ji,jj,jk) = 0.25 * ( zztmpx * zztmpx + zztmpy * zztmpy )   & 
    241238                     &                 * umask(ji,jj,jk) * umask(ji-1,jj,jk) * vmask(ji,jj,jk) * umask(ji,jj-1,jk) 
     
    252249         DO jj = 2, jpjm1                                    ! sst gradient 
    253250            DO ji = fs_2, fs_jpim1   ! vector opt. 
    254                zztmp  = tsn(ji,jj,1,jp_tem) 
    255                zztmpx = ( tsn(ji+1,jj,1,jp_tem) - zztmp ) * r1_e1u(ji,jj) + ( zztmp - tsn(ji-1,jj  ,1,jp_tem) ) * r1_e1u(ji-1,jj) 
    256                zztmpy = ( tsn(ji,jj+1,1,jp_tem) - zztmp ) * r1_e2v(ji,jj) + ( zztmp - tsn(ji  ,jj-1,1,jp_tem) ) * r1_e2v(ji,jj-1) 
     251               zztmp  = ts(ji,jj,1,jp_tem,Kmm) 
     252               zztmpx = ( ts(ji+1,jj,1,jp_tem,Kmm) - zztmp ) * r1_e1u(ji,jj) + ( zztmp - ts(ji-1,jj  ,1,jp_tem,Kmm) ) * r1_e1u(ji-1,jj) 
     253               zztmpy = ( ts(ji,jj+1,1,jp_tem,Kmm) - zztmp ) * r1_e2v(ji,jj) + ( zztmp - ts(ji  ,jj-1,1,jp_tem,Kmm) ) * r1_e2v(ji,jj-1) 
    257254               z2d(ji,jj) = 0.25 * ( zztmpx * zztmpx + zztmpy * zztmpy )   & 
    258255                  &              * umask(ji,jj,1) * umask(ji-1,jj,1) * vmask(ji,jj,1) * umask(ji,jj-1,1) 
     
    271268            DO jj = 1, jpj 
    272269               DO ji = 1, jpi 
    273                   z2d(ji,jj) = z2d(ji,jj) + e3t_n(ji,jj,jk) * tsn(ji,jj,jk,jp_tem) * tmask(ji,jj,jk) 
     270                  z2d(ji,jj) = z2d(ji,jj) + e3t(ji,jj,jk,Kmm) * ts(ji,jj,jk,jp_tem,Kmm) * tmask(ji,jj,jk) 
    274271               END DO 
    275272            END DO 
     
    283280            DO jj = 1, jpj 
    284281               DO ji = 1, jpi 
    285                   z2d(ji,jj) = z2d(ji,jj) + e3t_n(ji,jj,jk) * tsn(ji,jj,jk,jp_sal) * tmask(ji,jj,jk) 
     282                  z2d(ji,jj) = z2d(ji,jj) + e3t(ji,jj,jk,Kmm) * ts(ji,jj,jk,jp_sal,Kmm) * tmask(ji,jj,jk) 
    286283               END DO 
    287284            END DO 
     
    295292            DO jj = 1, jpj 
    296293               DO ji = 1, jpi 
    297                   z2d(ji,jj) = z2d(ji,jj) + e3t_n(ji,jj,jk) * tsn(ji,jj,jk,jp_sal) * tsn(ji,jj,jk,jp_sal) * tmask(ji,jj,jk) 
     294                  z2d(ji,jj) = z2d(ji,jj) + e3t(ji,jj,jk,Kmm) * ts(ji,jj,jk,jp_sal,Kmm) * ts(ji,jj,jk,jp_sal,Kmm) * tmask(ji,jj,jk) 
    298295               END DO 
    299296            END DO 
     
    305302         z3d(:,:,jpk) = 0._wp  
    306303         DO jk = 1, jpkm1 
    307             DO jj = 2, jpj 
    308                DO ji = 2, jpi 
    309                   zztmpx = 0.5 * ( un(ji-1,jj  ,jk) + un(ji,jj,jk) ) 
    310                   zztmpy = 0.5 * ( vn(ji  ,jj-1,jk) + vn(ji,jj,jk) ) 
    311                   z3d(ji,jj,jk) = 0.5 * ( zztmpx*zztmpx + zztmpy*zztmpy ) 
     304            DO jj = 2, jpjm1 
     305               DO ji = fs_2, fs_jpim1   ! vector opt. 
     306                  zztmp  = 0.25_wp * r1_e1e2t(ji,jj) / e3t(ji,jj,jk,Kmm) 
     307                  z3d(ji,jj,jk) = zztmp * (  uu(ji-1,jj,jk,Kmm)**2 * e2u(ji-1,jj) * e3u(ji-1,jj,jk,Kmm)   & 
     308                     &                     + uu(ji  ,jj,jk,Kmm)**2 * e2u(ji  ,jj) * e3u(ji  ,jj,jk,Kmm)   & 
     309                     &                     + vv(ji,jj-1,jk,Kmm)**2 * e1v(ji,jj-1) * e3v(ji,jj-1,jk,Kmm)   & 
     310                     &                     + vv(ji,jj  ,jk,Kmm)**2 * e1v(ji,jj  ) * e3v(ji,jj  ,jk,Kmm)   ) 
    312311               END DO 
    313312            END DO 
     
    325324            DO jj = 2, jpj 
    326325               DO ji = 2, jpi 
    327                   z3d(ji,jj,jk) = 0.25_wp * ( un(ji  ,jj,jk) * un(ji  ,jj,jk) * e1e2u(ji  ,jj) * e3u_n(ji  ,jj,jk)  & 
    328                      &                      + un(ji-1,jj,jk) * un(ji-1,jj,jk) * e1e2u(ji-1,jj) * e3u_n(ji-1,jj,jk)  & 
    329                      &                      + vn(ji,jj  ,jk) * vn(ji,jj  ,jk) * e1e2v(ji,jj  ) * e3v_n(ji,jj  ,jk)  & 
    330                      &                      + vn(ji,jj-1,jk) * vn(ji,jj-1,jk) * e1e2v(ji,jj-1) * e3v_n(ji,jj-1,jk)  )  & 
    331                      &                    * r1_e1e2t(ji,jj) / e3t_n(ji,jj,jk) * tmask(ji,jj,jk) 
     326                  z3d(ji,jj,jk) = 0.25_wp * ( uu(ji  ,jj,jk,Kmm) * uu(ji  ,jj,jk,Kmm) * e1e2u(ji  ,jj) * e3u(ji  ,jj,jk,Kmm)  & 
     327                     &                      + uu(ji-1,jj,jk,Kmm) * uu(ji-1,jj,jk,Kmm) * e1e2u(ji-1,jj) * e3u(ji-1,jj,jk,Kmm)  & 
     328                     &                      + vv(ji,jj  ,jk,Kmm) * vv(ji,jj  ,jk,Kmm) * e1e2v(ji,jj  ) * e3v(ji,jj  ,jk,Kmm)  & 
     329                     &                      + vv(ji,jj-1,jk,Kmm) * vv(ji,jj-1,jk,Kmm) * e1e2v(ji,jj-1) * e3v(ji,jj-1,jk,Kmm)  )  & 
     330                     &                    * r1_e1e2t(ji,jj) / e3t(ji,jj,jk,Kmm) * tmask(ji,jj,jk) 
    332331               END DO 
    333332            END DO 
     
    341340            DO jj = 1, jpj 
    342341               DO ji = 1, jpi 
    343                   z2d(ji,jj) = z2d(ji,jj) + e3t_n(ji,jj,jk) * z3d(ji,jj,jk) * tmask(ji,jj,jk) 
     342                  z2d(ji,jj) = z2d(ji,jj) + e3t(ji,jj,jk,Kmm) * z3d(ji,jj,jk) * tmask(ji,jj,jk) 
    344343               END DO 
    345344            END DO 
     
    349348      ENDIF 
    350349      ! 
    351       CALL iom_put( "hdiv", hdivn )                  ! Horizontal divergence 
     350      CALL iom_put( "hdiv", hdiv )                  ! Horizontal divergence 
    352351 
    353352      IF ( iom_use("relvor") .OR. iom_use("absvor") .OR. iom_use("potvor") ) THEN 
     
    357356            DO jj = 1, jpjm1 
    358357               DO ji = 1, fs_jpim1   ! vector opt. 
    359                   z3d(ji,jj,jk) = (  e2v(ji+1,jj  ) * vn(ji+1,jj  ,jk) - e2v(ji,jj) * vn(ji,jj,jk)    & 
    360                      &              - e1u(ji  ,jj+1) * un(ji  ,jj+1,jk) + e1u(ji,jj) * un(ji,jj,jk)  ) * r1_e1e2f(ji,jj) 
     358                  z3d(ji,jj,jk) = (   e2v(ji+1,jj  ) * vv(ji+1,jj  ,jk,Kmm) - e2v(ji,jj) * vv(ji,jj,jk,Kmm)    & 
     359                     &              - e1u(ji  ,jj+1) * uu(ji  ,jj+1,jk,Kmm) + e1u(ji,jj) * uu(ji,jj,jk,Kmm)  ) * r1_e1e2f(ji,jj) 
    361360               END DO 
    362361            END DO 
     
    377376            DO jj = 1, jpjm1 
    378377               DO ji = 1, fs_jpim1   ! vector opt. 
    379                   ze3  = (  e3t_n(ji,jj+1,jk)*tmask(ji,jj+1,jk) + e3t_n(ji+1,jj+1,jk)*tmask(ji+1,jj+1,jk)   & 
    380                      &    + e3t_n(ji,jj  ,jk)*tmask(ji,jj  ,jk) + e3t_n(ji+1,jj  ,jk)*tmask(ji+1,jj  ,jk)  ) 
     378                  ze3  = (  e3t(ji,jj+1,jk,Kmm)*tmask(ji,jj+1,jk) + e3t(ji+1,jj+1,jk,Kmm)*tmask(ji+1,jj+1,jk)   & 
     379                     &    + e3t(ji,jj  ,jk,Kmm)*tmask(ji,jj  ,jk) + e3t(ji+1,jj  ,jk,Kmm)*tmask(ji+1,jj  ,jk)  ) 
    381380                  IF( ze3 /= 0._wp ) THEN   ;   ze3 = 4._wp / ze3 
    382381                  ELSE                      ;   ze3 = 0._wp 
     
    396395         z2d(:,:) = 0.e0 
    397396         DO jk = 1, jpkm1 
    398             z3d(:,:,jk) = rau0 * un(:,:,jk) * e2u(:,:) * e3u_n(:,:,jk) * umask(:,:,jk) 
     397            z3d(:,:,jk) = rau0 * uu(:,:,jk,Kmm) * e2u(:,:) * e3u(:,:,jk,Kmm) * umask(:,:,jk) 
    399398            z2d(:,:) = z2d(:,:) + z3d(:,:,jk) 
    400399         END DO 
     
    408407            DO jj = 2, jpjm1 
    409408               DO ji = fs_2, fs_jpim1   ! vector opt. 
    410                   z2d(ji,jj) = z2d(ji,jj) + z3d(ji,jj,jk) * ( tsn(ji,jj,jk,jp_tem) + tsn(ji+1,jj,jk,jp_tem) ) 
     409                  z2d(ji,jj) = z2d(ji,jj) + z3d(ji,jj,jk) * ( ts(ji,jj,jk,jp_tem,Kmm) + ts(ji+1,jj,jk,jp_tem,Kmm) ) 
    411410               END DO 
    412411            END DO 
     
    421420            DO jj = 2, jpjm1 
    422421               DO ji = fs_2, fs_jpim1   ! vector opt. 
    423                   z2d(ji,jj) = z2d(ji,jj) + z3d(ji,jj,jk) * ( tsn(ji,jj,jk,jp_sal) + tsn(ji+1,jj,jk,jp_sal) ) 
     422                  z2d(ji,jj) = z2d(ji,jj) + z3d(ji,jj,jk) * ( ts(ji,jj,jk,jp_sal,Kmm) + ts(ji+1,jj,jk,jp_sal,Kmm) ) 
    424423               END DO 
    425424            END DO 
     
    433432         z3d(:,:,jpk) = 0.e0 
    434433         DO jk = 1, jpkm1 
    435             z3d(:,:,jk) = rau0 * vn(:,:,jk) * e1v(:,:) * e3v_n(:,:,jk) * vmask(:,:,jk) 
     434            z3d(:,:,jk) = rau0 * vv(:,:,jk,Kmm) * e1v(:,:) * e3v(:,:,jk,Kmm) * vmask(:,:,jk) 
    436435         END DO 
    437436         CALL iom_put( "v_masstr", z3d )              ! mass transport in j-direction 
     
    443442            DO jj = 2, jpjm1 
    444443               DO ji = fs_2, fs_jpim1   ! vector opt. 
    445                   z2d(ji,jj) = z2d(ji,jj) + z3d(ji,jj,jk) * ( tsn(ji,jj,jk,jp_tem) + tsn(ji,jj+1,jk,jp_tem) ) 
     444                  z2d(ji,jj) = z2d(ji,jj) + z3d(ji,jj,jk) * ( ts(ji,jj,jk,jp_tem,Kmm) + ts(ji,jj+1,jk,jp_tem,Kmm) ) 
    446445               END DO 
    447446            END DO 
     
    456455            DO jj = 2, jpjm1 
    457456               DO ji = fs_2, fs_jpim1   ! vector opt. 
    458                   z2d(ji,jj) = z2d(ji,jj) + z3d(ji,jj,jk) * ( tsn(ji,jj,jk,jp_sal) + tsn(ji,jj+1,jk,jp_sal) ) 
     457                  z2d(ji,jj) = z2d(ji,jj) + z3d(ji,jj,jk) * ( ts(ji,jj,jk,jp_sal,Kmm) + ts(ji,jj+1,jk,jp_sal,Kmm) ) 
    459458               END DO 
    460459            END DO 
     
    469468            DO jj = 2, jpjm1 
    470469               DO ji = fs_2, fs_jpim1   ! vector opt. 
    471                   z2d(ji,jj) = z2d(ji,jj) + e3t_n(ji,jj,jk) *  tsn(ji,jj,jk,jp_tem) 
     470                  z2d(ji,jj) = z2d(ji,jj) + e3t(ji,jj,jk,Kmm) *  ts(ji,jj,jk,jp_tem,Kmm) 
    472471               END DO 
    473472            END DO 
     
    481480            DO jj = 2, jpjm1 
    482481               DO ji = fs_2, fs_jpim1   ! vector opt. 
    483                   z2d(ji,jj) = z2d(ji,jj) + e3t_n(ji,jj,jk) * tsn(ji,jj,jk,jp_sal) 
     482                  z2d(ji,jj) = z2d(ji,jj) + e3t(ji,jj,jk,Kmm) * ts(ji,jj,jk,jp_sal,Kmm) 
    484483               END DO 
    485484            END DO 
     
    492491      ! 
    493492           
    494       IF (ln_dia25h)   CALL dia_25h( kt )             ! 25h averaging 
     493      IF (ln_dia25h)   CALL dia_25h( kt, Kmm )        ! 25h averaging 
    495494 
    496495      IF( ln_timing )   CALL timing_stop('dia_wri') 
     
    518517 
    519518    
    520    SUBROUTINE dia_wri( kt ) 
     519   SUBROUTINE dia_wri( kt, Kmm ) 
    521520      !!--------------------------------------------------------------------- 
    522521      !!                  ***  ROUTINE dia_wri  *** 
     
    531530      !!---------------------------------------------------------------------- 
    532531      INTEGER, INTENT( in ) ::   kt   ! ocean time-step index 
     532      INTEGER, INTENT( in ) ::   Kmm  ! ocean time level index 
    533533      ! 
    534534      LOGICAL ::   ll_print = .FALSE.                        ! =T print and flush numout 
     
    546546      ! 
    547547      IF( ninist == 1 ) THEN     !==  Output the initial state and forcings  ==! 
    548          CALL dia_wri_state( 'output.init' ) 
     548         CALL dia_wri_state( Kmm, 'output.init' ) 
    549549         ninist = 0 
    550550      ENDIF 
     
    687687            &          jpi, jpj, nh_T, ipk, 1, ipk, nz_T, 32, clop, zsto, zout ) 
    688688         IF(  .NOT.ln_linssh  ) THEN 
    689             CALL histdef( nid_T, "vovvle3t", "Level thickness"                    , "m"      ,&  ! e3t_n 
     689            CALL histdef( nid_T, "vovvle3t", "Level thickness"                    , "m"      ,&  ! e3t(:,:,:,Kmm) 
    690690            &             jpi, jpj, nh_T, ipk, 1, ipk, nz_T, 32, clop, zsto, zout ) 
    691             CALL histdef( nid_T, "vovvldep", "T point depth"                      , "m"      ,&  ! e3t_n 
     691            CALL histdef( nid_T, "vovvldep", "T point depth"                      , "m"      ,&  ! e3t(:,:,:,Kmm) 
    692692            &             jpi, jpj, nh_T, ipk, 1, ipk, nz_T, 32, clop, zsto, zout ) 
    693             CALL histdef( nid_T, "vovvldef", "Squared level deformation"          , "%^2"    ,&  ! e3t_n 
     693            CALL histdef( nid_T, "vovvldef", "Squared level deformation"          , "%^2"    ,&  ! e3t(:,:,:,Kmm) 
    694694            &             jpi, jpj, nh_T, ipk, 1, ipk, nz_T, 32, clop, zsto, zout ) 
    695695         ENDIF 
     
    708708            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout ) 
    709709         IF(  ln_linssh  ) THEN 
    710             CALL histdef( nid_T, "sosst_cd", "Concentration/Dilution term on temperature"     &  ! emp * tsn(:,:,1,jp_tem) 
     710            CALL histdef( nid_T, "sosst_cd", "Concentration/Dilution term on temperature"     &  ! emp * ts(:,:,1,jp_tem,Kmm) 
    711711            &                                                                  , "KgC/m2/s",  &  ! sosst_cd 
    712712            &             jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout ) 
    713             CALL histdef( nid_T, "sosss_cd", "Concentration/Dilution term on salinity"        &  ! emp * tsn(:,:,1,jp_sal) 
     713            CALL histdef( nid_T, "sosss_cd", "Concentration/Dilution term on salinity"        &  ! emp * ts(:,:,1,jp_sal,Kmm) 
    714714            &                                                                  , "KgPSU/m2/s",&  ! sosss_cd 
    715715            &             jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout ) 
     
    787787 
    788788         !                                                                                      !!! nid_U : 3D 
    789          CALL histdef( nid_U, "vozocrtx", "Zonal Current"                      , "m/s"    ,   &  ! un 
     789         CALL histdef( nid_U, "vozocrtx", "Zonal Current"                      , "m/s"    ,   &  ! uu(:,:,:,Kmm) 
    790790            &          jpi, jpj, nh_U, ipk, 1, ipk, nz_U, 32, clop, zsto, zout ) 
    791791         IF( ln_wave .AND. ln_sdw) THEN 
     
    800800 
    801801         !                                                                                      !!! nid_V : 3D 
    802          CALL histdef( nid_V, "vomecrty", "Meridional Current"                 , "m/s"    ,   &  ! vn 
     802         CALL histdef( nid_V, "vomecrty", "Meridional Current"                 , "m/s"    ,   &  ! vv(:,:,:,Kmm) 
    803803            &          jpi, jpj, nh_V, ipk, 1, ipk, nz_V, 32, clop, zsto, zout ) 
    804804         IF( ln_wave .AND. ln_sdw) THEN 
     
    813813 
    814814         !                                                                                      !!! nid_W : 3D 
    815          CALL histdef( nid_W, "vovecrtz", "Vertical Velocity"                  , "m/s"    ,   &  ! wn 
     815         CALL histdef( nid_W, "vovecrtz", "Vertical Velocity"                  , "m/s"    ,   &  ! ww 
    816816            &          jpi, jpj, nh_W, ipk, 1, ipk, nz_W, 32, clop, zsto, zout ) 
    817817         CALL histdef( nid_W, "votkeavt", "Vertical Eddy Diffusivity"          , "m2/s"   ,   &  ! avt 
     
    851851 
    852852      IF( .NOT.ln_linssh ) THEN 
    853          CALL histwrite( nid_T, "votemper", it, tsn(:,:,:,jp_tem) * e3t_n(:,:,:) , ndim_T , ndex_T  )   ! heat content 
    854          CALL histwrite( nid_T, "vosaline", it, tsn(:,:,:,jp_sal) * e3t_n(:,:,:) , ndim_T , ndex_T  )   ! salt content 
    855          CALL histwrite( nid_T, "sosstsst", it, tsn(:,:,1,jp_tem) * e3t_n(:,:,1) , ndim_hT, ndex_hT )   ! sea surface heat content 
    856          CALL histwrite( nid_T, "sosaline", it, tsn(:,:,1,jp_sal) * e3t_n(:,:,1) , ndim_hT, ndex_hT )   ! sea surface salinity content 
     853         CALL histwrite( nid_T, "votemper", it, ts(:,:,:,jp_tem,Kmm) * e3t(:,:,:,Kmm) , ndim_T , ndex_T  )   ! heat content 
     854         CALL histwrite( nid_T, "vosaline", it, ts(:,:,:,jp_sal,Kmm) * e3t(:,:,:,Kmm) , ndim_T , ndex_T  )   ! salt content 
     855         CALL histwrite( nid_T, "sosstsst", it, ts(:,:,1,jp_tem,Kmm) * e3t(:,:,1,Kmm) , ndim_hT, ndex_hT )   ! sea surface heat content 
     856         CALL histwrite( nid_T, "sosaline", it, ts(:,:,1,jp_sal,Kmm) * e3t(:,:,1,Kmm) , ndim_hT, ndex_hT )   ! sea surface salinity content 
    857857      ELSE 
    858          CALL histwrite( nid_T, "votemper", it, tsn(:,:,:,jp_tem) , ndim_T , ndex_T  )   ! temperature 
    859          CALL histwrite( nid_T, "vosaline", it, tsn(:,:,:,jp_sal) , ndim_T , ndex_T  )   ! salinity 
    860          CALL histwrite( nid_T, "sosstsst", it, tsn(:,:,1,jp_tem) , ndim_hT, ndex_hT )   ! sea surface temperature 
    861          CALL histwrite( nid_T, "sosaline", it, tsn(:,:,1,jp_sal) , ndim_hT, ndex_hT )   ! sea surface salinity 
     858         CALL histwrite( nid_T, "votemper", it, ts(:,:,:,jp_tem,Kmm) , ndim_T , ndex_T  )   ! temperature 
     859         CALL histwrite( nid_T, "vosaline", it, ts(:,:,:,jp_sal,Kmm) , ndim_T , ndex_T  )   ! salinity 
     860         CALL histwrite( nid_T, "sosstsst", it, ts(:,:,1,jp_tem,Kmm) , ndim_hT, ndex_hT )   ! sea surface temperature 
     861         CALL histwrite( nid_T, "sosaline", it, ts(:,:,1,jp_sal,Kmm) , ndim_hT, ndex_hT )   ! sea surface salinity 
    862862      ENDIF 
    863863      IF( .NOT.ln_linssh ) THEN 
    864          zw3d(:,:,:) = ( ( e3t_n(:,:,:) - e3t_0(:,:,:) ) / e3t_0(:,:,:) * 100 * tmask(:,:,:) ) ** 2 
    865          CALL histwrite( nid_T, "vovvle3t", it, e3t_n (:,:,:) , ndim_T , ndex_T  )   ! level thickness 
    866          CALL histwrite( nid_T, "vovvldep", it, gdept_n(:,:,:) , ndim_T , ndex_T  )   ! t-point depth 
     864         zw3d(:,:,:) = ( ( e3t(:,:,:,Kmm) - e3t_0(:,:,:) ) / e3t_0(:,:,:) * 100 * tmask(:,:,:) ) ** 2 
     865         CALL histwrite( nid_T, "vovvle3t", it, e3t (:,:,:,Kmm) , ndim_T , ndex_T  )   ! level thickness 
     866         CALL histwrite( nid_T, "vovvldep", it, gdept(:,:,:,Kmm) , ndim_T , ndex_T  )   ! t-point depth 
    867867         CALL histwrite( nid_T, "vovvldef", it, zw3d             , ndim_T , ndex_T  )   ! level thickness deformation 
    868868      ENDIF 
    869       CALL histwrite( nid_T, "sossheig", it, sshn          , ndim_hT, ndex_hT )   ! sea surface height 
     869      CALL histwrite( nid_T, "sossheig", it, ssh(:,:,Kmm)          , ndim_hT, ndex_hT )   ! sea surface height 
    870870      CALL histwrite( nid_T, "sowaflup", it, ( emp-rnf )   , ndim_hT, ndex_hT )   ! upward water flux 
    871871      CALL histwrite( nid_T, "sorunoff", it, rnf           , ndim_hT, ndex_hT )   ! river runoffs 
     
    874874                                                                                  ! in linear free surface case) 
    875875      IF( ln_linssh ) THEN 
    876          zw2d(:,:) = emp (:,:) * tsn(:,:,1,jp_tem) 
     876         zw2d(:,:) = emp (:,:) * ts(:,:,1,jp_tem,Kmm) 
    877877         CALL histwrite( nid_T, "sosst_cd", it, zw2d, ndim_hT, ndex_hT )          ! c/d term on sst 
    878          zw2d(:,:) = emp (:,:) * tsn(:,:,1,jp_sal) 
     878         zw2d(:,:) = emp (:,:) * ts(:,:,1,jp_sal,Kmm) 
    879879         CALL histwrite( nid_T, "sosss_cd", it, zw2d, ndim_hT, ndex_hT )          ! c/d term on sss 
    880880      ENDIF 
     
    912912         CALL histwrite( nid_T, "sohefldp", it, qrp           , ndim_hT, ndex_hT )   ! heat flux damping 
    913913         CALL histwrite( nid_T, "sowafldp", it, erp           , ndim_hT, ndex_hT )   ! freshwater flux damping 
    914          zw2d(:,:) = erp(:,:) * tsn(:,:,1,jp_sal) * tmask(:,:,1) 
     914         zw2d(:,:) = erp(:,:) * ts(:,:,1,jp_sal,Kmm) * tmask(:,:,1) 
    915915         CALL histwrite( nid_T, "sosafldp", it, zw2d          , ndim_hT, ndex_hT )   ! salt flux damping 
    916916      ENDIF 
     
    925925#endif 
    926926 
    927       CALL histwrite( nid_U, "vozocrtx", it, un            , ndim_U , ndex_U )    ! i-current 
     927      CALL histwrite( nid_U, "vozocrtx", it, uu(:,:,:,Kmm)            , ndim_U , ndex_U )    ! i-current 
    928928      CALL histwrite( nid_U, "sozotaux", it, utau          , ndim_hU, ndex_hU )   ! i-wind stress 
    929929 
    930       CALL histwrite( nid_V, "vomecrty", it, vn            , ndim_V , ndex_V  )   ! j-current 
     930      CALL histwrite( nid_V, "vomecrty", it, vv(:,:,:,Kmm)            , ndim_V , ndex_V  )   ! j-current 
    931931      CALL histwrite( nid_V, "sometauy", it, vtau          , ndim_hV, ndex_hV )   ! j-wind stress 
    932932 
    933       CALL histwrite( nid_W, "vovecrtz", it, wn             , ndim_T, ndex_T )    ! vert. current 
     933      CALL histwrite( nid_W, "vovecrtz", it, ww             , ndim_T, ndex_T )    ! vert. current 
    934934      CALL histwrite( nid_W, "votkeavt", it, avt            , ndim_T, ndex_T )    ! T vert. eddy diff. coef. 
    935935      CALL histwrite( nid_W, "votkeavm", it, avm            , ndim_T, ndex_T )    ! T vert. eddy visc. coef. 
     
    958958#endif 
    959959 
    960    SUBROUTINE dia_wri_state( cdfile_name ) 
     960   SUBROUTINE dia_wri_state( Kmm, cdfile_name ) 
    961961      !!--------------------------------------------------------------------- 
    962962      !!                 ***  ROUTINE dia_wri_state  *** 
     
    971971      !!      File 'output.abort.nc' is created in case of abnormal job end 
    972972      !!---------------------------------------------------------------------- 
     973      INTEGER           , INTENT( in ) ::   Kmm              ! time level index 
    973974      CHARACTER (len=* ), INTENT( in ) ::   cdfile_name      ! name of the file created 
    974975      !! 
     
    987988#endif 
    988989 
    989       CALL iom_rstput( 0, 0, inum, 'votemper', tsn(:,:,:,jp_tem) )    ! now temperature 
    990       CALL iom_rstput( 0, 0, inum, 'vosaline', tsn(:,:,:,jp_sal) )    ! now salinity 
    991       CALL iom_rstput( 0, 0, inum, 'sossheig', sshn              )    ! sea surface height 
    992       CALL iom_rstput( 0, 0, inum, 'vozocrtx', un                )    ! now i-velocity 
    993       CALL iom_rstput( 0, 0, inum, 'vomecrty', vn                )    ! now j-velocity 
    994       CALL iom_rstput( 0, 0, inum, 'vovecrtz', wn                )    ! now k-velocity 
     990      CALL iom_rstput( 0, 0, inum, 'votemper', ts(:,:,:,jp_tem,Kmm) )    ! now temperature 
     991      CALL iom_rstput( 0, 0, inum, 'vosaline', ts(:,:,:,jp_sal,Kmm) )    ! now salinity 
     992      CALL iom_rstput( 0, 0, inum, 'sossheig', ssh(:,:,Kmm)              )    ! sea surface height 
     993      CALL iom_rstput( 0, 0, inum, 'vozocrtx', uu(:,:,:,Kmm)                )    ! now i-velocity 
     994      CALL iom_rstput( 0, 0, inum, 'vomecrty', vv(:,:,:,Kmm)                )    ! now j-velocity 
     995      CALL iom_rstput( 0, 0, inum, 'vovecrtz', ww                )    ! now k-velocity 
    995996      IF( ALLOCATED(ahtu) ) THEN 
    996997         CALL iom_rstput( 0, 0, inum,  'ahtu', ahtu              )    ! aht at u-point 
     
    10081009      CALL iom_rstput( 0, 0, inum, 'sometauy', vtau              )    ! j-wind stress 
    10091010      IF(  .NOT.ln_linssh  ) THEN              
    1010          CALL iom_rstput( 0, 0, inum, 'vovvldep', gdept_n        )    !  T-cell depth  
    1011          CALL iom_rstput( 0, 0, inum, 'vovvle3t', e3t_n          )    !  T-cell thickness   
     1011         CALL iom_rstput( 0, 0, inum, 'vovvldep', gdept(:,:,:,Kmm)        )    !  T-cell depth  
     1012         CALL iom_rstput( 0, 0, inum, 'vovvle3t', e3t(:,:,:,Kmm)          )    !  T-cell thickness   
    10121013      END IF 
    10131014      IF( ln_wave .AND. ln_sdw ) THEN 
Note: See TracChangeset for help on using the changeset viewer.