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 14018 – NEMO

Changeset 14018


Ignore:
Timestamp:
2020-12-02T18:22:24+01:00 (3 years ago)
Author:
techene
Message:

#2385 branch updated with trunk 13970

Location:
NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3
Files:
56 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3

    • Property svn:externals
      •  

        old new  
        88 
        99# SETTE 
        10 ^/utils/CI/sette@13559        sette 
         10^/utils/CI/sette@13795        sette 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/doc/latex/NEMO/main/bibliography.bib

    r12377 r14018  
    19061906} 
    19071907 
     1908@Article{        love_PRSLA1909, 
     1909  author       = "A. E. H. Love", 
     1910  title        = "The Yielding of the Earth to Disturbing Forces", 
     1911  journal      = "Proc. R. Soc. Lond. A", 
     1912  year         = "1909", 
     1913  volume       = "82", 
     1914  pages        = "73-88", 
     1915  doi          = "10.1098/rspa.1909.0008" 
     1916} 
     1917 
    19081918@article{         losch_JGR08, 
    19091919  title         = "Modeling ice shelf cavities in a z coordinate Ocean 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/doc/latex/NEMO/subfiles/chap_DIA.tex

    r12377 r14018  
    119119\subsection{XIOS: Reading and writing restart file} 
    120120 
    121 XIOS may be used to read single file restart produced by \NEMO. Currently only the variables written to 
    122 file \forcode{numror} can be handled by XIOS. To activate restart reading using XIOS, set \np[=.true. ]{ln_xios_read}{ln\_xios\_read} 
     121XIOS may be used to read single file restart produced by \NEMO. The variables written to 
     122file \forcode{numror} (OCE), \forcode{numrir} (SI3), \forcode{numrtr} (TOP), \forcode{numrsr} (SED) can be handled by XIOS.  
     123To activate restart reading using XIOS, set \np[=.true. ]{ln_xios_read}{ln\_xios\_read} 
    123124in \textit{namelist\_cfg}. This setting will be ignored when multiple restart files are present, and default \NEMO 
    124125functionality will be used for reading. There is no need to change iodef.xml file to use XIOS to read 
     
    142143have to be rebuild before continuing the run. This option aims to reduce number of restart files generated by \NEMO\ only, 
    143144and may be useful when there is a need to change number of processors used to run simulation. 
    144  
    145 If an additional variable must be written to a restart file, the following steps are needed: 
    146 \begin{enumerate} 
    147 \item Add variable name to a list of restart variables (in subroutine \rou{iom\_set\_rst\_vars,} \mdl{iom}) and 
    148 define correct grid for the variable (\forcode{grid_N_3D} - 3D variable, \forcode{grid_N} - 2D variable, \forcode{grid_vector} - 
    149 1D variable, \forcode{grid_scalar} - scalar), 
    150 \item Add variable to the list of fields written by restart.  This can be done either in subroutine 
    151 \rou{iom\_set\_rstw\_core} (\mdl{iom}) or by calling  \rou{iom\_set\_rstw\_active} (\mdl{iom}) with the name of a variable 
    152 as an argument. This convention follows approach for writing restart using iom, where variables are 
    153 written either by \rou{rst\_write} or by calling \rou{iom\_rstput} from individual routines. 
    154 \end{enumerate} 
    155145 
    156146An older versions of XIOS do not support reading functionality. It's recommended to use at least XIOS2@1451. 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/doc/latex/NEMO/subfiles/chap_DYN.tex

    r11693 r14018  
    12451245the atmospheric pressure is taken into account when computing the surface pressure gradient. 
    12461246 
    1247 (2) When \np[=.true.]{ln_tide_pot}{ln\_tide\_pot} and \np[=.true.]{ln_tide}{ln\_tide} (see \autoref{sec:SBC_tide}), 
     1247(2) When \np[=.true.]{ln_tide_pot}{ln\_tide\_pot} and \np[=.true.]{ln_tide}{ln\_tide} (see \autoref{sec:SBC_TDE}), 
    12481248the tidal potential is taken into account when computing the surface pressure gradient. 
    12491249 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/doc/latex/NEMO/subfiles/chap_LBC.tex

    r11693 r14018  
    1616    Release & Author(s) & Modifications \\ 
    1717    \hline 
     18    {\em  next} & {\em Simon M{\" u}ller} & {\em Minor update of \autoref{subsec:LBC_bdy_tides}} \\[2mm] 
    1819    {\em   4.0} & {\em ...} & {\em ...} \\ 
    1920    {\em   3.6} & {\em ...} & {\em ...} \\ 
     
    665666 
    666667Tidal forcing at open boundaries requires the activation of surface 
    667 tides (i.e., in \nam{_tide}{\_tide}, \np{ln_tide}{ln\_tide} needs to be set to 
    668 \forcode{.true.} and the required constituents need to be activated by 
    669 including their names in the \np{clname}{clname} array; see 
    670 \autoref{sec:SBC_tide}). Specific options related to the reading in of 
     668tides (i.e., in \nam{_tide}{\_tide}, \np[=.true.]{ln_tide}{ln\_tide} with the active tidal 
     669constituents listed in the \np{sn_tide_cnames}{sn\_tide\_cnames} array; see 
     670\autoref{sec:SBC_TDE}). The specific options related to the reading in of 
    671671the complex harmonic amplitudes of elevation (SSH) and barotropic 
    672 velocity (u,v) at open boundaries are defined through the 
    673 \nam{bdy_tide}{bdy\_tide} namelist parameters.\\ 
     672velocity components (u,v) at the open boundaries are defined through the 
     673\nam{bdy_tide}{bdy\_tide} namelist parameters.\par 
    674674 
    675675The tidal harmonic data at open boundaries can be specified in two 
    676676different ways, either on a two-dimensional grid covering the entire 
    677677model domain or along open boundary segments; these two variants can 
    678 be selected by setting \np{ln_bdytide_2ddta }{ln\_bdytide\_2ddta } to \forcode{.true.} or 
    679 \forcode{.false.}, respectively. In either case, the real and 
    680 imaginary parts of SSH and the two barotropic velocity components for 
    681 each activated tidal constituent \textit{tcname} have to be provided 
    682 separately: when two-dimensional data is used, variables 
    683 \textit{tcname\_z1} and \textit{tcname\_z2} for real and imaginary SSH, 
    684 respectively, are expected in input file \np{filtide}{filtide} with suffix 
    685 \ifile{\_grid\_T}, variables \textit{tcname\_u1} and 
    686 \textit{tcname\_u2} for real and imaginary u, respectively, are 
    687 expected in input file \np{filtide}{filtide} with suffix \ifile{\_grid\_U}, and 
    688 \textit{tcname\_v1} and \textit{tcname\_v2} for real and imaginary v, 
    689 respectively, are expected in input file \np{filtide}{filtide} with suffix 
    690 \ifile{\_grid\_V}; when data along open boundary segments is used, 
    691 variables \textit{z1} and \textit{z2} (real and imaginary part of SSH) 
    692 are expected to be available from file \np{filtide}{filtide} with suffix 
    693 \ifile{tcname\_grid\_T}, variables \textit{u1} and \textit{u2} (real 
    694 and imaginary part of u) are expected to be available from file 
    695 \np{filtide}{filtide} with suffix \ifile{tcname\_grid\_U}, and variables 
    696 \textit{v1} and \textit{v2} (real and imaginary part of v) are 
    697 expected to be available from file \np{filtide}{filtide} with suffix 
    698 \ifile{tcname\_grid\_V}. If \np{ln_bdytide_conj}{ln\_bdytide\_conj} is set to 
    699 \forcode{.true.}, the data is expected to be in complex conjugate 
    700 form. 
     678be selected by setting \np[=.true.]{ln_bdytide_2ddta}{ln\_bdytide\_2ddta} or 
     679\np[=.false.]{ln_bdytide_2ddta}{ln\_bdytide\_2ddta}, respectively. In either 
     680case, the real and imaginary parts of SSH, u, and v amplitudes associated with 
     681each activated tidal constituent \texttt{<constituent>} have to be provided 
     682separately as fields in input files with names based on 
     683\np[=<input>]{filtide}{filtide}: when two-dimensional data is used, variables 
     684\texttt{<constituent>\_z1} and \texttt{<constituent>\_z2} for the real and imaginary parts of 
     685SSH, respectively, are expected to be available in file 
     686\ifile{<input>\_grid\_T}, variables \texttt{<constituent>\_u1} and 
     687\texttt{<constituent>\_u2} for the real and imaginary parts of u, respectively, in file 
     688\ifile{<input>\_grid\_U}, and \texttt{<constituent>\_v1} and 
     689\texttt{<constituent>\_v2} for the real and imaginary parts of v, respectively, in file 
     690\ifile{<input>\_grid\_V}; when data along open boundary segments is used, 
     691variables \texttt{z1} and \texttt{z2} (real and imaginary part of SSH) are 
     692expected to be available in file \ifile{<input><constituent>\_grid\_T}, 
     693variables \texttt{u1} and \texttt{u2} (real and imaginary part of u) in file 
     694\ifile{<input><constituent>\_grid\_U}, and variables \texttt{v1} and \texttt{v2} 
     695(real and imaginary part of v) in file 
     696\ifile{<input><constituent>\_grid\_V}.\par 
    701697 
    702698Note that the barotropic velocity components are assumed to be defined 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/doc/latex/NEMO/subfiles/chap_SBC.tex

    r13165 r14018  
    55\begin{document} 
    66 
    7 \chapter{Surface Boundary Condition (SBC, SAS, ISF, ICB)} 
     7\chapter{Surface Boundary Condition (SBC, SAS, ISF, ICB, TDE)} 
    88\label{chap:SBC} 
    99 
     
    1818    Release & Author(s) & Modifications \\ 
    1919    \hline 
     20    {\em  next} & {\em Simon M{\" u}ller} & {\em Update of \autoref{sec:SBC_TDE}}\\[2mm] 
    2021    {\em   4.0} & {\em ...} & {\em ...} \\ 
    2122    {\em   3.6} & {\em ...} & {\em ...} \\ 
     
    10131014 
    10141015%% ================================================================================================= 
    1015 \section[Surface tides (\textit{sbctide.F90})]{Surface tides (\protect\mdl{sbctide})} 
    1016 \label{sec:SBC_tide} 
     1016\section{Surface tides (TDE)} 
     1017\label{sec:SBC_TDE} 
    10171018 
    10181019\begin{listing} 
     
    10221023\end{listing} 
    10231024 
    1024 The tidal forcing, generated by the gravity forces of the Earth-Moon and Earth-Sun sytems, 
    1025 is activated if \np{ln_tide}{ln\_tide} and \np{ln_tide_pot}{ln\_tide\_pot} are both set to \forcode{.true.} in \nam{_tide}{\_tide}. 
    1026 This translates as an additional barotropic force in the momentum \autoref{eq:MB_PE_dyn} such that: 
     1025\subsection{Tidal constituents} 
     1026Ocean model component TDE provides the common functionality for tidal forcing 
     1027and tidal analysis in the model framework. This includes the computation of the gravitational 
     1028surface forcing, as well as support for lateral forcing at open boundaries (see 
     1029\autoref{subsec:LBC_bdy_tides}) and tidal harmonic analysis (see 
     1030\autoref{subsec:DIA_diamlr} and \autoref{subsec:DIA_diadetide}). The module is 
     1031activated with \np[=.true.]{ln_tide}{ln\_tide} in namelist 
     1032\nam{_tide}{\_tide}. It provides the same 34 tidal constituents that are 
     1033included in the 
     1034\href{https://www.aviso.altimetry.fr/en/data/products/auxiliary-products/global-tide-fes.html}{FES2014 
     1035  ocean tide model}: Mf, Mm, Ssa, Mtm, Msf, Msqm, Sa, K1, O1, P1, Q1, J1, S1, 
     1036M2, S2, N2, K2, nu2, mu2, 2N2, L2, T2, eps2, lam2, R2, M3, MKS2, MN4, MS4, M4, 
     1037N4, S4, M6, and M8; see file \hf{tide} and \mdl{tide\_mod} for further 
     1038information and references\footnote{As a legacy option \np{ln_tide_var} can be 
     1039  set to \forcode{0}, in which case the 19 tidal constituents (M2, N2, 2N2, S2, 
     1040  K2, K1, O1, Q1, P1, M4, Mf, Mm, Msqm, Mtm, S1, MU2, NU2, L2, and T2; see file 
     1041  \hf{tide}) and associated parameters that have been available in NEMO version 
     1042  4.0 and earlier are available}. Constituents to be included in the tidal forcing 
     1043(surface and lateral boundaries) are selected by enumerating their respective 
     1044names in namelist array \np{sn_tide_cnames}{sn\_tide\_cnames}.\par 
     1045 
     1046\subsection{Surface tidal forcing} 
     1047Surface tidal forcing can be represented in the model through an additional 
     1048barotropic force in the momentum equation (\autoref{eq:MB_PE_dyn}) such that: 
    10271049\[ 
    1028   % \label{eq:SBC_PE_dyn_tides} 
    1029   \frac{\partial {\mathrm {\mathbf U}}_h }{\partial t}= ... 
    1030   +g\nabla (\Pi_{eq} + \Pi_{sal}) 
     1050  \frac{\partial {\mathrm {\mathbf U}}_h }{\partial t} = \ldots +g\nabla (\gamma 
     1051  \Pi_{eq} + \Pi_{sal}) 
    10311052\] 
    1032 where $\Pi_{eq}$ stands for the equilibrium tidal forcing and 
    1033 $\Pi_{sal}$ is a self-attraction and loading term (SAL). 
    1034  
    1035 The equilibrium tidal forcing is expressed as a sum over a subset of 
    1036 constituents chosen from the set of available tidal constituents 
    1037 defined in file \hf{SBC/tide} (this comprises the tidal 
    1038 constituents \textit{M2, N2, 2N2, S2, K2, K1, O1, Q1, P1, M4, Mf, Mm, 
    1039   Msqm, Mtm, S1, MU2, NU2, L2}, and \textit{T2}). Individual 
    1040 constituents are selected by including their names in the array 
    1041 \np{clname}{clname} in \nam{_tide}{\_tide} (e.g., \np{clname}{clname}\forcode{(1)='M2', } 
    1042 \np{clname}{clname}\forcode{(2)='S2'} to select solely the tidal consituents \textit{M2} 
    1043 and \textit{S2}). Optionally, when \np{ln_tide_ramp}{ln\_tide\_ramp} is set to 
    1044 \forcode{.true.}, the equilibrium tidal forcing can be ramped up 
    1045 linearly from zero during the initial \np{rdttideramp}{rdttideramp} days of the 
    1046 model run. 
     1053where $\gamma \Pi_{eq}$ stands for the equilibrium tidal forcing scaled by a spatially 
     1054uniform tilt factor $\gamma$, and $\Pi_{sal}$ is an optional 
     1055self-attraction and loading term (SAL). These additional terms are enabled when, 
     1056in addition to \np[=.true.]{ln_tide}{ln\_tide}), 
     1057\np[=.true.]{ln_tide_pot}{ln\_tide\_pot}.\par 
     1058 
     1059The equilibrium tidal forcing is expressed as a sum over the subset of 
     1060constituents listed in \np{sn_tide_cnames}{sn\_tide\_cnames} of 
     1061\nam{_tide} (e.g., 
     1062\begin{forlines} 
     1063      sn_tide_cnames(1) = 'M2' 
     1064      sn_tide_cnames(2) = 'K1' 
     1065      sn_tide_cnames(3) = 'S2' 
     1066      sn_tide_cnames(4) = 'O1' 
     1067\end{forlines} 
     1068to select the four tidal constituents of strongest equilibrium tidal 
     1069potential). The tidal tilt factor $\gamma = 1 + k - h$ includes the 
     1070Love numbers $k$ and $h$ \citep{love_prsla1909}; this factor is 
     1071configurable using \np{rn_tide_gamma} (default value 0.7). Optionally, 
     1072when \np[=.true.]{ln_tide_ramp}{ln\_tide\_ramp}, the equilibrium tidal 
     1073forcing can be ramped up linearly from zero during the initial 
     1074\np{rn_tide_ramp_dt}{rn\_tide\_ramp\_dt} days of the model run.\par 
    10471075 
    10481076The SAL term should in principle be computed online as it depends on 
    10491077the model tidal prediction itself (see \citet{arbic.garner.ea_DSR04} for a 
    1050 discussion about the practical implementation of this term). 
    1051 Nevertheless, the complex calculations involved would make this 
    1052 computationally too expensive. Here, two options are available: 
    1053 $\Pi_{sal}$ generated by an external model can be read in 
    1054 (\np[=.true.]{ln_read_load}{ln\_read\_load}), or a ``scalar approximation'' can be 
    1055 used (\np[=.true.]{ln_scal_load}{ln\_scal\_load}). In the latter case 
     1078discussion about the practical implementation of this term). The complex 
     1079calculations involved in such computations, however, are computationally very 
     1080expensive. Here, two mutually exclusive simpler variants are available: 
     1081amplitudes generated by an external model for oscillatory $\Pi_{sal}$ 
     1082contributions from each of the selected tidal constituents can be read in 
     1083(\np[=.true.]{ln_read_load}{ln\_read\_load}) from the file specified in 
     1084\np{cn_tide_load}{cn\_tide\_load} (the variable names are comprised of the 
     1085tidal-constituent name and suffixes \forcode{_z1} and \forcode{_z2} for the two 
     1086orthogonal components, respectively); alternatively, a ``scalar approximation'' 
     1087can be used (\np[=.true.]{ln_scal_load}{ln\_scal\_load}), where 
    10561088\[ 
    10571089  \Pi_{sal} = \beta \eta, 
    10581090\] 
    1059 where $\beta$ (\np{rn_scal_load}{rn\_scal\_load} with a default value of 0.094) is a 
    1060 spatially constant scalar, often chosen to minimize tidal prediction 
    1061 errors. Setting both \np{ln_read_load}{ln\_read\_load} and \np{ln_scal_load}{ln\_scal\_load} to 
    1062 \forcode{.false.} removes the SAL contribution. 
     1091with a spatially uniform coefficient $\beta$, which can be configured 
     1092via \np{rn_scal_load}{rn\_scal\_load} (default value 0.094) and is 
     1093often tuned to minimize tidal prediction errors.\par 
     1094 
     1095For diagnostic purposes, the forcing potential of the individual tidal 
     1096constituents (incl. load ptential, if activated) and the total forcing 
     1097potential (incl. load potential, if activated) can be made available 
     1098as diagnostic output by setting 
     1099\np[=.true.]{ln_tide_dia}{ln\_tide\_dia} (fields 
     1100\forcode{tide_pot_<constituent>} and \forcode{tide_pot}).\par 
    10631101 
    10641102%% ================================================================================================= 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/doc/namelists/nam_tide

    r10075 r14018  
    33!----------------------------------------------------------------------- 
    44   ln_tide     = .false.      ! Activate tides 
    5       ln_tide_pot   = .true.                !  use tidal potential forcing 
     5      nn_tide_var   = 1          !  Variant of tidal parameter set and tide-potential computation 
     6      !                          !     (1: default; 0: compatibility with previous versions) 
     7      ln_tide_dia   = .false.    !  Enable tidal diagnostic output 
     8      ln_tide_pot   = .false.               !  use tidal potential forcing 
     9         rn_tide_gamma = 0.7                   ! Tidal tilt factor 
    610         ln_scal_load  = .false.               ! Use scalar approximation for 
    711            rn_scal_load = 0.094               !     load potential 
    812         ln_read_load  = .false.               ! Or read load potential from file 
    913            cn_tide_load = 'tide_LOAD_grid_T.nc'  ! filename for load potential 
    10             !       
     14            ! 
    1115      ln_tide_ramp  = .false.               !  Use linear ramp for tides at startup 
    12          rdttideramp   =    0.                 !  ramp duration in days 
    13       clname(1)    = 'DUMMY'               !  name of constituent - all tidal components must be set in namelist_cfg 
     16         rn_tide_ramp_dt = 0.               !  ramp duration in days 
     17      sn_tide_cnames(1) = 'DUMMY'               !  name of constituent - all tidal components must be set in namelist_cfg 
    1418/ 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/doc/namelists/nambdy_tide

    r10075 r14018  
    44   filtide          = 'bdydta/amm12_bdytide_'   !  file name root of tidal forcing files 
    55   ln_bdytide_2ddta = .false.                   ! 
    6    ln_bdytide_conj  = .false.                   !  
    76/ 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/src/ICE/icedia.F90

    r13286 r14018  
    261261         ! Write in numriw (if iter == nitrst) 
    262262         ! ------------------  
    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     ) 
     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    ) 
    268268         CALL iom_rstput( iter, nitrst, numriw, 'vol_loc_ini', vol_loc_ini ) 
    269269         CALL iom_rstput( iter, nitrst, numriw, 'tem_loc_ini', tem_loc_ini ) 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/src/ICE/icedyn_adv_pra.F90

    r13998 r14018  
    989989            DO jk = 1, nlay_s 
    990990               WRITE(zchar1,'(I2.2)') jk 
    991                znam = 'sxc0'//'_l'//zchar1  ;   CALL iom_get( numrir, jpdom_auto, znam , z3d, psgn = -1._wp )   ;   sxc0 (:,:,jk,:) = z3d(:,:,:) 
    992                znam = 'syc0'//'_l'//zchar1  ;   CALL iom_get( numrir, jpdom_auto, znam , z3d, psgn = -1._wp )   ;   syc0 (:,:,jk,:) = z3d(:,:,:) 
    993                znam = 'sxxc0'//'_l'//zchar1 ;   CALL iom_get( numrir, jpdom_auto, znam , z3d )   ;   sxxc0(:,:,jk,:) = z3d(:,:,:) 
    994                znam = 'syyc0'//'_l'//zchar1 ;   CALL iom_get( numrir, jpdom_auto, znam , z3d )   ;   syyc0(:,:,jk,:) = z3d(:,:,:) 
    995                znam = 'sxyc0'//'_l'//zchar1 ;   CALL iom_get( numrir, jpdom_auto, znam , z3d )   ;   sxyc0(:,:,jk,:) = z3d(:,:,:) 
     991               znam = 'sxc0'//'_l'//zchar1   
     992               CALL iom_get( numrir, jpdom_auto, znam , z3d, psgn = -1._wp )   ;   sxc0 (:,:,jk,:) = z3d(:,:,:) 
     993               znam = 'syc0'//'_l'//zchar1   
     994               CALL iom_get( numrir, jpdom_auto, znam , z3d, psgn = -1._wp )   ;   syc0 (:,:,jk,:) = z3d(:,:,:) 
     995               znam = 'sxxc0'//'_l'//zchar1  
     996               CALL iom_get( numrir, jpdom_auto, znam , z3d )   ;   sxxc0(:,:,jk,:) = z3d(:,:,:) 
     997               znam = 'syyc0'//'_l'//zchar1  
     998               CALL iom_get( numrir, jpdom_auto, znam , z3d )   ;   syyc0(:,:,jk,:) = z3d(:,:,:) 
     999               znam = 'sxyc0'//'_l'//zchar1  
     1000               CALL iom_get( numrir, jpdom_auto, znam , z3d )   ;   sxyc0(:,:,jk,:) = z3d(:,:,:) 
    9961001            END DO 
    9971002            !                                                        ! ice layers heat content 
    9981003            DO jk = 1, nlay_i 
    9991004               WRITE(zchar1,'(I2.2)') jk 
    1000                znam = 'sxe'//'_l'//zchar1   ;   CALL iom_get( numrir, jpdom_auto, znam , z3d, psgn = -1._wp )   ;   sxe (:,:,jk,:) = z3d(:,:,:) 
    1001                znam = 'sye'//'_l'//zchar1   ;   CALL iom_get( numrir, jpdom_auto, znam , z3d, psgn = -1._wp )   ;   sye (:,:,jk,:) = z3d(:,:,:) 
    1002                znam = 'sxxe'//'_l'//zchar1  ;   CALL iom_get( numrir, jpdom_auto, znam , z3d )   ;   sxxe(:,:,jk,:) = z3d(:,:,:) 
    1003                znam = 'syye'//'_l'//zchar1  ;   CALL iom_get( numrir, jpdom_auto, znam , z3d )   ;   syye(:,:,jk,:) = z3d(:,:,:) 
    1004                znam = 'sxye'//'_l'//zchar1  ;   CALL iom_get( numrir, jpdom_auto, znam , z3d )   ;   sxye(:,:,jk,:) = z3d(:,:,:) 
     1005               znam = 'sxe'//'_l'//zchar1    
     1006               CALL iom_get( numrir, jpdom_auto, znam , z3d, psgn = -1._wp )   ;   sxe (:,:,jk,:) = z3d(:,:,:) 
     1007               znam = 'sye'//'_l'//zchar1    
     1008               CALL iom_get( numrir, jpdom_auto, znam , z3d, psgn = -1._wp )   ;   sye (:,:,jk,:) = z3d(:,:,:) 
     1009               znam = 'sxxe'//'_l'//zchar1   
     1010               CALL iom_get( numrir, jpdom_auto, znam , z3d )   ;   sxxe(:,:,jk,:) = z3d(:,:,:) 
     1011               znam = 'syye'//'_l'//zchar1   
     1012               CALL iom_get( numrir, jpdom_auto, znam , z3d )   ;   syye(:,:,jk,:) = z3d(:,:,:) 
     1013               znam = 'sxye'//'_l'//zchar1   
     1014               CALL iom_get( numrir, jpdom_auto, znam , z3d )   ;   sxye(:,:,jk,:) = z3d(:,:,:) 
    10051015            END DO 
    10061016            ! 
     
    10671077         ! 
    10681078         !                                                           ! ice thickness 
    1069          CALL iom_rstput( iter, nitrst, numriw, 'sxice' , sxice  ) 
    1070          CALL iom_rstput( iter, nitrst, numriw, 'syice' , syice  ) 
    1071          CALL iom_rstput( iter, nitrst, numriw, 'sxxice', sxxice ) 
    1072          CALL iom_rstput( iter, nitrst, numriw, 'syyice', syyice ) 
    1073          CALL iom_rstput( iter, nitrst, numriw, 'sxyice', sxyice ) 
     1079         CALL iom_rstput( iter, nitrst, numriw, 'sxice' , sxice) 
     1080         CALL iom_rstput( iter, nitrst, numriw, 'syice' , syice) 
     1081         CALL iom_rstput( iter, nitrst, numriw, 'sxxice', sxxice) 
     1082         CALL iom_rstput( iter, nitrst, numriw, 'syyice', syyice) 
     1083         CALL iom_rstput( iter, nitrst, numriw, 'sxyice', sxyice) 
    10741084         !                                                           ! snow thickness 
    1075          CALL iom_rstput( iter, nitrst, numriw, 'sxsn'  , sxsn   ) 
    1076          CALL iom_rstput( iter, nitrst, numriw, 'sysn'  , sysn   ) 
    1077          CALL iom_rstput( iter, nitrst, numriw, 'sxxsn' , sxxsn  ) 
    1078          CALL iom_rstput( iter, nitrst, numriw, 'syysn' , syysn  ) 
    1079          CALL iom_rstput( iter, nitrst, numriw, 'sxysn' , sxysn  ) 
     1085         CALL iom_rstput( iter, nitrst, numriw, 'sxsn'  , sxsn ) 
     1086         CALL iom_rstput( iter, nitrst, numriw, 'sysn'  , sysn ) 
     1087         CALL iom_rstput( iter, nitrst, numriw, 'sxxsn' , sxxsn ) 
     1088         CALL iom_rstput( iter, nitrst, numriw, 'syysn' , syysn ) 
     1089         CALL iom_rstput( iter, nitrst, numriw, 'sxysn' , sxysn ) 
    10801090         !                                                           ! ice concentration 
    1081          CALL iom_rstput( iter, nitrst, numriw, 'sxa'   , sxa    ) 
    1082          CALL iom_rstput( iter, nitrst, numriw, 'sya'   , sya    ) 
    1083          CALL iom_rstput( iter, nitrst, numriw, 'sxxa'  , sxxa   ) 
    1084          CALL iom_rstput( iter, nitrst, numriw, 'syya'  , syya   ) 
    1085          CALL iom_rstput( iter, nitrst, numriw, 'sxya'  , sxya   ) 
     1091         CALL iom_rstput( iter, nitrst, numriw, 'sxa'   , sxa  ) 
     1092         CALL iom_rstput( iter, nitrst, numriw, 'sya'   , sya  ) 
     1093         CALL iom_rstput( iter, nitrst, numriw, 'sxxa'  , sxxa  ) 
     1094         CALL iom_rstput( iter, nitrst, numriw, 'syya'  , syya  ) 
     1095         CALL iom_rstput( iter, nitrst, numriw, 'sxya'  , sxya  ) 
    10861096         !                                                           ! ice salinity 
    1087          CALL iom_rstput( iter, nitrst, numriw, 'sxsal' , sxsal  ) 
    1088          CALL iom_rstput( iter, nitrst, numriw, 'sysal' , sysal  ) 
    1089          CALL iom_rstput( iter, nitrst, numriw, 'sxxsal', sxxsal ) 
    1090          CALL iom_rstput( iter, nitrst, numriw, 'syysal', syysal ) 
    1091          CALL iom_rstput( iter, nitrst, numriw, 'sxysal', sxysal ) 
     1097         CALL iom_rstput( iter, nitrst, numriw, 'sxsal' , sxsal) 
     1098         CALL iom_rstput( iter, nitrst, numriw, 'sysal' , sysal) 
     1099         CALL iom_rstput( iter, nitrst, numriw, 'sxxsal', sxxsal) 
     1100         CALL iom_rstput( iter, nitrst, numriw, 'syysal', syysal) 
     1101         CALL iom_rstput( iter, nitrst, numriw, 'sxysal', sxysal) 
    10921102         !                                                           ! ice age 
    1093          CALL iom_rstput( iter, nitrst, numriw, 'sxage' , sxage  ) 
    1094          CALL iom_rstput( iter, nitrst, numriw, 'syage' , syage  ) 
    1095          CALL iom_rstput( iter, nitrst, numriw, 'sxxage', sxxage ) 
    1096          CALL iom_rstput( iter, nitrst, numriw, 'syyage', syyage ) 
    1097          CALL iom_rstput( iter, nitrst, numriw, 'sxyage', sxyage ) 
     1103         CALL iom_rstput( iter, nitrst, numriw, 'sxage' , sxage) 
     1104         CALL iom_rstput( iter, nitrst, numriw, 'syage' , syage) 
     1105         CALL iom_rstput( iter, nitrst, numriw, 'sxxage', sxxage) 
     1106         CALL iom_rstput( iter, nitrst, numriw, 'syyage', syyage) 
     1107         CALL iom_rstput( iter, nitrst, numriw, 'sxyage', sxyage) 
    10981108         !                                                           ! snow layers heat content 
    10991109         DO jk = 1, nlay_s 
    11001110            WRITE(zchar1,'(I2.2)') jk 
    1101             znam = 'sxc0'//'_l'//zchar1  ;   z3d(:,:,:) = sxc0 (:,:,jk,:)  ;   CALL iom_rstput( iter, nitrst, numriw, znam , z3d ) 
    1102             znam = 'syc0'//'_l'//zchar1  ;   z3d(:,:,:) = syc0 (:,:,jk,:)  ;   CALL iom_rstput( iter, nitrst, numriw, znam , z3d ) 
    1103             znam = 'sxxc0'//'_l'//zchar1 ;   z3d(:,:,:) = sxxc0(:,:,jk,:)  ;   CALL iom_rstput( iter, nitrst, numriw, znam , z3d ) 
    1104             znam = 'syyc0'//'_l'//zchar1 ;   z3d(:,:,:) = syyc0(:,:,jk,:)  ;   CALL iom_rstput( iter, nitrst, numriw, znam , z3d ) 
    1105             znam = 'sxyc0'//'_l'//zchar1 ;   z3d(:,:,:) = sxyc0(:,:,jk,:)  ;   CALL iom_rstput( iter, nitrst, numriw, znam , z3d ) 
     1111            znam = 'sxc0'//'_l'//zchar1  ;   z3d(:,:,:) = sxc0 (:,:,jk,:) 
     1112            CALL iom_rstput( iter, nitrst, numriw, znam , z3d) 
     1113            znam = 'syc0'//'_l'//zchar1  ;   z3d(:,:,:) = syc0 (:,:,jk,:) 
     1114            CALL iom_rstput( iter, nitrst, numriw, znam , z3d) 
     1115            znam = 'sxxc0'//'_l'//zchar1 ;   z3d(:,:,:) = sxxc0(:,:,jk,:) 
     1116            CALL iom_rstput( iter, nitrst, numriw, znam , z3d) 
     1117            znam = 'syyc0'//'_l'//zchar1 ;   z3d(:,:,:) = syyc0(:,:,jk,:) 
     1118            CALL iom_rstput( iter, nitrst, numriw, znam , z3d) 
     1119            znam = 'sxyc0'//'_l'//zchar1 ;   z3d(:,:,:) = sxyc0(:,:,jk,:) 
     1120            CALL iom_rstput( iter, nitrst, numriw, znam , z3d) 
    11061121         END DO 
    11071122         !                                                           ! ice layers heat content 
    11081123         DO jk = 1, nlay_i 
    11091124            WRITE(zchar1,'(I2.2)') jk 
    1110             znam = 'sxe'//'_l'//zchar1   ;   z3d(:,:,:) = sxe (:,:,jk,:)   ;   CALL iom_rstput( iter, nitrst, numriw, znam , z3d ) 
    1111             znam = 'sye'//'_l'//zchar1   ;   z3d(:,:,:) = sye (:,:,jk,:)   ;   CALL iom_rstput( iter, nitrst, numriw, znam , z3d ) 
    1112             znam = 'sxxe'//'_l'//zchar1  ;   z3d(:,:,:) = sxxe(:,:,jk,:)   ;   CALL iom_rstput( iter, nitrst, numriw, znam , z3d ) 
    1113             znam = 'syye'//'_l'//zchar1  ;   z3d(:,:,:) = syye(:,:,jk,:)   ;   CALL iom_rstput( iter, nitrst, numriw, znam , z3d ) 
    1114             znam = 'sxye'//'_l'//zchar1  ;   z3d(:,:,:) = sxye(:,:,jk,:)   ;   CALL iom_rstput( iter, nitrst, numriw, znam , z3d ) 
     1125            znam = 'sxe'//'_l'//zchar1   ;   z3d(:,:,:) = sxe (:,:,jk,:) 
     1126            CALL iom_rstput( iter, nitrst, numriw, znam , z3d) 
     1127            znam = 'sye'//'_l'//zchar1   ;   z3d(:,:,:) = sye (:,:,jk,:) 
     1128            CALL iom_rstput( iter, nitrst, numriw, znam , z3d) 
     1129            znam = 'sxxe'//'_l'//zchar1  ;   z3d(:,:,:) = sxxe(:,:,jk,:) 
     1130            CALL iom_rstput( iter, nitrst, numriw, znam , z3d) 
     1131            znam = 'syye'//'_l'//zchar1  ;   z3d(:,:,:) = syye(:,:,jk,:) 
     1132            CALL iom_rstput( iter, nitrst, numriw, znam , z3d) 
     1133            znam = 'sxye'//'_l'//zchar1  ;   z3d(:,:,:) = sxye(:,:,jk,:) 
     1134            CALL iom_rstput( iter, nitrst, numriw, znam , z3d) 
    11151135         END DO 
    11161136         ! 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/src/ICE/icedyn_rhg_evp.F90

    r13998 r14018  
    10331033         iter = kt + nn_fsbc - 1             ! ice restarts are written at kt == nitrst - nn_fsbc + 1 
    10341034         ! 
    1035          CALL iom_rstput( iter, nitrst, numriw, 'stress1_i' , stress1_i  ) 
    1036          CALL iom_rstput( iter, nitrst, numriw, 'stress2_i' , stress2_i  ) 
     1035         CALL iom_rstput( iter, nitrst, numriw, 'stress1_i' , stress1_i ) 
     1036         CALL iom_rstput( iter, nitrst, numriw, 'stress2_i' , stress2_i ) 
    10371037         CALL iom_rstput( iter, nitrst, numriw, 'stress12_i', stress12_i ) 
    10381038         ! 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/src/ICE/icerst.F90

    r13998 r14018  
    5555      CHARACTER(len=50)   ::   clname   ! ice output restart file name 
    5656      CHARACTER(len=256)  ::   clpath   ! full path to ice output restart file  
     57      CHARACTER(LEN=52)   ::   clpname   ! ocean output restart file name including prefix for AGRIF 
    5758      !!---------------------------------------------------------------------- 
    5859      ! 
     
    8485            ENDIF 
    8586            ! 
    86             CALL iom_open( TRIM(clpath)//TRIM(clname), numriw, ldwrt = .TRUE., kdlev = jpl, cdcomp = 'ICE' ) 
     87            IF(.NOT.lwxios) THEN 
     88               CALL iom_open( TRIM(clpath)//TRIM(clname), numriw, ldwrt = .TRUE., kdlev = jpl, cdcomp = 'ICE' ) 
     89            ELSE 
     90#if defined key_iomput 
     91               cw_icerst_cxt = "rstwi_"//TRIM(ADJUSTL(clkt)) 
     92               IF( TRIM(Agrif_CFixed()) == '0' ) THEN 
     93                  clpname = clname 
     94               ELSE 
     95                  clpname = TRIM(Agrif_CFixed())//"_"//clname 
     96               ENDIF 
     97               numriw = iom_xios_setid(TRIM(clpath)//TRIM(clpname)) 
     98               CALL iom_init( cw_icerst_cxt, kdid = numriw, ld_closedef = .FALSE. ) 
     99               CALL iom_swap( cxios_context ) 
     100#else 
     101               clinfo = 'Can not use XIOS in rst_opn' 
     102               CALL ctl_stop(TRIM(clinfo)) 
     103#endif 
     104            ENDIF 
    87105            lrst_ice = .TRUE. 
    88106         ENDIF 
     
    117135         IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~~~'          
    118136      ENDIF 
    119  
     137       
    120138      ! Write in numriw (if iter == nitrst) 
    121139      ! ------------------  
     
    123141      CALL iom_rstput( iter, nitrst, numriw, 'nn_fsbc', REAL( nn_fsbc, wp ) )      ! time-step  
    124142      CALL iom_rstput( iter, nitrst, numriw, 'kt_ice' , REAL( iter   , wp ) )      ! date 
    125       CALL iom_delay_rst( 'WRITE', 'ICE', numriw )   ! save only ice delayed global communication variables 
     143       
     144      IF(.NOT.lwxios) CALL iom_delay_rst( 'WRITE', 'ICE', numriw )   ! save only ice delayed global communication variables 
    126145 
    127146      ! Prognostic variables 
     
    154173      IF( ln_cpl ) THEN 
    155174         CALL iom_rstput( iter, nitrst, numriw, 'cnd_ice', cnd_ice ) 
    156          CALL iom_rstput( iter, nitrst, numriw, 't1_ice' , t1_ice  ) 
     175         CALL iom_rstput( iter, nitrst, numriw, 't1_ice' , t1_ice ) 
    157176      ENDIF 
    158177      ! 
     
    161180      ! ------------------ 
    162181      IF( iter == nitrst ) THEN 
    163          CALL iom_close( numriw ) 
     182         IF(.NOT.lwxios) THEN 
     183            CALL iom_close( numriw ) 
     184         ELSE 
     185            CALL iom_context_finalize(      cw_icerst_cxt          ) 
     186            iom_file(numriw)%nfid       = 0 
     187            numriw = 0 
     188         ENDIF 
    164189         lrst_ice = .FALSE. 
    165190      ENDIF 
     
    181206      CHARACTER(len=2)  ::   zchar, zchar1 
    182207      REAL(wp)          ::   zfice, ziter 
     208      CHARACTER(lc)     ::   clpname 
    183209      REAL(wp), DIMENSION(jpi,jpj,jpl) ::   z3d   ! 3D workspace 
    184210      !!---------------------------------------------------------------------- 
     
    190216      ENDIF 
    191217 
     218      lxios_sini = .FALSE. 
    192219      CALL iom_open ( TRIM(cn_icerst_indir)//'/'//cn_icerst_in, numrir ) 
     220 
     221      IF( lrxios) THEN 
     222          cr_icerst_cxt = 'si3_rst' 
     223          IF(lwp) WRITE(numout,*) 'Enable restart reading by XIOS for SI3' 
     224!         IF( TRIM(Agrif_CFixed()) == '0' ) THEN 
     225!            clpname = cn_icerst_in 
     226!         ELSE 
     227!            clpname = TRIM(Agrif_CFixed())//"_"//cn_icerst_in    
     228!         ENDIF 
     229          CALL iom_init( cr_icerst_cxt, kdid = numrir, ld_closedef = .TRUE. ) 
     230      ENDIF 
    193231 
    194232      ! test if v_i exists  
     
    198236      IF( id0 > 0 ) THEN   ! == case of a normal restart == ! 
    199237         !                 ! ------------------------------ ! 
    200           
    201238         ! Time info 
    202239         CALL iom_get( numrir, 'nn_fsbc', zfice ) 
     
    278315         ENDIF 
    279316 
    280          CALL iom_delay_rst( 'READ', 'ICE', numrir )   ! read only ice delayed global communication variables 
    281  
     317         IF(.NOT.lrxios) CALL iom_delay_rst( 'READ', 'ICE', numrir )   ! read only ice delayed global communication variables 
    282318         !                 ! ---------------------------------- ! 
    283319      ELSE                 ! == case of a simplified restart == ! 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/src/ICE/icestp.F90

    r13998 r14018  
    291291      tn_ice(:,:,:) = t_su(:,:,:)      ! initialisation of surface temp for coupled simu 
    292292      ! 
    293       IF( ln_rstart )   CALL iom_close( numrir )  ! close input ice restart file 
     293      IF( ln_rstart )  THEN 
     294         CALL iom_close( numrir )  ! close input ice restart file 
     295         IF(lrxios) CALL iom_context_finalize(      cr_icerst_cxt         ) 
     296      ENDIF 
    294297      ! 
    295298   END SUBROUTINE ice_init 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/src/OCE/C1D/step_c1d.F90

    r13237 r14018  
    122122                        CALL dyn_atf    ( kstp, Nbb, Nnn, Naa , uu, vv, e3t, e3u, e3v )  ! time filtering of "now" fields 
    123123      IF(.NOT.ln_linssh)CALL ssh_atf    ( kstp, Nbb, Nnn, Naa , ssh )                    ! time filtering of "now" sea surface height 
     124      IF( kstp == nit000 .AND. ln_linssh) THEN 
     125         ssh(:,:,Naa) = ssh(:,:,Nnn)  ! init ssh after in ln_linssh case 
     126      ENDIF 
    124127      ! 
    125128      ! Swap time levels 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/src/OCE/DIA/diahsb.F90

    r13286 r14018  
    267267            IF(lwp) WRITE(numout,*) '   dia_hsb_rst : read hsb restart at it= ', kt,' date= ', ndastp 
    268268            IF(lwp) WRITE(numout,*) 
    269             CALL iom_get( numror, 'frc_v', frc_v, ldxios = lrxios ) 
    270             CALL iom_get( numror, 'frc_t', frc_t, ldxios = lrxios ) 
    271             CALL iom_get( numror, 'frc_s', frc_s, ldxios = lrxios ) 
     269            CALL iom_get( numror, 'frc_v', frc_v ) 
     270            CALL iom_get( numror, 'frc_t', frc_t ) 
     271            CALL iom_get( numror, 'frc_s', frc_s ) 
    272272            IF( ln_linssh ) THEN 
    273                CALL iom_get( numror, 'frc_wn_t', frc_wn_t, ldxios = lrxios ) 
    274                CALL iom_get( numror, 'frc_wn_s', frc_wn_s, ldxios = lrxios ) 
     273               CALL iom_get( numror, 'frc_wn_t', frc_wn_t ) 
     274               CALL iom_get( numror, 'frc_wn_s', frc_wn_s ) 
    275275            ENDIF 
    276             CALL iom_get( numror, jpdom_auto, 'surf_ini'  , surf_ini  , ldxios = lrxios ) ! ice sheet coupling 
    277             CALL iom_get( numror, jpdom_auto, 'ssh_ini'   , ssh_ini   , ldxios = lrxios ) 
    278             CALL iom_get( numror, jpdom_auto, 'e3t_ini'   , e3t_ini   , ldxios = lrxios ) 
    279             CALL iom_get( numror, jpdom_auto, 'tmask_ini' , tmask_ini , ldxios = lrxios ) 
    280             CALL iom_get( numror, jpdom_auto, 'hc_loc_ini', hc_loc_ini, ldxios = lrxios ) 
    281             CALL iom_get( numror, jpdom_auto, 'sc_loc_ini', sc_loc_ini, ldxios = lrxios ) 
     276            CALL iom_get( numror, jpdom_auto, 'surf_ini'  , surf_ini  ) ! ice sheet coupling 
     277            CALL iom_get( numror, jpdom_auto, 'ssh_ini'   , ssh_ini    ) 
     278            CALL iom_get( numror, jpdom_auto, 'e3t_ini'   , e3t_ini    ) 
     279            CALL iom_get( numror, jpdom_auto, 'tmask_ini' , tmask_ini ) 
     280            CALL iom_get( numror, jpdom_auto, 'hc_loc_ini', hc_loc_ini ) 
     281            CALL iom_get( numror, jpdom_auto, 'sc_loc_ini', sc_loc_ini ) 
    282282            IF( ln_linssh ) THEN 
    283                CALL iom_get( numror, jpdom_auto, 'ssh_hc_loc_ini', ssh_hc_loc_ini, ldxios = lrxios ) 
    284                CALL iom_get( numror, jpdom_auto, 'ssh_sc_loc_ini', ssh_sc_loc_ini, ldxios = lrxios ) 
     283               CALL iom_get( numror, jpdom_auto, 'ssh_hc_loc_ini', ssh_hc_loc_ini ) 
     284               CALL iom_get( numror, jpdom_auto, 'ssh_sc_loc_ini', ssh_sc_loc_ini ) 
    285285            ENDIF 
    286286         ELSE 
     
    323323         IF(lwp) WRITE(numout,*) 
    324324         ! 
    325          IF( lwxios ) CALL iom_swap(      cwxios_context          ) 
    326          CALL iom_rstput( kt, nitrst, numrow, 'frc_v', frc_v, ldxios = lwxios ) 
    327          CALL iom_rstput( kt, nitrst, numrow, 'frc_t', frc_t, ldxios = lwxios ) 
    328          CALL iom_rstput( kt, nitrst, numrow, 'frc_s', frc_s, ldxios = lwxios ) 
     325         CALL iom_rstput( kt, nitrst, numrow, 'frc_v', frc_v ) 
     326         CALL iom_rstput( kt, nitrst, numrow, 'frc_t', frc_t ) 
     327         CALL iom_rstput( kt, nitrst, numrow, 'frc_s', frc_s ) 
    329328         IF( ln_linssh ) THEN 
    330             CALL iom_rstput( kt, nitrst, numrow, 'frc_wn_t', frc_wn_t, ldxios = lwxios ) 
    331             CALL iom_rstput( kt, nitrst, numrow, 'frc_wn_s', frc_wn_s, ldxios = lwxios ) 
     329            CALL iom_rstput( kt, nitrst, numrow, 'frc_wn_t', frc_wn_t ) 
     330            CALL iom_rstput( kt, nitrst, numrow, 'frc_wn_s', frc_wn_s ) 
    332331         ENDIF 
    333          CALL iom_rstput( kt, nitrst, numrow, 'surf_ini'  , surf_ini  , ldxios = lwxios )      ! ice sheet coupling 
    334          CALL iom_rstput( kt, nitrst, numrow, 'ssh_ini'   , ssh_ini   , ldxios = lwxios ) 
    335          CALL iom_rstput( kt, nitrst, numrow, 'e3t_ini'   , e3t_ini   , ldxios = lwxios ) 
    336          CALL iom_rstput( kt, nitrst, numrow, 'tmask_ini' , tmask_ini , ldxios = lwxios ) 
    337          CALL iom_rstput( kt, nitrst, numrow, 'hc_loc_ini', hc_loc_ini, ldxios = lwxios ) 
    338          CALL iom_rstput( kt, nitrst, numrow, 'sc_loc_ini', sc_loc_ini, ldxios = lwxios ) 
     332         CALL iom_rstput( kt, nitrst, numrow, 'surf_ini'  , surf_ini  )      ! ice sheet coupling 
     333         CALL iom_rstput( kt, nitrst, numrow, 'ssh_ini'   , ssh_ini    ) 
     334         CALL iom_rstput( kt, nitrst, numrow, 'e3t_ini'   , e3t_ini    ) 
     335         CALL iom_rstput( kt, nitrst, numrow, 'tmask_ini' , tmask_ini ) 
     336         CALL iom_rstput( kt, nitrst, numrow, 'hc_loc_ini', hc_loc_ini ) 
     337         CALL iom_rstput( kt, nitrst, numrow, 'sc_loc_ini', sc_loc_ini ) 
    339338         IF( ln_linssh ) THEN 
    340             CALL iom_rstput( kt, nitrst, numrow, 'ssh_hc_loc_ini', ssh_hc_loc_ini, ldxios = lwxios ) 
    341             CALL iom_rstput( kt, nitrst, numrow, 'ssh_sc_loc_ini', ssh_sc_loc_ini, ldxios = lwxios ) 
     339            CALL iom_rstput( kt, nitrst, numrow, 'ssh_hc_loc_ini', ssh_hc_loc_ini ) 
     340            CALL iom_rstput( kt, nitrst, numrow, 'ssh_sc_loc_ini', ssh_sc_loc_ini ) 
    342341         ENDIF 
    343          IF( lwxios ) CALL iom_swap(      cxios_context          ) 
    344342         ! 
    345343      ENDIF 
     
    385383      IF( .NOT. ln_diahsb )   RETURN 
    386384 
    387       IF(lwxios) THEN 
    388 ! define variables in restart file when writing with XIOS 
    389         CALL iom_set_rstw_var_active('frc_v') 
    390         CALL iom_set_rstw_var_active('frc_t') 
    391         CALL iom_set_rstw_var_active('frc_s') 
    392         CALL iom_set_rstw_var_active('surf_ini') 
    393         CALL iom_set_rstw_var_active('ssh_ini') 
    394         CALL iom_set_rstw_var_active('e3t_ini') 
    395         CALL iom_set_rstw_var_active('hc_loc_ini') 
    396         CALL iom_set_rstw_var_active('sc_loc_ini') 
    397         IF( ln_linssh ) THEN 
    398            CALL iom_set_rstw_var_active('ssh_hc_loc_ini') 
    399            CALL iom_set_rstw_var_active('ssh_sc_loc_ini') 
    400            CALL iom_set_rstw_var_active('frc_wn_t') 
    401            CALL iom_set_rstw_var_active('frc_wn_s') 
    402         ENDIF 
    403       ENDIF 
    404385      ! ------------------- ! 
    405386      ! 1 - Allocate memory ! 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/src/OCE/DOM/daymod.F90

    r13998 r14018  
    149149      CALL day( nit000 ) 
    150150      ! 
    151       IF( lwxios ) THEN 
    152 ! define variables in restart file when writing with XIOS 
    153           CALL iom_set_rstw_var_active('kt') 
    154           CALL iom_set_rstw_var_active('ndastp') 
    155           CALL iom_set_rstw_var_active('adatrj') 
    156           CALL iom_set_rstw_var_active('ntime') 
    157       ENDIF 
    158  
    159151   END SUBROUTINE day_init 
    160152 
     
    324316 
    325317      IF( TRIM(cdrw) == 'READ' ) THEN 
    326  
    327318         IF( iom_varid( numror, 'kt', ldstop = .FALSE. ) > 0 ) THEN 
    328319            ! Get Calendar informations 
    329             CALL iom_get( numror, 'kt', zkt, ldxios = lrxios )   ! last time-step of previous run 
     320            CALL iom_get( numror, 'kt', zkt )   ! last time-step of previous run 
    330321            IF(lwp) THEN 
    331322               WRITE(numout,*) ' *** Info read in restart : ' 
     
    346337            IF ( nrstdt == 2 ) THEN 
    347338               ! read the parameters corresponding to nit000 - 1 (last time step of previous run) 
    348                CALL iom_get( numror, 'ndastp', zndastp, ldxios = lrxios ) 
     339               CALL iom_get( numror, 'ndastp', zndastp ) 
    349340               ndastp = NINT( zndastp ) 
    350                CALL iom_get( numror, 'adatrj', adatrj , ldxios = lrxios ) 
    351           CALL iom_get( numror, 'ntime' , ktime  , ldxios = lrxios ) 
     341               CALL iom_get( numror, 'adatrj', adatrj ) 
     342          CALL iom_get( numror, 'ntime' , ktime  ) 
    352343               nn_time0 = NINT(ktime) 
    353344               ! calculate start time in hours and minutes 
     
    410401         ENDIF 
    411402         ! calendar control 
    412          IF( lwxios ) CALL iom_swap(      cwxios_context          ) 
    413          CALL iom_rstput( kt, nitrst, numrow, 'kt'     , REAL( kt    , wp)  , ldxios = lwxios )   ! time-step 
    414          CALL iom_rstput( kt, nitrst, numrow, 'ndastp' , REAL( ndastp, wp)  , ldxios = lwxios )   ! date 
    415          CALL iom_rstput( kt, nitrst, numrow, 'adatrj' , adatrj             , ldxios = lwxios            )   ! number of elapsed days since 
     403         CALL iom_rstput( kt, nitrst, numrow, 'kt'     , REAL( kt    , wp)   )   ! time-step 
     404         CALL iom_rstput( kt, nitrst, numrow, 'ndastp' , REAL( ndastp, wp)   )   ! date 
     405         CALL iom_rstput( kt, nitrst, numrow, 'adatrj' , adatrj              )   ! number of elapsed days since 
    416406         !                                                                                                   ! the begining of the run [s] 
    417          CALL iom_rstput( kt, nitrst, numrow, 'ntime'  , REAL( nn_time0, wp), ldxios = lwxios ) ! time 
    418          IF( lwxios ) CALL iom_swap(      cxios_context          ) 
     407         CALL iom_rstput( kt, nitrst, numrow, 'ntime'  , REAL( nn_time0, wp) ) ! time 
    419408      ENDIF 
    420409      ! 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/src/OCE/DOM/domain.F90

    r13998 r14018  
    6767CONTAINS 
    6868 
    69    SUBROUTINE dom_init( Kbb, Kmm, Kaa, cdstr ) 
     69   SUBROUTINE dom_init( Kbb, Kmm, Kaa ) 
    7070      !!---------------------------------------------------------------------- 
    7171      !!                  ***  ROUTINE dom_init  *** 
     
    8383      !!---------------------------------------------------------------------- 
    8484      INTEGER          , INTENT(in) :: Kbb, Kmm, Kaa          ! ocean time level indices 
    85       CHARACTER (len=*), INTENT(in) :: cdstr                  ! model: NEMO or SAS. Determines core restart variables 
    8685      ! 
    8786      INTEGER ::   ji, jj, jk, jt   ! dummy loop indices 
     
    129128      !           !==  Reference coordinate system  ==! 
    130129      ! 
    131       CALL dom_glo                     ! global domain versus local domain 
    132       CALL dom_nam( cdstr )                     ! read namelist ( namrun, namdom ) 
     130      CALL dom_glo                      ! global domain versus local domain 
     131      CALL dom_nam                      ! read namelist ( namrun, namdom ) 
    133132      ! 
    134133      CALL dom_hgr                      ! Horizontal mesh 
     
    175174      ! 
    176175      !                                 != ssh initialization 
    177       IF( cdstr /= 'SAS' ) THEN 
     176      IF( .NOT.l_offline .AND. .NOT.l_SAS ) THEN 
    178177         CALL ssh_init_rst( Kbb, Kmm, Kaa ) 
     178      ELSE 
     179         ssh(:,:,:) = 0._wp 
    179180      ENDIF 
    180181      ! 
     
    296297 
    297298 
    298    SUBROUTINE dom_nam( cdstr ) 
     299   SUBROUTINE dom_nam 
    299300      !!---------------------------------------------------------------------- 
    300301      !!                     ***  ROUTINE dom_nam  *** 
     
    308309      USE ioipsl 
    309310      !! 
    310       CHARACTER (len=*), INTENT(in) ::   cdstr   ! model: NEMO or SAS. Determines core restart variables 
    311       ! 
    312311      INTEGER ::   ios   ! Local integer 
    313312      REAL(wp)::   zrdt 
     
    360359      rDt   = 2._wp * rn_Dt 
    361360      r1_Dt = 1._wp / rDt 
     361      ! 
     362      IF( l_SAS .AND. .NOT.ln_linssh ) THEN 
     363         CALL ctl_warn( 'SAS requires linear ssh : force ln_linssh = T' ) 
     364         ln_linssh = .TRUE. 
     365      ENDIF 
    362366      ! 
    363367#if defined key_qco 
     
    429433      ! 
    430434      !                                        !==  Set parameters for restart reading using xIOS  ==! 
    431       lwxios = .FALSE. 
    432435      ! 
    433436      IF( TRIM(Agrif_CFixed()) == '0' ) THEN 
     
    436439         nxioso = nn_wxios 
    437440      ENDIF 
    438       ! 
    439       IF( lwxios ) THEN                                 !*  define names for restart write and set core output (restart.F90) 
    440          CALL iom_set_rst_vars ( rst_wfields ) 
    441          CALL iom_set_rstw_core( cdstr ) 
    442       ENDIF 
    443       ! 
    444       IF( cdstr == 'SAS' ) THEN                         !*  reset namelist for SAS 
    445          IF( lrxios ) THEN 
    446             IF(lwp) WRITE(numout,*) 'Disable reading restart file using XIOS for SAS' 
    447             lrxios = .FALSE. 
    448          ENDIF 
    449       ENDIF 
    450       ! 
    451441      !                                        !==  Check consistency between ln_rstart and ln_1st_euler  ==!   (i.e. set l_1st_euler) 
    452442      l_1st_euler = ln_1st_euler 
     
    459449         ! 
    460450         IF( iom_varid( numror, 'rdt', ldstop = .FALSE. ) > 0 ) THEN     !- Check time-step consistency and force Euler restart if changed 
    461             CALL iom_get( numror, 'rdt', zrdt, ldxios = lrxios ) 
     451            CALL iom_get( numror, 'rdt', zrdt ) 
    462452            IF( zrdt /= rn_Dt ) THEN 
    463453               IF(lwp) WRITE( numout,*) 
     
    469459         ENDIF 
    470460         ! 
    471          IF( iom_varid( numror, 'sshb', ldstop = .FALSE. ) <= 0 ) THEN   !- Check absence of one of the Kbb field (here sshb) 
    472             !                                                            !  (any Kbb field is missing ==> all Kbb fields are missing)  
     461         IF( .NOT.l_SAS .AND. iom_varid( numror, 'sshb', ldstop = .FALSE. ) <= 0 ) THEN   !- Check absence of one of the Kbb field (here sshb) 
     462            !                                                                             !  (any Kbb field is missing ==> all Kbb fields are missing)  
    473463            IF( .NOT.l_1st_euler ) THEN 
    474464               CALL ctl_warn('dom_nam : ssh at Kbb not found in restart files ',   & 
     
    484474         l_1st_euler = .TRUE. 
    485475      ENDIF 
    486        
    487476      ! 
    488477      !                                        !==  control of output frequency  ==! 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/src/OCE/DOM/domqco.F90

    r13874 r14018  
    9595      r3v(:,:,Kaa) = r3v(:,:,Kmm) 
    9696#endif 
    97       ! 
    98       IF(lwxios) THEN   ! define variables in restart file when writing with XIOS 
    99          CALL iom_set_rstw_var_active('sshb') 
    100          CALL iom_set_rstw_var_active('sshn') 
    101       ENDIF 
    10297      ! 
    10398   END SUBROUTINE dom_qco_init 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/src/OCE/DOM/domvvl.F90

    r13998 r14018  
    282282      ENDIF 
    283283      ! 
    284       IF(lwxios) THEN 
    285 ! define variables in restart file when writing with XIOS 
    286          CALL iom_set_rstw_var_active('e3t_b') 
    287          CALL iom_set_rstw_var_active('e3t_n') 
    288          !                                           ! ----------------------- ! 
    289          IF( ln_vvl_ztilde .OR. ln_vvl_layer ) THEN  ! z_tilde and layer cases ! 
    290             !                                        ! ----------------------- ! 
    291             CALL iom_set_rstw_var_active('tilde_e3t_b') 
    292             CALL iom_set_rstw_var_active('tilde_e3t_n') 
    293          END IF 
    294          !                                           ! -------------!     
    295          IF( ln_vvl_ztilde ) THEN                    ! z_tilde case ! 
    296             !                                        ! ------------ ! 
    297             CALL iom_set_rstw_var_active('hdiv_lf') 
    298          ENDIF 
    299          ! 
    300       ENDIF 
    301       ! 
    302284   END SUBROUTINE dom_vvl_zgr 
    303285 
     
    825807            !                                                           !*  scale factors 
    826808            IF(lwp) WRITE(numout,*)    '          Kmm scale factor read in the restart file' 
    827             CALL iom_get( numror, jpdom_auto, 'e3t_n', e3t(:,:,:,Kmm), ldxios = lrxios ) 
     809            CALL iom_get( numror, jpdom_auto, 'e3t_n', e3t(:,:,:,Kmm) ) 
    828810            WHERE ( tmask(:,:,:) == 0.0_wp )  
    829811               e3t(:,:,:,Kmm) = e3t_0(:,:,:) 
     
    834816            ELSE                                         ! leap frog 
    835817               IF(lwp) WRITE(numout,*) '          Kbb scale factor read in the restart file' 
    836                CALL iom_get( numror, jpdom_auto, 'e3t_b', e3t(:,:,:,Kbb), ldxios = lrxios ) 
     818               CALL iom_get( numror, jpdom_auto, 'e3t_b', e3t(:,:,:,Kbb) ) 
    837819               WHERE ( tmask(:,:,:) == 0.0_wp )  
    838820                  e3t(:,:,:,Kbb) = e3t_0(:,:,:) 
     
    851833               IF( id4 > 0 ) THEN                                       !*  scale factor increments 
    852834                  IF(lwp) WRITE(numout,*)    '          Kmm scale factor increments read in the restart file' 
    853                   CALL iom_get( numror, jpdom_auto, 'tilde_e3t_n', tilde_e3t_n(:,:,:), ldxios = lrxios ) 
     835                  CALL iom_get( numror, jpdom_auto, 'tilde_e3t_n', tilde_e3t_n(:,:,:) ) 
    854836                  IF( l_1st_euler ) THEN                 ! euler 
    855837                     IF(lwp) WRITE(numout,*) '          Euler first time step : tilde_e3t(Kbb) = tilde_e3t(Kmm)' 
     
    857839                  ELSE                                   ! leap frog 
    858840                     IF(lwp) WRITE(numout,*) '          Kbb scale factor increments read in the restart file' 
    859                      CALL iom_get( numror, jpdom_auto, 'tilde_e3t_b', tilde_e3t_b(:,:,:), ldxios = lrxios ) 
     841                     CALL iom_get( numror, jpdom_auto, 'tilde_e3t_b', tilde_e3t_b(:,:,:) ) 
    860842                  ENDIF 
    861843               ELSE  
     
    867849                  !                                   ! ------------ ! 
    868850                  IF( id5 > 0 ) THEN  ! required array exists 
    869                      CALL iom_get( numror, jpdom_auto, 'hdiv_lf', hdiv_lf(:,:,:), ldxios = lrxios ) 
     851                     CALL iom_get( numror, jpdom_auto, 'hdiv_lf', hdiv_lf(:,:,:) ) 
    870852                  ELSE                ! array is missing 
    871853                     hdiv_lf(:,:,:) = 0.0_wp  
     
    892874         ! 
    893875         IF(lwp) WRITE(numout,*) '---- dom_vvl_rst ----' 
    894          IF( lwxios ) CALL iom_swap(      cwxios_context          ) 
    895876         !                                           ! --------- ! 
    896877         !                                           ! all cases ! 
    897878         !                                           ! --------- ! 
    898          CALL iom_rstput( kt, nitrst, numrow, 'e3t_b', e3t(:,:,:,Kbb), ldxios = lwxios ) 
    899          CALL iom_rstput( kt, nitrst, numrow, 'e3t_n', e3t(:,:,:,Kmm), ldxios = lwxios ) 
     879         CALL iom_rstput( kt, nitrst, numrow, 'e3t_b', e3t(:,:,:,Kbb) ) 
     880         CALL iom_rstput( kt, nitrst, numrow, 'e3t_n', e3t(:,:,:,Kmm) ) 
    900881         !                                           ! ----------------------- ! 
    901882         IF( ln_vvl_ztilde .OR. ln_vvl_layer ) THEN  ! z_tilde and layer cases ! 
    902883            !                                        ! ----------------------- ! 
    903             CALL iom_rstput( kt, nitrst, numrow, 'tilde_e3t_b', tilde_e3t_b(:,:,:), ldxios = lwxios) 
    904             CALL iom_rstput( kt, nitrst, numrow, 'tilde_e3t_n', tilde_e3t_n(:,:,:), ldxios = lwxios) 
     884            CALL iom_rstput( kt, nitrst, numrow, 'tilde_e3t_b', tilde_e3t_b(:,:,:)) 
     885            CALL iom_rstput( kt, nitrst, numrow, 'tilde_e3t_n', tilde_e3t_n(:,:,:)) 
    905886         END IF 
    906887         !                                           ! -------------!     
    907888         IF( ln_vvl_ztilde ) THEN                    ! z_tilde case ! 
    908889            !                                        ! ------------ ! 
    909             CALL iom_rstput( kt, nitrst, numrow, 'hdiv_lf', hdiv_lf(:,:,:), ldxios = lwxios) 
     890            CALL iom_rstput( kt, nitrst, numrow, 'hdiv_lf', hdiv_lf(:,:,:)) 
    910891         ENDIF 
    911892         ! 
    912          IF( lwxios ) CALL iom_swap(      cxios_context          ) 
    913893      ENDIF 
    914894      ! 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/src/OCE/DYN/dynspg_ts.F90

    r13998 r14018  
    933933         !                                   ! --------------- 
    934934         IF( ln_rstart .AND. ln_bt_fw .AND. .NOT.l_1st_euler ) THEN    !* Read the restart file 
    935             CALL iom_get( numror, jpdom_auto, 'ub2_b'  , ub2_b  (:,:), cd_type = 'U', psgn = -1._wp, ldxios = lrxios )    
    936             CALL iom_get( numror, jpdom_auto, 'vb2_b'  , vb2_b  (:,:), cd_type = 'V', psgn = -1._wp, ldxios = lrxios )  
    937             CALL iom_get( numror, jpdom_auto, 'un_bf'  , un_bf  (:,:), cd_type = 'U', psgn = -1._wp, ldxios = lrxios )    
    938             CALL iom_get( numror, jpdom_auto, 'vn_bf'  , vn_bf  (:,:), cd_type = 'V', psgn = -1._wp, ldxios = lrxios )  
     935            CALL iom_get( numror, jpdom_auto, 'ub2_b'  , ub2_b  (:,:), cd_type = 'U', psgn = -1._wp )    
     936            CALL iom_get( numror, jpdom_auto, 'vb2_b'  , vb2_b  (:,:), cd_type = 'V', psgn = -1._wp )  
     937            CALL iom_get( numror, jpdom_auto, 'un_bf'  , un_bf  (:,:), cd_type = 'U', psgn = -1._wp )    
     938            CALL iom_get( numror, jpdom_auto, 'vn_bf'  , vn_bf  (:,:), cd_type = 'V', psgn = -1._wp )  
    939939            IF( .NOT.ln_bt_av ) THEN 
    940                CALL iom_get( numror, jpdom_auto, 'sshbb_e'  , sshbb_e(:,:), cd_type = 'T', psgn =  1._wp, ldxios = lrxios )    
    941                CALL iom_get( numror, jpdom_auto, 'ubb_e'    ,   ubb_e(:,:), cd_type = 'U', psgn = -1._wp, ldxios = lrxios )    
    942                CALL iom_get( numror, jpdom_auto, 'vbb_e'    ,   vbb_e(:,:), cd_type = 'V', psgn = -1._wp, ldxios = lrxios ) 
    943                CALL iom_get( numror, jpdom_auto, 'sshb_e'   ,  sshb_e(:,:), cd_type = 'T', psgn =  1._wp, ldxios = lrxios )  
    944                CALL iom_get( numror, jpdom_auto, 'ub_e'     ,    ub_e(:,:), cd_type = 'U', psgn = -1._wp, ldxios = lrxios )    
    945                CALL iom_get( numror, jpdom_auto, 'vb_e'     ,    vb_e(:,:), cd_type = 'V', psgn = -1._wp, ldxios = lrxios ) 
     940               CALL iom_get( numror, jpdom_auto, 'sshbb_e'  , sshbb_e(:,:), cd_type = 'T', psgn =  1._wp )    
     941               CALL iom_get( numror, jpdom_auto, 'ubb_e'    ,   ubb_e(:,:), cd_type = 'U', psgn = -1._wp )    
     942               CALL iom_get( numror, jpdom_auto, 'vbb_e'    ,   vbb_e(:,:), cd_type = 'V', psgn = -1._wp ) 
     943               CALL iom_get( numror, jpdom_auto, 'sshb_e'   ,  sshb_e(:,:), cd_type = 'T', psgn =  1._wp )  
     944               CALL iom_get( numror, jpdom_auto, 'ub_e'     ,    ub_e(:,:), cd_type = 'U', psgn = -1._wp )    
     945               CALL iom_get( numror, jpdom_auto, 'vb_e'     ,    vb_e(:,:), cd_type = 'V', psgn = -1._wp ) 
    946946            ENDIF 
    947947#if defined key_agrif 
    948948            ! Read time integrated fluxes 
    949949            IF ( .NOT.Agrif_Root() ) THEN 
    950                CALL iom_get( numror, jpdom_auto, 'ub2_i_b'  , ub2_i_b(:,:), cd_type = 'U', psgn = -1._wp, ldxios = lrxios )    
    951                CALL iom_get( numror, jpdom_auto, 'vb2_i_b'  , vb2_i_b(:,:), cd_type = 'V', psgn = -1._wp, ldxios = lrxios ) 
     950               CALL iom_get( numror, jpdom_auto, 'ub2_i_b'  , ub2_i_b(:,:), cd_type = 'U', psgn = -1._wp )    
     951               CALL iom_get( numror, jpdom_auto, 'vb2_i_b'  , vb2_i_b(:,:), cd_type = 'V', psgn = -1._wp ) 
    952952            ELSE 
    953953               ub2_i_b(:,:) = 0._wp   ;   vb2_i_b(:,:) = 0._wp   ! used in the 1st update of agrif 
     
    968968         !                                   ! ------------------- 
    969969         IF(lwp) WRITE(numout,*) '---- ts_rst ----' 
    970          IF( lwxios ) CALL iom_swap(      cwxios_context          ) 
    971          CALL iom_rstput( kt, nitrst, numrow, 'ub2_b'   , ub2_b  (:,:), ldxios = lwxios ) 
    972          CALL iom_rstput( kt, nitrst, numrow, 'vb2_b'   , vb2_b  (:,:), ldxios = lwxios ) 
    973          CALL iom_rstput( kt, nitrst, numrow, 'un_bf'   , un_bf  (:,:), ldxios = lwxios ) 
    974          CALL iom_rstput( kt, nitrst, numrow, 'vn_bf'   , vn_bf  (:,:), ldxios = lwxios ) 
     970         CALL iom_rstput( kt, nitrst, numrow, 'ub2_b'   , ub2_b  (:,:) ) 
     971         CALL iom_rstput( kt, nitrst, numrow, 'vb2_b'   , vb2_b  (:,:) ) 
     972         CALL iom_rstput( kt, nitrst, numrow, 'un_bf'   , un_bf  (:,:) ) 
     973         CALL iom_rstput( kt, nitrst, numrow, 'vn_bf'   , vn_bf  (:,:) ) 
    975974         ! 
    976975         IF (.NOT.ln_bt_av) THEN 
    977             CALL iom_rstput( kt, nitrst, numrow, 'sshbb_e'  , sshbb_e(:,:), ldxios = lwxios )  
    978             CALL iom_rstput( kt, nitrst, numrow, 'ubb_e'    ,   ubb_e(:,:), ldxios = lwxios ) 
    979             CALL iom_rstput( kt, nitrst, numrow, 'vbb_e'    ,   vbb_e(:,:), ldxios = lwxios ) 
    980             CALL iom_rstput( kt, nitrst, numrow, 'sshb_e'   ,  sshb_e(:,:), ldxios = lwxios ) 
    981             CALL iom_rstput( kt, nitrst, numrow, 'ub_e'     ,    ub_e(:,:), ldxios = lwxios ) 
    982             CALL iom_rstput( kt, nitrst, numrow, 'vb_e'     ,    vb_e(:,:), ldxios = lwxios ) 
     976            CALL iom_rstput( kt, nitrst, numrow, 'sshbb_e'  , sshbb_e(:,:) )  
     977            CALL iom_rstput( kt, nitrst, numrow, 'ubb_e'    ,   ubb_e(:,:) ) 
     978            CALL iom_rstput( kt, nitrst, numrow, 'vbb_e'    ,   vbb_e(:,:) ) 
     979            CALL iom_rstput( kt, nitrst, numrow, 'sshb_e'   ,  sshb_e(:,:) ) 
     980            CALL iom_rstput( kt, nitrst, numrow, 'ub_e'     ,    ub_e(:,:) ) 
     981            CALL iom_rstput( kt, nitrst, numrow, 'vb_e'     ,    vb_e(:,:) ) 
    983982         ENDIF 
    984983#if defined key_agrif 
    985984         ! Save time integrated fluxes 
    986985         IF ( .NOT.Agrif_Root() ) THEN 
    987             CALL iom_rstput( kt, nitrst, numrow, 'ub2_i_b'  , ub2_i_b(:,:), ldxios = lwxios ) 
    988             CALL iom_rstput( kt, nitrst, numrow, 'vb2_i_b'  , vb2_i_b(:,:), ldxios = lwxios ) 
     986            CALL iom_rstput( kt, nitrst, numrow, 'ub2_i_b'  , ub2_i_b(:,:) ) 
     987            CALL iom_rstput( kt, nitrst, numrow, 'vb2_i_b'  , vb2_i_b(:,:) ) 
    989988         ENDIF 
    990989#endif 
    991          IF( lwxios ) CALL iom_swap(      cxios_context          ) 
    992990      ENDIF 
    993991      ! 
     
    10811079      !                             ! read restart when needed 
    10821080      CALL ts_rst( nit000, 'READ' ) 
    1083       ! 
    1084       IF( lwxios ) THEN 
    1085 ! define variables in restart file when writing with XIOS 
    1086          CALL iom_set_rstw_var_active('ub2_b') 
    1087          CALL iom_set_rstw_var_active('vb2_b') 
    1088          CALL iom_set_rstw_var_active('un_bf') 
    1089          CALL iom_set_rstw_var_active('vn_bf') 
    1090          ! 
    1091          IF (.NOT.ln_bt_av) THEN 
    1092             CALL iom_set_rstw_var_active('sshbb_e') 
    1093             CALL iom_set_rstw_var_active('ubb_e') 
    1094             CALL iom_set_rstw_var_active('vbb_e') 
    1095             CALL iom_set_rstw_var_active('sshb_e') 
    1096             CALL iom_set_rstw_var_active('ub_e') 
    1097             CALL iom_set_rstw_var_active('vb_e') 
    1098          ENDIF 
    1099 #if defined key_agrif 
    1100          ! Save time integrated fluxes 
    1101          IF ( .NOT.Agrif_Root() ) THEN 
    1102             CALL iom_set_rstw_var_active('ub2_i_b') 
    1103             CALL iom_set_rstw_var_active('vb2_i_b') 
    1104          ENDIF 
    1105 #endif 
    1106       ENDIF 
    11071081      ! 
    11081082   END SUBROUTINE dyn_spg_ts_init 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/src/OCE/DYN/sshwzv.F90

    r13998 r14018  
    473473         IF(lwp) WRITE(numout,*) 
    474474         IF(lwp) WRITE(numout,*)    '      Kmm sea surface height read in the restart file' 
    475          CALL iom_get( numror, jpdom_auto, 'sshn'   , ssh(:,:,Kmm), ldxios = lrxios ) 
     475         CALL iom_get( numror, jpdom_auto, 'sshn'   , ssh(:,:,Kmm) ) 
    476476         ! 
    477477         IF( l_1st_euler ) THEN                !* Euler at first time-step 
     
    483483            IF(lwp) WRITE(numout,*) 
    484484            IF(lwp) WRITE(numout,*) '      Kbb sea surface height read in the restart file' 
    485             CALL iom_get( numror, jpdom_auto, 'sshb', ssh(:,:,Kbb), ldxios = lrxios ) 
     485            CALL iom_get( numror, jpdom_auto, 'sshb', ssh(:,:,Kbb) ) 
    486486         ENDIF 
    487487         !                         !============================! 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/src/OCE/IOM/in_out_manager.F90

    r13286 r14018  
    8989   LOGICAL ::   lrst_abl              !: logical to control the abl restart write  
    9090   INTEGER ::   numror = 0            !: logical unit for ocean restart (read). Init to 0 is needed for SAS (in daymod.F90) 
    91    INTEGER ::   numrir                !: logical unit for ice   restart (read) 
    92    INTEGER ::   numrar                !: logical unit for abl   restart (read) 
    93    INTEGER ::   numrow                !: logical unit for ocean restart (write) 
    94    INTEGER ::   numriw                !: logical unit for ice   restart (write) 
    95    INTEGER ::   numraw                !: logical unit for abl   restart (write) 
     91   INTEGER ::   numrir = 0            !: logical unit for ice   restart (read) 
     92   INTEGER ::   numrar = 0            !: logical unit for abl   restart (read) 
     93   INTEGER ::   numrow = 0            !: logical unit for ocean restart (write) 
     94   INTEGER ::   numriw = 0            !: logical unit for ice   restart (write) 
     95   INTEGER ::   numraw = 0            !: logical unit for abl   restart (write) 
     96   INTEGER ::   numrtr = 0            !: trc restart (read ) 
     97   INTEGER ::   numrtw = 0            !: trc restart (write ) 
     98   INTEGER ::   numrsr = 0            !: logical unit for sed restart (read) 
     99   INTEGER ::   numrsw = 0            !: logical unit for sed restart (write) 
     100 
    96101   INTEGER ::   nrst_lst              !: number of restart to output next 
    97102 
     
    165170   LOGICAL       ::   lwp      = .FALSE.    !: boolean : true on the 1st processor only .OR. sn_cfctl%l_oceout=T 
    166171   LOGICAL       ::   lsp_area = .TRUE.     !: to make a control print over a specific area 
    167    CHARACTER(lc) ::   cxios_context         !: context name used in xios 
    168    CHARACTER(lc) ::   crxios_context         !: context name used in xios to read restart 
    169    CHARACTER(lc) ::   cwxios_context        !: context name used in xios to write restart file 
     172   CHARACTER(LEN=lc) ::   cxios_context     !: context name used in xios 
     173   CHARACTER(LEN=lc) ::   cr_ocerst_cxt     !: context name used in xios to read OCE restart 
     174   CHARACTER(LEN=lc) ::   cw_ocerst_cxt     !: context name used in xios to write OCE restart file 
     175   CHARACTER(LEN=lc) ::   cr_icerst_cxt     !: context name used in xios to read SI3 restart 
     176   CHARACTER(LEN=lc) ::   cw_icerst_cxt     !: context name used in xios to write SI3 restart file 
     177   CHARACTER(LEN=lc) ::   cr_toprst_cxt     !: context name used in xios to read TOP restart 
     178   CHARACTER(LEN=lc) ::   cw_toprst_cxt     !: context name used in xios to write TOP restart file 
     179   CHARACTER(LEN=lc) ::   cr_sedrst_cxt     !: context name used in xios to read SEDIMENT restart 
     180   CHARACTER(LEN=lc) ::   cw_sedrst_cxt     !: context name used in xios to write SEDIMENT restart file 
     181 
     182 
     183 
    170184 
    171185   !! * Substitutions 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/src/OCE/IOM/iom.F90

    r13998 r14018  
    4646   USE lib_fortran  
    4747   USE diu_bulk, ONLY : ln_diurnal_only, ln_diurnal 
     48   USE iom_nf90 
     49   USE netcdf 
    4850 
    4951   IMPLICIT NONE 
     
    5860   PUBLIC iom_chkatt, iom_getatt, iom_putatt, iom_getszuld, iom_rstput, iom_delay_rst, iom_put 
    5961   PUBLIC iom_use, iom_context_finalize, iom_update_file_name, iom_miss_val 
     62   PUBLIC iom_xios_setid 
    6063 
    6164   PRIVATE iom_rp0d_sp, iom_rp1d_sp, iom_rp2d_sp, iom_rp3d_sp 
     
    6972   PRIVATE iom_set_domain_attr, iom_set_axis_attr, iom_set_field_attr, iom_set_file_attr, iom_get_file_attr, iom_set_grid_attr 
    7073   PRIVATE set_grid, set_grid_bounds, set_scalar, set_xmlatt, set_mooring, iom_sdate 
    71    PRIVATE iom_set_rst_context, iom_set_rstw_active, iom_set_rstr_active 
     74   PRIVATE iom_set_rst_context, iom_set_vars_active 
    7275# endif 
    73    PUBLIC iom_set_rstw_var_active, iom_set_rstw_core, iom_set_rst_vars 
     76   PRIVATE set_xios_context 
     77   PRIVATE iom_set_rstw_active 
    7478 
    7579   INTERFACE iom_get 
     
    101105CONTAINS 
    102106 
    103    SUBROUTINE iom_init( cdname, fname, ld_closedef )  
     107   SUBROUTINE iom_init( cdname, kdid, ld_closedef )  
    104108      !!---------------------------------------------------------------------- 
    105109      !!                     ***  ROUTINE   *** 
     
    109113      !!---------------------------------------------------------------------- 
    110114      CHARACTER(len=*),           INTENT(in)  :: cdname 
    111       CHARACTER(len=*), OPTIONAL, INTENT(in)  :: fname 
     115      INTEGER         , OPTIONAL, INTENT(in)  :: kdid           
    112116      LOGICAL         , OPTIONAL, INTENT(in)  :: ld_closedef 
    113117#if defined key_iomput 
     
    118122      INTEGER             :: irefyear, irefmonth, irefday 
    119123      INTEGER           :: ji 
    120       LOGICAL :: llrst_context              ! is context related to restart 
     124      LOGICAL           :: llrst_context              ! is context related to restart 
     125      LOGICAL           :: llrstr, llrstw  
     126      INTEGER           :: inum 
    121127      ! 
    122128      REAL(wp), ALLOCATABLE, DIMENSION(:,:) :: zt_bnds, zw_bnds 
    123129      REAL(wp), DIMENSION(2,jpkam1)         :: za_bnds   ! ABL vertical boundaries 
    124       LOGICAL ::   ll_closedef = .TRUE. 
     130      LOGICAL ::   ll_closedef 
    125131      LOGICAL ::   ll_exist 
    126132      !!---------------------------------------------------------------------- 
    127133      ! 
     134      ll_closedef = .TRUE. 
    128135      IF ( PRESENT(ld_closedef) ) ll_closedef = ld_closedef 
    129136      ! 
     
    134141      CALL xios_context_initialize(TRIM(clname), mpi_comm_oce) 
    135142      CALL iom_swap( cdname ) 
    136       llrst_context =  (TRIM(cdname) == TRIM(crxios_context) .OR. TRIM(cdname) == TRIM(cwxios_context)) 
     143 
     144      llrstr = (cdname == cr_ocerst_cxt) .OR. (cdname == cr_icerst_cxt) 
     145      llrstr = llrstr .OR. (cdname == cr_toprst_cxt) 
     146      llrstr = llrstr .OR. (cdname == cr_sedrst_cxt) 
     147 
     148      llrstw = (cdname == cw_ocerst_cxt) .OR. (cdname == cw_icerst_cxt) 
     149      llrstw = llrstw .OR. (cdname == cw_toprst_cxt) 
     150      llrstw = llrstw .OR. (cdname == cw_sedrst_cxt) 
     151 
     152      llrst_context = llrstr .OR. llrstw 
    137153 
    138154      ! Calendar type is now defined in xml file  
     
    153169      IF(.NOT.llrst_context) CALL set_scalar 
    154170      ! 
    155       IF( TRIM(cdname) == TRIM(cxios_context) ) THEN   
     171      IF( cdname == cxios_context ) THEN   
    156172         CALL set_grid( "T", glamt, gphit, .FALSE., .FALSE. )  
    157173         CALL set_grid( "U", glamu, gphiu, .FALSE., .FALSE. ) 
     
    200216      ! vertical grid definition 
    201217      IF(.NOT.llrst_context) THEN 
    202           CALL iom_set_axis_attr(  "deptht", paxis = gdept_1d ) 
    203           CALL iom_set_axis_attr(  "depthu", paxis = gdept_1d ) 
    204           CALL iom_set_axis_attr(  "depthv", paxis = gdept_1d ) 
    205           CALL iom_set_axis_attr(  "depthw", paxis = gdepw_1d ) 
     218         CALL iom_set_axis_attr(  "deptht", paxis = gdept_1d ) 
     219         CALL iom_set_axis_attr(  "depthu", paxis = gdept_1d ) 
     220         CALL iom_set_axis_attr(  "depthv", paxis = gdept_1d ) 
     221         CALL iom_set_axis_attr(  "depthw", paxis = gdepw_1d ) 
    206222          CALL iom_set_axis_attr(  "depthf", paxis = gdept_1d ) 
    207223 
    208224          ! ABL 
    209           IF( .NOT. ALLOCATED(ght_abl) ) THEN   ! force definition for xml files (xios)  
    210              ALLOCATE( ght_abl(jpka), ghw_abl(jpka), e3t_abl(jpka), e3w_abl(jpka) )   ! default allocation needed by iom 
    211              ght_abl(:) = -1._wp   ;   ghw_abl(:) = -1._wp 
    212              e3t_abl(:) = -1._wp   ;   e3w_abl(:) = -1._wp 
    213           ENDIF 
    214           CALL iom_set_axis_attr( "ght_abl", ght_abl(2:jpka) ) 
    215           CALL iom_set_axis_attr( "ghw_abl", ghw_abl(2:jpka) ) 
     225         IF( .NOT. ALLOCATED(ght_abl) ) THEN   ! force definition for xml files (xios)  
     226            ALLOCATE( ght_abl(jpka), ghw_abl(jpka), e3t_abl(jpka), e3w_abl(jpka) )   ! default allocation needed by iom 
     227            ght_abl(:) = -1._wp   ;   ghw_abl(:) = -1._wp 
     228            e3t_abl(:) = -1._wp   ;   e3w_abl(:) = -1._wp 
     229         ENDIF 
     230         CALL iom_set_axis_attr( "ght_abl", ght_abl(2:jpka) ) 
     231         CALL iom_set_axis_attr( "ghw_abl", ghw_abl(2:jpka) ) 
    216232           
    217           ! Add vertical grid bounds 
    218           zt_bnds(2,:      ) = gdept_1d(:) 
    219           zt_bnds(1,2:jpk  ) = gdept_1d(1:jpkm1) 
    220           zt_bnds(1,1      ) = gdept_1d(1) - e3w_1d(1) 
    221           zw_bnds(1,:      ) = gdepw_1d(:) 
    222           zw_bnds(2,1:jpkm1) = gdepw_1d(2:jpk) 
    223           zw_bnds(2,jpk:   ) = gdepw_1d(jpk) + e3t_1d(jpk) 
    224           CALL iom_set_axis_attr(  "deptht", bounds=zw_bnds ) 
    225           CALL iom_set_axis_attr(  "depthu", bounds=zw_bnds ) 
    226           CALL iom_set_axis_attr(  "depthv", bounds=zw_bnds ) 
    227           CALL iom_set_axis_attr(  "depthw", bounds=zt_bnds ) 
     233         ! Add vertical grid bounds 
     234         zt_bnds(2,:      ) = gdept_1d(:) 
     235         zt_bnds(1,2:jpk  ) = gdept_1d(1:jpkm1) 
     236         zt_bnds(1,1      ) = gdept_1d(1) - e3w_1d(1) 
     237         zw_bnds(1,:      ) = gdepw_1d(:) 
     238         zw_bnds(2,1:jpkm1) = gdepw_1d(2:jpk) 
     239         zw_bnds(2,jpk:   ) = gdepw_1d(jpk) + e3t_1d(jpk) 
     240         CALL iom_set_axis_attr(  "deptht", bounds=zw_bnds ) 
     241         CALL iom_set_axis_attr(  "depthu", bounds=zw_bnds ) 
     242         CALL iom_set_axis_attr(  "depthv", bounds=zw_bnds ) 
     243         CALL iom_set_axis_attr(  "depthw", bounds=zt_bnds ) 
    228244          CALL iom_set_axis_attr(  "depthf", bounds=zw_bnds ) 
    229245 
    230           ! ABL 
    231           za_bnds(1,:) = ghw_abl(1:jpkam1) 
    232           za_bnds(2,:) = ghw_abl(2:jpka  ) 
    233           CALL iom_set_axis_attr( "ght_abl", bounds=za_bnds ) 
    234           za_bnds(1,:) = ght_abl(2:jpka  ) 
    235           za_bnds(2,:) = ght_abl(2:jpka  ) + e3w_abl(2:jpka) 
    236           CALL iom_set_axis_attr( "ghw_abl", bounds=za_bnds ) 
    237  
    238           CALL iom_set_axis_attr(  "nfloat", (/ (REAL(ji,wp), ji=1,jpnfl) /) ) 
     246         ! ABL 
     247         za_bnds(1,:) = ghw_abl(1:jpkam1) 
     248         za_bnds(2,:) = ghw_abl(2:jpka  ) 
     249         CALL iom_set_axis_attr( "ght_abl", bounds=za_bnds ) 
     250         za_bnds(1,:) = ght_abl(2:jpka  ) 
     251         za_bnds(2,:) = ght_abl(2:jpka  ) + e3w_abl(2:jpka) 
     252         CALL iom_set_axis_attr( "ghw_abl", bounds=za_bnds ) 
     253 
     254         CALL iom_set_axis_attr(  "nfloat", (/ (REAL(ji,wp), ji=1,jpnfl) /) ) 
    239255# if defined key_si3 
    240           CALL iom_set_axis_attr( "ncatice", (/ (REAL(ji,wp), ji=1,jpl) /) ) 
    241           ! SIMIP diagnostics (4 main arctic straits) 
    242           CALL iom_set_axis_attr( "nstrait", (/ (REAL(ji,wp), ji=1,4) /) ) 
     256         CALL iom_set_axis_attr( "ncatice", (/ (REAL(ji,wp), ji=1,jpl) /) ) 
     257         ! SIMIP diagnostics (4 main arctic straits) 
     258         CALL iom_set_axis_attr( "nstrait", (/ (REAL(ji,wp), ji=1,4) /) ) 
    243259# endif 
    244260#if defined key_top 
    245           IF( ALLOCATED(profsed) ) CALL iom_set_axis_attr( "profsed", paxis = profsed ) 
    246 #endif 
    247           CALL iom_set_axis_attr( "icbcla", class_num ) 
    248           CALL iom_set_axis_attr( "iax_20C", (/ REAL(20,wp) /) )   ! strange syntaxe and idea... 
    249           CALL iom_set_axis_attr( "iax_26C", (/ REAL(26,wp) /) )   ! strange syntaxe and idea... 
    250           CALL iom_set_axis_attr( "iax_28C", (/ REAL(28,wp) /) )   ! strange syntaxe and idea... 
    251           ! for diaprt, we need to define an axis which size can be 1 (default) or 5 (if the file subbasins.nc exists) 
    252           INQUIRE( FILE = 'subbasins.nc', EXIST = ll_exist ) 
    253           nbasin = 1 + 4 * COUNT( (/ll_exist/) ) 
    254           CALL iom_set_axis_attr( "basin"  , (/ (REAL(ji,wp), ji=1,nbasin) /) ) 
     261         IF( ALLOCATED(profsed) ) CALL iom_set_axis_attr( "profsed", paxis = profsed ) 
     262#endif 
     263         CALL iom_set_axis_attr( "icbcla", class_num ) 
     264         CALL iom_set_axis_attr( "iax_20C", (/ REAL(20,wp) /) )   ! strange syntaxe and idea... 
     265         CALL iom_set_axis_attr( "iax_26C", (/ REAL(26,wp) /) )   ! strange syntaxe and idea... 
     266         CALL iom_set_axis_attr( "iax_28C", (/ REAL(28,wp) /) )   ! strange syntaxe and idea... 
     267         ! for diaprt, we need to define an axis which size can be 1 (default) or 5 (if the file subbasins.nc exists) 
     268         INQUIRE( FILE = 'subbasins.nc', EXIST = ll_exist ) 
     269         nbasin = 1 + 4 * COUNT( (/ll_exist/) ) 
     270         CALL iom_set_axis_attr( "basin"  , (/ (REAL(ji,wp), ji=1,nbasin) /) ) 
    255271      ENDIF 
    256272      ! 
    257273      ! automatic definitions of some of the xml attributs 
    258       IF( TRIM(cdname) == TRIM(crxios_context) ) THEN 
    259 !set names of the fields in restart file IF using XIOS to read data 
    260           CALL iom_set_rst_context(.TRUE.) 
    261           CALL iom_set_rst_vars(rst_rfields) 
    262 !set which fields are to be read from restart file 
    263           CALL iom_set_rstr_active() 
    264       ELSE IF( TRIM(cdname) == TRIM(cwxios_context) ) THEN 
    265 !set names of the fields in restart file IF using XIOS to write data 
    266           CALL iom_set_rst_context(.FALSE.) 
    267           CALL iom_set_rst_vars(rst_wfields) 
    268 !set which fields are to be written to a restart file 
    269           CALL iom_set_rstw_active(fname) 
     274      IF(llrstr) THEN 
     275         IF(PRESENT(kdid)) THEN 
     276            CALL iom_set_rst_context(.TRUE.) 
     277!set which fields will be read from restart file 
     278            CALL iom_set_vars_active(kdid) 
     279         ELSE 
     280            CALL ctl_stop( 'iom_init:', 'restart read with XIOS: missing pointer to NETCDF file' ) 
     281         ENDIF 
     282      ELSE IF(llrstw) THEN 
     283         CALL iom_set_rstw_file(iom_file(kdid)%name) 
    270284      ELSE 
    271           CALL set_xmlatt 
     285         CALL set_xmlatt 
    272286      ENDIF 
    273287      ! 
     
    285299   END SUBROUTINE iom_init 
    286300 
    287    SUBROUTINE iom_init_closedef 
     301   SUBROUTINE iom_init_closedef(cdname) 
    288302      !!---------------------------------------------------------------------- 
    289303      !!            ***  SUBROUTINE iom_init_closedef  *** 
     
    293307      !! 
    294308      !!---------------------------------------------------------------------- 
    295  
     309      CHARACTER(len=*), OPTIONAL, INTENT(IN) :: cdname 
    296310#if defined key_iomput 
    297       CALL xios_close_context_definition() 
    298       CALL xios_update_calendar( 0 ) 
     311      LOGICAL :: llrstw 
     312 
     313      llrstw = .FALSE. 
     314      IF(PRESENT(cdname)) THEN 
     315         llrstw = (cdname == cw_ocerst_cxt) 
     316         llrstw = llrstw .OR. (cdname == cw_icerst_cxt) 
     317         llrstw = llrstw .OR. (cdname == cw_toprst_cxt) 
     318         llrstw = llrstw .OR. (cdname == cw_sedrst_cxt) 
     319      ENDIF 
     320 
     321      IF( llrstw ) THEN 
     322!set names of the fields in restart file IF using XIOS to write data 
     323         CALL iom_set_rst_context(.FALSE.) 
     324         CALL xios_close_context_definition() 
     325      ELSE 
     326         CALL xios_close_context_definition() 
     327         CALL xios_update_calendar( 0 ) 
     328      ENDIF 
    299329#else 
    300330      IF( .FALSE. )   WRITE(numout,*) 'iom_init_closedef: should not see this'   ! useless statement to avoid compilation warnings 
     
    303333   END SUBROUTINE iom_init_closedef 
    304334 
    305    SUBROUTINE iom_set_rstw_var_active(field) 
     335   SUBROUTINE iom_set_vars_active(idnum) 
    306336      !!--------------------------------------------------------------------- 
    307       !!                   ***  SUBROUTINE  iom_set_rstw_var_active  *** 
    308       !! 
    309       !! ** Purpose :  enable variable in restart file when writing with XIOS  
     337      !!                   ***  SUBROUTINE  iom_set_vars_active  *** 
     338      !! 
     339      !! ** Purpose :  define filename in XIOS context for reading file, 
     340      !!               enable variables present in a file for reading with XIOS  
     341      !!               id of the file is assumed to be rrestart. 
    310342      !!--------------------------------------------------------------------- 
    311    CHARACTER(len = *), INTENT(IN) :: field 
    312    INTEGER :: i 
    313    LOGICAL :: llis_set 
    314    CHARACTER(LEN=256) :: clinfo    ! info character 
    315  
     343      INTEGER, INTENT(IN) :: idnum  
     344       
    316345#if defined key_iomput 
    317    llis_set = .FALSE. 
    318  
    319    DO i = 1, max_rst_fields 
    320        IF(TRIM(rst_wfields(i)%vname) == field) THEN  
    321           rst_wfields(i)%active = .TRUE. 
    322           llis_set = .TRUE. 
    323           EXIT 
    324        ENDIF 
    325    ENDDO 
    326 !Warn if variable is not in defined in rst_wfields 
    327    IF(.NOT.llis_set) THEN 
    328       WRITE(ctmp1,*) 'iom_set_rstw_var_active: variable ', field ,' is available for writing but not defined'  
    329       CALL ctl_stop( 'iom_set_rstw_var_active:', ctmp1 ) 
    330    ENDIF 
    331 #else 
    332         clinfo = 'iom_set_rstw_var_active: key_iomput is needed to use XIOS restart read/write functionality' 
    333         CALL ctl_stop('STOP', TRIM(clinfo)) 
    334 #endif 
    335  
    336    END SUBROUTINE iom_set_rstw_var_active 
    337  
    338    SUBROUTINE iom_set_rstr_active() 
     346      INTEGER                                    :: ndims, nvars, natts, unlimitedDimId, dimlen, xtype,mdims 
     347      TYPE(xios_field)                           :: field_hdl 
     348      TYPE(xios_file)                            :: file_hdl 
     349      TYPE(xios_filegroup)                       :: filegroup_hdl 
     350      INTEGER                                    :: dimids(4), jv,i, idim 
     351      CHARACTER(LEN=256)                         :: clinfo               ! info character 
     352      INTEGER, ALLOCATABLE                       :: indimlens(:) 
     353      CHARACTER(LEN=nf90_max_name), ALLOCATABLE  :: indimnames(:) 
     354      CHARACTER(LEN=nf90_max_name)               :: dimname, varname 
     355      INTEGER                                    :: iln 
     356      CHARACTER(LEN=lc)                          :: fname 
     357      LOGICAL                                    :: lmeta 
     358!metadata in restart file for restart read with XIOS 
     359      INTEGER, PARAMETER                         :: NMETA = 10 
     360      CHARACTER(LEN=lc)                          :: meta(NMETA) 
     361 
     362 
     363      meta(1) = "nav_lat" 
     364      meta(2) = "nav_lon" 
     365      meta(3) = "nav_lev" 
     366      meta(4) = "time_instant" 
     367      meta(5) = "time_instant_bounds" 
     368      meta(6) = "time_counter" 
     369      meta(7) = "time_counter_bounds" 
     370      meta(8) = "x" 
     371      meta(9) = "y" 
     372      meta(10) = "numcat" 
     373 
     374      clinfo = '          iom_set_vars_active, file: '//TRIM(iom_file(idnum)%name) 
     375 
     376      iln = INDEX( iom_file(idnum)%name, '.nc' ) 
     377!XIOS doee not need .nc 
     378      IF(iln > 0) THEN 
     379        fname =  iom_file(idnum)%name(1:iln-1) 
     380      ELSE 
     381        fname =  iom_file(idnum)%name 
     382      ENDIF 
     383 
     384!set name of the restart file and enable available fields 
     385      CALL xios_get_handle("file_definition", filegroup_hdl ) 
     386      CALL xios_add_child(filegroup_hdl, file_hdl, 'rrestart') 
     387      CALL xios_set_file_attr( "rrestart", name=fname, type="one_file",      & 
     388           par_access="collective", enabled=.TRUE., mode="read",              & 
     389                                                    output_freq=xios_timestep ) 
     390 
     391      CALL iom_nf90_check( nf90_inquire(iom_file(idnum)%nfid, ndims, nvars, natts ), clinfo ) 
     392      ALLOCATE(indimlens(ndims), indimnames(ndims)) 
     393      CALL iom_nf90_check( nf90_inquire(iom_file(idnum)%nfid, unlimitedDimId = unlimitedDimId ), clinfo ) 
     394 
     395      DO idim = 1, ndims 
     396         CALL iom_nf90_check( nf90_inquire_dimension(iom_file(idnum)%nfid, idim, dimname, dimlen ), clinfo ) 
     397         indimlens(idim) = dimlen 
     398         indimnames(idim) = dimname 
     399      ENDDO 
     400 
     401      DO jv =1, nvars 
     402         lmeta = .FALSE. 
     403         CALL iom_nf90_check( nf90_inquire_variable(iom_file(idnum)%nfid, jv, varname, xtype, ndims, dimids, natts ), clinfo ) 
     404         DO i = 1, NMETA 
     405           IF(varname == meta(i)) THEN 
     406             lmeta = .TRUE. 
     407           ENDIF 
     408         ENDDO 
     409         IF(.NOT.lmeta) THEN 
     410            CALL xios_add_child(file_hdl, field_hdl, varname) 
     411            mdims = ndims 
     412 
     413            IF(ANY(dimids(1:ndims) == unlimitedDimId)) THEN 
     414               mdims = mdims - 1 
     415            ENDIF 
     416 
     417            IF(mdims == 3) THEN 
     418               CALL xios_set_attr (field_hdl, enabled = .TRUE., name = varname,   & 
     419                                   domain_ref="grid_N",                           & 
     420                                   axis_ref=iom_axis(indimlens(dimids(mdims))),   & 
     421                                   prec = 8, operation = "instant"                ) 
     422            ELSEIF(mdims == 2) THEN 
     423               CALL xios_set_attr (field_hdl, enabled = .TRUE., name = varname,  & 
     424                                   domain_ref="grid_N", prec = 8,                & 
     425                                   operation = "instant"                         )  
     426            ELSEIF(mdims == 1) THEN 
     427               CALL xios_set_attr (field_hdl, enabled = .TRUE., name = varname, & 
     428                                   axis_ref=iom_axis(indimlens(dimids(mdims))), & 
     429                                   prec = 8, operation = "instant"              ) 
     430            ELSEIF(mdims == 0) THEN 
     431               CALL xios_set_attr (field_hdl, enabled = .TRUE., name = varname, & 
     432                                   scalar_ref = "grid_scalar", prec = 8,        & 
     433                                   operation = "instant"                        ) 
     434            ELSE 
     435               WRITE(ctmp1,*) 'iom_set_vars_active: variable ', TRIM(varname) ,' incorrect number of dimensions'  
     436               CALL ctl_stop( 'iom_set_vars_active:', ctmp1 ) 
     437            ENDIF 
     438         ENDIF 
     439      ENDDO 
     440      DEALLOCATE(indimlens, indimnames) 
     441#endif 
     442   END SUBROUTINE iom_set_vars_active 
     443 
     444   SUBROUTINE iom_set_rstw_file(cdrst_file) 
    339445      !!--------------------------------------------------------------------- 
    340       !!                   ***  SUBROUTINE  iom_set_rstr_active  *** 
    341       !! 
    342       !! ** Purpose :  define file name in XIOS context for reading restart file, 
    343       !!               enable variables present in restart file for reading with XIOS  
     446      !!                   ***  SUBROUTINE iom_set_rstw_file   *** 
     447      !! 
     448      !! ** Purpose :  define file name in XIOS context for writing restart 
    344449      !!--------------------------------------------------------------------- 
    345  
    346 !sets enabled = .TRUE. for each field in restart file 
    347    CHARACTER(len=256) :: rst_file 
    348  
     450      CHARACTER(len=*) :: cdrst_file 
    349451#if defined key_iomput 
    350    TYPE(xios_field) :: field_hdl 
    351    TYPE(xios_file) :: file_hdl 
    352    TYPE(xios_filegroup) :: filegroup_hdl 
    353    INTEGER :: i 
    354    CHARACTER(lc)  ::   clpath 
    355  
    356         clpath = TRIM(cn_ocerst_indir) 
    357         IF( clpath(LEN_TRIM(clpath):) /= '/' ) clpath = TRIM(clpath) // '/' 
    358         IF( TRIM(Agrif_CFixed()) == '0' ) THEN 
    359            rst_file = TRIM(clpath)//TRIM(cn_ocerst_in) 
    360         ELSE 
    361            rst_file = TRIM(clpath)//TRIM(Agrif_CFixed())//'_'//TRIM(cn_ocerst_in) 
    362         ENDIF 
     452      TYPE(xios_file) :: file_hdl 
     453      TYPE(xios_filegroup) :: filegroup_hdl 
     454 
    363455!set name of the restart file and enable available fields 
    364         if(lwp) WRITE(numout,*) 'Setting restart filename (for XIOS) to: ',rst_file 
    365         CALL xios_get_handle("file_definition", filegroup_hdl ) 
    366         CALL xios_add_child(filegroup_hdl, file_hdl, 'rrestart') 
    367         CALL xios_set_file_attr( "rrestart", name=trim(rst_file), type="one_file", & 
    368              par_access="collective", enabled=.TRUE., mode="read",                 & 
    369              output_freq=xios_timestep) 
    370 !define variables for restart context 
    371         DO i = 1, max_rst_fields 
    372          IF( TRIM(rst_rfields(i)%vname) /= "NO_NAME") THEN 
    373            IF( iom_varid( numror, TRIM(rst_rfields(i)%vname), ldstop = .FALSE. ) > 0 ) THEN 
    374                 CALL xios_add_child(file_hdl, field_hdl, TRIM(rst_rfields(i)%vname)) 
    375                 SELECT CASE (TRIM(rst_rfields(i)%grid)) 
    376                  CASE ("grid_N_3D") 
    377                     CALL xios_set_attr (field_hdl, enabled = .TRUE., name = TRIM(rst_rfields(i)%vname), & 
    378                         domain_ref="grid_N", axis_ref="nav_lev", operation = "instant") 
    379                  CASE ("grid_N") 
    380                     CALL xios_set_attr (field_hdl, enabled = .TRUE., name = TRIM(rst_rfields(i)%vname), & 
    381                         domain_ref="grid_N", operation = "instant")  
    382                 CASE ("grid_vector") 
    383                     CALL xios_set_attr (field_hdl, enabled = .TRUE., name = TRIM(rst_rfields(i)%vname), & 
    384                          axis_ref="nav_lev", operation = "instant") 
    385                  CASE ("grid_scalar") 
    386                     CALL xios_set_attr (field_hdl, enabled = .TRUE., name = TRIM(rst_rfields(i)%vname), & 
    387                         scalar_ref = "grid_scalar", operation = "instant") 
    388                 END SELECT 
    389                 IF(lwp) WRITE(numout,*) 'XIOS read: ', TRIM(rst_rfields(i)%vname), ' enabled in ', TRIM(rst_file) 
    390            ENDIF 
    391          ENDIF 
    392         END DO 
    393 #endif 
    394    END SUBROUTINE iom_set_rstr_active 
    395  
    396    SUBROUTINE iom_set_rstw_core(cdmdl) 
    397       !!--------------------------------------------------------------------- 
    398       !!                   ***  SUBROUTINE  iom_set_rstw_core  *** 
    399       !! 
    400       !! ** Purpose :  set variables which are always in restart file  
    401       !!--------------------------------------------------------------------- 
    402    CHARACTER (len=*), INTENT (IN) :: cdmdl ! model OPA or SAS 
    403    CHARACTER(LEN=256)             :: clinfo    ! info character 
    404 #if defined key_iomput 
    405    IF(cdmdl == "OPA") THEN 
    406 !from restart.F90 
    407    CALL iom_set_rstw_var_active("rn_Dt") 
    408    IF ( .NOT. ln_diurnal_only ) THEN 
    409         CALL iom_set_rstw_var_active('ub'  ) 
    410         CALL iom_set_rstw_var_active('vb'  ) 
    411         CALL iom_set_rstw_var_active('tb'  ) 
    412         CALL iom_set_rstw_var_active('sb'  ) 
    413         CALL iom_set_rstw_var_active('sshb') 
    414         ! 
    415         CALL iom_set_rstw_var_active('un'  ) 
    416         CALL iom_set_rstw_var_active('vn'  ) 
    417         CALL iom_set_rstw_var_active('tn'  ) 
    418         CALL iom_set_rstw_var_active('sn'  ) 
    419         CALL iom_set_rstw_var_active('sshn') 
    420         CALL iom_set_rstw_var_active('rhop') 
    421       ENDIF 
    422       IF(ln_diurnal) CALL iom_set_rstw_var_active('Dsst') 
    423 !from trasbc.F90 
    424          CALL iom_set_rstw_var_active('sbc_hc_b') 
    425          CALL iom_set_rstw_var_active('sbc_sc_b') 
    426    ENDIF 
    427 #else 
    428         clinfo = 'iom_set_rstw_core: key_iomput is needed to use XIOS restart read/write functionality' 
    429         CALL ctl_stop('STOP', TRIM(clinfo)) 
    430 #endif 
    431    END SUBROUTINE iom_set_rstw_core 
    432  
    433    SUBROUTINE iom_set_rst_vars(fields) 
    434       !!--------------------------------------------------------------------- 
    435       !!                   ***  SUBROUTINE iom_set_rst_vars   *** 
    436       !! 
    437       !! ** Purpose :  Fill array fields with the information about all  
    438       !!               possible variables and corresponding grids definition  
    439       !!               for reading/writing restart with XIOS 
    440       !!--------------------------------------------------------------------- 
    441    TYPE(RST_FIELD), INTENT(INOUT) :: fields(max_rst_fields) 
    442    INTEGER :: i 
    443  
    444         i = 0 
    445         i = i + 1; fields(i)%vname="rn_Dt";            fields(i)%grid="grid_scalar" 
    446         i = i + 1; fields(i)%vname="un";             fields(i)%grid="grid_N_3D" 
    447         i = i + 1; fields(i)%vname="ub";             fields(i)%grid="grid_N_3D" 
    448         i = i + 1; fields(i)%vname="vn";             fields(i)%grid="grid_N_3D" 
    449         i = i + 1; fields(i)%vname="vb";             fields(i)%grid="grid_N_3D"   
    450         i = i + 1; fields(i)%vname="tn";             fields(i)%grid="grid_N_3D" 
    451         i = i + 1; fields(i)%vname="tb";             fields(i)%grid="grid_N_3D" 
    452         i = i + 1; fields(i)%vname="sn";             fields(i)%grid="grid_N_3D" 
    453         i = i + 1; fields(i)%vname="sb";             fields(i)%grid="grid_N_3D" 
    454         i = i + 1; fields(i)%vname="sshn";           fields(i)%grid="grid_N" 
    455         i = i + 1; fields(i)%vname="sshb";           fields(i)%grid="grid_N" 
    456         i = i + 1; fields(i)%vname="rhop";           fields(i)%grid="grid_N_3D" 
    457         i = i + 1; fields(i)%vname="kt";             fields(i)%grid="grid_scalar" 
    458         i = i + 1; fields(i)%vname="ndastp";         fields(i)%grid="grid_scalar" 
    459         i = i + 1; fields(i)%vname="adatrj";         fields(i)%grid="grid_scalar" 
    460         i = i + 1; fields(i)%vname="utau_b";         fields(i)%grid="grid_N" 
    461         i = i + 1; fields(i)%vname="vtau_b";         fields(i)%grid="grid_N" 
    462         i = i + 1; fields(i)%vname="qns_b";          fields(i)%grid="grid_N" 
    463         i = i + 1; fields(i)%vname="emp_b";          fields(i)%grid="grid_N" 
    464         i = i + 1; fields(i)%vname="sfx_b";          fields(i)%grid="grid_N" 
    465         i = i + 1; fields(i)%vname="en" ;            fields(i)%grid="grid_N_3D"  
    466         i = i + 1; fields(i)%vname="avt_k";            fields(i)%grid="grid_N_3D" 
    467         i = i + 1; fields(i)%vname="avm_k";            fields(i)%grid="grid_N_3D" 
    468         i = i + 1; fields(i)%vname="dissl";          fields(i)%grid="grid_N_3D" 
    469         i = i + 1; fields(i)%vname="sbc_hc_b";       fields(i)%grid="grid_N" 
    470         i = i + 1; fields(i)%vname="sbc_sc_b";       fields(i)%grid="grid_N" 
    471         i = i + 1; fields(i)%vname="qsr_hc_b";       fields(i)%grid="grid_N_3D" 
    472         i = i + 1; fields(i)%vname="fraqsr_1lev";    fields(i)%grid="grid_N" 
    473         i = i + 1; fields(i)%vname="greenland_icesheet_mass" 
    474                                                fields(i)%grid="grid_scalar" 
    475         i = i + 1; fields(i)%vname="greenland_icesheet_timelapsed" 
    476                                                fields(i)%grid="grid_scalar" 
    477         i = i + 1; fields(i)%vname="greenland_icesheet_mass_roc" 
    478                                                fields(i)%grid="grid_scalar" 
    479         i = i + 1; fields(i)%vname="antarctica_icesheet_mass" 
    480                                                fields(i)%grid="grid_scalar" 
    481         i = i + 1; fields(i)%vname="antarctica_icesheet_timelapsed" 
    482                                                fields(i)%grid="grid_scalar" 
    483         i = i + 1; fields(i)%vname="antarctica_icesheet_mass_roc" 
    484                                                fields(i)%grid="grid_scalar" 
    485         i = i + 1; fields(i)%vname="frc_v";          fields(i)%grid="grid_scalar" 
    486         i = i + 1; fields(i)%vname="frc_t";          fields(i)%grid="grid_scalar" 
    487         i = i + 1; fields(i)%vname="frc_s";          fields(i)%grid="grid_scalar" 
    488         i = i + 1; fields(i)%vname="frc_wn_t";       fields(i)%grid="grid_scalar" 
    489         i = i + 1; fields(i)%vname="frc_wn_s";       fields(i)%grid="grid_scalar" 
    490         i = i + 1; fields(i)%vname="ssh_ini";        fields(i)%grid="grid_N" 
    491         i = i + 1; fields(i)%vname="e3t_ini";        fields(i)%grid="grid_N_3D" 
    492         i = i + 1; fields(i)%vname="hc_loc_ini";     fields(i)%grid="grid_N_3D" 
    493         i = i + 1; fields(i)%vname="sc_loc_ini";     fields(i)%grid="grid_N_3D" 
    494         i = i + 1; fields(i)%vname="ssh_hc_loc_ini"; fields(i)%grid="grid_N" 
    495         i = i + 1; fields(i)%vname="ssh_sc_loc_ini"; fields(i)%grid="grid_N" 
    496         i = i + 1; fields(i)%vname="tilde_e3t_b";    fields(i)%grid="grid_N" 
    497         i = i + 1; fields(i)%vname="tilde_e3t_n";    fields(i)%grid="grid_N" 
    498         i = i + 1; fields(i)%vname="hdiv_lf";        fields(i)%grid="grid_N" 
    499         i = i + 1; fields(i)%vname="ub2_b";          fields(i)%grid="grid_N" 
    500         i = i + 1; fields(i)%vname="vb2_b";          fields(i)%grid="grid_N" 
    501         i = i + 1; fields(i)%vname="sshbb_e";        fields(i)%grid="grid_N" 
    502         i = i + 1; fields(i)%vname="ubb_e";          fields(i)%grid="grid_N" 
    503         i = i + 1; fields(i)%vname="vbb_e";          fields(i)%grid="grid_N" 
    504         i = i + 1; fields(i)%vname="sshb_e";         fields(i)%grid="grid_N" 
    505         i = i + 1; fields(i)%vname="ub_e";           fields(i)%grid="grid_N" 
    506         i = i + 1; fields(i)%vname="vb_e";           fields(i)%grid="grid_N" 
    507         i = i + 1; fields(i)%vname="fwf_isf_b";      fields(i)%grid="grid_N" 
    508         i = i + 1; fields(i)%vname="isf_sc_b";       fields(i)%grid="grid_N" 
    509         i = i + 1; fields(i)%vname="isf_hc_b";       fields(i)%grid="grid_N" 
    510         i = i + 1; fields(i)%vname="ssh_ibb";        fields(i)%grid="grid_N" 
    511         i = i + 1; fields(i)%vname="rnf_b";          fields(i)%grid="grid_N" 
    512         i = i + 1; fields(i)%vname="rnf_hc_b";       fields(i)%grid="grid_N" 
    513         i = i + 1; fields(i)%vname="rnf_sc_b";       fields(i)%grid="grid_N" 
    514         i = i + 1; fields(i)%vname="nn_fsbc";        fields(i)%grid="grid_scalar" 
    515         i = i + 1; fields(i)%vname="ssu_m";          fields(i)%grid="grid_N" 
    516         i = i + 1; fields(i)%vname="ssv_m";          fields(i)%grid="grid_N" 
    517         i = i + 1; fields(i)%vname="sst_m";          fields(i)%grid="grid_N" 
    518         i = i + 1; fields(i)%vname="sss_m";          fields(i)%grid="grid_N" 
    519         i = i + 1; fields(i)%vname="ssh_m";          fields(i)%grid="grid_N" 
    520         i = i + 1; fields(i)%vname="e3t_m";          fields(i)%grid="grid_N" 
    521         i = i + 1; fields(i)%vname="frq_m";          fields(i)%grid="grid_N" 
    522         i = i + 1; fields(i)%vname="avmb";           fields(i)%grid="grid_vector" 
    523         i = i + 1; fields(i)%vname="avtb";           fields(i)%grid="grid_vector" 
    524         i = i + 1; fields(i)%vname="ub2_i_b";        fields(i)%grid="grid_N" 
    525         i = i + 1; fields(i)%vname="vb2_i_b";        fields(i)%grid="grid_N" 
    526         i = i + 1; fields(i)%vname="ntime";          fields(i)%grid="grid_scalar" 
    527         i = i + 1; fields(i)%vname="Dsst";           fields(i)%grid="grid_scalar" 
    528         i = i + 1; fields(i)%vname="tmask";          fields(i)%grid="grid_N_3D" 
    529         i = i + 1; fields(i)%vname="umask";          fields(i)%grid="grid_N_3D" 
    530         i = i + 1; fields(i)%vname="vmask";          fields(i)%grid="grid_N_3D" 
    531         i = i + 1; fields(i)%vname="smask";          fields(i)%grid="grid_N_3D" 
    532         i = i + 1; fields(i)%vname="gdepw_n";        fields(i)%grid="grid_N_3D" 
    533         i = i + 1; fields(i)%vname="e3t_n";          fields(i)%grid="grid_N_3D" 
    534         i = i + 1; fields(i)%vname="e3u_n";          fields(i)%grid="grid_N_3D" 
    535         i = i + 1; fields(i)%vname="e3v_n";          fields(i)%grid="grid_N_3D" 
    536         i = i + 1; fields(i)%vname="surf_ini";       fields(i)%grid="grid_N" 
    537         i = i + 1; fields(i)%vname="e3t_b";          fields(i)%grid="grid_N_3D" 
    538         i = i + 1; fields(i)%vname="hmxl_n";         fields(i)%grid="grid_N_3D" 
    539         i = i + 1; fields(i)%vname="un_bf";          fields(i)%grid="grid_N" 
    540         i = i + 1; fields(i)%vname="vn_bf";          fields(i)%grid="grid_N" 
    541         i = i + 1; fields(i)%vname="hbl";            fields(i)%grid="grid_N" 
    542         i = i + 1; fields(i)%vname="hbli";           fields(i)%grid="grid_N" 
    543         i = i + 1; fields(i)%vname="wn";             fields(i)%grid="grid_N_3D" 
    544  
    545         IF( i-1 > max_rst_fields) THEN 
    546            WRITE(ctmp1,*) 'E R R O R : iom_set_rst_vars SIZE of RST_FIELD array is too small' 
    547            CALL ctl_stop( 'iom_set_rst_vars:', ctmp1 ) 
    548         ENDIF 
    549    END SUBROUTINE iom_set_rst_vars 
    550  
    551  
    552    SUBROUTINE iom_set_rstw_active(cdrst_file) 
     456      IF(lwp) WRITE(numout,*) 'Setting restart filename (for XIOS write) to: ', TRIM(cdrst_file) 
     457      CALL xios_get_handle("file_definition", filegroup_hdl ) 
     458      CALL xios_add_child(filegroup_hdl, file_hdl, 'wrestart') 
     459      IF(nxioso.eq.1) THEN  
     460         CALL xios_set_file_attr( "wrestart", type="one_file", enabled=.TRUE.,&  
     461                                       mode="write", output_freq=xios_timestep)  
     462         IF(lwp) write(numout,*) 'OPEN ', trim(cdrst_file), ' in one_file mode'  
     463      ELSE   
     464         CALL xios_set_file_attr( "wrestart", type="multiple_file", enabled=.TRUE.,&  
     465                                            mode="write", output_freq=xios_timestep)  
     466         IF(lwp) write(numout,*) 'OPEN ', trim(cdrst_file), ' in multiple_file mode'  
     467      ENDIF  
     468      CALL xios_set_file_attr( "wrestart", name=trim(cdrst_file)) 
     469#endif 
     470   END SUBROUTINE iom_set_rstw_file 
     471 
     472 
     473   SUBROUTINE iom_set_rstw_active(sdfield, rd0, rs0, rd1, rs1, rd2, rs2, rd3, rs3) 
    553474      !!--------------------------------------------------------------------- 
    554475      !!                   ***  SUBROUTINE iom_set_rstw_active   *** 
     
    558479      !!--------------------------------------------------------------------- 
    559480!sets enabled = .TRUE. for each field in restart file 
    560    CHARACTER(len=*) :: cdrst_file 
     481      CHARACTER(len = *), INTENT(IN)                     :: sdfield 
     482      REAL(dp), OPTIONAL, INTENT(IN)                     :: rd0 
     483      REAL(sp), OPTIONAL, INTENT(IN)                     :: rs0 
     484      REAL(dp), OPTIONAL, INTENT(IN), DIMENSION(:)       :: rd1 
     485      REAL(sp), OPTIONAL, INTENT(IN), DIMENSION(:)       :: rs1 
     486      REAL(dp), OPTIONAL, INTENT(IN), DIMENSION(:, :)    :: rd2 
     487      REAL(sp), OPTIONAL, INTENT(IN), DIMENSION(:, :)    :: rs2 
     488      REAL(dp), OPTIONAL, INTENT(IN), DIMENSION(:, :, :) :: rd3   
     489      REAL(sp), OPTIONAL, INTENT(IN), DIMENSION(:, :, :) :: rs3 
    561490#if defined key_iomput 
    562    TYPE(xios_field) :: field_hdl 
    563    TYPE(xios_file) :: file_hdl 
    564    TYPE(xios_filegroup) :: filegroup_hdl 
    565    INTEGER :: i 
    566    CHARACTER(lc)  ::   clpath 
    567  
    568 !set name of the restart file and enable available fields 
    569         IF(lwp) WRITE(numout,*) 'Setting restart filename (for XIOS write) to: ',cdrst_file 
    570         CALL xios_get_handle("file_definition", filegroup_hdl ) 
    571         CALL xios_add_child(filegroup_hdl, file_hdl, 'wrestart') 
    572         IF(nxioso.eq.1) THEN  
    573            CALL xios_set_file_attr( "wrestart", type="one_file", enabled=.TRUE.,&  
    574                                     mode="write", output_freq=xios_timestep)  
    575            if(lwp) write(numout,*) 'OPEN ', trim(cdrst_file), ' in one_file mode'  
    576         ELSE   
    577            CALL xios_set_file_attr( "wrestart", type="multiple_file", enabled=.TRUE.,&  
    578                                     mode="write", output_freq=xios_timestep)  
    579            if(lwp) write(numout,*) 'OPEN ', trim(cdrst_file), ' in multiple_file mode'  
    580         ENDIF  
    581         CALL xios_set_file_attr( "wrestart", name=trim(cdrst_file)) 
     491      TYPE(xios_field) :: field_hdl 
     492      TYPE(xios_file) :: file_hdl 
     493 
     494      CALL xios_get_handle("wrestart", file_hdl) 
    582495!define fields for restart context 
    583         DO i = 1, max_rst_fields 
    584          IF( rst_wfields(i)%active ) THEN 
    585                 CALL xios_add_child(file_hdl, field_hdl, TRIM(rst_wfields(i)%vname)) 
    586                 SELECT CASE (TRIM(rst_wfields(i)%grid)) 
    587                  CASE ("grid_N_3D") 
    588                     CALL xios_set_attr (field_hdl, enabled = .TRUE., name = TRIM(rst_wfields(i)%vname), & 
    589                         domain_ref="grid_N", axis_ref="nav_lev", prec = 8, operation = "instant") 
    590                  CASE ("grid_N") 
    591                     CALL xios_set_attr (field_hdl, enabled = .TRUE., name = TRIM(rst_wfields(i)%vname), & 
    592                         domain_ref="grid_N", prec = 8, operation = "instant")  
    593                  CASE ("grid_vector") 
    594                     CALL xios_set_attr (field_hdl, enabled = .TRUE., name = TRIM(rst_wfields(i)%vname), & 
    595                          axis_ref="nav_lev", prec = 8, operation = "instant") 
    596                  CASE ("grid_scalar") 
    597                     CALL xios_set_attr (field_hdl, enabled = .TRUE., name = TRIM(rst_wfields(i)%vname), & 
    598                         scalar_ref = "grid_scalar", prec = 8, operation = "instant") 
    599                 END SELECT 
    600          ENDIF 
    601         END DO 
     496      CALL xios_add_child(file_hdl, field_hdl, sdfield) 
     497 
     498      IF(PRESENT(rd3)) THEN 
     499         CALL xios_set_attr (field_hdl, enabled = .TRUE., name = sdfield, & 
     500                             domain_ref = "grid_N",                       & 
     501                             axis_ref = iom_axis(size(rd3, 3)),           & 
     502                             prec = 8, operation = "instant"              ) 
     503      ELSEIF(PRESENT(rs3)) THEN 
     504         CALL xios_set_attr (field_hdl, enabled = .TRUE., name = sdfield, & 
     505                             domain_ref = "grid_N",                       & 
     506                             axis_ref = iom_axis(size(rd3, 3)),           & 
     507                             prec = 4, operation = "instant"              ) 
     508      ELSEIF(PRESENT(rd2)) THEN 
     509         CALL xios_set_attr (field_hdl, enabled = .TRUE., name = sdfield, & 
     510                             domain_ref = "grid_N", prec = 8,             & 
     511                             operation = "instant"                        )  
     512      ELSEIF(PRESENT(rs2)) THEN 
     513         CALL xios_set_attr (field_hdl, enabled = .TRUE., name = sdfield, & 
     514                             domain_ref = "grid_N", prec = 4,             & 
     515                             operation = "instant"                        ) 
     516      ELSEIF(PRESENT(rd1)) THEN 
     517         CALL xios_set_attr (field_hdl, enabled = .TRUE., name = sdfield, & 
     518                             axis_ref = iom_axis(size(rd1, 1)),           & 
     519                             prec = 8, operation = "instant"              ) 
     520      ELSEIF(PRESENT(rs1)) THEN 
     521         CALL xios_set_attr (field_hdl, enabled = .TRUE., name = sdfield, & 
     522                             axis_ref = iom_axis(size(rd1, 1)),           & 
     523                             prec = 4, operation = "instant"              ) 
     524      ELSEIF(PRESENT(rd0)) THEN 
     525         CALL xios_set_attr (field_hdl, enabled = .TRUE., name = sdfield, & 
     526                             scalar_ref = "grid_scalar", prec = 8,        & 
     527                             operation = "instant"                        ) 
     528      ELSEIF(PRESENT(rs0)) THEN 
     529         CALL xios_set_attr (field_hdl, enabled = .TRUE., name = sdfield, & 
     530                             scalar_ref = "grid_scalar", prec = 4,        & 
     531                             operation = "instant"                        ) 
     532      ENDIF 
    602533#endif 
    603534   END SUBROUTINE iom_set_rstw_active 
    604535 
     536   FUNCTION iom_axis(idlev) result(axis_ref) 
     537      !!--------------------------------------------------------------------- 
     538      !!                   ***  FUNCTION  iom_axis  *** 
     539      !! 
     540      !! ** Purpose : Used for grid definition when XIOS is used to read/write 
     541      !!              restart. Returns axis corresponding to the number of levels 
     542      !!              given as an input variable. Axes are defined in routine  
     543      !!              iom_set_rst_context 
     544      !!--------------------------------------------------------------------- 
     545      INTEGER, INTENT(IN) :: idlev 
     546      CHARACTER(len=lc)   :: axis_ref 
     547      CHARACTER(len=12)   :: str 
     548      IF(idlev == jpk) THEN 
     549         axis_ref="nav_lev" 
     550#if defined key_si3 
     551      ELSEIF(idlev == jpl) THEN 
     552         axis_ref="numcat" 
     553#endif          
     554      ELSE 
     555         write(str, *) idlev 
     556         CALL ctl_stop( 'iom_axis', 'Definition for axis with '//TRIM(ADJUSTL(str))//' levels missing') 
     557      ENDIF 
     558   END FUNCTION iom_axis 
     559 
     560   FUNCTION iom_xios_setid(cdname) result(kid) 
     561     !!--------------------------------------------------------------------- 
     562      !!                   ***  FUNCTION    *** 
     563      !! 
     564      !! ** Purpose : this function returns first available id to keep information about file  
     565      !!              sets filename in iom_file structure and sets name 
     566      !!              of XIOS context depending on cdcomp 
     567      !!              corresponds to iom_nf90_open 
     568      !!--------------------------------------------------------------------- 
     569      CHARACTER(len=*), INTENT(in   ) :: cdname      ! File name 
     570      INTEGER                         :: kid      ! identifier of the opened file 
     571      INTEGER                         :: jl 
     572 
     573      kid = 0 
     574      DO jl = jpmax_files, 1, -1 
     575         IF( iom_file(jl)%nfid == 0 )   kid = jl 
     576      ENDDO 
     577 
     578      iom_file(kid)%name   = TRIM(cdname) 
     579      iom_file(kid)%nfid   = 1 
     580      iom_file(kid)%nvars  = 0 
     581      iom_file(kid)%irec   = -1 
     582 
     583   END FUNCTION iom_xios_setid 
     584 
    605585   SUBROUTINE iom_set_rst_context(ld_rstr)  
    606      !!--------------------------------------------------------------------- 
     586      !!--------------------------------------------------------------------- 
    607587      !!                   ***  SUBROUTINE  iom_set_rst_context  *** 
    608588      !! 
     
    611591      !!                
    612592      !!--------------------------------------------------------------------- 
    613    LOGICAL, INTENT(IN)               :: ld_rstr 
    614 !ld_rstr is true for restart context. There is no need to define grid for  
    615 !restart read, because it's read from file 
     593      LOGICAL, INTENT(IN)               :: ld_rstr 
     594      INTEGER :: ji 
    616595#if defined key_iomput 
    617    TYPE(xios_domaingroup)            :: domaingroup_hdl  
    618    TYPE(xios_domain)                 :: domain_hdl  
    619    TYPE(xios_axisgroup)              :: axisgroup_hdl  
    620    TYPE(xios_axis)                   :: axis_hdl  
    621    TYPE(xios_scalar)                 :: scalar_hdl  
    622    TYPE(xios_scalargroup)            :: scalargroup_hdl  
    623  
    624      CALL xios_get_handle("domain_definition",domaingroup_hdl)  
    625      CALL xios_add_child(domaingroup_hdl, domain_hdl, "grid_N")  
    626      CALL set_grid("N", glamt, gphit, .TRUE., ld_rstr)  
     596      TYPE(xios_domaingroup)            :: domaingroup_hdl  
     597      TYPE(xios_domain)                 :: domain_hdl  
     598      TYPE(xios_axisgroup)              :: axisgroup_hdl  
     599      TYPE(xios_axis)                   :: axis_hdl  
     600      TYPE(xios_scalar)                 :: scalar_hdl  
     601      TYPE(xios_scalargroup)            :: scalargroup_hdl  
     602 
     603      CALL xios_get_handle("domain_definition",domaingroup_hdl)  
     604      CALL xios_add_child(domaingroup_hdl, domain_hdl, "grid_N")  
     605      CALL set_grid("N", glamt, gphit, .TRUE., ld_rstr)  
    627606  
    628      CALL xios_get_handle("axis_definition",axisgroup_hdl)  
    629      CALL xios_add_child(axisgroup_hdl, axis_hdl, "nav_lev")  
     607      CALL xios_get_handle("axis_definition",axisgroup_hdl)  
     608      CALL xios_add_child(axisgroup_hdl, axis_hdl, "nav_lev")  
    630609!AGRIF fails to compile when unit= is in call to xios_set_axis_attr 
    631 !    CALL xios_set_axis_attr( "nav_lev", long_name="Vertical levels",  unit="m", positive="down")  
    632      CALL xios_set_axis_attr( "nav_lev", long_name="Vertical levels in meters", positive="down") 
    633      CALL iom_set_axis_attr( "nav_lev", paxis = gdept_1d )  
    634  
    635      CALL xios_get_handle("scalar_definition", scalargroup_hdl)  
    636      CALL xios_add_child(scalargroup_hdl, scalar_hdl, "grid_scalar")  
     610!     CALL xios_set_axis_attr( "nav_lev", long_name="Vertical levels",  unit="m", positive="down")  
     611      CALL xios_set_axis_attr( "nav_lev", long_name = "Vertical levels in meters", positive = "down") 
     612      CALL iom_set_axis_attr( "nav_lev", paxis = gdept_1d )  
     613#if defined key_si3 
     614      CALL xios_add_child(axisgroup_hdl, axis_hdl, "numcat") 
     615      CALL iom_set_axis_attr( "numcat", (/ (REAL(ji,wp), ji=1,jpl) /) ) 
     616#endif 
     617      CALL xios_get_handle("scalar_definition", scalargroup_hdl)  
     618      CALL xios_add_child(scalargroup_hdl, scalar_hdl, "grid_scalar")  
    637619#endif 
    638620   END SUBROUTINE iom_set_rst_context 
     621 
     622 
     623   SUBROUTINE set_xios_context(kdid, cdcont)  
     624      !!--------------------------------------------------------------------- 
     625      !!                   ***  SUBROUTINE  iom_set_rst_context  *** 
     626      !! 
     627      !! ** Purpose : set correct XIOS context based on kdid 
     628      !!                
     629      !!--------------------------------------------------------------------- 
     630      INTEGER,           INTENT(IN)     :: kdid           ! Identifier of the file 
     631      CHARACTER(LEN=lc), INTENT(OUT)    :: cdcont         ! name of the context for XIOS read/write 
     632       
     633      cdcont = "NONE" 
     634 
     635      IF(lrxios) THEN 
     636         IF(kdid == numror) THEN 
     637            cdcont = cr_ocerst_cxt 
     638         ELSEIF(kdid == numrir) THEN 
     639            cdcont = cr_icerst_cxt  
     640         ELSEIF(kdid == numrtr) THEN 
     641            cdcont = cr_toprst_cxt 
     642         ELSEIF(kdid == numrsr) THEN 
     643            cdcont = cr_sedrst_cxt 
     644         ENDIF 
     645      ENDIF 
     646 
     647      IF(lwxios) THEN 
     648         IF(kdid == numrow) THEN 
     649            cdcont = cw_ocerst_cxt 
     650         ELSEIF(kdid == numriw) THEN 
     651            cdcont = cw_icerst_cxt 
     652         ELSEIF(kdid == numrtw) THEN 
     653            cdcont = cw_toprst_cxt 
     654         ELSEIF(kdid == numrsw) THEN 
     655            cdcont = cw_sedrst_cxt 
     656         ENDIF 
     657      ENDIF 
     658   END SUBROUTINE set_xios_context 
     659 
    639660 
    640661   SUBROUTINE iom_swap( cdname ) 
     
    647668#if defined key_iomput 
    648669      TYPE(xios_context) :: nemo_hdl 
    649  
    650670      IF( TRIM(Agrif_CFixed()) == '0' ) THEN 
    651671        CALL xios_get_handle(TRIM(cdname),nemo_hdl) 
     
    897917   !!                   INTERFACE iom_get 
    898918   !!---------------------------------------------------------------------- 
    899    SUBROUTINE iom_g0d_sp( kiomid, cdvar, pvar, ktime, ldxios ) 
     919   SUBROUTINE iom_g0d_sp( kiomid, cdvar, pvar, ktime ) 
    900920      INTEGER         , INTENT(in   )                 ::   kiomid    ! Identifier of the file 
    901921      CHARACTER(len=*), INTENT(in   )                 ::   cdvar     ! Name of the variable 
     
    903923      REAL(dp)                                        ::   ztmp_pvar ! tmp var to read field 
    904924      INTEGER         , INTENT(in   ),     OPTIONAL   ::   ktime     ! record number 
    905       LOGICAL         , INTENT(in   ),     OPTIONAL   ::   ldxios    ! use xios to read restart 
    906925      ! 
    907926      INTEGER                                         ::   idvar     ! variable id 
     
    911930      CHARACTER(LEN=100)                              ::   clname    ! file name 
    912931      CHARACTER(LEN=1)                                ::   cldmspc   ! 
    913       LOGICAL                                         ::   llxios 
    914       ! 
    915       llxios = .FALSE. 
    916       IF( PRESENT(ldxios) ) llxios = ldxios 
    917  
    918       IF(.NOT.llxios) THEN  ! read data using default library 
     932      CHARACTER(LEN=lc)                               ::   context 
     933      ! 
     934      CALL set_xios_context(kiomid, context) 
     935 
     936      IF(context == "NONE") THEN  ! read data using default library 
    919937         itime = 1 
    920938         IF( PRESENT(ktime) ) itime = ktime 
     
    939957#if defined key_iomput 
    940958         IF(lwp) WRITE(numout,*) 'XIOS RST READ (0D): ', trim(cdvar) 
    941          CALL iom_swap( TRIM(crxios_context) ) 
     959         CALL iom_swap(context) 
    942960         CALL xios_recv_field( trim(cdvar), pvar) 
    943          CALL iom_swap( TRIM(cxios_context) ) 
     961         CALL iom_swap(cxios_context) 
    944962#else 
    945963         WRITE(ctmp1,*) 'Can not use XIOS in iom_g0d, file: '//trim(clname)//', var:'//trim(cdvar) 
     
    949967   END SUBROUTINE iom_g0d_sp 
    950968 
    951    SUBROUTINE iom_g0d_dp( kiomid, cdvar, pvar, ktime, ldxios ) 
     969   SUBROUTINE iom_g0d_dp( kiomid, cdvar, pvar, ktime ) 
    952970      INTEGER         , INTENT(in   )                 ::   kiomid    ! Identifier of the file 
    953971      CHARACTER(len=*), INTENT(in   )                 ::   cdvar     ! Name of the variable 
    954972      REAL(dp)        , INTENT(  out)                 ::   pvar      ! read field 
    955973      INTEGER         , INTENT(in   ),     OPTIONAL   ::   ktime     ! record number 
    956       LOGICAL         , INTENT(in   ),     OPTIONAL   ::   ldxios    ! use xios to read restart 
    957974      ! 
    958975      INTEGER                                         ::   idvar     ! variable id 
     
    962979      CHARACTER(LEN=100)                              ::   clname    ! file name 
    963980      CHARACTER(LEN=1)                                ::   cldmspc   ! 
    964       LOGICAL                                         ::   llxios 
    965       ! 
    966       llxios = .FALSE. 
    967       IF( PRESENT(ldxios) ) llxios = ldxios 
    968  
    969       IF(.NOT.llxios) THEN  ! read data using default library 
     981      CHARACTER(LEN=lc)                               ::   context 
     982      ! 
     983      CALL set_xios_context(kiomid, context) 
     984 
     985      IF(context == "NONE") THEN  ! read data using default library 
    970986         itime = 1 
    971987         IF( PRESENT(ktime) ) itime = ktime 
     
    9891005#if defined key_iomput 
    9901006         IF(lwp) WRITE(numout,*) 'XIOS RST READ (0D): ', trim(cdvar) 
    991          CALL iom_swap( TRIM(crxios_context) ) 
     1007         CALL iom_swap(context) 
    9921008         CALL xios_recv_field( trim(cdvar), pvar) 
    993          CALL iom_swap( TRIM(cxios_context) ) 
     1009         CALL iom_swap(cxios_context) 
    9941010#else 
    9951011         WRITE(ctmp1,*) 'Can not use XIOS in iom_g0d, file: '//trim(clname)//', var:'//trim(cdvar) 
     
    9991015   END SUBROUTINE iom_g0d_dp 
    10001016 
    1001    SUBROUTINE iom_g1d_sp( kiomid, kdom, cdvar, pvar, ktime, kstart, kcount, ldxios ) 
     1017   SUBROUTINE iom_g1d_sp( kiomid, kdom, cdvar, pvar, ktime, kstart, kcount ) 
    10021018      INTEGER         , INTENT(in   )                         ::   kiomid    ! Identifier of the file 
    10031019      INTEGER         , INTENT(in   )                         ::   kdom      ! Type of domain to be read 
     
    10081024      INTEGER         , INTENT(in   ), DIMENSION(1), OPTIONAL ::   kstart    ! start axis position of the reading  
    10091025      INTEGER         , INTENT(in   ), DIMENSION(1), OPTIONAL ::   kcount    ! number of points in each axis 
    1010       LOGICAL         , INTENT(in   ),               OPTIONAL ::   ldxios    ! read data using XIOS 
    10111026      ! 
    10121027      IF( kiomid > 0 ) THEN 
     
    10141029            ALLOCATE(ztmp_pvar(size(pvar,1))) 
    10151030            CALL iom_get_123d( kiomid, kdom       , cdvar        , pv_r1d=ztmp_pvar,   & 
    1016               &                                                     ktime=ktime, kstart=kstart, kcount=kcount, & 
    1017               &                                                     ldxios=ldxios ) 
     1031              &                                                     ktime=ktime, kstart=kstart, kcount=kcount ) 
    10181032            pvar = ztmp_pvar 
    10191033            DEALLOCATE(ztmp_pvar) 
     
    10231037 
    10241038 
    1025    SUBROUTINE iom_g1d_dp( kiomid, kdom, cdvar, pvar, ktime, kstart, kcount, ldxios ) 
     1039   SUBROUTINE iom_g1d_dp( kiomid, kdom, cdvar, pvar, ktime, kstart, kcount ) 
    10261040      INTEGER         , INTENT(in   )                         ::   kiomid    ! Identifier of the file 
    10271041      INTEGER         , INTENT(in   )                         ::   kdom      ! Type of domain to be read 
     
    10311045      INTEGER         , INTENT(in   ), DIMENSION(1), OPTIONAL ::   kstart    ! start axis position of the reading  
    10321046      INTEGER         , INTENT(in   ), DIMENSION(1), OPTIONAL ::   kcount    ! number of points in each axis 
    1033       LOGICAL         , INTENT(in   ),               OPTIONAL ::   ldxios    ! read data using XIOS 
    10341047      ! 
    10351048      IF( kiomid > 0 ) THEN 
    10361049         IF( iom_file(kiomid)%nfid > 0 ) CALL iom_get_123d( kiomid, kdom       , cdvar        , pv_r1d=pvar,   & 
    1037               &                                                     ktime=ktime, kstart=kstart, kcount=kcount, & 
    1038               &                                                     ldxios=ldxios ) 
     1050              &                                                     ktime=ktime, kstart=kstart, kcount=kcount) 
    10391051      ENDIF 
    10401052   END SUBROUTINE iom_g1d_dp 
    10411053 
    1042    SUBROUTINE iom_g2d_sp( kiomid, kdom, cdvar, pvar, ktime, cd_type, psgn, kfill, kstart, kcount, ldxios) 
     1054   SUBROUTINE iom_g2d_sp( kiomid, kdom, cdvar, pvar, ktime, cd_type, psgn, kfill, kstart, kcount) 
    10431055      INTEGER         , INTENT(in   )                         ::   kiomid    ! Identifier of the file 
    10441056      INTEGER         , INTENT(in   )                         ::   kdom      ! Type of domain to be read 
     
    10521064      INTEGER         , INTENT(in   ), DIMENSION(2), OPTIONAL ::   kstart    ! start axis position of the reading  
    10531065      INTEGER         , INTENT(in   ), DIMENSION(2), OPTIONAL ::   kcount    ! number of points in each axis 
    1054       LOGICAL         , INTENT(in   ),               OPTIONAL ::   ldxios    ! read data using XIOS 
    10551066      ! 
    10561067      IF( kiomid > 0 ) THEN 
     
    10591070            CALL iom_get_123d( kiomid, kdom, cdvar      , pv_r2d = ztmp_pvar  , ktime = ktime,   & 
    10601071             &                                                      cd_type = cd_type, psgn   = psgn  , kfill = kfill,   & 
    1061              &                                                      kstart  = kstart , kcount = kcount, ldxios=ldxios  ) 
     1072             &                                                      kstart  = kstart , kcount = kcount  ) 
    10621073            pvar = ztmp_pvar 
    10631074            DEALLOCATE(ztmp_pvar) 
     
    10661077   END SUBROUTINE iom_g2d_sp 
    10671078 
    1068    SUBROUTINE iom_g2d_dp( kiomid, kdom, cdvar, pvar, ktime, cd_type, psgn, kfill, kstart, kcount, ldxios) 
     1079   SUBROUTINE iom_g2d_dp( kiomid, kdom, cdvar, pvar, ktime, cd_type, psgn, kfill, kstart, kcount) 
    10691080      INTEGER         , INTENT(in   )                         ::   kiomid    ! Identifier of the file 
    10701081      INTEGER         , INTENT(in   )                         ::   kdom      ! Type of domain to be read 
     
    10771088      INTEGER         , INTENT(in   ), DIMENSION(2), OPTIONAL ::   kstart    ! start axis position of the reading  
    10781089      INTEGER         , INTENT(in   ), DIMENSION(2), OPTIONAL ::   kcount    ! number of points in each axis 
    1079       LOGICAL         , INTENT(in   ),               OPTIONAL ::   ldxios    ! read data using XIOS 
    10801090      ! 
    10811091      IF( kiomid > 0 ) THEN 
    10821092         IF( iom_file(kiomid)%nfid > 0 ) CALL iom_get_123d( kiomid, kdom, cdvar      , pv_r2d = pvar  , ktime = ktime,   & 
    10831093            &                                                       cd_type = cd_type, psgn   = psgn  , kfill = kfill,   & 
    1084             &                                                       kstart  = kstart , kcount = kcount, ldxios=ldxios  ) 
     1094            &                                                       kstart  = kstart , kcount = kcount                ) 
    10851095      ENDIF 
    10861096   END SUBROUTINE iom_g2d_dp 
    10871097 
    1088    SUBROUTINE iom_g3d_sp( kiomid, kdom, cdvar, pvar, ktime, cd_type, psgn, kfill, kstart, kcount, ldxios ) 
     1098   SUBROUTINE iom_g3d_sp( kiomid, kdom, cdvar, pvar, ktime, cd_type, psgn, kfill, kstart, kcount ) 
    10891099      INTEGER         , INTENT(in   )                         ::   kiomid    ! Identifier of the file 
    10901100      INTEGER         , INTENT(in   )                         ::   kdom      ! Type of domain to be read 
     
    10981108      INTEGER         , INTENT(in   ), DIMENSION(3), OPTIONAL ::   kstart    ! start axis position of the reading  
    10991109      INTEGER         , INTENT(in   ), DIMENSION(3), OPTIONAL ::   kcount    ! number of points in each axis 
    1100       LOGICAL         , INTENT(in   ),               OPTIONAL ::   ldxios    ! read data using XIOS 
    11011110      ! 
    11021111      IF( kiomid > 0 ) THEN 
     
    11051114            CALL iom_get_123d( kiomid, kdom, cdvar      , pv_r3d = ztmp_pvar  , ktime = ktime,   & 
    11061115            &                                                       cd_type = cd_type, psgn   = psgn  , kfill = kfill,   & 
    1107             &                                                       kstart  = kstart , kcount = kcount, ldxios=ldxios  ) 
     1116            &                                                       kstart  = kstart , kcount = kcount                ) 
    11081117            pvar = ztmp_pvar 
    11091118            DEALLOCATE(ztmp_pvar) 
     
    11121121   END SUBROUTINE iom_g3d_sp 
    11131122 
    1114    SUBROUTINE iom_g3d_dp( kiomid, kdom, cdvar, pvar, ktime, cd_type, psgn, kfill, kstart, kcount, ldxios ) 
     1123   SUBROUTINE iom_g3d_dp( kiomid, kdom, cdvar, pvar, ktime, cd_type, psgn, kfill, kstart, kcount ) 
    11151124      INTEGER         , INTENT(in   )                         ::   kiomid    ! Identifier of the file 
    11161125      INTEGER         , INTENT(in   )                         ::   kdom      ! Type of domain to be read 
     
    11231132      INTEGER         , INTENT(in   ), DIMENSION(3), OPTIONAL ::   kstart    ! start axis position of the reading  
    11241133      INTEGER         , INTENT(in   ), DIMENSION(3), OPTIONAL ::   kcount    ! number of points in each axis 
    1125       LOGICAL         , INTENT(in   ),               OPTIONAL ::   ldxios    ! read data using XIOS 
    11261134      ! 
    11271135      IF( kiomid > 0 ) THEN 
     
    11291137            CALL iom_get_123d( kiomid, kdom, cdvar      , pv_r3d = pvar  , ktime = ktime,   & 
    11301138            &                                                       cd_type = cd_type, psgn   = psgn  , kfill = kfill,   & 
    1131             &                                                       kstart  = kstart , kcount = kcount, ldxios=ldxios  ) 
     1139            &                                                       kstart  = kstart , kcount = kcount                ) 
    11321140         END IF 
    11331141      ENDIF 
     
    11371145 
    11381146   SUBROUTINE iom_get_123d( kiomid , kdom, cdvar, pv_r1d, pv_r2d, pv_r3d, ktime ,   & 
    1139          &                  cd_type, psgn, kfill, kstart, kcount, ldxios ) 
     1147         &                  cd_type, psgn, kfill, kstart, kcount ) 
    11401148      !!----------------------------------------------------------------------- 
    11411149      !!                  ***  ROUTINE  iom_get_123d  *** 
     
    11571165      INTEGER , DIMENSION(:)     , INTENT(in   ), OPTIONAL ::   kstart    ! start position of the reading in each axis  
    11581166      INTEGER , DIMENSION(:)     , INTENT(in   ), OPTIONAL ::   kcount    ! number of points to be read in each axis 
    1159       LOGICAL                    , INTENT(in   ), OPTIONAL ::   ldxios    ! use XIOS to read restart 
    11601167      ! 
    11611168      LOGICAL                        ::   llok        ! true if ok! 
    1162       LOGICAL                        ::   llxios      ! local definition for XIOS read 
    11631169      INTEGER                        ::   jl          ! loop on number of dimension  
    11641170      INTEGER                        ::   idom        ! type of domain 
     
    11871193      REAL(dp)                       ::   gma, gmi 
    11881194      !--------------------------------------------------------------------- 
    1189       ! 
     1195      CHARACTER(LEN=lc)                               ::   context 
     1196      ! 
     1197      CALL set_xios_context(kiomid, context) 
    11901198      inlev = -1 
    11911199      IF( PRESENT(pv_r3d) )   inlev = SIZE(pv_r3d, 3) 
    11921200      ! 
    1193       llxios = .FALSE. 
    1194       IF( PRESENT(ldxios) )   llxios = ldxios 
    1195       ! 
    11961201      idom = kdom 
    11971202      istop = nstop 
    11981203      ! 
    1199       IF(.NOT.llxios) THEN 
     1204      IF(context == "NONE") THEN 
    12001205         clname = iom_file(kiomid)%name   !   esier to read 
    12011206         clinfo = '          iom_get_123d, file: '//trim(clname)//', var: '//trim(cdvar) 
     
    13641369#if defined key_iomput 
    13651370!would be good to be able to check which context is active and swap only if current is not restart 
    1366          CALL iom_swap( TRIM(crxios_context) )  
     1371         idvar = iom_varid( kiomid, cdvar ) 
     1372         CALL iom_swap(context) 
     1373         zsgn = 1._wp 
     1374         IF( PRESENT(psgn   ) )   zsgn    = psgn 
     1375         cl_type = 'T' 
     1376         IF( PRESENT(cd_type) )   cl_type = cd_type 
     1377 
    13671378         IF( PRESENT(pv_r3d) ) THEN 
    13681379            IF(lwp) WRITE(numout,*) 'XIOS RST READ (3D): ',TRIM(cdvar) 
    1369             CALL xios_recv_field( trim(cdvar), pv_r3d) 
    1370             IF(idom /= jpdom_unknown )   CALL lbc_lnk( 'iom', pv_r3d,'Z', -999., kfillmode = jpfillnothing) 
     1380            CALL xios_recv_field( trim(cdvar), pv_r3d(:, :, :)) 
     1381            IF(idom /= jpdom_unknown .AND. cl_type /= 'Z' ) THEN 
     1382               CALL lbc_lnk( 'iom', pv_r3d, cl_type, zsgn, kfillmode = kfill) 
     1383            ENDIF 
    13711384         ELSEIF( PRESENT(pv_r2d) ) THEN 
    13721385            IF(lwp) WRITE(numout,*) 'XIOS RST READ (2D): ', TRIM(cdvar) 
    1373             CALL xios_recv_field( trim(cdvar), pv_r2d) 
    1374             IF(idom /= jpdom_unknown )   CALL lbc_lnk('iom', pv_r2d,'Z',-999., kfillmode = jpfillnothing) 
     1386            CALL xios_recv_field( trim(cdvar), pv_r2d(:, :)) 
     1387            IF(idom /= jpdom_unknown .AND. cl_type /= 'Z' ) THEN 
     1388               CALL lbc_lnk('iom', pv_r2d, cl_type, zsgn, kfillmode = kfill) 
     1389            ENDIF 
    13751390         ELSEIF( PRESENT(pv_r1d) ) THEN 
    13761391            IF(lwp) WRITE(numout,*) 'XIOS RST READ (1D): ', TRIM(cdvar) 
    13771392            CALL xios_recv_field( trim(cdvar), pv_r1d) 
    13781393         ENDIF 
    1379          CALL iom_swap( TRIM(cxios_context) ) 
     1394         CALL iom_swap(cxios_context) 
    13801395#else 
    13811396         istop = istop + 1  
     
    13921407      zofs = iom_file(kiomid)%ofs(idvar)      ! offset 
    13931408      IF(     PRESENT(pv_r1d) ) THEN 
    1394          IF( zscf /= 1. )   pv_r1d(:) = pv_r1d(:) * zscf  
    1395          IF( zofs /= 0. )   pv_r1d(:) = pv_r1d(:) + zofs 
     1409         IF( zscf /= 1._wp )   pv_r1d(:) = pv_r1d(:) * zscf  
     1410         IF( zofs /= 0._wp )   pv_r1d(:) = pv_r1d(:) + zofs 
    13961411      ELSEIF( PRESENT(pv_r2d) ) THEN 
    1397          IF( zscf /= 1.)   pv_r2d(:,:) = pv_r2d(:,:) * zscf 
    1398          IF( zofs /= 0.)   pv_r2d(:,:) = pv_r2d(:,:) + zofs 
     1412         IF( zscf /= 1._wp)   pv_r2d(:,:) = pv_r2d(:,:) * zscf 
     1413         IF( zofs /= 0._wp)   pv_r2d(:,:) = pv_r2d(:,:) + zofs 
    13991414      ELSEIF( PRESENT(pv_r3d) ) THEN 
    1400          IF( zscf /= 1.)   pv_r3d(:,:,:) = pv_r3d(:,:,:) * zscf 
    1401          IF( zofs /= 0.)   pv_r3d(:,:,:) = pv_r3d(:,:,:) + zofs 
     1415         IF( zscf /= 1._wp)   pv_r3d(:,:,:) = pv_r3d(:,:,:) * zscf 
     1416         IF( zofs /= 0._wp)   pv_r3d(:,:,:) = pv_r3d(:,:,:) + zofs 
    14021417      ENDIF 
    14031418      ! 
     
    15731588   !!                   INTERFACE iom_rstput 
    15741589   !!---------------------------------------------------------------------- 
    1575    SUBROUTINE iom_rp0d_sp( kt, kwrite, kiomid, cdvar, pvar, ktype, ldxios ) 
     1590   SUBROUTINE iom_rp0d_sp( kt, kwrite, kiomid, cdvar, pvar, ktype ) 
    15761591      INTEGER         , INTENT(in)                         ::   kt       ! ocean time-step 
    15771592      INTEGER         , INTENT(in)                         ::   kwrite   ! writing time-step 
     
    15801595      REAL(sp)        , INTENT(in)                         ::   pvar     ! written field 
    15811596      INTEGER         , INTENT(in), OPTIONAL               ::   ktype    ! variable external type 
    1582       LOGICAL, OPTIONAL :: ldxios   ! xios write flag 
    1583       LOGICAL :: llx                ! local xios write flag 
    1584       INTEGER :: ivid   ! variable id 
    1585  
    1586       llx = .FALSE. 
    1587       IF(PRESENT(ldxios)) llx = ldxios 
     1597      ! 
     1598      LOGICAL           :: llx                ! local xios write flag 
     1599      INTEGER           :: ivid   ! variable id 
     1600      CHARACTER(LEN=lc) :: context 
     1601      ! 
     1602      CALL set_xios_context(kiomid, context) 
     1603 
     1604      llx = .NOT. (context == "NONE") 
     1605 
    15881606      IF( llx ) THEN 
    15891607#ifdef key_iomput 
    1590       IF( kt == kwrite ) THEN 
    1591           IF(lwp) write(numout,*) 'RESTART: write (XIOS 0D) ',trim(cdvar) 
    1592           CALL xios_send_field(trim(cdvar), pvar) 
    1593       ENDIF 
     1608         IF( kt == kwrite ) THEN 
     1609            IF(lwp) write(numout,*) 'RESTART: write (XIOS 0D) ',trim(cdvar) 
     1610            CALL iom_swap(context) 
     1611            CALL iom_put(trim(cdvar), pvar) 
     1612            CALL iom_swap(cxios_context) 
     1613         ELSE 
     1614            IF(lwp) write(numout,*) 'RESTART: define (XIOS 0D) ',trim(cdvar) 
     1615            CALL iom_swap(context) 
     1616            CALL iom_set_rstw_active( trim(cdvar), rs0 = pvar )  
     1617            CALL iom_swap(cxios_context) 
     1618         ENDIF 
    15941619#endif 
    15951620      ELSE 
     
    16031628   END SUBROUTINE iom_rp0d_sp 
    16041629 
    1605    SUBROUTINE iom_rp0d_dp( kt, kwrite, kiomid, cdvar, pvar, ktype, ldxios ) 
     1630   SUBROUTINE iom_rp0d_dp( kt, kwrite, kiomid, cdvar, pvar, ktype ) 
    16061631      INTEGER         , INTENT(in)                         ::   kt       ! ocean time-step 
    16071632      INTEGER         , INTENT(in)                         ::   kwrite   ! writing time-step 
     
    16101635      REAL(dp)        , INTENT(in)                         ::   pvar     ! written field 
    16111636      INTEGER         , INTENT(in), OPTIONAL               ::   ktype    ! variable external type 
    1612       LOGICAL, OPTIONAL :: ldxios   ! xios write flag 
    1613       LOGICAL :: llx                ! local xios write flag 
    1614       INTEGER :: ivid   ! variable id 
    1615  
    1616       llx = .FALSE. 
    1617       IF(PRESENT(ldxios)) llx = ldxios 
     1637      ! 
     1638      LOGICAL           :: llx                ! local xios write flag 
     1639      INTEGER           :: ivid   ! variable id 
     1640      CHARACTER(LEN=lc) :: context 
     1641      ! 
     1642      CALL set_xios_context(kiomid, context) 
     1643 
     1644      llx = .NOT. (context == "NONE") 
     1645 
    16181646      IF( llx ) THEN 
    16191647#ifdef key_iomput 
    1620       IF( kt == kwrite ) THEN 
    1621           IF(lwp) write(numout,*) 'RESTART: write (XIOS 0D) ',trim(cdvar) 
    1622           CALL xios_send_field(trim(cdvar), pvar) 
    1623       ENDIF 
     1648         IF( kt == kwrite ) THEN 
     1649            IF(lwp) write(numout,*) 'RESTART: write (XIOS 0D) ',trim(cdvar) 
     1650            CALL iom_swap(context) 
     1651            CALL iom_put(trim(cdvar), pvar) 
     1652            CALL iom_swap(cxios_context) 
     1653         ELSE 
     1654            IF(lwp) write(numout,*) 'RESTART: define (XIOS 0D) ',trim(cdvar) 
     1655            CALL iom_swap(context) 
     1656            CALL iom_set_rstw_active( trim(cdvar), rd0 = pvar )  
     1657            CALL iom_swap(cxios_context) 
     1658         ENDIF 
    16241659#endif 
    16251660      ELSE 
     
    16341669 
    16351670 
    1636    SUBROUTINE iom_rp1d_sp( kt, kwrite, kiomid, cdvar, pvar, ktype, ldxios ) 
     1671   SUBROUTINE iom_rp1d_sp( kt, kwrite, kiomid, cdvar, pvar, ktype ) 
    16371672      INTEGER         , INTENT(in)                         ::   kt       ! ocean time-step 
    16381673      INTEGER         , INTENT(in)                         ::   kwrite   ! writing time-step 
     
    16411676      REAL(sp)        , INTENT(in), DIMENSION(          :) ::   pvar     ! written field 
    16421677      INTEGER         , INTENT(in), OPTIONAL               ::   ktype    ! variable external type 
    1643       LOGICAL, OPTIONAL                                    ::   ldxios   ! xios write flag 
    1644       LOGICAL :: llx                ! local xios write flag 
    1645       INTEGER :: ivid   ! variable id 
    1646  
    1647       llx = .FALSE. 
    1648       IF(PRESENT(ldxios)) llx = ldxios 
     1678      ! 
     1679      LOGICAL           :: llx                ! local xios write flag 
     1680      INTEGER           :: ivid   ! variable id 
     1681      CHARACTER(LEN=lc) :: context 
     1682      ! 
     1683      CALL set_xios_context(kiomid, context) 
     1684 
     1685      llx = .NOT. (context == "NONE") 
     1686 
    16491687      IF( llx ) THEN 
    16501688#ifdef key_iomput 
    1651       IF( kt == kwrite ) THEN 
    1652          IF(lwp) write(numout,*) 'RESTART: write (XIOS 1D) ',trim(cdvar) 
    1653          CALL xios_send_field(trim(cdvar), pvar) 
    1654       ENDIF 
     1689         IF( kt == kwrite ) THEN 
     1690            IF(lwp) write(numout,*) 'RESTART: write (XIOS 1D) ',trim(cdvar) 
     1691            CALL iom_swap(context) 
     1692            CALL iom_put(trim(cdvar), pvar) 
     1693            CALL iom_swap(cxios_context) 
     1694         ELSE 
     1695            IF(lwp) write(numout,*) 'RESTART: define (XIOS 1D)',trim(cdvar) 
     1696            CALL iom_swap(context) 
     1697            CALL iom_set_rstw_active( trim(cdvar), rs1 = pvar ) 
     1698            CALL iom_swap(cxios_context) 
     1699         ENDIF 
    16551700#endif 
    16561701      ELSE 
     
    16641709   END SUBROUTINE iom_rp1d_sp 
    16651710 
    1666    SUBROUTINE iom_rp1d_dp( kt, kwrite, kiomid, cdvar, pvar, ktype, ldxios ) 
     1711   SUBROUTINE iom_rp1d_dp( kt, kwrite, kiomid, cdvar, pvar, ktype ) 
    16671712      INTEGER         , INTENT(in)                         ::   kt       ! ocean time-step 
    16681713      INTEGER         , INTENT(in)                         ::   kwrite   ! writing time-step 
     
    16711716      REAL(dp)        , INTENT(in), DIMENSION(          :) ::   pvar     ! written field 
    16721717      INTEGER         , INTENT(in), OPTIONAL               ::   ktype    ! variable external type 
    1673       LOGICAL, OPTIONAL                                    ::   ldxios   ! xios write flag 
    1674       LOGICAL :: llx                ! local xios write flag 
    1675       INTEGER :: ivid   ! variable id 
    1676  
    1677       llx = .FALSE. 
    1678       IF(PRESENT(ldxios)) llx = ldxios 
     1718      ! 
     1719      LOGICAL           :: llx                ! local xios write flag 
     1720      INTEGER           :: ivid   ! variable id 
     1721      CHARACTER(LEN=lc) :: context 
     1722      ! 
     1723      CALL set_xios_context(kiomid, context) 
     1724 
     1725      llx = .NOT. (context == "NONE") 
     1726 
    16791727      IF( llx ) THEN 
    16801728#ifdef key_iomput 
    1681       IF( kt == kwrite ) THEN 
    1682          IF(lwp) write(numout,*) 'RESTART: write (XIOS 1D) ',trim(cdvar) 
    1683          CALL xios_send_field(trim(cdvar), pvar) 
    1684       ENDIF 
     1729         IF( kt == kwrite ) THEN 
     1730            IF(lwp) write(numout,*) 'RESTART: write (XIOS 1D) ',trim(cdvar) 
     1731            CALL iom_swap(context) 
     1732            CALL iom_put(trim(cdvar), pvar) 
     1733            CALL iom_swap(cxios_context) 
     1734         ELSE 
     1735            IF(lwp) write(numout,*) 'RESTART: define (XIOS 1D)',trim(cdvar) 
     1736            CALL iom_swap(context) 
     1737            CALL iom_set_rstw_active( trim(cdvar), rd1 = pvar ) 
     1738            CALL iom_swap(cxios_context) 
     1739         ENDIF 
    16851740#endif 
    16861741      ELSE 
     
    16951750 
    16961751 
    1697    SUBROUTINE iom_rp2d_sp( kt, kwrite, kiomid, cdvar, pvar, ktype, ldxios ) 
     1752   SUBROUTINE iom_rp2d_sp( kt, kwrite, kiomid, cdvar, pvar, ktype ) 
    16981753      INTEGER         , INTENT(in)                         ::   kt       ! ocean time-step 
    16991754      INTEGER         , INTENT(in)                         ::   kwrite   ! writing time-step 
     
    17021757      REAL(sp)        , INTENT(in), DIMENSION(:,    :    ) ::   pvar     ! written field 
    17031758      INTEGER         , INTENT(in), OPTIONAL               ::   ktype    ! variable external type 
    1704       LOGICAL, OPTIONAL :: ldxios   ! xios write flag 
    1705       LOGICAL :: llx 
    1706       INTEGER :: ivid   ! variable id 
    1707  
    1708       llx = .FALSE. 
    1709       IF(PRESENT(ldxios)) llx = ldxios 
     1759      ! 
     1760      LOGICAL            :: llx 
     1761      INTEGER            :: ivid   ! variable id 
     1762      CHARACTER(LEN=lc)  :: context 
     1763      ! 
     1764      CALL set_xios_context(kiomid, context) 
     1765 
     1766      llx = .NOT. (context == "NONE") 
     1767 
    17101768      IF( llx ) THEN 
    17111769#ifdef key_iomput 
    1712       IF( kt == kwrite ) THEN 
    1713          IF(lwp) write(numout,*) 'RESTART: write (XIOS 2D) ',trim(cdvar) 
    1714          CALL xios_send_field(trim(cdvar), pvar) 
    1715       ENDIF 
     1770         IF( kt == kwrite ) THEN 
     1771            IF(lwp) write(numout,*) 'RESTART: write (XIOS 2D) ',trim(cdvar) 
     1772            CALL iom_swap(context) 
     1773            CALL iom_put(trim(cdvar), pvar) 
     1774            CALL iom_swap(cxios_context) 
     1775         ELSE 
     1776            IF(lwp) write(numout,*) 'RESTART: define (XIOS 2D)',trim(cdvar) 
     1777            CALL iom_swap(context) 
     1778            CALL iom_set_rstw_active( trim(cdvar), rs2 = pvar ) 
     1779            CALL iom_swap(cxios_context) 
     1780         ENDIF 
    17161781#endif 
    17171782      ELSE 
     
    17251790   END SUBROUTINE iom_rp2d_sp 
    17261791 
    1727    SUBROUTINE iom_rp2d_dp( kt, kwrite, kiomid, cdvar, pvar, ktype, ldxios ) 
     1792   SUBROUTINE iom_rp2d_dp( kt, kwrite, kiomid, cdvar, pvar, ktype ) 
    17281793      INTEGER         , INTENT(in)                         ::   kt       ! ocean time-step 
    17291794      INTEGER         , INTENT(in)                         ::   kwrite   ! writing time-step 
     
    17321797      REAL(dp)        , INTENT(in), DIMENSION(:,    :    ) ::   pvar     ! written field 
    17331798      INTEGER         , INTENT(in), OPTIONAL               ::   ktype    ! variable external type 
    1734       LOGICAL, OPTIONAL :: ldxios   ! xios write flag 
    1735       LOGICAL :: llx 
    1736       INTEGER :: ivid   ! variable id 
    1737  
    1738       llx = .FALSE. 
    1739       IF(PRESENT(ldxios)) llx = ldxios 
     1799      ! 
     1800      LOGICAL           :: llx 
     1801      INTEGER           :: ivid   ! variable id 
     1802      CHARACTER(LEN=lc) :: context 
     1803      ! 
     1804      CALL set_xios_context(kiomid, context) 
     1805 
     1806      llx = .NOT. (context == "NONE") 
     1807 
    17401808      IF( llx ) THEN 
    17411809#ifdef key_iomput 
    1742       IF( kt == kwrite ) THEN 
    1743          IF(lwp) write(numout,*) 'RESTART: write (XIOS 2D) ',trim(cdvar) 
    1744          CALL xios_send_field(trim(cdvar), pvar) 
    1745       ENDIF 
     1810         IF( kt == kwrite ) THEN 
     1811            IF(lwp) write(numout,*) 'RESTART: write (XIOS 2D) ',trim(cdvar) 
     1812            CALL iom_swap(context) 
     1813            CALL iom_put(trim(cdvar), pvar) 
     1814            CALL iom_swap(cxios_context) 
     1815         ELSE 
     1816            IF(lwp) write(numout,*) 'RESTART: define (XIOS 2D)',trim(cdvar) 
     1817            CALL iom_swap(context) 
     1818            CALL iom_set_rstw_active( trim(cdvar), rd2 = pvar ) 
     1819            CALL iom_swap(cxios_context) 
     1820         ENDIF 
    17461821#endif 
    17471822      ELSE 
     
    17561831 
    17571832 
    1758    SUBROUTINE iom_rp3d_sp( kt, kwrite, kiomid, cdvar, pvar, ktype, ldxios ) 
     1833   SUBROUTINE iom_rp3d_sp( kt, kwrite, kiomid, cdvar, pvar, ktype ) 
    17591834      INTEGER         , INTENT(in)                         ::   kt       ! ocean time-step 
    17601835      INTEGER         , INTENT(in)                         ::   kwrite   ! writing time-step 
     
    17631838      REAL(sp)        , INTENT(in),       DIMENSION(:,:,:) ::   pvar     ! written field 
    17641839      INTEGER         , INTENT(in), OPTIONAL               ::   ktype    ! variable external type 
    1765       LOGICAL, OPTIONAL :: ldxios   ! xios write flag 
    1766       LOGICAL :: llx                 ! local xios write flag 
    1767       INTEGER :: ivid   ! variable id 
    1768  
    1769       llx = .FALSE. 
    1770       IF(PRESENT(ldxios)) llx = ldxios 
     1840      ! 
     1841      LOGICAL           :: llx                 ! local xios write flag 
     1842      INTEGER           :: ivid   ! variable id 
     1843      CHARACTER(LEN=lc) :: context 
     1844      ! 
     1845      CALL set_xios_context(kiomid, context) 
     1846 
     1847      llx = .NOT. (context == "NONE") 
     1848 
    17711849      IF( llx ) THEN 
    17721850#ifdef key_iomput 
    1773       IF( kt == kwrite ) THEN 
    1774          IF(lwp) write(numout,*) 'RESTART: write (XIOS 3D) ',trim(cdvar) 
    1775          CALL xios_send_field(trim(cdvar), pvar) 
    1776       ENDIF 
     1851         IF( kt == kwrite ) THEN 
     1852            IF(lwp) write(numout,*) 'RESTART: write (XIOS 3D) ',trim(cdvar) 
     1853            CALL iom_swap(context) 
     1854            CALL iom_put(trim(cdvar), pvar) 
     1855            CALL iom_swap(cxios_context) 
     1856         ELSE 
     1857            IF(lwp) write(numout,*) 'RESTART: define (XIOS 3D)',trim(cdvar) 
     1858            CALL iom_swap(context) 
     1859            CALL iom_set_rstw_active( trim(cdvar), rs3 = pvar ) 
     1860            CALL iom_swap(cxios_context) 
     1861         ENDIF 
    17771862#endif 
    17781863      ELSE 
     
    17861871   END SUBROUTINE iom_rp3d_sp 
    17871872 
    1788    SUBROUTINE iom_rp3d_dp( kt, kwrite, kiomid, cdvar, pvar, ktype, ldxios ) 
     1873   SUBROUTINE iom_rp3d_dp( kt, kwrite, kiomid, cdvar, pvar, ktype ) 
    17891874      INTEGER         , INTENT(in)                         ::   kt       ! ocean time-step 
    17901875      INTEGER         , INTENT(in)                         ::   kwrite   ! writing time-step 
     
    17931878      REAL(dp)        , INTENT(in),       DIMENSION(:,:,:) ::   pvar     ! written field 
    17941879      INTEGER         , INTENT(in), OPTIONAL               ::   ktype    ! variable external type 
    1795       LOGICAL, OPTIONAL :: ldxios   ! xios write flag 
    1796       LOGICAL :: llx                 ! local xios write flag 
    1797       INTEGER :: ivid   ! variable id 
    1798  
    1799       llx = .FALSE. 
    1800       IF(PRESENT(ldxios)) llx = ldxios 
     1880      ! 
     1881      LOGICAL           :: llx                 ! local xios write flag 
     1882      INTEGER           :: ivid   ! variable id 
     1883      CHARACTER(LEN=lc) :: context 
     1884      ! 
     1885      CALL set_xios_context(kiomid, context) 
     1886 
     1887      llx = .NOT. (context == "NONE") 
     1888 
    18011889      IF( llx ) THEN 
    18021890#ifdef key_iomput 
    1803       IF( kt == kwrite ) THEN 
    1804          IF(lwp) write(numout,*) 'RESTART: write (XIOS 3D) ',trim(cdvar) 
    1805          CALL xios_send_field(trim(cdvar), pvar) 
    1806       ENDIF 
     1891         IF( kt == kwrite ) THEN 
     1892            IF(lwp) write(numout,*) 'RESTART: write (XIOS 3D) ',trim(cdvar) 
     1893            CALL iom_swap(context) 
     1894            CALL iom_put(trim(cdvar), pvar) 
     1895            CALL iom_swap(cxios_context) 
     1896         ELSE 
     1897            IF(lwp) write(numout,*) 'RESTART: define (XIOS 3D)',trim(cdvar) 
     1898            CALL iom_swap(context) 
     1899            CALL iom_set_rstw_active( trim(cdvar), rd3 = pvar ) 
     1900            CALL iom_swap(cxios_context) 
     1901         ENDIF 
    18071902#endif 
    18081903      ELSE 
     
    21502245      CALL iom_swap( cdname )   ! swap to cdname context 
    21512246      CALL xios_update_calendar(kt) 
    2152       IF( cdname /= TRIM(cxios_context) )   CALL iom_swap( TRIM(cxios_context) )   ! return back to nemo context 
     2247      IF( cdname /= TRIM(cxios_context) )   CALL iom_swap( cxios_context )   ! return back to nemo context 
    21532248   END SUBROUTINE iom_setkt 
    21542249 
     
    21642259         CALL iom_swap( cdname )   ! swap to cdname context 
    21652260         CALL xios_context_finalize() ! finalize the context 
    2166          IF( cdname /= TRIM(cxios_context) ) CALL iom_swap( TRIM(cxios_context) )   ! return back to nemo context 
     2261         IF( cdname /= cxios_context ) CALL iom_swap( cxios_context )   ! return back to nemo context 
    21672262      ENDIF 
    21682263      ! 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/src/OCE/IOM/iom_def.F90

    r13998 r14018  
    99   !!---------------------------------------------------------------------- 
    1010   USE par_kind 
     11   USE netcdf 
    1112 
    1213   IMPLICIT NONE 
     
    3637   INTEGER, PUBLIC            ::   nxioso = 0          !: type of restart file when writing using XIOS 1 - single, 2 - multiple 
    3738!XIOS read restart    
    38    LOGICAL, PUBLIC            ::   lrxios = .FALSE.     !: read single file restart using XIOS 
     39   LOGICAL, PUBLIC            ::   lrxios = .FALSE.     !: read single file restart using XIOS main switch 
    3940   LOGICAL, PUBLIC            ::   lxios_sini = .FALSE. ! is restart in a single file 
    40    LOGICAL, PUBLIC            ::   lxios_set  = .FALSE.  
     41 
     42 
    4143 
    4244   TYPE, PUBLIC ::   file_descriptor 
     
    5961   END TYPE file_descriptor 
    6062   TYPE(file_descriptor), DIMENSION(jpmax_files), PUBLIC ::   iom_file !: array containing the info for all opened files 
    61    INTEGER, PARAMETER, PUBLIC                   :: max_rst_fields = 95 !: maximum number of restart variables defined in iom_set_rst_vars 
    62    TYPE, PUBLIC :: RST_FIELD   
    63     CHARACTER(len=30) :: vname = "NO_NAME" ! names of variables in restart file 
    64     CHARACTER(len=30) :: grid = "NO_GRID" 
    65     LOGICAL           :: active =.FALSE. ! for restart write only: true - write field, false do not write field 
    66    END TYPE RST_FIELD 
    6763!$AGRIF_END_DO_NOT_TREAT 
    68    ! 
    69    TYPE(RST_FIELD), PUBLIC, SAVE :: rst_wfields(max_rst_fields), rst_rfields(max_rst_fields) 
    7064   ! 
    7165   !! * Substitutions 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/src/OCE/IOM/iom_nf90.F90

    r13286 r14018  
    3131   PUBLIC iom_nf90_open  , iom_nf90_close, iom_nf90_varid, iom_nf90_get, iom_nf90_rstput 
    3232   PUBLIC iom_nf90_chkatt, iom_nf90_getatt, iom_nf90_putatt 
     33   PUBLIC iom_nf90_check 
    3334 
    3435   INTERFACE iom_nf90_get 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/src/OCE/IOM/restart.F90

    r13895 r14018  
    111111            ELSE 
    112112#if defined key_iomput 
    113                cwxios_context = "rstw_"//TRIM(ADJUSTL(clkt)) 
     113               cw_ocerst_cxt = "rstw_"//TRIM(ADJUSTL(clkt)) 
    114114               IF( TRIM(Agrif_CFixed()) == '0' ) THEN 
    115115                  clpname = clname 
     
    117117                  clpname = TRIM(Agrif_CFixed())//"_"//clname    
    118118               ENDIF 
    119                CALL iom_init( cwxios_context, TRIM(clpath)//TRIM(clpname), .false. ) 
    120                CALL xios_update_calendar(nitrst) 
     119               numrow = iom_xios_setid(TRIM(clpath)//TRIM(clpname)) 
     120               CALL iom_init( cw_ocerst_cxt, kdid = numrow, ld_closedef = .false. ) 
    121121               CALL iom_swap(      cxios_context          ) 
    122122#else 
     
    147147      INTEGER, INTENT(in) ::   Kbb, Kmm   ! ocean time level indices 
    148148      !!---------------------------------------------------------------------- 
    149                      IF(lwxios) CALL iom_swap(      cwxios_context          ) 
    150                      CALL iom_rstput( kt, nitrst, numrow, 'rdt'    , rn_Dt       , ldxios = lwxios)   ! dynamics time step 
    151                      CALL iom_delay_rst( 'WRITE', 'OCE', numrow )   ! save only ocean delayed global communication variables 
     149                     CALL iom_rstput( kt, nitrst, numrow, 'rdt'    , rn_Dt       )   ! dynamics time step 
     150                     IF(.NOT.lwxios) CALL iom_delay_rst( 'WRITE', 'OCE', numrow )   ! save only ocean delayed global communication variables 
    152151 
    153152      IF ( .NOT. ln_diurnal_only ) THEN 
    154                      CALL iom_rstput( kt, nitrst, numrow, 'ub'     , uu(:,:,:       ,Kbb), ldxios = lwxios        )     ! before fields 
    155                      CALL iom_rstput( kt, nitrst, numrow, 'vb'     , vv(:,:,:       ,Kbb), ldxios = lwxios        ) 
    156                      CALL iom_rstput( kt, nitrst, numrow, 'tb'     , ts(:,:,:,jp_tem,Kbb), ldxios = lwxios ) 
    157                      CALL iom_rstput( kt, nitrst, numrow, 'sb'     , ts(:,:,:,jp_sal,Kbb), ldxios = lwxios ) 
    158                      CALL iom_rstput( kt, nitrst, numrow, 'sshb'   ,ssh(:,:         ,Kbb), ldxios = lwxios      ) 
     153                     CALL iom_rstput( kt, nitrst, numrow, 'ub'     , uu(:,:,:       ,Kbb) )     ! before fields 
     154                     CALL iom_rstput( kt, nitrst, numrow, 'vb'     , vv(:,:,:       ,Kbb) ) 
     155                     CALL iom_rstput( kt, nitrst, numrow, 'tb'     , ts(:,:,:,jp_tem,Kbb) ) 
     156                     CALL iom_rstput( kt, nitrst, numrow, 'sb'     , ts(:,:,:,jp_sal,Kbb) ) 
     157                     CALL iom_rstput( kt, nitrst, numrow, 'sshb'   , ssh(:,:         ,Kbb)) 
    159158                     ! 
    160                      CALL iom_rstput( kt, nitrst, numrow, 'un'     , uu(:,:,:       ,Kmm), ldxios = lwxios        )     ! now fields 
    161                      CALL iom_rstput( kt, nitrst, numrow, 'vn'     , vv(:,:,:       ,Kmm), ldxios = lwxios        ) 
    162                      CALL iom_rstput( kt, nitrst, numrow, 'tn'     , ts(:,:,:,jp_tem,Kmm), ldxios = lwxios ) 
    163                      CALL iom_rstput( kt, nitrst, numrow, 'sn'     , ts(:,:,:,jp_sal,Kmm), ldxios = lwxios ) 
    164                      CALL iom_rstput( kt, nitrst, numrow, 'sshn'   ,ssh(:,:         ,Kmm), ldxios = lwxios      ) 
    165                      CALL iom_rstput( kt, nitrst, numrow, 'rhop'   , rhop, ldxios = lwxios      ) 
     159                     CALL iom_rstput( kt, nitrst, numrow, 'un'     , uu(:,:,:       ,Kmm) )     ! now fields 
     160                     CALL iom_rstput( kt, nitrst, numrow, 'vn'     , vv(:,:,:       ,Kmm) ) 
     161                     CALL iom_rstput( kt, nitrst, numrow, 'tn'     , ts(:,:,:,jp_tem,Kmm) ) 
     162                     CALL iom_rstput( kt, nitrst, numrow, 'sn'     , ts(:,:,:,jp_sal,Kmm) ) 
     163                     CALL iom_rstput( kt, nitrst, numrow, 'sshn'   , ssh(:,:         ,Kmm)) 
     164                     CALL iom_rstput( kt, nitrst, numrow, 'rhop'   , rhop      ) 
    166165      ENDIF 
    167166       
    168       IF (ln_diurnal) CALL iom_rstput( kt, nitrst, numrow, 'Dsst', x_dsst, ldxios = lwxios )   
    169       IF(lwxios) CALL iom_swap(      cxios_context          ) 
     167      IF (ln_diurnal) CALL iom_rstput( kt, nitrst, numrow, 'Dsst', x_dsst )   
    170168      IF( kt == nitrst ) THEN 
    171169         IF(.NOT.lwxios) THEN 
    172170            CALL iom_close( numrow )     ! close the restart file (only at last time step) 
    173171         ELSE 
    174             CALL iom_context_finalize(      cwxios_context          ) 
     172            CALL iom_context_finalize(      cw_ocerst_cxt          ) 
     173            iom_file(numrow)%nfid       = 0 
     174            numrow = 0 
    175175         ENDIF 
    176176!!gm         IF( .NOT. lk_trdmld )   lrst_oce = .FALSE. 
     
    195195      !!                the file has already been opened 
    196196      !!---------------------------------------------------------------------- 
    197       LOGICAL        ::   llok 
    198       CHARACTER(lc)  ::   clpath   ! full path to ocean output restart file 
     197      LOGICAL             ::   llok 
     198      CHARACTER(len=lc)   ::   clpath   ! full path to ocean output restart file 
     199      CHARACTER(len=lc+2) ::   clpname  ! file name including agrif prefix 
    199200      !!---------------------------------------------------------------------- 
    200201      ! 
     
    213214! can handle checking if variable is in the restart file (there will be no need to open 
    214215! restart) 
    215          IF( .NOT.lxios_set )   lrxios = lrxios.AND.lxios_sini 
    216          IF( lrxios ) THEN 
    217              crxios_context = 'nemo_rst' 
    218              IF( .NOT.lxios_set ) THEN 
    219                  IF(lwp) WRITE(numout,*) 'Enable restart reading by XIOS' 
    220                  CALL iom_init( crxios_context ) 
    221                  lxios_set = .TRUE. 
    222              ENDIF 
    223          ENDIF 
    224          IF( TRIM(Agrif_CFixed()) /= '0' .AND. lrxios ) THEN 
    225              CALL iom_init( crxios_context ) 
    226              IF(lwp) WRITE(numout,*) 'Enable restart reading by XIOS for AGRIF' 
    227              lxios_set = .TRUE. 
    228          ENDIF  
     216         lrxios = lrxios.AND.lxios_sini 
     217 
     218         IF( lrxios) THEN 
     219             cr_ocerst_cxt = 'oce_rst' 
     220             IF(lwp) WRITE(numout,*) 'Enable restart reading by XIOS' 
     221!            IF( TRIM(Agrif_CFixed()) == '0' ) THEN 
     222!               clpname = cn_ocerst_in 
     223!            ELSE 
     224!               clpname = TRIM(Agrif_CFixed())//"_"//cn_ocerst_in    
     225!            ENDIF 
     226             CALL iom_init( cr_ocerst_cxt, kdid = numror, ld_closedef = .TRUE. ) 
     227             CALL iom_swap(      cxios_context          ) 
     228         ENDIF 
     229 
    229230      ENDIF 
    230231 
     
    252253      !!---------------------------------------------------------------------- 
    253254      ! 
    254       CALL iom_delay_rst( 'READ', 'OCE', numror )   ! read only ocean delayed global communication variables 
     255      IF(.NOT.lrxios ) CALL iom_delay_rst( 'READ', 'OCE', numror )   ! read only ocean delayed global communication variables 
    255256      ! 
    256257      !                             !*  Diurnal DSST  
    257       IF( ln_diurnal )   CALL iom_get( numror, jpdom_auto, 'Dsst' , x_dsst, ldxios = lrxios )  
     258      IF( ln_diurnal )   CALL iom_get( numror, jpdom_auto, 'Dsst' , x_dsst )  
    258259      IF ( ln_diurnal_only ) THEN  
    259260         IF(lwp) WRITE( numout, * ) & 
    260261         &   "rst_read:- ln_diurnal_only set, setting rhop=rho0"  
    261262         rhop = rho0 
    262          CALL iom_get( numror, jpdom_auto, 'tn'     , w3d, ldxios = lrxios )  
     263         CALL iom_get( numror, jpdom_auto, 'tn'     , w3d )  
    263264         ts(:,:,1,jp_tem,Kmm) = w3d(:,:,1) 
    264265         RETURN  
     
    267268      !                             !*  Read Kmm fields 
    268269      IF(lwp) WRITE(numout,*)    '           Kmm u, v and T-S fields read in the restart file' 
    269       CALL iom_get( numror, jpdom_auto, 'un'     , uu(:,:,:       ,Kmm), ldxios = lrxios, cd_type = 'U', psgn = -1._wp ) 
    270       CALL iom_get( numror, jpdom_auto, 'vn'     , vv(:,:,:       ,Kmm), ldxios = lrxios, cd_type = 'V', psgn = -1._wp ) 
    271       CALL iom_get( numror, jpdom_auto, 'tn'     , ts(:,:,:,jp_tem,Kmm), ldxios = lrxios ) 
    272       CALL iom_get( numror, jpdom_auto, 'sn'     , ts(:,:,:,jp_sal,Kmm), ldxios = lrxios ) 
     270      CALL iom_get( numror, jpdom_auto, 'un'     , uu(:,:,:       ,Kmm), cd_type = 'U', psgn = -1._wp ) 
     271      CALL iom_get( numror, jpdom_auto, 'vn'     , vv(:,:,:       ,Kmm), cd_type = 'V', psgn = -1._wp ) 
     272      CALL iom_get( numror, jpdom_auto, 'tn'     , ts(:,:,:,jp_tem,Kmm) ) 
     273      CALL iom_get( numror, jpdom_auto, 'sn'     , ts(:,:,:,jp_sal,Kmm) ) 
    273274      ! 
    274275      IF( l_1st_euler ) THEN        !*  Euler restart 
     
    279280      ELSE                          !* Leap frog restart 
    280281         IF(lwp) WRITE(numout,*) '           Kbb u, v and T-S fields read in the restart file' 
    281          CALL iom_get( numror, jpdom_auto, 'ub'     , uu(:,:,:       ,Kbb), ldxios = lrxios, cd_type = 'U', psgn = -1._wp ) 
    282          CALL iom_get( numror, jpdom_auto, 'vb'     , vv(:,:,:       ,Kbb), ldxios = lrxios, cd_type = 'V', psgn = -1._wp ) 
    283          CALL iom_get( numror, jpdom_auto, 'tb'     , ts(:,:,:,jp_tem,Kbb), ldxios = lrxios ) 
    284          CALL iom_get( numror, jpdom_auto, 'sb'     , ts(:,:,:,jp_sal,Kbb), ldxios = lrxios ) 
     282         CALL iom_get( numror, jpdom_auto, 'ub'     , uu(:,:,:       ,Kbb), cd_type = 'U', psgn = -1._wp ) 
     283         CALL iom_get( numror, jpdom_auto, 'vb'     , vv(:,:,:       ,Kbb), cd_type = 'V', psgn = -1._wp ) 
     284         CALL iom_get( numror, jpdom_auto, 'tb'     , ts(:,:,:,jp_tem,Kbb) ) 
     285         CALL iom_get( numror, jpdom_auto, 'sb'     , ts(:,:,:,jp_sal,Kbb) ) 
    285286      ENDIF 
    286287      ! 
    287288      IF( iom_varid( numror, 'rhop', ldstop = .FALSE. ) > 0 ) THEN 
    288          CALL iom_get( numror, jpdom_auto, 'rhop'   , rhop, ldxios = lrxios )   ! now    potential density 
     289         CALL iom_get( numror, jpdom_auto, 'rhop'   , rhop )   ! now    potential density 
    289290      ELSE 
    290291         CALL eos( ts(:,:,:,:,Kmm), rhd, rhop, gdept(:,:,:,Kmm) )    
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/src/OCE/ISF/isfcav.F90

    r13226 r14018  
    183183      ! cavity mask 
    184184      mskisf_cav(:,:)    = (1._wp - tmask(:,:,1)) * ssmask(:,:) 
    185       ! 
    186       !================ 
    187       ! 2: read restart 
     185      !================ 
     186      ! 2: activate restart 
     187      !================ 
     188      ! 
     189      !================ 
     190      ! 3: read restart 
    188191      !================ 
    189192      ! 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/src/OCE/ISF/isfcpl.F90

    r13895 r14018  
    120120      e3t(:,:,:,Kbb)   = e3t(:,:,:,Kmm) 
    121121#endif  
    122       ! prepare writing restart 
    123       IF( lwxios ) THEN 
    124          CALL iom_set_rstw_var_active('ssmask') 
    125          CALL iom_set_rstw_var_active('tmask') 
    126          CALL iom_set_rstw_var_active('e3t_n') 
    127          CALL iom_set_rstw_var_active('e3u_n') 
    128          CALL iom_set_rstw_var_active('e3v_n') 
    129       END IF 
    130       ! 
    131122   END SUBROUTINE isfcpl_init 
    132123 
     
    154145      END DO  
    155146      ! 
    156       IF( lwxios ) CALL iom_swap( cwxios_context ) 
    157       CALL iom_rstput( kt, nitrst, numrow, 'tmask'  , tmask , ldxios = lwxios ) 
    158       CALL iom_rstput( kt, nitrst, numrow, 'ssmask' , ssmask, ldxios = lwxios ) 
    159       CALL iom_rstput( kt, nitrst, numrow, 'e3t_n'  , ze3t , ldxios = lwxios ) 
    160       CALL iom_rstput( kt, nitrst, numrow, 'e3u_n'  , ze3u , ldxios = lwxios ) 
    161       CALL iom_rstput( kt, nitrst, numrow, 'e3v_n'  , ze3v , ldxios = lwxios ) 
    162       CALL iom_rstput( kt, nitrst, numrow, 'gdepw_n', zgdepw , ldxios = lwxios ) 
    163       IF( lwxios ) CALL iom_swap( cxios_context ) 
     147      CALL iom_rstput( kt, nitrst, numrow, 'tmask'  , tmask  ) 
     148      CALL iom_rstput( kt, nitrst, numrow, 'ssmask' , ssmask ) 
     149      CALL iom_rstput( kt, nitrst, numrow, 'e3t_n'  , ze3t   ) 
     150      CALL iom_rstput( kt, nitrst, numrow, 'e3u_n'  , ze3u   ) 
     151      CALL iom_rstput( kt, nitrst, numrow, 'e3v_n'  , ze3v   ) 
     152      CALL iom_rstput( kt, nitrst, numrow, 'gdepw_n', zgdepw ) 
    164153      ! 
    165154   END SUBROUTINE isfcpl_rst_write 
     
    185174      !!---------------------------------------------------------------------- 
    186175      ! 
    187       CALL iom_get( numror, jpdom_auto, 'ssmask'  , zssmask_b, ldxios = lrxios   ) ! need to extrapolate T/S 
     176      CALL iom_get( numror, jpdom_auto, 'ssmask'  , zssmask_b   ) ! need to extrapolate T/S 
    188177 
    189178      ! compute new ssh if we open a full water column  
     
    267256      !!---------------------------------------------------------------------- 
    268257      !  
    269       CALL iom_get( numror, jpdom_auto, 'tmask'  , ztmask_b, ldxios = lrxios   ) ! need to extrapolate T/S 
    270       !CALL iom_get( numror, jpdom_auto, 'wmask'  , zwmask_b, ldxios = lrxios   ) ! need to extrapolate T/S 
    271       !CALL iom_get( numror, jpdom_auto, 'gdepw_n', zdepw_b(:,:,:), ldxios = lrxios ) ! need to interpol vertical profile (vvl) 
     258      CALL iom_get( numror, jpdom_auto, 'tmask'  , ztmask_b   ) ! need to extrapolate T/S 
     259      !CALL iom_get( numror, jpdom_auto, 'wmask'  , zwmask_b  ) ! need to extrapolate T/S 
     260      !CALL iom_get( numror, jpdom_auto, 'gdepw_n', zdepw_b(:,:,:) ) ! need to interpol vertical profile (vvl) 
    272261      ! 
    273262      !  
     
    414403      !!---------------------------------------------------------------------- 
    415404      ! 
    416       CALL iom_get( numror, jpdom_auto, 'tmask'  , ztmask_b, ldxios = lrxios ) 
    417       CALL iom_get( numror, jpdom_auto, 'e3u_n'  , ze3u_b  , ldxios = lrxios ) 
    418       CALL iom_get( numror, jpdom_auto, 'e3v_n'  , ze3v_b  , ldxios = lrxios ) 
     405      CALL iom_get( numror, jpdom_auto, 'tmask'  , ztmask_b ) 
     406      CALL iom_get( numror, jpdom_auto, 'e3u_n'  , ze3u_b  ) 
     407      CALL iom_get( numror, jpdom_auto, 'e3v_n'  , ze3v_b  ) 
    419408      ! 
    420409      ! 1.0: compute horizontal volume flux divergence difference before-after coupling 
     
    525514 
    526515      ! get restart variable 
    527       CALL iom_get( numror, jpdom_auto, 'tmask'  , ztmask_b(:,:,:), ldxios = lrxios  ) ! need to extrapolate T/S 
    528       CALL iom_get( numror, jpdom_auto, 'e3t_n'  , ze3t_b(:,:,:)  , ldxios = lrxios ) 
    529       CALL iom_get( numror, jpdom_auto, 'tn'     , zt_b(:,:,:)    , ldxios = lrxios ) 
    530       CALL iom_get( numror, jpdom_auto, 'sn'     , zs_b(:,:,:)    , ldxios = lrxios ) 
     516      CALL iom_get( numror, jpdom_auto, 'tmask'  , ztmask_b(:,:,:) ) ! need to extrapolate T/S 
     517      CALL iom_get( numror, jpdom_auto, 'e3t_n'  , ze3t_b(:,:,:)  ) 
     518      CALL iom_get( numror, jpdom_auto, 'tn'     , zt_b(:,:,:)    ) 
     519      CALL iom_get( numror, jpdom_auto, 'sn'     , zs_b(:,:,:)    ) 
    531520 
    532521      ! compute run length 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/src/OCE/ISF/isfrst.F90

    r13895 r14018  
    5353      IF( .NOT.l_1st_euler ) THEN 
    5454         IF(lwp) WRITE(numout,*) '          nit000-1 isf tracer content forcing fields read in the restart file' 
    55          CALL iom_get( numror, jpdom_auto, cfwf_b, pfwf_b(:,:)        , ldxios = lrxios )   ! before ice shelf melt 
    56          CALL iom_get( numror, jpdom_auto, chc_b , ptsc_b (:,:,jp_tem), ldxios = lrxios )   ! before ice shelf heat flux 
    57          CALL iom_get( numror, jpdom_auto, csc_b , ptsc_b (:,:,jp_sal), ldxios = lrxios )   ! before ice shelf heat flux 
     55         CALL iom_get( numror, jpdom_auto, cfwf_b, pfwf_b(:,:)        )   ! before ice shelf melt 
     56         CALL iom_get( numror, jpdom_auto, chc_b , ptsc_b (:,:,jp_tem) )   ! before ice shelf heat flux 
     57         CALL iom_get( numror, jpdom_auto, csc_b , ptsc_b (:,:,jp_sal) )   ! before ice shelf heat flux 
    5858      ELSE 
    5959         pfwf_b(:,:)   = pfwf(:,:) 
    6060         ptsc_b(:,:,:) = ptsc(:,:,:) 
    61       ENDIF 
    62       ! 
    63       IF( lwxios ) THEN 
    64          CALL iom_set_rstw_var_active( TRIM(chc_b ) ) 
    65          CALL iom_set_rstw_var_active( TRIM(csc_b ) ) 
    66          CALL iom_set_rstw_var_active( TRIM(cfwf_b) ) 
    6761      ENDIF 
    6862      ! 
     
    9690      ! 
    9791      ! write restart variable 
    98       IF( lwxios ) CALL iom_swap( cwxios_context ) 
    99       CALL iom_rstput( kt, nitrst, numrow, cfwf_b, pfwf(:,:)       , ldxios = lwxios ) 
    100       CALL iom_rstput( kt, nitrst, numrow, chc_b , ptsc(:,:,jp_tem), ldxios = lwxios ) 
    101       CALL iom_rstput( kt, nitrst, numrow, csc_b , ptsc(:,:,jp_sal), ldxios = lwxios ) 
    102       IF( lwxios ) CALL iom_swap( cxios_context ) 
     92      CALL iom_rstput( kt, nitrst, numrow, cfwf_b, pfwf(:,:)        ) 
     93      CALL iom_rstput( kt, nitrst, numrow, chc_b , ptsc(:,:,jp_tem) ) 
     94      CALL iom_rstput( kt, nitrst, numrow, csc_b , ptsc(:,:,jp_sal) ) 
    10395      ! 
    10496   END SUBROUTINE isfrst_write 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/src/OCE/SBC/sbcapr.F90

    r13895 r14018  
    6565      CHARACTER(len=100) ::  cn_dir   ! Root directory for location of ssr files 
    6666      TYPE(FLD_N)        ::  sn_apr   ! informations about the fields to be read 
    67       LOGICAL            ::  lrxios   ! read restart using XIOS? 
    6867      !! 
    6968      NAMELIST/namsbc_apr/ cn_dir, sn_apr, ln_ref_apr, rn_pref, ln_apr_obc 
     
    108107            CALL ctl_warn( 'sbc_apr: use inverse barometer ssh at open boundary ONLY requires ln_apr_dyn=T' ) 
    109108      ! 
    110       IF( lwxios ) THEN 
    111          CALL iom_set_rstw_var_active('ssh_ibb') 
    112       ENDIF 
    113109   END SUBROUTINE sbc_apr_init 
    114110 
     
    154150         IF( ln_rstart .AND. .NOT.l_1st_euler ) THEN  
    155151            IF(lwp) WRITE(numout,*) 'sbc_apr:   ssh_ibb read in the restart file' 
    156             CALL iom_get( numror, jpdom_auto, 'ssh_ibb', ssh_ibb, ldxios = lrxios )   ! before inv. barometer ssh 
     152            CALL iom_get( numror, jpdom_auto, 'ssh_ibb', ssh_ibb )   ! before inv. barometer ssh 
    157153            ! 
    158154         ELSE                                         !* no restart: set from nit000 values 
     
    167163         IF(lwp) WRITE(numout,*) 'sbc_apr : ssh_ib written in ocean restart file at it= ', kt,' date= ', ndastp 
    168164         IF(lwp) WRITE(numout,*) '~~~~' 
    169          IF( lwxios ) CALL iom_swap(      cwxios_context          ) 
    170          CALL iom_rstput( kt, nitrst, numrow, 'ssh_ibb' , ssh_ib, ldxios = lwxios ) 
    171          IF( lwxios ) CALL iom_swap(      cxios_context          ) 
     165         CALL iom_rstput( kt, nitrst, numrow, 'ssh_ibb' , ssh_ib ) 
    172166      ENDIF 
    173167      ! 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/src/OCE/SBC/sbcmod.F90

    r13998 r14018  
    359359      IF( ln_wave     )   CALL sbc_wave_init                     ! surface wave initialisation 
    360360      ! 
    361       IF( lwxios ) THEN 
    362          CALL iom_set_rstw_var_active('utau_b') 
    363          CALL iom_set_rstw_var_active('vtau_b') 
    364          CALL iom_set_rstw_var_active('qns_b') 
    365          ! The 3D heat content due to qsr forcing is treated in traqsr 
    366          ! CALL iom_set_rstw_var_active('qsr_b') 
    367          CALL iom_set_rstw_var_active('emp_b') 
    368          CALL iom_set_rstw_var_active('sfx_b') 
    369       ENDIF 
    370  
    371361   END SUBROUTINE sbc_init 
    372362 
     
    509499         IF( ln_rstart .AND. .NOT.l_1st_euler ) THEN            !* Restart: read in restart file 
    510500            IF(lwp) WRITE(numout,*) '          nit000-1 surface forcing fields read in the restart file' 
    511             CALL iom_get( numror, jpdom_auto, 'utau_b', utau_b, ldxios = lrxios, cd_type = 'U', psgn = -1._wp )   ! i-stress 
    512             CALL iom_get( numror, jpdom_auto, 'vtau_b', vtau_b, ldxios = lrxios, cd_type = 'V', psgn = -1._wp )   ! j-stress 
    513             CALL iom_get( numror, jpdom_auto,  'qns_b',  qns_b, ldxios = lrxios                              )   ! non solar heat flux 
    514             CALL iom_get( numror, jpdom_auto,  'emp_b',  emp_b, ldxios = lrxios                              )   ! freshwater flux 
     501            CALL iom_get( numror, jpdom_auto, 'utau_b', utau_b )   ! i-stress 
     502            CALL iom_get( numror, jpdom_auto, 'vtau_b', vtau_b )   ! j-stress 
     503            CALL iom_get( numror, jpdom_auto,  'qns_b',  qns_b )   ! non solar heat flux 
     504            CALL iom_get( numror, jpdom_auto,  'emp_b',  emp_b )   ! freshwater flux 
    515505            ! NB: The 3D heat content due to qsr forcing (qsr_hc_b) is treated in traqsr 
    516506            ! To ensure restart capability with 3.3x/3.4 restart files    !! to be removed in v3.6 
    517507            IF( iom_varid( numror, 'sfx_b', ldstop = .FALSE. ) > 0 ) THEN 
    518                CALL iom_get( numror, jpdom_auto, 'sfx_b', sfx_b, ldxios = lrxios )  ! before salt flux (T-point) 
     508               CALL iom_get( numror, jpdom_auto, 'sfx_b', sfx_b )  ! before salt flux (T-point) 
    519509            ELSE 
    520510               sfx_b (:,:) = sfx(:,:) 
     
    536526            &                    'at it= ', kt,' date= ', ndastp 
    537527         IF(lwp) WRITE(numout,*) '~~~~' 
    538          IF( lwxios ) CALL iom_swap(      cwxios_context          ) 
    539          CALL iom_rstput( kt, nitrst, numrow, 'utau_b' , utau, ldxios = lwxios ) 
    540          CALL iom_rstput( kt, nitrst, numrow, 'vtau_b' , vtau, ldxios = lwxios ) 
    541          CALL iom_rstput( kt, nitrst, numrow, 'qns_b'  , qns, ldxios = lwxios  ) 
     528         CALL iom_rstput( kt, nitrst, numrow, 'utau_b' , utau ) 
     529         CALL iom_rstput( kt, nitrst, numrow, 'vtau_b' , vtau ) 
     530         CALL iom_rstput( kt, nitrst, numrow, 'qns_b'  , qns  ) 
    542531         ! The 3D heat content due to qsr forcing is treated in traqsr 
    543532         ! CALL iom_rstput( kt, nitrst, numrow, 'qsr_b'  , qsr  ) 
    544          CALL iom_rstput( kt, nitrst, numrow, 'emp_b'  , emp, ldxios = lwxios  ) 
    545          CALL iom_rstput( kt, nitrst, numrow, 'sfx_b'  , sfx, ldxios = lwxios  ) 
    546          IF( lwxios ) CALL iom_swap(      cxios_context          ) 
     533         CALL iom_rstput( kt, nitrst, numrow, 'emp_b'  , emp  ) 
     534         CALL iom_rstput( kt, nitrst, numrow, 'sfx_b'  , sfx  ) 
    547535      ENDIF 
    548536      !                                                ! ---------------------------------------- ! 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/src/OCE/SBC/sbcrnf.F90

    r13998 r14018  
    159159         IF( ln_rstart .AND. .NOT.l_1st_euler ) THEN         !* Restart: read in restart file 
    160160            IF(lwp) WRITE(numout,*) '          nit000-1 runoff forcing fields red in the restart file', lrxios 
    161             CALL iom_get( numror, jpdom_auto, 'rnf_b'   , rnf_b                , ldxios = lrxios )   ! before runoff 
    162             CALL iom_get( numror, jpdom_auto, 'rnf_hc_b', rnf_tsc_b(:,:,jp_tem), ldxios = lrxios )   ! before heat content of runoff 
    163             CALL iom_get( numror, jpdom_auto, 'rnf_sc_b', rnf_tsc_b(:,:,jp_sal), ldxios = lrxios )   ! before salinity content of runoff 
     161            CALL iom_get( numror, jpdom_auto, 'rnf_b'   , rnf_b                )   ! before runoff 
     162            CALL iom_get( numror, jpdom_auto, 'rnf_hc_b', rnf_tsc_b(:,:,jp_tem) )   ! before heat content of runoff 
     163            CALL iom_get( numror, jpdom_auto, 'rnf_sc_b', rnf_tsc_b(:,:,jp_sal) )   ! before salinity content of runoff 
    164164         ELSE                                                !* no restart: set from nit000 values 
    165165            IF(lwp) WRITE(numout,*) '          nit000-1 runoff forcing fields set to nit000' 
     
    175175            &                    'at it= ', kt,' date= ', ndastp 
    176176         IF(lwp) WRITE(numout,*) '~~~~' 
    177          IF( lwxios ) CALL iom_swap(      cwxios_context         ) 
    178          CALL iom_rstput( kt, nitrst, numrow, 'rnf_b'   , rnf                , ldxios = lwxios ) 
    179          CALL iom_rstput( kt, nitrst, numrow, 'rnf_hc_b', rnf_tsc(:,:,jp_tem), ldxios = lwxios ) 
    180          CALL iom_rstput( kt, nitrst, numrow, 'rnf_sc_b', rnf_tsc(:,:,jp_sal), ldxios = lwxios ) 
    181          IF( lwxios ) CALL iom_swap(      cxios_context          ) 
     177         CALL iom_rstput( kt, nitrst, numrow, 'rnf_b'   , rnf                 ) 
     178         CALL iom_rstput( kt, nitrst, numrow, 'rnf_hc_b', rnf_tsc(:,:,jp_tem) ) 
     179         CALL iom_rstput( kt, nitrst, numrow, 'rnf_sc_b', rnf_tsc(:,:,jp_sal) ) 
    182180      ENDIF 
    183181      ! 
     
    479477      ENDIF 
    480478      ! 
    481       IF( lwxios ) THEN 
    482          CALL iom_set_rstw_var_active('rnf_b') 
    483          CALL iom_set_rstw_var_active('rnf_hc_b') 
    484          CALL iom_set_rstw_var_active('rnf_sc_b') 
    485       ENDIF 
    486  
    487479   END SUBROUTINE sbc_rnf_init 
    488480 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/src/OCE/SBC/sbcssm.F90

    r13286 r14018  
    154154            IF(lwp) WRITE(numout,*) '~~~~~~~' 
    155155            zf_sbc = REAL( nn_fsbc, wp ) 
    156             IF( lwxios ) CALL iom_swap(      cwxios_context          ) 
    157             CALL iom_rstput( kt, nitrst, numrow, 'nn_fsbc', zf_sbc, ldxios = lwxios )    ! sbc frequency 
    158             CALL iom_rstput( kt, nitrst, numrow, 'ssu_m'  , ssu_m, ldxios = lwxios  )    ! sea surface mean fields 
    159             CALL iom_rstput( kt, nitrst, numrow, 'ssv_m'  , ssv_m, ldxios = lwxios  ) 
    160             CALL iom_rstput( kt, nitrst, numrow, 'sst_m'  , sst_m, ldxios = lwxios  ) 
    161             CALL iom_rstput( kt, nitrst, numrow, 'sss_m'  , sss_m, ldxios = lwxios  ) 
    162             CALL iom_rstput( kt, nitrst, numrow, 'ssh_m'  , ssh_m, ldxios = lwxios  ) 
    163             CALL iom_rstput( kt, nitrst, numrow, 'e3t_m'  , e3t_m, ldxios = lwxios  ) 
    164             CALL iom_rstput( kt, nitrst, numrow, 'frq_m'  , frq_m, ldxios = lwxios  ) 
    165             ! 
    166             IF( lwxios ) CALL iom_swap(      cxios_context          ) 
     156            CALL iom_rstput( kt, nitrst, numrow, 'nn_fsbc', zf_sbc )    ! sbc frequency 
     157            CALL iom_rstput( kt, nitrst, numrow, 'ssu_m'  , ssu_m  )    ! sea surface mean fields 
     158            CALL iom_rstput( kt, nitrst, numrow, 'ssv_m'  , ssv_m  ) 
     159            CALL iom_rstput( kt, nitrst, numrow, 'sst_m'  , sst_m  ) 
     160            CALL iom_rstput( kt, nitrst, numrow, 'sss_m'  , sss_m  ) 
     161            CALL iom_rstput( kt, nitrst, numrow, 'ssh_m'  , ssh_m  ) 
     162            CALL iom_rstput( kt, nitrst, numrow, 'e3t_m'  , e3t_m  ) 
     163            CALL iom_rstput( kt, nitrst, numrow, 'frq_m'  , frq_m  ) 
     164            ! 
    167165         ENDIF 
    168166         ! 
     
    208206         IF( ln_rstart .AND. iom_varid( numror, 'nn_fsbc', ldstop = .FALSE. ) > 0 ) THEN 
    209207            l_ssm_mean = .TRUE. 
    210             CALL iom_get( numror            , 'nn_fsbc', zf_sbc,ldxios = lrxios )     ! sbc frequency of previous run 
    211             CALL iom_get( numror, jpdom_auto, 'ssu_m'  , ssu_m, ldxios = lrxios, cd_type = 'U', psgn = -1._wp )    ! sea surface mean velocity    (U-point) 
    212             CALL iom_get( numror, jpdom_auto, 'ssv_m'  , ssv_m, ldxios = lrxios, cd_type = 'V', psgn = -1._wp )    !   "         "    velocity    (V-point) 
    213             CALL iom_get( numror, jpdom_auto, 'sst_m'  , sst_m, ldxios = lrxios )    !   "         "    temperature (T-point) 
    214             CALL iom_get( numror, jpdom_auto, 'sss_m'  , sss_m, ldxios = lrxios )    !   "         "    salinity    (T-point) 
    215             CALL iom_get( numror, jpdom_auto, 'ssh_m'  , ssh_m, ldxios = lrxios )    !   "         "    height      (T-point) 
    216             CALL iom_get( numror, jpdom_auto, 'e3t_m'  , e3t_m, ldxios = lrxios )    ! 1st level thickness          (T-point) 
     208            CALL iom_get( numror            , 'nn_fsbc', zf_sbc )     ! sbc frequency of previous run 
     209            CALL iom_get( numror, jpdom_auto, 'ssu_m'  , ssu_m, cd_type = 'U', psgn = -1._wp )    ! sea surface mean velocity    (U-point) 
     210            CALL iom_get( numror, jpdom_auto, 'ssv_m'  , ssv_m, cd_type = 'V', psgn = -1._wp )    !   "         "    velocity    (V-point) 
     211            CALL iom_get( numror, jpdom_auto, 'sst_m'  , sst_m )    !   "         "    temperature (T-point) 
     212            CALL iom_get( numror, jpdom_auto, 'sss_m'  , sss_m )    !   "         "    salinity    (T-point) 
     213            CALL iom_get( numror, jpdom_auto, 'ssh_m'  , ssh_m )    !   "         "    height      (T-point) 
     214            CALL iom_get( numror, jpdom_auto, 'e3t_m'  , e3t_m )    ! 1st level thickness          (T-point) 
    217215            ! fraction of solar net radiation absorbed in 1st T level 
    218216            IF( iom_varid( numror, 'frq_m', ldstop = .FALSE. ) > 0 ) THEN 
    219                CALL iom_get( numror, jpdom_auto, 'frq_m'  , frq_m, ldxios = lrxios  ) 
     217               CALL iom_get( numror, jpdom_auto, 'frq_m'  , frq_m  ) 
    220218            ELSE 
    221219               frq_m(:,:) = 1._wp   ! default definition 
     
    255253      IF( .NOT. ln_traqsr )   fraqsr_1lev(:,:) = 1._wp   ! default definition: qsr 100% in the fisrt level  
    256254      ! 
    257       IF( lwxios.AND.nn_fsbc > 1 ) THEN 
    258          CALL iom_set_rstw_var_active('nn_fsbc') 
    259          CALL iom_set_rstw_var_active('ssu_m') 
    260          CALL iom_set_rstw_var_active('ssv_m') 
    261          CALL iom_set_rstw_var_active('sst_m') 
    262          CALL iom_set_rstw_var_active('sss_m') 
    263          CALL iom_set_rstw_var_active('ssh_m') 
    264          CALL iom_set_rstw_var_active('e3t_m') 
    265          CALL iom_set_rstw_var_active('frq_m') 
    266       ENDIF 
    267  
    268255   END SUBROUTINE sbc_ssm_init 
    269256 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/src/OCE/TRA/traqsr.F90

    r13998 r14018  
    138138            IF(lwp) WRITE(numout,*) '          nit000-1 qsr tracer content forcing field read in the restart file' 
    139139            z1_2 = 0.5_wp 
    140             CALL iom_get( numror, jpdom_auto, 'qsr_hc_b', qsr_hc_b, ldxios = lrxios )   ! before heat content trend due to Qsr flux 
     140            CALL iom_get( numror, jpdom_auto, 'qsr_hc_b', qsr_hc_b )   ! before heat content trend due to Qsr flux 
    141141         ELSE                                           ! No restart or Euler forward at 1st time step 
    142142            z1_2 = 1._wp 
     
    292292      ! 
    293293      IF( lrst_oce ) THEN     ! write in the ocean restart file 
    294          IF( lwxios ) CALL iom_swap(      cwxios_context          ) 
    295          CALL iom_rstput( kt, nitrst, numrow, 'qsr_hc_b'   , qsr_hc     , ldxios = lwxios ) 
    296          CALL iom_rstput( kt, nitrst, numrow, 'fraqsr_1lev', fraqsr_1lev, ldxios = lwxios )  
    297          IF( lwxios ) CALL iom_swap(      cxios_context          ) 
     294         CALL iom_rstput( kt, nitrst, numrow, 'qsr_hc_b'   , qsr_hc      ) 
     295         CALL iom_rstput( kt, nitrst, numrow, 'fraqsr_1lev', fraqsr_1lev )  
    298296      ENDIF 
    299297      ! 
     
    431429      ! 1st ocean level attenuation coefficient (used in sbcssm) 
    432430      IF( iom_varid( numror, 'fraqsr_1lev', ldstop = .FALSE. ) > 0 ) THEN 
    433          CALL iom_get( numror, jpdom_auto, 'fraqsr_1lev'  , fraqsr_1lev, ldxios = lrxios  ) 
     431         CALL iom_get( numror, jpdom_auto, 'fraqsr_1lev'  , fraqsr_1lev  ) 
    434432      ELSE 
    435433         fraqsr_1lev(:,:) = 1._wp   ! default : no penetration 
    436434      ENDIF 
    437435      ! 
    438       IF( lwxios ) THEN 
    439          CALL iom_set_rstw_var_active('qsr_hc_b') 
    440          CALL iom_set_rstw_var_active('fraqsr_1lev') 
    441       ENDIF 
    442       ! 
    443436   END SUBROUTINE tra_qsr_init 
    444437 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/src/OCE/TRA/trasbc.F90

    r13998 r14018  
    111111            zfact = 0.5_wp 
    112112            sbc_tsc(:,:,:) = 0._wp            ! CAUTION: here only the halos should be set to 0 due to rst_put 
    113             CALL iom_get( numror, jpdom_auto, 'sbc_hc_b', sbc_tsc_b(:,:,jp_tem), ldxios = lrxios )   ! before heat content sbc trend 
    114             CALL iom_get( numror, jpdom_auto, 'sbc_sc_b', sbc_tsc_b(:,:,jp_sal), ldxios = lrxios )   ! before salt content sbc trend 
     113            CALL iom_get( numror, jpdom_auto, 'sbc_hc_b', sbc_tsc_b(:,:,jp_tem) )   ! before heat content sbc trend 
     114            CALL iom_get( numror, jpdom_auto, 'sbc_sc_b', sbc_tsc_b(:,:,jp_sal) )   ! before salt content sbc trend 
    115115         ELSE                                             ! No restart or restart not found: Euler forward time stepping 
    116116            zfact = 1._wp 
     
    144144      !                   
    145145      IF( lrst_oce ) THEN           !==  write sbc_tsc in the ocean restart file  ==! 
    146          IF( lwxios ) CALL iom_swap(      cwxios_context          ) 
    147          CALL iom_rstput( kt, nitrst, numrow, 'sbc_hc_b', sbc_tsc(:,:,jp_tem), ldxios = lwxios ) 
    148          CALL iom_rstput( kt, nitrst, numrow, 'sbc_sc_b', sbc_tsc(:,:,jp_sal), ldxios = lwxios ) 
    149          IF( lwxios ) CALL iom_swap(      cxios_context          ) 
     146         CALL iom_rstput( kt, nitrst, numrow, 'sbc_hc_b', sbc_tsc(:,:,jp_tem) ) 
     147         CALL iom_rstput( kt, nitrst, numrow, 'sbc_sc_b', sbc_tsc(:,:,jp_sal) ) 
    150148      ENDIF 
    151149      ! 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/src/OCE/ZDF/zdfgls.F90

    r13998 r14018  
    10571057      CALL gls_rst( nit000, 'READ' )      ! (en, avt_k, avm_k, hmxl_n) 
    10581058      ! 
    1059       IF( lwxios ) THEN 
    1060          CALL iom_set_rstw_var_active('en') 
    1061          CALL iom_set_rstw_var_active('avt_k') 
    1062          CALL iom_set_rstw_var_active('avm_k') 
    1063          CALL iom_set_rstw_var_active('hmxl_n') 
    1064       ENDIF 
    1065       ! 
    10661059   END SUBROUTINE zdf_gls_init 
    10671060 
     
    10971090            ! 
    10981091            IF( MIN( id1, id2, id3, id4 ) > 0 ) THEN        ! all required arrays exist 
    1099                CALL iom_get( numror, jpdom_auto, 'en'    , en    , ldxios = lrxios ) 
    1100                CALL iom_get( numror, jpdom_auto, 'avt_k' , avt_k , ldxios = lrxios ) 
    1101                CALL iom_get( numror, jpdom_auto, 'avm_k' , avm_k , ldxios = lrxios ) 
    1102                CALL iom_get( numror, jpdom_auto, 'hmxl_n', hmxl_n, ldxios = lrxios ) 
     1092               CALL iom_get( numror, jpdom_auto, 'en'    , en    ) 
     1093               CALL iom_get( numror, jpdom_auto, 'avt_k' , avt_k ) 
     1094               CALL iom_get( numror, jpdom_auto, 'avm_k' , avm_k ) 
     1095               CALL iom_get( numror, jpdom_auto, 'hmxl_n', hmxl_n ) 
    11031096            ELSE                         
    11041097               IF(lwp) WRITE(numout,*) 
     
    11191112         !                                   ! ------------------- 
    11201113         IF(lwp) WRITE(numout,*) '---- gls-rst ----' 
    1121          IF( lwxios ) CALL iom_swap(      cwxios_context         ) 
    1122          CALL iom_rstput( kt, nitrst, numrow, 'en'    , en    , ldxios = lwxios ) 
    1123          CALL iom_rstput( kt, nitrst, numrow, 'avt_k' , avt_k , ldxios = lwxios ) 
    1124          CALL iom_rstput( kt, nitrst, numrow, 'avm_k' , avm_k , ldxios = lwxios ) 
    1125          CALL iom_rstput( kt, nitrst, numrow, 'hmxl_n', hmxl_n, ldxios = lwxios ) 
    1126          IF( lwxios ) CALL iom_swap(      cxios_context          ) 
     1114         CALL iom_rstput( kt, nitrst, numrow, 'en'    , en     ) 
     1115         CALL iom_rstput( kt, nitrst, numrow, 'avt_k' , avt_k  ) 
     1116         CALL iom_rstput( kt, nitrst, numrow, 'avm_k' , avm_k  ) 
     1117         CALL iom_rstput( kt, nitrst, numrow, 'hmxl_n', hmxl_n ) 
    11271118         ! 
    11281119      ENDIF 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/src/OCE/ZDF/zdfosm.F90

    r13998 r14018  
    14371437     ghamv(:,:,:) = 0. 
    14381438     ! 
    1439      IF( lwxios ) THEN 
    1440         CALL iom_set_rstw_var_active('wn') 
    1441         CALL iom_set_rstw_var_active('hbl') 
    1442         CALL iom_set_rstw_var_active('hbli') 
    1443      ENDIF 
    14441439   END SUBROUTINE zdf_osm_init 
    14451440 
     
    14741469        id1 = iom_varid( numror, 'wn'   , ldstop = .FALSE. ) 
    14751470        IF( id1 > 0 ) THEN                       ! 'wn' exists; read 
    1476            CALL iom_get( numror, jpdom_auto, 'wn', ww, ldxios = lrxios ) 
     1471           CALL iom_get( numror, jpdom_auto, 'wn', ww ) 
    14771472           WRITE(numout,*) ' ===>>>> :  ww read from restart file' 
    14781473        ELSE 
     
    14831478        id2 = iom_varid( numror, 'hbli'   , ldstop = .FALSE. ) 
    14841479        IF( id1 > 0 .AND. id2 > 0) THEN                       ! 'hbl' exists; read and return 
    1485            CALL iom_get( numror, jpdom_auto, 'hbl' , hbl , ldxios = lrxios ) 
    1486            CALL iom_get( numror, jpdom_auto, 'hbli', hbli, ldxios = lrxios  ) 
     1480           CALL iom_get( numror, jpdom_auto, 'hbl' , hbl ) 
     1481           CALL iom_get( numror, jpdom_auto, 'hbli', hbli  ) 
    14871482           WRITE(numout,*) ' ===>>>> :  hbl & hbli read from restart file' 
    14881483           RETURN 
     
    14971492     IF( TRIM(cdrw) == 'WRITE') THEN     !* Write hbli into the restart file, then return 
    14981493        IF(lwp) WRITE(numout,*) '---- osm-rst ----' 
    1499          CALL iom_rstput( kt, nitrst, numrow, 'wn'     , ww  , ldxios = lwxios ) 
    1500          CALL iom_rstput( kt, nitrst, numrow, 'hbl'    , hbl , ldxios = lwxios ) 
    1501          CALL iom_rstput( kt, nitrst, numrow, 'hbli'   , hbli, ldxios = lwxios ) 
     1494         CALL iom_rstput( kt, nitrst, numrow, 'wn'     , ww  ) 
     1495         CALL iom_rstput( kt, nitrst, numrow, 'hbl'    , hbl ) 
     1496         CALL iom_rstput( kt, nitrst, numrow, 'hbli'   , hbli ) 
    15021497        RETURN 
    15031498     END IF 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/src/OCE/ZDF/zdfric.F90

    r13998 r14018  
    103103      CALL ric_rst( nit000, 'READ' )  !* read or initialize all required files 
    104104      ! 
    105       IF( lwxios ) THEN 
    106          CALL iom_set_rstw_var_active('avt_k') 
    107          CALL iom_set_rstw_var_active('avm_k') 
    108       ENDIF 
    109105   END SUBROUTINE zdf_ric_init 
    110106 
     
    214210            ! 
    215211            IF( MIN( id1, id2 ) > 0 ) THEN         ! restart exists => read it 
    216                CALL iom_get( numror, jpdom_auto, 'avt_k', avt_k, ldxios = lrxios ) 
    217                CALL iom_get( numror, jpdom_auto, 'avm_k', avm_k, ldxios = lrxios ) 
     212               CALL iom_get( numror, jpdom_auto, 'avt_k', avt_k ) 
     213               CALL iom_get( numror, jpdom_auto, 'avm_k', avm_k ) 
    218214            ENDIF 
    219215         ENDIF 
     
    223219         !                                   ! ------------------- 
    224220         IF(lwp) WRITE(numout,*) '---- ric-rst ----' 
    225          IF( lwxios ) CALL iom_swap(      cwxios_context          ) 
    226          CALL iom_rstput( kt, nitrst, numrow, 'avt_k', avt_k, ldxios = lwxios ) 
    227          CALL iom_rstput( kt, nitrst, numrow, 'avm_k', avm_k, ldxios = lwxios) 
    228          IF( lwxios ) CALL iom_swap(      cxios_context          ) 
     221         CALL iom_rstput( kt, nitrst, numrow, 'avt_k', avt_k ) 
     222         CALL iom_rstput( kt, nitrst, numrow, 'avm_k', avm_k) 
    229223         ! 
    230224      ENDIF 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/src/OCE/ZDF/zdftke.F90

    r13998 r14018  
    721721      CALL tke_rst( nit000, 'READ' )      ! (en, avt_k, avm_k, dissl)  
    722722      ! 
    723       IF( lwxios ) THEN 
    724          CALL iom_set_rstw_var_active('en') 
    725          CALL iom_set_rstw_var_active('avt_k') 
    726          CALL iom_set_rstw_var_active('avm_k') 
    727          CALL iom_set_rstw_var_active('dissl') 
    728       ENDIF 
    729723   END SUBROUTINE zdf_tke_init 
    730724 
     
    758752            ! 
    759753            IF( MIN( id1, id2, id3, id4 ) > 0 ) THEN      ! fields exist 
    760                CALL iom_get( numror, jpdom_auto, 'en'   , en   , ldxios = lrxios ) 
    761                CALL iom_get( numror, jpdom_auto, 'avt_k', avt_k, ldxios = lrxios ) 
    762                CALL iom_get( numror, jpdom_auto, 'avm_k', avm_k, ldxios = lrxios ) 
    763                CALL iom_get( numror, jpdom_auto, 'dissl', dissl, ldxios = lrxios ) 
     754               CALL iom_get( numror, jpdom_auto, 'en'   , en    ) 
     755               CALL iom_get( numror, jpdom_auto, 'avt_k', avt_k ) 
     756               CALL iom_get( numror, jpdom_auto, 'avm_k', avm_k ) 
     757               CALL iom_get( numror, jpdom_auto, 'dissl', dissl ) 
    764758            ELSE                                          ! start TKE from rest 
    765759               IF(lwp) WRITE(numout,*) 
     
    780774         !                                   ! ------------------- 
    781775         IF(lwp) WRITE(numout,*) '---- tke_rst ----' 
    782          IF( lwxios ) CALL iom_swap(      cwxios_context          )  
    783          CALL iom_rstput( kt, nitrst, numrow, 'en'   , en   , ldxios = lwxios ) 
    784          CALL iom_rstput( kt, nitrst, numrow, 'avt_k', avt_k, ldxios = lwxios ) 
    785          CALL iom_rstput( kt, nitrst, numrow, 'avm_k', avm_k, ldxios = lwxios ) 
    786          CALL iom_rstput( kt, nitrst, numrow, 'dissl', dissl, ldxios = lwxios ) 
    787          IF( lwxios ) CALL iom_swap(      cxios_context          ) 
     776         CALL iom_rstput( kt, nitrst, numrow, 'en'   , en    ) 
     777         CALL iom_rstput( kt, nitrst, numrow, 'avt_k', avt_k ) 
     778         CALL iom_rstput( kt, nitrst, numrow, 'avm_k', avm_k ) 
     779         CALL iom_rstput( kt, nitrst, numrow, 'dissl', dissl ) 
    788780         ! 
    789781      ENDIF 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/src/OCE/nemogcm.F90

    r13998 r14018  
    415415     CALL Agrif_Declare_Var_ini   !  "      "   "   "      "  DOM 
    416416#endif 
    417                            CALL     dom_init( Nbb, Nnn, Naa, "OCE")   ! Domain 
    418       IF( ln_crs       )   CALL     crs_init(      Nnn            )   ! coarsened grid: domain initialization  
     417                           CALL     dom_init( Nbb, Nnn, Naa )   ! Domain 
     418      IF( ln_crs       )   CALL     crs_init(      Nnn      )   ! coarsened grid: domain initialization  
    419419      IF( sn_cfctl%l_prtctl )   & 
    420420         &                 CALL prt_ctl_init        ! Print control 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/src/OCE/oce.F90

    r13608 r14018  
    7171   !! Shallow Water Eq. case (SWE) 
    7272   LOGICAL, PUBLIC ::   lk_SWE = .FALSE.                                   !: shallow water flag =T in SWE configurations only 
     73 
     74   !! Stand-Alone Surface module (SAS) 
     75   LOGICAL, PUBLIC ::   l_SAS = .FALSE.                                    !: SAS flag =T in SAS configurations only 
     76    
    7377    
    7478   !!---------------------------------------------------------------------- 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/src/OCE/step.F90

    r13915 r14018  
    122122         IF( ln_crs      )   CALL iom_init( TRIM(cxios_context)//"_crs" )  ! for coarse grid 
    123123      ENDIF 
     124      IF((kstp == nitrst) .AND. lwxios) THEN 
     125         CALL iom_swap(      cw_ocerst_cxt          ) 
     126         CALL iom_init_closedef(cw_ocerst_cxt) 
     127         CALL iom_setkt( kstp - nit000 + 1,      cw_ocerst_cxt          ) 
     128#if defined key_top 
     129         CALL iom_swap(      cw_toprst_cxt          ) 
     130         CALL iom_init_closedef(cw_toprst_cxt) 
     131         CALL iom_setkt( kstp - nit000 + 1,      cw_toprst_cxt          ) 
     132#endif 
     133      ENDIF 
     134#if defined key_si3 
     135      IF(((kstp + nn_fsbc - 1) == nitrst) .AND. lwxios) THEN 
     136         CALL iom_swap(      cw_icerst_cxt          ) 
     137         CALL iom_init_closedef(cw_icerst_cxt) 
     138         CALL iom_setkt( kstp - nit000 + 1,      cw_icerst_cxt          ) 
     139      ENDIF 
     140#endif 
    124141      IF( kstp /= nit000 )   CALL day( kstp )         ! Calendar (day was already called at nit000 in day_init) 
    125142                             CALL iom_setkt( kstp - nit000 + 1,      cxios_context          )   ! tell IOM we are at time step kstp 
     
    336353      IF( kstp == nit000 ) THEN                          ! 1st time step only 
    337354                                        CALL iom_close( numror )   ! close input  ocean restart file 
     355         IF( lrxios )                   CALL iom_context_finalize(      cr_ocerst_cxt         ) 
    338356         IF(lwm)                        CALL FLUSH    ( numond )   ! flush output namelist oce 
    339357         IF(lwm .AND. numoni /= -1 )    CALL FLUSH    ( numoni )   ! flush output namelist ice (if exist) 
     
    351369      IF( kstp == nitend .OR. nstop > 0 ) THEN  
    352370                      CALL iom_context_finalize(      cxios_context          ) ! needed for XIOS+AGRIF 
    353          IF( lrxios ) CALL iom_context_finalize(      crxios_context         ) 
    354371         IF( ln_crs ) CALL iom_context_finalize( trim(cxios_context)//"_crs" ) !  
    355372      ENDIF 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/src/OFF/dtadyn.F90

    r13998 r14018  
    4646   USE fldread         ! read input fields  
    4747   USE timing          ! Timing 
    48    USE trc, ONLY : ln_rsttr, numrtr, numrtw, lrst_trc 
     48   USE trc, ONLY : ln_rsttr, lrst_trc 
    4949 
    5050   IMPLICIT NONE 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/src/OFF/nemogcm.F90

    r13998 r14018  
    130130         ENDIF 
    131131         ! 
     132      IF((istp == nitrst) .AND. lwxios) THEN 
     133         CALL iom_swap(      cw_toprst_cxt          ) 
     134         CALL iom_init_closedef(cw_toprst_cxt) 
     135         CALL iom_setkt( istp - nit000 + 1,      cw_toprst_cxt          ) 
     136      ENDIF 
     137 
    132138         IF( istp /= nit000 )   CALL day        ( istp )         ! Calendar (day was already called at nit000 in day_init) 
    133139                                CALL iom_setkt  ( istp - nit000 + 1, cxios_context )   ! say to iom that we are at time step kstp 
     
    344350                           CALL     eos_init        ! Equation of state 
    345351      IF( lk_c1d       )   CALL     c1d_init        ! 1D column configuration 
    346                            CALL     dom_init( Nbb, Nnn, Naa, "OPA") ! Domain 
     352                           CALL     dom_init( Nbb, Nnn, Naa ) ! Domain 
    347353      IF( sn_cfctl%l_prtctl )   & 
    348354         &                 CALL prt_ctl_init        ! Print control 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/src/SAO/nemogcm.F90

    r13286 r14018  
    235235                           CALL phy_cst            ! Physical constants 
    236236                           CALL eos_init           ! Equation of state 
    237                            CALL dom_init( Nbb, Nnn, Naa, 'SAO')    ! Domain 
     237                           CALL dom_init( Nbb, Nnn, Naa )    ! Domain 
    238238 
    239239 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/src/SAS/nemogcm.F90

    r13998 r14018  
    215215      !!---------------------------------------------------------------------- 
    216216      ! 
    217       IF( lk_oasis ) THEN   ;   cxios_context = 'sas' 
    218       ELSE                  ;   cxios_context = 'nemo' 
     217      IF( lk_oasis ) THEN   ;   cxios_context = 'sas'    ! when coupling SAS to OCE 
     218      ELSE                  ;   cxios_context = 'nemo'   !  
    219219      ENDIF 
    220220      nn_hls = 1 
     221      ! 
     222      l_SAS = .TRUE.   ! used in domain:dom_nam 
    221223      ! 
    222224      !                             !-------------------------------------------------! 
     
    374376     CALL Agrif_Declare_Var_ini   !  "      "   "   "      "  DOM 
    375377#endif 
    376                            CALL dom_init( Nbb, Nnn, Naa, 'SAS') ! Domain 
     378                           CALL dom_init( Nbb, Nnn, Naa ) ! Domain 
    377379      IF( sn_cfctl%l_prtctl )   & 
    378380         &                 CALL prt_ctl_init        ! Print control 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/src/SAS/step.F90

    r12933 r14018  
    8989#endif    
    9090      IF( kstp == nit000 )   CALL iom_init( cxios_context ) ! iom_put initialization (must be done after nemo_init for AGRIF+XIOS+OASIS) 
     91                             CALL iom_setkt( kstp - nit000 + 1, cxios_context )   ! tell iom we are at time step kstp 
     92      IF((kstp == nitrst) .AND. lwxios) THEN 
     93         CALL iom_swap(      cw_ocerst_cxt          ) 
     94         CALL iom_init_closedef(cw_ocerst_cxt) 
     95         CALL iom_setkt( kstp - nit000 + 1,      cw_ocerst_cxt          ) 
     96#if defined key_top 
     97         CALL iom_swap(      cw_toprst_cxt          ) 
     98         CALL iom_init_closedef(cw_toprst_cxt) 
     99         CALL iom_setkt( kstp - nit000 + 1,      cw_toprst_cxt          ) 
     100#endif 
     101      ENDIF 
    91102      IF( kstp /= nit000 )   CALL day( kstp )             ! Calendar (day was already called at nit000 in day_init) 
    92                              CALL iom_setkt( kstp - nit000 + 1, cxios_context )   ! tell iom we are at time step kstp 
     103 
     104#if defined key_si3 
     105      IF(((kstp + nn_fsbc - 1) == nitrst) .AND. lwxios) THEN 
     106         CALL iom_swap(      cw_icerst_cxt          ) 
     107         CALL iom_init_closedef(cw_icerst_cxt) 
     108         CALL iom_setkt( kstp - nit000 + 1,      cw_icerst_cxt          ) 
     109      ENDIF 
     110#endif 
    93111 
    94112      ! ==> clem: open boundaries is mandatory for sea-ice because ice BDY is not decoupled from   
     
    128146      ! File manipulation at the end of the first time step 
    129147      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<                          
    130       IF( kstp == nit000   ) CALL iom_close( numror )                          ! close input  ocean restart file 
     148      IF( kstp == nit000   ) THEN 
     149            CALL iom_close( numror )                          ! close input  ocean restart file 
     150            IF( lrxios )     CALL iom_context_finalize(      cr_ocerst_cxt      ) 
     151      ENDIF 
    131152       
    132153      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     
    140161            CALL iom_close( numrow )      
    141162         ELSE 
    142             CALL iom_context_finalize( cwxios_context ) 
     163            CALL iom_context_finalize( cw_ocerst_cxt ) 
     164            iom_file(numrow)%nfid       = 0 
     165            numrow = 0 
    143166         ENDIF 
    144167         lrst_oce = .FALSE. 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/src/SWE/nemogcm.F90

    r13769 r14018  
    296296                           r1_rho0_rcp = 1._wp / rho0_rcp  
    297297      ! 
    298                            CALL     dom_init( Nbb, Nnn, Naa, "OPA") ! Domain 
     298                           CALL     dom_init( Nbb, Nnn, Naa ) ! Domain 
    299299 
    300300      IF( sn_cfctl%l_prtctl )   & 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/src/TOP/C14/trcsms_c14.F90

    r13295 r14018  
    144144         IF(lwp) WRITE(numout,*) ' ~~~~~~~~~~~~~~' 
    145145         ! 
    146          CALL iom_rstput( kt, nitrst, numrtw, 'co2sbc', co2sbc )       ! These five need      & 
    147          CALL iom_rstput( kt, nitrst, numrtw, 'c14sbc', c14sbc )     ! &    to be written   & 
     146         CALL iom_rstput( kt, nitrst, numrtw, 'co2sbc', co2sbc ) ! These five need      & 
     147         CALL iom_rstput( kt, nitrst, numrtw, 'c14sbc', c14sbc ) ! &    to be written   & 
    148148         CALL iom_rstput( kt, nitrst, numrtw, 'exch_co2', exch_co2 ) ! &    for temporal    & 
    149149         CALL iom_rstput( kt, nitrst, numrtw, 'exch_c14', exch_c14 ) ! &    averages        & 
    150          CALL iom_rstput( kt, nitrst, numrtw, 'qtr_c14', qtr_c14 ! &    to be coherent. 
     150         CALL iom_rstput( kt, nitrst, numrtw, 'qtr_c14', qtr_c14   ) ! &    to be coherent. 
    151151         CALL iom_rstput( kt, nitrst, numrtw, 'qint_c14', qint_c14 ) ! Cumulative 
    152152         ! 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/src/TOP/PISCES/P4Z/p4zsms.F90

    r13998 r14018  
    369369            IF(lwp) WRITE(numout,*) '~~~~~~~' 
    370370         ENDIF 
    371          CALL iom_rstput( kt, nitrst, numrtw, 'PH', hi(:,:,:) ) 
    372          CALL iom_rstput( kt, nitrst, numrtw, 'Silicalim', xksi(:,:) ) 
     371         CALL iom_rstput( kt, nitrst, numrtw, 'PH', hi(:,:,:)           ) 
     372         CALL iom_rstput( kt, nitrst, numrtw, 'Silicalim', xksi(:,:)    ) 
    373373         CALL iom_rstput( kt, nitrst, numrtw, 'Silicamax', xksimax(:,:) ) 
    374374         CALL iom_rstput( kt, nitrst, numrtw, 'tcflxcum', t_oce_co2_flx_cum ) 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/src/TOP/PISCES/SED/sed.F90

    r10425 r14018  
    4444   REAL    , PUBLIC               ::  sedmask 
    4545   REAL(wp), PUBLIC               ::  denssol                !: density of solid material 
    46    INTEGER , PUBLIC               ::  numrsr, numrsw   !: logical unit for sed restart (read and write) 
    4746   LOGICAL , PUBLIC               ::  lrst_sed       !: logical to control the trc restart write 
    4847   LOGICAL , PUBLIC               ::  ln_rst_sed  = .TRUE.     !: initialisation from a restart file or not 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/src/TOP/PISCES/SED/sedrst.F90

    r13286 r14018  
    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 
    4445      !!---------------------------------------------------------------------- 
    4546      ! 
     
    8081         IF(lwp) WRITE(numsed,*) & 
    8182             '             open sed restart.output NetCDF file: ',TRIM(clpath)//clname 
    82          CALL iom_open( TRIM(clpath)//TRIM(clname), numrsw, ldwrt = .TRUE., kdlev = jpksed, cdcomp = 'SED' ) 
     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_iomput 
     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               clinfo = 'Can not use XIOS in trc_rst_opn' 
     97               CALL ctl_stop(TRIM(clinfo)) 
     98#endif 
     99            ENDIF 
     100 
    83101         lrst_sed = .TRUE. 
    84102      ENDIF 
     
    196214      CALL pack_arr( jpoce, sedligand(1:jpoce,1:jpksed), & 
    197215         &             zdta2(1:jpi,1:jpj,1:jpksed), iarroce(1:jpoce) ) 
    198  
    199216      IF( ln_timing )  CALL timing_stop('sed_rst_read') 
    200217      
     
    240257      !! 1. WRITE in nutwrs 
    241258      !! ------------------ 
    242  
    243       zinfo(1) = REAL( kt) 
    244       CALL iom_rstput( kt, nitrst, numrsw, 'kt', zinfo  ) 
     259!     zinfo(1) = REAL( kt) 
     260      CALL iom_rstput( kt, nitrst, numrsw, 'kt', REAL( kt    , wp) ) 
    245261 
    246262      ! Back to 2D geometry 
     
    299315 
    300316      IF( kt == nitrst ) THEN 
    301           CALL iom_close( numrsw )     ! close the restart file (only at last time step) 
     317          IF(.NOT.lwxios) THEN 
     318             CALL iom_close( numrsw )     ! close the restart file (only at last time step) 
     319          ELSE 
     320             CALL iom_context_finalize( cw_sedrst_cxt )  
     321             iom_file(numrsw)%nfid       = 0 
     322             numrsw = 0 
     323          ENDIF 
    302324          IF( l_offline .AND. ln_rst_list ) THEN 
    303325             nrst_lst = nrst_lst + 1 
     
    342364      REAL(wp) ::  zkt, zrdttrc1 
    343365      REAL(wp) ::  zndastp 
     366      CHARACTER(len = 82) :: clpname 
    344367 
    345368      ! Time domain : restart 
     
    353376 
    354377         IF( ln_rst_sed ) THEN 
     378            lxios_sini = .FALSE. 
    355379            CALL iom_open( TRIM(cn_sedrst_indir)//'/'//cn_sedrst_in, numrsr ) 
     380 
     381            IF( lrxios) THEN 
     382                cr_sedrst_cxt = 'sed_rst' 
     383                IF(lwp) WRITE(numout,*) 'Enable restart reading by XIOS for SED' 
     384!               IF( TRIM(Agrif_CFixed()) == '0' ) THEN 
     385!                  clpname = cn_sedrst_in 
     386!               ELSE 
     387!                  clpname = TRIM(Agrif_CFixed())//"_"//cn_sedrst_in    
     388!               ENDIF 
     389                CALL iom_init( cr_sedrst_cxt, kdid = numrsr, ld_closedef = .TRUE. ) 
     390            ENDIF 
    356391            CALL iom_get ( numrsr, 'kt', zkt )   ! last time-step of previous run 
    357  
    358392            IF(lwp) THEN 
    359393               WRITE(numsed,*) ' *** Info read in restart : ' 
     
    402436            IF(lwp) WRITE(numsed,*) 'trc_wri : write the TOP restart file (NetCDF) at it= ', kt, ' date= ', ndastp 
    403437            IF(lwp) WRITE(numsed,*) '~~~~~~~' 
     438            IF( lwxios ) CALL iom_init_closedef(cw_sedrst_cxt) 
    404439         ENDIF 
    405440         CALL iom_rstput( kt, nitrst, numrsw, 'kt'     , REAL( kt    , wp) )   ! time-step 
    406441         CALL iom_rstput( kt, nitrst, numrsw, 'ndastp' , REAL( ndastp, wp) )   ! date 
    407          CALL iom_rstput( kt, nitrst, numrsw, 'adatrj' , adatrj            )   ! number of elapsed days since 
    408          !                                                                     ! the begining of the run [s] 
     442         CALL iom_rstput( kt, nitrst, numrsw, 'adatrj' , adatrj )   ! number of elapsed days since 
     443         !                                                                                      ! the begining of the run [s] 
    409444      ENDIF 
    410445 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/src/TOP/PISCES/SED/sedstp.F90

    r12489 r14018  
    8686      IF( kt == nitsed000 ) THEN 
    8787          CALL iom_close( numrsr )       ! close input tracer restart file 
    88 !          IF(lwm) CALL FLUSH( numont )   ! flush namelist output 
     88          IF(lrxios) CALL iom_context_finalize(      cr_sedrst_cxt  ) 
     89!         IF(lwm) CALL FLUSH( numont )   ! flush namelist output 
    8990      ENDIF 
    9091      IF( lrst_sed )            CALL sed_rst_wri( kt )   ! restart file output 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/src/TOP/trc.F90

    r13998 r14018  
    2121   INTEGER, PUBLIC ::   numonr     = -1   !: reference passive tracer namelist output output.namelist.top 
    2222   INTEGER, PUBLIC ::   numstr            !: tracer statistics 
    23    INTEGER, PUBLIC ::   numrtr     = -1   !: trc restart (read ) 
    24    INTEGER, PUBLIC ::   numrtw            !: trc restart ( write ) 
    2523   CHARACTER(:), ALLOCATABLE, PUBLIC ::   numnat_ref   !: character buffer for reference passive tracer namelist_top_ref 
    2624   CHARACTER(:), ALLOCATABLE, PUBLIC ::   numnat_cfg   !: character buffer for configuration specific passive tracer namelist_top_cfg 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/src/TOP/trcrst.F90

    r13998 r14018  
    5252      CHARACTER(LEN=50)   ::   clname   ! trc output restart file name 
    5353      CHARACTER(LEN=256)  ::   clpath   ! full path to ocean output restart file 
     54      CHARACTER(LEN=50)   ::   clpname  ! trc output restart file name including AGRIF 
    5455      !!---------------------------------------------------------------------- 
    5556      ! 
     
    9192         IF(lwp) WRITE(numout,*) & 
    9293             '             open trc restart.output NetCDF file: ',TRIM(clpath)//clname 
    93          CALL iom_open( TRIM(clpath)//TRIM(clname), numrtw, ldwrt = .TRUE. ) 
     94         IF(.NOT.lwxios) THEN 
     95            CALL iom_open( TRIM(clpath)//TRIM(clname), numrtw, ldwrt = .TRUE. ) 
     96         ELSE 
     97#if defined key_iomput 
     98            cw_toprst_cxt = "rstwt_"//TRIM(ADJUSTL(clkt)) 
     99            IF( TRIM(Agrif_CFixed()) == '0' ) THEN 
     100               clpname = clname 
     101            ELSE 
     102               clpname = TRIM(Agrif_CFixed())//"_"//clname 
     103            ENDIF 
     104            numrtw = iom_xios_setid(TRIM(clpath)//TRIM(clpname)) 
     105            CALL iom_init( cw_toprst_cxt, kdid = numrtw, ld_closedef = .FALSE. ) 
     106#else 
     107               clinfo = 'Can not use XIOS in trc_rst_opn' 
     108               CALL ctl_stop(TRIM(clinfo)) 
     109#endif 
     110            ENDIF 
    94111         lrst_trc = .TRUE. 
    95112      ENDIF 
     
    121138      END DO 
    122139      ! 
    123       CALL iom_delay_rst( 'READ', 'TOP', numrtr )   ! read only TOP delayed global communication variables 
    124        
     140      IF(.NOT.lrxios) CALL iom_delay_rst( 'READ', 'TOP', numrtr )   ! read only TOP delayed global communication variables 
    125141   END SUBROUTINE trc_rst_read 
    126142 
     
    147163         CALL iom_rstput( kt, nitrst, numrtw, 'TRB'//ctrcnm(jn), tr(:,:,:,jn,Kbb) ) 
    148164      END DO 
    149       ! 
    150       CALL iom_delay_rst( 'WRITE', 'TOP', numrtw )   ! save only TOP delayed global communication variables 
     165 
     166      IF( .NOT. lwxios ) CALL iom_delay_rst( 'WRITE', 'TOP', numrtw )   ! save only TOP delayed global communication variables 
    151167     
    152168      IF( kt == nitrst ) THEN 
    153169          CALL trc_rst_stat( Kmm, Krhs )             ! statistics 
    154           CALL iom_close( numrtw )     ! close the restart file (only at last time step) 
     170          IF(lwxios) THEN 
     171             CALL iom_context_finalize(      cw_toprst_cxt          ) 
     172             iom_file(numrtw)%nfid       = 0 
     173             numrtw = 0 
     174          ELSE 
     175             CALL iom_close( numrtw )     ! close the restart file (only at last time step) 
     176          ENDIF 
    155177#if ! defined key_trdmxl_trc 
    156178          lrst_trc = .FALSE. 
     
    196218      REAL(wp) ::  zrdttrc1, zkt, zndastp, zdayfrac, ksecs, ktime 
    197219      INTEGER  ::   ihour, iminute 
     220      CHARACTER(len=82) :: clpname 
    198221 
    199222      ! Time domain : restart 
     
    207230 
    208231         IF( ln_rsttr ) THEN 
     232            lxios_sini = .FALSE. 
    209233            CALL iom_open( TRIM(cn_trcrst_indir)//'/'//cn_trcrst_in, numrtr ) 
     234            IF( lrxios) THEN 
     235                cr_toprst_cxt = 'top_rst' 
     236                IF(lwp) WRITE(numout,*) 'Enable restart reading by XIOS for TOP' 
     237!               IF( TRIM(Agrif_CFixed()) == '0' ) THEN 
     238!                  clpname = cn_trcrst_in 
     239!               ELSE 
     240!                  clpname = TRIM(Agrif_CFixed())//"_"//cn_trcrst_in    
     241!               ENDIF 
     242                CALL iom_init( cr_toprst_cxt, kdid = numrtr, ld_closedef = .TRUE. ) 
     243            ENDIF 
     244 
    210245            CALL iom_get ( numrtr, 'kt', zkt )   ! last time-step of previous run 
    211246 
     
    293328            IF(lwp) WRITE(numout,*) '~~~~~~~' 
    294329         ENDIF 
    295          CALL iom_rstput( kt, nitrst, numrtw, 'kt'     , REAL( kt    , wp) )   ! time-step 
    296          CALL iom_rstput( kt, nitrst, numrtw, 'ndastp' , REAL( ndastp, wp) )   ! date 
    297          CALL iom_rstput( kt, nitrst, numrtw, 'adatrj' , adatrj            )   ! number of elapsed days since 
     330         CALL iom_rstput( kt, nitrst, numrtw, 'kt'     , REAL( kt    , wp)   )   ! time-step 
     331         CALL iom_rstput( kt, nitrst, numrtw, 'ndastp' , REAL( ndastp, wp)   )   ! date 
     332         CALL iom_rstput( kt, nitrst, numrtw, 'adatrj' , adatrj              )   ! number of elapsed days since 
    298333         !                                                                     ! the begining of the run [s] 
    299          CALL iom_rstput( kt, nitrst, numrtw, 'ntime'  , REAL( nn_time0, wp)) ! time 
     334         CALL iom_rstput( kt, nitrst, numrtw, 'ntime'  , REAL( nn_time0, wp) ) ! time 
    300335      ENDIF 
    301336 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/src/TOP/trcstp.F90

    r13286 r14018  
    110110      IF( kt == nittrc000 ) THEN 
    111111         CALL iom_close( numrtr )                         ! close input tracer restart file 
     112         IF(lrxios) CALL iom_context_finalize(      cr_toprst_cxt          ) 
    112113         IF(lwm) CALL FLUSH( numont )                     ! flush namelist output 
    113114      ENDIF 
     
    196197           &                              .AND. iom_varid( numrtr, 'ktdcy'    , ldstop = .FALSE. ) > 0  & 
    197198           &                              .AND. iom_varid( numrtr, 'nrdcy'    , ldstop = .FALSE. ) > 0  ) THEN 
    198  
    199199            CALL iom_get( numrtr, 'ktdcy', zkt )   
    200200            rsecfst = INT( zkt ) * rn_Dt 
Note: See TracChangeset for help on using the changeset viewer.