Changeset 10354 for NEMO/trunk/doc/latex/NEMO/subfiles/annex_D.tex
- Timestamp:
- 2018-11-21T17:59:55+01:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
NEMO/trunk/doc/latex/NEMO/subfiles/annex_D.tex
r9407 r10354 13 13 14 14 15 A "model life" is more than ten years. Its software, composed of a few16 hundred modules, is used by many people who are scientists or students 17 and do not necessarily know every aspect of computing very well. 18 Moreover, a well thought-out program is easier to read and understand, 19 less difficult to modify, produces fewer bugs and is easier to maintain. 20 Therefore, it is essential that the model development follows some rules 15 A "model life" is more than ten years. 16 Its software, composed of a few hundred modules, is used by many people who are scientists or students and 17 do not necessarily know every aspect of computing very well. 18 Moreover, a well thought-out program is easier to read and understand, less difficult to modify, 19 produces fewer bugs and is easier to maintain. 20 Therefore, it is essential that the model development follows some rules: 21 21 22 22 - well planned and designed … … 32 32 - flexible. 33 33 34 To satisfy part of these aims, \NEMO is written with a coding standard which 35 is close to the ECMWF rules,named DOCTOR \citep{Gibson_TR86}.36 These rules present some advantages like 34 To satisfy part of these aims, \NEMO is written with a coding standard which is close to the ECMWF rules, 35 named DOCTOR \citep{Gibson_TR86}. 36 These rules present some advantages like: 37 37 38 38 - to provide a well presented program 39 39 40 - to use rules for variable names which allow recognition of their type 40 - to use rules for variable names which allow recognition of their type 41 41 (integer, real, parameter, local or shared variables, etc. ). 42 42 … … 49 49 \label{sec:D_structure} 50 50 51 Each program begins with a set of headline comments containing 51 Each program begins with a set of headline comments containing: 52 52 53 53 - the program title … … 65 65 - the author name(s), the date of creation and any updates. 66 66 67 - Each program is split into several well separated sections and 67 - Each program is split into several well separated sections and 68 68 sub-sections with an underlined title and specific labelled statements. 69 69 70 70 - A program has not more than 200 to 300 lines. 71 71 72 A template of a module style can be found on the NEMO depository 73 in the following file :NEMO/OPA\_SRC/module\_example.72 A template of a module style can be found on the NEMO depository in the following file: 73 NEMO/OPA\_SRC/module\_example. 74 74 % ================================================================ 75 75 % Coding conventions … … 78 78 \label{sec:D_coding} 79 79 80 - Use of the universal language \textsc{Fortran} 90, and try to avoid obsolescent 81 features like statement functions, do not use GO TO and EQUIVALENCE statements. 82 83 - A continuation line begins with the character {\&} indented by three spaces 84 compared to the previous line, while the previous line ended with the character {\&}. 85 86 - All the variables must be declared. The code is usually compiled with implicit none. 80 - Use of the universal language \textsc{Fortran} 90, and try to avoid obsolescent features like statement functions, 81 do not use GO TO and EQUIVALENCE statements. 82 83 - A continuation line begins with the character {\&} indented by three spaces compared to the previous line, 84 while the previous line ended with the character {\&}. 85 86 - All the variables must be declared. 87 The code is usually compiled with implicit none. 87 88 88 - Never use continuation lines in the declaration of a variable. When searching a 89 variable in the code through a \textit{grep} command, the declaration line will be found. 90 91 - In the declaration of a PUBLIC variable, the comment part at the end of the line 92 should start with the two characters "\verb?!:?". the following UNIX command, \\ 89 - Never use continuation lines in the declaration of a variable. 90 When searching a variable in the code through a \textit{grep} command, the declaration line will be found. 91 92 - In the declaration of a PUBLIC variable, the comment part at the end of the line should start with 93 the two characters "\verb?!:?". 94 The following UNIX command, \\ 93 95 \verb?grep var_name *90 \ grep \!: ? \\ 94 96 will display the module name and the line where the var\_name declaration is. 95 97 96 - Always use a three spaces indentation in DO loop, CASE, or IF-ELSEIF-ELSE-ENDIF 97 statements. 98 - Always use a three spaces indentation in DO loop, CASE, or IF-ELSEIF-ELSE-ENDIF statements. 98 99 99 100 - use a space after a comma, except when it appears to separate the indices of an array. … … 109 110 \label{sec:D_naming} 110 111 111 The purpose of the naming conventions is to use prefix letters to classify 112 model variables. These conventions allow the variable type to be easily 113 known and rapidly identified. The naming conventions are summarised 114 in the Table below: 112 The purpose of the naming conventions is to use prefix letters to classify model variables. 113 These conventions allow the variable type to be easily known and rapidly identified. 114 The naming conventions are summarised in the Table below: 115 115 116 116 … … 192 192 %-------------------------------------------------------------------------------------------------------------- 193 193 194 N.B. Parameter here, in not only parameter in the \textsc{Fortran} acceptation, it is also used for code variables195 that are read in namelist and should never been modified during a simulation.194 N.B. Parameter here, in not only parameter in the \textsc{Fortran} acceptation, 195 it is also used for code variables that are read in namelist and should never been modified during a simulation. 196 196 It is the case, for example, for the size of a domain (jpi,jpj,jpk). 197 197
Note: See TracChangeset
for help on using the changeset viewer.