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 12957 for NEMO/branches/2020 – NEMO

Changeset 12957 for NEMO/branches/2020


Ignore:
Timestamp:
2020-05-20T18:53:27+02:00 (4 years ago)
Author:
andmirek
Message:

Ticket #2462: write/read SI3 restart with XIOS (has debug print statements)

Location:
NEMO/branches/2020/dev_12905_xios_restart/src
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/2020/dev_12905_xios_restart/src/ICE/icedia.F90

    r12489 r12957  
    221221         IF( ln_rstart ) THEN                   !* Read the restart file 
    222222            ! 
    223             CALL iom_get( numrir, 'kt_ice' , ziter ) 
     223            IF(lrxios) CALL iom_swap(crixios_context) 
     224            CALL iom_get( numrir, 'kt_ice' , ziter, ldxios = lrxios ) 
    224225            IF(lwp) WRITE(numout,*) 
    225226            IF(lwp) WRITE(numout,*) 'ice_dia_rst read at time step = ', ziter 
    226227            IF(lwp) WRITE(numout,*) '~~~~~~~~~~' 
    227             CALL iom_get( numrir, 'frc_voltop' , frc_voltop  ) 
    228             CALL iom_get( numrir, 'frc_volbot' , frc_volbot  ) 
    229             CALL iom_get( numrir, 'frc_temtop' , frc_temtop  ) 
    230             CALL iom_get( numrir, 'frc_tembot' , frc_tembot  ) 
    231             CALL iom_get( numrir, 'frc_sal'    , frc_sal     ) 
    232             CALL iom_get( numrir, jpdom_autoglo, 'vol_loc_ini', vol_loc_ini ) 
    233             CALL iom_get( numrir, jpdom_autoglo, 'tem_loc_ini', tem_loc_ini ) 
    234             CALL iom_get( numrir, jpdom_autoglo, 'sal_loc_ini', sal_loc_ini ) 
     228            CALL iom_get( numrir, 'frc_voltop' , frc_voltop, ldxios = lrxios  ) 
     229            CALL iom_get( numrir, 'frc_volbot' , frc_volbot, ldxios = lrxios  ) 
     230            CALL iom_get( numrir, 'frc_temtop' , frc_temtop, ldxios = lrxios  ) 
     231            CALL iom_get( numrir, 'frc_tembot' , frc_tembot, ldxios = lrxios  ) 
     232            CALL iom_get( numrir, 'frc_sal'    , frc_sal, ldxios = lrxios     ) 
     233            CALL iom_get( numrir, jpdom_autoglo, 'vol_loc_ini', vol_loc_ini, ldxios = lrxios ) 
     234            CALL iom_get( numrir, jpdom_autoglo, 'tem_loc_ini', tem_loc_ini, ldxios = lrxios ) 
     235            CALL iom_get( numrir, jpdom_autoglo, 'sal_loc_ini', sal_loc_ini, ldxios = lrxios ) 
     236            IF(lrxios) CALL iom_swap(cxios_context) 
    235237         ELSE 
    236238            IF(lwp) WRITE(numout,*) 
     
    261263         ! Write in numriw (if iter == nitrst) 
    262264         ! ------------------  
    263          CALL iom_rstput( iter, nitrst, numriw, 'frc_voltop' , frc_voltop  ) 
    264          CALL iom_rstput( iter, nitrst, numriw, 'frc_volbot' , frc_volbot  ) 
    265          CALL iom_rstput( iter, nitrst, numriw, 'frc_temtop' , frc_temtop  ) 
    266          CALL iom_rstput( iter, nitrst, numriw, 'frc_tembot' , frc_tembot  ) 
    267          CALL iom_rstput( iter, nitrst, numriw, 'frc_sal'    , frc_sal     ) 
    268          CALL iom_rstput( iter, nitrst, numriw, 'vol_loc_ini', vol_loc_ini ) 
    269          CALL iom_rstput( iter, nitrst, numriw, 'tem_loc_ini', tem_loc_ini ) 
    270          CALL iom_rstput( iter, nitrst, numriw, 'sal_loc_ini', sal_loc_ini ) 
     265         IF( lwxios ) CALL iom_swap(      cwixios_context         ) 
     266         CALL iom_rstput( iter, nitrst, numriw, 'frc_voltop' , frc_voltop,  ldxios = lwxios ) 
     267         CALL iom_rstput( iter, nitrst, numriw, 'frc_volbot' , frc_volbot,  ldxios = lwxios ) 
     268         CALL iom_rstput( iter, nitrst, numriw, 'frc_temtop' , frc_temtop,  ldxios = lwxios ) 
     269         CALL iom_rstput( iter, nitrst, numriw, 'frc_tembot' , frc_tembot,  ldxios = lwxios ) 
     270         CALL iom_rstput( iter, nitrst, numriw, 'frc_sal'    , frc_sal,     ldxios = lwxios ) 
     271         CALL iom_rstput( iter, nitrst, numriw, 'vol_loc_ini', vol_loc_ini, ldxios = lwxios ) 
     272         CALL iom_rstput( iter, nitrst, numriw, 'tem_loc_ini', tem_loc_ini, ldxios = lwxios ) 
     273         CALL iom_rstput( iter, nitrst, numriw, 'sal_loc_ini', sal_loc_ini, ldxios = lwxios ) 
     274         IF( lwxios ) CALL iom_swap(      cxios_context         ) 
    271275         ! 
    272276      ENDIF 
  • NEMO/branches/2020/dev_12905_xios_restart/src/ICE/icedyn_adv_pra.F90

    r12489 r12957  
    770770         ! 
    771771         IF( id1 > 0 ) THEN                     !**  Read the restart file  **! 
     772            IF(lrxios) CALL iom_swap(crixios_context) 
    772773            ! 
    773774            !                                                        ! ice thickness 
    774             CALL iom_get( numrir, jpdom_autoglo, 'sxice' , sxice  ) 
    775             CALL iom_get( numrir, jpdom_autoglo, 'syice' , syice  ) 
    776             CALL iom_get( numrir, jpdom_autoglo, 'sxxice', sxxice ) 
    777             CALL iom_get( numrir, jpdom_autoglo, 'syyice', syyice ) 
    778             CALL iom_get( numrir, jpdom_autoglo, 'sxyice', sxyice ) 
     775            CALL iom_get( numrir, jpdom_autoglo, 'sxice' , sxice, ldxios = lrxios  ) 
     776            CALL iom_get( numrir, jpdom_autoglo, 'syice' , syice, ldxios = lrxios  ) 
     777            CALL iom_get( numrir, jpdom_autoglo, 'sxxice', sxxice, ldxios = lrxios ) 
     778            CALL iom_get( numrir, jpdom_autoglo, 'syyice', syyice, ldxios = lrxios ) 
     779            CALL iom_get( numrir, jpdom_autoglo, 'sxyice', sxyice, ldxios = lrxios ) 
    779780            !                                                        ! snow thickness 
    780             CALL iom_get( numrir, jpdom_autoglo, 'sxsn'  , sxsn   ) 
    781             CALL iom_get( numrir, jpdom_autoglo, 'sysn'  , sysn   ) 
    782             CALL iom_get( numrir, jpdom_autoglo, 'sxxsn' , sxxsn  ) 
    783             CALL iom_get( numrir, jpdom_autoglo, 'syysn' , syysn  ) 
    784             CALL iom_get( numrir, jpdom_autoglo, 'sxysn' , sxysn  ) 
     781            CALL iom_get( numrir, jpdom_autoglo, 'sxsn'  , sxsn, ldxios = lrxios   ) 
     782            CALL iom_get( numrir, jpdom_autoglo, 'sysn'  , sysn, ldxios = lrxios   ) 
     783            CALL iom_get( numrir, jpdom_autoglo, 'sxxsn' , sxxsn, ldxios = lrxios  ) 
     784            CALL iom_get( numrir, jpdom_autoglo, 'syysn' , syysn, ldxios = lrxios  ) 
     785            CALL iom_get( numrir, jpdom_autoglo, 'sxysn' , sxysn, ldxios = lrxios  ) 
    785786            !                                                        ! ice concentration 
    786             CALL iom_get( numrir, jpdom_autoglo, 'sxa'   , sxa    ) 
    787             CALL iom_get( numrir, jpdom_autoglo, 'sya'   , sya    ) 
    788             CALL iom_get( numrir, jpdom_autoglo, 'sxxa'  , sxxa   ) 
    789             CALL iom_get( numrir, jpdom_autoglo, 'syya'  , syya   ) 
    790             CALL iom_get( numrir, jpdom_autoglo, 'sxya'  , sxya   ) 
     787            CALL iom_get( numrir, jpdom_autoglo, 'sxa'   , sxa, ldxios = lrxios    ) 
     788            CALL iom_get( numrir, jpdom_autoglo, 'sya'   , sya, ldxios = lrxios    ) 
     789            CALL iom_get( numrir, jpdom_autoglo, 'sxxa'  , sxxa, ldxios = lrxios   ) 
     790            CALL iom_get( numrir, jpdom_autoglo, 'syya'  , syya, ldxios = lrxios   ) 
     791            CALL iom_get( numrir, jpdom_autoglo, 'sxya'  , sxya, ldxios = lrxios   ) 
    791792            !                                                        ! ice salinity 
    792             CALL iom_get( numrir, jpdom_autoglo, 'sxsal' , sxsal  ) 
    793             CALL iom_get( numrir, jpdom_autoglo, 'sysal' , sysal  ) 
    794             CALL iom_get( numrir, jpdom_autoglo, 'sxxsal', sxxsal ) 
    795             CALL iom_get( numrir, jpdom_autoglo, 'syysal', syysal ) 
    796             CALL iom_get( numrir, jpdom_autoglo, 'sxysal', sxysal ) 
     793            CALL iom_get( numrir, jpdom_autoglo, 'sxsal' , sxsal, ldxios = lrxios  ) 
     794            CALL iom_get( numrir, jpdom_autoglo, 'sysal' , sysal, ldxios = lrxios  ) 
     795            CALL iom_get( numrir, jpdom_autoglo, 'sxxsal', sxxsal, ldxios = lrxios ) 
     796            CALL iom_get( numrir, jpdom_autoglo, 'syysal', syysal, ldxios = lrxios ) 
     797            CALL iom_get( numrir, jpdom_autoglo, 'sxysal', sxysal, ldxios = lrxios ) 
    797798            !                                                        ! ice age 
    798             CALL iom_get( numrir, jpdom_autoglo, 'sxage' , sxage  ) 
    799             CALL iom_get( numrir, jpdom_autoglo, 'syage' , syage  ) 
    800             CALL iom_get( numrir, jpdom_autoglo, 'sxxage', sxxage ) 
    801             CALL iom_get( numrir, jpdom_autoglo, 'syyage', syyage ) 
    802             CALL iom_get( numrir, jpdom_autoglo, 'sxyage', sxyage ) 
     799            CALL iom_get( numrir, jpdom_autoglo, 'sxage' , sxage, ldxios = lrxios  ) 
     800            CALL iom_get( numrir, jpdom_autoglo, 'syage' , syage, ldxios = lrxios  ) 
     801            CALL iom_get( numrir, jpdom_autoglo, 'sxxage', sxxage, ldxios = lrxios ) 
     802            CALL iom_get( numrir, jpdom_autoglo, 'syyage', syyage, ldxios = lrxios ) 
     803            CALL iom_get( numrir, jpdom_autoglo, 'sxyage', sxyage, ldxios = lrxios ) 
    803804            !                                                        ! snow layers heat content 
    804805            DO jk = 1, nlay_s 
    805806               WRITE(zchar1,'(I2.2)') jk 
    806                znam = 'sxc0'//'_l'//zchar1  ;   CALL iom_get( numrir, jpdom_autoglo, znam , z3d )   ;   sxc0 (:,:,jk,:) = z3d(:,:,:) 
    807                znam = 'syc0'//'_l'//zchar1  ;   CALL iom_get( numrir, jpdom_autoglo, znam , z3d )   ;   syc0 (:,:,jk,:) = z3d(:,:,:) 
    808                znam = 'sxxc0'//'_l'//zchar1 ;   CALL iom_get( numrir, jpdom_autoglo, znam , z3d )   ;   sxxc0(:,:,jk,:) = z3d(:,:,:) 
    809                znam = 'syyc0'//'_l'//zchar1 ;   CALL iom_get( numrir, jpdom_autoglo, znam , z3d )   ;   syyc0(:,:,jk,:) = z3d(:,:,:) 
    810                znam = 'sxyc0'//'_l'//zchar1 ;   CALL iom_get( numrir, jpdom_autoglo, znam , z3d )   ;   sxyc0(:,:,jk,:) = z3d(:,:,:) 
     807               znam = 'sxc0'//'_l'//zchar1   
     808               CALL iom_get( numrir, jpdom_autoglo, znam , z3d, ldxios = lrxios )   ;   sxc0 (:,:,jk,:) = z3d(:,:,:) 
     809               znam = 'syc0'//'_l'//zchar1   
     810               CALL iom_get( numrir, jpdom_autoglo, znam , z3d, ldxios = lrxios )   ;   syc0 (:,:,jk,:) = z3d(:,:,:) 
     811               znam = 'sxxc0'//'_l'//zchar1  
     812               CALL iom_get( numrir, jpdom_autoglo, znam , z3d, ldxios = lrxios )   ;   sxxc0(:,:,jk,:) = z3d(:,:,:) 
     813               znam = 'syyc0'//'_l'//zchar1  
     814               CALL iom_get( numrir, jpdom_autoglo, znam , z3d, ldxios = lrxios )   ;   syyc0(:,:,jk,:) = z3d(:,:,:) 
     815               znam = 'sxyc0'//'_l'//zchar1  
     816               CALL iom_get( numrir, jpdom_autoglo, znam , z3d, ldxios = lrxios )   ;   sxyc0(:,:,jk,:) = z3d(:,:,:) 
    811817            END DO 
    812818            !                                                        ! ice layers heat content 
    813819            DO jk = 1, nlay_i 
    814820               WRITE(zchar1,'(I2.2)') jk 
    815                znam = 'sxe'//'_l'//zchar1   ;   CALL iom_get( numrir, jpdom_autoglo, znam , z3d )   ;   sxe (:,:,jk,:) = z3d(:,:,:) 
    816                znam = 'sye'//'_l'//zchar1   ;   CALL iom_get( numrir, jpdom_autoglo, znam , z3d )   ;   sye (:,:,jk,:) = z3d(:,:,:) 
    817                znam = 'sxxe'//'_l'//zchar1  ;   CALL iom_get( numrir, jpdom_autoglo, znam , z3d )   ;   sxxe(:,:,jk,:) = z3d(:,:,:) 
    818                znam = 'syye'//'_l'//zchar1  ;   CALL iom_get( numrir, jpdom_autoglo, znam , z3d )   ;   syye(:,:,jk,:) = z3d(:,:,:) 
    819                znam = 'sxye'//'_l'//zchar1  ;   CALL iom_get( numrir, jpdom_autoglo, znam , z3d )   ;   sxye(:,:,jk,:) = z3d(:,:,:) 
     821               znam = 'sxe'//'_l'//zchar1    
     822               CALL iom_get( numrir, jpdom_autoglo, znam , z3d, ldxios = lrxios )   ;   sxe (:,:,jk,:) = z3d(:,:,:) 
     823               znam = 'sye'//'_l'//zchar1    
     824               CALL iom_get( numrir, jpdom_autoglo, znam , z3d, ldxios = lrxios )   ;   sye (:,:,jk,:) = z3d(:,:,:) 
     825               znam = 'sxxe'//'_l'//zchar1   
     826               CALL iom_get( numrir, jpdom_autoglo, znam , z3d, ldxios = lrxios )   ;   sxxe(:,:,jk,:) = z3d(:,:,:) 
     827               znam = 'syye'//'_l'//zchar1   
     828               CALL iom_get( numrir, jpdom_autoglo, znam , z3d, ldxios = lrxios )   ;   syye(:,:,jk,:) = z3d(:,:,:) 
     829               znam = 'sxye'//'_l'//zchar1   
     830               CALL iom_get( numrir, jpdom_autoglo, znam , z3d, ldxios = lrxios )   ;   sxye(:,:,jk,:) = z3d(:,:,:) 
    820831            END DO 
    821832            ! 
    822833            IF( ln_pnd_H12 ) THEN                                    ! melt pond fraction 
    823                CALL iom_get( numrir, jpdom_autoglo, 'sxap' , sxap  ) 
    824                CALL iom_get( numrir, jpdom_autoglo, 'syap' , syap  ) 
    825                CALL iom_get( numrir, jpdom_autoglo, 'sxxap', sxxap ) 
    826                CALL iom_get( numrir, jpdom_autoglo, 'syyap', syyap ) 
    827                CALL iom_get( numrir, jpdom_autoglo, 'sxyap', sxyap ) 
     834               CALL iom_get( numrir, jpdom_autoglo, 'sxap' , sxap,  ldxios = lrxios ) 
     835               CALL iom_get( numrir, jpdom_autoglo, 'syap' , syap,  ldxios = lrxios ) 
     836               CALL iom_get( numrir, jpdom_autoglo, 'sxxap', sxxap, ldxios = lrxios ) 
     837               CALL iom_get( numrir, jpdom_autoglo, 'syyap', syyap, ldxios = lrxios ) 
     838               CALL iom_get( numrir, jpdom_autoglo, 'sxyap', sxyap, ldxios = lrxios ) 
    828839               !                                                     ! melt pond volume 
    829                CALL iom_get( numrir, jpdom_autoglo, 'sxvp' , sxvp  ) 
    830                CALL iom_get( numrir, jpdom_autoglo, 'syvp' , syvp  ) 
    831                CALL iom_get( numrir, jpdom_autoglo, 'sxxvp', sxxvp ) 
    832                CALL iom_get( numrir, jpdom_autoglo, 'syyvp', syyvp ) 
    833                CALL iom_get( numrir, jpdom_autoglo, 'sxyvp', sxyvp ) 
     840               CALL iom_get( numrir, jpdom_autoglo, 'sxvp' , sxvp,  ldxios = lrxios ) 
     841               CALL iom_get( numrir, jpdom_autoglo, 'syvp' , syvp,  ldxios = lrxios ) 
     842               CALL iom_get( numrir, jpdom_autoglo, 'sxxvp', sxxvp, ldxios = lrxios ) 
     843               CALL iom_get( numrir, jpdom_autoglo, 'syyvp', syyvp, ldxios = lrxios ) 
     844               CALL iom_get( numrir, jpdom_autoglo, 'sxyvp', sxyvp, ldxios = lrxios ) 
    834845            ENDIF 
     846            IF(lrxios) CALL iom_swap(cxios_context) 
    835847            ! 
    836848         ELSE                                   !**  start rheology from rest  **! 
     
    862874         ! 
    863875         !                                                           ! ice thickness 
    864          CALL iom_rstput( iter, nitrst, numriw, 'sxice' , sxice  ) 
    865          CALL iom_rstput( iter, nitrst, numriw, 'syice' , syice  ) 
    866          CALL iom_rstput( iter, nitrst, numriw, 'sxxice', sxxice ) 
    867          CALL iom_rstput( iter, nitrst, numriw, 'syyice', syyice ) 
    868          CALL iom_rstput( iter, nitrst, numriw, 'sxyice', sxyice ) 
     876         IF( lwxios ) CALL iom_swap(      cwixios_context         ) 
     877         CALL iom_rstput( iter, nitrst, numriw, 'sxice' , sxice,  ldxios = lwxios) 
     878         CALL iom_rstput( iter, nitrst, numriw, 'syice' , syice,  ldxios = lwxios) 
     879         CALL iom_rstput( iter, nitrst, numriw, 'sxxice', sxxice, ldxios = lwxios) 
     880         CALL iom_rstput( iter, nitrst, numriw, 'syyice', syyice, ldxios = lwxios) 
     881         CALL iom_rstput( iter, nitrst, numriw, 'sxyice', sxyice, ldxios = lwxios) 
    869882         !                                                           ! snow thickness 
    870          CALL iom_rstput( iter, nitrst, numriw, 'sxsn'  , sxsn  ) 
    871          CALL iom_rstput( iter, nitrst, numriw, 'sysn'  , sysn  ) 
    872          CALL iom_rstput( iter, nitrst, numriw, 'sxxsn' , sxxsn  ) 
    873          CALL iom_rstput( iter, nitrst, numriw, 'syysn' , syysn  ) 
    874          CALL iom_rstput( iter, nitrst, numriw, 'sxysn' , sxysn  ) 
     883         CALL iom_rstput( iter, nitrst, numriw, 'sxsn'  , sxsn,  ldxios = lwxios ) 
     884         CALL iom_rstput( iter, nitrst, numriw, 'sysn'  , sysn,  ldxios = lwxios ) 
     885         CALL iom_rstput( iter, nitrst, numriw, 'sxxsn' , sxxsn, ldxios = lwxios ) 
     886         CALL iom_rstput( iter, nitrst, numriw, 'syysn' , syysn, ldxios = lwxios ) 
     887         CALL iom_rstput( iter, nitrst, numriw, 'sxysn' , sxysn, ldxios = lwxios ) 
    875888         !                                                           ! ice concentration 
    876          CALL iom_rstput( iter, nitrst, numriw, 'sxa'   , sxa    ) 
    877          CALL iom_rstput( iter, nitrst, numriw, 'sya'   , sya    ) 
    878          CALL iom_rstput( iter, nitrst, numriw, 'sxxa'  , sxxa   ) 
    879          CALL iom_rstput( iter, nitrst, numriw, 'syya'  , syya   ) 
    880          CALL iom_rstput( iter, nitrst, numriw, 'sxya'  , sxya   ) 
     889         CALL iom_rstput( iter, nitrst, numriw, 'sxa'   , sxa,  ldxios = lwxios  ) 
     890         CALL iom_rstput( iter, nitrst, numriw, 'sya'   , sya,  ldxios = lwxios  ) 
     891         CALL iom_rstput( iter, nitrst, numriw, 'sxxa'  , sxxa, ldxios = lwxios  ) 
     892         CALL iom_rstput( iter, nitrst, numriw, 'syya'  , syya, ldxios = lwxios  ) 
     893         CALL iom_rstput( iter, nitrst, numriw, 'sxya'  , sxya, ldxios = lwxios  ) 
    881894         !                                                           ! ice salinity 
    882          CALL iom_rstput( iter, nitrst, numriw, 'sxsal' , sxsal  ) 
    883          CALL iom_rstput( iter, nitrst, numriw, 'sysal' , sysal  ) 
    884          CALL iom_rstput( iter, nitrst, numriw, 'sxxsal', sxxsal ) 
    885          CALL iom_rstput( iter, nitrst, numriw, 'syysal', syysal ) 
    886          CALL iom_rstput( iter, nitrst, numriw, 'sxysal', sxysal ) 
     895         CALL iom_rstput( iter, nitrst, numriw, 'sxsal' , sxsal,  ldxios = lwxios) 
     896         CALL iom_rstput( iter, nitrst, numriw, 'sysal' , sysal,  ldxios = lwxios) 
     897         CALL iom_rstput( iter, nitrst, numriw, 'sxxsal', sxxsal, ldxios = lwxios) 
     898         CALL iom_rstput( iter, nitrst, numriw, 'syysal', syysal, ldxios = lwxios) 
     899         CALL iom_rstput( iter, nitrst, numriw, 'sxysal', sxysal, ldxios = lwxios) 
    887900         !                                                           ! ice age 
    888          CALL iom_rstput( iter, nitrst, numriw, 'sxage' , sxage  ) 
    889          CALL iom_rstput( iter, nitrst, numriw, 'syage' , syage  ) 
    890          CALL iom_rstput( iter, nitrst, numriw, 'sxxage', sxxage ) 
    891          CALL iom_rstput( iter, nitrst, numriw, 'syyage', syyage ) 
    892          CALL iom_rstput( iter, nitrst, numriw, 'sxyage', sxyage ) 
     901         CALL iom_rstput( iter, nitrst, numriw, 'sxage' , sxage,  ldxios = lwxios) 
     902         CALL iom_rstput( iter, nitrst, numriw, 'syage' , syage,  ldxios = lwxios) 
     903         CALL iom_rstput( iter, nitrst, numriw, 'sxxage', sxxage, ldxios = lwxios) 
     904         CALL iom_rstput( iter, nitrst, numriw, 'syyage', syyage, ldxios = lwxios) 
     905         CALL iom_rstput( iter, nitrst, numriw, 'sxyage', sxyage, ldxios = lwxios) 
    893906         !                                                           ! snow layers heat content 
    894907         DO jk = 1, nlay_s 
    895908            WRITE(zchar1,'(I2.2)') jk 
    896             znam = 'sxc0'//'_l'//zchar1  ;   z3d(:,:,:) = sxc0 (:,:,jk,:)  ;   CALL iom_rstput( iter, nitrst, numriw, znam , z3d ) 
    897             znam = 'syc0'//'_l'//zchar1  ;   z3d(:,:,:) = syc0 (:,:,jk,:)  ;   CALL iom_rstput( iter, nitrst, numriw, znam , z3d ) 
    898             znam = 'sxxc0'//'_l'//zchar1 ;   z3d(:,:,:) = sxxc0(:,:,jk,:)  ;   CALL iom_rstput( iter, nitrst, numriw, znam , z3d ) 
    899             znam = 'syyc0'//'_l'//zchar1 ;   z3d(:,:,:) = syyc0(:,:,jk,:)  ;   CALL iom_rstput( iter, nitrst, numriw, znam , z3d ) 
    900             znam = 'sxyc0'//'_l'//zchar1 ;   z3d(:,:,:) = sxyc0(:,:,jk,:)  ;   CALL iom_rstput( iter, nitrst, numriw, znam , z3d ) 
     909            znam = 'sxc0'//'_l'//zchar1  ;   z3d(:,:,:) = sxc0 (:,:,jk,:) 
     910            CALL iom_rstput( iter, nitrst, numriw, znam , z3d, ldxios = lwxios) 
     911            znam = 'syc0'//'_l'//zchar1  ;   z3d(:,:,:) = syc0 (:,:,jk,:) 
     912            CALL iom_rstput( iter, nitrst, numriw, znam , z3d, ldxios = lwxios) 
     913            znam = 'sxxc0'//'_l'//zchar1 ;   z3d(:,:,:) = sxxc0(:,:,jk,:) 
     914            CALL iom_rstput( iter, nitrst, numriw, znam , z3d, ldxios = lwxios) 
     915            znam = 'syyc0'//'_l'//zchar1 ;   z3d(:,:,:) = syyc0(:,:,jk,:) 
     916            CALL iom_rstput( iter, nitrst, numriw, znam , z3d, ldxios = lwxios) 
     917            znam = 'sxyc0'//'_l'//zchar1 ;   z3d(:,:,:) = sxyc0(:,:,jk,:) 
     918            CALL iom_rstput( iter, nitrst, numriw, znam , z3d, ldxios = lwxios) 
    901919         END DO 
    902920         !                                                           ! ice layers heat content 
    903921         DO jk = 1, nlay_i 
    904922            WRITE(zchar1,'(I2.2)') jk 
    905             znam = 'sxe'//'_l'//zchar1   ;   z3d(:,:,:) = sxe (:,:,jk,:)   ;   CALL iom_rstput( iter, nitrst, numriw, znam , z3d ) 
    906             znam = 'sye'//'_l'//zchar1   ;   z3d(:,:,:) = sye (:,:,jk,:)   ;   CALL iom_rstput( iter, nitrst, numriw, znam , z3d ) 
    907             znam = 'sxxe'//'_l'//zchar1  ;   z3d(:,:,:) = sxxe(:,:,jk,:)   ;   CALL iom_rstput( iter, nitrst, numriw, znam , z3d ) 
    908             znam = 'syye'//'_l'//zchar1  ;   z3d(:,:,:) = syye(:,:,jk,:)   ;   CALL iom_rstput( iter, nitrst, numriw, znam , z3d ) 
    909             znam = 'sxye'//'_l'//zchar1  ;   z3d(:,:,:) = sxye(:,:,jk,:)   ;   CALL iom_rstput( iter, nitrst, numriw, znam , z3d ) 
     923            znam = 'sxe'//'_l'//zchar1   ;   z3d(:,:,:) = sxe (:,:,jk,:) 
     924            CALL iom_rstput( iter, nitrst, numriw, znam , z3d, ldxios = lwxios) 
     925            znam = 'sye'//'_l'//zchar1   ;   z3d(:,:,:) = sye (:,:,jk,:) 
     926            CALL iom_rstput( iter, nitrst, numriw, znam , z3d, ldxios = lwxios) 
     927            znam = 'sxxe'//'_l'//zchar1  ;   z3d(:,:,:) = sxxe(:,:,jk,:) 
     928            CALL iom_rstput( iter, nitrst, numriw, znam , z3d, ldxios = lwxios) 
     929            znam = 'syye'//'_l'//zchar1  ;   z3d(:,:,:) = syye(:,:,jk,:) 
     930            CALL iom_rstput( iter, nitrst, numriw, znam , z3d, ldxios = lwxios) 
     931            znam = 'sxye'//'_l'//zchar1  ;   z3d(:,:,:) = sxye(:,:,jk,:) 
     932            CALL iom_rstput( iter, nitrst, numriw, znam , z3d, ldxios = lwxios) 
    910933         END DO 
    911934         ! 
    912935         IF( ln_pnd_H12 ) THEN                                       ! melt pond fraction 
    913             CALL iom_rstput( iter, nitrst, numriw, 'sxap' , sxap  ) 
    914             CALL iom_rstput( iter, nitrst, numriw, 'syap' , syap  ) 
    915             CALL iom_rstput( iter, nitrst, numriw, 'sxxap', sxxap ) 
    916             CALL iom_rstput( iter, nitrst, numriw, 'syyap', syyap ) 
    917             CALL iom_rstput( iter, nitrst, numriw, 'sxyap', sxyap ) 
     936            CALL iom_rstput( iter, nitrst, numriw, 'sxap' , sxap,  ldxios = lwxios) 
     937            CALL iom_rstput( iter, nitrst, numriw, 'syap' , syap,  ldxios = lwxios) 
     938            CALL iom_rstput( iter, nitrst, numriw, 'sxxap', sxxap, ldxios = lwxios) 
     939            CALL iom_rstput( iter, nitrst, numriw, 'syyap', syyap, ldxios = lwxios) 
     940            CALL iom_rstput( iter, nitrst, numriw, 'sxyap', sxyap, ldxios = lwxios) 
    918941            !                                                        ! melt pond volume 
    919             CALL iom_rstput( iter, nitrst, numriw, 'sxvp' , sxvp  ) 
    920             CALL iom_rstput( iter, nitrst, numriw, 'syvp' , syvp  ) 
    921             CALL iom_rstput( iter, nitrst, numriw, 'sxxvp', sxxvp ) 
    922             CALL iom_rstput( iter, nitrst, numriw, 'syyvp', syyvp ) 
    923             CALL iom_rstput( iter, nitrst, numriw, 'sxyvp', sxyvp ) 
     942            CALL iom_rstput( iter, nitrst, numriw, 'sxvp' , sxvp,  ldxios = lwxios) 
     943            CALL iom_rstput( iter, nitrst, numriw, 'syvp' , syvp,  ldxios = lwxios) 
     944            CALL iom_rstput( iter, nitrst, numriw, 'sxxvp', sxxvp, ldxios = lwxios) 
     945            CALL iom_rstput( iter, nitrst, numriw, 'syyvp', syyvp, ldxios = lwxios) 
     946            CALL iom_rstput( iter, nitrst, numriw, 'sxyvp', sxyvp, ldxios = lwxios) 
    924947         ENDIF 
     948         IF( lwxios ) CALL iom_swap(      cxios_context         ) 
    925949         ! 
    926950      ENDIF 
  • NEMO/branches/2020/dev_12905_xios_restart/src/ICE/icedyn_rhg_evp.F90

    r12489 r12957  
    839839         IF( ln_rstart ) THEN                   !* Read the restart file 
    840840            ! 
     841            IF(lrxios) CALL iom_swap(crixios_context) 
    841842            id1 = iom_varid( numrir, 'stress1_i' , ldstop = .FALSE. ) 
    842843            id2 = iom_varid( numrir, 'stress2_i' , ldstop = .FALSE. ) 
     
    844845            ! 
    845846            IF( MIN( id1, id2, id3 ) > 0 ) THEN      ! fields exist 
    846                CALL iom_get( numrir, jpdom_autoglo, 'stress1_i' , stress1_i  ) 
    847                CALL iom_get( numrir, jpdom_autoglo, 'stress2_i' , stress2_i  ) 
    848                CALL iom_get( numrir, jpdom_autoglo, 'stress12_i', stress12_i ) 
     847               CALL iom_get( numrir, jpdom_autoglo, 'stress1_i' , stress1_i,  ldxios = lrxios ) 
     848               CALL iom_get( numrir, jpdom_autoglo, 'stress2_i' , stress2_i,  ldxios = lrxios ) 
     849               CALL iom_get( numrir, jpdom_autoglo, 'stress12_i', stress12_i, ldxios = lrxios ) 
    849850            ELSE                                     ! start rheology from rest 
    850851               IF(lwp) WRITE(numout,*) 
     
    854855               stress12_i(:,:) = 0._wp 
    855856            ENDIF 
     857            IF(lrxios) CALL iom_swap(cxios_context) 
    856858         ELSE                                   !* Start from rest 
    857859            IF(lwp) WRITE(numout,*) 
     
    867869         iter = kt + nn_fsbc - 1             ! ice restarts are written at kt == nitrst - nn_fsbc + 1 
    868870         ! 
    869          CALL iom_rstput( iter, nitrst, numriw, 'stress1_i' , stress1_i  ) 
    870          CALL iom_rstput( iter, nitrst, numriw, 'stress2_i' , stress2_i  ) 
    871          CALL iom_rstput( iter, nitrst, numriw, 'stress12_i', stress12_i ) 
     871         IF( lwxios ) CALL iom_swap(      cwixios_context         ) 
     872         CALL iom_rstput( iter, nitrst, numriw, 'stress1_i' , stress1_i,  ldxios = lwxios ) 
     873         CALL iom_rstput( iter, nitrst, numriw, 'stress2_i' , stress2_i,  ldxios = lwxios ) 
     874         CALL iom_rstput( iter, nitrst, numriw, 'stress12_i', stress12_i, ldxios = lwxios ) 
     875         IF( lwxios ) CALL iom_swap(      cxios_context         ) 
    872876         ! 
    873877      ENDIF 
  • NEMO/branches/2020/dev_12905_xios_restart/src/ICE/icerst.F90

    r12649 r12957  
    5151      CHARACTER(len=50)   ::   clname   ! ice output restart file name 
    5252      CHARACTER(len=256)  ::   clpath   ! full path to ice output restart file  
     53      CHARACTER(LEN=52)   ::   clpname   ! ocean output restart file name including prefix for AGRIF 
    5354      !!---------------------------------------------------------------------- 
    5455      ! 
     
    8081            ENDIF 
    8182            ! 
    82             CALL iom_open( TRIM(clpath)//TRIM(clname), numriw, ldwrt = .TRUE., kdlev = jpl, cdcomp = 'ICE' ) 
     83            IF(.NOT.lwxios) THEN 
     84               CALL iom_open( TRIM(clpath)//TRIM(clname), numriw, ldwrt = .TRUE., kdlev = jpl, cdcomp = 'ICE' ) 
     85            ELSE 
     86#if defined key_iomput 
     87               cwixios_context = "rstwi_"//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., ld_closedef = .FALSE. ) 
     94               CALL iom_swap(      cxios_context          ) 
     95#else 
     96               clinfo = 'Can not use XIOS in rst_opn' 
     97               CALL ctl_stop(TRIM(clinfo)) 
     98#endif 
     99            ENDIF 
    83100            lrst_ice = .TRUE. 
    84101         ENDIF 
     
    117134      ! ------------------  
    118135      !                                                                        ! calendar control 
    119       CALL iom_rstput( iter, nitrst, numriw, 'nn_fsbc', REAL( nn_fsbc, wp ) )      ! time-step  
    120       CALL iom_rstput( iter, nitrst, numriw, 'kt_ice' , REAL( iter   , wp ) )      ! date 
     136      IF( lwxios ) CALL iom_swap(      cwixios_context         ) 
     137      CALL iom_rstput( iter, nitrst, numriw, 'nn_fsbc', REAL( nn_fsbc, wp ), ldxios = lwxios )      ! time-step  
     138      CALL iom_rstput( iter, nitrst, numriw, 'kt_ice' , REAL( iter   , wp ), ldxios = lwxios )      ! date 
    121139      CALL iom_delay_rst( 'WRITE', 'ICE', numriw )   ! save only ice delayed global communication variables 
    122140 
    123141      ! Prognostic variables 
    124       CALL iom_rstput( iter, nitrst, numriw, 'v_i'  , v_i  ) 
    125       CALL iom_rstput( iter, nitrst, numriw, 'v_s'  , v_s  ) 
    126       CALL iom_rstput( iter, nitrst, numriw, 'sv_i' , sv_i  ) 
    127       CALL iom_rstput( iter, nitrst, numriw, 'a_i'  , a_i  ) 
    128       CALL iom_rstput( iter, nitrst, numriw, 't_su' , t_su  ) 
    129       CALL iom_rstput( iter, nitrst, numriw, 'u_ice', u_ice ) 
    130       CALL iom_rstput( iter, nitrst, numriw, 'v_ice', v_ice ) 
    131       CALL iom_rstput( iter, nitrst, numriw, 'oa_i' , oa_i  ) 
    132       CALL iom_rstput( iter, nitrst, numriw, 'a_ip' , a_ip  ) 
    133       CALL iom_rstput( iter, nitrst, numriw, 'v_ip' , v_ip  ) 
     142      CALL iom_rstput( iter, nitrst, numriw, 'v_i'  , v_i,   ldxios = lwxios ) 
     143      CALL iom_rstput( iter, nitrst, numriw, 'v_s'  , v_s,   ldxios = lwxios ) 
     144      CALL iom_rstput( iter, nitrst, numriw, 'sv_i' , sv_i,  ldxios = lwxios ) 
     145      CALL iom_rstput( iter, nitrst, numriw, 'a_i'  , a_i,   ldxios = lwxios ) 
     146      CALL iom_rstput( iter, nitrst, numriw, 't_su' , t_su,  ldxios = lwxios ) 
     147      CALL iom_rstput( iter, nitrst, numriw, 'u_ice', u_ice, ldxios = lwxios ) 
     148      CALL iom_rstput( iter, nitrst, numriw, 'v_ice', v_ice, ldxios = lwxios ) 
     149      CALL iom_rstput( iter, nitrst, numriw, 'oa_i' , oa_i,  ldxios = lwxios ) 
     150      CALL iom_rstput( iter, nitrst, numriw, 'a_ip' , a_ip,  ldxios = lwxios ) 
     151      CALL iom_rstput( iter, nitrst, numriw, 'v_ip' , v_ip,  ldxios = lwxios ) 
    134152      ! Snow enthalpy 
    135153      DO jk = 1, nlay_s  
     
    137155         znam = 'e_s'//'_l'//zchar1 
    138156         z3d(:,:,:) = e_s(:,:,jk,:) 
    139          CALL iom_rstput( iter, nitrst, numriw, znam , z3d ) 
     157         CALL iom_rstput( iter, nitrst, numriw, znam , z3d, ldxios = lwxios ) 
    140158      END DO 
    141159      ! Ice enthalpy 
     
    144162         znam = 'e_i'//'_l'//zchar1 
    145163         z3d(:,:,:) = e_i(:,:,jk,:) 
    146          CALL iom_rstput( iter, nitrst, numriw, znam , z3d ) 
     164         CALL iom_rstput( iter, nitrst, numriw, znam , z3d, ldxios = lwxios ) 
    147165      END DO 
    148166      ! fields needed for Met Office (Jules) coupling 
    149167      IF( ln_cpl ) THEN 
    150          CALL iom_rstput( iter, nitrst, numriw, 'cnd_ice', cnd_ice ) 
    151          CALL iom_rstput( iter, nitrst, numriw, 't1_ice' , t1_ice  ) 
    152       ENDIF 
     168         CALL iom_rstput( iter, nitrst, numriw, 'cnd_ice', cnd_ice, ldxios = lwxios ) 
     169         CALL iom_rstput( iter, nitrst, numriw, 't1_ice' , t1_ice,  ldxios = lwxios ) 
     170      ENDIF 
     171      IF( lwxios ) CALL iom_swap(      cxios_context         ) 
    153172      ! 
    154173 
     
    156175      ! ------------------ 
    157176      IF( iter == nitrst ) THEN 
    158          CALL iom_close( numriw ) 
     177         IF(.NOT.lwxios) THEN 
     178            CALL iom_close( numriw ) 
     179         ELSE 
     180            CALL iom_context_finalize(      cwixios_context          ) 
     181         ENDIF 
    159182         lrst_ice = .FALSE. 
    160183      ENDIF 
     
    176199      CHARACTER(len=2)  ::   zchar, zchar1 
    177200      REAL(wp)          ::   zfice, ziter 
     201      CHARACTER(lc)     ::   clpname 
    178202      REAL(wp), DIMENSION(jpi,jpj,jpl) ::   z3d   ! 3D workspace 
    179203      !!---------------------------------------------------------------------- 
     
    185209      ENDIF 
    186210 
     211      lxios_sini = .FALSE. 
    187212      CALL iom_open ( TRIM(cn_icerst_indir)//'/'//cn_icerst_in, numrir ) 
     213 
     214      IF( lrxios .AND. .NOT. lxios_sini) STOP 'OCE and ICE restart must be in a single file' 
     215      IF(lwp) write(numout, *) 'USE XIOS to read restart: ', lrxios 
     216      IF(lwp) CALL FLUSH(numout) 
     217      IF( lrxios) THEN 
     218          crixios_context = 'si3_rst' 
     219          IF(lwp) WRITE(numout,*) 'Enable restart reading by XIOS for SI3' 
     220          IF( TRIM(Agrif_CFixed()) == '0' ) THEN 
     221             clpname = cn_icerst_in 
     222          ELSE 
     223             clpname = TRIM(Agrif_CFixed())//"_"//cn_icerst_in    
     224          ENDIF 
     225          CALL iom_init( crixios_context, fname = TRIM(cn_icerst_indir)//'/'//TRIM(clpname), ld_tmppatch = .TRUE. ) 
     226      ENDIF 
    188227 
    189228      ! test if v_i exists  
     
    193232      IF( id0 > 0 ) THEN   ! == case of a normal restart == ! 
    194233         !                 ! ------------------------------ ! 
    195           
     234         IF(lrxios) CALL iom_swap(crixios_context)  
    196235         ! Time info 
    197          CALL iom_get( numrir, 'nn_fsbc', zfice ) 
    198          CALL iom_get( numrir, 'kt_ice' , ziter )     
     236         CALL iom_get( numrir, 'nn_fsbc', zfice, ldxios = lrxios ) 
     237         CALL iom_get( numrir, 'kt_ice' , ziter, ldxios = lrxios )     
    199238         IF(lwp) WRITE(numout,*) '   read ice restart file at time step    : ', ziter 
    200239         IF(lwp) WRITE(numout,*) '   in any case we force it to nit000 - 1 : ', nit000 - 1 
     
    211250 
    212251         ! --- mandatory fields --- !  
    213          CALL iom_get( numrir, jpdom_autoglo, 'v_i'  , v_i  ) 
    214          CALL iom_get( numrir, jpdom_autoglo, 'v_s'  , v_s  ) 
    215          CALL iom_get( numrir, jpdom_autoglo, 'sv_i' , sv_i  ) 
    216          CALL iom_get( numrir, jpdom_autoglo, 'a_i'  , a_i  ) 
    217          CALL iom_get( numrir, jpdom_autoglo, 't_su' , t_su  ) 
    218          CALL iom_get( numrir, jpdom_autoglo, 'u_ice', u_ice ) 
    219          CALL iom_get( numrir, jpdom_autoglo, 'v_ice', v_ice ) 
     252         CALL iom_get( numrir, jpdom_autoglo, 'v_i'  , v_i,   ldxios = lrxios ) 
     253         CALL iom_get( numrir, jpdom_autoglo, 'v_s'  , v_s,   ldxios = lrxios ) 
     254         CALL iom_get( numrir, jpdom_autoglo, 'sv_i' , sv_i,  ldxios = lrxios ) 
     255         CALL iom_get( numrir, jpdom_autoglo, 'a_i'  , a_i,   ldxios = lrxios ) 
     256         CALL iom_get( numrir, jpdom_autoglo, 't_su' , t_su,  ldxios = lrxios ) 
     257         CALL iom_get( numrir, jpdom_autoglo, 'u_ice', u_ice, ldxios = lrxios ) 
     258         CALL iom_get( numrir, jpdom_autoglo, 'v_ice', v_ice, ldxios = lrxios ) 
    220259         ! Snow enthalpy 
    221260         DO jk = 1, nlay_s 
    222261            WRITE(zchar1,'(I2.2)') jk 
    223262            znam = 'e_s'//'_l'//zchar1 
    224             CALL iom_get( numrir, jpdom_autoglo, znam , z3d ) 
     263            CALL iom_get( numrir, jpdom_autoglo, znam , z3d, ldxios = lrxios ) 
    225264            e_s(:,:,jk,:) = z3d(:,:,:) 
    226265         END DO 
     
    229268            WRITE(zchar1,'(I2.2)') jk 
    230269            znam = 'e_i'//'_l'//zchar1 
    231             CALL iom_get( numrir, jpdom_autoglo, znam , z3d ) 
     270            CALL iom_get( numrir, jpdom_autoglo, znam , z3d, ldxios = lrxios ) 
    232271            e_i(:,:,jk,:) = z3d(:,:,:) 
    233272         END DO 
     
    236275         id1 = iom_varid( numrir, 'oa_i' , ldstop = .FALSE. ) 
    237276         IF( id1 > 0 ) THEN                       ! fields exist 
    238             CALL iom_get( numrir, jpdom_autoglo, 'oa_i', oa_i ) 
     277            CALL iom_get( numrir, jpdom_autoglo, 'oa_i', oa_i, ldxios = lrxios ) 
    239278         ELSE                                     ! start from rest 
    240279            IF(lwp) WRITE(numout,*) '   ==>>   previous run without ice age output then set it to zero' 
     
    244283         id2 = iom_varid( numrir, 'a_ip' , ldstop = .FALSE. ) 
    245284         IF( id2 > 0 ) THEN                       ! fields exist 
    246             CALL iom_get( numrir, jpdom_autoglo, 'a_ip' , a_ip ) 
    247             CALL iom_get( numrir, jpdom_autoglo, 'v_ip' , v_ip ) 
     285            CALL iom_get( numrir, jpdom_autoglo, 'a_ip' , a_ip, ldxios = lrxios ) 
     286            CALL iom_get( numrir, jpdom_autoglo, 'v_ip' , v_ip, ldxios = lrxios ) 
    248287         ELSE                                     ! start from rest 
    249288            IF(lwp) WRITE(numout,*) '   ==>>   previous run without melt ponds output then set it to zero' 
     
    256295            id4 = iom_varid( numrir, 't1_ice'  , ldstop = .FALSE. ) 
    257296            IF( id3 > 0 .AND. id4 > 0 ) THEN         ! fields exist 
    258                CALL iom_get( numrir, jpdom_autoglo, 'cnd_ice', cnd_ice ) 
    259                CALL iom_get( numrir, jpdom_autoglo, 't1_ice' , t1_ice  ) 
     297               CALL iom_get( numrir, jpdom_autoglo, 'cnd_ice', cnd_ice, ldxios = lrxios ) 
     298               CALL iom_get( numrir, jpdom_autoglo, 't1_ice' , t1_ice,  ldxios = lrxios ) 
    260299            ELSE                                     ! start from rest 
    261300               IF(lwp) WRITE(numout,*) '   ==>>   previous run without conductivity output then set it to zero' 
     
    266305 
    267306         CALL iom_delay_rst( 'READ', 'ICE', numrir )   ! read only ice delayed global communication variables 
    268  
     307         IF(lrxios) CALL iom_swap(cxios_context) 
    269308         !                 ! ---------------------------------- ! 
    270309      ELSE                 ! == case of a simplified restart == ! 
  • NEMO/branches/2020/dev_12905_xios_restart/src/ICE/iceupdate.F90

    r12489 r12957  
    417417            ! 
    418418            IF( id1 > 0 ) THEN                       ! fields exist 
    419                CALL iom_get( numrir, jpdom_autoglo, 'snwice_mass'  , snwice_mass   ) 
    420                CALL iom_get( numrir, jpdom_autoglo, 'snwice_mass_b', snwice_mass_b ) 
     419               IF(lrxios) CALL iom_swap(crixios_context)  
     420               CALL iom_get( numrir, jpdom_autoglo, 'snwice_mass'  , snwice_mass,   ldxios = lrxios ) 
     421               CALL iom_get( numrir, jpdom_autoglo, 'snwice_mass_b', snwice_mass_b, ldxios = lrxios ) 
     422               IF(lrxios) CALL iom_swap(cxios_context) 
    421423            ELSE                                     ! start from rest 
    422424               IF(lwp) WRITE(numout,*) '   ==>>   previous run without snow-ice mass output then set it' 
     
    435437         iter = kt + nn_fsbc - 1             ! ice restarts are written at kt == nitrst - nn_fsbc + 1 
    436438         ! 
    437          CALL iom_rstput( iter, nitrst, numriw, 'snwice_mass'  , snwice_mass   ) 
    438          CALL iom_rstput( iter, nitrst, numriw, 'snwice_mass_b', snwice_mass_b ) 
     439         IF( lwxios ) CALL iom_swap(      cwixios_context         ) 
     440         CALL iom_rstput( iter, nitrst, numriw, 'snwice_mass'  , snwice_mass,   ldxios = lwxios ) 
     441         CALL iom_rstput( iter, nitrst, numriw, 'snwice_mass_b', snwice_mass_b, ldxios = lwxios ) 
     442         IF( lwxios ) CALL iom_swap(      cxios_context         ) 
    439443         ! 
    440444      ENDIF 
  • NEMO/branches/2020/dev_12905_xios_restart/src/OCE/DOM/daymod.F90

    r12951 r12957  
    403403         ! calendar control 
    404404         IF( lwxios ) CALL iom_swap(      cwxios_context          ) 
    405          ENDIF 
    406405         CALL iom_rstput( kt, nitrst, numrow, 'kt'     , REAL( kt    , wp)  , ldxios = lwxios )   ! time-step 
    407406         CALL iom_rstput( kt, nitrst, numrow, 'ndastp' , REAL( ndastp, wp)  , ldxios = lwxios )   ! date 
  • NEMO/branches/2020/dev_12905_xios_restart/src/OCE/IOM/in_out_manager.F90

    r12914 r12957  
    180180   CHARACTER(lc) ::   crxios_context        !: context name used in xios to read restart 
    181181   CHARACTER(lc) ::   cwxios_context        !: context name used in xios to write restart file 
     182   CHARACTER(lc) ::   crixios_context       !: context name used in xios to read SI3 restart 
     183   CHARACTER(lc) ::   cwixios_context       !: context name used in xios to write SI3 restart file 
     184 
    182185 
    183186   !! * Substitutions 
  • NEMO/branches/2020/dev_12905_xios_restart/src/OCE/IOM/iom.F90

    r12951 r12957  
    114114      INTEGER             :: irefyear, irefmonth, irefday 
    115115      INTEGER           :: ji 
    116       LOGICAL :: llrst_context              ! is context related to restart 
     116      LOGICAL           :: llrst_context              ! is context related to restart 
     117      INTEGER           :: inum 
    117118      ! 
    118119      REAL(wp), ALLOCATABLE, DIMENSION(:,:) :: zt_bnds, zw_bnds 
     
    142143      ALLOCATE( zt_bnds(2,jpk), zw_bnds(2,jpk) ) 
    143144      ! 
     145      IF(lwp) write(numout, *) 'TEST IOM_INIT: ', TRIM(cdname),' File: ', TRIM(fname) 
     146      IF(lwp) CALL FLUSH(numout) 
    144147      clname = cdname 
    145148      IF( TRIM(Agrif_CFixed()) /= '0' )   clname = TRIM(Agrif_CFixed())//"_"//TRIM(cdname) 
    146149      CALL xios_context_initialize(TRIM(clname), mpi_comm_oce) 
    147150      CALL iom_swap( cdname ) 
    148       llrst_context =  (TRIM(cdname) == TRIM(crxios_context) .OR. TRIM(cdname) == TRIM(cwxios_context)) 
     151      llrst_context = (TRIM(cdname) == TRIM(crxios_context)) .OR. (TRIM(cdname) == TRIM(cwxios_context)) 
     152      llrst_context = llrst_context .OR. (TRIM(cdname) == TRIM(crixios_context)) .OR. (TRIM(cdname) == TRIM(cwixios_context)) 
    149153 
    150154      ! Calendar type is now defined in xml file  
     
    260264      ! 
    261265      ! automatic definitions of some of the xml attributs 
    262       IF( TRIM(cdname) == TRIM(crxios_context) ) THEN 
    263 !set names of the fields in restart file IF using XIOS to read data 
     266      IF(lwp) write(numout, *) 'TEST IOM_INIT: ', TRIM(cdname), TRIM(cdname) == TRIM(crixios_context) 
     267      IF(lwp) CALL FLUSH(numout) 
     268      IF( TRIM(cdname) == TRIM(crxios_context) .OR. TRIM(cdname) == TRIM(crixios_context)) THEN 
     269          IF(TRIM(cdname) == TRIM(crxios_context) ) THEN 
     270             inum = numror 
     271          ELSEIF(TRIM(cdname) == TRIM(crixios_context)) THEN 
     272             inum = numrir  
     273          ELSE 
     274             CALL ctl_stop( 'iom_init:', 'restart read with XIOS: Unknown restart context' ) 
     275          ENDIF 
    264276          CALL iom_set_rst_context(.TRUE.) 
    265 !set which fields are to be read from restart file 
    266           CALL iom_set_rstr_active() 
    267       ELSE IF( TRIM(cdname) == TRIM(cwxios_context) ) THEN 
     277!set which fields will be read from restart file 
     278          CALL iom_set_rstr_active(fname, inum) 
     279      ELSE IF( (TRIM(cdname) == TRIM(cwxios_context)) .OR. (TRIM(cdname) == TRIM(cwixios_context))) THEN 
    268280          CALL iom_set_rstw_file(fname) 
    269281      ELSE 
     
    298310   CHARACTER(len=*), OPTIONAL, INTENT(IN) :: cdname 
    299311#if defined key_iomput 
    300       IF( TRIM(cdname) == TRIM(cwxios_context) ) THEN 
     312   LOGICAL :: llrstw 
     313 
     314      IF(lwp) write(numout, *) 'XIOS CLOSE definitions for: ', TRIM(cdname) 
     315      llrstw = .FALSE. 
     316     IF(PRESENT(cdname)) THEN 
     317         IF((TRIM(cdname) == TRIM(cwxios_context)) .OR. (TRIM(cdname) == TRIM(cwixios_context))) THEN 
     318           llrstw = .TRUE. 
     319         ENDIF 
     320      ENDIF 
     321 
     322      IF( llrstw ) THEN 
    301323!set names of the fields in restart file IF using XIOS to write data 
    302324          CALL iom_set_rst_context(.FALSE.) 
     
    305327      CALL xios_close_context_definition() 
    306328 
    307       IF(.NOT. (TRIM(cdname) == TRIM(cwxios_context)))  CALL xios_update_calendar( 0 ) 
     329      IF(.NOT. llrstw)  CALL xios_update_calendar( 0 ) 
    308330 
    309331#else 
     
    313335   END SUBROUTINE iom_init_closedef 
    314336 
    315    SUBROUTINE iom_set_rstr_active() 
     337   SUBROUTINE iom_set_rstr_active(cdfname, idnum) 
    316338      !!--------------------------------------------------------------------- 
    317339      !!                   ***  SUBROUTINE  iom_set_rstr_active  *** 
     
    322344 
    323345!sets enabled = .TRUE. for each field in restart file 
    324    CHARACTER(len=256) :: rst_file 
     346   CHARACTER(len=*), INTENT(IN) :: cdfname 
     347   INTEGER         , INTENT(IN) :: idnum  
    325348#if defined key_iomput 
    326349   INTEGER                                    :: ndims, nvars, natts, unlimitedDimId, dimlen, xtype,mdims 
     
    329352   TYPE(xios_filegroup)                       :: filegroup_hdl 
    330353   INTEGER                                    :: dimids(4), jv,i, idim 
    331    CHARACTER(LEN=lc)                          :: clpath 
    332354   CHARACTER(LEN=256)                         :: clinfo               ! info character 
    333355   INTEGER, ALLOCATABLE                       :: indimlens(:) 
     
    353375        meta(10) = "numcat" 
    354376 
    355         clpath = TRIM(cn_ocerst_indir) 
    356         IF( clpath(LEN_TRIM(clpath):) /= '/' ) clpath = TRIM(clpath) // '/' 
    357         IF( TRIM(Agrif_CFixed()) == '0' ) THEN 
    358            rst_file = TRIM(clpath)//TRIM(cn_ocerst_in) 
    359         ELSE 
    360            rst_file = TRIM(clpath)//TRIM(Agrif_CFixed())//'_'//TRIM(cn_ocerst_in) 
    361         ENDIF 
    362  
    363         clinfo = '          iom_set_rstr_active, file: '//TRIM(rst_file) 
    364  
     377        clinfo = '          iom_set_rstr_active, file: '//TRIM(cdfname) 
     378 
     379        IF(lwp) write(numout, *) TRIM(clinfo) 
     380        IF(lwp) CALL FLUSH(numout) 
    365381!set name of the restart file and enable available fields 
    366382        CALL xios_get_handle("file_definition", filegroup_hdl ) 
    367383        CALL xios_add_child(filegroup_hdl, file_hdl, 'rrestart') 
    368         CALL xios_set_file_attr( "rrestart", name=trim(rst_file), type="one_file", & 
     384        CALL xios_set_file_attr( "rrestart", name=trim(cdfname), type="one_file", & 
    369385             par_access="collective", enabled=.TRUE., mode="read",                 & 
    370386             output_freq=xios_timestep) 
    371387 
    372         CALL iom_nf90_check( nf90_inquire( iom_file(numror)%nfid, ndims, nvars, natts ), clinfo ) 
     388        CALL iom_nf90_check( nf90_inquire( iom_file(idnum)%nfid, ndims, nvars, natts ), clinfo ) 
    373389        ALLOCATE(indimlens(ndims), indimnames(ndims)) 
    374         CALL iom_nf90_check( nf90_inquire( iom_file(numror)%nfid, unlimitedDimId = unlimitedDimId ), clinfo ) 
     390        CALL iom_nf90_check( nf90_inquire( iom_file(idnum)%nfid, unlimitedDimId = unlimitedDimId ), clinfo ) 
    375391 
    376392        DO idim = 1, ndims 
    377            CALL iom_nf90_check( nf90_inquire_dimension( iom_file(numror)%nfid, idim, dimname, dimlen ), clinfo ) 
     393           CALL iom_nf90_check( nf90_inquire_dimension( iom_file(idnum)%nfid, idim, dimname, dimlen ), clinfo ) 
    378394           indimlens(idim) = dimlen 
    379395           indimnames(idim) = dimname 
     
    382398        DO jv =1, nvars 
    383399            lmeta = .FALSE. 
    384             CALL iom_nf90_check( nf90_inquire_variable( iom_file(numror)%nfid, jv, varname, xtype, ndims, dimids, natts ), clinfo ) 
     400            CALL iom_nf90_check( nf90_inquire_variable( iom_file(idnum)%nfid, jv, varname, xtype, ndims, dimids, natts ), clinfo ) 
    385401            DO i = 1, NMETA 
    386402               IF(TRIM(varname) == TRIM(meta(i))) THEN 
     
    390406            IF(.NOT.lmeta) THEN 
    391407               CALL xios_add_child(file_hdl, field_hdl, TRIM(varname)) 
     408               if(lwp) write(numout, *) 'ADD field: ', TRIM(varname) 
     409               IF(lwp) CALL FLUSH(numout) 
    392410               mdims = ndims 
    393411 
     
    397415 
    398416               IF(mdims == 3) THEN 
     417                      if(lwp) write(numout, *) '3D', indimlens(ndims) 
     418                      IF(lwp) CALL FLUSH(numout) 
     419 
    399420                      CALL xios_set_attr (field_hdl, enabled = .TRUE., name = TRIM(varname),   & 
    400421                                   domain_ref="grid_N", axis_ref=TRIM(iom_axis(indimlens(ndims))), & 
    401422                                   prec = 8, operation = "instant") 
    402423               ELSEIF(mdims == 2) THEN 
     424                      if(lwp) write(numout, *) '2D' 
     425                      IF(lwp) CALL FLUSH(numout) 
     426 
    403427                      CALL xios_set_attr (field_hdl, enabled = .TRUE., name = TRIM(varname), & 
    404428                                          domain_ref="grid_N", prec = 8, operation = "instant")  
    405429               ELSEIF(mdims == 1) THEN 
     430                      if(lwp) write(numout, *) '1D', indimlens(ndims) 
     431                      IF(lwp) CALL FLUSH(numout) 
     432 
    406433                      CALL xios_set_attr (field_hdl, enabled = .TRUE., name = TRIM(varname), & 
    407434                                          axis_ref=TRIM(iom_axis(indimlens(ndims))), prec = 8, operation = "instant") 
    408435               ELSEIF(mdims == 0) THEN 
     436                      if(lwp) write(numout, *) '0D' 
     437                      IF(lwp) CALL FLUSH(numout) 
     438 
    409439                      CALL xios_set_attr (field_hdl, enabled = .TRUE., name = TRIM(varname), & 
    410440                                                scalar_ref = "grid_scalar", prec = 8, operation = "instant") 
    411441               ELSE 
    412                    WRITE(ctmp1,*) 'iom_set_rstr_active: variable ', TRIM(varname) ,' incorrect number of dimensions'  
    413                    CALL ctl_stop( 'iom_set_rstr_active:', ctmp1 ) 
     442                      if(lwp) write(numout, *) 'WAHT?' 
     443                      IF(lwp) CALL FLUSH(numout) 
     444 
     445                      WRITE(ctmp1,*) 'iom_set_rstr_active: variable ', TRIM(varname) ,' incorrect number of dimensions'  
     446                      CALL ctl_stop( 'iom_set_rstr_active:', ctmp1 ) 
    414447               ENDIF 
    415448            ENDIF 
     
    434467!set name of the restart file and enable available fields 
    435468        IF(lwp) WRITE(numout,*) 'Setting restart filename (for XIOS write) to: ',cdrst_file 
     469        IF(lwp) CALL FLUSH(numout) 
    436470        CALL xios_get_handle("file_definition", filegroup_hdl ) 
    437471        CALL xios_add_child(filegroup_hdl, file_hdl, 'wrestart') 
     
    18691903      !!---------------------------------------------------------------------- 
    18701904      clname = cdname 
     1905      IF(lwp) write(numout, *) 'Finalize: ', TRIM(cdname) 
    18711906      IF( TRIM(Agrif_CFixed()) .NE. '0' ) clname = TRIM(Agrif_CFixed())//"_"//clname  
    18721907      IF( xios_is_valid_context(clname) ) THEN 
  • NEMO/branches/2020/dev_12905_xios_restart/src/OCE/IOM/restart.F90

    r12950 r12957  
    190190      !!                the file has already been opened 
    191191      !!---------------------------------------------------------------------- 
    192       LOGICAL        ::   llok 
    193       CHARACTER(lc)  ::   clpath   ! full path to ocean output restart file 
     192      LOGICAL         ::   llok 
     193      CHARACTER(lc)   ::   clpath   ! full path to ocean output restart file 
     194      CHARACTER(lc+2) ::   clpname  ! file name including agrif prefix 
    194195      !!---------------------------------------------------------------------- 
    195196      ! 
     
    209210! restart) 
    210211         IF(.NOT.lxios_set) lrxios = lrxios.AND.lxios_sini 
     212 
    211213         IF( lrxios) THEN 
    212              crxios_context = 'nemo_rst' 
     214             crxios_context = 'oce_rst' 
    213215             IF( .NOT.lxios_set ) THEN 
    214216                 IF(lwp) WRITE(numout,*) 'Enable restart reading by XIOS' 
    215                  CALL iom_init( crxios_context, ld_tmppatch = .TRUE. ) 
     217                 IF( TRIM(Agrif_CFixed()) == '0' ) THEN 
     218                    clpname = cn_ocerst_in 
     219                 ELSE 
     220                    clpname = TRIM(Agrif_CFixed())//"_"//cn_ocerst_in    
     221                 ENDIF 
     222                 CALL iom_init( crxios_context, fname = TRIM(clpath)//TRIM(clpname), ld_tmppatch = .TRUE. ) 
    216223                 lxios_set = .TRUE. 
    217224             ENDIF 
    218225         ENDIF 
    219          IF( TRIM(Agrif_CFixed()) /= '0' .AND. lrxios) THEN 
    220              CALL iom_init( crxios_context, ld_tmppatch = .TRUE. ) 
    221              IF(lwp) WRITE(numout,*) 'Enable restart reading by XIOS for AGRIF' 
    222              lxios_set = .TRUE. 
    223          ENDIF  
     226 
    224227      ENDIF 
    225228 
  • NEMO/branches/2020/dev_12905_xios_restart/src/OCE/step.F90

    r12950 r12957  
    122122                             CALL iom_init_closedef 
    123123         IF( ln_crs      )   CALL iom_init( TRIM(cxios_context)//"_crs" )  ! for coarse grid 
    124       ELSEIF((kstp == nitrst) .AND. lwxios) THEN 
     124      ENDIF 
     125      IF((kstp == nitrst) .AND. lwxios) THEN 
    125126         CALL iom_swap(      cwxios_context          ) 
    126127         CALL iom_init_closedef(cwxios_context) 
    127128         CALL iom_setkt( kstp - nit000 + 1,      cwxios_context          ) 
    128          CALL iom_swap(      cwxios_context          ) 
    129       ENDIF 
     129      ENDIF 
     130#if defined key_si3 
     131      IF(((kstp + nn_fsbc - 1) == nitrst) .AND. lwxios) THEN 
     132         CALL iom_swap(      cwixios_context          ) 
     133         CALL iom_init_closedef(cwixios_context) 
     134         CALL iom_setkt( kstp - nit000 + 1,      cwixios_context          ) 
     135      ENDIF 
     136#endif 
    130137      IF( kstp /= nit000 )   CALL day( kstp )         ! Calendar (day was already called at nit000 in day_init) 
    131138                             CALL iom_setkt( kstp - nit000 + 1,      cxios_context          )   ! tell IOM we are at time step kstp 
     
    355362      IF( kstp == nitend .OR. indic < 0 ) THEN  
    356363                      CALL iom_context_finalize(      cxios_context          ) ! needed for XIOS+AGRIF 
    357          IF( lrxios ) CALL iom_context_finalize(      crxios_context         ) 
     364         IF( lrxios ) THEN 
     365                      CALL iom_context_finalize(      crxios_context         ) 
     366#if defined key_si3 
     367                      CALL iom_context_finalize(      crixios_context         ) 
     368#endif 
     369         ENDIF 
    358370         IF( ln_crs ) CALL iom_context_finalize( trim(cxios_context)//"_crs" ) !  
    359371      ENDIF 
Note: See TracChangeset for help on using the changeset viewer.