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 12377 for NEMO/trunk/tests/CANAL – NEMO

Ignore:
Timestamp:
2020-02-12T15:39:06+01:00 (4 years ago)
Author:
acc
Message:

The big one. Merging all 2019 developments from the option 1 branch back onto the trunk.

This changeset reproduces 2019/dev_r11943_MERGE_2019 on the trunk using a 2-URL merge
onto a working copy of the trunk. I.e.:

svn merge --ignore-ancestry \

svn+ssh://acc@forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/NEMO/trunk \
svn+ssh://acc@forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/NEMO/branches/2019/dev_r11943_MERGE_2019 ./

The --ignore-ancestry flag avoids problems that may otherwise arise from the fact that
the merge history been trunk and branch may have been applied in a different order but
care has been taken before this step to ensure that all applicable fixes and updates
are present in the merge branch.

The trunk state just before this step has been branched to releases/release-4.0-HEAD
and that branch has been immediately tagged as releases/release-4.0.2. Any fixes
or additions in response to tickets on 4.0, 4.0.1 or 4.0.2 should be done on
releases/release-4.0-HEAD. From now on future 'point' releases (e.g. 4.0.2) will
remain unchanged with periodic releases as needs demand. Note release-4.0-HEAD is a
transitional naming convention. Future full releases, say 4.2, will have a release-4.2
branch which fulfills this role and the first point release (e.g. 4.2.0) will be made
immediately following the release branch creation.

2020 developments can be started from any trunk revision later than this one.

Location:
NEMO/trunk
Files:
10 edited
1 copied

Legend:

