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 11870 for NEMO/branches/2019/dev_r11756_SI3restart_XIOS – NEMO

Ignore:
Timestamp:
2019-11-07T12:27:28+01:00 (4 years ago)
Author:
andmirek
Message:

Ticket #2323: open single restart write context for all restart files

Location:
NEMO/branches/2019/dev_r11756_SI3restart_XIOS/src
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/2019/dev_r11756_SI3restart_XIOS/src/ICE/icedia.F90

    r11840 r11870  
    277277         ! Write in numriw (if iter == nitrst) 
    278278         ! ------------------  
    279          IF(lwxios) CALL iom_swap(      cwixios_context          ) 
     279         IF(lwxios) CALL iom_swap(      cwxios_context          ) 
    280280         CALL iom_rstput( iter, nitrst, numriw, 'frc_voltop' , frc_voltop,  ldxios = lwxios ) 
    281281         CALL iom_rstput( iter, nitrst, numriw, 'frc_volbot' , frc_volbot,  ldxios = lwxios ) 
  • NEMO/branches/2019/dev_r11756_SI3restart_XIOS/src/ICE/icedyn_adv_pra.F90

    r11840 r11870  
    893893         ! 
    894894         !                                                           ! ice thickness 
    895          IF(lwxios) CALL iom_swap( TRIM(cwixios_context) ) 
     895         IF(lwxios) CALL iom_swap( TRIM(cwxios_context) ) 
    896896         CALL iom_rstput( iter, nitrst, numriw, 'sxice' , sxice,  ldxios = lwxios ) 
    897897         CALL iom_rstput( iter, nitrst, numriw, 'syice' , syice,  ldxios = lwxios ) 
  • NEMO/branches/2019/dev_r11756_SI3restart_XIOS/src/ICE/icedyn_rhg_evp.F90

    r11840 r11870  
    870870      !!---------------------------------------------------------------------- 
    871871      ! 
     872      IF(lwxios) THEN 
     873         CALL iom_set_rstw_var_active(rsti_wfields, 'stress1_i' ) 
     874         CALL iom_set_rstw_var_active(rsti_wfields, 'stress2_i' ) 
     875         CALL iom_set_rstw_var_active(rsti_wfields, 'stress12_i') 
     876      ENDIF 
     877 
    872878      IF( TRIM(cdrw) == 'READ' ) THEN        ! Read/initialize 
    873879         !                                   ! --------------- 
    874          IF(lwxios) THEN 
    875             CALL iom_set_rstw_var_active(rsti_wfields, 'stress1_i' ) 
    876             CALL iom_set_rstw_var_active(rsti_wfields, 'stress2_i' ) 
    877             CALL iom_set_rstw_var_active(rsti_wfields, 'stress12_i') 
    878          ENDIF 
    879          ! 
    880880         IF( ln_rstart ) THEN                   !* Read the restart file 
    881881            ! 
     
    910910         iter = kt + nn_fsbc - 1             ! ice restarts are written at kt == nitrst - nn_fsbc + 1 
    911911         ! 
    912          IF(lwxios) CALL iom_swap( TRIM(cwixios_context) ) 
     912         IF(lwxios) CALL iom_swap( TRIM(cwxios_context) ) 
    913913         CALL iom_rstput( iter, nitrst, numriw, 'stress1_i' , stress1_i,  ldxios = lwxios ) 
    914914         CALL iom_rstput( iter, nitrst, numriw, 'stress2_i' , stress2_i,  ldxios = lwxios ) 
  • NEMO/branches/2019/dev_r11756_SI3restart_XIOS/src/ICE/icerst.F90

    r11840 r11870  
    8181            ENDIF 
    8282            ! 
    83             IF(.NOT.lwxios) THEN 
     83            IF(lwxios) THEN 
     84               CALL iom_setkt( nitrst, cwxios_context ) 
     85            ELSE 
    8486               CALL iom_open( TRIM(clpath)//TRIM(clname), numriw, ldwrt = .TRUE., kdlev = jpl ) 
    85             ELSE 
    86 #if defined key_iomput 
    87                cwixios_context = "si3_rstw_"//TRIM(ADJUSTL(clkt)) 
    88                IF( TRIM(Agrif_CFixed()) == '0' ) THEN 
    89                   clpname = clname 
    90                ELSE 
    91                   clpname = TRIM(Agrif_CFixed())//"_"//clname 
    92                ENDIF 
    93                CALL iom_init( cwixios_context, TRIM(clpath)//TRIM(clpname), .false. ) 
    94                CALL xios_update_calendar(nitrst) 
    95                CALL iom_swap(      cxios_context          ) 
    96 #else 
    97                clinfo = 'Can not use XIOS in rst_opn' 
    98                CALL ctl_stop(TRIM(clinfo)) 
    99 #endif 
    10087            ENDIF 
    10188            lrst_ice = .TRUE. 
     
    135122      ! ------------------  
    136123      !                                                                        ! calendar control 
    137       IF(lwxios) CALL iom_swap(      cwixios_context          ) 
    138       CALL iom_rstput( iter, nitrst, numriw, 'nn_fsbc', REAL( nn_fsbc, wp ), ldxios = lwxios )      ! time-step  
     124      IF(lwxios) CALL iom_swap(      cwxios_context          ) 
     125      CALL iom_rstput( iter, nitrst, numriw, 'nn_fsbc_ice', REAL( nn_fsbc, wp ), ldxios = lwxios )      ! time-step  
    139126      CALL iom_rstput( iter, nitrst, numriw, 'kt_ice' , REAL( iter   , wp ), ldxios = lwxios )      ! date 
    140127      CALL iom_delay_rst( 'WRITE', 'ICE', numriw )   ! save only ice delayed global communication variables 
     
    176163      ! ------------------ 
    177164      IF( iter == nitrst ) THEN 
    178          IF(lwxios) THEN 
    179             CALL iom_context_finalize(      cwixios_context          ) 
    180          ELSE 
     165         IF(.NOT. lwxios) THEN 
    181166            CALL iom_close( numriw ) 
    182167         ENDIF 
     
    235220 
    236221         ! Time info 
    237          CALL iom_get( numrir, 'nn_fsbc', zfice, ldxios = lrxios ) 
     222         CALL iom_get( numrir, 'nn_fsbc_ice', zfice, ldxios = lrxios ) 
    238223         CALL iom_get( numrir, 'kt_ice' , ziter, ldxios = lrxios )     
    239224         IF(lwp) WRITE(numout,*) '   read ice restart file at time step    : ', ziter 
     
    246231            &                   '   control of time parameter  nrstdt' ) 
    247232         IF( NINT(zfice) /= nn_fsbc          .AND. ABS( nrstdt ) == 1 )   & 
    248             &     CALL ctl_stop( 'ice_rst_read ===>>>> : problem with nn_fsbc in ice restart',  & 
     233                 CALL ctl_stop( 'ice_rst_read ===>>>> : problem with nn_fsbc in ice restart',  & 
    249234            &                   '   verify the file or rerun with the value 0 for the',         & 
    250235            &                   '   control of time parameter  nrstdt' ) 
  • NEMO/branches/2019/dev_r11756_SI3restart_XIOS/src/ICE/iceupdate.F90

    r11840 r11870  
    448448         iter = kt + nn_fsbc - 1             ! ice restarts are written at kt == nitrst - nn_fsbc + 1 
    449449         ! 
    450          IF(lwxios) CALL iom_swap(      cwixios_context          ) 
     450         IF(lwxios) CALL iom_swap(      cwxios_context          ) 
    451451         CALL iom_rstput( iter, nitrst, numriw, 'snwice_mass'  , snwice_mass, ldxios = lwxios   ) 
    452452         CALL iom_rstput( iter, nitrst, numriw, 'snwice_mass_b', snwice_mass_b, ldxios = lwxios ) 
  • NEMO/branches/2019/dev_r11756_SI3restart_XIOS/src/OCE/IOM/in_out_manager.F90

    r11840 r11870  
    171171   CHARACTER(lc) ::   cwxios_context        !: context name used in xios to write NEMO restart file 
    172172   CHARACTER(lc) ::   crixios_context       !: context name used in xios to read SI3 restart 
    173    CHARACTER(lc) ::   cwixios_context       !: context name used in xios to write SI3 restart 
    174173   LOGICAL       ::   lrsi3_nemo            !: is SI3 irestart in nemo format 
    175174 
  • NEMO/branches/2019/dev_r11756_SI3restart_XIOS/src/OCE/IOM/iom.F90

    r11840 r11870  
    4848   USE diurnal_bulk, ONLY : ln_diurnal_only, ln_diurnal 
    4949#if defined key_si3 
    50    USE ice, ONLY: nlay_i, nlay_s 
     50   USE ice, ONLY: nlay_i, nlay_s, cn_icerst_outdir, cn_icerst_out 
    5151#endif 
    5252 
     
    7272   PRIVATE iom_set_rst_context, iom_set_rstw_active, iom_set_rstr_active 
    7373# endif 
     74   PRIVATE iom_define_restartw, iom_set_rstw_validate 
    7475   PUBLIC iom_set_rstw_var_active, iom_set_rstw_core, iom_set_rst_vars 
    7576   PRIVATE iom_add 
    76    INTEGER, PRIVATE :: numrst 
     77   INTEGER,           PRIVATE    :: numrst 
     78   CHARACTER(len=12), PRIVATE    :: snr 
     79 
    7780 
    7881   INTERFACE iom_get 
     
    241244!set which fields are to be read from restart file 
    242245          CALL iom_set_rstr_active(fname) 
    243       ELSE IF( TRIM(cdname) == TRIM(cwxios_context) ) THEN 
     246      ELSE IF( TRIM(cdname) == TRIM(cwxios_context)) THEN 
     247!validate output for issues 
     248          CALL iom_set_rstw_validate() 
    244249!set names of the fields in restart file IF using XIOS to write data 
    245           CALL iom_set_rst_context(.FALSE.) 
     250          CALL iom_set_rst_context(.FALSE.)   ! grid definition 
    246251!set which fields are to be written to a restart file 
    247           CALL iom_set_rstw_active(rst_wfields, fname) 
    248       ELSE IF( TRIM(cdname) == TRIM(cwixios_context) ) THEN 
    249 !set names of the fields in restart file IF using XIOS to write data 
    250           CALL iom_set_rst_context(.FALSE.) 
    251 !set which fields are to be written to a restart file 
    252           CALL iom_set_rstw_active(rsti_wfields, fname) 
     252          CALL iom_define_restartw()          ! fields and files definition 
    253253      ELSE 
    254254          CALL set_xmlatt 
     
    270270      ! 
    271271   END SUBROUTINE iom_init 
     272 
     273   SUBROUTINE iom_define_restartw() 
     274      !!--------------------------------------------------------------------- 
     275      !!                   ***  SUBROUTINE  iom_define_restatw  *** 
     276      !! 
     277      !! ** Purpose :  Add files in nemo context to write restart (one and si3)  
     278      !!--------------------------------------------------------------------- 
     279      INTEGER :: kt 
     280      CHARACTER(LEN=50)   ::   clname   ! ocean output restart file name 
     281      CHARACTER(lc)       ::   clpath   ! full path to ocean output restart file 
     282      CHARACTER(LEN=52)   ::   clpname   ! ocean output restart file name including prefix for AGRIF 
     283      CHARACTER(LEN=20)   ::   clkt     ! ocean time-step deine as a character 
     284      INTEGER             ::   iterx, nitrstx, nrst_lstx 
     285      LOGICAL             ::   lrst_icex, lrst_ocex 
     286#if defined key_iomput 
     287 
     288      IF( ln_rst_list ) THEN 
     289         nrst_lstx = 1 
     290         nitrstx = nn_stocklist( nrst_lst ) 
     291      ELSE 
     292         nitrstx = nitend 
     293      ENDIF 
     294 
     295      IF( .NOT. ln_rst_list .AND. nn_stock == -1 )   RETURN   ! we will never do any restart 
     296 
     297      DO kt = nit000, nitend 
     298         IF( .NOT. ln_rst_list .AND. MOD( kt - 1, nn_stock ) == 0 ) THEN 
     299            ! we use kt - 1 and not kt - nit000 to keep the same periodicity from the beginning of the experiment 
     300            nitrstx = kt + nn_stock - 1                  ! define the next value of nitrst for restart writing 
     301            IF( nitrstx > nitend )   nitrstx = nitend   ! make sure we write a restart at the end of the run 
     302         ENDIF 
     303         IF( kt == nitrstx .OR. nn_stock == 1 .OR. kt == nitend ) THEN 
     304            IF( nitrstx <= nitend .AND. nitrstx > 0 ) THEN 
     305 
     306               IF( nitrst > 999999999 ) THEN   ;   WRITE(clkt, *       ) nitrstx 
     307               ELSE                            ;   WRITE(clkt, '(i8.8)') nitrstx 
     308               ENDIF 
     309               ! create the file 
     310               clname = TRIM(cexper)//"_"//TRIM(ADJUSTL(clkt))//"_"//TRIM(cn_ocerst_out) 
     311               clpath = TRIM(cn_ocerst_outdir) 
     312               IF( clpath(LEN_TRIM(clpath):) /= '/' ) clpath = TRIM(clpath) // '/' 
     313               IF(lwp) THEN 
     314                  write(numout, *) 'Create restart file at the step: ', kt 
     315               ENDIF 
     316               CALL iom_set_rstw_active(rst_wfields, TRIM(clpath)//TRIM(clname), nitrstx) 
     317            ENDIF 
     318         ENDIF 
     319#if defined key_si3 
     320         IF( kt == nitrstx - 2*nn_fsbc + 1 .OR. nn_stock == nn_fsbc    & 
     321         &                             .OR. ( kt == nitend - nn_fsbc + 1 .AND. .NOT. lrst_icex ) ) THEN 
     322            IF( nitrst <= nitend .AND. nitrst > 0 ) THEN 
     323               ! beware of the format used to write kt (default is i8.8, that should be large enough...) 
     324               IF( nitrst > 99999999 ) THEN   ;   WRITE(clkt, *       ) nitrstx 
     325               ELSE                           ;   WRITE(clkt, '(i8.8)') nitrstx 
     326               ENDIF 
     327               ! create the file 
     328               clname = TRIM(cexper)//"_"//TRIM(ADJUSTL(clkt))//"_"//TRIM(cn_icerst_out) 
     329               clpath = TRIM(cn_icerst_outdir)  
     330               IF( clpath(LEN_TRIM(clpath):) /= '/' ) clpath = TRIM(clpath)//'/' 
     331               IF(lwp) THEN 
     332                  WRITE(numout,*) 
     333                  WRITE(numout,*) '             Create ice restart NetCDF file: ',TRIM(clpath)//clname 
     334                  IF( kt == nitrstx - 2*nn_fsbc + 1 ) THEN 
     335                     WRITE(numout,*) '             kt = nitrst - 2*nn_fsbc + 1 = ', kt,' date= ', ndastp 
     336                  ELSE 
     337                     WRITE(numout,*) '             kt = '                         , kt,' date= ', ndastp 
     338                  ENDIF 
     339               ENDIF 
     340               lrst_icex = .TRUE. 
     341               CALL iom_set_rstw_active(rsti_wfields, TRIM(clpath)//TRIM(clname), nitrstx) 
     342            ENDIF 
     343         ENDIF 
     344         iterx = kt + nn_fsbc - 1 
     345         IF( iterx == nitrstx ) THEN 
     346            lrst_icex = .FALSE. 
     347            lrst_ocex = .FALSE. 
     348         ENDIF 
     349#endif 
     350         IF( ln_rst_list .AND. kt == nitrst) THEN 
     351            nrst_lstx = MIN(nrst_lst + 1, SIZE(nn_stocklist,1)) 
     352            nitrstx = nn_stocklist( nrst_lst ) 
     353         ENDIF 
     354      ENDDO 
     355#endif 
     356   END SUBROUTINE iom_define_restartw 
     357 
     358   SUBROUTINE iom_set_rstw_validate() 
     359      !!--------------------------------------------------------------------- 
     360      !!                   ***  SUBROUTINE iom_set_rst_validate   *** 
     361      !! 
     362      !! ** Purpose :  validate restart files. This routine is only used if 
     363      !!               restart is written with XIOS. It will check if the same variable 
     364      !!               is written into more than 1 file. Currently with XIOS 
     365      !!               the same variable can't be written into 2 different files. Print 
     366      !!               warning if it's a case.  
     367      !!--------------------------------------------------------------------- 
     368   INTEGER                        :: ik, jk 
     369   CHARACTER(LEN=256)             :: clinfo      ! info character 
     370 
     371#if defined key_si3 
     372     DO ik =1, max_rst_fields 
     373        IF(rst_wfields(ik)%active) THEN 
     374           DO jk = 1, max_rst_fields 
     375            IF(rsti_wfields(jk)%active .AND. (TRIM(rsti_wfields(jk)%vname) == TRIM(rst_wfields(ik)%vname))) THEN 
     376                clinfo = 'Varaible '//TRIM(rsti_wfields(jk)%vname)//' will be written in NEMO and SI3 restart file!' 
     377                CALL ctl_warn( 'From iom_set_rstw_validate: ',                                                & 
     378                     trim(clinfo), 'This will cause problems with XIOS; use iom interface instead or rename', & 
     379                     & 'in one of the restart files') 
     380            ENDIF 
     381           ENDDO 
     382        ENDIF 
     383     ENDDO 
     384#endif 
     385 
     386   END SUBROUTINE iom_set_rstw_validate 
    272387 
    273388   SUBROUTINE iom_set_rstw_var_active(drst_wfields, field) 
     
    411526         CALL iom_set_rstw_var_active(drst_wfields, 'sbc_sc_b') 
    412527   ELSE IF(cdmdl == "SI3") THEN 
    413       CALL iom_set_rstw_var_active(drst_wfields, 'nn_fsbc') 
     528      CALL iom_set_rstw_var_active(drst_wfields, 'nn_fsbc_ice') 
    414529      CALL iom_set_rstw_var_active(drst_wfields, 'kt_ice') 
    415530      CALL iom_set_rstw_var_active(drst_wfields, 'v_i') 
     
    524639        i = iom_add(i); fields(i)%vname="rnf_hc_b";       fields(i)%grid="grid_N" 
    525640        i = iom_add(i); fields(i)%vname="rnf_sc_b";       fields(i)%grid="grid_N" 
    526         i = iom_add(i); fields(i)%vname="nn_fsbc";        fields(i)%grid="grid_scalar" 
    527641        i = iom_add(i); fields(i)%vname="ssu_m";          fields(i)%grid="grid_N" 
    528642        i = iom_add(i); fields(i)%vname="ssv_m";          fields(i)%grid="grid_N" 
     
    554668        i = iom_add(i); fields(i)%vname="hbli";           fields(i)%grid="grid_N" 
    555669        i = iom_add(i); fields(i)%vname="wn";             fields(i)%grid="grid_N_3D" 
     670        i = iom_add(i); fields(i)%vname="nn_fsbc";       fields(i)%grid="grid_scalar" 
    556671#ifdef key_si3 
    557672!ICE/icedia.F90 
     
    648763        i = iom_add(i); fields(i)%vname="stress2_i";     fields(i)%grid="grid_N" 
    649764        i = iom_add(i); fields(i)%vname="stress12_i";    fields(i)%grid="grid_N" 
    650         i = iom_add(i); fields(i)%vname="nn_fsbc";       fields(i)%grid="grid_scalar" 
     765        i = iom_add(i); fields(i)%vname="nn_fsbc_ice";   fields(i)%grid="grid_scalar" 
    651766        i = iom_add(i); fields(i)%vname="kt_ice";        fields(i)%grid="grid_scalar" 
    652767        i = iom_add(i); fields(i)%vname="v_i";           fields(i)%grid="grid_Ni_3D" 
     
    685800 
    686801 
    687    SUBROUTINE iom_set_rstw_active(drst_wfields, cdrst_file) 
     802   SUBROUTINE iom_set_rstw_active(drst_wfields, cdrst_file, kdstep) 
    688803      !!--------------------------------------------------------------------- 
    689804      !!                   ***  SUBROUTINE iom_set_rstw_active   *** 
     
    695810   CHARACTER(len=*), INTENT(IN) :: cdrst_file 
    696811   TYPE(RST_FIELD),  INTENT(IN) :: drst_wfields(max_rst_fields) 
     812   INTEGER        ,  INTENT(IN) :: kdstep 
    697813#if defined key_iomput 
    698    TYPE(xios_field) :: field_hdl 
    699    TYPE(xios_file) :: file_hdl 
     814   TYPE(xios_field)     :: field_hdl 
     815   TYPE(xios_file)      :: file_hdl 
    700816   TYPE(xios_filegroup) :: filegroup_hdl 
    701    INTEGER :: i 
    702    CHARACTER(lc)  ::   clpath 
    703  
     817   TYPE(XIOS_DURATION)  :: freq 
     818   INTEGER              :: i 
     819   CHARACTER(lc)        :: clpath 
     820 
     821   write(snr, *) kdstep 
    704822!set name of the restart file and enable available fields 
    705823        IF(lwp) WRITE(numout,*) 'Setting restart filename (for XIOS write) to: ',cdrst_file 
    706824        CALL xios_get_handle("file_definition", filegroup_hdl ) 
    707         CALL xios_add_child(filegroup_hdl, file_hdl, 'wrestart') 
     825        CALL xios_add_child(filegroup_hdl, file_hdl) 
    708826        IF(nxioso.eq.1) THEN  
    709            CALL xios_set_file_attr( "wrestart", type="one_file", enabled=.TRUE.,&  
     827           CALL xios_set_attr( file_hdl, type="one_file", enabled=.TRUE.,&  
     828                                    mode="write", output_freq=kdstep*xios_timestep)  
     829           if(lwp) write(numout,*) 'Define ', trim(cdrst_file), ' in one_file mode'  
     830        ELSE   
     831           CALL xios_set_attr( file_hdl, type="multiple_file", enabled=.TRUE.,&  
    710832                                    mode="write", output_freq=xios_timestep)  
    711            if(lwp) write(numout,*) 'OPEN ', trim(cdrst_file), ' in one_file mode'  
    712         ELSE   
    713            CALL xios_set_file_attr( "wrestart", type="multiple_file", enabled=.TRUE.,&  
    714                                     mode="write", output_freq=xios_timestep)  
    715            if(lwp) write(numout,*) 'OPEN ', trim(cdrst_file), ' in multiple_file mode'  
     833           if(lwp) write(numout,*) 'Define ', trim(cdrst_file), ' in multiple_file mode'  
    716834        ENDIF  
    717         CALL xios_set_file_attr( "wrestart", name=trim(cdrst_file)) 
     835        CALL xios_set_attr( file_hdl, name=trim(cdrst_file)) 
    718836!define fields for restart context 
    719837        DO i = 1, max_rst_fields 
    720838         IF( drst_wfields(i)%active ) THEN 
    721                 CALL xios_add_child(file_hdl, field_hdl, TRIM(drst_wfields(i)%vname)) 
     839                CALL xios_add_child(file_hdl, field_hdl, TRIM(drst_wfields(i)%vname)//"_"//TRIM(ADJUSTL(snr))) 
    722840                SELECT CASE (TRIM(drst_wfields(i)%grid)) 
    723841                 CASE ("grid_Ni_3D") 
    724842                    CALL xios_set_attr (field_hdl, enabled = .TRUE., name = TRIM(drst_wfields(i)%vname), & 
    725                         domain_ref="grid_N", axis_ref="numcat", prec = 8, operation = "instant") 
     843                        domain_ref="grid_N", axis_ref="numcat", prec = 8, operation = "once",            & 
     844                        freq_offset=(kdstep -1) * xios_timestep) 
    726845                 CASE ("grid_N_3D") 
    727846                    CALL xios_set_attr (field_hdl, enabled = .TRUE., name = TRIM(drst_wfields(i)%vname), & 
    728                         domain_ref="grid_N", axis_ref="nav_lev", prec = 8, operation = "instant") 
     847                        domain_ref="grid_N", axis_ref="nav_lev", prec = 8, operation = "once",           & 
     848                        freq_offset=(kdstep -1) * xios_timestep) 
    729849                 CASE ("grid_N") 
    730850                    CALL xios_set_attr (field_hdl, enabled = .TRUE., name = TRIM(drst_wfields(i)%vname), & 
    731                         domain_ref="grid_N", prec = 8, operation = "instant")  
     851                        domain_ref="grid_N", prec = 8, operation = "once",                               & 
     852                        freq_offset=(kdstep -1) * xios_timestep) 
    732853                 CASE ("grid_vector") 
    733854                    CALL xios_set_attr (field_hdl, enabled = .TRUE., name = TRIM(drst_wfields(i)%vname), & 
    734                          axis_ref="nav_lev", prec = 8, operation = "instant") 
     855                         axis_ref="nav_lev", prec = 8, operation = "once",                               & 
     856                        freq_offset=(kdstep -1) * xios_timestep) 
    735857                 CASE ("grid_scalar") 
    736858                    CALL xios_set_attr (field_hdl, enabled = .TRUE., name = TRIM(drst_wfields(i)%vname), & 
    737                         scalar_ref = "grid_scalar", prec = 8, operation = "instant") 
     859                        scalar_ref = "grid_scalar", prec = 8, operation = "once",                        & 
     860                        freq_offset=(kdstep -1) * xios_timestep) 
    738861                END SELECT 
    739862         ENDIF 
     
    17231846      IF( kt == kwrite ) THEN 
    17241847          IF(lwp) write(numout,*) 'RESTART: write (XIOS 0D) ',trim(cdvar) 
    1725           CALL xios_send_field(trim(cdvar), pvar) 
     1848          write(snr, *) nitrst 
     1849          CALL xios_send_field(trim(cdvar)//"_"//TRIM(ADJUSTL(snr)), pvar) 
    17261850      ENDIF 
    17271851#endif 
     
    17531877      IF( kt == kwrite ) THEN 
    17541878         IF(lwp) write(numout,*) 'RESTART: write (XIOS 1D) ',trim(cdvar) 
    1755          CALL xios_send_field(trim(cdvar), pvar) 
     1879         write(snr, *) nitrst 
     1880         CALL xios_send_field(trim(cdvar)//"_"//TRIM(ADJUSTL(snr)), pvar) 
    17561881      ENDIF 
    17571882#endif 
     
    17831908      IF( kt == kwrite ) THEN 
    17841909         IF(lwp) write(numout,*) 'RESTART: write (XIOS 2D) ',trim(cdvar) 
    1785          CALL xios_send_field(trim(cdvar), pvar) 
     1910         write(snr, *) nitrst 
     1911         CALL xios_send_field(trim(cdvar)//"_"//TRIM(ADJUSTL(snr)), pvar) 
    17861912      ENDIF 
    17871913#endif 
     
    18131939      IF( kt == kwrite ) THEN 
    18141940         IF(lwp) write(numout,*) 'RESTART: write (XIOS 3D) ',trim(cdvar) 
    1815          CALL xios_send_field(trim(cdvar), pvar) 
     1941         write(snr, *) nitrst 
     1942         CALL xios_send_field(trim(cdvar)//"_"//TRIM(ADJUSTL(snr)), pvar) 
    18161943      ENDIF 
    18171944#endif 
     
    18421969      !!--------------------------------------------------------------------- 
    18431970      ! 
     1971      !return for now. When XIOS is used to write restart it also should be used to write this attribute 
     1972      IF(lwxios) return 
    18441973      !                                      =================================== 
    18451974      IF( TRIM(cdaction) == 'READ' ) THEN   ! read restart related to mpp_delay ! 
  • NEMO/branches/2019/dev_r11756_SI3restart_XIOS/src/OCE/IOM/restart.F90

    r11837 r11870  
    108108            ENDIF 
    109109            ! 
    110             IF(.NOT.lwxios) THEN 
     110            IF(lwxios) THEN 
     111               CALL iom_setkt( nitrst, cwxios_context ) 
     112            ELSE 
    111113               CALL iom_open( TRIM(clpath)//TRIM(clname), numrow, ldwrt = .TRUE. ) 
    112             ELSE 
    113 #if defined key_iomput 
    114                cwxios_context = "rstw_"//TRIM(ADJUSTL(clkt)) 
    115                IF( TRIM(Agrif_CFixed()) == '0' ) THEN 
    116                   clpname = clname 
    117                ELSE 
    118                   clpname = TRIM(Agrif_CFixed())//"_"//clname    
    119                ENDIF 
    120                CALL iom_init( cwxios_context, TRIM(clpath)//TRIM(clpname), .false. ) 
    121                CALL xios_update_calendar(nitrst) 
    122                CALL iom_swap(      cxios_context          ) 
    123 #else 
    124                clinfo = 'Can not use XIOS in rst_opn' 
    125                CALL ctl_stop(TRIM(clinfo)) 
    126 #endif 
    127114            ENDIF 
    128115            lrst_oce = .TRUE. 
     
    179166         IF(.NOT.lwxios) THEN 
    180167            CALL iom_close( numrow )     ! close the restart file (only at last time step) 
    181          ELSE 
    182             CALL iom_context_finalize(      cwxios_context          ) 
    183168         ENDIF 
    184169!!gm         IF( .NOT. lk_trdmld )   lrst_oce = .FALSE. 
  • NEMO/branches/2019/dev_r11756_SI3restart_XIOS/src/OCE/nemogcm.F90

    r11536 r11870  
    269269      !!---------------------------------------------------------------------- 
    270270      ! 
    271       cxios_context = 'nemo' 
     271      cxios_context  = 'nemo' 
     272      cwxios_context = 'nemo_rstw' 
    272273      ! 
    273274      !                             !-------------------------------------------------! 
  • NEMO/branches/2019/dev_r11756_SI3restart_XIOS/src/OCE/step.F90

    r11837 r11870  
    102102                             CALL iom_init(      cxios_context          )  ! for model grid (including passible AGRIF zoom) 
    103103         IF( ln_crs      )   CALL iom_init( TRIM(cxios_context)//"_crs" )  ! for coarse grid 
     104         IF( lwxios      )   CALL iom_init( cwxios_context              )  ! restart write context 
    104105      ENDIF 
    105106      IF( kstp /= nit000 )   CALL day( kstp )         ! Calendar (day was already called at nit000 in day_init) 
Note: See TracChangeset for help on using the changeset viewer.