| 1 | = Control text output = |
| 2 | 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. |
| 3 | |
| 4 | === PRINTLEV : global parameter === |
| 5 | |
| 6 | PRINTLEV is an externalised parameter used to define a global level of output text information. Default value is 1. |
| 7 | |
| 8 | PRINTLEV definition: |
| 9 | * 0 no output. |
| 10 | * 1 minimum writing for long simulations only at initialization and finalization phase (default) |
| 11 | * 2 more basic information for long simulations, some daily information can be written, nothing must be written at each time step. |
| 12 | * 3 first debug level: entering and leaving important subroutines can be reported. |
| 13 | * 4 higher debug level: input parameters to major subroutines can be reported, other debug information. |
| 14 | |
| 15 | |
| 16 | In the code, use the following syntax: |
| 17 | {{{ |
| 18 | IF (printlev>=1) WRITE(numout,*) 'This is a very important write statement...' |
| 19 | IF (printlev>=3) WRITE(numout,*) 'This is a debug print...' |
| 20 | }}} |
| 21 | |
| 22 | === PRINTLEV_''modulename'' : local parameter to one module === |
| 23 | 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: |
| 24 | |
| 25 | In module sechiba: |
| 26 | |
| 27 | {{{ |
| 28 | ! Module declared variable |
| 29 | INTEGER, SAVE :: printlev_loc |
| 30 | |
| 31 | ! In subroutine sechiba_init: |
| 32 | printlev_loc=get_printlev('sechiba') |
| 33 | }}} |
| 34 | 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.[[BR]] |
| 35 | |
| 36 | In the rest of the module, all write statements should be done as follows: |
| 37 | {{{ |
| 38 | IF (printlev_loc>=1) WRITE(numout,*) 'This is a low level print' |
| 39 | IF (printlev_loc>=3) WRITE(numout,*) 'This is a debug print' |
| 40 | }}} |