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.
2013WP/2013Stream1/Configuration_Setting – NEMO
wiki:2013WP/2013Stream1/Configuration_Setting

Version 12 (modified by frrh, 11 years ago) (diff)

--

Configuration Setting

Last edited Timestamp?


Position of the issue

Several points have to be improved regarding the management of the namelist in NEMO.

From a user point of view:

  • global domain sizes are FORTRAN parameters, not namelist parameters
    • a namelist file in each configuration with all the variables (i.e. all the sub-namelist), not only the sub-namelist that depart from the default values

From a developer point of view:

  • the number of copies of the whole namelist (2 by configuration and an increasing number of reference configuration) make the change in namelist a nightmare
    • default values of the namelist appear twice: 1) in the namelist itself and 2) in the code, distributed in the declaration phase of numerous modules
    • global domain sizes (jpiglo, jpjglo, jpidta, jpjdta, jpkdta) are FORTRAN parameters, except in AGRIF case ==> almost as many par_XXX.h90 as the number of reference configurations !
    • in the code old namelist variables (i.e. with a non-doctor name) still survive ==> suppression is needed.

Proposed SOLUTION1 (Gurvan, december 2012): "3 namelists, 1 additional step"

I - global domain sizes, configuration names, etc... (all the PARAMETER in par_oce.F90) defined in the namelist. Impact: suppression of all par_XXX.h90 files. Also suppression of all key_XXX associated to configurations (key_ORCA_RXXX, key_EEL_RXXX, key_GYRE, etc...).

II - namelist:
• One single whole by medium (ocean, ice, top, ...: namelist_ref , namelist_ice_ref, name list_top_ref, ...) put at CONFIG/ level in read-only mode. This namelist contains the default values. The hard coded default values spread in the modules are suppressed (together with the surviving old non-doctor variables).
• In each configuration the namelists of each medium contain only the changes associated with the configuration (the name may be namelist_cfg , namelist_cfg_top, etc...). A pearl script will be used to build the all the namelists that are required to run NEMO:

namelist == namelist_ref + namelist_cfg changes
namelist_top == namelist_top_ref + namelist_top_cfg changes
etc ...

Discussion (Claire)

Initialization of the variables

Up to now, these namelist variables are initialized twice: hard coded default values spread in the modules, and in the namelist file. Suppressing the hard coded initialisation opens possibility for no initialisation at all (if something is mispelled in the namelist for example). In that sense, removing the hard coded initialisation may be questionnable.

SOLUTION1: some critics

The option is to have a unique complete reference namelist, and a smaller "configuration specific" on containing only the values changed from the reference namelist. This implies and additional step before execution: a merge of the 2 namelists (reference overwritten by specific) to build the third namelist, the one to be used at execution time. The perl script to do that is already written (sent by Marcello Vichi) I see to major defaults with this solution:

  • adding a new step in the execution process is an additional burden. We should look at it carefully before making such a choice. On a technical level, is it obvious that perl will be available on each computing platform? At a user level, it is one thing more not to forget, which cannot be automated neither at compilation (not the right place since namelist can be changed a number of time without changing executable) nor at execution (not an appropriate risk to take if crashes in a batch job) time
  • once the new namelist is created (the first time), my guess is that users will change this "execution namelist" if needed, and not the "configuration" one, in order not to have to do ther merge namelist step again. Mainly this choice means that in order to be sure of what is done, user will have to check 3 namelists (rahter than 1): the reference, the configuration, and the execution one. This seems to be too much

Proposed SOLUTION2 (Claire, January 2013) : "1 namelist, more initialisation in the code"

Another way to look at the question:

  • a default initialisation is left in the fortran code, in the module where the namelist variables are declared, used, with all the comments...
  • a configuration namelist containing only the values departing from this default, is available in the CONFIG/CONFIG_NAME/EXP00 directory (like now, but a smaller one)
  • no reference unique default namelist anymore, BUT
  • a complete print of all namelist values is created at the first time step in a separate "output_namelist_xxx" file, aside from ocean.output, in order for the user to know exactly what is done in the run, and what are the values for all these namelist variables
  • this suppresses the reference namelist, and above all the additionnal "merge namelist" step
  • in addition: using IOSTAT and ERR in the READ of the namelist, it is possible to manage properly not having a specific namelist at all in the small namelist file (when all default values are used), and typos in the namelist file

Proposed SOLUTION3 (Claire, January 2013) "2 namelist, more READS in the code"

If the idea of losing at least one complete namelist is unbearable, another solution (based on choices of SOLUTION1) could be imagined:

  • a unique reference namelist (complete, with default values) in CONFIG/SHARED
  • a small configuration-specific namelist in CONFIG/CONFIG_NAME/EXP00 containing only the modified values from the reference namelist
  • no initialisation in the code (since reference namelist contains everything)
  • reading a namelist now takes 2 steps (in the code): reading the reference namelist and reading afterwards the configuration-specific namelist which will overwrite the default values by the changed one given in the configuration-specific

This allows having a complete namelist file (the unique reference namelist) but suppresses the additional merge-namelist step needed in SOLUTION1

Please add your comments and suggestions below

Marcello: Solution3 was partly discussed during the meeting and I found it very clever. This is very much equivalent to Solution1 but without the need to run a parser first. On the other hand, the step of running the parser can be included in the example script for job submission, but I do agree that it is less automatic.  Incidentally, perl must be installed on the machines, otherwise FCM does not work! In summary, I'm for SOLUTION3 and second choice SOLUTION1.

Richard H: As the model increases in size and content it can become increasingly difficult (and important) to be able to compare a standard configuration with some alternative/updated/modified configuration. However, the namelist is potentially a single point of reference which could be used to do this. e.g. if ALL inputs must come via a single namelist (or even via the 2 stage namelist in solution 3) then we have an easy means of finding the difference between two configurations. Initialising all namelist fields to missing data indicators in the code ensure that all input fields must be given a valid value in the namelist (or the model will crash). Allowing all/some fields to be given defaults in the FORTRAN code means that people can apply changes by modifying FORTRAN code OR namelist values, whereas defaulting everything to missing data values ensures only the namelist is an acceptable mechanism for changing inputs and gives us a single point of reference/definition for model settings.

Add your vote below

SOLUTION1 "3 namelists, 1 additional step":
SOLUTION2 "1 namelist, more initialisation in the code": (Richard H - but only if the initialisation is to missing data values!)
SOLUTION3 "2 namelist, more READS in the code": Marcello, Richard H
???