HowTo: Print alert messages

De LMDZPedia
Révision de 17 septembre 2021 à 12:03 par Lfairhead (discussion | contributions) (Page créée avec « Routine 'prt_alerte' has been added to module phy_common/print_control_mod.F90 to enable developpers to print out informative messages on the first pass through physics an... »)

(diff) ← Version précédente | Voir la version actuelle (diff) | Version suivante → (diff)
Aller à : navigation, rechercher

Routine 'prt_alerte' has been added to module phy_common/print_control_mod.F90 to enable developpers to print out informative messages on the first pass through physics and from the master process only. This can be used to remind oneself of potential problems or further enhancements.

Messages can be differentiated by a 'priority' code 0/1/2 (corresponding to GREEN/ORANGE/RED alerts)

By default, the messages are output in a file called ALERTES.txt but changing the unit number to 6 in the print_control_mod.F90 file allows you to print out your messages to the screen.

To use you simply need to:

  • have this USE statement at the start of your routine:
   USE print_control_mod, ONLY: prt_level, lunout, call_alert, prt_alerte
  • ensure that the modname variable is defined and contains the name of your routine

then you just need to add the following lines in your routine wherever you want to ouput your message (preferably not in a do loop)

   message='your informative message'
   IF (call_alert) CALL prt_alerte(message,modname,CODE)

where

   message is the message to print out
   modname is the routine name
   CODE is an integer representing your priority code (0/1/2) 

and you should get messages of the form

   ALERTE ROUGE cva_driver! ym missing init, need to have a look by developpers
   ALERTE VERTE orosetup_strato! ym correction en attendant mieux


in your output file.