A few rules for programming (from Meso-NH)

The following few rules are intended for SURFEX developers. They must be seen as a facility to read and update the code more than a constraint.

  1. The DOCTOR norm must be respected, following article193.
  2. Every routine must include the command IMPLICIT NONE at the beginning, and therefore every variable must be declared.
  3. A namelist for developers is available for all the programs (NAM_BLANK declared in the module MODN_BLANK and the associated declarative module MODD_BLANK) with a lot of variables not used in the standard code. The use of these modules is advised.
    If the introduction of a new namelist NAM_xxx is absolutely necessary, a namelist module (MODN_xxx) and a declarative module (MODD_xxx) must be declared.
  4. An objective is to limit the duplication of the code. Therefore, a subroutine or a function aaa, included with a CONTAINS at the end of the routine yyy.f 90 must be only called in yyy. If it is necessary to call again this routine aaa in an other routine zzz, it mustn’t be duplicated with a CONTAINS in the routine zzz.f 90. A new routine aaa.f 90 must be created, and will be called both in yyy and zzz. As a general rule, the use of the CONTAINS must be limited to low level routines.
  5. You can’t use modules with $n in routines without $n.