New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Changeset 11967 for NEMO/branches/2019/ENHANCE-02_ISF_nemo_TEST_MERGE/doc/latex/global/coding_rules.tex – NEMO

Ignore:
Timestamp:
2019-11-26T15:11:43+01:00 (4 years ago)
Author:
davestorkey
Message:

2019/ENHANCE-02_ISF_nemo_TEST_MERGE : Update to rev 11953.

Location:
NEMO/branches/2019/ENHANCE-02_ISF_nemo_TEST_MERGE/doc
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/2019/ENHANCE-02_ISF_nemo_TEST_MERGE/doc

    • Property svn:externals set to
      ^/utils/badges badges
      ^/utils/logos logos
  • NEMO/branches/2019/ENHANCE-02_ISF_nemo_TEST_MERGE/doc/latex

    • Property svn:ignore deleted
  • NEMO/branches/2019/ENHANCE-02_ISF_nemo_TEST_MERGE/doc/latex/global

    • Property svn:ignore deleted
  • NEMO/branches/2019/ENHANCE-02_ISF_nemo_TEST_MERGE/doc/latex/global/coding_rules.tex

    r11299 r11967  
    1 %\documentclass{article} 
    2  
    3 %\usepackage{fancyhdr} 
    4 %\usepackage{times} 
    5 %\usepackage{graphicx} 
    6 %\usepackage{hyperref} 
    7 %\usepackage{minted} 
    8 %\usepackage[normalem]{ulem}   % striketrough style with \sout{...} 
    9  
    10 %\hypersetup{pdftitle={NEMO coding conventions}, pdfauthor={NEMO System Team}, colorlinks} 
    11 %\setminted{style=emacs, breaklines, frame=leftline} 
    12 %\newmintinline[forcode]{fortran}{fontsize=auto, frame=lines}   % \forcode{...} 
    13 %\newminted[forlines]{fortran}{}                                % \begin{forlines} 
    14  
    15 %\pagestyle{empty} 
    16 %\setlength{\leftmargin}{1 cm} 
    17 %\setlength{\rightmargin}{1 cm} 
    18 %\setlength{\oddsidemargin}{0 cm} 
    19 %\setlength{\evensidemargin}{0 cm} 
    20 %\setlength{\topmargin}{-1cm} 
    21 %\setlength{\textwidth}{16 cm} 
    22 %\setlength{\textheight}{25cm} 
    23 %\pagestyle{fancy} 
    24  
    25 %\title{ 
    26 %  \includegraphics[width=0.3\textwidth]{../../../figures/NEMO_grey} \\ 
    27 %  \vspace{1.0cm} \rule{345pt}{1.5pt} \\ 
    28 %  \vspace{0.45cm} {\Huge NEMO coding conventions} \rule{345pt}{1.5pt} \\ 
    29 %} 
    30 %\title{NEMO coding conventions} 
    31 %\author{\Large NEMO System Team 
    32 %  \thanks{ 
    33 %    To be completed 
    34 %  } 
    35 %} 
    36 %\date{version X.X -- month year} 
    37  
    38 %\begin{document} 
    39  
    40 %\maketitle 
    41  
    42 %\newpage 
    43  
    44 %\tableofcontents 
    45  
    46 %\newpage 
    47  
    48 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
     1 
    492\chapter{Coding Rules} 
    50 \label{apdx:coding} 
    51  
    52 \minitoc 
     3\label{apdx:CODING} 
     4 
     5\chaptertoc 
    536 
    547\newpage 
     
    6114Therefore, it is essential that the model development follows some rules: 
    6215 
    63 - well planned and designed 
    64  
    65 - well written 
    66  
    67 - well documented (both on- and off-line) 
    68  
    69 - maintainable 
    70  
    71 - easily portable 
    72  
    73 - flexible. 
    74  
    75 To satisfy part of these aims, \NEMO is written with a coding standard which is close to the ECMWF rules, 
    76 named DOCTOR \citep{gibson_rpt86}.  
     16\begin{itemize} 
     17\item well planned and designed 
     18\item well written 
     19\item well documented (both on- and off-line) 
     20\item maintainable 
     21\item easily portable 
     22\item flexible. 
     23\end{itemize} 
     24 
     25To satisfy part of these aims, \NEMO\ is written with a coding standard which is close to the ECMWF rules, 
     26named DOCTOR \citep{gibson_rpt86}. 
    7727These rules present some advantages like: 
    7828 
    79 - to provide a well presented program 
    80  
    81 - to use rules for variable names which allow recognition of their type 
    82 (integer, real, parameter, local or shared variables, etc. ).  
     29\begin{itemize} 
     30\item to provide a well presented program 
     31\item to use rules for variable names which allow recognition of their type   (integer, real, parameter, local or shared variables, etc. ). 
     32\end{itemize} 
    8333 
    8434This facilitates both the understanding and the debugging of an algorithm. 
     
    8636\section{Introduction} 
    8737 
    88 This document describes conventions\index{conventions} used in NEMO coding and suggested for its development. 
    89 The objectives are to offer a guide to all readers of the NEMO code, and to facilitate the work of 
     38This document describes conventions used in \NEMO\ coding and suggested for its development. 
     39The objectives are to offer a guide to all readers of the \NEMO\ code, and to facilitate the work of 
    9040all the developers, including the validation of their developments, and 
    91 eventually the implementation of these developments within the NEMO platform. 
     41eventually the implementation of these developments within the \NEMO\ platform. 
    9242 
    9343A first approach of these rules can be found in the code in \path{./src/OCE/module_example} where 
     
    9646 
    9747This work is based on the coding conventions in use for the Community Climate System Model 
    98 \footnote {\href{http://www.cesm.ucar.edu/working_groups/Software/dev_guide/dev_guide/node7.html}{UCAR conventions}},  
     48\footnote {\href{http://www.cesm.ucar.edu/working_groups/Software/dev_guide/dev_guide/node7.html}{UCAR conventions}}, 
    9949the previous version of this document (``FORTRAN coding standard in the OPA System'') and 
    100 the expertise of the NEMO System Team. 
     50the expertise of the \NEMO\ System Team. 
    10151After a general overview below, this document will describe: 
    10252 
    10353\begin{itemize} 
    104 \item 
    105   The style rules, $i.e.$ the syntax, appearance and naming conventions chosen to improve readability of the code; 
    106 \item 
    107   The content rules, $i.e.$ the conventions to improve the reliability of the different parts of the code; 
    108 \item 
    109   The package rules to go a step further by improving the reliability of the whole and 
    110   interfaces between routines and modules. 
     54\item The style rules, $i.e.$ the syntax, appearance and naming conventions chosen to improve readability of the code; 
     55\item The content rules, $i.e.$ the conventions to improve the reliability of the different parts of the code; 
     56\item The package rules to go a step further by improving the reliability of the whole and 
     57   interfaces between routines and modules. 
    11158\end{itemize} 
    11259 
    113 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
    11460\section{Overview and general conventions} 
    11561 
    116 NEMO has 3 major components: ocean dynamics (\path{./src/OCE}), sea-ice (\path{./src/ICE}) and 
     62\NEMO\ has 3 major components: ocean dynamics (\path{./src/OCE}), sea-ice (\path{./src/ICE}) and 
    11763marine biogeochemistry (\path{./src/MBG}). 
    11864%, linear-tangent and adjoint of the dynamics ($TAM$) each of them corresponding to a directory. 
     
    12672See \path{.src/OCE/DOM/phycst.F90} files for conversions. 
    12773 
    128 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
    12974\section{Architecture} 
    13075 
    131 Within each directory, organisation of files is driven by orthogonality\index{orthogonality}, 
     76Within each directory, organisation of files is driven by orthogonality, 
    13277$i.e.$ one functionality of the code is intended to be in one and only one directory, and 
    13378one module and all its related routines are in one file. 
    134 The functional modules\index{module} are: 
     79The functional modules are: 
    13580 
    13681\begin{itemize} 
     
    13883\item \path{IOM}             management of the I/O 
    13984\item \path{NST}             interface to AGRIF (nesting model) for dynamics and biogeochemistry 
    140 \item \path{OBC}, \path{BDY} management of structured and unstructured open boundaries  
     85\item \path{OBC}, \path{BDY} management of structured and unstructured open boundaries 
    14186\item \path{C1D}             1D (vertical) configuration for dynamics, sea-ice and biogeochemistry 
    14287\item \path{OFF}             off-line module: passive tracer or biogeochemistry alone 
     
    14792this module (\texttt{dom\_init, dom\_nam, dom\_ctl}). 
    14893 
    149 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
    15094\section{Style rules} 
    15195 
    152 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
    15396\subsection{Argument list format} 
    15497 
    155 Routine argument lists will contain a maximum 5 variables\index{variable} per line, 
     98Routine argument lists will contain a maximum 5 variables per line, 
    15699whilst continuation lines can be used. 
    157100This applies both to the calling routine and the dummy argument list in the routine being called. 
     
    164107\end{forlines} 
    165108 
    166 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
    167109\subsection{Array syntax} 
    168110 
     
    198140\end{forlines} 
    199141 
    200 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
    201142\subsection{Case} 
    202143 
    203144All FORTRAN keywords are in capital: \forcode{DIMENSION}, \forcode{WRITE}, \forcode{DO}, \forcode{END DO}, 
    204 \forcode{NAMELIST}, ... All other parts of the NEMO code will be written in lower case. 
    205  
    206 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
     145\forcode{NAMELIST}, ... All other parts of the \NEMO\ code will be written in lower case. 
     146 
    207147\subsection{Comments} 
    208148 
     
    248188\end{enumerate} 
    249189 
    250 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
    251190\subsection{Continuation lines} 
    252191 
     
    265204use a ``\&'' as first character of the continuing lines to maintain the alignment. 
    266205 
    267 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
    268206\subsection{Declaration of arguments and local variables} 
    269207 
     
    277215\end{forlines} 
    278216 
    279 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
    280217\subsection{F90 Standard} 
    281218 
    282 NEMO software adheres to the FORTRAN 95 language standard and does not rely on any specific language or 
     219\NEMO\ software adheres to the \fninety language standard and does not rely on any specific language or 
    283220vendor extensions. 
    284221 
    285  
    286 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
    287222\subsection{Free-Form Source} 
    288223 
     
    292227Multi-line comments that extend to column 100 are unacceptable. 
    293228 
    294 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
    295229\subsection{Indentation} 
    296230 
     
    310244\end{forlines} 
    311245 
    312 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
    313246\subsection{Loops} 
    314247 
     
    317250In the case of a long loop, a self-descriptive label can be used ($i.e.$ not just a number). 
    318251 
    319 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
    320252\subsection{Naming Conventions: files} 
    321253 
     
    331263} 
    332264 
    333 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
    334265\subsection{Naming Conventions: modules} 
    335266 
     
    338269For example, zdftke, where ``zdf'' stands for vertical diffusion, and ``tke'' for turbulent kinetic energy. \\ 
    339270Note that by implication multiple modules are not allowed in a single file. 
    340 The use of common blocks is deprecated in Fortran 90 and their use in NEMO is strongly discouraged. 
     271The use of common blocks is deprecated in \fortran 90 and their use in \NEMO\ is strongly discouraged. 
    341272Modules are a better way to declare static data. 
    342273Among the advantages of modules is the ability to freely mix data of various types, and 
    343274to limit access to contained variables through the use of the \forcode{ONLY} and \forcode{PRIVATE} attributes. 
    344275 
    345 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
    346276\subsection{Naming Conventions: variables} 
    347277 
    348278All variable should be named as explicitly as possible in English. 
    349279The naming convention concerns prefix letters of these name, in order to identify the variable type and status. \\ 
    350 Never use a FORTRAN keyword as a routine or variable name. \\ 
     280Never use a \fortran keyword as a routine or variable name. \\ 
    351281The table below lists the starting letter(s) to be used for variable naming, depending on their type and status: 
    352282%--------------------------------------------------TABLE-------------------------------------------------- 
     
    355285    \begin{tabular}{|p{50pt}|p{50pt}|p{50pt}|p{50pt}|p{50pt}|p{50pt}|p{50pt}|} 
    356286      \hline 
    357       Type \par / Status &   integer&   real&   logical &   character&   double \par precision&   complex \\ 
     287      Type \par / Status                                                                          & 
     288      integer                                                                                     & 
     289      real                                                                                        & 
     290      logical                                                                                     & 
     291      character                                                                                   & 
     292      double \par precision                                                                       & 
     293      complex                                                                                     \\ 
    358294      \hline 
    359       public  \par or  \par module variable& \textbf{m n} \par \textit{but not } \par \textbf{nn\_}& \textbf{a b e f g h o} \textbf{q} \textit{to} \textbf{x} \par but not \par \textbf{fs rn\_}& \textbf{l} \par \textit{but not} \par \textbf{lp ld ll ln\_}& \textbf{c} \par \textit{but not} \par \textbf{cp cd cl cn\_}& \textbf{d} \par \textit{but not} \par \textbf{dp dd dl dn\_}& \textbf{y} \par \textit{but not} \par \textbf{yp yd yl} \\ 
     295      public \par or \par module variable                                                         & 
     296      \textbf{m n} \par \textit{but not} \par \textbf{nn\_}                                       & 
     297      \textbf{a b e f g h o} \textbf{q} \textit{to} \textbf{x} \par but not \par \textbf{fs rn\_} & 
     298      \textbf{l} \par \textit{but not} \par \textbf{lp ld ll ln\_}                                & 
     299      \textbf{c} \par \textit{but not} \par \textbf{cp cd cl cn\_}                                & 
     300      \textbf{d} \par \textit{but not} \par \textbf{dp dd dl dn\_}                                & 
     301      \textbf{y} \par \textit{but not} \par \textbf{yp yd yl}                                     \\ 
    360302      \hline 
    361       dummy \par argument& \textbf{k} \par \textit{but not} \par \textbf{kf}& \textbf{p} \par \textit{but not}  \par \textbf{pp pf}& \textbf{ld}& \textbf{cd}& \textbf{dd}& \textbf{yd} \\ 
     303      dummy \par argument                                                                         & 
     304      \textbf{k} \par \textit{but not} \par \textbf{kf}                                           & 
     305      \textbf{p} \par \textit{but not} \par \textbf{pp pf}                                        & 
     306      \textbf{ld}                                                                                 & 
     307      \textbf{cd}                                                                                 & 
     308      \textbf{dd}                                                                                 & 
     309      \textbf{yd}                                                                                 \\ 
    362310      \hline 
    363       local \par variable& \textbf{i}& \textbf{z}& \textbf{ll}& \textbf{cl}& \textbf{cd}& \textbf{yl} \\ 
     311      local \par variable                                                                         & 
     312      \textbf{i}                                                                                  & 
     313      \textbf{z}                                                                                  & 
     314      \textbf{ll}                                                                                 & 
     315      \textbf{cl}                                                                                 & 
     316      \textbf{cd}                                                                                 & 
     317      \textbf{yl}                                                                                 \\ 
    364318      \hline 
    365       loop \par control& \textbf{j} \par \textit{but not } \par \textbf{jp}& & & & &  \\ 
     319      loop \par control                                                                           & 
     320      \textbf{j} \par \textit{but not} \par \textbf{jp}                                           & 
     321                                                                                                  & 
     322                                                                                                  & 
     323                                                                                                  & 
     324                                                                                                  & 
     325                                                                                                  \\ 
    366326      \hline 
    367       parameter& \textbf{jp}& \textbf{pp}& \textbf{lp}& \textbf{cp}& \textbf{dp}& \textbf{yp} \\ 
     327      parameter                                                                                   & 
     328      \textbf{jp}                                                                                 & 
     329      \textbf{pp}                                                                                 & 
     330      \textbf{lp}                                                                                 & 
     331      \textbf{cp}                                                                                 & 
     332      \textbf{dp}                                                                                 & 
     333      \textbf{yp}                                                                                 \\ 
    368334      \hline 
    369       namelist& \textbf{nn\_}& \textbf{rn\_}& \textbf{ln\_}& \textbf{cn\_}& \textbf{dn\_}& \\ 
     335      namelist                                                                                    & 
     336      \textbf{nn\_}                                                                               & 
     337      \textbf{rn\_}                                                                               & 
     338      \textbf{ln\_}                                                                               & 
     339      \textbf{cn\_}                                                                               & 
     340      \textbf{dn\_}                                                                               & 
     341                                                                                                  \\ 
    370342      \hline 
    371       CPP \par macro& \textbf{kf}& \textbf{sf} \par & & & & \\ 
     343      CPP \par macro                                                                              & 
     344      \textbf{kf}                                                                                 & 
     345      \textbf{sf}                                                                                 & 
     346                                                                                                  & 
     347                                                                                                  & 
     348                                                                                                  & 
     349                                                                                                  \\ 
    372350      \hline 
    373351    \end{tabular} 
     
    377355%-------------------------------------------------------------------------------------------------------------- 
    378356 
    379 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
    380357\subsection{Operators} 
    381358 
     
    385362In general use the notation: \\ 
    386363$<Blank><Operator><Blank>$ 
    387 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
     364 
    388365\subsection{Pre processor} 
    389366 
     
    412389Is to be used rather than the \#ifdef abbreviate form since it may have conflicts with some Unix scripts. 
    413390 
    414 Tests on cpp keys included in NEMO at compilation step: 
     391Tests on cpp keys included in \NEMO\ at compilation step: 
    415392 
    416393\begin{itemize} 
     
    421398  If a change occurs in the CPP keys used for a given experiment, the whole compilation phase is done again. 
    422399\end{itemize} 
    423 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
     400 
    424401\section{Content rules} 
    425402 
    426 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
    427403\subsection{Configurations} 
    428404 
    429 The configuration defines the domain and the grid on which NEMO is running. 
    430 It may be useful to associate a cpp key and some variables to a given configuration, although 
     405The configuration defines the domain and the grid on which \NEMO\ is running. 
     406It may be useful to associate a CPP key and some variables to a given configuration, although 
    431407the part of the code changed under each of those keys should be minimized. 
    432408As an example, the "ORCA2" configuration (global ocean, 2 degrees grid size) is associated with 
     
    438414\end{forlines} 
    439415 
    440 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
    441416\subsection{Constants} 
    442417 
    443 Physical constants ($e.g.$ $\pi$, gas constants) must never be hardwired into the executable portion of a code. 
     418Physical constants ($e.g.$ $\pi$, gas constants) must never be hard-wired into the executable portion of a code. 
    444419Instead, a mnemonically named variable or parameter should be set to the appropriate value, 
    445 in the setup routine for the package\index{package}. 
     420in the setup routine for the package. 
    446421We realize than many parameterizations rely on empirically derived constants or fudge factors, 
    447422which are not easy to name. 
     
    450425Hard-coded numbers should never be passed through argument lists. 
    451426 
    452 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
    453427\subsection{Declaration for variables and constants} 
    454428 
     
    512486improve control of variables in routine calls. 
    513487 
    514 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
    515488\subsection{Headers} 
    516489 
    517 Prologues are not used in NEMO for now, although it may become an interesting tool in combination with 
     490Prologues are not used in \NEMO\ for now, although it may become an interesting tool in combination with 
    518491ProTeX auto documentation script in the future. 
    519492Rules to code the headers and layout of a module or a routine are illustrated in the example module available with 
    520493the code: \path{./src/OCE/module_example} 
    521494 
    522 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
    523495\subsection{Interface blocks} 
    524496 
     
    528500FORTRAN 95 compilers can automatically provide explicit interface blocks for routines contained in a module. 
    529501 
    530 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
    531502\subsection{I/O Error Conditions} 
    532503 
     
    536507a negative value means the end of record or end of file was encountered. 
    537508 
    538 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
    539509\subsection{PRINT - ASCII output files} 
    540510 
     
    551521\end{forlines} 
    552522 
    553 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
    554523\subsection{Precision} 
    555524 
     
    570539\end{forlines} 
    571540 
    572 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
    573541\subsection{Structures} 
    574542 
    575 The \forcode{TYPE} structure allowing to declare some variables is more often used in NEMO, 
     543The \forcode{TYPE} structure allowing to declare some variables is more often used in \NEMO, 
    576544especially in the modules dealing with reading fields, or interfaces. 
    577545For example: 
     
    592560Missing rule on structure name?? 
    593561 
    594 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
    595562\section{Packages coding rules} 
    596563 
    597 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
    598564\subsection{Bounds checking} 
    599565 
    600 NEMO is able to run when an array bounds checking option is enabled 
     566\NEMO\ is able to run when an array bounds checking option is enabled 
    601567(provided the cpp key \texttt{key\_vectopt\_loop} is not defined). \\ 
    602568Thus, constructs of the following form are disallowed: 
     
    610576it effectively disables array bounds checking. 
    611577 
    612 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
    613578\subsection{Communication} 
    614579 
     
    624589} 
    625590 
    626 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
    627591\subsection{Error conditions} 
    628592 
     
    634598see \textit{stpctl.F90}. 
    635599 
    636 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
    637600\subsection{Memory management} 
    638601 
    639602The main action is to identify and declare which arrays are \forcode{PUBLIC} and which are \forcode{PRIVATE}. \\ 
    640 As of version 3.3.1 of NEMO, the use of static arrays (size fixed at compile time) has been deprecated. 
     603As of version 3.3.1 of \NEMO, the use of static arrays (size fixed at compile time) has been deprecated. 
    641604All module arrays are now declared \forcode{ALLOCATABLE} and 
    642605allocated in either the \texttt{<module\_name>\_alloc()} or \texttt{<module\_name>\_init()} routines. 
     
    644607the \texttt{stat=<integer\ variable>} optional argument. \\ 
    645608 
    646 In addition to arrays contained within modules, many routines in NEMO require local, ``workspace'' arrays to 
     609In addition to arrays contained within modules, many routines in \NEMO\ require local, ``workspace'' arrays to 
    647610hold the intermediate results of calculations. 
    648 In previous versions of NEMO, these arrays were declared in such a way as to be automatically allocated on 
     611In previous versions of \NEMO, these arrays were declared in such a way as to be automatically allocated on 
    649612the stack when the routine was called. 
    650613An example of an automatic array is: 
     
    735698It is then associated with a sub-array of \texttt{wrk\_3d\_5} once the call to 
    736699\texttt{wrk\_in\_use()} has completed successfully. 
    737 Note that in F95 (to which NEMO conforms) it is not possible for either the upper or lower array bounds of 
     700Note that in F95 (to which \NEMO\ conforms) it is not possible for either the upper or lower array bounds of 
    738701the pointer object to differ from those of the target array. \\ 
    739702 
     
    748711This should enable the developer to choose alternatives for use in the subroutine being worked on. \\ 
    749712 
    750 When compiling NEMO for production runs, 
     713When compiling \NEMO\ for production runs, 
    751714the calls to {\texttt{wrk\_in\_use()} / \texttt{wrk\_not\_released()} can be reduced to stubs that just 
    752715return \forcode{.false.} by setting the cpp key \texttt{key\_no\_workspace\_check}. 
    753 These stubs may then be inlined (and thus effectively removed altogether) by setting appropriate compiler flags 
     716These stubs may then be in-lined (and thus effectively removed altogether) by setting appropriate compiler flags 
    754717($e.g.$ ``-finline'' for the Intel compiler or ``-Q'' for the IBM compiler). 
    755718 
    756 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
    757719\subsection{Optimisation} 
    758720 
    759721Considering the new computer architecture, optimisation cannot be considered independently from the computer type. 
    760 In NEMO, portability is a priority, before any too specific optimisation. 
     722In \NEMO, portability is a priority, before any too specific optimisation. 
    761723 
    762724Some tools are available to help: for vector computers, \texttt{key\_vectopt\_loop} allows to unroll a loop 
    763725 
    764 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
    765726\subsection{Package attribute: \forcode{PRIVATE}, \forcode{PUBLIC}, \forcode{USE}, \forcode{ONLY}} 
    766727 
     
    770731defined in a module are to be made available to the using routine. 
    771732 
    772 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
    773 \subsection {Parallelism using MPI} 
    774  
    775 NEMO is written in order to be able to run on one processor, or on one or more using MPI 
     733\subsection{Parallelism using MPI} 
     734 
     735\NEMO\ is written in order to be able to run on one processor, or on one or more using MPI 
    776736($i.e.$ activating the cpp key $key\_mpp\_mpi$). 
    777 The domain decomposition divides the global domain in cubes (see NEMO reference manual). 
     737The domain decomposition divides the global domain in cubes (see \NEMO\ reference manual). 
    778738Whilst coding a new development, the MPI compatibility has to be taken in account 
    779739(see \path{./src/LBC/lib_mpp.F90}) and should be tested. 
    780740By default, the $x$-$z$ part of the decomposition is chosen to be as square as possible. 
    781 However, this may be overriden by specifying the number of subdomains in latitude and longitude in 
     741However, this may be overriden by specifying the number of sub-domains in latitude and longitude in 
    782742the \texttt{nammpp} section of the namelist file. 
    783743 
    784 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
    785744\section{Features to be avoided} 
    786745 
     
    790749Below is a list of features to avoid: 
    791750\begin{itemize} 
    792 \item 
    793   \forcode{COMMON} block 
     751\item \forcode{COMMON} block 
    794752  (use the declaration part of \forcode{MODULE} instead) 
    795 \item 
    796   \forcode{EQUIVALENCE} 
     753\item \forcode{EQUIVALENCE} 
    797754  (use \forcode{POINTER} or derived data type instead to form data structure) 
    798 \item 
    799   Assigned and computed \forcode{GOTO} 
     755\item Assigned and computed \forcode{GOTO} 
    800756  (use the \forcode{CASE} construct instead) 
    801 \item 
    802   Arithmetic \forcode{IF} statement 
     757\item Arithmetic \forcode{IF} statement 
    803758  (use the block \forcode{IF}, \forcode{ELSE}, \forcode{ELSEIF}, \forcode{ENDIF} or 
    804759  \forcode{SELECT CASE} construct instead) 
    805 \item 
    806   Labeled \forcode{DO} construct 
    807   (use unlabeled \forcode{END DO} instead) 
    808 \item 
    809   \forcode{FORMAT} statement 
     760\item Labelled \forcode{DO} construct 
     761  (use unlabelled \forcode{END DO} instead) 
     762\item \forcode{FORMAT} statement 
    810763  (use character parameters or 
    811764  explicit format- specifiers inside the \forcode{READ} or \forcode{WRITE} statement instead) 
    812 \item 
    813   \forcode{GOTO} and \forcode{CONTINUE} statements 
     765\item \forcode{GOTO} and \forcode{CONTINUE} statements 
    814766  (use \forcode{IF}, \forcode{CASE}, \forcode{DO WHILE}, \forcode{EXIT} or \forcode{CYCLE} statements or 
    815767  a contained ?) 
    816 \item 
    817   \forcode{PAUSE} 
    818 \item 
    819   \forcode{ENTRY} statement: a subprogram must only have one entry point. 
    820 \item 
    821   \forcode{RETURN} is obsolete and so not necessary at the end of program units 
    822 \item 
    823   \forcode{FUNCTION} statement 
    824 \item 
    825   Avoid functions with side effects. 
     768\item \forcode{PAUSE} 
     769\item \forcode{ENTRY} statement: a sub-program must only have one entry point. 
     770\item \forcode{RETURN} is obsolete and so not necessary at the end of program units 
     771\item \forcode{FUNCTION} statement 
     772\item Avoid functions with side effects. 
    826773  \footnote{ 
    827774    First, the code is easier to understand, if you can rely on 
     
    832779    This is especially important on massive parallel and as well on vector machines. 
    833780  } 
    834 \item 
    835   \forcode{DATA} and \forcode{BLOCK DATA} 
     781\item \forcode{DATA} and \forcode{BLOCK DATA} 
    836782  (use initialisers) 
    837783\end{itemize} 
    838784 
    839 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
    840  
    841 % \printindex 
    842 % \input NEMO_coding.conv.ind 
    843  
    844 %\end{document} 
     785%% Imported from introduction 
     786%%gm    To be put somewhere else .... 
     787%%nm    We should consider creating a glossary for all this kind of stuff (terms, acronyms and symbols) 
     788%%      http://en.wikibooks.org/wiki/LaTeX/Glossary 
     789%\noindent CPP keys and namelists are used as inputs to the code. 
     790 
     791%\noindent \index{CPP keys} CPP keys 
     792 
     793%Some CPP keys are implemented in the \fortran code to allow code selection at compiling step. 
     794%This selection of code at compilation time reduces the reliability of the whole platform since 
     795%it changes the code from one set of CPP keys to the other. 
     796%It is used only when the addition/suppression of the part of code highly changes the amount of memory at run time. 
     797%Usual coding looks like: 
     798 
     799%\begin{forlines} 
     800%#if defined key_option1 
     801%  ! This part of the \fortran code will be active 
     802%  ! only if key_option1 is activated at compiling step 
     803%#endif 
     804%\end{forlines} 
     805 
     806%\noindent \index{Namelist} Namelists 
     807 
     808%The namelist allows to input variables (character, logical, real and integer) into the code. 
     809%There is one namelist file for each component of \NEMO\ (dynamics, sea-ice, biogeochemistry...) 
     810%containing all the \fortran namelists needed. 
     811%The implementation in \NEMO\ uses a 2-step process. 
     812%For each \fortran namelist, two files are read: 
     813 
     814%\begin{enumerate} 
     815%\item 
     816%  A reference namelist (in \path{./cfgs/SHARED/namelist_ref}) is read first. 
     817%  This file contains all the namelist variables which are initialised to default values 
     818%\item 
     819%  A configuration namelist (in \path{./cfgs/CFG_NAME/EXP00/namelist_cfg}) is read aferwards. 
     820%  This file contains only the namelist variables which are changed from default values, and overwrites those. 
     821%\end{enumerate} 
     822%A template can be found in \path{NEMO/OPA_SRC/module.example}. 
     823%The effective namelist, taken in account during the run, is stored at execution time in 
     824%an \texttt{output\_namelist\_dyn} (or \texttt{\_ice} or \texttt{\_top}) file. 
     825%%gm  end 
     826 
     827%%nm: Add some words on the \NEMO\ dependencies 
     828%The model is implemented in \fninety, with preprocessing (C pre-processor). 
     829%It runs under UNIX. 
     830%It is optimized for vector computers and parallelised by domain decomposition with MPI. 
     831%All input and output is done in NetCDF (Network Common Data Format) with a optional direct access format for output. 
     832%To ensure the clarity and readability of the code it is necessary to follow coding rules. 
     833%The coding rules for OPA include conventions for naming variables, 
     834%with different starting letters for different types of variables (real, integer, parameter\ldots). 
     835%Those rules are briefly presented in \autoref{apdx:coding} and a more complete document is available . 
     836 
     837%The model is organized with a high internal modularity based on physics. 
     838%For example, each trend (\ie, a term in the RHS of the prognostic equation) for momentum and tracers 
     839%is computed in a dedicated module. 
     840%To make it easier for the user to find his way around the code, the module names follow a three-letter rule. 
     841%For example, \mdl{traldf} is a module related to the TRAcers equation, computing the Lateral DiFfussion. 
     842%The complete list of module names is presented in \autoref{apdx:coding}.      %====>>>> to be done ! 
     843%Furthermore, modules are organized in a few directories that correspond to their category, 
     844%as indicated by the first three letters of their name (\autoref{tab:chapters}). 
Note: See TracChangeset for help on using the changeset viewer.