Index: /trunk/DOC/NEMO_coding.conv.tex
===================================================================
--- /trunk/DOC/NEMO_coding.conv.tex	(revision 2696)
+++ /trunk/DOC/NEMO_coding.conv.tex	(revision 2697)
@@ -31,5 +31,5 @@
 
 \title{ 
-\includegraphics[width=0.3\textwidth]{./TexFiles/FIgures/NEMO_logo_Black.pdf} \\
+\includegraphics[width=0.3\textwidth]{./TexFiles/Figures/NEMO_logo_Black.pdf} \\
 \vspace{1.0cm}
 \rule{345pt}{1.5pt} \\
@@ -54,6 +54,6 @@
 This document describes conventions\index{conventions} used in NEMO coding and suggested for its development. The objectives are to offer a guide to all readers of the NEMO code, and to facilitate the work of all the developers, including the validation of their developments, and eventually the implementation of these developments within the NEMO platform. \\
 A first approach of these rules can be found in the code in $NEMO/OPA\_SRC/module\_example$ where all the basics coding conventions are illustrated. More details can be found below.\\
-This work is based on the coding conventions is use for the Community Climate System Model \footnote { http://www.cesm.ucar.edu/working\_groups/Software/dev\_guide/dev\_guide/node7.html }
- the previous version of this document (ÒFORTRAN coding standard in the OPA SystemÓ) and the expertise of the NEMO System Team which can be contacted for further information ($nemo\_st@locean-ipsl.upmc.fr$)
+This work is based on the coding conventions in use for the Community Climate System Model, \footnote { http://www.cesm.ucar.edu/working\_groups/Software/dev\_guide/dev\_guide/node7.html }
+ the previous version of this document (``FORTRAN coding standard in the OPA System'') and the expertise of the NEMO System Team which can be contacted for further information ($nemo\_st@locean-ipsl.upmc.fr$)
 After a general overview below, this document will describe :
 \begin{itemize} 
@@ -65,12 +65,12 @@
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \section{Overview and general conventions}
-NEMO has different component: ocean dynamics ($OPA\_SRC$), sea-ice ($LIM\_SRC$), ocean biogeochemistry\- ($TOP\_SRC$), linear-tangent and adjoint of the dynamics ($TAM$)É each of them corresponding to a directory.
+NEMO has several different components: ocean dynamics ($OPA\_SRC$), sea-ice ($LIM\_SRC$), ocean biogeochemistry\- ($TOP\_SRC$), linear-tangent and adjoint of the dynamics ($TAM$)É each of them corresponding to a directory.
 In each directory, one will find some FORTRAN files and/or subdirectories, one per functionality of the code: $BDY$ (boundaries), $DIA$ (diagnostics), $DOM$ (domain), $DYN$ (dynamics), $LDF$ (lateral diffusion), etc...\\
 All name are chosen to be as self-explanatory as possible, in English, all prefixes are 3 digits.\\
 English is used for all variables names, comments, and documentation. \\
-Physical units are MKS. Only exception for the temperature, which is expressed in degree Celsius, except in bulk formulae and part of LIM sea-ice model where it is in Kelvin. See $DOM/phycst.F90$ files for conversions.
+Physical units are MKS. The only exception to this is the temperature, which is expressed in degrees Celsius, except in bulk formulae and part of LIM sea-ice model where it is in Kelvin. See $DOM/phycst.F90$ files for conversions.
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \section{Architecture}
-Within each directory, organisation of files is driven by ÒorthogonalityÓ\index{orthogonality}, i.e. one functionality of the code is intented to be in one and only one directory, and one module and all its related routines are in one file.
+Within each directory, organisation of files is driven by ÒorthogonalityÓ\index{orthogonality}, i.e. one functionality of the code is intended to be in one and only one directory, and one module and all its related routines are in one file.
 The functional modules\index{module} are:
 \begin{itemize} 
@@ -90,5 +90,5 @@
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \subsection{Argument list format}
-Routines argument lists will contain a maximum 5 variables\index{variable} per line, whilst continuation lines can be used. 
+Routine argument lists will contain a maximum 5 variables\index{variable} per line, whilst continuation lines can be used. 
 This applies both to the calling routine and the dummy argument list in the routine being called. The purpose is to simplify matching up the arguments between caller and callee. 
 
@@ -112,5 +112,5 @@
    &                -   twodarray2(:,2:len2 ) ) 
 \end{verbatim}   
-For long, complicated loops, explicitly indexed loops should be preferred. In general when using this syntax, the order of the loops indices should reflect the following scheme: (best usage of data locality):
+For long, complicated loops, explicitly indexed loops should be preferred. In general when using this syntax, the order of the loops indices should reflect the following scheme (for best usage of data locality):
 \begin{verbatim}
 DO jk = 1, jpk 
@@ -124,5 +124,5 @@
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \subsection{Case}
-All FORTRAN keywords are in capital : \begin {verbatim} DIMENSION, WRITE, DO É END DO, NAMELIST \end{verbatim} 
+All FORTRAN keywords are in capital : \begin {verbatim} DIMENSION, WRITE, DO, END DO, NAMELIST \end{verbatim} 
 All other parts of the NEMO code will be written in lower case.	
 
@@ -132,6 +132,6 @@
 The full documentation and detailed explanations are to be added in the reference manual (TeX files, aside from the code itself). \\
 In the code, the comments should explain variable content and describe each computational step.\\
-Comments in the header start with Ò!!Ó. For more details on the content of the headers, see ÒContent rules/HeadersÓ in this document.\\
-Comments in the code start with "!".\\
+Comments in the header start with ``!!''. For more details on the content of the headers, see ÒContent rules/HeadersÓ in this document.\\
+Comments in the code start with ``!''.\\
 All comments are indented (3, 6, or 9 É blank spaces).\\
 Short comments may be included on the same line as executable code, and an additional line can be used with proper alignment. For example: 
@@ -163,5 +163,5 @@
    &              * fse3uw_b(ji,jj,jk) )
 \end{verbatim}    
-Code lines, which are continuation lines of assignment statements, must begin to the right of the column of the assignment operator. Due to the possibility of automatic indentation in some editor (emacs for example), use a Ô\&Õ as first character of the continuing lines to maintain the alignment. 
+Code lines, which are continuation lines of assignment statements, must begin to the right of the column of the assignment operator. Due to the possibility of automatic indentation in some editor (emacs for example), use a ``\&'' as first character of the continuing lines to maintain the alignment. 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \subsection{Declaration of arguments and local variables}
@@ -173,10 +173,10 @@
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \subsection{F90 Standard}
-NEMO software adheres to the FORTRAN 95 language standard and does not rely on any specific language or vendor extension.
+NEMO software adheres to the FORTRAN 95 language standard and does not rely on any specific language or vendor extensions.
 
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \subsection{Free-Form Source}
-Free-form source will be used. The F90/95 standard allows up to 132 characters, but a self-imposed limit of 80 should enhance readability, or print source files with two columns per page. Multi-line comments that extend to column 100 would be unacceptable.
+Free-form source will be used. The F90/95 standard allows lines of up to 132 characters, but a self-imposed limit of 80 should enhance readability, or print source files with two columns per page. Multi-line comments that extend to column 100 are unacceptable.
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -195,25 +195,23 @@
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \subsection{Loops}
-Loops, if explicit, should be structured with the do-end do construct as opposed to numbered loops. Nevertheless non-number label can be used for a big iterative loop of recursive algorithm. In case of long loop, a self-descriptive label can be used (i.e. not just a number).
+Loops, if explicit, should be structured with the do-end do construct as opposed to numbered loops. Nevertheless non-numeric labels can be used for a big iterative loop of a recursive algorithm. In the case of a long loop, a self-descriptive label can be used (i.e. not just a number).
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \subsection{Naming Conventions: files}
-A file containing a module will have the same name as the inside module.
+A file containing a module will have the same name as the module it contains (because dependency rules used by "make" programs are based on file names).
+\footnote{For example, if routine A "USE"s module B, then "make" must be told of the dependency relation which requires B to be compiled before A. If one can assume that module B resides in file B.o, building a tool to generate this dependency rule (e.g. A.o: B.o) is quite simple. Put another way, it is difficult (to say nothing of CPU-intensive) to search an entire source tree to find the file in which module B resides for each routine or module which "USE"s B.}
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \subsection{Naming Conventions: modules}
-Use meaningful English name and the Ò3 lettersÓ naming convention: first 3 metters for the code section, and last 3 to describe the module. For example, zdftke, where ÒzdfÓ stands for vertical diffusion, and ÒtkeÓ for turbulent kinetic energy.
-Modules must be called with the same name as the file in which they reside, because dependency rules used by "make" programs are based on file names
-\footnote{For example, if routine A "USE"s module B, then "make" must be told of the dependency relation which requires B to be compiled before A. If one can assume that module B resides in file B.o, building a tool to generate this dependency rule (e.g. A.o: B.o) is quite simple. Put another way, it is difficult (to say nothing of CPU-intensive) to search an entire source tree to find the file in which module B resides for each routine or module which "USE"s B.}
- . 
+Use a meaningful English name and the ``3 letters'' naming convention: first 3 letters for the code section, and last 3 to describe the module. For example, zdftke, where ``zdf'' stands for vertical diffusion, and ``tke'' for turbulent kinetic energy. 
 \\
 Note that by implication multiple modules are not allowed in a single file. 
-The use of common blocks is deprecated in Fortran 90 and their use in NEMO is strongly discouraged. Modules are a better way to declare static data. Among the advantages of modules is the ability to freely mix data of various types, and to limit access to contained variables through use of the ONLY and PRIVATE attributes. 
+The use of common blocks is deprecated in Fortran 90 and their use in NEMO is strongly discouraged. Modules are a better way to declare static data. Among the advantages of modules is the ability to freely mix data of various types, and to limit access to contained variables through the use of the ONLY and PRIVATE attributes. 
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \subsection{Naming Conventions: variables}
-All variable should be named as explicit as possible in English. The naming convention concerns prefix letters of these name, in  order to identify the variable type and status.\\
+All variable should be named as explicitly as possible in English. The naming convention concerns prefix letters of these name, in  order to identify the variable type and status.\\
 Never use a FORTRAN keyword as a routine or variable name. \\
-Table below lists the stating letter(s) to be used for variable naming, depending on their type and status:
+The table below lists the starting letter(s) to be used for variable naming, depending on their type and status:
 %--------------------------------------------------TABLE--------------------------------------------------
 \begin{table}[htbp]
@@ -293,8 +291,8 @@
 Where the use of a language pre-processor is required, it will be the C pre-processor (cpp).\\
 The cpp key is the main feature used, allowing to ignore some useless parts of the code at compilation step. \\
-The advantage is to reduce the memory use; the drawback is that compilation of this part of the code isnÕt checked. \\
-The cpp key feature should only be used for a few limited options, if is reduces the memory usage. In all cases, a logical variable and a FORTRAN $IF$ should be preferred.
+The advantage is to reduce the memory use; the drawback is that compilation of this part of the code isn't checked. \\
+The cpp key feature should only be used for a few limited options, if it reduces the memory usage. In all cases, a logical variable and a FORTRAN $IF$ should be preferred.
 When using a cpp key $key\_optionname$, a corresponding logical variable $lk\_optionname$ should be declared to allow FORTRAN $IF$ tests in the code and  a FORTRAN module with the same name (i.e. $optionname.F90$) should
- to be defined. This module is the only place where a \#if defined command appears, selecting either the whole FORTRAN code or a dummy module. For example, the TKE vertical physics, the module name is $zdftke.F90$, the CPP key is $key\_zdftke$ and the associated logical is $lk\_zdftke$. 
+ be defined. This module is the only place where a ``\#if defined'' command appears, selecting either the whole FORTRAN code or a dummy module. For example, the TKE vertical physics, the module name is $zdftke.F90$, the CPP key is $key\_zdftke$ and the associated logical is $lk\_zdftke$. 
 
 The following syntax:
@@ -316,5 +314,5 @@
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \subsection{Configurations}
-The configuration defines the domain and the grid on which NEMO is running. It may be usefull to associate a cpp key and some variables to a given configuration, although the part of the code changed under each of those keys should be minimized. As an example, the "ORCA2" configuration (global ocean, 2 degrees grid size) is associated with the cpp key $key\_orca2$ for which 
+The configuration defines the domain and the grid on which NEMO is running. It may be useful to associate a cpp key and some variables to a given configuration, although the part of the code changed under each of those keys should be minimized. As an example, the "ORCA2" configuration (global ocean, 2 degrees grid size) is associated with the cpp key $key\_orca2$ for which 
 \begin{verbatim} 
 cp_cfg = "orca"
@@ -332,11 +330,10 @@
 \begin{itemize}
 \item Usage of the DIMENSION statement or attribute is required in declaration statements
-\item Attribute SAVE is banned. This simplifies the use of AGRIF software. Since all the subroutine are embedded into a module, the variables which value have to be preserved between two calls can be declared in the module interface. 
-The Ò::Ó notation is quite useful to show that this program unit declaration part is  written in standard FORTRAN syntax, even if there are no attributes to clarify the  declaration section. Always use the notation <blank>:<three blanks> to improve readability. 
+\item The ``::'' notation is quite useful to show that this program unit declaration part is  written in standard FORTRAN syntax, even if there are no attributes to clarify the  declaration section. Always use the notation $<$blank$>$::$<$three blanks$>$ to improve readability. 
 \item Declare the length of a character variable using the CHARACTER (len=xxx) syntax
-\footnote { The len specifier is important because it is possible to have several kinds for characters  (e.g. Unicode using two bytes per character, or there might be a different kind for Japanese e.g.. NEC). }
+\footnote { The len specifier is important because it is possible to have several kinds for characters  (e.g. Unicode using two bytes per character, or there might be a different kind for Japanese e.g. NEC). }
 
 \item For all global data (in contrast to module data, that is all data that can be access by other module) must be accompanied with a comment field  on the same line. 
-\footnote {This allows a easy research of where and how a variable is declared using the unix command: Ògrep var *90 |grep !:Ó. }
+\footnote {This allows a easy research of where and how a variable is declared using the unix command: ``grep var *90 |grep !:''. }
 \\
 For example:
@@ -349,5 +346,5 @@
  All subroutines and functions will include an IMPLICIT NONE statement. 
 Thus all variables must be explicitly typed. It also allows the compiler to detect typographical errors in variable names. 
-For modules, one IMPLICIT NONE statement in the modules definition section is needed. 
+For modules, one IMPLICIT NONE statement in the modules definition section is needed. This also removes the need to have IMPLICIT NONE statements in any routines that are CONTAIN'd in the module.
 Improper data initialisation is another common source of errors. 
 \footnote{A variable could contain an initial value you did not expect. This can happen for several reasons, e.g. the variable has never been assigned a value, its value is outdated, memory has been allocated for a pointer but you have forgotten to initialise the variable pointed to.} 
@@ -364,5 +361,5 @@
 \subsection{Headers}
 Prologues are not used in NEMO for now, although it may become an interesting tool in combination with ProTeX auto documentation script in the future. 
-Rules to code the headers and layout of a module or a routine are illustrated in the example module available with the code : $NEMO/OPA\_SRC/module\_example$
+Rules to code the headers and layout of a module or a routine are illustrated in the example module available with the code : {\it NEMO/OPA\_SRC/module\_example}
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \subsection{Interface blocks}
@@ -385,9 +382,9 @@
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \subsection{Precision}
-Parameterizations should not rely on vendor-supplied flags to supply a default floating point precision or integer size. The f95$ KIND$ feature should be used instead. In order to improve portability between 32 and 64 bit platforms, it is necessary to make use of kinds by using a specific module ($OPA\_SRC/par\_kind.F90$)  declaring the "kind definitions" to obtain the required numerical precision and range as well as size of INTEGER. It should be noted that constants need to have attached a \_kindvalue to have the according size. \\
-Thus wp being the "working precision" as declared in $OPA\_SRC/par\_kind.F90$, declaring real array $zpc$ will take the form:
+Parameterizations should not rely on vendor-supplied flags to supply a default floating point precision or integer size. The F95$ KIND$ feature should be used instead. In order to improve portability between 32 and 64 bit platforms, it is necessary to make use of kinds by using a specific module ($OPA\_SRC/par\_kind.F90$)  declaring the "kind definitions" to obtain the required numerical precision and range as well as the size of INTEGER. It should be noted that numerical constants need to have a suffix of \_$kindvalue$ to have the according size. \\
+Thus $wp$ being the "working precision" as declared in $OPA\_SRC/par\_kind.F90$, declaring real array $zpc$ will take the form:
 \begin{verbatim}
       REAL(wp), DIMENSION(jpi,jpj,jpk) ::  zpc      ! power consumption
-       \end{verbatim}
+\end{verbatim}
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \subsection{Structures}
@@ -404,5 +401,5 @@
 
       TYPE(PTRACER) , DIMENSION(jptra) :: tracer
- \end{verbatim}
+\end{verbatim}
  
  Missing rule on structure name??
@@ -412,9 +409,9 @@
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \subsection{Bounds checking}
-NEMO is able to run when an array bounds checking option is enabled. \\
+NEMO is able to run when an array bounds checking option is enabled (provided the cpp key $key\_vectopt\_loop$ is not defined). \\
 Thus, constructs of the  following form are disallowed: 
 \begin{verbatim}
 REAL(wp) :: arr(1) 
- \end{verbatim}
+\end{verbatim}
 where "arr" is an input argument into which the user wishes to index beyond 1. Use of the (*) construct in array dimensioning  is forbidden also because it effectively disables array bounds checking.
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -429,10 +426,17 @@
 \subsection{Memory management}
 
-The main action is to identify and declare which arrays are PUBLIC and which are PRIVATE.\\
-Dynamic memory allocation should be avoided, unless necessary. Indeed, it may be desirable in some occasions. However, this type of memory allocation can reduce performance on some machines, and some debuggers may get confused when trying to diagnose the contents of such variables.  \\
-
-The preferable mechanism for dynamic memory allocation is automatic arrays, as opposed to $ALLOCATABLE$ or $POINTER$ arrays for which memory must be explicitly allocated and de-allocated.
-\footnote {$POINTER$ and $ALLOCATE$ are widely used in AGRIF, and in the routine reading input files.}
-An example of an automatic array is: 
+The main action is to identify and declare which arrays are PUBLIC and
+which are PRIVATE.\\ As of version 3.3.1 of NEMO, the use of static
+arrays (size fixed at compile time) has been deprecated.  All module
+arrays are now declared ALLOCATABLE and allocated in either the
+$<$module\_name$>$\_alloc() or $<$module\_name$>$\_init()
+routines. The success or otherwise of each ALLOCATE must be checked
+using the $Stat=<integer\ variable>$ optional argument.\\
+
+In addition to arrays contained within modules, many routines in NEMO
+require local, ``workspace'' arrays to hold the intermediate results
+of calculations. In previous versions of NEMO, these arrays were
+declared in such a way as to be automatically allocated on the stack
+when the routine was called.  An example of an automatic array is:
 \begin{verbatim}
 SUBROUTINE sub(n) 
@@ -441,14 +445,111 @@
 END SUBROUTINE sub 
 \end{verbatim}
-
-Whereas the same example with $ALLOCATE$ is:
-\begin{verbatim}
-SUBROUTINE sub(n) 
-   REAL, ALLOCATABLE :: a(:) 
-   ALLOCATE(a(n)) 
+The downside of this approach is that the program will crash if it
+runs out of stack space and the reason for the crash might not be
+obvious to the user.
+
+Therefore, as of version 3.3.1, the use of automatic arrays is
+deprecated. Instead, a new module, ``wrk\_nemo,'' has been introduced
+which contains 1-,2-,3- and 4-dimensional workspace arrays for use in
+subroutines. These workspace arrays should be used in preference to
+declaring new, local (allocatable) arrays whenever possible. The only
+exceptions to this are when workspace arrays with lower bounds other
+than 1 and/or with extent(s) greater than those in the {\it wrk\_nemo}
+module are required.\\
+
+The 2D, 3D and 4D workspace arrays in {\it wrk\_nemo} have extents
+$jpi$, $jpj$, $jpk$ and $jpts$ ($x$, $y$, $z$ and tracers) in the first,
+second, third and fourth dimensions, respectively. The 1D arrays are
+allocated with extent MAX($jpi\times jpj, jpk\times jpj, jpi\times
+jpk$).\\
+
+The REAL (KIND=$wp$) workspace arrays in {\it wrk\_nemo} are named
+e.g. $wrk\_1d\_1$, $wrk\_4d\_2$ etc. and should be accessed by USE'ing
+the {\it wrk\_nemo} module. Since these arrays are available to any
+routine, some care must be taken that a given workspace array is not
+already being used somewhere up the call stack. To help with this,
+{\it wrk\_nemo} also contains some utility routines; {\it
+  wrk\_in\_use()} and {\it wrk\_not\_released()}. The former first
+checks that the requested arrays are not already in use and then sets
+internal flags to show that they are now in use. The {\it
+  wrk\_not\_released()} routine un-sets those internal flags. A
+subroutine using this functionality for two, 3D workspace arrays named
+$zwrk1$ and $zwrk2$ will look something like:
+\begin{verbatim}
+SUBROUTINE sub()
+   USE wrk_nemo, ONLY: wrk_in_use, wrk_not_released 
+   USE wrk_nemo, ONLY: zwrk1 => wrk_3d_5, zwrk2 => wrk_3d_6
+   !
+   IF(wrk_in_use(3, 5,6)THEN
+      CALL ctl_stop('sub: requested workspace arrays unavailable.')
+      RETURN
+   END IF
    ... 
-   DEALLOCATE(a) ... 
+   ...
+   IF(wrk_not_released(3, 5,6)THEN
+      CALL ctl_stop('sub: failed to release workspace arrays.')
+   END IF
+   !
 END SUBROUTINE sub 
 \end{verbatim}
+The first argument to each of the utility routines is the
+dimensionality of the required workspace (1--4). Following this there
+must be one or more integers identifying which workspaces are to be
+used/released.
+Note that, in the interests of keeping the code as simple as possible,
+there is no use of POINTERs etc. in the {\it wrk\_nemo}
+module. Therefore it is the responsibility of the developer to ensure
+that the arguments to {\it wrk\_in\_use()} and {\it
+  wrk\_not\_released()} match the workspace arrays actually being used
+by the subroutine.\\
+
+If a workspace array is required that has extent(s) less than those of
+the arrays in the {\it wrk\_nemo} module then the advantages of
+implicit loops and bounds checking may be retained by defining a
+pointer to a sub-array as follows:
+\begin{verbatim}
+SUBROUTINE sub()
+   USE wrk_nemo, ONLY: wrk_in_use, wrk_not_released 
+   USE wrk_nemo, ONLY: wrk_3d_5
+   !
+   REAL(wp), DIMENSION(:,:,:), POINTER :: zwrk1
+   !
+   IF(wrk_in_use(3, 5)THEN
+      CALL ctl_stop('sub: requested workspace arrays unavailable.')
+      RETURN
+   END IF
+   !
+   zwrk1 => wrk_3d_5(1:10,1:10,1:10)
+   ... 
+END SUBROUTINE sub 
+\end{verbatim}
+Here, instead of ``use associating'' the variable $zwrk1$ with the
+array $wrk\_3d\_5$ (as in the first example), it is explicitly
+declared as a pointer to a 3D array. It is then associated with a
+sub-array of $wrk\_3d\_5$ once the call to {\it wrk\_in\_use()} has
+completed successfully. Note that in F95 (to which NEMO conforms) it
+is not possible for either the upper or lower array bounds of the
+pointer object to differ from those of the target array.\\
+
+In addition to the REAL (KIND=$wp$) workspace arrays, {\it wrk\_nemo}
+also contains 2D integer arrays and 2D REAL arrays with extent ($jpi$,
+$jpk$), {\it i.e.} $xz$. The utility routines for the integer
+workspaces are {\it iwrk\_in\_use()} and {\it iwrk\_not\_released()}
+while those for the $xz$ workspaces are {\it wrk\_in\_use\_xz()}
+and {\it wrk\_not\_released\_xz()}.
+
+Should a call to one of the {\it wrk\_in\_use()} family of utilities
+fail, an error message is printed along with a table showing which of
+the workspace arrays are currently in use. This should enable the
+developer to choose alternatives for use in the subroutine being
+worked on.\\
+
+When compiling NEMO for production runs, the calls to {\it
+  wrk\_in\_use()}/{\it wrk\_not\_released()} can be reduced to stubs
+that just return $.$FALSE$.$ by setting the cpp key
+{\it key\_no\_workspace\_check}. These stubs may then be inlined (and
+thus effectively removed altogether) by setting appropriate compiler
+flags (e.g. ``-finline'' for the Intel compiler or ``-Q'' for the IBM
+compiler).
 
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -464,13 +565,13 @@
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \subsection{Package attribute: $PRIVATE, PUBLIC, USE, ONLY$}
-Modules variables and routines should be encapsulated by using the PRIVATE attribute. What shall be used outside the module can be declared PUBLIC instead. Use USE with the ONLY attribute to specify which of the variables, type definitions etc. defined in a module are to be made available to the using routine. 
+Module variables and routines should be encapsulated by using the PRIVATE attribute. What shall be used outside the module can be declared PUBLIC instead. Use USE with the ONLY attribute to specify which of the variables, type definitions etc. defined in a module are to be made available to the using routine. 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \subsection {Parallelism: using MPI}
-NEMO is written in order to be able to run on one processor, or on one or more using MPI (i.e. activating the cpp key $key_mpp\_mpi$, and defining the number of subdomains in latitude and longitude. The domain decomposition divides the global domain in cubes (see NEMO reference manual). Whilst coding a new development, the MPI compatibility has to be taken in account (see $lib\_mpp.F90$) and should be tested.
+NEMO is written in order to be able to run on one processor, or on one or more using MPI (i.e. activating the cpp key $key\_mpp\_mpi$. The domain decomposition divides the global domain in cubes (see NEMO reference manual). Whilst coding a new development, the MPI compatibility has to be taken in account (see $LBC/lib\_mpp.F90$) and should be tested. By default, the $x$-$z$ part of the decomposition is chosen to be as square as possible. However, this may be overriden by specifying the number of subdomains in latitude and longitude in the nammpp section of the namelist file.
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \section{Features to be avoided}
 
-The code must follow the current standards of FORTRAN and ANSI C.  In particular, the code should not produce any WARNING at compiling phase, so that user can be easily alerted of potential bugs when some appear in their new developments. ). 
+The code must follow the current standards of FORTRAN and ANSI C.  In particular, the code should not produce any WARNING at compiling phase, so that users can be easily alerted of potential bugs when some appear in their new developments. ). 
 Below is a list of features to avoid:
 \begin{itemize}
