Simple BASIN example with XIOS fails

Hello, CROCO beginner here. Just started trying out v1.2.1
Successfully compiled BASIN and CANYON test cases so far. Now exploring BASIN with XIOS.

The default XIOS xml files don’t work for me. I added these lines to my jobcomp in the xiosisdefined block:

$CPP1 -P -traditional -imacros cppdefs.h  ${ROOT_DIR}/XIOS/field_def_croco.xml_full_withcpp $RUNDIR/field_def_croco.xml
$CPP1 -P -traditional -imacros cppdefs.h  ${ROOT_DIR}/XIOS/file_def_croco.xml_full_withcpp $RUNDIR/file_def_croco.xml
cp ${ROOT_DIR}/XIOS/domain_def_croco.xml $RUNDIR/domain_def_croco.xml
cp ${ROOT_DIR}/XIOS/iodef.xml_croco_xios $RUNDIR/iodef.xml
cp ${ROOT_DIR}/XIOS/context_croco.xml $RUNDIR/context_croco.xml

It gives me these XML files:

  • context_croco.xml
  • domain_def_croco.xml
  • field_def_croco.xml
  • file_def_croco.xml
  • iodef.xml

XIOS-2.5 is installed system-wide, and I set the #define XIOS compiler key in the BASIN block in the cppdefs.

croco.log reports these Activated C-preprocessing Options:

  BASIN
  MPI
  XIOS
  LOGFILE
  SOLVE3D
  UV_COR
  UV_ADV
  UV_HADV_UP3
  UV_VIS2
  UV_VADV_SPLINES
  TS_HADV_UP3
  TS_DIF2
  TS_MIX_S
  TS_VADV_AKIMA
  BODYFORCE
  ANA_BTFLUX
  START_DATE
  ANA_INITIAL
  ANA_STFLUX
  ANA_GRID
  ANA_SMFLUX
  NO_FRCFILE
  MPI_COMM_WORLD
  M2FILTER_POWER
  TRACERS
  TEMPERATURE
  HZR
  VAR_RHO_2D
  RESET_RHO0
  PGF_FLAT_BOTTOM
  UV_MIX_S
  NTRA_T3DMIX
  NF_CLOBBER

The model initially runs, coro.log get up to here

 level   S-coord     Cs-curve          at_hmin  over_slope     at_hmax

    10   0.0000000   0.0000000           0.000       0.000       0.000
     9  -0.1000000  -0.0852337        -426.316    -426.316    -426.316
     8  -0.2000000  -0.1713205        -856.889    -856.889    -856.889
     7  -0.3000000  -0.2591218       -1296.018   -1296.018   -1296.018
     6  -0.4000000  -0.3495166       -1748.088   -1748.088   -1748.088
     5  -0.5000000  -0.4434094       -2217.613   -2217.613   -2217.613
     4  -0.6000000  -0.5417401       -2709.283   -2709.283   -2709.283
     3  -0.7000000  -0.6454926       -3228.008   -3228.008   -3228.008
     2  -0.8000000  -0.7557055       -3778.970   -3778.970   -3778.970
     1  -0.9000000  -0.8734817       -4367.674   -4367.674   -4367.674
     0  -1.0000000  -1.0000000       -5000.000   -5000.000   -5000.000

 Time splitting: ndtfast = 65    nfast = 88

 Maximum grid stiffness ratios:   rx0 =  0.000000000000000E+000 rx1 =
  0.000000000000000E+000
 1029.7821  rho0     Reset Boussinesq approximation mean density, kg/m3.

My namelist is taken from the repositrory

wget https://forge.ird.fr/lops/croco/-/raw/9a648a3d44d50041d7acc6143dd86f76346e3479/TEST_CASES/croco.in.Basin?inline=false -O croco.in.Basin

The model run fails somewhere in XIOS code with this ERROR:

> Error [CField::solveGridReference(void)] : In file '/home/fwobus/Downloads/xios/xios-2.5_nc474f453hdf1105p/xios-2.5/src/node/field.cpp', line 1302 -> A grid must be defined for field '__field_undef_id_9' .

Abort(-1) on node 1 (rank 1 in comm 0): application called MPI_Abort(MPI_COMM_WORLD, -1) - process 1
> Error [CField::solveGridReference(void)] : In file '/home/fwobus/Downloads/xios/xios-2.5_nc474f453hdf1105p/xios-2.5/src/node/field.cpp', line 1302 -> A grid must be defined for field '__field_undef_id_9' .

Abort(-1) on node 0 (rank 0 in comm 0): application called MPI_Abort(MPI_COMM_WORLD, -1) - process 0
> Error [CField::solveGridReference(void)] : In file '/home/fwobus/Downloads/xios/xios-2.5_nc474f453hdf1105p/xios-2.5/src/node/field.cpp', line 1302 -> A grid must be defined for field '__field_undef_id_9' .

Abort(-1) on node 2 (rank 2 in comm 0): application called MPI_Abort(MPI_COMM_WORLD, -1) - process 2
> Error [CField::solveGridReference(void)] : In file '/home/fwobus/Downloads/xios/xios-2.5_nc474f453hdf1105p/xios-2.5/src/node/field.cpp', line 1302 -> A grid must be defined for field '__field_undef_id_9' .

Abort(-1) on node 3 (rank 3 in comm 0): application called MPI_Abort(MPI_COMM_WORLD, -1) - process 3

Does anyone have a working set of XML files for XIOS? Or can anyone see where I’m going wrong. What else can I check?

Thanks,
Fred

Hi Fred

I had a look and realized the default iodef.xml was only suitable for lon/lat coordinates, not cartesian one, and with BASIN or other academic configurations, it fails to write the grid. Here the set of files I used successfully:

https://filesender.renater.fr/?s=download&token=f4d4c47e-905c-4fde-aa5b-4a30ea45dc77

Note that I was running XIOS in attached mode (server=false in iodef.xml), but I hope this is also ok in detached mode

Rachid

Thank you so much Rachid. This set of files works now.

Could the differences required for the test cases be added to the official release, please? It would help others get started. There is a mechanism to cpp-preprocess the xml files, so it should be relatively straight forward to add the ifdefs

Thanks for your feedback Fred, glad it works. Yes, I’ll try not to forget to correct this for the next release