Unmodified
Added
Removed
  • NEMO/trunk

    • Property svn:externals
      •  

        old new  
        33^/utils/build/mk@HEAD         mk 
        44^/utils/tools@HEAD            tools 
        5 ^/vendors/AGRIF/dev@HEAD      ext/AGRIF 
         5^/vendors/AGRIF/dev_r11615_ENHANCE-04_namelists_as_internalfiles_agrif@HEAD      ext/AGRIF 
        66^/vendors/FCM@HEAD            ext/FCM 
        77^/vendors/IOIPSL@HEAD         ext/IOIPSL 
  • NEMO/trunk/tests/CANAL/EXPREF/field_def_nemo-oce.xml

    r12230 r12377  
    11<?xml version="1.0"?>  
    22    <!-- $id$ --> 
     3 
     4    <field_definition level="1" prec="4" operation="average" enabled=".TRUE." default_value="1.e20" > <!-- time step automaticaly defined --> 
     5 
     6    <!-- 
     7       ===================================================================================================== 
     8       =                                   Configurable diagnostics                                        = 
     9       ===================================================================================================== 
     10      --> 
     11 
     12    <field_group id="diamlr_fields"> 
     13 
     14    <!-- 
     15       ===================================================================================================== 
     16                         Configuration of multiple-linear-regression analysis (diamlr) 
     17       ===================================================================================================== 
     18        
     19       This field group configures diamlr for tidal harmonic analysis of field 
     20       ssh: in addition to a regressor for fitting the mean value (diamlr_r101), 
     21       it includes the regressors for the analysis of the tidal constituents 
     22       that are available in the tidal-forcing implementation (see 
     23       ./src/OCE/SBC/tide.h90). 
     24 
     25      --> 
     26 
     27      <!-- Time --> 
     28      <field id="diamlr_time" grid_ref="diamlr_grid_T_2D" prec="8" /> 
     29 
     30      <!-- Regressors for tidal harmonic analysis --> 
     31      <field id="diamlr_r001"  field_ref="diamlr_time" expr="sin( __TDE_M2_omega__   * diamlr_time )" enabled=".TRUE."  comment="harmonic:sin:M2"   /> 
     32      <field id="diamlr_r002"  field_ref="diamlr_time" expr="cos( __TDE_M2_omega__   * diamlr_time )" enabled=".TRUE."  comment="harmonic:cos:M2"   /> 
     33      <field id="diamlr_r003"  field_ref="diamlr_time" expr="sin( __TDE_N2_omega__   * diamlr_time )" enabled=".TRUE."  comment="harmonic:sin:N2"   /> 
     34      <field id="diamlr_r004"  field_ref="diamlr_time" expr="cos( __TDE_N2_omega__   * diamlr_time )" enabled=".TRUE."  comment="harmonic:cos:N2"   /> 
     35      <field id="diamlr_r005"  field_ref="diamlr_time" expr="sin( __TDE_2N2_omega__  * diamlr_time )" enabled=".TRUE."  comment="harmonic:sin:2N2"  /> 
     36      <field id="diamlr_r006"  field_ref="diamlr_time" expr="cos( __TDE_2N2_omega__  * diamlr_time )" enabled=".TRUE."  comment="harmonic:cos:2N2"  /> 
     37      <field id="diamlr_r007"  field_ref="diamlr_time" expr="sin( __TDE_S2_omega__   * diamlr_time )" enabled=".TRUE."  comment="harmonic:sin:S2"   /> 
     38      <field id="diamlr_r008"  field_ref="diamlr_time" expr="cos( __TDE_S2_omega__   * diamlr_time )" enabled=".TRUE."  comment="harmonic:cos:S2"   /> 
     39      <field id="diamlr_r009"  field_ref="diamlr_time" expr="sin( __TDE_K2_omega__   * diamlr_time )" enabled=".TRUE."  comment="harmonic:sin:K2"   /> 
     40      <field id="diamlr_r010"  field_ref="diamlr_time" expr="cos( __TDE_K2_omega__   * diamlr_time )" enabled=".TRUE."  comment="harmonic:cos:K2"   /> 
     41      <field id="diamlr_r011"  field_ref="diamlr_time" expr="sin( __TDE_K1_omega__   * diamlr_time )" enabled=".TRUE."  comment="harmonic:sin:K1"   /> 
     42      <field id="diamlr_r012"  field_ref="diamlr_time" expr="cos( __TDE_K1_omega__   * diamlr_time )" enabled=".TRUE."  comment="harmonic:cos:K1"   /> 
     43      <field id="diamlr_r013"  field_ref="diamlr_time" expr="sin( __TDE_O1_omega__   * diamlr_time )" enabled=".TRUE."  comment="harmonic:sin:O1"   /> 
     44      <field id="diamlr_r014"  field_ref="diamlr_time" expr="cos( __TDE_O1_omega__   * diamlr_time )" enabled=".TRUE."  comment="harmonic:cos:O1"   /> 
     45      <field id="diamlr_r015"  field_ref="diamlr_time" expr="sin( __TDE_Q1_omega__   * diamlr_time )" enabled=".TRUE."  comment="harmonic:sin:Q1"   /> 
     46      <field id="diamlr_r016"  field_ref="diamlr_time" expr="cos( __TDE_Q1_omega__   * diamlr_time )" enabled=".TRUE."  comment="harmonic:cos:Q1"   /> 
     47      <field id="diamlr_r017"  field_ref="diamlr_time" expr="sin( __TDE_P1_omega__   * diamlr_time )" enabled=".TRUE."  comment="harmonic:sin:P1"   /> 
     48      <field id="diamlr_r018"  field_ref="diamlr_time" expr="cos( __TDE_P1_omega__   * diamlr_time )" enabled=".TRUE."  comment="harmonic:cos:P1"   /> 
     49      <field id="diamlr_r019"  field_ref="diamlr_time" expr="sin( __TDE_M4_omega__   * diamlr_time )" enabled=".TRUE."  comment="harmonic:sin:M4"   /> 
     50      <field id="diamlr_r020"  field_ref="diamlr_time" expr="cos( __TDE_M4_omega__   * diamlr_time )" enabled=".TRUE."  comment="harmonic:cos:M4"   /> 
     51      <field id="diamlr_r021"  field_ref="diamlr_time" expr="sin( __TDE_Mf_omega__   * diamlr_time )" enabled=".TRUE."  comment="harmonic:sin:Mf"   /> 
     52      <field id="diamlr_r022"  field_ref="diamlr_time" expr="cos( __TDE_Mf_omega__   * diamlr_time )" enabled=".TRUE."  comment="harmonic:cos:Mf"   /> 
     53      <field id="diamlr_r023"  field_ref="diamlr_time" expr="sin( __TDE_Mm_omega__   * diamlr_time )" enabled=".TRUE."  comment="harmonic:sin:Mm"   /> 
     54      <field id="diamlr_r024"  field_ref="diamlr_time" expr="cos( __TDE_Mm_omega__   * diamlr_time )" enabled=".TRUE."  comment="harmonic:cos:Mm"   /> 
     55      <field id="diamlr_r025"  field_ref="diamlr_time" expr="sin( __TDE_Msqm_omega__ * diamlr_time )" enabled=".TRUE."  comment="harmonic:sin:Msqm" /> 
     56      <field id="diamlr_r026"  field_ref="diamlr_time" expr="cos( __TDE_Msqm_omega__ * diamlr_time )" enabled=".TRUE."  comment="harmonic:cos:Msqm" /> 
     57      <field id="diamlr_r027"  field_ref="diamlr_time" expr="sin( __TDE_Mtm_omega__  * diamlr_time )" enabled=".TRUE."  comment="harmonic:sin:Mtm"  /> 
     58      <field id="diamlr_r028"  field_ref="diamlr_time" expr="cos( __TDE_Mtm_omega__  * diamlr_time )" enabled=".TRUE."  comment="harmonic:cos:Mtm"  /> 
     59      <field id="diamlr_r029"  field_ref="diamlr_time" expr="sin( __TDE_S1_omega__   * diamlr_time )" enabled=".TRUE."  comment="harmonic:sin:S1"   /> 
     60      <field id="diamlr_r030"  field_ref="diamlr_time" expr="cos( __TDE_S1_omega__   * diamlr_time )" enabled=".TRUE."  comment="harmonic:cos:S1"   /> 
     61      <field id="diamlr_r031"  field_ref="diamlr_time" expr="sin( __TDE_MU2_omega__  * diamlr_time )" enabled=".TRUE."  comment="harmonic:sin:MU2"  /> 
     62      <field id="diamlr_r032"  field_ref="diamlr_time" expr="cos( __TDE_MU2_omega__  * diamlr_time )" enabled=".TRUE."  comment="harmonic:cos:MU2"  /> 
     63      <field id="diamlr_r033"  field_ref="diamlr_time" expr="sin( __TDE_NU2_omega__  * diamlr_time )" enabled=".TRUE."  comment="harmonic:sin:NU2"  /> 
     64      <field id="diamlr_r034"  field_ref="diamlr_time" expr="cos( __TDE_NU2_omega__  * diamlr_time )" enabled=".TRUE."  comment="harmonic:cos:NU2"  /> 
     65      <field id="diamlr_r035"  field_ref="diamlr_time" expr="sin( __TDE_L2_omega__   * diamlr_time )" enabled=".TRUE."  comment="harmonic:sin:L2"   /> 
     66      <field id="diamlr_r036"  field_ref="diamlr_time" expr="cos( __TDE_L2_omega__   * diamlr_time )" enabled=".TRUE."  comment="harmonic:cos:L2"   /> 
     67      <field id="diamlr_r037"  field_ref="diamlr_time" expr="sin( __TDE_T2_omega__   * diamlr_time )" enabled=".TRUE."  comment="harmonic:sin:T2"   /> 
     68      <field id="diamlr_r038"  field_ref="diamlr_time" expr="cos( __TDE_T2_omega__   * diamlr_time )" enabled=".TRUE."  comment="harmonic:cos:T2"   /> 
     69      <field id="diamlr_r101"  field_ref="diamlr_time" expr="diamlr_time^0.0"                         enabled=".TRUE."  comment="mean"              /> 
     70 
     71      <!-- Fields selected for regression analysis --> 
     72      <field id="diamlr_f001" field_ref="ssh" enabled=".TRUE." /> 
     73 
     74    </field_group> 
    375     
    476    <!--  
     
    880============================================================================================================ 
    981    --> 
    10     <field_definition level="1" prec="4" operation="average" enabled=".TRUE." default_value="1.e20" > <!-- time step automaticaly defined --> 
     82 
     83    <field_group id="diadetide_fields"> 
     84 
     85    <!-- 
     86       ===================================================================================================== 
     87                 Weight fields for the computation of daily detided model diagnostics (diadetide) 
     88       ===================================================================================================== 
     89 
     90       --> 
     91 
     92      <field id="diadetide_weight" grid_ref="diadetide_grid_T_2D" enabled=".TRUE." /> 
     93      <field id="diadetide_weight_grid_T_2D" field_ref="diadetide_weight" grid_ref="diadetide_grid_T_2D" enabled=".TRUE." > this </field> 
     94      <field id="diadetide_weight_grid_U_2D" field_ref="diadetide_weight" grid_ref="diadetide_grid_U_2D" enabled=".TRUE." > this </field> 
     95      <field id="diadetide_weight_grid_V_2D" field_ref="diadetide_weight" grid_ref="diadetide_grid_V_2D" enabled=".TRUE." > this </field> 
     96      <field id="diadetide_weight_grid_T_3D" field_ref="diadetide_weight" grid_ref="diadetide_grid_2D_to_grid_T_3D" enabled=".TRUE." > this </field> 
     97      <field id="diadetide_weight_grid_U_3D" field_ref="diadetide_weight" grid_ref="diadetide_grid_2D_to_grid_U_3D" enabled=".TRUE." > this </field> 
     98      <field id="diadetide_weight_grid_V_3D" field_ref="diadetide_weight" grid_ref="diadetide_grid_2D_to_grid_V_3D" enabled=".TRUE." > this </field> 
     99      <field id="diadetide_weight_grid_W_3D" field_ref="diadetide_weight" grid_ref="diadetide_grid_2D_to_grid_W_3D" enabled=".TRUE." > this </field> 
     100 
     101    </field_group> 
    11102 
    12103    <!--  
     
    22113        <field id="salgrad"          long_name="module of salinity gradient"              unit="psu/m"   grid_ref="grid_T_3D"/> 
    23114        <field id="salgrad2"         long_name="square of module of salinity gradient"    unit="psu2/m2" grid_ref="grid_T_3D"/> 
    24         <field id="ke"             long_name="kinetic energy"                           unit="m2/s2"   grid_ref="grid_T_3D"/> 
    25         <field id="ke_zint"        long_name="vertical integration of kinetic energy"   unit="m3/s2"   /> 
     115        <field id="ke"               long_name="kinetic energy"                           unit="m2/s2"   grid_ref="grid_T_3D"/> 
     116        <field id="ke_zint"          long_name="vertical integration of kinetic energy"   unit="m3/s2"   /> 
    26117        <field id="relvor"           long_name="relative vorticity"                       unit="s-1"    grid_ref="grid_T_3D"/> 
    27118        <field id="absvor"           long_name="absolute vorticity"                       unit="s-1"    grid_ref="grid_T_3D"/> 
    28119        <field id="potvor"           long_name="potential vorticity"                      unit="s-1"    grid_ref="grid_T_3D"/> 
    29  
    30         <field id="e3t"          long_name="T-cell thickness"                    standard_name="cell_thickness"     unit="m"   grid_ref="grid_T_3D" /> 
    31         <field id="e3t_surf"     long_name="T-cell thickness"   field_ref="e3t"  standard_name="cell_thickness"     unit="m"   grid_ref="grid_T_SFC"/> 
    32         <field id="e3t_0"        long_name="Initial T-cell thickness"            standard_name="ref_cell_thickness" unit="m"   grid_ref="grid_T_3D" /> 
    33  
     120        <field id="sstgrad2"         long_name="square of module of sst gradient"         unit="degC2/m2" /> 
     121    
     122        <field id="e3t"          long_name="T-cell thickness"                    standard_name="cell_thickness"        unit="m"   grid_ref="grid_T_3D" /> 
     123        <field id="e3ts"         long_name="T-cell thickness"   field_ref="e3t"  standard_name="cell_thickness"        unit="m"   grid_ref="grid_T_SFC"/> 
     124        <field id="e3t_0"        long_name="Initial T-cell thickness"            standard_name="ref_cell_thickness"    unit="m"   grid_ref="grid_T_3D" /> 
     125        <field id="e3tb"         long_name="bottom T-cell thickness"             standard_name="bottom_cell_thickness" unit="m"   grid_ref="grid_T_2D"/>  
     126        <field id="e3t_300"      field_ref="e3t"                grid_ref="grid_T_zoom_300"       detect_missing_value="true" /> 
     127        <field id="e3t_vsum300"  field_ref="e3t_300"            grid_ref="grid_T_vsum"   detect_missing_value="true" /> 
     128   <field id="masscello"    long_name="Sea Water Mass per unit area"   standard_name="sea_water_mass_per_unit_area"   unit="kg/m2"   grid_ref="grid_T_3D"/> 
     129        <field id="volcello"     long_name="Ocean Volume"                   standard_name="ocean_volume"   unit="m3"       grid_ref="grid_T_3D"/>  
    34130        <field id="toce"         long_name="temperature"                         standard_name="sea_water_potential_temperature"   unit="degC"     grid_ref="grid_T_3D"/> 
    35131        <field id="toce_e3t"     long_name="temperature (thickness weighted)"                                                      unit="degC"     grid_ref="grid_T_3D" > toce * e3t </field > 
     
    37133        <field id="soce_e3t"     long_name="salinity    (thickness weighted)"                                                      unit="1e-3"     grid_ref="grid_T_3D" > soce * e3t </field > 
    38134 
     135        <field id="toce_e3t_300"      field_ref="toce_e3t"          unit="degree_C"     grid_ref="grid_T_zoom_300"      detect_missing_value="true" /> 
     136        <field id="toce_e3t_vsum300"  field_ref="toce_e3t_300"      unit="degress_C*m"  grid_ref="grid_T_vsum"  detect_missing_value="true" /> 
     137        <field id="toce_vmean300"     field_ref="toce_e3t_vsum300"  unit="degree_C"     grid_ref="grid_T_vsum"  detect_missing_value="true" > toce_e3t_vsum300/e3t_vsum300 </field> 
     138 
     139        <!-- AGRIF sponge --> 
     140        <field id="agrif_spt"         long_name=" AGRIF t-sponge coefficient"   unit=" " /> 
     141 
    39142        <!-- t-eddy viscosity coefficients (ldfdyn) --> 
    40143   <field id="ahmt_2d"      long_name=" surface t-eddy viscosity coefficient"   unit="m2/s or m4/s"                      /> 
    41144   <field id="ahmt_3d"      long_name=" 3D      t-eddy viscosity coefficient"   unit="m2/s or m4/s"  grid_ref="grid_T_3D"/> 
    42145 
    43         <field id="sst"          long_name="sea surface temperature"                            standard_name="sea_surface_temperature"             unit="degC"     /> 
     146        <field id="sst"          long_name="Bulk sea surface temperature"                       standard_name="bulk_sea_surface_temperature"        unit="degC"     /> 
     147        <field id="t_skin"       long_name="Skin temperature aka SSST"                          standard_name="skin_temperature"                    unit="degC"     /> 
    44148        <field id="sst2"         long_name="square of sea surface temperature"                  standard_name="square_of_sea_surface_temperature"   unit="degC2"     > sst * sst </field > 
    45149        <field id="sstmax"       long_name="max of sea surface temperature"   field_ref="sst"   operation="maximum"                                                 /> 
     
    62166        <field id="taubot"       long_name="bottom stress module"                                                                                   unit="N/m2"     />  
    63167 
     168         <!-- Case EOS = TEOS-10 : output potential temperature --> 
     169   <field id="toce_pot"     long_name="Sea Water Potential Temperature"              standard_name="sea_water_potential_temperature"   unit="degC"     grid_ref="grid_T_3D"/> 
     170        <field id="sst_pot"      long_name="potential sea surface temperature"             standard_name="sea_surface_temperature"             unit="degC"     /> 
     171        <field id="tosmint_pot"  long_name="vertical integral of potential temperature times density"   standard_name="integral_wrt_depth_of_product_of_density_and_potential_temperature"  unit="(kg m2) degree_C" /> 
     172 
     173 
    64174        <field id="ssh"          long_name="sea surface height"                                 standard_name="sea_surface_height_above_geoid"             unit="m" /> 
    65175        <field id="ssh2"         long_name="square of sea surface height"                       standard_name="square_of_sea_surface_height_above_geoid"   unit="m2" > ssh * ssh </field > 
     
    73183        <field id="heatc"        long_name="Heat content vertically integrated"                 standard_name="integral_of_sea_water_potential_temperature_wrt_depth_expressed_as_heat_content"   unit="J/m2"       /> 
    74184        <field id="saltc"        long_name="Salt content vertically integrated"                                                                                                                   unit="1e-3*kg/m2" /> 
    75         <field id="salt2c"       long_name="Salt content vertically integrated"                                                                                                                   unit="1e-3*kg/m2" /> 
    76185 
    77186        <!-- EOS --> 
     
    102211        <field id="topthdep"     long_name="Top of Thermocline Depth (dT = -0.2 wrt 10m)"   standard_name="ocean_mixed_layer_thickness_defined_by_temperature"                                unit="m"                         /> 
    103212        <field id="pycndep"      long_name="Pycnocline Depth (dsigma[dT=-0.2] wrt 10m)"     standard_name="ocean_mixed_layer_thickness_defined_by_sigma_theta"                                unit="m"                         /> 
    104         <field id="BLT"          long_name="Barrier Layer Thickness"                                                                                                                          unit="m"                          > topthdep - pycndep </field> 
     213        <field id="BLT"          long_name="Barrier Layer Thickness"                                                                                                                          unit="m"   > topthdep - pycndep </field> 
    105214        <field id="tinv"         long_name="Max of vertical invertion of temperature"                                                                                                         unit="degC"                      /> 
    106215        <field id="depti"        long_name="Depth of max. vert. inv. of temperature"                                                                                                          unit="m"                         /> 
    107         <field id="20d"          long_name="Depth of 20C isotherm"                          standard_name="depth_of_isosurface_of_sea_water_potential_temperature"                            unit="m"      axis_ref="iax_20C" /> 
    108         <field id="28d"          long_name="Depth of 28C isotherm"                          standard_name="depth_of_isosurface_of_sea_water_potential_temperature"                            unit="m"      axis_ref="iax_28C" /> 
     216   <field id="20d"          long_name="Depth of 20C isotherm"                          standard_name="depth_of_isosurface_of_sea_water_potential_temperature"                            unit="m"   axis_ref="iax_20C" /> 
     217        <field id="26d"          long_name="Depth of 26C isotherm"                          standard_name="depth_of_isosurface_of_sea_water_potential_temperature"                            unit="m"   axis_ref="iax_26C"   /> 
     218        <field id="28d"          long_name="Depth of 28C isotherm"                          standard_name="depth_of_isosurface_of_sea_water_potential_temperature"                            unit="m"   axis_ref="iax_28C" /> 
    109219        <field id="hc300"        long_name="Heat content 0-300m"                            standard_name="integral_of_sea_water_potential_temperature_wrt_depth_expressed_as_heat_content"   unit="J/m2"                      /> 
     220        <field id="hc700"        long_name="Heat content 0-700m"                            standard_name="integral_of_sea_water_potential_temperature_wrt_depth_expressed_as_heat_content"   unit="J/m2"                      /> 
     221        <field id="hc2000"       long_name="Heat content 0-2000m"                           standard_name="integral_of_sea_water_potential_temperature_wrt_depth_expressed_as_heat_content"   unit="J/m2"                      /> 
    110222 
    111223        <!-- variables available with diaar5 --> 
     
    129241 
    130242      <field_group id="Tides_T" grid_ref="grid_T_2D" operation="once" > 
    131         <!-- tidal composante --> 
    132         <field id="M2x"          long_name="M2 Elevation harmonic real part "                             unit="m"        /> 
    133         <field id="M2y"          long_name="M2 Elevation harmonic imaginary part"                         unit="m"        /> 
    134         <field id="S2x"          long_name="S2 Elevation harmonic real part "                             unit="m"        /> 
    135         <field id="S2y"          long_name="S2 Elevation harmonic imaginary part"                         unit="m"        /> 
    136         <field id="N2x"          long_name="N2 Elevation harmonic real part "                             unit="m"        /> 
    137         <field id="N2y"          long_name="N2 Elevation harmonic imaginary part"                         unit="m"        /> 
    138         <field id="K1x"          long_name="K1 Elevation harmonic real part "                             unit="m"        /> 
    139         <field id="K1y"          long_name="K1 Elevation harmonic imaginary part"                         unit="m"        /> 
    140         <field id="O1x"          long_name="O1 Elevation harmonic real part "                             unit="m"        /> 
    141         <field id="O1y"          long_name="O1 Elevation harmonic imaginary part"                         unit="m"        /> 
    142         <field id="Q1x"          long_name="Q1 Elevation harmonic real part "                             unit="m"        /> 
    143         <field id="Q1y"          long_name="Q1 Elevation harmonic imaginary part"                         unit="m"        /> 
    144         <field id="M4x"          long_name="M4 Elevation harmonic real part "                             unit="m"        /> 
    145         <field id="M4y"          long_name="M4 Elevation harmonic imaginary part"                         unit="m"        /> 
    146         <field id="K2x"          long_name="K2 Elevation harmonic real part "                             unit="m"        /> 
    147         <field id="K2y"          long_name="K2 Elevation harmonic imaginary part"                         unit="m"        /> 
    148         <field id="P1x"          long_name="P1 Elevation harmonic real part "                             unit="m"        /> 
    149         <field id="P1y"          long_name="P1 Elevation harmonic imaginary part"                         unit="m"        /> 
    150         <field id="Mfx"          long_name="Mf Elevation harmonic real part "                             unit="m"        /> 
    151         <field id="Mfy"          long_name="Mf Elevation harmonic imaginary part"                         unit="m"        /> 
    152         <field id="Mmx"          long_name="Mm Elevation harmonic real part "                             unit="m"        /> 
    153         <field id="Mmy"          long_name="Mm Elevation harmonic imaginary part"                         unit="m"        /> 
    154       </field_group> 
    155      
    156       <field_group id="Tides_U" grid_ref="grid_U_2D" operation="once" > 
    157         <field id="M2x_u"        long_name="M2 current barotrope along i-axis harmonic real part "        unit="m/s"      /> 
    158         <field id="M2y_u"        long_name="M2 current barotrope along i-axis harmonic imaginary part "   unit="m/s"      /> 
    159         <field id="S2x_u"        long_name="S2 current barotrope along i-axis harmonic real part "        unit="m/s"      /> 
    160         <field id="S2y_u"        long_name="S2 current barotrope along i-axis harmonic imaginary part "   unit="m/s"      /> 
    161         <field id="N2x_u"        long_name="N2 current barotrope along i-axis harmonic real part "        unit="m/s"      /> 
    162         <field id="N2y_u"        long_name="N2 current barotrope along i-axis harmonic imaginary part "   unit="m/s"      /> 
    163         <field id="K1x_u"        long_name="K1 current barotrope along i-axis harmonic real part "        unit="m/s"      /> 
    164         <field id="K1y_u"        long_name="K1 current barotrope along i-axis harmonic imaginary part "   unit="m/s"      /> 
    165         <field id="O1x_u"        long_name="O1 current barotrope along i-axis harmonic real part "        unit="m/s"      /> 
    166         <field id="O1y_u"        long_name="O1 current barotrope along i-axis harmonic imaginary part "   unit="m/s"      /> 
    167         <field id="Q1x_u"        long_name="Q1 current barotrope along i-axis harmonic real part "        unit="m/s"      /> 
    168         <field id="Q1y_u"        long_name="Q1 current barotrope along i-axis harmonic imaginary part "   unit="m/s"      /> 
    169         <field id="M4x_u"        long_name="M4 current barotrope along i-axis harmonic real part "        unit="m/s"      /> 
    170         <field id="M4y_u"        long_name="M4 current barotrope along i-axis harmonic imaginary part "   unit="m/s"      /> 
    171         <field id="K2x_u"        long_name="K2 current barotrope along i-axis harmonic real part "        unit="m/s"      /> 
    172         <field id="K2y_u"        long_name="K2 current barotrope along i-axis harmonic imaginary part "   unit="m/s"      /> 
    173         <field id="P1x_u"        long_name="P1 current barotrope along i-axis harmonic real part "        unit="m/s"      /> 
    174         <field id="P1y_u"        long_name="P1 current barotrope along i-axis harmonic imaginary part "   unit="m/s"      /> 
    175         <field id="Mfx_u"        long_name="Mf current barotrope along i-axis harmonic real part "        unit="m/s"      /> 
    176         <field id="Mfy_u"        long_name="Mf current barotrope along i-axis harmonic imaginary part "   unit="m/s"      /> 
    177         <field id="Mmx_u"        long_name="Mm current barotrope along i-axis harmonic real part "        unit="m/s"      /> 
    178         <field id="Mmy_u"        long_name="Mm current barotrope along i-axis harmonic imaginary part "   unit="m/s"      /> 
    179       </field_group> 
    180      
    181       <field_group id="Tides_V" grid_ref="grid_V_2D" operation="once" > 
    182         <field id="M2x_v"        long_name="M2 current barotrope along j-axis harmonic real part "        unit="m/s"      /> 
    183         <field id="M2y_v"        long_name="M2 current barotrope along j-axis harmonic imaginary part "   unit="m/s"      /> 
    184         <field id="S2x_v"        long_name="S2 current barotrope along j-axis harmonic real part "        unit="m/s"      /> 
    185         <field id="S2y_v"        long_name="S2 current barotrope along j-axis harmonic imaginary part "   unit="m/s"      /> 
    186         <field id="N2x_v"        long_name="N2 current barotrope along j-axis harmonic real part "        unit="m/s"      /> 
    187         <field id="N2y_v"        long_name="N2 current barotrope along j-axis harmonic imaginary part "   unit="m/s"      /> 
    188         <field id="K1x_v"        long_name="K1 current barotrope along j-axis harmonic real part "        unit="m/s"      /> 
    189         <field id="K1y_v"        long_name="K1 current barotrope along j-axis harmonic imaginary part "   unit="m/s"      /> 
    190         <field id="O1x_v"        long_name="O1 current barotrope along j-axis harmonic real part "        unit="m/s"      /> 
    191         <field id="O1y_v"        long_name="O1 current barotrope along j-axis harmonic imaginary part "   unit="m/s"      /> 
    192         <field id="Q1x_v"        long_name="Q1 current barotrope along j-axis harmonic real part "        unit="m/s"      /> 
    193         <field id="Q1y_v"        long_name="Q1 current barotrope along j-axis harmonic imaginary part "   unit="m/s"      /> 
    194         <field id="M4x_v"        long_name="M4 current barotrope along j-axis harmonic real part "        unit="m/s"      /> 
    195         <field id="M4y_v"        long_name="M4 current barotrope along j-axis harmonic imaginary part "   unit="m/s"      /> 
    196         <field id="K2x_v"        long_name="K2 current barotrope along j-axis harmonic real part "        unit="m/s"      /> 
    197         <field id="K2y_v"        long_name="K2 current barotrope along j-axis harmonic imaginary part "   unit="m/s"      /> 
    198         <field id="P1x_v"        long_name="P1 current barotrope along j-axis harmonic real part "        unit="m/s"      /> 
    199         <field id="P1y_v"        long_name="P1 current barotrope along j-axis harmonic imaginary part "   unit="m/s"      /> 
    200         <field id="Mfx_v"        long_name="Mf current barotrope along j-axis harmonic real part "        unit="m/s"      /> 
    201         <field id="Mfy_v"        long_name="Mf current barotrope along j-axis harmonic imaginary part "   unit="m/s"      /> 
    202         <field id="Mmx_v"        long_name="Mm current barotrope along j-axis harmonic real part "        unit="m/s"      /> 
    203         <field id="Mmy_v"        long_name="Mm current barotrope along j-axis harmonic imaginary part "   unit="m/s"      />    
     243        <!-- Tidal potential --> 
     244        <field id="tide_pot"      long_name="Total tidal potential" unit="m" /> 
     245        <field id="tide_pot_M2"   long_name="M2 tidal potential"    unit="m" /> 
     246        <field id="tide_pot_N2"   long_name="N2 tidal potential"    unit="m" /> 
     247        <field id="tide_pot_2N2"  long_name="2N2 tidal potential"   unit="m" /> 
     248        <field id="tide_pot_S2"   long_name="S2 tidal potential"    unit="m" /> 
     249        <field id="tide_pot_K2"   long_name="K2 tidal potential"    unit="m" /> 
     250        <field id="tide_pot_K1"   long_name="K1 tidal potential"    unit="m" /> 
     251        <field id="tide_pot_O1"   long_name="O1 tidal potential"    unit="m" /> 
     252        <field id="tide_pot_Q1"   long_name="Q1 tidal potential"    unit="m" /> 
     253        <field id="tide_pot_P1"   long_name="P1 tidal potential"    unit="m" /> 
     254        <field id="tide_pot_M4"   long_name="M4 tidal potential"    unit="m" /> 
     255        <field id="tide_pot_Mf"   long_name="Mf tidal potential"    unit="m" /> 
     256        <field id="tide_pot_Mm"   long_name="Mm tidal potential"    unit="m" /> 
     257        <field id="tide_pot_Msqm" long_name="Msqm tidal potential"  unit="m" /> 
     258        <field id="tide_pot_Mtm"  long_name="Mtm tidal potential"   unit="m" /> 
     259        <field id="tide_pot_S1"   long_name="S1 tidal potential"    unit="m" /> 
     260        <field id="tide_pot_MU2"  long_name="MU2 tidal potential"   unit="m" /> 
     261        <field id="tide_pot_NU2"  long_name="NU2 tidal potential"   unit="m" /> 
     262        <field id="tide_pot_L2"   long_name="L2 tidal potential"    unit="m" /> 
     263        <field id="tide_pot_T2"   long_name="T2 tidal potential"    unit="m" /> 
    204264      </field_group> 
    205265 
     
    260320          <field id="runoffs"      long_name="River Runoffs"                        standard_name="water_flux_into_sea_water_from_rivers"                                unit="kg/m2/s"   /> 
    261321          <field id="precip"       long_name="Total precipitation"                  standard_name="precipitation_flux"                                                   unit="kg/m2/s"   /> 
     322          <field id="wclosea"      long_name="closed sea empmr correction"          standard_name="closea_empmr"                                                         unit="kg/m2/s"   /> 
    262323      
    263324          <field id="qt"           long_name="Net Downward Heat Flux"                standard_name="surface_downward_heat_flux_in_sea_water"                              unit="W/m2"                           /> 
     
    266327          <field id="qsr3d"        long_name="Shortwave Radiation 3D distribution"   standard_name="downwelling_shortwave_flux_in_sea_water"                              unit="W/m2"      grid_ref="grid_T_3D" /> 
    267328          <field id="qrp"          long_name="Surface Heat Flux: Damping"            standard_name="heat_flux_into_sea_water_due_to_newtonian_relaxation"                 unit="W/m2"                           /> 
     329          <field id="qclosea"      long_name="closed sea heat content flux"          standard_name="closea_heat_content_downward_flux"                                    unit="W/m2"     /> 
    268330          <field id="erp"          long_name="Surface Water Flux: Damping"           standard_name="water_flux_out_of_sea_water_due_to_newtonian_relaxation"              unit="kg/m2/s"                        /> 
    269331          <field id="taum"         long_name="wind stress module"                    standard_name="magnitude_of_surface_downward_stress"                                 unit="N/m2"                           /> 
     
    274336 
    275337          <!-- * variable related to ice shelf forcing * --> 
    276           <field id="fwfisf"       long_name="Ice shelf melting"                             unit="kg/m2/s"  /> 
    277           <field id="fwfisf3d"     long_name="Ice shelf melting"                             unit="kg/m2/s"  grid_ref="grid_T_3D" /> 
    278           <field id="qlatisf"      long_name="Ice shelf latent heat flux"                    unit="W/m2"     /> 
    279           <field id="qlatisf3d"    long_name="Ice shelf latent heat flux"                    unit="W/m2"     grid_ref="grid_T_3D" /> 
    280           <field id="qhcisf"       long_name="Ice shelf heat content flux"                   unit="W/m2"     /> 
    281           <field id="qhcisf3d"     long_name="Ice shelf heat content flux"                   unit="W/m2"     grid_ref="grid_T_3D" /> 
    282           <field id="isfgammat"    long_name="transfert coefficient for isf (temperature) "  unit="m/s"      /> 
    283           <field id="isfgammas"    long_name="transfert coefficient for isf (salinity)    "  unit="m/s"      /> 
    284           <field id="stbl"         long_name="salinity in the Losh tbl                    "  unit="PSU"      /> 
    285           <field id="ttbl"         long_name="temperature in the Losh tbl                 "  unit="C"        /> 
    286           <field id="utbl"         long_name="zonal current in the Losh tbl at T point    "  unit="m/s"      /> 
    287           <field id="vtbl"         long_name="merid current in the Losh tbl at T point    "  unit="m/s"      /> 
    288           <field id="thermald"     long_name="thermal driving of ice shelf melting        "  unit="C"        /> 
    289           <field id="tfrz"         long_name="top freezing point (used to compute melt)   "  unit="C"        /> 
    290           <field id="tinsitu"      long_name="top insitu temperature (used to cmpt melt)  "  unit="C"        /> 
    291           <field id="ustar"        long_name="ustar at T point used in ice shelf melting  "  unit="m/s"      /> 
     338          <field id="isftfrz_cav"     long_name="freezing point temperature at ocean/isf interface"                unit="degC"     /> 
     339          <field id="isftfrz_par"     long_name="freezing point temperature in the parametrization boundary layer" unit="degC"     /> 
     340          <field id="fwfisf_cav"      long_name="Ice shelf melt rate"                           unit="kg/m2/s"  /> 
     341          <field id="fwfisf_par"      long_name="Ice shelf melt rate"                           unit="kg/m2/s"  /> 
     342          <field id="qoceisf_cav"     long_name="Ice shelf ocean  heat flux"                    unit="W/m2"     /> 
     343          <field id="qoceisf_par"     long_name="Ice shelf ocean  heat flux"                    unit="W/m2"     /> 
     344          <field id="qlatisf_cav"     long_name="Ice shelf latent heat flux"                    unit="W/m2"     /> 
     345          <field id="qlatisf_par"     long_name="Ice shelf latent heat flux"                    unit="W/m2"     /> 
     346          <field id="qhcisf_cav"      long_name="Ice shelf heat content flux of injected water" unit="W/m2"     /> 
     347          <field id="qhcisf_par"      long_name="Ice shelf heat content flux of injected water" unit="W/m2"     /> 
     348          <field id="fwfisf3d_cav"    long_name="Ice shelf melt rate"                           unit="kg/m2/s"  grid_ref="grid_T_3D" /> 
     349          <field id="fwfisf3d_par"    long_name="Ice shelf melt rate"                           unit="kg/m2/s"  grid_ref="grid_T_3D" /> 
     350          <field id="qoceisf3d_cav"   long_name="Ice shelf ocean  heat flux"                    unit="W/m2"     grid_ref="grid_T_3D" /> 
     351          <field id="qoceisf3d_par"   long_name="Ice shelf ocean  heat flux"                    unit="W/m2"     grid_ref="grid_T_3D" /> 
     352          <field id="qlatisf3d_cav"   long_name="Ice shelf latent heat flux"                    unit="W/m2"     grid_ref="grid_T_3D" /> 
     353          <field id="qlatisf3d_par"   long_name="Ice shelf latent heat flux"                    unit="W/m2"     grid_ref="grid_T_3D" /> 
     354          <field id="qhcisf3d_cav"    long_name="Ice shelf heat content flux of injected water" unit="W/m2"     grid_ref="grid_T_3D" /> 
     355          <field id="qhcisf3d_par"    long_name="Ice shelf heat content flux of injected water" unit="W/m2"     grid_ref="grid_T_3D" /> 
     356          <field id="ttbl_cav"        long_name="temperature in Losch tbl"                      unit="degC"     /> 
     357          <field id="ttbl_par"        long_name="temperature in the parametrisation boundary layer" unit="degC" /> 
     358          <field id="isfthermald_cav" long_name="thermal driving of ice shelf melting"          unit="degC"     /> 
     359          <field id="isfthermald_par" long_name="thermal driving of ice shelf melting"          unit="degC"     /> 
     360          <field id="isfgammat"       long_name="Ice shelf heat-transfert velocity"             unit="m/s"      /> 
     361          <field id="isfgammas"       long_name="Ice shelf salt-transfert velocity"             unit="m/s"      /> 
     362          <field id="stbl"            long_name="salinity in the Losh tbl"                      unit="1e-3"     /> 
     363          <field id="utbl"            long_name="zonal current in the Losh tbl at T point"      unit="m/s"      /> 
     364          <field id="vtbl"            long_name="merid current in the Losh tbl at T point"      unit="m/s"      /> 
     365          <field id="isfustar"        long_name="ustar at T point used in ice shelf melting"    unit="m/s"      /> 
     366          <field id="qconisf"         long_name="Conductive heat flux through the ice shelf"    unit="W/m2"     /> 
    292367 
    293368          <!-- *_oce variables available with ln_blk_clio or ln_blk_core --> 
     369          <field id="rho_air"      long_name="Air density at 10m above sea surface"         standard_name="rho_air_10m"                                        unit="kg/m3" /> 
     370          <field id="dt_skin"      long_name="SSST-SST temperature difference"              standard_name="SSST-SST"                                             unit="K"   /> 
    294371          <field id="qlw_oce"      long_name="Longwave Downward Heat Flux over open ocean"  standard_name="surface_net_downward_longwave_flux"                 unit="W/m2"  /> 
    295372          <field id="qsb_oce"      long_name="Sensible Downward Heat Flux over open ocean"  standard_name="surface_downward_sensible_heat_flux"                unit="W/m2"  /> 
    296373          <field id="qla_oce"      long_name="Latent Downward Heat Flux over open ocean"    standard_name="surface_downward_latent_heat_flux"                  unit="W/m2"  /> 
     374          <field id="evap_oce"     long_name="Evaporation over open ocean"                  standard_name="evaporation"                                        unit="kg/m2/s" /> 
    297375          <field id="qt_oce"       long_name="total flux at ocean surface"                  standard_name="surface_downward_heat_flux_in_sea_water"            unit="W/m2"  /> 
    298376          <field id="qsr_oce"      long_name="solar heat flux at ocean surface"             standard_name="net_downward_shortwave_flux_at_sea_water_surface"   unit="W/m2"  /> 
     
    312390 
    313391          <!-- available if key_oasis3 + conservative method --> 
    314           <field id="rain"          long_name="Liquid precipitation"                                     standard_name="rainfall_flux"                                                                 unit="kg/m2/s"  /> 
     392     <field id="rain"          long_name="Liquid precipitation"                                     standard_name="rainfall_flux"                                                                 unit="kg/m2/s"  /> 
     393          <field id="rain_ao_cea"   long_name="Liquid precipitation over ice-free ocean (cell average)"  standard_name="rainfall_flux"                                                                 unit="kg/m2/s"  /> 
    315394          <field id="evap_ao_cea"   long_name="Evaporation over ice-free ocean (cell average)"           standard_name="water_evaporation_flux"                                                        unit="kg/m2/s"  /> 
    316395          <field id="isnwmlt_cea"   long_name="Snow over Ice melting (cell average)"                     standard_name="surface_snow_melt_flux"                                                        unit="kg/m2/s"  /> 
     
    355434 
    356435      </field_group> <!-- SBC --> 
    357  
     436       
     437      <!-- ABL --> 
     438      <field_group id="ABL" > <!-- time step automaticaly defined based on nn_fsbc --> 
     439 
     440   <!-- variables available with ABL on atmospheric T grid--> 
     441   <field_group id="grid_ABL3D" grid_ref="grid_TA_3D" > 
     442          <field id="u_abl"      long_name="ABL i-horizontal velocity"     standard_name="abl_x_velocity" unit="m/s"      /> 
     443          <field id="v_abl"      long_name="ABL j-horizontal velocity"     standard_name="abl_y_velocity" unit="m/s"      /> 
     444          <field id="t_abl"      long_name="ABL potential temperature"     standard_name="abl_theta"      unit="K"        /> 
     445          <field id="q_abl"      long_name="ABL specific humidity"         standard_name="abl_qspe"       unit="kg/kg"    /> 
     446          <!-- debug (to be removed) --> 
     447          <field id="u_dta"      long_name="DTA i-horizontal velocity"     standard_name="dta_x_velocity" unit="m/s"      /> 
     448          <field id="v_dta"      long_name="DTA j-horizontal velocity"     standard_name="dta_y_velocity" unit="m/s"      /> 
     449          <field id="t_dta"      long_name="DTA potential temperature"     standard_name="dta_theta"      unit="K"        /> 
     450          <field id="q_dta"      long_name="DTA specific humidity"         standard_name="dta_qspe"       unit="kg/kg"    /> 
     451          <field id="coeft"      long_name="ABL nudging coefficient"       standard_name="coeft"          unit=""         /> 
     452          <field id="tke_abl"    long_name="ABL turbulent kinetic energy"  standard_name="abl_tke"        unit="m2/s2"    /> 
     453          <field id="avm_abl"    long_name="ABL turbulent viscosity"       standard_name="abl_avm"        unit="m2/s"     /> 
     454          <field id="avt_abl"    long_name="ABL turbulent diffusivity"     standard_name="abl_avt"        unit="m2/s"     /> 
     455          <field id="mxl_abl"    long_name="ABL mixing length"             standard_name="abl_mxl"        unit="m"        /> 
     456   </field_group> 
     457 
     458   <field_group id="grid_ABL2D" grid_ref="grid_TA_2D" > 
     459          <field id="pblh"       long_name="ABL height"                    standard_name="abl_height"     unit="m"        /> 
     460          <field id="uz1_abl"    long_name="ABL i-horizontal velocity"     standard_name="abl_x_velocity" unit="m/s"      /> 
     461          <field id="vz1_abl"    long_name="ABL j-horizontal velocity"     standard_name="abl_y_velocity" unit="m/s"      /> 
     462          <field id="uvz1_abl"   long_name="ABL wind speed module"         standard_name="abl_wind_speed" unit="m/s"       > sqrt( uz1_abl^2 + vz1_abl^2 ) </field> 
     463          <field id="tz1_abl"    long_name="ABL potential temperature"     standard_name="abl_theta"      unit="K"        /> 
     464          <field id="qz1_abl"    long_name="ABL specific humidity"         standard_name="abl_qspe"       unit="kg/kg"    /> 
     465          <field id="uz1_dta"    long_name="DTA i-horizontal velocity"     standard_name="dta_x_velocity" unit="m/s"      /> 
     466          <field id="vz1_dta"    long_name="DTA j-horizontal velocity"     standard_name="dta_y_velocity" unit="m/s"      /> 
     467          <field id="uvz1_dta"   long_name="DTA wind speed module"         standard_name="dta_wind_speed" unit="m/s"       > sqrt( uz1_dta^2 + vz1_dta^2 ) </field>  
     468          <field id="tz1_dta"    long_name="DTA potential temperature"     standard_name="dta_theta"      unit="K"        /> 
     469          <field id="qz1_dta"    long_name="DTA specific humidity"         standard_name="dta_qspe"       unit="kg/kg"    /> 
     470          <!-- debug (to be removed) --> 
     471          <field id="uz1_geo"    long_name="GEO i-horizontal velocity"     standard_name="geo_x_velocity" unit="m/s"      /> 
     472          <field id="vz1_geo"    long_name="GEO j-horizontal velocity"     standard_name="geo_y_velocity" unit="m/s"      /> 
     473          <field id="uvz1_geo"   long_name="GEO wind speed module"         standard_name="geo_wind_speed" unit="m/s"       > sqrt( uz1_geo^2 + vz1_geo^2 ) </field>  
     474   </field_group> 
     475 
     476      </field_group> <!-- ABL --> 
     477 
     478       
    358479      <!-- U grid --> 
    359480       
    360481      <field_group id="grid_U"   grid_ref="grid_U_2D"> 
    361         <field id="e3u"          long_name="U-cell thickness"                                       standard_name="cell_thickness"              unit="m"          grid_ref="grid_U_3D" /> 
    362         <field id="e3u_0"        long_name="Initial U-cell thickness"                               standard_name="ref_cell_thickness"          unit="m"          grid_ref="grid_U_3D"/> 
    363         <field id="utau"         long_name="Wind Stress along i-axis"                               standard_name="surface_downward_x_stress"   unit="N/m2"                            /> 
    364         <field id="uoce"         long_name="ocean current along i-axis"                             standard_name="sea_water_x_velocity"        unit="m/s"        grid_ref="grid_U_3D" /> 
    365         <field id="uoce_e3u"     long_name="ocean current along i-axis  (thickness weighted)"                                                   unit="m/s"        grid_ref="grid_U_3D"  > uoce * e3u </field> 
     482        <field id="e2u"           long_name="U-cell width in meridional direction"                   standard_name="cell_width"                  unit="m"                               /> 
     483        <field id="e3u"           long_name="U-cell thickness"                                       standard_name="cell_thickness"              unit="m"          grid_ref="grid_U_3D" /> 
     484        <field id="e3u_0"         long_name="Initial U-cell thickness"                               standard_name="ref_cell_thickness"          unit="m"          grid_ref="grid_U_3D"/> 
     485        <field id="utau"          long_name="Wind Stress along i-axis"                               standard_name="surface_downward_x_stress"   unit="N/m2"                            /> 
     486        <field id="uoce"          long_name="ocean current along i-axis"                             standard_name="sea_water_x_velocity"        unit="m/s"        grid_ref="grid_U_3D" /> 
     487      <field id="uoce_e3u"      long_name="ocean current along i-axis  (thickness weighted)"                                                   unit="m/s"        grid_ref="grid_U_3D"  > uoce * e3u </field> 
     488      <field id="uoce_e3u_vsum" long_name="ocean current along i-axis * e3u summed on the vertical"  field_ref="uoce_e3u"    unit="m3/s"       grid_ref="grid_U_vsum"/> 
     489        <field id="uocetr_vsum"   long_name="ocean transport along i-axis  summed on the vertical"         field_ref="e2u"       unit="m3/s"> this * uoce_e3u_vsum  </field>  
     490 
     491        <field id="uocetr_vsum_op"    long_name="ocean current along i-axis * e3u * e2u summed on the vertical"  read_access="true"  freq_op="1mo"    field_ref="e2u"       unit="m3/s"> @uocetr_vsum </field> 
     492        <field id="uocetr_vsum_cumul" long_name="ocean current along i-axis * e3u * e2u cumulated from southwest point" freq_offset="_reset_" operation="instant" freq_op="1mo"  unit="m3/s" />  
     493        <field id="msftbarot"         long_name="ocean_barotropic_mass_streamfunction"   unit="kg s-1" > uocetr_vsum_cumul * $rau0 </field> 
     494 
     495 
    366496        <field id="ssu"          long_name="ocean surface current along i-axis"                                                                 unit="m/s"                             /> 
    367497        <field id="sbu"          long_name="ocean bottom current along i-axis"                                                                  unit="m/s"                             /> 
     
    370500        <field id="uocet"        long_name="ocean transport along i-axis times temperature (CRS)"                                               unit="degC*m/s"   grid_ref="grid_U_3D" /> 
    371501        <field id="uoces"        long_name="ocean transport along i-axis times salinity (CRS)"                                                  unit="1e-3*m/s"   grid_ref="grid_U_3D" /> 
    372  
     502        <field id="ssuww"        long_name="ocean surface wind work along i-axis"                   standard_name="surface_x_wind_work"         unit="N/m*s"                            > utau * ssu </field> 
     503        <!-- AGRIF sponge --> 
     504        <field id="agrif_spu"    long_name=" AGRIF u-sponge coefficient"   unit=" " /> 
    373505        <!-- u-eddy diffusivity coefficients (available if ln_traldf_OFF=F) --> 
    374506        <field id="ahtu_2d"      long_name=" surface u-eddy diffusivity coefficient"   unit="m2/s or m4/s" /> 
     
    382514 
    383515        <!-- uoce_eiv: available EIV (ln_ldfeiv=T and ln_ldfeiv_dia=T) --> 
    384         <field id="uoce_eiv"     long_name="EIV ocean current along i-axis"   standard_name="bolus_sea_water_x_velocity"   unit="m/s"   grid_ref="grid_U_3D" /> 
     516      <field id="uoce_eiv"      long_name="EIV ocean current along i-axis"                                  standard_name="bolus_sea_water_x_velocity"                     unit="m/s"   grid_ref="grid_U_3D" /> 
     517        <field id="ueiv_masstr"   long_name="EIV Ocean Mass X Transport"                                      standard_name="bolus_ocean_mass_x_transport"                   unit="kg/s"  grid_ref="grid_U_3D" /> 
     518        <field id="ueiv_heattr"   long_name="ocean bolus heat transport along i-axis"                         standard_name="ocean_heat_x_transport_due_to_bolus_advection"  unit="W"                         /> 
     519        <field id="ueiv_salttr"   long_name="ocean bolus salt transport along i-axis"                         standard_name="ocean_salt_x_transport_due_to_bolus_advection"  unit="Kg"                        /> 
     520        <field id="ueiv_heattr3d" long_name="ocean bolus heat transport along i-axis"                         standard_name="ocean_heat_x_transport_due_to_bolus_advection"  unit="W"     grid_ref="grid_U_3D" /> 
     521        <field id="ueiv_salttr3d" long_name="ocean bolus salt transport along i-axis"                         standard_name="ocean_salt_x_transport_due_to_bolus_advection"  unit="kg"    grid_ref="grid_U_3D" /> 
    385522 
    386523        <!-- uoce_bbl: available with ln_trabbl=T and nn_bbl_adv=1 --> 
     
    396533        <field id="utbl"         long_name="zonal current in the Losh tbl"     unit="m/s" /> 
    397534 
    398         <field id="u_masstr"      long_name="Ocean Mass X Transport"                                          standard_name="ocean_mass_x_transport"                         unit="kg/s" grid_ref="grid_U_3D" /> 
     535        <!-- variables available with diaar5 --> 
     536        <field id="u_masstr"      long_name="Ocean Mass X Transport"                                          standard_name="ocean_mass_x_transport"                         unit="kg/s"  grid_ref="grid_U_3D" /> 
    399537        <field id="u_masstr_vint" long_name="vertical integral of ocean eulerian mass transport along i-axis" standard_name="vertical_integral_of_ocean_mass_x_transport"    unit="kg/s"                      /> 
    400538        <field id="u_heattr"      long_name="ocean eulerian heat transport along i-axis"                      standard_name="ocean_heat_x_transport"                         unit="W"                         /> 
     
    402540        <field id="uadv_heattr"   long_name="ocean advective heat transport along i-axis"                     standard_name="advectice_ocean_heat_x_transport"               unit="W"                         /> 
    403541        <field id="uadv_salttr"   long_name="ocean advective salt transport along i-axis"                     standard_name="advectice_ocean_salt_x_transport"               unit="1e-3*kg/s"                 /> 
    404         <field id="ueiv_heattr"   long_name="ocean bolus heat transport along i-axis"                         standard_name="ocean_heat_x_transport_due_to_bolus_advection"  unit="W"                         /> 
    405         <field id="ueiv_salttr"   long_name="ocean bolus salt transport along i-axis"                         standard_name="ocean_salt_x_transport_due_to_bolus_advection"  unit="Kg"                        /> 
    406         <field id="ueiv_heattr3d" long_name="ocean bolus heat transport along i-axis"                         standard_name="ocean_heat_x_transport_due_to_bolus_advection"  unit="W"    grid_ref="grid_U_3D" /> 
    407         <field id="ueiv_salttr3d" long_name="ocean bolus salt transport along i-axis"                         standard_name="ocean_salt_x_transport_due_to_bolus_advection"  unit="kg"   grid_ref="grid_U_3D" /> 
    408542        <field id="udiff_heattr"  long_name="ocean diffusion heat transport along i-axis"                     standard_name="ocean_heat_x_transport_due_to_diffusion"        unit="W"                         /> 
    409543        <field id="udiff_salttr"  long_name="ocean diffusion salt transport along i-axis"                     standard_name="ocean_salt_x_transport_due_to_diffusion"        unit="1e-3*kg/s"                 /> 
     
    413547       
    414548      <field_group id="grid_V"   grid_ref="grid_V_2D"> 
     549        <field id="e1v"          long_name="V-cell width in longitudinal direction"                 standard_name="cell_width"                  unit="m"                              /> 
    415550        <field id="e3v"          long_name="V-cell thickness"                                       standard_name="cell_thickness"              unit="m"          grid_ref="grid_V_3D" /> 
    416551        <field id="e3v_0"        long_name="Initial V-cell thickness"                               standard_name="ref_cell_thickness"          unit="m"          grid_ref="grid_V_3D" /> 
     
    424559        <field id="vocet"        long_name="ocean transport along j-axis times temperature (CRS)"                                               unit="degC*m/s"   grid_ref="grid_V_3D" /> 
    425560        <field id="voces"        long_name="ocean transport along j-axis times salinity (CRS)"                                                  unit="1e-3*m/s"   grid_ref="grid_V_3D" /> 
    426  
     561        <field id="ssvww"        long_name="ocean surface wind work along j-axis"                   standard_name="surface_y_wind_work"         unit="N/m*s"                            > vtau * ssv </field> 
     562        <!-- AGRIF sponge --> 
     563        <field id="agrif_spv"    long_name=" AGRIF v-sponge coefficient"   unit=" " /> 
    427564        <!-- v-eddy diffusivity coefficients (available if ln_traldf_OFF=F) --> 
    428565        <field id="ahtv_2d"      long_name=" surface v-eddy diffusivity coefficient"     unit="m2/s or (m4/s)^1/2" /> 
     
    436573 
    437574        <!-- voce_eiv: available EIV (ln_ldfeiv=T and ln_ldfeiv_dia=T)  --> 
    438         <field id="voce_eiv"     long_name="EIV ocean current along j-axis"   standard_name="bolus_sea_water_y_velocity"   unit="m/s"   grid_ref="grid_V_3D" /> 
     575   <field id="voce_eiv"     long_name="EIV ocean current along j-axis"  standard_name="bolus_sea_water_y_velocity"     unit="m/s"   grid_ref="grid_V_3D" /> 
     576        <field id="veiv_masstr"  long_name="EIV Ocean Mass Y Transport"      standard_name="bolus_ocean_mass_y_transport"   unit="kg/s"  grid_ref="grid_V_3D" /> 
     577        <field id="veiv_heattr"   long_name="ocean bolus heat transport along j-axis"       standard_name="ocean_heat_y_transport_due_to_bolus_advection"   unit="W"                         /> 
     578        <field id="veiv_salttr"   long_name="ocean bolus salt transport along j-axis"       standard_name="ocean_salt_x_transport_due_to_bolus_advection"   unit="Kg"                        /> 
     579        <field id="veiv_heattr3d" long_name="ocean bolus heat transport along j-axis"       standard_name="ocean_heat_y_transport_due_to_bolus_advection"   unit="W"    grid_ref="grid_V_3D" /> 
     580        <field id="veiv_salttr3d" long_name="ocean bolus salt transport along j-axis"       standard_name="ocean_salt_y_transport_due_to_bolus_advection"   unit="kg"   grid_ref="grid_V_3D" /> 
     581 
    439582 
    440583        <!-- voce_bbl: available with ln_trabbl=T and nn_bbl_adv=1 --> 
     
    456599        <field id="vadv_heattr"   long_name="ocean advective heat transport along j-axis"   standard_name="advectice_ocean_heat_y_transport"                unit="W"                         /> 
    457600        <field id="vadv_salttr"   long_name="ocean advective salt transport along j-axis"   standard_name="advectice_ocean_salt_y_transport"                unit="1e-3*kg/s"                 /> 
    458         <field id="veiv_heattr"   long_name="ocean bolus heat transport along j-axis"       standard_name="ocean_heat_y_transport_due_to_bolus_advection"   unit="W"                         /> 
    459         <field id="veiv_salttr"   long_name="ocean bolus salt transport along j-axis"       standard_name="ocean_salt_x_transport_due_to_bolus_advection"   unit="Kg"                        /> 
    460         <field id="veiv_heattr3d" long_name="ocean bolus heat transport along j-axis"       standard_name="ocean_heat_y_transport_due_to_bolus_advection"   unit="W"    grid_ref="grid_V_3D" /> 
    461         <field id="veiv_salttr3d" long_name="ocean bolus salt transport along j-axis"       standard_name="ocean_salt_y_transport_due_to_bolus_advection"   unit="kg"   grid_ref="grid_V_3D" /> 
    462601        <field id="vdiff_heattr"  long_name="ocean diffusion heat transport along j-axis"   standard_name="ocean_heat_y_transport_due_to_diffusion"         unit="W"                         /> 
    463602        <field id="vdiff_salttr"  long_name="ocean diffusion salt transport along j-axis"   standard_name="ocean_salt_y_transport_due_to_diffusion"         unit="1e-3*kg/s"                 /> 
     
    468607      <field_group id="grid_W" grid_ref="grid_W_3D"> 
    469608        <field id="e3w"          long_name="W-cell thickness"                              standard_name="cell_thickness"                         unit="m"    /> 
    470         <field id="woce"         long_name="ocean vertical velocity"                       standard_name="upward_sea_water_velocity"              unit="m/s"  /> 
     609   <field id="woce"         long_name="ocean vertical velocity"                       standard_name="upward_sea_water_velocity"              unit="m/s"  /> 
     610   <field id="woce_e3w"     long_name="ocean vertical velocity * e3w"                                                                        unit="m2/s"  > woce * e3w </field>   
    471611        <field id="wocetr_eff"   long_name="effective ocean vertical transport"                                                                   unit="m3/s" /> 
    472612 
    473613        <!-- woce_eiv: available with EIV  (ln_ldfeiv=T and ln_ldfeiv_dia=T)  --> 
    474614        <field id="woce_eiv"     long_name="EIV ocean vertical velocity"                    standard_name="bolus_upward_sea_water_velocity"       unit="m/s"  /> 
    475  
    476         <field id="avt"          long_name="vertical eddy diffusivity"                      standard_name="ocean_vertical_heat_diffusivity"       unit="m2/s" /> 
     615        <field id="weiv_masstr"  long_name="EIV Upward Ocean Mass Transport"  standard_name="bolus_upward_ocean_mass_transport"             unit="kg/s"   /> 
     616        <field id="weiv_heattr3d" long_name="ocean bolus heat transport"    standard_name="ocean_heat_z_transport_due_to_bolus_advection"   unit="W"    /> 
     617        <field id="weiv_salttr3d" long_name="ocean bolus salt transport"    standard_name="ocean_salt_z_transport_due_to_bolus_advection"   unit="kg"   /> 
     618 
     619   <field id="avt"          long_name="vertical eddy diffusivity"                      standard_name="ocean_vertical_heat_diffusivity"       unit="m2/s" /> 
     620        <field id="avt_e3w"      long_name="vertical heat diffusivity * e3w"                unit="m3/s" > avt * e3w </field>      
    477621        <field id="logavt"       long_name="logarithm of vertical eddy diffusivity"         standard_name="ocean_vertical_heat_diffusivity"       unit="m2/s" /> 
    478622        <field id="avm"          long_name="vertical eddy viscosity"                        standard_name="ocean_vertical_momentum_diffusivity"   unit="m2/s" /> 
     623        <field id="avm_e3w"      long_name="vertical eddy viscosity * e3w"   unit="m3/s" > avm * e3w </field>  
    479624 
    480625        <!-- avs: /= avt with ln_zdfddm=T --> 
    481626        <field id="avs"          long_name="salt vertical eddy diffusivity"                 standard_name="ocean_vertical_salt_diffusivity"       unit="m2/s" /> 
    482         <field id="logavs"       long_name="logarithm of salt vertical eddy diffusivity"    standard_name="ocean_vertical_heat_diffusivity"       unit="m2/s" /> 
     627        <field id="avs_e3w"      long_name="vertical salt diffusivity * e3w"   unit="m3/s" > avs * e3w </field>  
     628   <field id="logavs"       long_name="logarithm of salt vertical eddy diffusivity"    standard_name="ocean_vertical_heat_diffusivity"       unit="m2/s" /> 
    483629 
    484630        <!-- avt_evd and avm_evd: available with ln_zdfevd --> 
    485631        <field id="avt_evd"      long_name="convective enhancement of vertical diffusivity" standard_name="ocean_vertical_tracer_diffusivity_due_to_convection"     unit="m2/s" /> 
    486         <field id="avm_evd"      long_name="convective enhancement of vertical viscosity"   standard_name="ocean_vertical_momentum_diffusivity_due_to_convection"   unit="m2/s" /> 
     632        <field id="avt_evd_e3w"  long_name="convective enhancement to vertical diffusivity * e3w "    unit="m3/s" > avt_evd * e3w </field>  
     633   <field id="avm_evd"      long_name="convective enhancement of vertical viscosity"   standard_name="ocean_vertical_momentum_diffusivity_due_to_convection"   unit="m2/s" /> 
    487634 
    488635        <!-- avt_tide: available with ln_zdfiwm=T --> 
     
    503650       
    504651      <!-- F grid --> 
     652      <!-- AGRIF sponge --> 
     653      <field id="agrif_spf"    long_name=" AGRIF f-sponge coefficient"   unit=" " /> 
    505654      <!-- f-eddy viscosity coefficients (ldfdyn) --> 
    506655      <field id="ahmf_2d"      long_name=" surface f-eddy viscosity coefficient"   unit="m2/s or m4/s" /> 
     
    515664        <field id="masstot"    long_name="global total mass"                            standard_name="sea_water_mass"                                 unit="kg"   /> 
    516665        <field id="temptot"    long_name="global mean temperature"                      standard_name="sea_water_potential_temperature"                unit="degC" /> 
    517         <field id="saltot"     long_name="global mean salinity"                         standard_name="sea_water_salinity"                             unit="1e-3" /> 
    518         <field id="fram_trans" long_name="Sea Ice Mass Transport Through Fram Strait"   standard_name="sea_ice_transport_across_line"                  unit="kg/s" /> 
     666   <field id="saltot"     long_name="global mean salinity"                         standard_name="sea_water_salinity"                             unit="1e-3" /> 
     667        <field id="ssttot"     long_name="global mean sea surface temperature"          standard_name="sea_water_conservative_temperature"             unit="degC" /> 
     668         <!-- EOS = TEOS-10 --> 
     669        <field id="temptot_pot" long_name="global mean potential temperature"            standard_name="sea_water_potential_temperature"               unit="degC" /> 
    519670 
    520671         <!-- available with ln_diahsb --> 
     
    533684        <field id="bgmissal"     long_name="global mean salinity error due to free surface (linssh true)"                                                                          unit="1e-3"     /> 
    534685      </field_group> 
     686 
     687 
     688      <!-- transects --> 
     689      <field_group id="oce_straits"> 
     690         <field id="uoce_e3u_ave"         long_name="Monthly average of u*e3u"                        field_ref="uoce_e3u"                    freq_op="1mo"   freq_offset="_reset_" > @uoce_e3u </field> 
     691         <field id="uoce_e3u_ave_vsum"    long_name="Vertical sum of u*e3u"                           field_ref="uoce_e3u_ave"         grid_ref="grid_U_vsum"     /> 
     692         <field id="uocetr_vsum_section"  long_name="Total 2D transport in i-direction"               field_ref="uoce_e3u_ave_vsum"    grid_ref="grid_U_scalar"  detect_missing_value="true"> this * e2u </field> 
     693         <field id="uocetr_strait"        long_name="Total transport across lines in i-direction"     field_ref="uocetr_vsum_section"  grid_ref="grid_U_4strait" /> 
     694         <field id="u_masstr_strait"      long_name="Sea water transport across line in i-direction"  field_ref="uocetr_strait"        grid_ref="grid_U_4strait_hsum" unit="kg/s"> this * maskMFO_u * $rau0 </field> 
     695 
     696         <field id="voce_e3v_ave"         long_name="Monthly average of v*e3v"                        field_ref="voce_e3v"                    freq_op="1mo"   freq_offset="_reset_" > @voce_e3v </field> 
     697         <field id="voce_e3v_ave_vsum"    long_name="Vertical sum of v*e3v"                           field_ref="voce_e3v_ave"         grid_ref="grid_V_vsum"      /> 
     698         <field id="vocetr_vsum_section"  long_name="Total 2D transport of in j-direction"            field_ref="voce_e3v_ave_vsum"    grid_ref="grid_V_scalar"  detect_missing_value="true"> this * e1v </field> 
     699         <field id="vocetr_strait"        long_name="Total transport across lines in j-direction"     field_ref="vocetr_vsum_section"  grid_ref="grid_V_4strait"  /> 
     700         <field id="v_masstr_strait"      long_name="Sea water transport across line in j-direction"  field_ref="vocetr_strait"        grid_ref="grid_V_4strait_hsum" unit="kg/s"> this * maskMFO_v * $rau0 </field> 
     701 
     702         <field id="masstr_strait"        long_name="Sea water transport across line"                                                  grid_ref="grid_4strait"  > u_masstr_strait + v_masstr_strait </field> 
     703      </field_group> 
     704 
    535705       
    536706      <!-- variables available with ln_floats --> 
     
    568738      <!-- Poleward transport : ptr -->      
    569739      <field_group id="diaptr" >   
    570         <field id="zomsfglo"          long_name="Meridional Stream-Function: Global"           unit="Sv"        grid_ref="gznl_W_3D" /> 
    571         <field id="zomsfatl"          long_name="Meridional Stream-Function: Atlantic"         unit="Sv"        grid_ref="gznl_W_3D" /> 
    572         <field id="zomsfpac"          long_name="Meridional Stream-Function: Pacific"          unit="Sv"        grid_ref="gznl_W_3D" /> 
    573         <field id="zomsfind"          long_name="Meridional Stream-Function: Indian"           unit="Sv"        grid_ref="gznl_W_3D" /> 
    574         <field id="zomsfipc"          long_name="Meridional Stream-Function: Pacific+Indian"   unit="Sv"        grid_ref="gznl_W_3D" /> 
    575         <field id="zotemglo"          long_name="Zonal Mean Temperature : Global"              unit="degree_C"  grid_ref="gznl_T_3D" /> 
    576         <field id="zotematl"          long_name="Zonal Mean Temperature : Atlantic"            unit="degree_C"  grid_ref="gznl_T_3D" /> 
    577         <field id="zotempac"          long_name="Zonal Mean Temperature : Pacific"             unit="degree_C"  grid_ref="gznl_T_3D" /> 
    578         <field id="zotemind"          long_name="Zonal Mean Temperature : Indian"              unit="degree_C"  grid_ref="gznl_T_3D" /> 
    579         <field id="zotemipc"          long_name="Zonal Mean Temperature : Pacific+Indian"      unit="degree_C"  grid_ref="gznl_T_3D" /> 
    580         <field id="zosalglo"          long_name="Zonal Mean Salinity : Global"                 unit="0.001"     grid_ref="gznl_T_3D" /> 
    581         <field id="zosalatl"          long_name="Zonal Mean Salinity : Atlantic"               unit="0.001"     grid_ref="gznl_T_3D" /> 
    582         <field id="zosalpac"          long_name="Zonal Mean Salinity : Pacific"                unit="0.001"     grid_ref="gznl_T_3D" /> 
    583         <field id="zosalind"          long_name="Zonal Mean Salinity : Indian"                 unit="0.001"     grid_ref="gznl_T_3D" /> 
    584         <field id="zosalipc"          long_name="Zonal Mean Salinity : Pacific+Indian"         unit="0.001"     grid_ref="gznl_T_3D" /> 
    585         <field id="zosrfglo"          long_name="Zonal Mean Surface"                           unit="m2"        grid_ref="gznl_T_3D" /> 
    586         <field id="zosrfatl"          long_name="Zonal Mean Surface : Atlantic"                unit="m2"        grid_ref="gznl_T_3D" /> 
    587         <field id="zosrfpac"          long_name="Zonal Mean Surface : Pacific"                 unit="m2"        grid_ref="gznl_T_3D" /> 
    588         <field id="zosrfind"          long_name="Zonal Mean Surface : Indian"                  unit="m2"        grid_ref="gznl_T_3D" /> 
    589         <field id="zosrfipc"          long_name="Zonal Mean Surface : Pacific+Indian"          unit="m2"        grid_ref="gznl_T_3D" /> 
    590         <field id="sophtadv"          long_name="Advective Heat Transport"                     unit="PW"        grid_ref="gznl_T_2D" /> 
    591         <field id="sophtadv_atl"      long_name="Advective Heat Transport: Atlantic"           unit="PW"        grid_ref="gznl_T_2D" /> 
    592         <field id="sophtadv_pac"      long_name="Advective Heat Transport: Pacific"            unit="PW"        grid_ref="gznl_T_2D" /> 
    593         <field id="sophtadv_ind"      long_name="Advective Heat Transport: Indian"             unit="PW"        grid_ref="gznl_T_2D" /> 
    594         <field id="sophtadv_ipc"      long_name="Advective Heat Transport: Pacific+Indian"     unit="PW"        grid_ref="gznl_T_2D" /> 
    595         <field id="sophtldf"          long_name="Diffusive Heat Transport"                     unit="PW"        grid_ref="gznl_T_2D" /> 
    596         <field id="sophtldf_atl"      long_name="Diffusive Heat Transport: Atlantic"           unit="PW"        grid_ref="gznl_T_2D" /> 
    597         <field id="sophtldf_pac"      long_name="Diffusive Heat Transport: Pacific"            unit="PW"        grid_ref="gznl_T_2D" /> 
    598         <field id="sophtldf_ind"      long_name="Diffusive Heat Transport: Indian"             unit="PW"        grid_ref="gznl_T_2D" /> 
    599         <field id="sophtldf_ipc"      long_name="Diffusive Heat Transport: Pacific+Indian"     unit="PW"        grid_ref="gznl_T_2D" /> 
    600         <field id="sophtove"          long_name="Overturning Heat Transport"                   unit="PW"        grid_ref="gznl_T_2D" /> 
    601         <field id="sophtove_atl"      long_name="Overturning Heat Transport: Atlantic"         unit="PW"        grid_ref="gznl_T_2D" /> 
    602         <field id="sophtove_pac"      long_name="Overturning Heat Transport: Pacific"          unit="PW"        grid_ref="gznl_T_2D" /> 
    603         <field id="sophtove_ind"      long_name="Overturning Heat Transport: Indian"           unit="PW"        grid_ref="gznl_T_2D" /> 
    604         <field id="sophtove_ipc"      long_name="Overturning Heat Transport: Pacific+Indian"   unit="PW"        grid_ref="gznl_T_2D" /> 
    605         <field id="sophtbtr"          long_name="Barotropic Heat Transport"                    unit="PW"        grid_ref="gznl_T_2D" /> 
    606         <field id="sophtbtr_atl"      long_name="Barotropic Heat Transport: Atlantic"          unit="PW"        grid_ref="gznl_T_2D" /> 
    607         <field id="sophtbtr_pac"      long_name="Barotropic Heat Transport: Pacific"           unit="PW"        grid_ref="gznl_T_2D" /> 
    608         <field id="sophtbtr_ind"      long_name="Barotropic Heat Transport: Indian"            unit="PW"        grid_ref="gznl_T_2D" /> 
    609         <field id="sophtbtr_ipc"      long_name="Barotropic Heat Transport: Pacific+Indian"    unit="PW"        grid_ref="gznl_T_2D" /> 
    610         <field id="sophteiv"          long_name="Heat Transport from mesoscale eddy advection"                     unit="PW"       grid_ref="gznl_T_2D" /> 
    611         <field id="sophteiv_atl"      long_name="Heat Transport from mesoscale eddy advection: Atlantic"           unit="PW"       grid_ref="gznl_T_2D" /> 
    612         <field id="sophteiv_pac"      long_name="Heat Transport from mesoscale eddy advection: Pacific"            unit="PW"       grid_ref="gznl_T_2D" /> 
    613         <field id="sophteiv_ind"      long_name="Heat Transport from mesoscale eddy advection: Indian"             unit="PW"       grid_ref="gznl_T_2D" /> 
    614         <field id="sophteiv_ipc"      long_name="Heat Transport from mesoscale eddy advection: Pacific+Indian"     unit="PW"       grid_ref="gznl_T_2D" /> 
    615         <field id="sopstadv"          long_name="Advective Salt Transport"                     unit="Giga g/s"  grid_ref="gznl_T_2D" /> 
    616         <field id="sopstadv_atl"      long_name="Advective Salt Transport: Atlantic"           unit="Giga g/s"  grid_ref="gznl_T_2D" /> 
    617         <field id="sopstadv_pac"      long_name="Advective Salt Transport: Pacific"            unit="Giga g/s"  grid_ref="gznl_T_2D" /> 
    618         <field id="sopstadv_ind"      long_name="Advective Salt Transport: Indian"             unit="Giga g/s"  grid_ref="gznl_T_2D" /> 
    619         <field id="sopstadv_ipc"      long_name="Advective Salt Transport: Pacific+Indian"     unit="Giga g/s"  grid_ref="gznl_T_2D" /> 
    620         <field id="sopstove"          long_name="Overturning Salt Transport"                   unit="Giga g/s"  grid_ref="gznl_T_2D" /> 
    621         <field id="sopstove_atl"      long_name="Overturning Salt Transport: Atlantic"         unit="Giga g/s"  grid_ref="gznl_T_2D" /> 
    622         <field id="sopstove_pac"      long_name="Overturning Salt Transport: Pacific"          unit="Giga g/s"  grid_ref="gznl_T_2D" /> 
    623         <field id="sopstove_ind"      long_name="Overturning Salt Transport: Indian"           unit="Giga g/s"  grid_ref="gznl_T_2D" /> 
    624         <field id="sopstove_ipc"      long_name="Overturning Salt Transport: Pacific+Indian"   unit="Giga g/s"  grid_ref="gznl_T_2D" /> 
    625         <field id="sopstbtr"          long_name="Barotropic Salt Transport"                    unit="Giga g/s"  grid_ref="gznl_T_2D" /> 
    626         <field id="sopstbtr_atl"      long_name="Barotropic Salt Transport: Atlantic"          unit="Giga g/s"  grid_ref="gznl_T_2D" /> 
    627         <field id="sopstbtr_pac"      long_name="Barotropic Salt Transport: Pacific"           unit="Giga g/s"  grid_ref="gznl_T_2D" /> 
    628         <field id="sopstbtr_ind"      long_name="Barotropic Salt Transport: Indian"            unit="Giga g/s"  grid_ref="gznl_T_2D" /> 
    629         <field id="sopstbtr_ipc"      long_name="Barotropic Salt Transport: Pacific+Indian"    unit="Giga g/s"  grid_ref="gznl_T_2D" /> 
    630         <field id="sopstldf"          long_name="Diffusive Salt Transport"                     unit="Giga g/s"  grid_ref="gznl_T_2D" /> 
    631         <field id="sopstldf_atl"      long_name="Diffusive Salt Transport: Atlantic"           unit="Giga g/s"  grid_ref="gznl_T_2D" /> 
    632         <field id="sopstldf_pac"      long_name="Diffusive Salt Transport: Pacific"            unit="Giga g/s"  grid_ref="gznl_T_2D" /> 
    633         <field id="sopstldf_ind"      long_name="Diffusive Salt Transport: Indian"             unit="Giga g/s"  grid_ref="gznl_T_2D" /> 
    634         <field id="sopstldf_ipc"      long_name="Diffusive Salt Transport: Pacific+Indian"     unit="Giga g/s"  grid_ref="gznl_T_2D" /> 
    635         <field id="sopsteiv"          long_name="Salt Transport from mesoscale eddy advection"                     unit="Giga g/s"       grid_ref="gznl_T_2D" /> 
    636         <field id="sopsteiv_atl"      long_name="Salt Transport from mesoscale eddy advection: Atlantic"           unit="Giga g/s"       grid_ref="gznl_T_2D" /> 
    637         <field id="sopsteiv_pac"      long_name="Salt Transport from mesoscale eddy advection: Pacific"            unit="Giga g/s"       grid_ref="gznl_T_2D" /> 
    638         <field id="sopsteiv_ind"      long_name="Salt Transport from mesoscale eddy advection: Indian"             unit="Giga g/s"       grid_ref="gznl_T_2D" /> 
    639         <field id="sopsteiv_ipc"      long_name="Salt Transport from mesoscale eddy advection: Pacific+Indian"     unit="Giga g/s"       grid_ref="gznl_T_2D" />        
    640       </field_group> 
     740        <field id="zomsf"         long_name="Overturning Stream-Function : All basins"                     unit="Sv"         grid_ref="grid_znl_W_3D" /> 
     741        <field id="zotem"         long_name="Zonal Mean Temperature : All basins"                          unit="degree_C"   grid_ref="grid_znl_T_3D" /> 
     742        <field id="zosal"         long_name="Zonal Mean Salinity : All basins"                             unit="0.001"      grid_ref="grid_znl_T_3D" /> 
     743        <field id="zosrf"         long_name="Zonal Mean Surface : All basins"                              unit="m2"         grid_ref="grid_znl_T_3D" /> 
     744        <field id="sophtove"      long_name="Overturning Heat Transport: All basins"                       unit="PW"         grid_ref="grid_znl_T_2D" /> 
     745        <field id="sopstove"      long_name="Overturning Salt Transport: All basins"                       unit="Giga g/s"   grid_ref="grid_znl_T_2D" /> 
     746        <field id="sophtbtr"      long_name="Barotropic Heat Transport: All basins"                        unit="PW"         grid_ref="grid_znl_T_2D" /> 
     747        <field id="sopstbtr"      long_name="Barotropic Salt Transport: All basins"                        unit="Giga g/s"   grid_ref="grid_znl_T_2D" />  
     748        <field id="sophtadv"      long_name="Advective Heat Transport: All basins"                         unit="PW"         grid_ref="grid_znl_T_2D" /> 
     749        <field id="sopstadv"      long_name="Advective Salt Transport: All basins"                         unit="Giga g/s"   grid_ref="grid_znl_T_2D" /> 
     750        <field id="sophtldf"      long_name="Diffusive Heat Transport: All basins"                         unit="PW"         grid_ref="grid_znl_T_2D" /> 
     751        <field id="sopstldf"      long_name="Diffusive Salt Transport: All basins"                         unit="Giga g/s"   grid_ref="grid_znl_T_2D" /> 
     752        <field id="sophtvtr"      long_name="Heat Transport : All basins"                                  unit="PW"         grid_ref="grid_znl_T_2D" /> 
     753        <field id="sopstvtr"      long_name="Salt Transport : All basins"                                  unit="Giga g/s"   grid_ref="grid_znl_T_2D" />   
     754        <field id="sophteiv"      long_name="Heat Transport from mesoscale eddy advection: All basins"     unit="PW"         grid_ref="grid_znl_T_2D" /> 
     755        <field id="sopsteiv"      long_name="Salt Transport from mesoscale eddy advection : All basins"    unit="Giga g/s"   grid_ref="grid_znl_T_2D" /> 
     756   <field id="sopstadv"      long_name="Advective Salt Transport"                                     unit="Giga g/s"   grid_ref="grid_znl_T_2D" /> 
     757        <field id="sophtgyre"     long_name="Overturning heat transport due to gyre" field_ref="sophtove"  unit="W"          grid_ref="grid_znl_T_2D" > sophtvtr - sophtove  </field> 
     758   <field id="sopstgyre"     long_name="Overturning salt transport due to gyre" field_ref="sopstove"  unit="kg/s"       grid_ref="grid_znl_T_2D" > sophtvtr - sopstove  </field> 
     759       </field_group> 
     760 
     761       <field_group id="constant_fields"  grid_ref="grid_T_2D"  operation="once" > 
     762         <field id="bathy"       long_name="Sea floor depth below geoid"               standard_name="sea_floor_depth_below_geoid"               unit="m"/> 
     763         <field id="areacello"   long_name="Horizontal area of ocean grid cells"       standard_name="cell_area"                                 unit="m2" /> 
     764         <field id="hfgeou"      long_name="Upward geothermal heat flux at sea floor"  standard_name="upward_geothermal_heat_flux_at_sea_floor"  unit="W/m2"/> 
     765         <field id="basins"      long_name="ocean tracer region masks"                 standard_name="ocean_tracer_region_masks"   unit="none" grid_ref="grid_basin"  /> 
     766       </field_group> 
     767 
    641768 
    642769    <!--  
     
    671798     <field id="ttrd_totad"    long_name="temperature-trend: total advection"         standard_name="tendency_of_sea_water_salinity_due_to_advection"              unit="degC/s"                        /> 
    672799     <field id="strd_totad"    long_name="salinity   -trend: total advection"         standard_name="tendency_of_sea_water_salinity_due_to_advection"              unit="1e-3/s"                        /> 
    673      <field id="ttrd_sad"      long_name="temperature-trend: surface adv. (linssh true)"                                                                                unit="degC/s"   grid_ref="grid_T_2D" /> 
    674      <field id="strd_sad"      long_name="salinity   -trend: surface adv. (linssh true)"                                                                                unit="1e-3/s"   grid_ref="grid_T_2D" /> 
     800     <field id="ttrd_sad"      long_name="temperature-trend: surface adv. (linssh true)"                                                                           unit="degC/s"   grid_ref="grid_T_2D" /> 
     801     <field id="strd_sad"      long_name="salinity   -trend: surface adv. (linssh true)"                                                                           unit="1e-3/s"   grid_ref="grid_T_2D" /> 
    675802     <field id="ttrd_ldf"      long_name="temperature-trend: lateral  diffusion"      standard_name="tendency_of_sea_water_temperature_due_to_horizontal_mixing"   unit="degC/s"                        /> 
    676803     <field id="strd_ldf"      long_name="salinity   -trend: lateral  diffusion"      standard_name="tendency_of_sea_water_salinity_due_to_horizontal_mixing"      unit="1e-3/s"                        /> 
     
    729856     <field id="ttrd_npc_e3t"      unit="degC/s * m"  >  ttrd_npc * e3t </field> 
    730857     <field id="strd_npc_e3t"      unit="1e-3/s * m"  >  strd_npc * e3t </field> 
    731      <field id="ttrd_qns_e3t"      unit="degC/s * m"  >  ttrd_qns * e3t_surf </field> 
    732      <field id="strd_cdt_e3t"      unit="degC/s * m"  >  strd_cdt * e3t_surf </field> 
     858     <field id="ttrd_qns_e3t"      unit="degC/s * m"  >  ttrd_qns * e3ts </field> 
     859     <field id="strd_cdt_e3t"      unit="degC/s * m"  >  strd_cdt * e3ts </field> 
    733860     <field id="ttrd_qsr_e3t"      unit="degC/s * m"  >  ttrd_qsr * e3t </field> 
    734861     <field id="ttrd_bbc_e3t"      unit="degC/s * m"  >  ttrd_bbc * e3t </field> 
     
    9321059    <field_group id="groupU" > 
    9331060      <field field_ref="uoce"         name="uo"      long_name="sea_water_x_velocity"      /> 
    934       <field field_ref="ssu"          name="uos"     long_name="sea_surface_x_velocity"    /> 
    9351061      <field field_ref="utau"         name="tauuo"   long_name="surface_downward_x_stress" /> 
    9361062    </field_group> 
     
    9381064    <field_group id="groupV" > 
    9391065      <field field_ref="voce"         name="vo"      long_name="sea_water_y_velocity"      /> 
    940       <field field_ref="ssv"          name="vos"     long_name="sea_surface_y_velocity"    /> 
    9411066      <field field_ref="vtau"         name="tauvo"   long_name="surface_downward_y_stress" /> 
    9421067    </field_group> 
  • NEMO/trunk/tests/CANAL/EXPREF/namelist_cfg

    r12206 r12377  
    276276!!   namdiu       Cool skin and warm layer models                       (default: OFF) 
    277277!!   namflo       float parameters                                      (default: OFF) 
    278 !!   nam_diaharm  Harmonic analysis of tidal constituents               (default: OFF) 
    279278!!   nam_diadct   transports through some sections                      (default: OFF) 
    280279!!   nam_dia25h   25h Mean Output                                       (default: OFF) 
  • NEMO/trunk/tests/CANAL/MY_SRC/diawri.F90

    r12206 r12377  
    5656   USE lib_mpp         ! MPP library 
    5757   USE timing          ! preformance summary 
    58    USE diurnal_bulk    ! diurnal warm layer 
    59    USE cool_skin       ! Cool skin 
     58   USE diu_bulk        ! diurnal warm layer 
     59   USE diu_coolskin    ! Cool skin 
    6060 
    6161   IMPLICIT NONE 
     
    7676   INTEGER, SAVE, ALLOCATABLE, DIMENSION(:) :: ndex_bT 
    7777 
    78    !! * Substitutions 
    79 #  include "vectopt_loop_substitute.h90" 
    8078   !!---------------------------------------------------------------------- 
    8179   !! NEMO/OCE 4.0 , NEMO Consortium (2018) 
     
    9694 
    9795    
    98    SUBROUTINE dia_wri( kt ) 
     96   SUBROUTINE dia_wri( kt, Kmm ) 
    9997      !!--------------------------------------------------------------------- 
    10098      !!                  ***  ROUTINE dia_wri  *** 
     
    106104      !!---------------------------------------------------------------------- 
    107105      INTEGER, INTENT( in ) ::   kt      ! ocean time-step index 
     106      INTEGER, INTENT( in ) ::   Kmm     ! ocean time level index 
    108107      !! 
    109108      INTEGER ::   ji, jj, jk       ! dummy loop indices 
     
    114113      REAL(wp), DIMENSION(jpi,jpj)     ::   z2d   ! 2D workspace 
    115114      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   z3d   ! 3D workspace 
    116       REAL(wp), DIMENSION(jpi,jpj,jpk) ::   bu, bv   ! volume of u- and v-boxes 
    117       REAL(wp), DIMENSION(jpi,jpj,jpk) ::   r1_bt    ! inverse of t-box volume 
    118115      !!---------------------------------------------------------------------- 
    119116      !  
     
    122119      ! Output the initial state and forcings 
    123120      IF( ninist == 1 ) THEN                        
    124          CALL dia_wri_state( 'output.init' ) 
     121         CALL dia_wri_state( Kmm, 'output.init' ) 
    125122         ninist = 0 
    126123      ENDIF 
     
    131128      CALL iom_put("e3v_0", e3v_0(:,:,:) ) 
    132129      ! 
    133       CALL iom_put( "e3t" , e3t_n(:,:,:) ) 
    134       CALL iom_put( "e3u" , e3u_n(:,:,:) ) 
    135       CALL iom_put( "e3v" , e3v_n(:,:,:) ) 
    136       CALL iom_put( "e3w" , e3w_n(:,:,:) ) 
     130      CALL iom_put( "e3t" , e3t(:,:,:,Kmm) ) 
     131      CALL iom_put( "e3u" , e3u(:,:,:,Kmm) ) 
     132      CALL iom_put( "e3v" , e3v(:,:,:,Kmm) ) 
     133      CALL iom_put( "e3w" , e3w(:,:,:,Kmm) ) 
    137134      IF( iom_use("e3tdef") )   & 
    138          CALL iom_put( "e3tdef"  , ( ( e3t_n(:,:,:) - e3t_0(:,:,:) ) / e3t_0(:,:,:) * 100 * tmask(:,:,:) ) ** 2 ) 
     135         CALL iom_put( "e3tdef"  , ( ( e3t(:,:,:,Kmm) - e3t_0(:,:,:) ) / e3t_0(:,:,:) * 100 * tmask(:,:,:) ) ** 2 ) 
    139136 
    140137      IF( ll_wd ) THEN 
    141          CALL iom_put( "ssh" , (sshn+ssh_ref)*tmask(:,:,1) )   ! sea surface height (brought back to the reference used for wetting and drying) 
     138         CALL iom_put( "ssh" , (ssh(:,:,Kmm)+ssh_ref)*tmask(:,:,1) )   ! sea surface height (brought back to the reference used for wetting and drying) 
    142139      ELSE 
    143          CALL iom_put( "ssh" , sshn )              ! sea surface height 
     140         CALL iom_put( "ssh" , ssh(:,:,Kmm) )              ! sea surface height 
    144141      ENDIF 
    145142 
    146143      IF( iom_use("wetdep") )   &                  ! wet depth 
    147          CALL iom_put( "wetdep" , ht_0(:,:) + sshn(:,:) ) 
     144         CALL iom_put( "wetdep" , ht_0(:,:) + ssh(:,:,Kmm) ) 
    148145       
    149       CALL iom_put( "toce", tsn(:,:,:,jp_tem) )    ! 3D temperature 
    150       CALL iom_put(  "sst", tsn(:,:,1,jp_tem) )    ! surface temperature 
     146      CALL iom_put( "toce", ts(:,:,:,jp_tem,Kmm) )    ! 3D temperature 
     147      CALL iom_put(  "sst", ts(:,:,1,jp_tem,Kmm) )    ! surface temperature 
    151148      IF ( iom_use("sbt") ) THEN 
    152149         DO jj = 1, jpj 
    153150            DO ji = 1, jpi 
    154151               ikbot = mbkt(ji,jj) 
    155                z2d(ji,jj) = tsn(ji,jj,ikbot,jp_tem) 
     152               z2d(ji,jj) = ts(ji,jj,ikbot,jp_tem,Kmm) 
    156153            END DO 
    157154         END DO 
     
    159156      ENDIF 
    160157       
    161       CALL iom_put( "soce", tsn(:,:,:,jp_sal) )    ! 3D salinity 
    162       CALL iom_put(  "sss", tsn(:,:,1,jp_sal) )    ! surface salinity 
     158      CALL iom_put( "soce", ts(:,:,:,jp_sal,Kmm) )    ! 3D salinity 
     159      CALL iom_put(  "sss", ts(:,:,1,jp_sal,Kmm) )    ! surface salinity 
    163160      IF ( iom_use("sbs") ) THEN 
    164161         DO jj = 1, jpj 
    165162            DO ji = 1, jpi 
    166163               ikbot = mbkt(ji,jj) 
    167                z2d(ji,jj) = tsn(ji,jj,ikbot,jp_sal) 
     164               z2d(ji,jj) = ts(ji,jj,ikbot,jp_sal,Kmm) 
    168165            END DO 
    169166         END DO 
     
    176173         DO jj = 2, jpjm1 
    177174            DO ji = fs_2, fs_jpim1   ! vector opt. 
    178                zztmp2 = (  ( rCdU_bot(ji+1,jj)+rCdU_bot(ji  ,jj) ) * un(ji  ,jj,mbku(ji  ,jj))  )**2   & 
    179                   &   + (  ( rCdU_bot(ji  ,jj)+rCdU_bot(ji-1,jj) ) * un(ji-1,jj,mbku(ji-1,jj))  )**2   & 
    180                   &   + (  ( rCdU_bot(ji,jj+1)+rCdU_bot(ji,jj  ) ) * vn(ji,jj  ,mbkv(ji,jj  ))  )**2   & 
    181                   &   + (  ( rCdU_bot(ji,jj  )+rCdU_bot(ji,jj-1) ) * vn(ji,jj-1,mbkv(ji,jj-1))  )**2 
     175               zztmp2 = (  ( rCdU_bot(ji+1,jj)+rCdU_bot(ji  ,jj) ) * uu(ji  ,jj,mbku(ji  ,jj),Kmm)  )**2   & 
     176                  &   + (  ( rCdU_bot(ji  ,jj)+rCdU_bot(ji-1,jj) ) * uu(ji-1,jj,mbku(ji-1,jj),Kmm)  )**2   & 
     177                  &   + (  ( rCdU_bot(ji,jj+1)+rCdU_bot(ji,jj  ) ) * vv(ji,jj  ,mbkv(ji,jj  ),Kmm)  )**2   & 
     178                  &   + (  ( rCdU_bot(ji,jj  )+rCdU_bot(ji,jj-1) ) * vv(ji,jj-1,mbkv(ji,jj-1),Kmm)  )**2 
    182179               z2d(ji,jj) = zztmp * SQRT( zztmp2 ) * tmask(ji,jj,1)  
    183180               ! 
     
    188185      ENDIF 
    189186          
    190       CALL iom_put( "uoce", un(:,:,:) )            ! 3D i-current 
    191       CALL iom_put(  "ssu", un(:,:,1) )            ! surface i-current 
     187      CALL iom_put( "uoce", uu(:,:,:,Kmm) )            ! 3D i-current 
     188      CALL iom_put(  "ssu", uu(:,:,1,Kmm) )            ! surface i-current 
    192189      IF ( iom_use("sbu") ) THEN 
    193190         DO jj = 1, jpj 
    194191            DO ji = 1, jpi 
    195192               ikbot = mbku(ji,jj) 
    196                z2d(ji,jj) = un(ji,jj,ikbot) 
     193               z2d(ji,jj) = uu(ji,jj,ikbot,Kmm) 
    197194            END DO 
    198195         END DO 
     
    200197      ENDIF 
    201198       
    202       CALL iom_put( "voce", vn(:,:,:) )            ! 3D j-current 
    203       CALL iom_put(  "ssv", vn(:,:,1) )            ! surface j-current 
     199      CALL iom_put( "voce", vv(:,:,:,Kmm) )            ! 3D j-current 
     200      CALL iom_put(  "ssv", vv(:,:,1,Kmm) )            ! surface j-current 
    204201      IF ( iom_use("sbv") ) THEN 
    205202         DO jj = 1, jpj 
    206203            DO ji = 1, jpi 
    207204               ikbot = mbkv(ji,jj) 
    208                z2d(ji,jj) = vn(ji,jj,ikbot) 
     205               z2d(ji,jj) = vv(ji,jj,ikbot,Kmm) 
    209206            END DO 
    210207         END DO 
     
    212209      ENDIF 
    213210 
    214       CALL iom_put( "woce", wn )                   ! vertical velocity 
     211      CALL iom_put( "woce", ww )                   ! vertical velocity 
    215212      IF( iom_use('w_masstr') .OR. iom_use('w_masstr2') ) THEN   ! vertical mass transport & its square value 
    216213         ! Caution: in the VVL case, it only correponds to the baroclinic mass transport. 
    217214         z2d(:,:) = rau0 * e1e2t(:,:) 
    218215         DO jk = 1, jpk 
    219             z3d(:,:,jk) = wn(:,:,jk) * z2d(:,:) 
     216            z3d(:,:,jk) = ww(:,:,jk) * z2d(:,:) 
    220217         END DO 
    221218         CALL iom_put( "w_masstr" , z3d )   
     
    235232            DO jj = 2, jpjm1                                    ! sal gradient 
    236233               DO ji = fs_2, fs_jpim1   ! vector opt. 
    237                   zztmp  = tsn(ji,jj,jk,jp_sal) 
    238                   zztmpx = ( tsn(ji+1,jj,jk,jp_sal) - zztmp ) * r1_e1u(ji,jj) + ( zztmp - tsn(ji-1,jj  ,jk,jp_sal) ) * r1_e1u(ji-1,jj) 
    239                   zztmpy = ( tsn(ji,jj+1,jk,jp_sal) - zztmp ) * r1_e2v(ji,jj) + ( zztmp - tsn(ji  ,jj-1,jk,jp_sal) ) * r1_e2v(ji,jj-1) 
     234                  zztmp  = ts(ji,jj,jk,jp_sal,Kmm) 
     235                  zztmpx = ( ts(ji+1,jj,jk,jp_sal,Kmm) - zztmp ) * r1_e1u(ji,jj) + ( zztmp - ts(ji-1,jj  ,jk,jp_sal,Kmm) ) * r1_e1u(ji-1,jj) 
     236                  zztmpy = ( ts(ji,jj+1,jk,jp_sal,Kmm) - zztmp ) * r1_e2v(ji,jj) + ( zztmp - ts(ji  ,jj-1,jk,jp_sal,Kmm) ) * r1_e2v(ji,jj-1) 
    240237                  z3d(ji,jj,jk) = 0.25 * ( zztmpx * zztmpx + zztmpy * zztmpy )   & 
    241238                     &                 * umask(ji,jj,jk) * umask(ji-1,jj,jk) * vmask(ji,jj,jk) * umask(ji,jj-1,jk) 
     
    252249         DO jj = 2, jpjm1                                    ! sst gradient 
    253250            DO ji = fs_2, fs_jpim1   ! vector opt. 
    254                zztmp  = tsn(ji,jj,1,jp_tem) 
    255                zztmpx = ( tsn(ji+1,jj,1,jp_tem) - zztmp ) * r1_e1u(ji,jj) + ( zztmp - tsn(ji-1,jj  ,1,jp_tem) ) * r1_e1u(ji-1,jj) 
    256                zztmpy = ( tsn(ji,jj+1,1,jp_tem) - zztmp ) * r1_e2v(ji,jj) + ( zztmp - tsn(ji  ,jj-1,1,jp_tem) ) * r1_e2v(ji,jj-1) 
     251               zztmp  = ts(ji,jj,1,jp_tem,Kmm) 
     252               zztmpx = ( ts(ji+1,jj,1,jp_tem,Kmm) - zztmp ) * r1_e1u(ji,jj) + ( zztmp - ts(ji-1,jj  ,1,jp_tem,Kmm) ) * r1_e1u(ji-1,jj) 
     253               zztmpy = ( ts(ji,jj+1,1,jp_tem,Kmm) - zztmp ) * r1_e2v(ji,jj) + ( zztmp - ts(ji  ,jj-1,1,jp_tem,Kmm) ) * r1_e2v(ji,jj-1) 
    257254               z2d(ji,jj) = 0.25 * ( zztmpx * zztmpx + zztmpy * zztmpy )   & 
    258255                  &              * umask(ji,jj,1) * umask(ji-1,jj,1) * vmask(ji,jj,1) * umask(ji,jj-1,1) 
     
    271268            DO jj = 1, jpj 
    272269               DO ji = 1, jpi 
    273                   z2d(ji,jj) = z2d(ji,jj) + e3t_n(ji,jj,jk) * tsn(ji,jj,jk,jp_tem) * tmask(ji,jj,jk) 
     270                  z2d(ji,jj) = z2d(ji,jj) + e3t(ji,jj,jk,Kmm) * ts(ji,jj,jk,jp_tem,Kmm) * tmask(ji,jj,jk) 
    274271               END DO 
    275272            END DO 
     
    283280            DO jj = 1, jpj 
    284281               DO ji = 1, jpi 
    285                   z2d(ji,jj) = z2d(ji,jj) + e3t_n(ji,jj,jk) * tsn(ji,jj,jk,jp_sal) * tmask(ji,jj,jk) 
     282                  z2d(ji,jj) = z2d(ji,jj) + e3t(ji,jj,jk,Kmm) * ts(ji,jj,jk,jp_sal,Kmm) * tmask(ji,jj,jk) 
    286283               END DO 
    287284            END DO 
     
    295292            DO jj = 1, jpj 
    296293               DO ji = 1, jpi 
    297                   z2d(ji,jj) = z2d(ji,jj) + e3t_n(ji,jj,jk) * tsn(ji,jj,jk,jp_sal) * tsn(ji,jj,jk,jp_sal) * tmask(ji,jj,jk) 
     294                  z2d(ji,jj) = z2d(ji,jj) + e3t(ji,jj,jk,Kmm) * ts(ji,jj,jk,jp_sal,Kmm) * ts(ji,jj,jk,jp_sal,Kmm) * tmask(ji,jj,jk) 
    298295               END DO 
    299296            END DO 
     
    305302         z3d(:,:,jpk) = 0._wp  
    306303         DO jk = 1, jpkm1 
    307             DO jj = 2, jpj 
    308                DO ji = 2, jpi 
    309                   zztmpx = 0.5 * ( un(ji-1,jj  ,jk) + un(ji,jj,jk) ) 
    310                   zztmpy = 0.5 * ( vn(ji  ,jj-1,jk) + vn(ji,jj,jk) ) 
    311                   z3d(ji,jj,jk) = 0.5 * ( zztmpx*zztmpx + zztmpy*zztmpy ) 
     304            DO jj = 2, jpjm1 
     305               DO ji = fs_2, fs_jpim1   ! vector opt. 
     306                  zztmp  = 0.25_wp * r1_e1e2t(ji,jj) / e3t(ji,jj,jk,Kmm) 
     307                  z3d(ji,jj,jk) = zztmp * (  uu(ji-1,jj,jk,Kmm)**2 * e2u(ji-1,jj) * e3u(ji-1,jj,jk,Kmm)   & 
     308                     &                     + uu(ji  ,jj,jk,Kmm)**2 * e2u(ji  ,jj) * e3u(ji  ,jj,jk,Kmm)   & 
     309                     &                     + vv(ji,jj-1,jk,Kmm)**2 * e1v(ji,jj-1) * e3v(ji,jj-1,jk,Kmm)   & 
     310                     &                     + vv(ji,jj  ,jk,Kmm)**2 * e1v(ji,jj  ) * e3v(ji,jj  ,jk,Kmm)   ) 
    312311               END DO 
    313312            END DO 
     
    325324            DO jj = 2, jpj 
    326325               DO ji = 2, jpi 
    327                   z3d(ji,jj,jk) = 0.25_wp * ( un(ji  ,jj,jk) * un(ji  ,jj,jk) * e1e2u(ji  ,jj) * e3u_n(ji  ,jj,jk)  & 
    328                      &                      + un(ji-1,jj,jk) * un(ji-1,jj,jk) * e1e2u(ji-1,jj) * e3u_n(ji-1,jj,jk)  & 
    329                      &                      + vn(ji,jj  ,jk) * vn(ji,jj  ,jk) * e1e2v(ji,jj  ) * e3v_n(ji,jj  ,jk)  & 
    330                      &                      + vn(ji,jj-1,jk) * vn(ji,jj-1,jk) * e1e2v(ji,jj-1) * e3v_n(ji,jj-1,jk)  )  & 
    331                      &                    * r1_e1e2t(ji,jj) / e3t_n(ji,jj,jk) * tmask(ji,jj,jk) 
     326                  z3d(ji,jj,jk) = 0.25_wp * ( uu(ji  ,jj,jk,Kmm) * uu(ji  ,jj,jk,Kmm) * e1e2u(ji  ,jj) * e3u(ji  ,jj,jk,Kmm)  & 
     327                     &                      + uu(ji-1,jj,jk,Kmm) * uu(ji-1,jj,jk,Kmm) * e1e2u(ji-1,jj) * e3u(ji-1,jj,jk,Kmm)  & 
     328                     &                      + vv(ji,jj  ,jk,Kmm) * vv(ji,jj  ,jk,Kmm) * e1e2v(ji,jj  ) * e3v(ji,jj  ,jk,Kmm)  & 
     329                     &                      + vv(ji,jj-1,jk,Kmm) * vv(ji,jj-1,jk,Kmm) * e1e2v(ji,jj-1) * e3v(ji,jj-1,jk,Kmm)  )  & 
     330                     &                    * r1_e1e2t(ji,jj) / e3t(ji,jj,jk,Kmm) * tmask(ji,jj,jk) 
    332331               END DO 
    333332            END DO 
     
    341340            DO jj = 1, jpj 
    342341               DO ji = 1, jpi 
    343                   z2d(ji,jj) = z2d(ji,jj) + e3t_n(ji,jj,jk) * z3d(ji,jj,jk) * tmask(ji,jj,jk) 
     342                  z2d(ji,jj) = z2d(ji,jj) + e3t(ji,jj,jk,Kmm) * z3d(ji,jj,jk) * tmask(ji,jj,jk) 
    344343               END DO 
    345344            END DO 
     
    349348      ENDIF 
    350349      ! 
    351       CALL iom_put( "hdiv", hdivn )                  ! Horizontal divergence 
     350      CALL iom_put( "hdiv", hdiv )                  ! Horizontal divergence 
    352351 
    353352      IF ( iom_use("relvor") .OR. iom_use("absvor") .OR. iom_use("potvor") ) THEN 
     
    357356            DO jj = 1, jpjm1 
    358357               DO ji = 1, fs_jpim1   ! vector opt. 
    359                   z3d(ji,jj,jk) = (  e2v(ji+1,jj  ) * vn(ji+1,jj  ,jk) - e2v(ji,jj) * vn(ji,jj,jk)    & 
    360                      &              - e1u(ji  ,jj+1) * un(ji  ,jj+1,jk) + e1u(ji,jj) * un(ji,jj,jk)  ) * r1_e1e2f(ji,jj) 
     358                  z3d(ji,jj,jk) = (   e2v(ji+1,jj  ) * vv(ji+1,jj  ,jk,Kmm) - e2v(ji,jj) * vv(ji,jj,jk,Kmm)    & 
     359                     &              - e1u(ji  ,jj+1) * uu(ji  ,jj+1,jk,Kmm) + e1u(ji,jj) * uu(ji,jj,jk,Kmm)  ) * r1_e1e2f(ji,jj) 
    361360               END DO 
    362361            END DO 
     
    377376            DO jj = 1, jpjm1 
    378377               DO ji = 1, fs_jpim1   ! vector opt. 
    379                   ze3  = (  e3t_n(ji,jj+1,jk)*tmask(ji,jj+1,jk) + e3t_n(ji+1,jj+1,jk)*tmask(ji+1,jj+1,jk)   & 
    380                      &    + e3t_n(ji,jj  ,jk)*tmask(ji,jj  ,jk) + e3t_n(ji+1,jj  ,jk)*tmask(ji+1,jj  ,jk)  ) 
     378                  ze3  = (  e3t(ji,jj+1,jk,Kmm)*tmask(ji,jj+1,jk) + e3t(ji+1,jj+1,jk,Kmm)*tmask(ji+1,jj+1,jk)   & 
     379                     &    + e3t(ji,jj  ,jk,Kmm)*tmask(ji,jj  ,jk) + e3t(ji+1,jj  ,jk,Kmm)*tmask(ji+1,jj  ,jk)  ) 
    381380                  IF( ze3 /= 0._wp ) THEN   ;   ze3 = 4._wp / ze3 
    382381                  ELSE                      ;   ze3 = 0._wp 
     
    396395         z2d(:,:) = 0.e0 
    397396         DO jk = 1, jpkm1 
    398             z3d(:,:,jk) = rau0 * un(:,:,jk) * e2u(:,:) * e3u_n(:,:,jk) * umask(:,:,jk) 
     397            z3d(:,:,jk) = rau0 * uu(:,:,jk,Kmm) * e2u(:,:) * e3u(:,:,jk,Kmm) * umask(:,:,jk) 
    399398            z2d(:,:) = z2d(:,:) + z3d(:,:,jk) 
    400399         END DO 
     
    408407            DO jj = 2, jpjm1 
    409408               DO ji = fs_2, fs_jpim1   ! vector opt. 
    410                   z2d(ji,jj) = z2d(ji,jj) + z3d(ji,jj,jk) * ( tsn(ji,jj,jk,jp_tem) + tsn(ji+1,jj,jk,jp_tem) ) 
     409                  z2d(ji,jj) = z2d(ji,jj) + z3d(ji,jj,jk) * ( ts(ji,jj,jk,jp_tem,Kmm) + ts(ji+1,jj,jk,jp_tem,Kmm) ) 
    411410               END DO 
    412411            END DO 
     
    421420            DO jj = 2, jpjm1 
    422421               DO ji = fs_2, fs_jpim1   ! vector opt. 
    423                   z2d(ji,jj) = z2d(ji,jj) + z3d(ji,jj,jk) * ( tsn(ji,jj,jk,jp_sal) + tsn(ji+1,jj,jk,jp_sal) ) 
     422                  z2d(ji,jj) = z2d(ji,jj) + z3d(ji,jj,jk) * ( ts(ji,jj,jk,jp_sal,Kmm) + ts(ji+1,jj,jk,jp_sal,Kmm) ) 
    424423               END DO 
    425424            END DO 
     
    433432         z3d(:,:,jpk) = 0.e0 
    434433         DO jk = 1, jpkm1 
    435             z3d(:,:,jk) = rau0 * vn(:,:,jk) * e1v(:,:) * e3v_n(:,:,jk) * vmask(:,:,jk) 
     434            z3d(:,:,jk) = rau0 * vv(:,:,jk,Kmm) * e1v(:,:) * e3v(:,:,jk,Kmm) * vmask(:,:,jk) 
    436435         END DO 
    437436         CALL iom_put( "v_masstr", z3d )              ! mass transport in j-direction 
     
    443442            DO jj = 2, jpjm1 
    444443               DO ji = fs_2, fs_jpim1   ! vector opt. 
    445                   z2d(ji,jj) = z2d(ji,jj) + z3d(ji,jj,jk) * ( tsn(ji,jj,jk,jp_tem) + tsn(ji,jj+1,jk,jp_tem) ) 
     444                  z2d(ji,jj) = z2d(ji,jj) + z3d(ji,jj,jk) * ( ts(ji,jj,jk,jp_tem,Kmm) + ts(ji,jj+1,jk,jp_tem,Kmm) ) 
    446445               END DO 
    447446            END DO 
     
    456455            DO jj = 2, jpjm1 
    457456               DO ji = fs_2, fs_jpim1   ! vector opt. 
    458                   z2d(ji,jj) = z2d(ji,jj) + z3d(ji,jj,jk) * ( tsn(ji,jj,jk,jp_sal) + tsn(ji,jj+1,jk,jp_sal) ) 
     457                  z2d(ji,jj) = z2d(ji,jj) + z3d(ji,jj,jk) * ( ts(ji,jj,jk,jp_sal,Kmm) + ts(ji,jj+1,jk,jp_sal,Kmm) ) 
    459458               END DO 
    460459            END DO 
     
    469468            DO jj = 2, jpjm1 
    470469               DO ji = fs_2, fs_jpim1   ! vector opt. 
    471                   z2d(ji,jj) = z2d(ji,jj) + e3t_n(ji,jj,jk) *  tsn(ji,jj,jk,jp_tem) 
     470                  z2d(ji,jj) = z2d(ji,jj) + e3t(ji,jj,jk,Kmm) *  ts(ji,jj,jk,jp_tem,Kmm) 
    472471               END DO 
    473472            END DO 
     
    481480            DO jj = 2, jpjm1 
    482481               DO ji = fs_2, fs_jpim1   ! vector opt. 
    483                   z2d(ji,jj) = z2d(ji,jj) + e3t_n(ji,jj,jk) * tsn(ji,jj,jk,jp_sal) 
     482                  z2d(ji,jj) = z2d(ji,jj) + e3t(ji,jj,jk,Kmm) * ts(ji,jj,jk,jp_sal,Kmm) 
    484483               END DO 
    485484            END DO 
     
    492491      ! 
    493492           
    494       IF (ln_dia25h)   CALL dia_25h( kt )             ! 25h averaging 
     493      IF (ln_dia25h)   CALL dia_25h( kt, Kmm )        ! 25h averaging 
    495494 
    496495      IF( ln_timing )   CALL timing_stop('dia_wri') 
     
    518517 
    519518    
    520    SUBROUTINE dia_wri( kt ) 
     519   SUBROUTINE dia_wri( kt, Kmm ) 
    521520      !!--------------------------------------------------------------------- 
    522521      !!                  ***  ROUTINE dia_wri  *** 
     
    531530      !!---------------------------------------------------------------------- 
    532531      INTEGER, INTENT( in ) ::   kt   ! ocean time-step index 
     532      INTEGER, INTENT( in ) ::   Kmm  ! ocean time level index 
    533533      ! 
    534534      LOGICAL ::   ll_print = .FALSE.                        ! =T print and flush numout 
     
    546546      ! 
    547547      IF( ninist == 1 ) THEN     !==  Output the initial state and forcings  ==! 
    548          CALL dia_wri_state( 'output.init' ) 
     548         CALL dia_wri_state( Kmm, 'output.init' ) 
    549549         ninist = 0 
    550550      ENDIF 
     
    687687            &          jpi, jpj, nh_T, ipk, 1, ipk, nz_T, 32, clop, zsto, zout ) 
    688688         IF(  .NOT.ln_linssh  ) THEN 
    689             CALL histdef( nid_T, "vovvle3t", "Level thickness"                    , "m"      ,&  ! e3t_n 
     689            CALL histdef( nid_T, "vovvle3t", "Level thickness"                    , "m"      ,&  ! e3t(:,:,:,Kmm) 
    690690            &             jpi, jpj, nh_T, ipk, 1, ipk, nz_T, 32, clop, zsto, zout ) 
    691             CALL histdef( nid_T, "vovvldep", "T point depth"                      , "m"      ,&  ! e3t_n 
     691            CALL histdef( nid_T, "vovvldep", "T point depth"                      , "m"      ,&  ! e3t(:,:,:,Kmm) 
    692692            &             jpi, jpj, nh_T, ipk, 1, ipk, nz_T, 32, clop, zsto, zout ) 
    693             CALL histdef( nid_T, "vovvldef", "Squared level deformation"          , "%^2"    ,&  ! e3t_n 
     693            CALL histdef( nid_T, "vovvldef", "Squared level deformation"          , "%^2"    ,&  ! e3t(:,:,:,Kmm) 
    694694            &             jpi, jpj, nh_T, ipk, 1, ipk, nz_T, 32, clop, zsto, zout ) 
    695695         ENDIF 
     
    708708            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout ) 
    709709         IF(  ln_linssh  ) THEN 
    710             CALL histdef( nid_T, "sosst_cd", "Concentration/Dilution term on temperature"     &  ! emp * tsn(:,:,1,jp_tem) 
     710            CALL histdef( nid_T, "sosst_cd", "Concentration/Dilution term on temperature"     &  ! emp * ts(:,:,1,jp_tem,Kmm) 
    711711            &                                                                  , "KgC/m2/s",  &  ! sosst_cd 
    712712            &             jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout ) 
    713             CALL histdef( nid_T, "sosss_cd", "Concentration/Dilution term on salinity"        &  ! emp * tsn(:,:,1,jp_sal) 
     713            CALL histdef( nid_T, "sosss_cd", "Concentration/Dilution term on salinity"        &  ! emp * ts(:,:,1,jp_sal,Kmm) 
    714714            &                                                                  , "KgPSU/m2/s",&  ! sosss_cd 
    715715            &             jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout ) 
     
    787787 
    788788         !                                                                                      !!! nid_U : 3D 
    789          CALL histdef( nid_U, "vozocrtx", "Zonal Current"                      , "m/s"    ,   &  ! un 
     789         CALL histdef( nid_U, "vozocrtx", "Zonal Current"                      , "m/s"    ,   &  ! uu(:,:,:,Kmm) 
    790790            &          jpi, jpj, nh_U, ipk, 1, ipk, nz_U, 32, clop, zsto, zout ) 
    791791         IF( ln_wave .AND. ln_sdw) THEN 
     
    800800 
    801801         !                                                                                      !!! nid_V : 3D 
    802          CALL histdef( nid_V, "vomecrty", "Meridional Current"                 , "m/s"    ,   &  ! vn 
     802         CALL histdef( nid_V, "vomecrty", "Meridional Current"                 , "m/s"    ,   &  ! vv(:,:,:,Kmm) 
    803803            &          jpi, jpj, nh_V, ipk, 1, ipk, nz_V, 32, clop, zsto, zout ) 
    804804         IF( ln_wave .AND. ln_sdw) THEN 
     
    813813 
    814814         !                                                                                      !!! nid_W : 3D 
    815          CALL histdef( nid_W, "vovecrtz", "Vertical Velocity"                  , "m/s"    ,   &  ! wn 
     815         CALL histdef( nid_W, "vovecrtz", "Vertical Velocity"                  , "m/s"    ,   &  ! ww 
    816816            &          jpi, jpj, nh_W, ipk, 1, ipk, nz_W, 32, clop, zsto, zout ) 
    817817         CALL histdef( nid_W, "votkeavt", "Vertical Eddy Diffusivity"          , "m2/s"   ,   &  ! avt 
     
    851851 
    852852      IF( .NOT.ln_linssh ) THEN 
    853          CALL histwrite( nid_T, "votemper", it, tsn(:,:,:,jp_tem) * e3t_n(:,:,:) , ndim_T , ndex_T  )   ! heat content 
    854          CALL histwrite( nid_T, "vosaline", it, tsn(:,:,:,jp_sal) * e3t_n(:,:,:) , ndim_T , ndex_T  )   ! salt content 
    855          CALL histwrite( nid_T, "sosstsst", it, tsn(:,:,1,jp_tem) * e3t_n(:,:,1) , ndim_hT, ndex_hT )   ! sea surface heat content 
    856          CALL histwrite( nid_T, "sosaline", it, tsn(:,:,1,jp_sal) * e3t_n(:,:,1) , ndim_hT, ndex_hT )   ! sea surface salinity content 
     853         CALL histwrite( nid_T, "votemper", it, ts(:,:,:,jp_tem,Kmm) * e3t(:,:,:,Kmm) , ndim_T , ndex_T  )   ! heat content 
     854         CALL histwrite( nid_T, "vosaline", it, ts(:,:,:,jp_sal,Kmm) * e3t(:,:,:,Kmm) , ndim_T , ndex_T  )   ! salt content 
     855         CALL histwrite( nid_T, "sosstsst", it, ts(:,:,1,jp_tem,Kmm) * e3t(:,:,1,Kmm) , ndim_hT, ndex_hT )   ! sea surface heat content 
     856         CALL histwrite( nid_T, "sosaline", it, ts(:,:,1,jp_sal,Kmm) * e3t(:,:,1,Kmm) , ndim_hT, ndex_hT )   ! sea surface salinity content 
    857857      ELSE 
    858          CALL histwrite( nid_T, "votemper", it, tsn(:,:,:,jp_tem) , ndim_T , ndex_T  )   ! temperature 
    859          CALL histwrite( nid_T, "vosaline", it, tsn(:,:,:,jp_sal) , ndim_T , ndex_T  )   ! salinity 
    860          CALL histwrite( nid_T, "sosstsst", it, tsn(:,:,1,jp_tem) , ndim_hT, ndex_hT )   ! sea surface temperature 
    861          CALL histwrite( nid_T, "sosaline", it, tsn(:,:,1,jp_sal) , ndim_hT, ndex_hT )   ! sea surface salinity 
     858         CALL histwrite( nid_T, "votemper", it, ts(:,:,:,jp_tem,Kmm) , ndim_T , ndex_T  )   ! temperature 
     859         CALL histwrite( nid_T, "vosaline", it, ts(:,:,:,jp_sal,Kmm) , ndim_T , ndex_T  )   ! salinity 
     860         CALL histwrite( nid_T, "sosstsst", it, ts(:,:,1,jp_tem,Kmm) , ndim_hT, ndex_hT )   ! sea surface temperature 
     861         CALL histwrite( nid_T, "sosaline", it, ts(:,:,1,jp_sal,Kmm) , ndim_hT, ndex_hT )   ! sea surface salinity 
    862862      ENDIF 
    863863      IF( .NOT.ln_linssh ) THEN 
    864          zw3d(:,:,:) = ( ( e3t_n(:,:,:) - e3t_0(:,:,:) ) / e3t_0(:,:,:) * 100 * tmask(:,:,:) ) ** 2 
    865          CALL histwrite( nid_T, "vovvle3t", it, e3t_n (:,:,:) , ndim_T , ndex_T  )   ! level thickness 
    866          CALL histwrite( nid_T, "vovvldep", it, gdept_n(:,:,:) , ndim_T , ndex_T  )   ! t-point depth 
     864         zw3d(:,:,:) = ( ( e3t(:,:,:,Kmm) - e3t_0(:,:,:) ) / e3t_0(:,:,:) * 100 * tmask(:,:,:) ) ** 2 
     865         CALL histwrite( nid_T, "vovvle3t", it, e3t (:,:,:,Kmm) , ndim_T , ndex_T  )   ! level thickness 
     866         CALL histwrite( nid_T, "vovvldep", it, gdept(:,:,:,Kmm) , ndim_T , ndex_T  )   ! t-point depth 
    867867         CALL histwrite( nid_T, "vovvldef", it, zw3d             , ndim_T , ndex_T  )   ! level thickness deformation 
    868868      ENDIF 
    869       CALL histwrite( nid_T, "sossheig", it, sshn          , ndim_hT, ndex_hT )   ! sea surface height 
     869      CALL histwrite( nid_T, "sossheig", it, ssh(:,:,Kmm)          , ndim_hT, ndex_hT )   ! sea surface height 
    870870      CALL histwrite( nid_T, "sowaflup", it, ( emp-rnf )   , ndim_hT, ndex_hT )   ! upward water flux 
    871871      CALL histwrite( nid_T, "sorunoff", it, rnf           , ndim_hT, ndex_hT )   ! river runoffs 
     
    874874                                                                                  ! in linear free surface case) 
    875875      IF( ln_linssh ) THEN 
    876          zw2d(:,:) = emp (:,:) * tsn(:,:,1,jp_tem) 
     876         zw2d(:,:) = emp (:,:) * ts(:,:,1,jp_tem,Kmm) 
    877877         CALL histwrite( nid_T, "sosst_cd", it, zw2d, ndim_hT, ndex_hT )          ! c/d term on sst 
    878          zw2d(:,:) = emp (:,:) * tsn(:,:,1,jp_sal) 
     878         zw2d(:,:) = emp (:,:) * ts(:,:,1,jp_sal,Kmm) 
    879879         CALL histwrite( nid_T, "sosss_cd", it, zw2d, ndim_hT, ndex_hT )          ! c/d term on sss 
    880880      ENDIF 
     
    912912         CALL histwrite( nid_T, "sohefldp", it, qrp           , ndim_hT, ndex_hT )   ! heat flux damping 
    913913         CALL histwrite( nid_T, "sowafldp", it, erp           , ndim_hT, ndex_hT )   ! freshwater flux damping 
    914          zw2d(:,:) = erp(:,:) * tsn(:,:,1,jp_sal) * tmask(:,:,1) 
     914         zw2d(:,:) = erp(:,:) * ts(:,:,1,jp_sal,Kmm) * tmask(:,:,1) 
    915915         CALL histwrite( nid_T, "sosafldp", it, zw2d          , ndim_hT, ndex_hT )   ! salt flux damping 
    916916      ENDIF 
     
    925925#endif 
    926926 
    927       CALL histwrite( nid_U, "vozocrtx", it, un            , ndim_U , ndex_U )    ! i-current 
     927      CALL histwrite( nid_U, "vozocrtx", it, uu(:,:,:,Kmm)            , ndim_U , ndex_U )    ! i-current 
    928928      CALL histwrite( nid_U, "sozotaux", it, utau          , ndim_hU, ndex_hU )   ! i-wind stress 
    929929 
    930       CALL histwrite( nid_V, "vomecrty", it, vn            , ndim_V , ndex_V  )   ! j-current 
     930      CALL histwrite( nid_V, "vomecrty", it, vv(:,:,:,Kmm)            , ndim_V , ndex_V  )   ! j-current 
    931931      CALL histwrite( nid_V, "sometauy", it, vtau          , ndim_hV, ndex_hV )   ! j-wind stress 
    932932 
    933       CALL histwrite( nid_W, "vovecrtz", it, wn             , ndim_T, ndex_T )    ! vert. current 
     933      CALL histwrite( nid_W, "vovecrtz", it, ww             , ndim_T, ndex_T )    ! vert. current 
    934934      CALL histwrite( nid_W, "votkeavt", it, avt            , ndim_T, ndex_T )    ! T vert. eddy diff. coef. 
    935935      CALL histwrite( nid_W, "votkeavm", it, avm            , ndim_T, ndex_T )    ! T vert. eddy visc. coef. 
     
    958958#endif 
    959959 
    960    SUBROUTINE dia_wri_state( cdfile_name ) 
     960   SUBROUTINE dia_wri_state( Kmm, cdfile_name ) 
    961961      !!--------------------------------------------------------------------- 
    962962      !!                 ***  ROUTINE dia_wri_state  *** 
     
    971971      !!      File 'output.abort.nc' is created in case of abnormal job end 
    972972      !!---------------------------------------------------------------------- 
     973      INTEGER           , INTENT( in ) ::   Kmm              ! time level index 
    973974      CHARACTER (len=* ), INTENT( in ) ::   cdfile_name      ! name of the file created 
    974975      !! 
     
    987988#endif 
    988989 
    989       CALL iom_rstput( 0, 0, inum, 'votemper', tsn(:,:,:,jp_tem) )    ! now temperature 
    990       CALL iom_rstput( 0, 0, inum, 'vosaline', tsn(:,:,:,jp_sal) )    ! now salinity 
    991       CALL iom_rstput( 0, 0, inum, 'sossheig', sshn              )    ! sea surface height 
    992       CALL iom_rstput( 0, 0, inum, 'vozocrtx', un                )    ! now i-velocity 
    993       CALL iom_rstput( 0, 0, inum, 'vomecrty', vn                )    ! now j-velocity 
    994       CALL iom_rstput( 0, 0, inum, 'vovecrtz', wn                )    ! now k-velocity 
     990      CALL iom_rstput( 0, 0, inum, 'votemper', ts(:,:,:,jp_tem,Kmm) )    ! now temperature 
     991      CALL iom_rstput( 0, 0, inum, 'vosaline', ts(:,:,:,jp_sal,Kmm) )    ! now salinity 
     992      CALL iom_rstput( 0, 0, inum, 'sossheig', ssh(:,:,Kmm)              )    ! sea surface height 
     993      CALL iom_rstput( 0, 0, inum, 'vozocrtx', uu(:,:,:,Kmm)                )    ! now i-velocity 
     994      CALL iom_rstput( 0, 0, inum, 'vomecrty', vv(:,:,:,Kmm)                )    ! now j-velocity 
     995      CALL iom_rstput( 0, 0, inum, 'vovecrtz', ww                )    ! now k-velocity 
    995996      IF( ALLOCATED(ahtu) ) THEN 
    996997         CALL iom_rstput( 0, 0, inum,  'ahtu', ahtu              )    ! aht at u-point 
     
    10081009      CALL iom_rstput( 0, 0, inum, 'sometauy', vtau              )    ! j-wind stress 
    10091010      IF(  .NOT.ln_linssh  ) THEN              
    1010          CALL iom_rstput( 0, 0, inum, 'vovvldep', gdept_n        )    !  T-cell depth  
    1011          CALL iom_rstput( 0, 0, inum, 'vovvle3t', e3t_n          )    !  T-cell thickness   
     1011         CALL iom_rstput( 0, 0, inum, 'vovvldep', gdept(:,:,:,Kmm)        )    !  T-cell depth  
     1012         CALL iom_rstput( 0, 0, inum, 'vovvle3t', e3t(:,:,:,Kmm)          )    !  T-cell thickness   
    10121013      END IF 
    10131014      IF( ln_wave .AND. ln_sdw ) THEN 
  • NEMO/trunk/tests/CANAL/MY_SRC/domvvl.F90

    r11536 r12377  
    88   !!            3.3  !  2011-10  (M. Leclair) totally rewrote domvvl: vvl option includes z_star and z_tilde coordinates 
    99   !!            3.6  !  2014-11  (P. Mathiot) add ice shelf capability 
     10   !!            4.1  !  2019-08  (A. Coward, D. Storkey) rename dom_vvl_sf_swp -> dom_vvl_sf_update for new timestepping 
    1011   !!---------------------------------------------------------------------- 
    1112 
     
    1314   !!   dom_vvl_init     : define initial vertical scale factors, depths and column thickness 
    1415   !!   dom_vvl_sf_nxt   : Compute next vertical scale factors 
    15    !!   dom_vvl_sf_swp   : Swap vertical scale factors and update the vertical grid 
     16   !!   dom_vvl_sf_update   : Swap vertical scale factors and update the vertical grid 
    1617   !!   dom_vvl_interpol : Interpolate vertical scale factors from one grid point to another 
    1718   !!   dom_vvl_rst      : read/write restart file 
     
    3738   PUBLIC  dom_vvl_init       ! called by domain.F90 
    3839   PUBLIC  dom_vvl_sf_nxt     ! called by step.F90 
    39    PUBLIC  dom_vvl_sf_swp     ! called by step.F90 
     40   PUBLIC  dom_vvl_sf_update  ! called by step.F90 
    4041   PUBLIC  dom_vvl_interpol   ! called by dynnxt.F90 
    4142 
     
    6162   REAL(wp)        , ALLOCATABLE, SAVE, DIMENSION(:,:)   :: frq_rst_hdv                 ! retoring period for low freq. divergence 
    6263 
    63    !! * Substitutions 
    64 #  include "vectopt_loop_substitute.h90" 
    6564   !!---------------------------------------------------------------------- 
    6665   !! NEMO/OCE 4.0 , NEMO Consortium (2018) 
     
    9392 
    9493 
    95    SUBROUTINE dom_vvl_init 
     94   SUBROUTINE dom_vvl_init( Kbb, Kmm, Kaa ) 
    9695      !!---------------------------------------------------------------------- 
    9796      !!                ***  ROUTINE dom_vvl_init  *** 
     
    104103      !! 
    105104      !! ** Action  : - e3t_(n/b) and tilde_e3t_(n/b) 
    106       !!              - Regrid: e3(u/v)_n 
    107       !!                        e3(u/v)_b        
    108       !!                        e3w_n            
    109       !!                        e3(u/v)w_b       
    110       !!                        e3(u/v)w_n       
    111       !!                        gdept_n, gdepw_n and gde3w_n 
     105      !!              - Regrid: e3[u/v](:,:,:,Kmm) 
     106      !!                        e3[u/v](:,:,:,Kmm)        
     107      !!                        e3w(:,:,:,Kmm)            
     108      !!                        e3[u/v]w_b 
     109      !!                        e3[u/v]w_n       
     110      !!                        gdept(:,:,:,Kmm), gdepw(:,:,:,Kmm) and gde3w 
    112111      !!              - h(t/u/v)_0 
    113112      !!              - frq_rst_e3t and frq_rst_hdv 
     
    115114      !! Reference  : Leclair, M., and G. Madec, 2011, Ocean Modelling. 
    116115      !!---------------------------------------------------------------------- 
     116      INTEGER, INTENT(in) :: Kbb, Kmm, Kaa 
     117      ! 
    117118      INTEGER ::   ji, jj, jk 
    118119      INTEGER ::   ii0, ii1, ij0, ij1 
     
    130131      ! 
    131132      !                    ! Read or initialize e3t_(b/n), tilde_e3t_(b/n) and hdiv_lf 
    132       CALL dom_vvl_rst( nit000, 'READ' ) 
    133       e3t_a(:,:,jpk) = e3t_0(:,:,jpk)  ! last level always inside the sea floor set one for all 
     133      CALL dom_vvl_rst( nit000, Kbb, Kmm, 'READ' ) 
     134      e3t(:,:,jpk,Kaa) = e3t_0(:,:,jpk)  ! last level always inside the sea floor set one for all 
    134135      ! 
    135136      !                    !== Set of all other vertical scale factors  ==!  (now and before) 
    136137      !                                ! Horizontal interpolation of e3t 
    137       CALL dom_vvl_interpol( e3t_b(:,:,:), e3u_b(:,:,:), 'U' )    ! from T to U 
    138       CALL dom_vvl_interpol( e3t_n(:,:,:), e3u_n(:,:,:), 'U' ) 
    139       CALL dom_vvl_interpol( e3t_b(:,:,:), e3v_b(:,:,:), 'V' )    ! from T to V  
    140       CALL dom_vvl_interpol( e3t_n(:,:,:), e3v_n(:,:,:), 'V' ) 
    141       CALL dom_vvl_interpol( e3u_n(:,:,:), e3f_n(:,:,:), 'F' )    ! from U to F 
     138      CALL dom_vvl_interpol( e3t(:,:,:,Kbb), e3u(:,:,:,Kbb), 'U' )    ! from T to U 
     139      CALL dom_vvl_interpol( e3t(:,:,:,Kmm), e3u(:,:,:,Kmm), 'U' ) 
     140      CALL dom_vvl_interpol( e3t(:,:,:,Kbb), e3v(:,:,:,Kbb), 'V' )    ! from T to V  
     141      CALL dom_vvl_interpol( e3t(:,:,:,Kmm), e3v(:,:,:,Kmm), 'V' ) 
     142      CALL dom_vvl_interpol( e3u(:,:,:,Kmm), e3f(:,:,:), 'F' )    ! from U to F 
    142143      !                                ! Vertical interpolation of e3t,u,v  
    143       CALL dom_vvl_interpol( e3t_n(:,:,:), e3w_n (:,:,:), 'W'  )  ! from T to W 
    144       CALL dom_vvl_interpol( e3t_b(:,:,:), e3w_b (:,:,:), 'W'  ) 
    145       CALL dom_vvl_interpol( e3u_n(:,:,:), e3uw_n(:,:,:), 'UW' )  ! from U to UW 
    146       CALL dom_vvl_interpol( e3u_b(:,:,:), e3uw_b(:,:,:), 'UW' ) 
    147       CALL dom_vvl_interpol( e3v_n(:,:,:), e3vw_n(:,:,:), 'VW' )  ! from V to UW 
    148       CALL dom_vvl_interpol( e3v_b(:,:,:), e3vw_b(:,:,:), 'VW' ) 
     144      CALL dom_vvl_interpol( e3t(:,:,:,Kmm), e3w (:,:,:,Kmm), 'W'  )  ! from T to W 
     145      CALL dom_vvl_interpol( e3t(:,:,:,Kbb), e3w (:,:,:,Kbb), 'W'  ) 
     146      CALL dom_vvl_interpol( e3u(:,:,:,Kmm), e3uw(:,:,:,Kmm), 'UW' )  ! from U to UW 
     147      CALL dom_vvl_interpol( e3u(:,:,:,Kbb), e3uw(:,:,:,Kbb), 'UW' ) 
     148      CALL dom_vvl_interpol( e3v(:,:,:,Kmm), e3vw(:,:,:,Kmm), 'VW' )  ! from V to UW 
     149      CALL dom_vvl_interpol( e3v(:,:,:,Kbb), e3vw(:,:,:,Kbb), 'VW' ) 
    149150 
    150151      ! We need to define e3[tuv]_a for AGRIF initialisation (should not be a problem for the restartability...) 
    151       e3t_a(:,:,:) = e3t_n(:,:,:) 
    152       e3u_a(:,:,:) = e3u_n(:,:,:) 
    153       e3v_a(:,:,:) = e3v_n(:,:,:) 
     152      e3t(:,:,:,Kaa) = e3t(:,:,:,Kmm) 
     153      e3u(:,:,:,Kaa) = e3u(:,:,:,Kmm) 
     154      e3v(:,:,:,Kaa) = e3v(:,:,:,Kmm) 
    154155      ! 
    155156      !                    !==  depth of t and w-point  ==!   (set the isf depth as it is in the initial timestep) 
    156       gdept_n(:,:,1) = 0.5_wp * e3w_n(:,:,1)       ! reference to the ocean surface (used for MLD and light penetration) 
    157       gdepw_n(:,:,1) = 0.0_wp 
    158       gde3w_n(:,:,1) = gdept_n(:,:,1) - sshn(:,:)  ! reference to a common level z=0 for hpg 
    159       gdept_b(:,:,1) = 0.5_wp * e3w_b(:,:,1) 
    160       gdepw_b(:,:,1) = 0.0_wp 
     157      gdept(:,:,1,Kmm) = 0.5_wp * e3w(:,:,1,Kmm)       ! reference to the ocean surface (used for MLD and light penetration) 
     158      gdepw(:,:,1,Kmm) = 0.0_wp 
     159      gde3w(:,:,1) = gdept(:,:,1,Kmm) - ssh(:,:,Kmm)  ! reference to a common level z=0 for hpg 
     160      gdept(:,:,1,Kbb) = 0.5_wp * e3w(:,:,1,Kbb) 
     161      gdepw(:,:,1,Kbb) = 0.0_wp 
    161162      DO jk = 2, jpk                               ! vertical sum 
    162163         DO jj = 1,jpj 
     
    165166               !                             ! 1 everywhere from mbkt to mikt + 1 or 1 (if no isf) 
    166167               !                             ! 0.5 where jk = mikt      
    167 !!gm ???????   BUG ?  gdept_n as well as gde3w_n  does not include the thickness of ISF ?? 
     168!!gm ???????   BUG ?  gdept(:,:,:,Kmm) as well as gde3w  does not include the thickness of ISF ?? 
    168169               zcoef = ( tmask(ji,jj,jk) - wmask(ji,jj,jk) ) 
    169                gdepw_n(ji,jj,jk) = gdepw_n(ji,jj,jk-1) + e3t_n(ji,jj,jk-1) 
    170                gdept_n(ji,jj,jk) =      zcoef  * ( gdepw_n(ji,jj,jk  ) + 0.5 * e3w_n(ji,jj,jk))  & 
    171                   &                + (1-zcoef) * ( gdept_n(ji,jj,jk-1) +       e3w_n(ji,jj,jk))  
    172                gde3w_n(ji,jj,jk) = gdept_n(ji,jj,jk) - sshn(ji,jj) 
    173                gdepw_b(ji,jj,jk) = gdepw_b(ji,jj,jk-1) + e3t_b(ji,jj,jk-1) 
    174                gdept_b(ji,jj,jk) =      zcoef  * ( gdepw_b(ji,jj,jk  ) + 0.5 * e3w_b(ji,jj,jk))  & 
    175                   &                + (1-zcoef) * ( gdept_b(ji,jj,jk-1) +       e3w_b(ji,jj,jk))  
     170               gdepw(ji,jj,jk,Kmm) = gdepw(ji,jj,jk-1,Kmm) + e3t(ji,jj,jk-1,Kmm) 
     171               gdept(ji,jj,jk,Kmm) =      zcoef  * ( gdepw(ji,jj,jk  ,Kmm) + 0.5 * e3w(ji,jj,jk,Kmm))  & 
     172                  &                + (1-zcoef) * ( gdept(ji,jj,jk-1,Kmm) +       e3w(ji,jj,jk,Kmm))  
     173               gde3w(ji,jj,jk) = gdept(ji,jj,jk,Kmm) - ssh(ji,jj,Kmm) 
     174               gdepw(ji,jj,jk,Kbb) = gdepw(ji,jj,jk-1,Kbb) + e3t(ji,jj,jk-1,Kbb) 
     175               gdept(ji,jj,jk,Kbb) =      zcoef  * ( gdepw(ji,jj,jk  ,Kbb) + 0.5 * e3w(ji,jj,jk,Kbb))  & 
     176                  &                + (1-zcoef) * ( gdept(ji,jj,jk-1,Kbb) +       e3w(ji,jj,jk,Kbb))  
    176177            END DO 
    177178         END DO 
     
    179180      ! 
    180181      !                    !==  thickness of the water column  !!   (ocean portion only) 
    181       ht_n(:,:) = e3t_n(:,:,1) * tmask(:,:,1)   !!gm  BUG  :  this should be 1/2 * e3w(k=1) .... 
    182       hu_b(:,:) = e3u_b(:,:,1) * umask(:,:,1) 
    183       hu_n(:,:) = e3u_n(:,:,1) * umask(:,:,1) 
    184       hv_b(:,:) = e3v_b(:,:,1) * vmask(:,:,1) 
    185       hv_n(:,:) = e3v_n(:,:,1) * vmask(:,:,1) 
     182      ht(:,:) = e3t(:,:,1,Kmm) * tmask(:,:,1)   !!gm  BUG  :  this should be 1/2 * e3w(k=1) .... 
     183      hu(:,:,Kbb) = e3u(:,:,1,Kbb) * umask(:,:,1) 
     184      hu(:,:,Kmm) = e3u(:,:,1,Kmm) * umask(:,:,1) 
     185      hv(:,:,Kbb) = e3v(:,:,1,Kbb) * vmask(:,:,1) 
     186      hv(:,:,Kmm) = e3v(:,:,1,Kmm) * vmask(:,:,1) 
    186187      DO jk = 2, jpkm1 
    187          ht_n(:,:) = ht_n(:,:) + e3t_n(:,:,jk) * tmask(:,:,jk) 
    188          hu_b(:,:) = hu_b(:,:) + e3u_b(:,:,jk) * umask(:,:,jk) 
    189          hu_n(:,:) = hu_n(:,:) + e3u_n(:,:,jk) * umask(:,:,jk) 
    190          hv_b(:,:) = hv_b(:,:) + e3v_b(:,:,jk) * vmask(:,:,jk) 
    191          hv_n(:,:) = hv_n(:,:) + e3v_n(:,:,jk) * vmask(:,:,jk) 
     188         ht(:,:) = ht(:,:) + e3t(:,:,jk,Kmm) * tmask(:,:,jk) 
     189         hu(:,:,Kbb) = hu(:,:,Kbb) + e3u(:,:,jk,Kbb) * umask(:,:,jk) 
     190         hu(:,:,Kmm) = hu(:,:,Kmm) + e3u(:,:,jk,Kmm) * umask(:,:,jk) 
     191         hv(:,:,Kbb) = hv(:,:,Kbb) + e3v(:,:,jk,Kbb) * vmask(:,:,jk) 
     192         hv(:,:,Kmm) = hv(:,:,Kmm) + e3v(:,:,jk,Kmm) * vmask(:,:,jk) 
    192193      END DO 
    193194      ! 
    194195      !                    !==  inverse of water column thickness   ==!   (u- and v- points) 
    195       r1_hu_b(:,:) = ssumask(:,:) / ( hu_b(:,:) + 1._wp - ssumask(:,:) )    ! _i mask due to ISF 
    196       r1_hu_n(:,:) = ssumask(:,:) / ( hu_n(:,:) + 1._wp - ssumask(:,:) ) 
    197       r1_hv_b(:,:) = ssvmask(:,:) / ( hv_b(:,:) + 1._wp - ssvmask(:,:) ) 
    198       r1_hv_n(:,:) = ssvmask(:,:) / ( hv_n(:,:) + 1._wp - ssvmask(:,:) ) 
     196      r1_hu(:,:,Kbb) = ssumask(:,:) / ( hu(:,:,Kbb) + 1._wp - ssumask(:,:) )    ! _i mask due to ISF 
     197      r1_hu(:,:,Kmm) = ssumask(:,:) / ( hu(:,:,Kmm) + 1._wp - ssumask(:,:) ) 
     198      r1_hv(:,:,Kbb) = ssvmask(:,:) / ( hv(:,:,Kbb) + 1._wp - ssvmask(:,:) ) 
     199      r1_hv(:,:,Kmm) = ssvmask(:,:) / ( hv(:,:,Kmm) + 1._wp - ssvmask(:,:) ) 
    199200 
    200201      !                    !==   z_tilde coordinate case  ==!   (Restoring frequencies) 
     
    266267 
    267268 
    268    SUBROUTINE dom_vvl_sf_nxt( kt, kcall )  
     269   SUBROUTINE dom_vvl_sf_nxt( kt, Kbb, Kmm, Kaa, kcall )  
    269270      !!---------------------------------------------------------------------- 
    270271      !!                ***  ROUTINE dom_vvl_sf_nxt  *** 
     
    288289      !! Reference  : Leclair, M., and Madec, G. 2011, Ocean Modelling. 
    289290      !!---------------------------------------------------------------------- 
    290       INTEGER, INTENT( in )           ::   kt      ! time step 
    291       INTEGER, INTENT( in ), OPTIONAL ::   kcall   ! optional argument indicating call sequence 
     291      INTEGER, INTENT( in )           ::   kt             ! time step 
     292      INTEGER, INTENT( in )           ::   Kbb, Kmm, Kaa  ! time step 
     293      INTEGER, INTENT( in ), OPTIONAL ::   kcall          ! optional argument indicating call sequence 
    292294      ! 
    293295      INTEGER                ::   ji, jj, jk            ! dummy loop indices 
     
    321323      !                                                ! --------------------------------------------- ! 
    322324      ! 
    323       z_scale(:,:) = ( ssha(:,:) - sshb(:,:) ) * ssmask(:,:) / ( ht_0(:,:) + sshn(:,:) + 1. - ssmask(:,:) ) 
     325      z_scale(:,:) = ( ssh(:,:,Kaa) - ssh(:,:,Kbb) ) * ssmask(:,:) / ( ht_0(:,:) + ssh(:,:,Kmm) + 1. - ssmask(:,:) ) 
    324326      DO jk = 1, jpkm1 
    325          ! formally this is the same as e3t_a = e3t_0*(1+ssha/ht_0) 
    326          e3t_a(:,:,jk) = e3t_b(:,:,jk) + e3t_n(:,:,jk) * z_scale(:,:) * tmask(:,:,jk) 
     327         ! formally this is the same as e3t(:,:,:,Kaa) = e3t_0*(1+ssha/ht_0) 
     328         e3t(:,:,jk,Kaa) = e3t(:,:,jk,Kbb) + e3t(:,:,jk,Kmm) * z_scale(:,:) * tmask(:,:,jk) 
    327329      END DO 
    328330      ! 
     
    337339         zht(:,:)   = 0._wp 
    338340         DO jk = 1, jpkm1 
    339             zhdiv(:,:) = zhdiv(:,:) + e3t_n(:,:,jk) * hdivn(:,:,jk) 
    340             zht  (:,:) = zht  (:,:) + e3t_n(:,:,jk) * tmask(:,:,jk) 
     341            zhdiv(:,:) = zhdiv(:,:) + e3t(:,:,jk,Kmm) * hdiv(:,:,jk) 
     342            zht  (:,:) = zht  (:,:) + e3t(:,:,jk,Kmm) * tmask(:,:,jk) 
    341343         END DO 
    342344         zhdiv(:,:) = zhdiv(:,:) / ( zht(:,:) + 1. - tmask_i(:,:) ) 
     
    348350               DO jk = 1, jpkm1 
    349351                  hdiv_lf(:,:,jk) = hdiv_lf(:,:,jk) - rdt * frq_rst_hdv(:,:)   & 
    350                      &          * ( hdiv_lf(:,:,jk) - e3t_n(:,:,jk) * ( hdivn(:,:,jk) - zhdiv(:,:) ) ) 
     352                     &          * ( hdiv_lf(:,:,jk) - e3t(:,:,jk,Kmm) * ( hdiv(:,:,jk) - zhdiv(:,:) ) ) 
    351353               END DO 
    352354            ENDIF 
     
    361363         IF( ln_vvl_ztilde ) THEN     ! z_tilde case 
    362364            DO jk = 1, jpkm1 
    363                tilde_e3t_a(:,:,jk) = tilde_e3t_a(:,:,jk) - ( e3t_n(:,:,jk) * ( hdivn(:,:,jk) - zhdiv(:,:) ) - hdiv_lf(:,:,jk) ) 
     365               tilde_e3t_a(:,:,jk) = tilde_e3t_a(:,:,jk) - ( e3t(:,:,jk,Kmm) * ( hdiv(:,:,jk) - zhdiv(:,:) ) - hdiv_lf(:,:,jk) ) 
    364366            END DO 
    365367         ELSE                         ! layer case 
    366368            DO jk = 1, jpkm1 
    367                tilde_e3t_a(:,:,jk) = tilde_e3t_a(:,:,jk) -   e3t_n(:,:,jk) * ( hdivn(:,:,jk) - zhdiv(:,:) ) * tmask(:,:,jk) 
     369               tilde_e3t_a(:,:,jk) = tilde_e3t_a(:,:,jk) -   e3t(:,:,jk,Kmm) * ( hdiv(:,:,jk) - zhdiv(:,:) ) * tmask(:,:,jk) 
    368370            END DO 
    369371         ENDIF 
     
    476478            zht(:,:)  = zht(:,:) + tilde_e3t_a(:,:,jk) * tmask(:,:,jk) 
    477479         END DO 
    478          z_scale(:,:) =  - zht(:,:) / ( ht_0(:,:) + sshn(:,:) + 1. - ssmask(:,:) ) 
     480         z_scale(:,:) =  - zht(:,:) / ( ht_0(:,:) + ssh(:,:,Kmm) + 1. - ssmask(:,:) ) 
    479481         DO jk = 1, jpkm1 
    480             dtilde_e3t_a(:,:,jk) = dtilde_e3t_a(:,:,jk) + e3t_n(:,:,jk) * z_scale(:,:) * tmask(:,:,jk) 
     482            dtilde_e3t_a(:,:,jk) = dtilde_e3t_a(:,:,jk) + e3t(:,:,jk,Kmm) * z_scale(:,:) * tmask(:,:,jk) 
    481483         END DO 
    482484 
     
    486488      !                                           ! ---baroclinic part--------- ! 
    487489         DO jk = 1, jpkm1 
    488             e3t_a(:,:,jk) = e3t_a(:,:,jk) + dtilde_e3t_a(:,:,jk) * tmask(:,:,jk) 
     490            e3t(:,:,jk,Kaa) = e3t(:,:,jk,Kaa) + dtilde_e3t_a(:,:,jk) * tmask(:,:,jk) 
    489491         END DO 
    490492      ENDIF 
     
    501503         zht(:,:) = 0.0_wp 
    502504         DO jk = 1, jpkm1 
    503             zht(:,:) = zht(:,:) + e3t_n(:,:,jk) * tmask(:,:,jk) 
    504          END DO 
    505          z_tmax = MAXVAL( tmask(:,:,1) * tmask_i(:,:) * ABS( ht_0(:,:) + sshn(:,:) - zht(:,:) ) ) 
     505            zht(:,:) = zht(:,:) + e3t(:,:,jk,Kmm) * tmask(:,:,jk) 
     506         END DO 
     507         z_tmax = MAXVAL( tmask(:,:,1) * tmask_i(:,:) * ABS( ht_0(:,:) + ssh(:,:,Kmm) - zht(:,:) ) ) 
    506508         CALL mpp_max( 'domvvl', z_tmax )                                ! max over the global domain 
    507          IF( lwp    ) WRITE(numout, *) kt,' MAXVAL(abs(ht_0+sshn-SUM(e3t_n))) =', z_tmax 
     509         IF( lwp    ) WRITE(numout, *) kt,' MAXVAL(abs(ht_0+sshn-SUM(e3t(:,:,:,Kmm)))) =', z_tmax 
    508510         ! 
    509511         zht(:,:) = 0.0_wp 
    510512         DO jk = 1, jpkm1 
    511             zht(:,:) = zht(:,:) + e3t_a(:,:,jk) * tmask(:,:,jk) 
    512          END DO 
    513          z_tmax = MAXVAL( tmask(:,:,1) * tmask_i(:,:) * ABS( ht_0(:,:) + ssha(:,:) - zht(:,:) ) ) 
     513            zht(:,:) = zht(:,:) + e3t(:,:,jk,Kaa) * tmask(:,:,jk) 
     514         END DO 
     515         z_tmax = MAXVAL( tmask(:,:,1) * tmask_i(:,:) * ABS( ht_0(:,:) + ssh(:,:,Kaa) - zht(:,:) ) ) 
    514516         CALL mpp_max( 'domvvl', z_tmax )                                ! max over the global domain 
    515          IF( lwp    ) WRITE(numout, *) kt,' MAXVAL(abs(ht_0+ssha-SUM(e3t_a))) =', z_tmax 
     517         IF( lwp    ) WRITE(numout, *) kt,' MAXVAL(abs(ht_0+ssha-SUM(e3t(:,:,:,Kaa)))) =', z_tmax 
    516518         ! 
    517519         zht(:,:) = 0.0_wp 
    518520         DO jk = 1, jpkm1 
    519             zht(:,:) = zht(:,:) + e3t_b(:,:,jk) * tmask(:,:,jk) 
    520          END DO 
    521          z_tmax = MAXVAL( tmask(:,:,1) * tmask_i(:,:) * ABS( ht_0(:,:) + sshb(:,:) - zht(:,:) ) ) 
     521            zht(:,:) = zht(:,:) + e3t(:,:,jk,Kbb) * tmask(:,:,jk) 
     522         END DO 
     523         z_tmax = MAXVAL( tmask(:,:,1) * tmask_i(:,:) * ABS( ht_0(:,:) + ssh(:,:,Kbb) - zht(:,:) ) ) 
    522524         CALL mpp_max( 'domvvl', z_tmax )                                ! max over the global domain 
    523          IF( lwp    ) WRITE(numout, *) kt,' MAXVAL(abs(ht_0+sshb-SUM(e3t_b))) =', z_tmax 
    524          ! 
    525          z_tmax = MAXVAL( tmask(:,:,1) *  ABS( sshb(:,:) ) ) 
     525         IF( lwp    ) WRITE(numout, *) kt,' MAXVAL(abs(ht_0+sshb-SUM(e3t(:,:,:,Kbb)))) =', z_tmax 
     526         ! 
     527         z_tmax = MAXVAL( tmask(:,:,1) *  ABS( ssh(:,:,Kbb) ) ) 
    526528         CALL mpp_max( 'domvvl', z_tmax )                                ! max over the global domain 
    527          IF( lwp    ) WRITE(numout, *) kt,' MAXVAL(abs(sshb))) =', z_tmax 
    528          ! 
    529          z_tmax = MAXVAL( tmask(:,:,1) *  ABS( sshn(:,:) ) ) 
     529         IF( lwp    ) WRITE(numout, *) kt,' MAXVAL(abs(ssh(:,:,Kbb)))) =', z_tmax 
     530         ! 
     531         z_tmax = MAXVAL( tmask(:,:,1) *  ABS( ssh(:,:,Kmm) ) ) 
    530532         CALL mpp_max( 'domvvl', z_tmax )                                ! max over the global domain 
    531          IF( lwp    ) WRITE(numout, *) kt,' MAXVAL(abs(sshn))) =', z_tmax 
    532          ! 
    533          z_tmax = MAXVAL( tmask(:,:,1) *  ABS( ssha(:,:) ) ) 
     533         IF( lwp    ) WRITE(numout, *) kt,' MAXVAL(abs(ssh(:,:,Kmm)))) =', z_tmax 
     534         ! 
     535         z_tmax = MAXVAL( tmask(:,:,1) *  ABS( ssh(:,:,Kaa) ) ) 
    534536         CALL mpp_max( 'domvvl', z_tmax )                                ! max over the global domain 
    535          IF( lwp    ) WRITE(numout, *) kt,' MAXVAL(abs(ssha))) =', z_tmax 
     537         IF( lwp    ) WRITE(numout, *) kt,' MAXVAL(abs(ssh(:,:,Kaa)))) =', z_tmax 
    536538      END IF 
    537539 
     
    540542      ! *********************************** ! 
    541543 
    542       CALL dom_vvl_interpol( e3t_a(:,:,:), e3u_a(:,:,:), 'U' ) 
    543       CALL dom_vvl_interpol( e3t_a(:,:,:), e3v_a(:,:,:), 'V' ) 
     544      CALL dom_vvl_interpol( e3t(:,:,:,Kaa), e3u(:,:,:,Kaa), 'U' ) 
     545      CALL dom_vvl_interpol( e3t(:,:,:,Kaa), e3v(:,:,:,Kaa), 'V' ) 
    544546 
    545547      ! *********************************** ! 
     
    547549      ! *********************************** ! 
    548550 
    549       hu_a(:,:) = e3u_a(:,:,1) * umask(:,:,1) 
    550       hv_a(:,:) = e3v_a(:,:,1) * vmask(:,:,1) 
     551      hu(:,:,Kaa) = e3u(:,:,1,Kaa) * umask(:,:,1) 
     552      hv(:,:,Kaa) = e3v(:,:,1,Kaa) * vmask(:,:,1) 
    551553      DO jk = 2, jpkm1 
    552          hu_a(:,:) = hu_a(:,:) + e3u_a(:,:,jk) * umask(:,:,jk) 
    553          hv_a(:,:) = hv_a(:,:) + e3v_a(:,:,jk) * vmask(:,:,jk) 
     554         hu(:,:,Kaa) = hu(:,:,Kaa) + e3u(:,:,jk,Kaa) * umask(:,:,jk) 
     555         hv(:,:,Kaa) = hv(:,:,Kaa) + e3v(:,:,jk,Kaa) * vmask(:,:,jk) 
    554556      END DO 
    555557      !                                        ! Inverse of the local depth 
    556558!!gm BUG ?  don't understand the use of umask_i here ..... 
    557       r1_hu_a(:,:) = ssumask(:,:) / ( hu_a(:,:) + 1._wp - ssumask(:,:) ) 
    558       r1_hv_a(:,:) = ssvmask(:,:) / ( hv_a(:,:) + 1._wp - ssvmask(:,:) ) 
     559      r1_hu(:,:,Kaa) = ssumask(:,:) / ( hu(:,:,Kaa) + 1._wp - ssumask(:,:) ) 
     560      r1_hv(:,:,Kaa) = ssvmask(:,:) / ( hv(:,:,Kaa) + 1._wp - ssvmask(:,:) ) 
    559561      ! 
    560562      IF( ln_timing )   CALL timing_stop('dom_vvl_sf_nxt') 
     
    563565 
    564566 
    565    SUBROUTINE dom_vvl_sf_swp( kt ) 
    566       !!---------------------------------------------------------------------- 
    567       !!                ***  ROUTINE dom_vvl_sf_swp  *** 
     567   SUBROUTINE dom_vvl_sf_update( kt, Kbb, Kmm, Kaa ) 
     568      !!---------------------------------------------------------------------- 
     569      !!                ***  ROUTINE dom_vvl_sf_update  *** 
    568570      !!                    
    569       !! ** Purpose :  compute time filter and swap of scale factors  
     571      !! ** Purpose :  for z tilde case: compute time filter and swap of scale factors  
    570572      !!               compute all depths and related variables for next time step 
    571573      !!               write outputs and restart file 
    572574      !! 
    573       !! ** Method  :  - swap of e3t with trick for volume/tracer conservation 
     575      !! ** Method  :  - swap of e3t with trick for volume/tracer conservation (ONLY FOR Z TILDE CASE) 
    574576      !!               - reconstruct scale factor at other grid points (interpolate) 
    575577      !!               - recompute depths and water height fields 
    576578      !! 
    577       !! ** Action  :  - e3t_(b/n), tilde_e3t_(b/n) and e3(u/v)_n ready for next time step 
     579      !! ** Action  :  - tilde_e3t_(b/n) ready for next time step 
    578580      !!               - Recompute: 
    579581      !!                    e3(u/v)_b        
    580       !!                    e3w_n            
     582      !!                    e3w(:,:,:,Kmm)            
    581583      !!                    e3(u/v)w_b       
    582584      !!                    e3(u/v)w_n       
    583       !!                    gdept_n, gdepw_n  and gde3w_n 
     585      !!                    gdept(:,:,:,Kmm), gdepw(:,:,:,Kmm)  and gde3w 
    584586      !!                    h(u/v) and h(u/v)r 
    585587      !! 
     
    587589      !!              Leclair, M., and G. Madec, 2011, Ocean Modelling. 
    588590      !!---------------------------------------------------------------------- 
    589       INTEGER, INTENT( in ) ::   kt   ! time step 
     591      INTEGER, INTENT( in ) ::   kt              ! time step 
     592      INTEGER, INTENT( in ) ::   Kbb, Kmm, Kaa   ! time level indices 
    590593      ! 
    591594      INTEGER  ::   ji, jj, jk   ! dummy loop indices 
     
    595598      IF( ln_linssh )   RETURN      ! No calculation in linear free surface 
    596599      ! 
    597       IF( ln_timing )   CALL timing_start('dom_vvl_sf_swp') 
     600      IF( ln_timing )   CALL timing_start('dom_vvl_sf_update') 
    598601      ! 
    599602      IF( kt == nit000 )   THEN 
    600603         IF(lwp) WRITE(numout,*) 
    601          IF(lwp) WRITE(numout,*) 'dom_vvl_sf_swp : - time filter and swap of scale factors' 
    602          IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~~~   - interpolate scale factors and compute depths for next time step' 
     604         IF(lwp) WRITE(numout,*) 'dom_vvl_sf_update : - interpolate scale factors and compute depths for next time step' 
     605         IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~~~~~~' 
    603606      ENDIF 
    604607      ! 
     
    615618         tilde_e3t_n(:,:,:) = tilde_e3t_a(:,:,:) 
    616619      ENDIF 
    617       gdept_b(:,:,:) = gdept_n(:,:,:) 
    618       gdepw_b(:,:,:) = gdepw_n(:,:,:) 
    619  
    620       e3t_n(:,:,:) = e3t_a(:,:,:) 
    621       e3u_n(:,:,:) = e3u_a(:,:,:) 
    622       e3v_n(:,:,:) = e3v_a(:,:,:) 
     620      gdept(:,:,:,Kbb) = gdept(:,:,:,Kmm) 
     621      gdepw(:,:,:,Kbb) = gdepw(:,:,:,Kmm) 
     622 
     623      e3t(:,:,:,Kmm) = e3t(:,:,:,Kaa) 
     624      e3u(:,:,:,Kmm) = e3u(:,:,:,Kaa) 
     625      e3v(:,:,:,Kmm) = e3v(:,:,:,Kaa) 
    623626 
    624627      ! Compute all missing vertical scale factor and depths 
     
    626629      ! Horizontal scale factor interpolations 
    627630      ! -------------------------------------- 
    628       ! - ML - e3u_b and e3v_b are allready computed in dynnxt 
    629       ! - JC - hu_b, hv_b, hur_b, hvr_b also 
     631      ! - ML - e3u(:,:,:,Kbb) and e3v(:,:,:,Kbb) are already computed in dynnxt 
     632      ! - JC - hu(:,:,:,Kbb), hv(:,:,:,:,Kbb), hur_b, hvr_b also 
    630633       
    631       CALL dom_vvl_interpol( e3u_n(:,:,:), e3f_n(:,:,:), 'F'  ) 
     634      CALL dom_vvl_interpol( e3u(:,:,:,Kmm), e3f(:,:,:), 'F'  ) 
    632635       
    633636      ! Vertical scale factor interpolations 
    634       CALL dom_vvl_interpol( e3t_n(:,:,:),  e3w_n(:,:,:), 'W'  ) 
    635       CALL dom_vvl_interpol( e3u_n(:,:,:), e3uw_n(:,:,:), 'UW' ) 
    636       CALL dom_vvl_interpol( e3v_n(:,:,:), e3vw_n(:,:,:), 'VW' ) 
    637       CALL dom_vvl_interpol( e3t_b(:,:,:),  e3w_b(:,:,:), 'W'  ) 
    638       CALL dom_vvl_interpol( e3u_b(:,:,:), e3uw_b(:,:,:), 'UW' ) 
    639       CALL dom_vvl_interpol( e3v_b(:,:,:), e3vw_b(:,:,:), 'VW' ) 
     637      CALL dom_vvl_interpol( e3t(:,:,:,Kmm),  e3w(:,:,:,Kmm), 'W'  ) 
     638      CALL dom_vvl_interpol( e3u(:,:,:,Kmm), e3uw(:,:,:,Kmm), 'UW' ) 
     639      CALL dom_vvl_interpol( e3v(:,:,:,Kmm), e3vw(:,:,:,Kmm), 'VW' ) 
     640      CALL dom_vvl_interpol( e3t(:,:,:,Kbb),  e3w(:,:,:,Kbb), 'W'  ) 
     641      CALL dom_vvl_interpol( e3u(:,:,:,Kbb), e3uw(:,:,:,Kbb), 'UW' ) 
     642      CALL dom_vvl_interpol( e3v(:,:,:,Kbb), e3vw(:,:,:,Kbb), 'VW' ) 
    640643 
    641644      ! t- and w- points depth (set the isf depth as it is in the initial step) 
    642       gdept_n(:,:,1) = 0.5_wp * e3w_n(:,:,1) 
    643       gdepw_n(:,:,1) = 0.0_wp 
    644       gde3w_n(:,:,1) = gdept_n(:,:,1) - sshn(:,:) 
     645      gdept(:,:,1,Kmm) = 0.5_wp * e3w(:,:,1,Kmm) 
     646      gdepw(:,:,1,Kmm) = 0.0_wp 
     647      gde3w(:,:,1) = gdept(:,:,1,Kmm) - ssh(:,:,Kmm) 
    645648      DO jk = 2, jpk 
    646649         DO jj = 1,jpj 
     
    649652                                                                 ! 1 for jk = mikt 
    650653               zcoef = (tmask(ji,jj,jk) - wmask(ji,jj,jk)) 
    651                gdepw_n(ji,jj,jk) = gdepw_n(ji,jj,jk-1) + e3t_n(ji,jj,jk-1) 
    652                gdept_n(ji,jj,jk) =    zcoef  * ( gdepw_n(ji,jj,jk  ) + 0.5 * e3w_n(ji,jj,jk) )  & 
    653                    &             + (1-zcoef) * ( gdept_n(ji,jj,jk-1) +       e3w_n(ji,jj,jk) )  
    654                gde3w_n(ji,jj,jk) = gdept_n(ji,jj,jk) - sshn(ji,jj) 
     654               gdepw(ji,jj,jk,Kmm) = gdepw(ji,jj,jk-1,Kmm) + e3t(ji,jj,jk-1,Kmm) 
     655               gdept(ji,jj,jk,Kmm) =    zcoef  * ( gdepw(ji,jj,jk  ,Kmm) + 0.5 * e3w(ji,jj,jk,Kmm) )  & 
     656                   &             + (1-zcoef) * ( gdept(ji,jj,jk-1,Kmm) +       e3w(ji,jj,jk,Kmm) )  
     657               gde3w(ji,jj,jk) = gdept(ji,jj,jk,Kmm) - ssh(ji,jj,Kmm) 
    655658            END DO 
    656659         END DO 
     
    659662      ! Local depth and Inverse of the local depth of the water 
    660663      ! ------------------------------------------------------- 
    661       hu_n(:,:) = hu_a(:,:)   ;   r1_hu_n(:,:) = r1_hu_a(:,:) 
    662       hv_n(:,:) = hv_a(:,:)   ;   r1_hv_n(:,:) = r1_hv_a(:,:) 
    663       ! 
    664       ht_n(:,:) = e3t_n(:,:,1) * tmask(:,:,1) 
     664      ! 
     665      ht(:,:) = e3t(:,:,1,Kmm) * tmask(:,:,1) 
    665666      DO jk = 2, jpkm1 
    666          ht_n(:,:) = ht_n(:,:) + e3t_n(:,:,jk) * tmask(:,:,jk) 
     667         ht(:,:) = ht(:,:) + e3t(:,:,jk,Kmm) * tmask(:,:,jk) 
    667668      END DO 
    668669 
    669670      ! write restart file 
    670671      ! ================== 
    671       IF( lrst_oce  )   CALL dom_vvl_rst( kt, 'WRITE' ) 
    672       ! 
    673       IF( ln_timing )   CALL timing_stop('dom_vvl_sf_swp') 
    674       ! 
    675    END SUBROUTINE dom_vvl_sf_swp 
     672      IF( lrst_oce  )   CALL dom_vvl_rst( kt, Kbb, Kmm, 'WRITE' ) 
     673      ! 
     674      IF( ln_timing )   CALL timing_stop('dom_vvl_sf_update') 
     675      ! 
     676   END SUBROUTINE dom_vvl_sf_update 
    676677 
    677678 
     
    783784 
    784785 
    785    SUBROUTINE dom_vvl_rst( kt, cdrw ) 
     786   SUBROUTINE dom_vvl_rst( kt, Kbb, Kmm, cdrw ) 
    786787      !!--------------------------------------------------------------------- 
    787788      !!                   ***  ROUTINE dom_vvl_rst  *** 
     
    795796      !!                they are set to 0. 
    796797      !!---------------------------------------------------------------------- 
    797       INTEGER         , INTENT(in) ::   kt     ! ocean time-step 
    798       CHARACTER(len=*), INTENT(in) ::   cdrw   ! "READ"/"WRITE" flag 
     798      INTEGER         , INTENT(in) ::   kt        ! ocean time-step 
     799      INTEGER         , INTENT(in) ::   Kbb, Kmm  ! ocean time level indices 
     800      CHARACTER(len=*), INTENT(in) ::   cdrw      ! "READ"/"WRITE" flag 
    799801      ! 
    800802      INTEGER ::   ji, jj, jk 
     
    806808         IF( ln_rstart ) THEN                   !* Read the restart file 
    807809            CALL rst_read_open                  !  open the restart file if necessary 
    808             CALL iom_get( numror, jpdom_autoglo, 'sshn'   , sshn, ldxios = lrxios    ) 
     810            CALL iom_get( numror, jpdom_autoglo, 'sshn'   , ssh(:,:,Kmm), ldxios = lrxios    ) 
    809811            ! 
    810812            id1 = iom_varid( numror, 'e3t_b', ldstop = .FALSE. ) 
     
    817819            !                             ! --------- ! 
    818820            IF( MIN( id1, id2 ) > 0 ) THEN       ! all required arrays exist 
    819                CALL iom_get( numror, jpdom_autoglo, 'e3t_b', e3t_b(:,:,:), ldxios = lrxios ) 
    820                CALL iom_get( numror, jpdom_autoglo, 'e3t_n', e3t_n(:,:,:), ldxios = lrxios ) 
     821               CALL iom_get( numror, jpdom_autoglo, 'e3t_b', e3t(:,:,:,Kbb), ldxios = lrxios ) 
     822               CALL iom_get( numror, jpdom_autoglo, 'e3t_n', e3t(:,:,:,Kmm), ldxios = lrxios ) 
    821823               ! needed to restart if land processor not computed  
    822                IF(lwp) write(numout,*) 'dom_vvl_rst : e3t_b and e3t_n found in restart files' 
     824               IF(lwp) write(numout,*) 'dom_vvl_rst : e3t(:,:,:,Kbb) and e3t(:,:,:,Kmm) found in restart files' 
    823825               WHERE ( tmask(:,:,:) == 0.0_wp )  
    824                   e3t_n(:,:,:) = e3t_0(:,:,:) 
    825                   e3t_b(:,:,:) = e3t_0(:,:,:) 
     826                  e3t(:,:,:,Kmm) = e3t_0(:,:,:) 
     827                  e3t(:,:,:,Kbb) = e3t_0(:,:,:) 
    826828               END WHERE 
    827829               IF( neuler == 0 ) THEN 
    828                   e3t_b(:,:,:) = e3t_n(:,:,:) 
     830                  e3t(:,:,:,Kbb) = e3t(:,:,:,Kmm) 
    829831               ENDIF 
    830832            ELSE IF( id1 > 0 ) THEN 
    831                IF(lwp) write(numout,*) 'dom_vvl_rst WARNING : e3t_n not found in restart files' 
     833               IF(lwp) write(numout,*) 'dom_vvl_rst WARNING : e3t(:,:,:,Kmm) not found in restart files' 
    832834               IF(lwp) write(numout,*) 'e3t_n set equal to e3t_b.' 
    833835               IF(lwp) write(numout,*) 'neuler is forced to 0' 
    834                CALL iom_get( numror, jpdom_autoglo, 'e3t_b', e3t_b(:,:,:), ldxios = lrxios ) 
    835                e3t_n(:,:,:) = e3t_b(:,:,:) 
     836               CALL iom_get( numror, jpdom_autoglo, 'e3t_b', e3t(:,:,:,Kbb), ldxios = lrxios ) 
     837               e3t(:,:,:,Kmm) = e3t(:,:,:,Kbb) 
    836838               neuler = 0 
    837839            ELSE IF( id2 > 0 ) THEN 
    838                IF(lwp) write(numout,*) 'dom_vvl_rst WARNING : e3t_b not found in restart files' 
     840               IF(lwp) write(numout,*) 'dom_vvl_rst WARNING : e3t(:,:,:,Kbb) not found in restart files' 
    839841               IF(lwp) write(numout,*) 'e3t_b set equal to e3t_n.' 
    840842               IF(lwp) write(numout,*) 'neuler is forced to 0' 
    841                CALL iom_get( numror, jpdom_autoglo, 'e3t_n', e3t_n(:,:,:), ldxios = lrxios ) 
    842                e3t_b(:,:,:) = e3t_n(:,:,:) 
     843               CALL iom_get( numror, jpdom_autoglo, 'e3t_n', e3t(:,:,:,Kmm), ldxios = lrxios ) 
     844               e3t(:,:,:,Kbb) = e3t(:,:,:,Kmm) 
    843845               neuler = 0 
    844846            ELSE 
    845                IF(lwp) write(numout,*) 'dom_vvl_rst WARNING : e3t_n not found in restart file' 
     847               IF(lwp) write(numout,*) 'dom_vvl_rst WARNING : e3t(:,:,:,Kmm) not found in restart file' 
    846848               IF(lwp) write(numout,*) 'Compute scale factor from sshn' 
    847849               IF(lwp) write(numout,*) 'neuler is forced to 0' 
    848850               DO jk = 1, jpk 
    849                   e3t_n(:,:,jk) =  e3t_0(:,:,jk) * ( ht_0(:,:) + sshn(:,:) ) & 
     851                  e3t(:,:,jk,Kmm) =  e3t_0(:,:,jk) * ( ht_0(:,:) + ssh(:,:,Kmm) ) & 
    850852                      &                          / ( ht_0(:,:) + 1._wp - ssmask(:,:) ) * tmask(:,:,jk)   & 
    851853                      &          + e3t_0(:,:,jk)                               * (1._wp -tmask(:,:,jk)) 
    852854               END DO 
    853                e3t_b(:,:,:) = e3t_n(:,:,:) 
     855               e3t(:,:,:,Kbb) = e3t(:,:,:,Kmm) 
    854856               neuler = 0 
    855857            ENDIF 
     
    888890               IF( cn_cfg == 'wad' ) THEN 
    889891                  ! Wetting and drying test case 
    890                   CALL usr_def_istate( gdept_b, tmask, tsb, ub, vb, sshb  ) 
    891                   tsn  (:,:,:,:) = tsb (:,:,:,:)       ! set now values from to before ones 
    892                   sshn (:,:)     = sshb(:,:) 
    893                   un   (:,:,:)   = ub  (:,:,:) 
    894                   vn   (:,:,:)   = vb  (:,:,:) 
     892                  CALL usr_def_istate( gdept(:,:,:,Kbb), tmask, ts(:,:,:,:,Kbb), uu(:,:,:,Kbb), vv(:,:,:,Kbb), ssh(:,:,Kbb)  ) 
     893                  ts  (:,:,:,:,Kmm) = ts (:,:,:,:,Kbb)       ! set now values from to before ones 
     894                  ssh (:,:,Kmm)     = ssh(:,:,Kbb) 
     895                  uu   (:,:,:,Kmm)   = uu  (:,:,:,Kbb) 
     896                  vv   (:,:,:,Kmm)   = vv  (:,:,:,Kbb) 
    895897               ELSE 
    896898                  ! if not test case 
    897                   sshn(:,:) = -ssh_ref 
    898                   sshb(:,:) = -ssh_ref 
     899                  ssh(:,:,Kmm) = -ssh_ref 
     900                  ssh(:,:,Kbb) = -ssh_ref 
    899901 
    900902                  DO jj = 1, jpj 
    901903                     DO ji = 1, jpi 
    902904                        IF( ht_0(ji,jj)-ssh_ref <  rn_wdmin1 ) THEN ! if total depth is less than min depth 
    903  
    904                            sshb(ji,jj) = rn_wdmin1 - (ht_0(ji,jj) ) 
    905                            sshn(ji,jj) = rn_wdmin1 - (ht_0(ji,jj) ) 
    906                            ssha(ji,jj) = rn_wdmin1 - (ht_0(ji,jj) ) 
     905                           ssh(ji,jj,Kbb) = rn_wdmin1 - (ht_0(ji,jj) ) 
     906                           ssh(ji,jj,Kmm) = rn_wdmin1 - (ht_0(ji,jj) ) 
    907907                        ENDIF 
    908908                     ENDDO 
     
    912912               ! Adjust vertical metrics for all wad 
    913913               DO jk = 1, jpk 
    914                   e3t_n(:,:,jk) =  e3t_0(:,:,jk) * ( ht_0(:,:) + sshn(:,:)  ) & 
     914                  e3t(:,:,jk,Kmm) =  e3t_0(:,:,jk) * ( ht_0(:,:) + ssh(:,:,Kmm)  ) & 
    915915                    &                            / ( ht_0(:,:) + 1._wp - ssmask(:,:) ) * tmask(:,:,jk)   & 
    916916                    &            + e3t_0(:,:,jk) * ( 1._wp - tmask(:,:,jk) ) 
    917917               END DO 
    918                e3t_b(:,:,:) = e3t_n(:,:,:) 
     918               e3t(:,:,:,Kbb) = e3t(:,:,:,Kmm) 
    919919 
    920920               DO ji = 1, jpi 
     
    928928            ELSE 
    929929               ! 
    930                ! usr_def_istate called here only to get sshb, that is needed to initialize e3t_b and e3t_n 
    931                CALL usr_def_istate( gdept_0, tmask, tsb, ub, vb, sshb  )   
     930               ! usr_def_istate called here only to get sshb, that is needed to initialize e3t(Kbb) and e3t(Kmm) 
     931               CALL usr_def_istate( gdept_0, tmask, ts(:,:,:,:,Kbb), uu(:,:,:,Kbb), vv(:,:,:,Kbb), ssh(:,:,Kbb)  ) 
    932932               ! usr_def_istate will be called again in istate_init to initialize ts(bn), ssh(bn), u(bn) and v(bn) 
    933933               ! 
    934934               DO jk=1,jpk 
    935                   e3t_b(:,:,jk) =  e3t_0(:,:,jk) * ( ht_0(:,:) + sshb(:,:) ) & 
    936                     &                            / ( ht_0(:,:) + 1._wp - ssmask(:,:) ) * tmask(:,:,jk)   & 
    937                     &            + e3t_0(:,:,jk) * ( 1._wp - tmask(:,:,jk) )   ! make sure e3t_b != 0 on land points 
     935                  e3t(:,:,jk,Kmm) =  e3t_0(:,:,jk) * ( ht_0(:,:) + ssh(:,:,Kbb) ) & 
     936                    &                              / ( ht_0(:,:) + 1._wp - ssmask(:,:) ) * tmask(:,:,jk)   & 
     937                    &              + e3t_0(:,:,jk) * ( 1._wp - tmask(:,:,jk) )   ! make sure e3t_b != 0 on land points 
    938938               END DO 
    939                e3t_n(:,:,:) = e3t_b(:,:,:) 
    940                sshn(:,:) = sshb(:,:)   ! needed later for gde3w 
    941 !!$                e3t_n(:,:,:)=e3t_0(:,:,:) 
    942 !!$                e3t_b(:,:,:)=e3t_0(:,:,:) 
     939               e3t(:,:,:,Kmm) = e3t(:,:,:,Kbb) 
     940               ssh(:,:  ,Kmm) = ssh(:,:  ,Kbb)   ! needed later for gde3w 
    943941               ! 
    944942            END IF           ! end of ll_wd edits 
     
    958956         !                                           ! all cases ! 
    959957         !                                           ! --------- ! 
    960          CALL iom_rstput( kt, nitrst, numrow, 'e3t_b', e3t_b(:,:,:), ldxios = lwxios ) 
    961          CALL iom_rstput( kt, nitrst, numrow, 'e3t_n', e3t_n(:,:,:), ldxios = lwxios ) 
     958         CALL iom_rstput( kt, nitrst, numrow, 'e3t_b', e3t(:,:,:,Kbb), ldxios = lwxios ) 
     959         CALL iom_rstput( kt, nitrst, numrow, 'e3t_n', e3t(:,:,:,Kmm), ldxios = lwxios ) 
    962960         !                                           ! ----------------------- ! 
    963961         IF( ln_vvl_ztilde .OR. ln_vvl_layer ) THEN  ! z_tilde and layer cases ! 
     
    992990      !!----------------------------------------------------------------------  
    993991      ! 
    994       REWIND( numnam_ref )              ! Namelist nam_vvl in reference namelist :  
    995992      READ  ( numnam_ref, nam_vvl, IOSTAT = ios, ERR = 901) 
    996993901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'nam_vvl in reference namelist' ) 
    997       REWIND( numnam_cfg )              ! Namelist nam_vvl in configuration namelist : Parameters of the run 
    998994      READ  ( numnam_cfg, nam_vvl, IOSTAT = ios, ERR = 902 ) 
    999995902   IF( ios >  0 ) CALL ctl_nam ( ios , 'nam_vvl in configuration namelist' ) 
  • NEMO/trunk/tests/CANAL/MY_SRC/stpctl.F90

    r10572 r12377  
    4242CONTAINS 
    4343 
    44    SUBROUTINE stp_ctl( kt, kindic ) 
     44   SUBROUTINE stp_ctl( kt, Kbb, Kmm, kindic ) 
    4545      !!---------------------------------------------------------------------- 
    4646      !!                    ***  ROUTINE stp_ctl  *** 
     
    6060      !!---------------------------------------------------------------------- 
    6161      INTEGER, INTENT(in   ) ::   kt       ! ocean time-step index 
     62      INTEGER, INTENT(in   ) ::   Kbb, Kmm      ! ocean time level index 
    6263      INTEGER, INTENT(inout) ::   kindic   ! error indicator 
    6364      !! 
     
    111112      !                                   !==  test of extrema  ==! 
    112113      IF( ll_wd ) THEN 
    113          zmax(1) = MAXVAL(  ABS( sshn(:,:) + ssh_ref*tmask(:,:,1) )  )        ! ssh max  
     114         zmax(1) = MAXVAL(  ABS( ssh(:,:,Kmm) + ssh_ref*tmask(:,:,1) )  )        ! ssh max  
    114115      ELSE 
    115          zmax(1) = MAXVAL(  ABS( sshn(:,:) )  )                               ! ssh max 
     116         zmax(1) = MAXVAL(  ABS( ssh(:,:,Kmm) )  )                               ! ssh max 
    116117      ENDIF 
    117       zmax(2) = MAXVAL(  ABS( un(:,:,:) )  )                                  ! velocity max (zonal only) 
    118       zmax(3) = MAXVAL( -tsn(:,:,:,jp_sal) , mask = tmask(:,:,:) == 1._wp )   ! minus salinity max 
    119       zmax(4) = MAXVAL(  tsn(:,:,:,jp_sal) , mask = tmask(:,:,:) == 1._wp )   !       salinity max 
    120       zmax(5) = MAXVAL( -tsn(:,:,:,jp_tem) , mask = tmask(:,:,:) == 1._wp )   ! minus temperature max 
    121       zmax(6) = MAXVAL(  tsn(:,:,:,jp_tem) , mask = tmask(:,:,:) == 1._wp )   !       temperature max 
     118      zmax(2) = MAXVAL(  ABS( uu(:,:,:,Kmm) )  )                                  ! velocity max (zonal only) 
     119      zmax(3) = MAXVAL( -ts(:,:,:,jp_sal,Kmm) , mask = tmask(:,:,:) == 1._wp )   ! minus salinity max 
     120      zmax(4) = MAXVAL(  ts(:,:,:,jp_sal,Kmm) , mask = tmask(:,:,:) == 1._wp )   !       salinity max 
     121      zmax(5) = MAXVAL( -ts(:,:,:,jp_tem,Kmm) , mask = tmask(:,:,:) == 1._wp )   ! minus temperature max 
     122      zmax(6) = MAXVAL(  ts(:,:,:,jp_tem,Kmm) , mask = tmask(:,:,:) == 1._wp )   !       temperature max 
    122123      zmax(7) = REAL( nstop , wp )                                            ! stop indicator 
    123124      IF( ln_zad_Aimp ) THEN 
     
    148149      !                                   !==  error handling  ==! 
    149150      IF( ( ln_ctl .OR. lsomeoce ) .AND. (   &             ! have use mpp_max (because ln_ctl=.T.) or contains some ocean points 
    150          &  zmax(1) >   50._wp .OR.   &                    ! too large sea surface height ( > 50 m ) 
    151          &  zmax(2) >   20._wp .OR.   &                    ! too large velocity ( > 20 m/s) 
    152 !!$         &  zmax(3) >=   0._wp .OR.   &                    ! negative or zero sea surface salinity 
    153 !!$         &  zmax(4) >= 100._wp .OR.   &                    ! too large sea surface salinity ( > 100 ) 
    154 !!$         &  zmax(4) <    0._wp .OR.   &                    ! too large sea surface salinity (keep this line for sea-ice) 
     151         &  zmax(1) >   20._wp .OR.   &                    ! too large sea surface height ( > 20 m ) 
     152         &  zmax(2) >   10._wp .OR.   &                    ! too large velocity ( > 10 m/s) 
     153!!$      &  zmax(3) >=   0._wp .OR.   &                    ! negative or zero sea surface salinity 
     154!!$      &  zmax(4) >= 100._wp .OR.   &                    ! too large sea surface salinity ( > 100 ) 
     155!!$      &  zmax(4) <    0._wp .OR.   &                    ! too large sea surface salinity (keep this line for sea-ice) 
    155156         &  ISNAN( zmax(1) + zmax(2) + zmax(3) ) ) ) THEN   ! NaN encounter in the tests 
    156157         IF( lk_mpp .AND. ln_ctl ) THEN 
    157             CALL mpp_maxloc( 'stpctl', ABS(sshn)        , ssmask(:,:)  , zzz, ih  ) 
    158             CALL mpp_maxloc( 'stpctl', ABS(un)          , umask (:,:,:), zzz, iu  ) 
    159             CALL mpp_minloc( 'stpctl', tsn(:,:,:,jp_sal), tmask (:,:,:), zzz, is1 ) 
    160             CALL mpp_maxloc( 'stpctl', tsn(:,:,:,jp_sal), tmask (:,:,:), zzz, is2 ) 
     158            CALL mpp_maxloc( 'stpctl', ABS(ssh(:,:,Kmm))        , ssmask(:,:)  , zzz, ih  ) 
     159            CALL mpp_maxloc( 'stpctl', ABS(uu(:,:,:,Kmm))          , umask (:,:,:), zzz, iu  ) 
     160            CALL mpp_minloc( 'stpctl', ts(:,:,:,jp_sal,Kmm), tmask (:,:,:), zzz, is1 ) 
     161            CALL mpp_maxloc( 'stpctl', ts(:,:,:,jp_sal,Kmm), tmask (:,:,:), zzz, is2 ) 
    161162         ELSE 
    162             ih(:)  = MAXLOC( ABS( sshn(:,:)   )                              ) + (/ nimpp - 1, njmpp - 1    /) 
    163             iu(:)  = MAXLOC( ABS( un  (:,:,:) )                              ) + (/ nimpp - 1, njmpp - 1, 0 /) 
    164             is1(:) = MINLOC( tsn(:,:,:,jp_sal), mask = tmask(:,:,:) == 1._wp ) + (/ nimpp - 1, njmpp - 1, 0 /) 
    165             is2(:) = MAXLOC( tsn(:,:,:,jp_sal), mask = tmask(:,:,:) == 1._wp ) + (/ nimpp - 1, njmpp - 1, 0 /) 
     163            ih(:)  = MAXLOC( ABS( ssh(:,:,Kmm)   )                              ) + (/ nimpp - 1, njmpp - 1    /) 
     164            iu(:)  = MAXLOC( ABS( uu  (:,:,:,Kmm) )                              ) + (/ nimpp - 1, njmpp - 1, 0 /) 
     165            is1(:) = MINLOC( ts(:,:,:,jp_sal,Kmm), mask = tmask(:,:,:) == 1._wp ) + (/ nimpp - 1, njmpp - 1, 0 /) 
     166            is2(:) = MAXLOC( ts(:,:,:,jp_sal,Kmm), mask = tmask(:,:,:) == 1._wp ) + (/ nimpp - 1, njmpp - 1, 0 /) 
    166167         ENDIF 
    167168          
    168          WRITE(ctmp1,*) ' stp_ctl: |ssh| > 50 m  or  |U| > 20 m/s  or  NaN encounter in the tests' 
     169         WRITE(ctmp1,*) ' stp_ctl: |ssh| > 20 m  or  |U| > 10 m/s  or  S <= 0  or  S >= 100  or  NaN encounter in the tests' 
    169170         WRITE(ctmp2,9100) kt,   zmax(1), ih(1) , ih(2) 
    170171         WRITE(ctmp3,9200) kt,   zmax(2), iu(1) , iu(2) , iu(3) 
     
    173174         WRITE(ctmp6,*) '      ===> output of last computed fields in output.abort.nc file' 
    174175          
    175          CALL dia_wri_state( 'output.abort' )     ! create an output.abort file 
     176         CALL dia_wri_state( Kmm, 'output.abort' )     ! create an output.abort file 
    176177          
    177178         IF( .NOT. ln_ctl ) THEN 
  • NEMO/trunk/tests/CANAL/MY_SRC/trazdf.F90

    r10572 r12377  
    3535   PUBLIC   tra_zdf_imp   ! called by trczdf.F90 
    3636 
    37    !! * Substitutions 
    38 #  include "vectopt_loop_substitute.h90" 
    3937   !!---------------------------------------------------------------------- 
    4038   !! NEMO/OCE 4.0 , NEMO Consortium (2018) 
     
    4442CONTAINS 
    4543 
    46    SUBROUTINE tra_zdf( kt ) 
     44   SUBROUTINE tra_zdf( kt, Kbb, Kmm, Krhs, pts, Kaa ) 
    4745      !!---------------------------------------------------------------------- 
    4846      !!                  ***  ROUTINE tra_zdf  *** 
     
    5048      !! ** Purpose :   compute the vertical ocean tracer physics. 
    5149      !!--------------------------------------------------------------------- 
    52       INTEGER, INTENT(in) ::   kt   ! ocean time-step index 
     50      INTEGER                                  , INTENT(in)    :: kt                  ! ocean time-step index 
     51      INTEGER                                  , INTENT(in)    :: Kbb, Kmm, Krhs, Kaa ! time level indices 
     52      REAL(wp), DIMENSION(jpi,jpj,jpk,jpts,jpt), INTENT(inout) :: pts                 ! active tracers and RHS of tracer equation 
    5353      ! 
    5454      INTEGER  ::   jk   ! Dummy loop indices 
     
    7070      IF( l_trdtra )   THEN                  !* Save ta and sa trends 
    7171         ALLOCATE( ztrdt(jpi,jpj,jpk) , ztrds(jpi,jpj,jpk) ) 
    72          ztrdt(:,:,:) = tsa(:,:,:,jp_tem) 
    73          ztrds(:,:,:) = tsa(:,:,:,jp_sal) 
     72         ztrdt(:,:,:) = pts(:,:,:,jp_tem,Kaa) 
     73         ztrds(:,:,:) = pts(:,:,:,jp_sal,Kaa) 
    7474      ENDIF 
    7575      ! 
    7676      !                                      !* compute lateral mixing trend and add it to the general trend 
    77       CALL tra_zdf_imp( kt, nit000, 'TRA', r2dt, tsb, tsa, jpts )  
     77      CALL tra_zdf_imp( kt, nit000, 'TRA', r2dt, Kbb, Kmm, Krhs, pts, Kaa, jpts )  
    7878 
    7979!!gm WHY here !   and I don't like that ! 
     
    8181      ! JMM avoid negative salinities near river outlet ! Ugly fix 
    8282      ! JMM : restore negative salinities to small salinities: 
    83 !!$      WHERE( tsa(:,:,:,jp_sal) < 0._wp )   tsa(:,:,:,jp_sal) = 0.1_wp 
     83!!$   WHERE( pts(:,:,:,jp_sal,Kaa) < 0._wp )   pts(:,:,:,jp_sal,Kaa) = 0.1_wp 
    8484!!gm 
    8585 
    8686      IF( l_trdtra )   THEN                      ! save the vertical diffusive trends for further diagnostics 
    8787         DO jk = 1, jpkm1 
    88             ztrdt(:,:,jk) = ( ( tsa(:,:,jk,jp_tem)*e3t_a(:,:,jk) - tsb(:,:,jk,jp_tem)*e3t_b(:,:,jk) ) & 
    89                &          / (e3t_n(:,:,jk)*r2dt) ) - ztrdt(:,:,jk) 
    90             ztrds(:,:,jk) = ( ( tsa(:,:,jk,jp_sal)*e3t_a(:,:,jk) - tsb(:,:,jk,jp_sal)*e3t_b(:,:,jk) ) & 
    91               &           / (e3t_n(:,:,jk)*r2dt) ) - ztrds(:,:,jk) 
     88            ztrdt(:,:,jk) = ( ( pts(:,:,jk,jp_tem,Kaa)*e3t(:,:,jk,Kaa) - pts(:,:,jk,jp_tem,Kbb)*e3t(:,:,jk,Kbb) ) & 
     89               &          / (e3t(:,:,jk,Kmm)*r2dt) ) - ztrdt(:,:,jk) 
     90            ztrds(:,:,jk) = ( ( pts(:,:,jk,jp_sal,Kaa)*e3t(:,:,jk,Kaa) - pts(:,:,jk,jp_sal,Kbb)*e3t(:,:,jk,Kbb) ) & 
     91              &           / (e3t(:,:,jk,Kmm)*r2dt) ) - ztrds(:,:,jk) 
    9292         END DO 
    9393!!gm this should be moved in trdtra.F90 and done on all trends 
    9494         CALL lbc_lnk_multi( 'trazdf', ztrdt, 'T', 1. , ztrds, 'T', 1. ) 
    9595!!gm 
    96          CALL trd_tra( kt, 'TRA', jp_tem, jptra_zdf, ztrdt ) 
    97          CALL trd_tra( kt, 'TRA', jp_sal, jptra_zdf, ztrds ) 
     96         CALL trd_tra( kt, Kmm, Krhs, 'TRA', jp_tem, jptra_zdf, ztrdt ) 
     97         CALL trd_tra( kt, Kmm, Krhs, 'TRA', jp_sal, jptra_zdf, ztrds ) 
    9898         DEALLOCATE( ztrdt , ztrds ) 
    9999      ENDIF 
    100100      !                                          ! print mean trends (used for debugging) 
    101       IF(ln_ctl)   CALL prt_ctl( tab3d_1=tsa(:,:,:,jp_tem), clinfo1=' zdf  - Ta: ', mask1=tmask,               & 
    102          &                       tab3d_2=tsa(:,:,:,jp_sal), clinfo2=       ' Sa: ', mask2=tmask, clinfo3='tra' ) 
     101      IF(ln_ctl)   CALL prt_ctl( tab3d_1=pts(:,:,:,jp_tem,Kaa), clinfo1=' zdf  - Ta: ', mask1=tmask,               & 
     102         &                       tab3d_2=pts(:,:,:,jp_sal,Kaa), clinfo2=       ' Sa: ', mask2=tmask, clinfo3='tra' ) 
    103103      ! 
    104104      IF( ln_timing )   CALL timing_stop('tra_zdf') 
     
    107107 
    108108  
    109    SUBROUTINE tra_zdf_imp( kt, kit000, cdtype, p2dt, ptb, pta, kjpt )  
     109   SUBROUTINE tra_zdf_imp( kt, kit000, cdtype, p2dt, Kbb, Kmm, Krhs, pt, Kaa, kjpt )  
    110110      !!---------------------------------------------------------------------- 
    111111      !!                  ***  ROUTINE tra_zdf_imp  *** 
     
    125125      !!      If iso-neutral mixing, add to avt the contribution due to lateral mixing. 
    126126      !! 
    127       !! ** Action  : - pta  becomes the after tracer 
    128       !!--------------------------------------------------------------------- 
    129       INTEGER                              , INTENT(in   ) ::   kt       ! ocean time-step index 
    130       INTEGER                              , INTENT(in   ) ::   kit000   ! first time step index 
    131       CHARACTER(len=3)                     , INTENT(in   ) ::   cdtype   ! =TRA or TRC (tracer indicator) 
    132       INTEGER                              , INTENT(in   ) ::   kjpt     ! number of tracers 
    133       REAL(wp)                             , INTENT(in   ) ::   p2dt     ! tracer time-step 
    134       REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(in   ) ::   ptb      ! before and now tracer fields 
    135       REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(inout) ::   pta      ! in: tracer trend ; out: after tracer field 
     127      !! ** Action  : - pt(:,:,:,:,Kaa)  becomes the after tracer 
     128      !!--------------------------------------------------------------------- 
     129      INTEGER                                  , INTENT(in   ) ::   kt       ! ocean time-step index 
     130      INTEGER                                  , INTENT(in   ) ::   Kbb, Kmm, Krhs, Kaa  ! ocean time level indices 
     131      INTEGER                                  , INTENT(in   ) ::   kit000   ! first time step index 
     132      CHARACTER(len=3)                         , INTENT(in   ) ::   cdtype   ! =TRA or TRC (tracer indicator) 
     133      INTEGER                                  , INTENT(in   ) ::   kjpt     ! number of tracers 
     134      REAL(wp)                                 , INTENT(in   ) ::   p2dt     ! tracer time-step 
     135      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt,jpt), INTENT(inout) ::   pt       ! tracers and RHS of tracer equation 
    136136      ! 
    137137      INTEGER  ::  ji, jj, jk, jn   ! dummy loop indices 
     
    181181                  DO jj = 2, jpjm1 
    182182                     DO ji = fs_2, fs_jpim1   ! vector opt. (ensure same order of calculation as below if wi=0.) 
    183                         zzwi = - p2dt * zwt(ji,jj,jk  ) / e3w_n(ji,jj,jk  ) 
    184                         zzws = - p2dt * zwt(ji,jj,jk+1) / e3w_n(ji,jj,jk+1) 
    185                         zwd(ji,jj,jk) = e3t_a(ji,jj,jk) - zzwi - zzws   & 
     183                        zzwi = - p2dt * zwt(ji,jj,jk  ) / e3w(ji,jj,jk  ,Kmm) 
     184                        zzws = - p2dt * zwt(ji,jj,jk+1) / e3w(ji,jj,jk+1,Kmm) 
     185                        zwd(ji,jj,jk) = e3t(ji,jj,jk,Kaa) - zzwi - zzws   & 
    186186                           &                 + p2dt * ( MAX( wi(ji,jj,jk  ) , 0._wp ) - MIN( wi(ji,jj,jk+1) , 0._wp ) ) 
    187187                        zwi(ji,jj,jk) = zzwi + p2dt *   MIN( wi(ji,jj,jk  ) , 0._wp ) 
     
    194194                  DO jj = 2, jpjm1 
    195195                     DO ji = fs_2, fs_jpim1   ! vector opt. 
    196                         zwi(ji,jj,jk) = - p2dt * zwt(ji,jj,jk  ) / e3w_n(ji,jj,jk) 
    197                         zws(ji,jj,jk) = - p2dt * zwt(ji,jj,jk+1) / e3w_n(ji,jj,jk+1) 
    198                         zwd(ji,jj,jk) = e3t_a(ji,jj,jk) - zwi(ji,jj,jk) - zws(ji,jj,jk) 
     196                        zwi(ji,jj,jk) = - p2dt * zwt(ji,jj,jk  ) / e3w(ji,jj,jk,Kmm) 
     197                        zws(ji,jj,jk) = - p2dt * zwt(ji,jj,jk+1) / e3w(ji,jj,jk+1,Kmm) 
     198                        zwd(ji,jj,jk) = e3t(ji,jj,jk,Kaa) - zwi(ji,jj,jk) - zws(ji,jj,jk) 
    199199                    END DO 
    200200                  END DO 
     
    218218            !   The solution will be in the 4d array pta. 
    219219            !   The 3d array zwt is used as a work space array. 
    220             !   En route to the solution pta is used a to evaluate the rhs and then  
     220            !   En route to the solution pt(:,:,:,:,Kaa) is used a to evaluate the rhs and then  
    221221            !   used as a work space array: its value is modified. 
    222222            ! 
     
    238238         DO jj = 2, jpjm1           !* 2nd recurrence:    Zk = Yk - Ik / Tk-1  Zk-1 
    239239            DO ji = fs_2, fs_jpim1 
    240                pta(ji,jj,1,jn) = e3t_b(ji,jj,1) * ptb(ji,jj,1,jn) + p2dt * e3t_n(ji,jj,1) * pta(ji,jj,1,jn) 
     240               pt(ji,jj,1,jn,Kaa) = e3t(ji,jj,1,Kbb) * pt(ji,jj,1,jn,Kbb) + p2dt * e3t(ji,jj,1,Kmm) * pt(ji,jj,1,jn,Krhs) 
    241241            END DO 
    242242         END DO 
     
    244244            DO jj = 2, jpjm1 
    245245               DO ji = fs_2, fs_jpim1 
    246                   zrhs = e3t_b(ji,jj,jk) * ptb(ji,jj,jk,jn) + p2dt * e3t_n(ji,jj,jk) * pta(ji,jj,jk,jn)   ! zrhs=right hand side 
    247                   pta(ji,jj,jk,jn) = zrhs - zwi(ji,jj,jk) / zwt(ji,jj,jk-1) * pta(ji,jj,jk-1,jn) 
     246                  zrhs = e3t(ji,jj,jk,Kbb) * pt(ji,jj,jk,jn,Kbb) + p2dt * e3t(ji,jj,jk,Kmm) * pt(ji,jj,jk,jn,Krhs)   ! zrhs=right hand side 
     247                  pt(ji,jj,jk,jn,Kaa) = zrhs - zwi(ji,jj,jk) / zwt(ji,jj,jk-1) * pt(ji,jj,jk-1,jn,Kaa) 
    248248               END DO 
    249249            END DO 
     
    252252         DO jj = 2, jpjm1           !* 3d recurrence:    Xk = (Zk - Sk Xk+1 ) / Tk   (result is the after tracer) 
    253253            DO ji = fs_2, fs_jpim1 
    254                pta(ji,jj,jpkm1,jn) = pta(ji,jj,jpkm1,jn) / zwt(ji,jj,jpkm1) * tmask(ji,jj,jpkm1) 
     254               pt(ji,jj,jpkm1,jn,Kaa) = pt(ji,jj,jpkm1,jn,Kaa) / zwt(ji,jj,jpkm1) * tmask(ji,jj,jpkm1) 
    255255            END DO 
    256256         END DO 
     
    258258            DO jj = 2, jpjm1 
    259259               DO ji = fs_2, fs_jpim1 
    260                   pta(ji,jj,jk,jn) = ( pta(ji,jj,jk,jn) - zws(ji,jj,jk) * pta(ji,jj,jk+1,jn) )   & 
     260                  pt(ji,jj,jk,jn,Kaa) = ( pt(ji,jj,jk,jn,Kaa) - zws(ji,jj,jk) * pt(ji,jj,jk+1,jn,Kaa) )   & 
    261261                     &             / zwt(ji,jj,jk) * tmask(ji,jj,jk) 
    262262               END DO 
  • NEMO/trunk/tests/CANAL/MY_SRC/usrdef_nam.F90

    r11899 r12377  
    8484      !!---------------------------------------------------------------------- 
    8585      ! 
    86       REWIND( numnam_cfg )          ! Namelist namusr_def (exist in namelist_cfg only) 
    8786      READ  ( numnam_cfg, namusr_def, IOSTAT = ios, ERR = 902 ) 
    8887902   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namusr_def in configuration namelist' ) 
  • NEMO/trunk/tests/CANAL/MY_SRC/usrdef_sbc.F90

    r10074 r12377  
    3131   PUBLIC   usrdef_sbc_ice_flx  ! routine called by icestp.F90 for ice thermo 
    3232 
    33    !! * Substitutions 
    34 #  include "vectopt_loop_substitute.h90" 
    3533   !!---------------------------------------------------------------------- 
    3634   !! NEMO/OCE 4.0 , NEMO Consortium (2018) 
     
    4038CONTAINS 
    4139 
    42    SUBROUTINE usrdef_sbc_oce( kt ) 
     40   SUBROUTINE usrdef_sbc_oce( kt, Kmm, Kbb ) 
    4341      !!--------------------------------------------------------------------- 
    4442      !!                    ***  ROUTINE usr_def_sbc  *** 
     
    5452      !! 
    5553      !!---------------------------------------------------------------------- 
    56       INTEGER, INTENT(in) ::   kt   ! ocean time step 
    57        
     54      INTEGER, INTENT(in) ::   kt        ! ocean time step 
     55      INTEGER, INTENT(in) ::   Kbb, Kmm  ! ocean time index 
    5856      INTEGER  ::   ji, jj               ! dummy loop indices 
    5957      REAL(wp) :: zrhoair = 1.22     ! approximate air density [Kg/m3] 
     
    8886          
    8987         WHERE( ABS(gphit) <= rn_windszy/2. ) 
    90             zwndrel(:,:) = rn_u10 - rn_uofac * un(:,:,1) 
     88            zwndrel(:,:) = rn_u10 - rn_uofac * uu(:,:,1,Kmm) 
    9189         ELSEWHERE 
    92             zwndrel(:,:) =        - rn_uofac * un(:,:,1) 
     90            zwndrel(:,:) =        - rn_uofac * uu(:,:,1,Kmm) 
    9391         END WHERE 
    9492         utau(:,:) = zrhocd * zwndrel(:,:) * zwndrel(:,:) 
    9593 
    96          zwndrel(:,:) = - rn_uofac * vn(:,:,1) 
     94         zwndrel(:,:) = - rn_uofac * vv(:,:,1,Kmm) 
    9795         vtau(:,:) = zrhocd * zwndrel(:,:) * zwndrel(:,:) 
    9896 
     
    105103   END SUBROUTINE usrdef_sbc_ice_tau 
    106104 
    107    SUBROUTINE usrdef_sbc_ice_flx( kt ) 
     105 
     106   SUBROUTINE usrdef_sbc_ice_flx( kt, phs, phi ) 
    108107      INTEGER, INTENT(in) ::   kt   ! ocean time step 
     108      REAL(wp), DIMENSION(:,:,:), INTENT(in)  ::   phs    ! snow thickness 
     109      REAL(wp), DIMENSION(:,:,:), INTENT(in)  ::   phi    ! ice thickness 
    109110   END SUBROUTINE usrdef_sbc_ice_flx 
    110111 
  • NEMO/trunk/tests/CANAL/MY_SRC/usrdef_zgr.F90

    r10425 r12377  
    3131   PUBLIC   usr_def_zgr        ! called by domzgr.F90 
    3232 
    33   !! * Substitutions 
    34 #  include "vectopt_loop_substitute.h90" 
    3533   !!---------------------------------------------------------------------- 
    3634   !! NEMO/OCE 4.0 , NEMO Consortium (2018) 
Note: See TracChangeset for help on using the changeset viewer.