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 13463 for NEMO/branches/2019/dev_r11351_fldread_with_XIOS/src/TOP/trcstp.F90 – NEMO

Ignore:
Timestamp:
2020-09-14T17:40:34+02:00 (4 years ago)
Author:
andmirek
Message:

Ticket #2195:update to trunk 13461

Location:
NEMO/branches/2019/dev_r11351_fldread_with_XIOS
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/2019/dev_r11351_fldread_with_XIOS

    • 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_r12970_AGRIF_CMEMS      ext/AGRIF 
        66^/vendors/FCM@HEAD            ext/FCM 
        77^/vendors/IOIPSL@HEAD         ext/IOIPSL 
         8 
         9# SETTE 
         10^/utils/CI/sette@13382        sette 
  • NEMO/branches/2019/dev_r11351_fldread_with_XIOS/src/TOP/trcstp.F90

    r10570 r13463  
    55   !!====================================================================== 
    66   !! History :  1.0  !  2004-03  (C. Ethe)  Original 
     7   !!            4.1  !  2019-08  (A. Coward, D. Storkey) rewrite in preparation for new timestepping scheme 
    78   !!---------------------------------------------------------------------- 
    89#if defined key_top 
     
    1718   USE trcwri 
    1819   USE trcrst 
    19    USE trcsub         ! 
    2020   USE trdtrc_oce 
    2121   USE trdmxl_trc 
    2222   USE sms_pisces,  ONLY : ln_check_mass 
    2323   ! 
    24    USE prtctl_trc     ! Print control for debbuging 
     24   USE prtctl         ! Print control for debbuging 
    2525   USE iom            ! 
    2626   USE in_out_manager ! 
     
    3737   REAL(wp), DIMENSION(:,:,:), SAVE, ALLOCATABLE ::   qsr_arr   ! save qsr during TOP time-step 
    3838 
     39#  include "domzgr_substitute.h90" 
    3940   !!---------------------------------------------------------------------- 
    4041   !! NEMO/TOP 4.0 , NEMO Consortium (2018) 
     
    4445CONTAINS 
    4546 
    46    SUBROUTINE trc_stp( kt ) 
     47   SUBROUTINE trc_stp( kt, Kbb, Kmm, Krhs, Kaa ) 
    4748      !!------------------------------------------------------------------- 
    4849      !!                     ***  ROUTINE trc_stp  *** 
     
    5354      !!                Update the passive tracers 
    5455      !!------------------------------------------------------------------- 
    55       INTEGER, INTENT( in ) ::   kt   ! ocean time-step index 
     56      INTEGER, INTENT( in ) :: kt                  ! ocean time-step index 
     57      INTEGER, INTENT( in ) :: Kbb, Kmm, Krhs, Kaa ! time level indices 
    5658      ! 
    5759      INTEGER ::   jk, jn   ! dummy loop indices 
     
    6365      IF( ln_timing )   CALL timing_start('trc_stp') 
    6466      ! 
    65       IF( ( neuler == 0 .AND. kt == nittrc000 ) .OR. ln_top_euler ) THEN     ! at nittrc000 
    66          r2dttrc =  rdttrc           ! = rdttrc (use or restarting with Euler time stepping) 
    67       ELSEIF( kt <= nittrc000 + nn_dttrc ) THEN          ! at nittrc000 or nittrc000+1 
    68          r2dttrc = 2. * rdttrc       ! = 2 rdttrc (leapfrog) 
    69       ENDIF 
    70       ! 
    71       ll_trcstat  = ( ln_ctl .OR. sn_cfctl%l_trcstat ) .AND. & 
     67      IF( l_1st_euler .OR. ln_top_euler ) THEN     ! at nittrc000 
     68         rDt_trc =  rn_Dt           ! = rn_Dt (use or restarting with Euler time stepping) 
     69      ELSEIF( kt <= nittrc000 + 1 ) THEN                                     ! at nittrc000 or nittrc000+1  
     70         rDt_trc = 2. * rn_Dt       ! = 2 rn_Dt (leapfrog)  
     71      ENDIF 
     72      ! 
     73      ll_trcstat  = ( sn_cfctl%l_trcstat ) .AND. & 
    7274     &              ( ( MOD( kt, sn_cfctl%ptimincr ) == 0 ) .OR. ( kt == nitend ) ) 
     75 
     76      IF( kt == nittrc000 )                      CALL trc_stp_ctl   ! control  
    7377      IF( kt == nittrc000 .AND. lk_trdmxl_trc )  CALL trd_mxl_trc_init    ! trends: Mixed-layer 
    7478      ! 
    7579      IF( .NOT.ln_linssh ) THEN                                           ! update ocean volume due to ssh temporal evolution 
    7680         DO jk = 1, jpk 
    77             cvol(:,:,jk) = e1e2t(:,:) * e3t_n(:,:,jk) * tmask(:,:,jk) 
     81            cvol(:,:,jk) = e1e2t(:,:) * e3t(:,:,jk,Kmm) * tmask(:,:,jk) 
    7882         END DO 
    79          IF ( ln_ctl .OR. kt == nitrst .OR. ( ln_check_mass .AND. kt == nitend )              & 
     83         IF ( ll_trcstat .OR. kt == nitrst .OR. ( ln_check_mass .AND. kt == nitend )   & 
    8084            & .OR. iom_use( "pno3tot" ) .OR. iom_use( "ppo4tot" ) .OR. iom_use( "psiltot" )   & 
    8185            & .OR. iom_use( "palktot" ) .OR. iom_use( "pfertot" ) )                           & 
     
    8589      IF( l_trcdm2dc )   CALL trc_mean_qsr( kt ) 
    8690      !     
    87       IF( nn_dttrc /= 1 )   CALL trc_sub_stp( kt )  ! averaging physical variables for sub-stepping 
    88       !     
    89       IF( MOD( kt , nn_dttrc ) == 0 ) THEN      ! only every nn_dttrc time step 
    90          ! 
    91          IF(ln_ctl) THEN 
    92             WRITE(charout,FMT="('kt =', I4,'  d/m/y =',I2,I2,I4)") kt, nday, nmonth, nyear 
    93             CALL prt_ctl_trc_info(charout) 
    94          ENDIF 
    95          ! 
    96          tra(:,:,:,:) = 0.e0 
    97          ! 
    98                                    CALL trc_rst_opn  ( kt )       ! Open tracer restart file  
    99          IF( lrst_trc )            CALL trc_rst_cal  ( kt, 'WRITE' )   ! calendar 
    100                                    CALL trc_wri      ( kt )       ! output of passive tracers with iom I/O manager 
    101                                    CALL trc_sms      ( kt )       ! tracers: sinks and sources 
    102                                    CALL trc_trp      ( kt )       ! transport of passive tracers 
    103          IF( kt == nittrc000 ) THEN 
    104             CALL iom_close( numrtr )       ! close input tracer restart file 
    105             IF(lwm) CALL FLUSH( numont )   ! flush namelist output 
    106          ENDIF 
    107          IF( lrst_trc )            CALL trc_rst_wri  ( kt )       ! write tracer restart file 
    108          IF( lk_trdmxl_trc  )      CALL trd_mxl_trc  ( kt )       ! trends: Mixed-layer 
    109          ! 
    110          IF( nn_dttrc /= 1   )     CALL trc_sub_reset( kt )       ! resetting physical variables when sub-stepping 
    111          ! 
     91      ! 
     92      IF(sn_cfctl%l_prttrc) THEN 
     93         WRITE(charout,FMT="('kt =', I4,'  d/m/y =',I2,I2,I4)") kt, nday, nmonth, nyear 
     94         CALL prt_ctl_info( charout, cdcomp = 'top' ) 
     95      ENDIF 
     96      ! 
     97      tr(:,:,:,:,Krhs) = 0._wp 
     98      ! 
     99      CALL trc_rst_opn  ( kt )                            ! Open tracer restart file  
     100      IF( lrst_trc )  CALL trc_rst_cal  ( kt, 'WRITE' )   ! calendar 
     101      CALL trc_wri      ( kt,      Kmm            )       ! output of passive tracers with iom I/O manager 
     102      CALL trc_sms      ( kt, Kbb, Kmm, Krhs      )       ! tracers: sinks and sources 
     103      CALL trc_trp      ( kt, Kbb, Kmm, Krhs, Kaa )       ! transport of passive tracers 
     104           ! 
     105           ! Note passive tracers have been time-filtered in trc_trp but the time level 
     106           ! indices will not be swapped until after tra_atf/dyn_atf/ssh_atf in stp. Subsequent calls here 
     107           ! anticipate this update which will be: Nrhs= Nbb ; Nbb = Nnn ; Nnn = Naa ; Naa = Nrhs 
     108           ! and use the filtered levels explicitly. 
     109           ! 
     110      IF( kt == nittrc000 ) THEN 
     111         CALL iom_close( numrtr )                         ! close input tracer restart file 
     112         IF(lwm) CALL FLUSH( numont )                     ! flush namelist output 
     113      ENDIF 
     114      IF( lrst_trc )            CALL trc_rst_wri  ( kt, Kmm, Kaa, Kbb  )       ! write tracer restart file 
     115      IF( lk_trdmxl_trc  )      CALL trd_mxl_trc  ( kt,      Kaa       )       ! trends: Mixed-layer 
     116      ! 
     117      IF( ln_top_euler ) THEN  
     118         ! For Euler timestepping for TOP we need to copy the "after" to the "now" fields  
     119         ! here then after the (leapfrog) swapping of the time-level indices in OCE/step.F90 we have  
     120         ! "before" fields = "now" fields. 
     121         tr(:,:,:,:,Kmm) = tr(:,:,:,:,Kaa) 
    112122      ENDIF 
    113123      ! 
     
    115125         ztrai = 0._wp                                                   !  content of all tracers 
    116126         DO jn = 1, jptra 
    117             ztrai = ztrai + glob_sum( 'trcstp', trn(:,:,:,jn) * cvol(:,:,:)   ) 
     127            ztrai = ztrai + glob_sum( 'trcstp', tr(:,:,:,jn,Kaa) * cvol(:,:,:)   ) 
    118128         END DO 
    119129         IF( lwm ) WRITE(numstr,9300) kt,  ztrai / areatot 
     
    124134      ! 
    125135   END SUBROUTINE trc_stp 
     136 
     137 
     138   SUBROUTINE trc_stp_ctl 
     139      !!---------------------------------------------------------------------- 
     140      !!                     ***  ROUTINE trc_stp_ctl  *** 
     141      !! ** Purpose :        Control  + ocean volume 
     142      !!---------------------------------------------------------------------- 
     143      ! 
     144      ! Define logical parameter ton control dirunal cycle in TOP 
     145      l_trcdm2dc = ln_dm2dc .OR. ( ln_cpl .AND. ncpl_qsr_freq /= 1 .AND. ncpl_qsr_freq /= 0 ) 
     146      l_trcdm2dc = l_trcdm2dc .AND. .NOT. l_offline 
     147      ! 
     148      IF( l_trcdm2dc .AND. lwp )   CALL ctl_warn( 'Coupling with passive tracers and used of diurnal cycle.',   & 
     149         &                           'Computation of a daily mean shortwave for some biogeochemical models ' ) 
     150      ! 
     151   END SUBROUTINE trc_stp_ctl 
    126152 
    127153 
     
    153179            nb_rec_per_day = ncpl_qsr_freq 
    154180         ELSE   
    155             rdt_sampl = MAX( 3600., rdttrc ) 
     181            rdt_sampl = MAX( 3600., rn_Dt ) 
    156182            nb_rec_per_day = INT( rday / rdt_sampl ) 
    157183         ENDIF 
     
    172198 
    173199            CALL iom_get( numrtr, 'ktdcy', zkt )   
    174             rsecfst = INT( zkt ) * rdttrc 
     200            rsecfst = INT( zkt ) * rn_Dt 
    175201            IF(lwp) WRITE(numout,*) 'trc_qsr_mean:   qsr_mean read in the restart file at time-step rsecfst =', rsecfst, ' s ' 
    176             CALL iom_get( numrtr, jpdom_autoglo, 'qsr_mean', qsr_mean )   !  A mean of qsr 
     202            CALL iom_get( numrtr, jpdom_auto, 'qsr_mean', qsr_mean )   !  A mean of qsr 
    177203            CALL iom_get( numrtr, 'nrdcy', zrec )   !  Number of record per days 
    178204            IF( INT( zrec ) == nb_rec_per_day ) THEN 
     
    180206                  IF( jn <= 9 )  THEN 
    181207                    WRITE(cl1,'(i1)') jn 
    182                     CALL iom_get( numrtr, jpdom_autoglo, 'qsr_arr_'//cl1, qsr_arr(:,:,jn) )   !  A mean of qsr 
     208                    CALL iom_get( numrtr, jpdom_auto, 'qsr_arr_'//cl1, qsr_arr(:,:,jn) )   !  A mean of qsr 
    183209                  ELSE 
    184210                    WRITE(cl2,'(i2.2)') jn 
    185                     CALL iom_get( numrtr, jpdom_autoglo, 'qsr_arr_'//cl2, qsr_arr(:,:,jn) )   !  A mean of qsr 
     211                    CALL iom_get( numrtr, jpdom_auto, 'qsr_arr_'//cl2, qsr_arr(:,:,jn) )   !  A mean of qsr 
    186212                  ENDIF 
    187213              END DO 
     
    193219         ELSE                                         !* no restart: set from nit000 values 
    194220            IF(lwp) WRITE(numout,*) 'trc_qsr_mean:   qsr_mean set to nit000 values' 
    195             rsecfst  = kt * rdttrc 
     221            rsecfst  = kt * rn_Dt 
    196222            ! 
    197223            qsr_mean(:,:) = qsr(:,:) 
     
    203229      ENDIF 
    204230      ! 
    205       rseclast = kt * rdttrc 
     231      rseclast = kt * rn_Dt 
    206232      ! 
    207233      llnew   = ( rseclast - rsecfst ) .ge.  rdt_sampl    !   new shortwave to store 
Note: See TracChangeset for help on using the changeset viewer.