Skip to content
Snippets Groups Projects
diags.rst 1.1 KiB
Newer Older
*******************
Add new diagnostics
*******************
Claire Levy's avatar
Claire Levy committed
   TBD

.. contents::
   :local:

If you want to add a NEMO diagnostic to the NEMO code you will need to do the following:

1. Add any necessary code to calculate you new diagnostic in NEMO
2. Send the field to XIOS using ``CALL iom_put( 'field_id', variable )`` where
   ``field_id`` is a unique id for your new diagnostics and
   variable is the fortran variable containing the data.
   This should be called at every model timestep regardless of how often you want to output the field.
   No time averaging should be done in the model code.
3. If it is computationally expensive to calculate your new diagnostic
   you should also use "iom_use" to determine if it is requested in the current model run.
   For example,

   .. code-block:: fortran

      IF iom_use('field_id') THEN
         !Some expensive computation
         !...
         !...
	 iom_put('field_id', variable)
      ENDIF

4. Add a variable definition to the :file:`field_def_nemo-???.xml` file.
5. Add the variable to the :file:`iodef.xml` or :file:`file_definition.xml` file.