wiki:Documentation/UserGuide/Printlev

Control text output

The control of text output in ORCHIDEE trunk has been homogenized. The externalized parameter PRINTLEV is replacing BAVARD, LONGPRINT and local hard coded debug variables. This is available in ORCHIDEE trunk since revision 2348.

PRINTLEV : global parameter

PRINTLEV is an externalised parameter used to define a global level of output text information. Default value is 1.

PRINTLEV definition:

  • 0 no output.
  • 1 minimum writing for long simulations only at initialization and finalization phase (default)
  • 2 more basic information for long simulations, some daily information can be written, nothing must be written at each time step.
  • 3 first debug level: entering and leaving important subroutines can be reported.
  • 4 higher debug level: input parameters to major subroutines can be reported, other debug information.

In the code, use the following syntax:

IF (printlev>=1) WRITE(numout,*) 'This is a very important write statement...'
IF (printlev>=3) WRITE(numout,*) 'This is a debug print...'

PRINTLEV_modulename : local parameter to one module

The function get_ printlev('modulename') makes it possible to have a local write level in a module. Setting PRINTLEV_modulename in run.def changes then the write level in that module. The default value is the global PRINTLEV value. This functionality is available only in modules where the function get_printlev() is called. get_printlev should be called once in the initialization part for the module to define a new local saved variable. This new variable should be used in the whole module for all write statements instead of printlev. For example:

In module sechiba:

! Module declared variable
INTEGER, SAVE :: printlev_loc

! In subroutine sechiba_init:
printlev_loc=get_printlev('sechiba') 

In the example the function printlev_loc will read the variable PRINTLEV _sechiba from run.def. The default value is the same as the global printlev variable.

In the rest of the module, all write statements should be done as follows:

IF (printlev_loc>=1) WRITE(numout,*) 'This is a low level print'
IF (printlev_loc>=3) WRITE(numout,*) 'This is a debug print'
Last modified 3 years ago Last modified on 07/10/15 12:18:05