[v4.0.x] Output `msftbarot` and `uocetr_vsum_cumul` at a given frequency


I am using NEMO4.0.4 on ORCA1 and I struggle in outputting the variables msftbarot and uocetr_vsum_cumul. When I include these variables in the file_def_nemo-oce.xml my simulation crashes with this error message:

`> Error [CConstDataPacketPtr CStoreFilter::getPacket(Time timestamp) const] : 
In file '/gpfs/scratch/bsc32/bsc32019/a4cr/auto-nemo/sources/xios-2.5/src/filter/store_filter.cpp', line 54 
-> Impossible to get the packet with timestamp = 1831766400`

Tracking back the problem it seems that it is coming from the variable uocetr_vsum_op that NEMO is retrieving from xios in the routine diaptr.F90 (cf. line 310: CALL iom_get_var( 'uocetr_vsum_op', z2d )).

Here is this iom_get_var function from the file iom.F90:

   SUBROUTINE iom_get_var( cdname, z2d)
      CHARACTER(LEN=*), INTENT(in ) ::   cdname
      REAL(wp), DIMENSION(jpi,jpj) ::   z2d 
#if defined key_iomput
      IF( xios_field_is_active( cdname, at_current_timestep_arg = .TRUE. ) ) THEN
         z2d(:,:) = 0._wp
         CALL xios_recv_field( cdname, z2d)
      IF( .FALSE. )   WRITE(numout,*) cdname, z2d ! useless test to avoid compilation warnings                                                                                                                     
   END SUBROUTINE iom_get_var

Here I can see this line:

IF( xios_field_is_active( cdname, at_current_timestep_arg = .TRUE. ) ) THEN

, which I understood as a check to verify whether the variable uocetr_vsum_op exists at the current timestep and is possibly available for NEMO.

Here is the parts related to those variables in my:

  • field_def_nemo-oce.xml:

        <field_group id="grid_U"   grid_ref="grid_U_2D">
          <field id="e2u"           long_name="U-cell width in meridional direction"                   standard_name="cell_width"                  unit="m"                               />
          <field id="e3u"           long_name="U-cell thickness"                                       standard_name="cell_thickness"              unit="m"          grid_ref="grid_U_3D" />
          <field id="e3u_0"         long_name="Initial U-cell thickness"                               standard_name="ref_cell_thickness"          unit="m"          grid_ref="grid_U_3D"/>
          <field id="utau"          long_name="Wind Stress along i-axis"                               standard_name="surface_downward_x_stress"   unit="N/m2"                            />
          <field id="uoce"         long_name="ocean current along i-axis"                             standard_name="sea_water_x_velocity"        unit="m/s"        grid_ref="grid_U_3D" />
          <field id="uoce_e3u"     long_name="ocean current along i-axis * e3u"                                                                   unit="m2/s"       grid_ref="grid_U_3D"  > uoce * e3u </field>
          <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"/>
          <field id="uocetr_vsum"  long_name="ocean current along i-axis * e3u * e2u summed on the vertical"      field_ref="e2u"       unit="m3/s"> uoce_e3u_vsum * e2u </field>                                 
          <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>	
          <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" grid_ref="grid_U_2D" />
          <field id="msftbarot"         long_name="ocean_barotropic_mass_streamfunction"  unit="kg s-1" > uocetr_vsum_cumul * $rau0 </field>
  • file_def_nemo-oce.xml

          <file id="file42" name_suffix="_grid_U_2D" description="ocean U grid variables" enabled=".TRUE.">
            <field enabled="True" field_ref="uoce_e3u_vsum" name="uoce_e3u_vsum" />
            <field enabled="True" field_ref="uocetr_vsum" name="uocetr_vsum" />
            <field enabled="True" field_ref="uocetr_vsum_op" name="uocetr_vsum_op" />
            <field enabled="True" field_ref="uocetr_vsum_cumul" name="uocetr_vsum_cumul" />
            <field enabled="True" field_ref="msftbarot" name="msftbarot" />

Can someone help me with this problem? Am I doing something wrong with the XML files?

Thank you,

Hi Yohan, I’m not sure I understand how this is meant to work either. This seems to have been put in to support the CMIP6 diagnostics 2 years ago (around revision 11993). My only guess is that it will only work with certain time periods (either monthly or annual averages) and that you are asking for output at a different frequency?

Thank you for your answer Andrew.

This is also how I understood it. And since the freq_op option of the variable uocetr_vsum_cumul is set to freq_op="1mo" in the field_def_nemo-oce.xml, my guess was that asking it at monthly frequency would be fine. But it does not work. I also tried to output it at the model time step then, but I had the same error.

Did you try with simply the reference to msftbarot in your file_def_nemo-oce.xml:

        <file id="file42" name_suffix="_grid_U_2D" description="ocean U grid variables" enabled=".TRUE.">
          <field field_ref="msftbarot"  />

The other variables are intermediate variables that will be used internally to compute msftbarot.

Two other points :

  • msftbarot will be wrong if you suppress some land domains
  • it is so much simpler to simply output u_masstr_vint and, in a post-processing phase, do the cumulative sum along the j direction to get msftbarot

Hi Sebastien,

thank you for your replies.

I have the same problem in case I only try to output msftbarot in my file_def_nemo-oce.xml. The issue seems to be coming from the diaptr.F90 routine that is called to compute uocetr_vsum_cumul, from which the variable msftbarot is built on.

Good to know… Could you explain why?

We are actually currently outputing uocetr_vsum and computing offline its cumulative sum along j. But it seems that I should get the same thing if I compute offline msftbarot from u_masstr_vint (taking into account the mutliplication by rau0). What do you think? I will try in any case.