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 15574 for NEMO/branches/2021/dev_r14318_RK3_stage1/src/TOP/PISCES/SED/sedrst.F90 – NEMO

Ignore:
Timestamp:
2021-12-03T20:32:50+01:00 (3 years ago)
Author:
techene
Message:

#2605 #2715 trunk merged into dev_r14318_RK3_stage1

Location:
NEMO/branches/2021/dev_r14318_RK3_stage1
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/2021/dev_r14318_RK3_stage1

    • Property svn:externals
      •  

        old new  
        99 
        1010# SETTE 
        11 ^/utils/CI/sette@14244        sette 
         11^/utils/CI/sette@HEAD        sette 
         12 
  • NEMO/branches/2021/dev_r14318_RK3_stage1/src/TOP/PISCES/SED/sedrst.F90

    r14239 r15574  
    4242      CHARACTER(LEN=50)   ::   clname   ! trc output restart file name 
    4343      CHARACTER(LEN=256)  ::   clpath   ! full path to ocean output restart file 
    44       CHARACTER(LEN=52)   ::   clpname   ! trc output restart file name including AGRIF 
     44      CHARACTER(LEN=3)    ::   cdcomp 
    4545      !!---------------------------------------------------------------------- 
    4646      ! 
     
    6565 
    6666      IF( .NOT. ln_rst_list .AND. nn_stock == -1 )   RETURN   ! we will never do any restart 
    67  
    6867      ! to get better performances with NetCDF format: 
    69       ! we open and define the tracer restart file one tracer time step before writing the data (-> at nitrst - 1) 
    70       ! except if we write tracer restart files every tracer time step or if a tracer restart file was writen at nitend - 1 
    71       IF( kt == nitrst - 2*nn_dtsed .OR. nn_stock == nn_dtsed .OR. ( kt == nitend - nn_dtsed .AND. .NOT. lrst_sed ) ) THEN 
     68      ! we open and define the tracer restart file one tracer time step before writing the data (-> at nitrst - 2*nn_dttrc + 1) 
     69      ! except if we write tracer restart files every tracer time step or if a tracer restart file was writen at nitend - 2*nn_dttrc + 1 
     70      IF( kt == nitrst - 1 .OR. nn_stock == 1 .OR. ( kt == nitend - 1 .AND. .NOT. lrst_sed ) ) THEN 
    7271         ! beware of the format used to write kt (default is i8.8, that should be large enough) 
    7372         IF( nitrst > 1.0e9 ) THEN   ;   WRITE(clkt,*       ) nitrst 
     
    8180         IF(lwp) WRITE(numsed,*) & 
    8281             '             open sed restart.output NetCDF file: ',TRIM(clpath)//clname 
    83          IF(.NOT.lwxios) THEN 
    84             CALL iom_open( TRIM(clpath)//TRIM(clname), numrsw, ldwrt = .TRUE., kdlev = jpksed, cdcomp = 'SED' ) 
    85          ELSE 
    86 #if defined key_xios 
    87             cw_sedrst_cxt = "rstws_"//TRIM(ADJUSTL(clkt)) 
    88             IF( TRIM(Agrif_CFixed()) == '0' ) THEN 
    89                clpname = clname 
    90             ELSE 
    91                clpname = TRIM(Agrif_CFixed())//"_"//clname 
    92             ENDIF 
    93             numrsw = iom_xios_setid(TRIM(clpath)//TRIM(clpname)) 
    94             CALL iom_init( cw_sedrst_cxt, kdid = numrsw, ld_closedef = .FALSE. ) 
    95 #else 
    96             CALL ctl_stop( 'Can not use XIOS in trc_rst_opn' ) 
    97 #endif 
    98          ENDIF 
    99  
     82         cdcomp ='SED' 
     83         CALL iom_open( TRIM(clpath)//TRIM(clname), numrsw, ldwrt = .TRUE., kdlev = jpksed, cdcomp = cdcomp ) 
    10084         lrst_sed = .TRUE. 
    10185      ENDIF 
     
    204188         &             zdta2(1:jpi,1:jpj,1:jpksed), iarroce(1:jpoce) ) 
    205189 
    206       cltra = "sedligand" 
    207       IF( iom_varid( numrsr, TRIM(cltra) , ldstop = .FALSE. ) > 0 ) THEN 
    208          CALL iom_get( numrsr, jpdom_auto, TRIM(cltra), zdta2(:,:,:) ) 
    209       ELSE 
    210          zdta2(:,:,:) = 0.0 
    211       ENDIF 
    212  
    213       CALL pack_arr( jpoce, sedligand(1:jpoce,1:jpksed), & 
    214          &             zdta2(1:jpi,1:jpj,1:jpksed), iarroce(1:jpoce) ) 
    215190      IF( ln_timing )  CALL timing_stop('sed_rst_read') 
    216191      
     
    247222      IF(lwp) WRITE(numsed,*) '~~~~~~~~~' 
    248223 
    249  
    250       trcsedi(:,:,:,:)   = 0.0 
    251       flxsedi3d(:,:,:,:) = 0.0 
    252224      zdta(:,:)          = 1.0 
    253225      zdta2(:,:,:)       = 0.0 
    254  
    255226          
    256227      !! 1. WRITE in nutwrs 
    257228      !! ------------------ 
    258 !     zinfo(1) = REAL( kt) 
    259       CALL iom_rstput( kt, nitrst, numrsw, 'kt', REAL( kt    , wp) ) 
     229      zinfo(1) = REAL( kt) 
     230      CALL iom_rstput( kt, nitrst, numrsw, 'kt', zinfo ) 
    260231 
    261232      ! Back to 2D geometry 
    262233      DO jn = 1, jpsol 
    263          CALL unpack_arr( jpoce, trcsedi(1:jpi,1:jpj,1:jpksed,jn) , iarroce(1:jpoce), & 
     234         CALL unpack_arr( jpoce, zdta2(1:jpi,1:jpj,1:jpksed) , iarroce(1:jpoce), & 
    264235         &                       solcp(1:jpoce,1:jpksed,jn ) ) 
     236         cltra = TRIM(sedtrcd(jn)) 
     237         CALL iom_rstput( kt, nitrst, numrsw, TRIM(cltra), zdta2(:,:,:) ) 
    265238      END DO 
    266239 
    267240      DO jn = 1, jpwat 
    268          CALL unpack_arr( jpoce, trcsedi(1:jpi,1:jpj,1:jpksed,jpsol+jn) , iarroce(1:jpoce), & 
     241         CALL unpack_arr( jpoce, zdta2(1:jpi,1:jpj,1:jpksed) , iarroce(1:jpoce), & 
    269242         &                       pwcp(1:jpoce,1:jpksed,jn  )  ) 
     243         cltra = TRIM(sedtrcd(jpsol+jn)) 
     244         CALL iom_rstput( kt, nitrst, numrsw, TRIM(cltra), zdta2(:,:,:) ) 
    270245      END DO 
    271246      ! pH 
     
    276251      ENDDO 
    277252 
    278       CALL unpack_arr( jpoce, flxsedi3d(1:jpi,1:jpj,1:jpksed,1)  , iarroce(1:jpoce), & 
     253      CALL unpack_arr( jpoce, zdta2(1:jpi,1:jpj,1:jpksed)  , iarroce(1:jpoce), & 
    279254      &                   zdta(1:jpoce,1:jpksed)  ) 
     255      cltra = TRIM(seddia3d(1)) 
     256      CALL iom_rstput( kt, nitrst, numrsw, TRIM(cltra), zdta2(:,:,:) ) 
    280257          
    281       CALL unpack_arr( jpoce, flxsedi3d(1:jpi,1:jpj,1:jpksed,2)  , iarroce(1:jpoce), & 
     258      CALL unpack_arr( jpoce, zdta2(1:jpi,1:jpj,1:jpksed)  , iarroce(1:jpoce), & 
    282259      &                   co3por(1:jpoce,1:jpksed)  ) 
     260      cltra = TRIM(seddia3d(2)) 
     261      CALL iom_rstput( kt, nitrst, numrsw, TRIM(cltra), zdta2(:,:,:) ) 
    283262 
    284263      ! prognostic variables 
    285264      ! -------------------- 
    286265 
    287       DO jn = 1, jptrased 
    288          cltra = TRIM(sedtrcd(jn)) 
    289          CALL iom_rstput( kt, nitrst, numrsw, TRIM(cltra), trcsedi(:,:,:,jn) ) 
    290       ENDDO 
    291  
    292       DO jn = 1, 2 
    293          cltra = TRIM(seddia3d(jn)) 
    294          CALL iom_rstput( kt, nitrst, numrsw, TRIM(cltra), flxsedi3d(:,:,:,jn) ) 
    295       ENDDO 
    296  
    297266      CALL unpack_arr( jpoce, zdta2(1:jpi,1:jpj,1:jpksed)  , iarroce(1:jpoce), & 
    298267      &                   db(1:jpoce,1:jpksed)  ) 
     
    307276      CALL iom_rstput( kt, nitrst, numrsw, TRIM(cltra), zdta2(:,:,:) ) 
    308277 
    309       CALL unpack_arr( jpoce, zdta2(1:jpi,1:jpj,1:jpksed)  , iarroce(1:jpoce), & 
    310       &                   sedligand(1:jpoce,1:jpksed)  ) 
    311  
    312       cltra = "sedligand" 
    313       CALL iom_rstput( kt, nitrst, numrsw, TRIM(cltra), zdta2(:,:,:) ) 
    314  
    315278      IF( kt == nitrst ) THEN 
    316           IF(.NOT.lwxios) THEN 
    317              CALL iom_close( numrsw )     ! close the restart file (only at last time step) 
    318           ELSE 
    319              CALL iom_context_finalize( cw_sedrst_cxt )  
    320              iom_file(numrsw)%nfid       = 0 
    321              numrsw = 0 
    322           ENDIF 
     279          CALL iom_close( numrsw )     ! close the restart file (only at last time step) 
    323280          IF( l_offline .AND. ln_rst_list ) THEN 
    324281             nrst_lst = nrst_lst + 1 
     
    351308      !!       In both those options, the  exact duration of the experiment 
    352309      !!       since the beginning (cumulated duration of all previous restart runs) 
    353       !!       is not stored in the restart and is assumed to be (nittrc000-1)*rn_Dt. 
     310      !!       is not stored in the restart and is assumed to be (nittrc000-1)*rdt. 
    354311      !!       This is valid is the time step has remained constant. 
    355312      !! 
     
    363320      REAL(wp) ::  zkt, zrdttrc1 
    364321      REAL(wp) ::  zndastp 
    365       CHARACTER(len = 82) :: clpname 
    366322 
    367323      ! Time domain : restart 
     
    375331 
    376332         IF( ln_rst_sed ) THEN 
    377             lxios_sini = .FALSE. 
    378333            CALL iom_open( TRIM(cn_sedrst_indir)//'/'//cn_sedrst_in, numrsr ) 
    379  
    380             IF( lrxios) THEN 
    381                 cr_sedrst_cxt = 'sed_rst' 
    382                 IF(lwp) WRITE(numout,*) 'Enable restart reading by XIOS for SED' 
    383 !               IF( TRIM(Agrif_CFixed()) == '0' ) THEN 
    384 !                  clpname = cn_sedrst_in 
    385 !               ELSE 
    386 !                  clpname = TRIM(Agrif_CFixed())//"_"//cn_sedrst_in    
    387 !               ENDIF 
    388                 CALL iom_init( cr_sedrst_cxt, kdid = numrsr, ld_closedef = .TRUE. ) 
    389             ENDIF 
    390334            CALL iom_get ( numrsr, 'kt', zkt )   ! last time-step of previous run 
     335 
    391336            IF(lwp) THEN 
    392337               WRITE(numsed,*) ' *** Info read in restart : ' 
     
    401346            ENDIF 
    402347            ! Control of date  
    403             IF( nittrc000  - NINT( zkt ) /= nn_dtsed .AND.  nn_rstsed /= 0 )                                  & 
     348            IF( nittrc000  - NINT( zkt ) /= 1 .AND.  nn_rstsed /= 0 )                                  & 
    404349               &   CALL ctl_stop( ' ===>>>> : problem with nittrc000 for the restart',                 & 
    405350               &                  ' verify the restart file or rerun with nn_rsttr = 0 (namelist)' ) 
     
    414359             ELSE 
    415360               ndastp = ndate0 - 1     ! ndate0 read in the namelist in dom_nam 
    416                adatrj = ( REAL( nittrc000-1, wp ) * rn_Dt ) / rday 
     361               adatrj = ( REAL( nittrc000-1, wp ) * rdt ) / rday 
    417362               ! note this is wrong if time step has changed during run 
    418363            ENDIF 
     
    435380            IF(lwp) WRITE(numsed,*) 'trc_wri : write the TOP restart file (NetCDF) at it= ', kt, ' date= ', ndastp 
    436381            IF(lwp) WRITE(numsed,*) '~~~~~~~' 
    437             IF( lwxios ) CALL iom_init_closedef(cw_sedrst_cxt) 
    438382         ENDIF 
    439383         CALL iom_rstput( kt, nitrst, numrsw, 'kt'     , REAL( kt    , wp) )   ! time-step 
    440384         CALL iom_rstput( kt, nitrst, numrsw, 'ndastp' , REAL( ndastp, wp) )   ! date 
    441          CALL iom_rstput( kt, nitrst, numrsw, 'adatrj' , adatrj )   ! number of elapsed days since 
    442          !                                                                                      ! the begining of the run [s] 
     385         CALL iom_rstput( kt, nitrst, numrsw, 'adatrj' , adatrj            )   ! number of elapsed days since 
     386         !                                                                     ! the begining of the run [s] 
    443387      ENDIF 
    444388 
Note: See TracChangeset for help on using the changeset viewer.