Index: branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zbio.F
===================================================================
--- branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zbio.F	(revision 773)
+++ 	(revision )
@@ -1,438 +1,0 @@
-
-CCC $Header$ 
-CCC  TOP 1.0 , LOCEAN-IPSL (2005) 
-C This software is governed by CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
-C ---------------------------------------------------------------------------
-      SUBROUTINE p4zbio
-CDIR$ LIST
-#if defined key_top && defined key_pisces
-CCC   ------------------------------------------------------------------
-CCC   
-CCC   ROUTINE p4zbio : PISCES MODEL
-CCC   *****************************
-CCC   
-CC
-CC     PURPOSE.
-CC     --------
-CC          *P4ZBIO* ECOSYSTEM MODEL IN THE WHOLE OCEAN
-CC                   THIS ROUTINE COMPUTES THE DIFFERENT INTERACTIONS
-CC                   BETWEEN THE DIFFERENT COMPARTMENTS OF THE MODEL
-CC     EXTERNAL :
-CC     ----------
-CC          p4zopt, p4zprod, p4znano, p4zdiat, p4zmicro, p4zmeso
-CC          p4zsink, p4zrem
-CC
-CC   MODIFICATIONS:
-CC   --------------
-CC      original      : 2004    O. Aumont
-CC ----------------------------------------------------------------
-CC parameters and commons
-CC ======================
-CDIR$ NOLIST
-      USE oce_trc
-      USE trp_trc
-      USE sms
-      IMPLICIT NONE
-#include "domzgr_substitute.h90"
-CDIR$ LIST
-CC-----------------------------------------------------------------
-CC local declarations
-CC ==================
-C     
-      INTEGER ji, jj, jk, jn
-
-      REAL zdenom,zdenom1(jpi,jpj,jpk)
-      REAL prodca,ztemp
-
-#if ! defined key_kriest
-      REAL zdenom2(jpi,jpj,jpk)
-#else
-      REAL znumpoc, znumdoc
-#endif
-C     
-      REAL prodt
-      REAL zfracal(jpi,jpj,jpk)
-C
-C     ASSIGN THE SHEAR RATE THAT IS USED FOR AGGREGATION
-C     OF PHYTOPLANKTON AND DETRITUS
-C
-       zdiss(:,:,:) = 0.01
-C
-      DO jk=1,jpkm1
-        DO jj=1,jpj
-          DO ji=1,jpi
-       if (fsdepw(ji,jj,jk+1).le.hmld(ji,jj)) zdiss(ji,jj,jk)=1.
-          END DO 
-        END DO
-      END DO
-C
-C      Compute de different ratios for scavenging of iron
-C      --------------------------------------------------
-C
-       DO jk=1,jpk
-         DO jj=1,jpj
-           DO ji=1,jpi
-#if ! defined key_kriest
-         zdenom=1./(trn(ji,jj,jk,jppoc)+trn(ji,jj,jk,jpgoc)
-     $     +trn(ji,jj,jk,jpdsi)+trn(ji,jj,jk,jpcal)+rtrn)
-C
-         zdenom1(ji,jj,jk)=trn(ji,jj,jk,jppoc)*zdenom
-         zdenom2(ji,jj,jk)=trn(ji,jj,jk,jpgoc)*zdenom
-
-#else
-         zdenom=1./(trn(ji,jj,jk,jppoc)
-     $     +trn(ji,jj,jk,jpdsi)+trn(ji,jj,jk,jpcal)+rtrn)
-         zdenom1(ji,jj,jk)=trn(ji,jj,jk,jppoc)*zdenom
-
-#endif
-           END DO
-         END DO
-       END DO
-C
-C     Compute the fraction of nanophytoplankton that is made
-C     of calcifiers
-C     ------------------------------------------------------
-C
-       DO jk=1,jpkm1
-         DO jj=1,jpj
-           DO ji=1,jpi
-       ztemp=max(0.,tn(ji,jj,jk))
-       zfracal(ji,jj,jk)=caco3r*xlimphy(ji,jj,jk)*max(0.0001
-     &   ,ztemp/(2.+ztemp))*max(1.,trn(ji,jj,jk,jpphy)*1E6/2.)
-       zfracal(ji,jj,jk)=min(0.8,zfracal(ji,jj,jk))
-       zfracal(ji,jj,jk)=max(0.01,zfracal(ji,jj,jk))
-           END DO
-         END DO
-       END DO
-
-C
-C     Call subroutine for computation of the vertical flux
-C     of particulate organic matter
-C     ----------------------------------------------------
-C
-      CALL p4zsink
-
-C
-C  Call optical routine to compute the PAR in the water column
-C  -----------------------------------------------------------
-C
-      CALL p4zopt
-C
-C  Call routine to compute the co-limitations by the various
-C  nutrients
-C  ---------------------------------------------------------
-C
-      CALL p4zlim
-C
-C  Call production routine to compute phytoplankton growth rate
-C  over the global ocean. Growth rates for each element is 
-C  computed (C, Si, Fe, Chl)
-C  ------------------------------------------------------------
-C
-      CALL p4zprod
-C
-C  Call phytoplankton mortality routines. Mortality losses for 
-C  Each elements are computed (C, Fe, Si, Chl)
-C  -----------------------------------------------------------
-C
-      CALL p4znano
-      CALL p4zdiat
-C
-C  Call zooplankton sources/sinks routines. 
-C  Each elements are computed (C, Fe, Si, Chl)
-C  -----------------------------------------------------------
-C
-      CALL p4zmicro
-      CALL p4zmeso
-
-C 
-C     Call subroutine for computation of remineralization
-C     terms of organic matter+scavenging of Fe
-C     ----------------------------------------------------
-      CALL p4zrem
-C     
-C     Determination of tracers concentration as a function of 
-C     biological sources and sinks
-C     --------------------------------------------------------
-C     
-      DO jk = 1,jpkm1
-        DO jj = 1,jpj
-          DO ji = 1,jpi
-C     
-C     Evolution of PO4
-C     ----------------
-C     
-          trn(ji,jj,jk,jppo4) = trn(ji,jj,jk,jppo4)
-     &      -prorca(ji,jj,jk)-prorca2(ji,jj,jk)
-     &      +olimi(ji,jj,jk)+grarem(ji,jj,jk)*sigma1+denitr(ji,jj,jk)
-     &      +grarem2(ji,jj,jk)*sigma2
-C
-C     Evolution of NO3 and NH4
-C     ------------------------
-C
-          trn(ji,jj,jk,jpno3) = trn(ji,jj,jk,jpno3)
-     &      -pronew(ji,jj,jk)-pronew2(ji,jj,jk)+onitr(ji,jj,jk)
-     &      -denitr(ji,jj,jk)*rdenit
-
-          trn(ji,jj,jk,jpnh4) = trn(ji,jj,jk,jpnh4)
-     &      -proreg(ji,jj,jk)-proreg2(ji,jj,jk)+olimi(ji,jj,jk)
-     &      +grarem(ji,jj,jk)*sigma1+grarem2(ji,jj,jk)*sigma2
-     &      -onitr(ji,jj,jk)+denitr(ji,jj,jk)
-
-          END DO
-        END DO
-      END DO
-
-      DO jk = 1,jpkm1
-        DO jj = 1,jpj
-          DO ji = 1,jpi
-
-C    
-C     Evolution of Phytoplankton
-C     --------------------------
-C     
-          trn(ji,jj,jk,jpphy) = trn(ji,jj,jk,jpphy)
-     &      +prorca(ji,jj,jk)*(1.-excret)-tortp(ji,jj,jk)
-     &      -grazp(ji,jj,jk)-grazn(ji,jj,jk)-respp(ji,jj,jk)
-
-          trn(ji,jj,jk,jpnch) = trn(ji,jj,jk,jpnch)
-     &      +prorca6(ji,jj,jk)*(1.-excret)-tortnch(ji,jj,jk)
-     &      -grazpch(ji,jj,jk)-graznch(ji,jj,jk)-respnch(ji,jj,jk)
-C
-C     Evolution of Diatoms
-C     ------------------
-C
-          trn(ji,jj,jk,jpdia) = trn(ji,jj,jk,jpdia)
-     &      +prorca2(ji,jj,jk)*(1.-excret2)-tortp2(ji,jj,jk)
-     &      -respp2(ji,jj,jk)-grazd(ji,jj,jk)-grazsd(ji,jj,jk)
-
-          trn(ji,jj,jk,jpdch) = trn(ji,jj,jk,jpdch)
-     &      +prorca7(ji,jj,jk)*(1.-excret2)-tortdch(ji,jj,jk)
-     &      -respdch(ji,jj,jk)-grazdch(ji,jj,jk)-grazsch(ji,jj,jk)
-          END DO
-        END DO
-      END DO
-
-      DO jk = 1,jpkm1
-        DO jj = 1,jpj
-          DO ji = 1,jpi
-C    
-C     Evolution of Zooplankton
-C     ------------------------
-C     
-          trn(ji,jj,jk,jpzoo) = trn(ji,jj,jk,jpzoo)
-     &      +epsher*(grazp(ji,jj,jk)+grazm(ji,jj,jk)+grazsd(ji,jj,jk))
-     &      -grazz(ji,jj,jk)-tortz(ji,jj,jk)-respz(ji,jj,jk)
-C
-C     Evolution of Mesozooplankton
-C     ------------------------
-C
-          trn(ji,jj,jk,jpmes) = trn(ji,jj,jk,jpmes)
-     &      +epsher2*(grazd(ji,jj,jk)+grazz(ji,jj,jk)+grazn(ji,jj,jk)
-     &      +grazpoc(ji,jj,jk)+grazffe(ji,jj,jk))-tortz2(ji,jj,jk)
-     &      -respz2(ji,jj,jk)
-          END DO
-        END DO
-      END DO
-
-
-      DO jk = 1,jpkm1
-        DO jj = 1,jpj
-          DO ji = 1,jpi
-C    
-C     Evolution of O2
-C     ---------------
-C     
-         trn(ji,jj,jk,jpoxy) = trn(ji,jj,jk,jpoxy)
-     &     +o2ut*(proreg(ji,jj,jk)+proreg2(ji,jj,jk)-olimi(ji,jj,jk)
-     &     -grarem(ji,jj,jk)*sigma1-grarem2(ji,jj,jk)*sigma2)
-     &     +(o2ut+o2nit)*( pronew(ji,jj,jk)+pronew2(ji,jj,jk))
-     &     -o2nit*onitr(ji,jj,jk)
-C
-          END DO
-        END DO
-      END DO
-
-
-      DO jk = 1,jpkm1
-        DO jj = 1,jpj
-          DO ji = 1,jpi
-C
-C     Evolution of IRON
-C     -----------------
-C
-          trn(ji,jj,jk,jpfer) = trn(ji,jj,jk,jpfer)
-     &      +(excret-1.)*prorca5(ji,jj,jk)-xaggdfe(ji,jj,jk)
-     &      +(excret2-1.)*prorca4(ji,jj,jk)-xbactfer(ji,jj,jk)
-     &      +grafer(ji,jj,jk)+grafer2(ji,jj,jk)
-     &      +ofer(ji,jj,jk)-xscave(ji,jj,jk)
-C
-          END DO
-        END DO
-      END DO
-
-
-#if defined key_kriest
-
-#include "p4zbio.kriest.h"
-
-#else
-
-#include "p4zbio.std.h"
-
-#endif
-
-
-
-      DO jk = 1,jpkm1
-        DO jj = 1,jpj
-          DO ji = 1,jpi
-C
-C     Evolution of biogenic Silica
-C     ----------------------------
-C
-          trn(ji,jj,jk,jpbsi) = trn(ji,jj,jk,jpbsi)
-     &      +prorca3(ji,jj,jk)*(1.-excret2)-grazss(ji,jj,jk)
-     &      -tortds(ji,jj,jk)-respds(ji,jj,jk)-grazs(ji,jj,jk)
-C
-          END DO
-        END DO
-      END DO
-
-      DO jk = 1,jpkm1
-        DO jj = 1,jpj
-          DO ji = 1,jpi
-C
-C     Evolution of sinking biogenic silica
-C     ------------------------------------
-C
-          trn(ji,jj,jk,jpdsi)=trn(ji,jj,jk,jpdsi)
-     &      +tortds(ji,jj,jk)+respds(ji,jj,jk)+grazs(ji,jj,jk)
-     &      -osil(ji,jj,jk)+grazss(ji,jj,jk)
-C
-          END DO
-        END DO
-      END DO
-
-      DO jk = 1,jpkm1
-        DO jj = 1,jpj
-          DO ji = 1,jpi
-C
-C     Evolution of biogenic diatom Iron
-C     ---------------------------------
-C
-          trn(ji,jj,jk,jpdfe) = trn(ji,jj,jk,jpdfe)
-     &      +prorca4(ji,jj,jk)*(1.-excret2)-grazsf(ji,jj,jk)
-     &      -tortdf(ji,jj,jk)-respdf(ji,jj,jk)-grazf(ji,jj,jk)
-C
-C     Evolution of biogenic nanophytoplankton Iron
-C     --------------------------------------------
-C
-          trn(ji,jj,jk,jpnfe) = trn(ji,jj,jk,jpnfe)
-     &      +prorca5(ji,jj,jk)*(1.-excret)-graznf(ji,jj,jk)
-     &      -tortnf(ji,jj,jk)-respnf(ji,jj,jk)-grazpf(ji,jj,jk)
-C
-C     Evolution of dissolved Silica
-C     -----------------------------
-C
-          trn(ji,jj,jk,jpsil) = trn(ji,jj,jk,jpsil)
-     &      -(1.-excret2)*prorca3(ji,jj,jk)+osil(ji,jj,jk)
-C
-          END DO
-        END DO
-      END DO
-C     
-C     Evolution of calcite and silicates as a function of the two tracers
-C     -------------------------------------------------------------------
-C     
-      DO  jk = 1,jpkm1
-        DO  jj = 1,jpj
-          DO  ji = 1,jpi
-C
-          prodt = prorca(ji,jj,jk)+prorca2(ji,jj,jk)
-     &      -olimi(ji,jj,jk)-grarem(ji,jj,jk)*sigma1
-     &      -grarem2(ji,jj,jk)*sigma2-denitr(ji,jj,jk)
-
-          prodca = pronew(ji,jj,jk)+pronew2(ji,jj,jk)
-     &      -onitr(ji,jj,jk)+rdenit*denitr(ji,jj,jk)
-C     
-C     potential production of calcite and biogenic silicate
-C     ------------------------------------------------------
-C     
-          prcaca(ji,jj,jk)=
-     &      zfracal(ji,jj,jk)*(part*(unass*grazp(ji,jj,jk)+
-     &      unass2*grazn(ji,jj,jk))+tortp(ji,jj,jk)+respp(ji,jj,jk))
-C     
-C     Consumption of Total (12C)O2
-C     ----------------------------
-C     
-          trn(ji,jj,jk,jpdic) = trn(ji,jj,jk,jpdic)
-     &      -prodt-prcaca(ji,jj,jk)
-C     
-C     Consumption of alkalinity due to ca++ uptake and increase 
-C     of alkalinity due to nitrate consumption during organic 
-C     soft tissue production
-C     ---------------------------------------------------------
-C     
-          trn(ji,jj,jk,jptal) = trn(ji,jj,jk,jptal)
-     &      +rno3*prodca-2.*prcaca(ji,jj,jk)
-          END DO
-        END DO
-      END DO
-C
-      DO  jk = 1,jpkm1
-        DO  jj = 1,jpj
-          DO  ji = 1,jpi
-C
-C     Production of calcite due to biological production
-C     --------------------------------------------------
-C     
-           trn(ji,jj,jk,jpcal) = trn(ji,jj,jk,jpcal)
-     &        +prcaca(ji,jj,jk)
-          END DO
-        END DO
-      ENDDO
-C
-C
-C     Loop to test if tracers concentrations fall below 0.
-C     ----------------------------------------------------
-C
-C
-      znegtr(:,:,:) = 1.
-C
-      DO jn = 1,jptra
-        DO jk = 1,jpk
-          DO jj = 1,jpj
-            DO ji = 1,jpi
-              if (trn(ji,jj,jk,jn).lt.0.) then
-               znegtr(ji,jj,jk)=0.
-              endif
-            END DO
-          END DO
-        END DO
-      END DO
-C
-      DO jn = 1,jptra
-         trn(:,:,:,jn) = trb(:,:,:,jn)+
-     &     znegtr(:,:,:)*(trn(:,:,:,jn)-trb(:,:,:,jn))
-      END DO
-C
-#    if defined key_trc_dia3d
-          trc3d(:,:,:,4)=etot(:,:,:)
-          trc3d(:,:,:,5)=prorca(:,:,:)*znegtr(:,:,:)*1e3*rfact2r
-          trc3d(:,:,:,6)=prorca2(:,:,:)*znegtr(:,:,:)*1e3*rfact2r
-          trc3d(:,:,:,7)=pronew(:,:,:)*znegtr(:,:,:)*1e3*rfact2r
-          trc3d(:,:,:,8)=pronew2(:,:,:)*znegtr(:,:,:)*1e3*rfact2r
-          trc3d(:,:,:,9)=prorca3(:,:,:)*znegtr(:,:,:)*1e3*rfact2r
-          trc3d(:,:,:,10)=prorca4(:,:,:)*znegtr(:,:,:)*1e3*rfact2r
-#if ! defined key_kriest
-          trc3d(:,:,:,11)=prorca5(:,:,:)*znegtr(:,:,:)*1e3*rfact2r
-#else
-          trc3d(:,:,:,11)=prcaca(:,:,:)*znegtr(:,:,:)*1e3*rfact2r
-#endif
-#    endif
-C     
-#endif
-C     
-      RETURN
-      END
Index: branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zbio.F90
===================================================================
--- branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zbio.F90	(revision 775)
+++ branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zbio.F90	(revision 775)
@@ -0,0 +1,348 @@
+MODULE p4zbio
+   !!======================================================================
+   !!                         ***  MODULE p4zbio  ***
+   !! TOP :   PISCES bio-model
+   !!======================================================================
+   !! History :   1.0  !  2004     (O. Aumont) Original code
+   !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
+   !!----------------------------------------------------------------------
+#if defined key_pisces
+   !!----------------------------------------------------------------------
+   !!   'key_pisces'                                       PISCES bio-model
+   !!----------------------------------------------------------------------
+   !!   p4z_bio        :   computes the interactions between the different
+   !!                      compartments of PISCES
+   !!----------------------------------------------------------------------
+   USE oce_trc         !
+   USE trp_trc         ! 
+   USE sms             ! 
+   USE p4zsink         ! 
+   USE p4zsink_kriest  ! 
+   USE p4zopt          ! 
+   USE p4zlim          ! 
+   USE p4zprod         !
+   USE p4znano         !
+   USE p4zdiat         ! 
+   USE p4zmicro        ! 
+   USE p4zmeso         ! 
+   USE p4zrem          ! 
+   
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   p4z_bio    ! called in p4zprg.F90
+
+   !!* Substitution
+#  include "domzgr_substitute.h90"
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 2.0 , LOCEAN-IPSL (2007) 
+   !! $Header:$ 
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+   SUBROUTINE p4z_bio
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE p4z_bio  ***
+      !!
+      !! ** Purpose :   Ecosystem model in the whole ocean: computes the
+      !!              different interactions between the different compartments
+      !!              of PISCES
+      !!
+      !! ** Method  : - ???
+      !!---------------------------------------------------------------------
+      INTEGER  ::   ji, jj, jk, jn
+      REAL(wp) ::   zdenom, ztemp
+      REAL(wp) ::   zprodt, zprodca
+      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zdenom1
+      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zfracal
+#if defined key_kriest
+      REAL(wp) ::   znumpoc, znumdoc
+#else
+      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zdenom2
+#endif
+      !!---------------------------------------------------------------------
+
+      !     ASSIGN THE SHEAR RATE THAT IS USED FOR AGGREGATION
+      !     OF PHYTOPLANKTON AND DETRITUS
+
+      zdiss(:,:,:) = 0.01
+
+!!gm the use of nmld should be better here?
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               IF( fsdepw(ji,jj,jk+1) .le. hmld(ji,jj) )   zdiss(ji,jj,jk) = 1.e0
+            END DO 
+         END DO
+      END DO
+
+      ! Compute de different ratios for scavenging of iron
+      ! --------------------------------------------------
+
+      DO jk = 1, jpk
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+#if ! defined key_kriest
+               zdenom = 1. / (  trn(ji,jj,jk,jppoc) + trn(ji,jj,jk,jpgoc)           &
+                  &           + trn(ji,jj,jk,jpdsi) + trn(ji,jj,jk,jpcal) + rtrn )
+               zdenom1(ji,jj,jk) = trn(ji,jj,jk,jppoc) * zdenom
+               zdenom2(ji,jj,jk) = trn(ji,jj,jk,jpgoc) * zdenom
+#else
+               zdenom = 1. / (  trn(ji,jj,jk,jppoc)                                 &
+                  &           + trn(ji,jj,jk,jpdsi) + trn(ji,jj,jk,jpcal) + rtrn )
+               zdenom1(ji,jj,jk) = trn(ji,jj,jk,jppoc) * zdenom
+#endif
+            END DO
+         END DO
+      END DO
+
+      ! Compute the fraction of nanophytoplankton that is made of calcifiers
+      ! --------------------------------------------------------------------
+
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               ztemp = MAX( 0., tn(ji,jj,jk) )
+               zfracal(ji,jj,jk) = caco3r * xlimphy(ji,jj,jk)   &
+                  &                       * MAX( 0.0001, ztemp / ( 2.+ ztemp ) )   &
+                  &                       * MAX( 1., trn(ji,jj,jk,jpphy) * 1.e6 / 2. )
+               zfracal(ji,jj,jk) = MIN( 0.8 , zfracal(ji,jj,jk) )
+               zfracal(ji,jj,jk) = MAX( 0.01, zfracal(ji,jj,jk) )
+            END DO
+         END DO
+      END DO
+
+      ! computation of the vertical flux of particulate organic matter
+      ! --------------------------------------------------------------
+
+      IF( lk_kriest )   THEN   ;   CALL p4z_sink_kriest      ! Sink due to vertical flux of POM
+      ELSE                     ;   CALL p4z_sink             ! 
+      ENDIF
+
+      ! compute the PAR in the water column
+      ! -----------------------------------
+
+      CALL p4z_opt       ! Optical 
+
+      ! compute the co-limitations by the various nutrients
+      ! ----------------------------------------------------
+
+      CALL p4z_lim
+
+      ! compute phytoplankton growth rate over the global ocean. 
+      ! -------------------------------------------------------
+      ! (Growth rates for each element is computed (C, Si, Fe, Chl))
+
+      CALL p4z_prod
+
+      ! phytoplankton mortality (Mortality losses for each elements are computed (C, Fe, Si, Chl) )
+      ! -----------------------
+
+      CALL p4z_nano       ! nanophytoplankton
+      
+      CALL p4z_diat       ! diatoms
+
+      ! zooplankton sources/sinks routines (each elements are computed (C, Fe, Si, Chl) )
+      ! ----------------------------------
+
+      CALL p4z_micro      ! microzooplankton
+      
+      CALL p4z_meso       ! mesozooplankton
+
+      ! computation of remineralization terms of organic matter + scavenging of Fe
+      ! --------------------------------------------------------------------------
+      
+      CALL p4z_rem        ! remineralization
+
+
+      ! Determination of tracers concentration as a function of biological sources and sinks
+      ! ------------------------------------------------------------------------------------
+
+      DO jk = 1, jpkm1
+
+         ! Evolution of PO4
+         ! ----------------    
+         trn(:,:,jk,jppo4) = trn(:,:,jk,jppo4) - prorca(:,:,jk) - prorca2(:,:,jk)            &
+            &                                  + olimi (:,:,jk) + grarem (:,:,jk) * sigma1   &
+            &                                  + denitr(:,:,jk) + grarem2(:,:,jk) * sigma2
+
+         ! Evolution of NO3 and NH4
+         ! ------------------------
+         trn(:,:,jk,jpno3) = trn(:,:,jk,jpno3) - pronew(:,:,jk) - pronew2(:,:,jk)            &
+            &                                  + onitr (:,:,jk) - denitr (:,:,jk) * rdenit
+
+         trn(:,:,jk,jpnh4) = trn(:,:,jk,jpnh4) - proreg(:,:,jk) - proreg2(:,:,jk)            &
+            &                                  + olimi (:,:,jk) + grarem (:,:,jk) * sigma1   &
+            &                                                   + grarem2(:,:,jk) * sigma2   &
+            &                                  - onitr (:,:,jk) + denitr (:,:,jk)
+
+         ! Evolution of Phytoplankton
+         ! --------------------------
+         trn(:,:,jk,jpphy) = trn(:,:,jk,jpphy) + prorca (:,:,jk) * ( 1.- excret ) - tortp(:,:,jk)   &
+            &                                  - grazp  (:,:,jk) - grazn(:,:,jk)  - respp(:,:,jk)
+
+         trn(:,:,jk,jpnch) = trn(:,:,jk,jpnch) + prorca6(:,:,jk) * ( 1.- excret ) - tortnch(:,:,jk)   &
+            &                                  - grazpch(:,:,jk) - graznch(:,:,jk)- respnch(:,:,jk)
+
+         ! Evolution of Diatoms
+         ! --------------------
+         trn(:,:,jk,jpdia) = trn(:,:,jk,jpdia) + prorca2(:,:,jk) * ( 1.- excret2 ) - tortp2(:,:,jk)   &
+            &                                  - respp2 (:,:,jk) - grazd(:,:,jk)   - grazsd(:,:,jk)
+
+         trn(:,:,jk,jpdch) = trn(:,:,jk,jpdch) + prorca7(:,:,jk) * ( 1.- excret2 ) - tortdch(:,:,jk)   &
+            &                                  - respdch(:,:,jk) - grazdch(:,:,jk) - grazsch(:,:,jk)
+
+         ! Evolution of Zooplankton
+         ! ------------------------   
+         trn(:,:,jk,jpzoo) = trn(:,:,jk,jpzoo) + epsher * ( grazp(:,:,jk) + grazm(:,:,jk) + grazsd(:,:,jk) )   &
+            &                                  - grazz(:,:,jk) - tortz(:,:,jk) - respz(:,:,jk)
+
+         ! Evolution of Mesozooplankton
+         ! ------------------------
+         trn(:,:,jk,jpmes) = trn(:,:,jk,jpmes) + epsher2 * (  grazd  (:,:,jk) + grazz  (:,:,jk) + grazn(:,:,jk)   &
+            &                                               + grazpoc(:,:,jk) + grazffe(:,:,jk)  )                &
+            &                                  - tortz2(:,:,jk) - respz2(:,:,jk)
+    
+         ! Evolution of O2
+         ! ---------------     
+         trn(:,:,jk,jpoxy) = trn(:,:,jk,jpoxy) + o2ut * (  proreg(:,:,jk) + proreg2(:,:,jk) - olimi(:,:,jk)        &
+            &                                             -grarem(:,:,jk) * sigma1 - grarem2(:,:,jk) * sigma2  )   &
+            &                                  + ( o2ut + o2nit ) * ( pronew(:,:,jk) + pronew2(:,:,jk) )           &
+            &                                  - o2nit * onitr(:,:,jk)
+
+         ! Evolution of IRON
+         ! -----------------
+         trn(:,:,jk,jpfer) = trn(:,:,jk,jpfer) + ( excret  - 1.) * prorca5(:,:,jk) - xaggdfe (:,:,jk)   &
+            &                                  + ( excret2 - 1.) * prorca4(:,:,jk) - xbactfer(:,:,jk)   &
+            &                                  + grafer(:,:,jk) + grafer2(:,:,jk)                       &
+            &                                  + ofer  (:,:,jk) - xscave (:,:,jk)
+         !
+      END DO
+
+
+#if defined key_kriest
+
+#include "p4zbio_kriest.h90"
+
+#else
+
+#include "p4zbio_std.h90"
+
+#endif
+
+
+      DO jk = 1, jpkm1
+
+         ! Evolution of biogenic Silica
+         ! ----------------------------
+         trn(:,:,jk,jpbsi) = trn(:,:,jk,jpbsi) + prorca3(:,:,jk) * ( 1.- excret2 ) - grazss(:,:,jk)   &
+            &                                  - tortds (:,:,jk) - respds(:,:,jk)  - grazs (:,:,jk)
+
+         ! Evolution of sinking biogenic silica
+         ! ------------------------------------
+         trn(:,:,jk,jpdsi) = trn(:,:,jk,jpdsi) + tortds (:,:,jk) + respds(:,:,jk)  + grazs(:,:,jk)   &
+            &                                  - osil   (:,:,jk) + grazss(:,:,jk)
+
+         ! Evolution of biogenic diatom Iron
+         ! ---------------------------------
+         trn(:,:,jk,jpdfe) = trn(:,:,jk,jpdfe) + prorca4(:,:,jk) * ( 1.- excret2 ) - grazsf(:,:,jk)   &
+            &                                  - tortdf (:,:,jk) - respdf(:,:,jk)  - grazf (:,:,jk)
+
+         ! Evolution of biogenic nanophytoplankton Iron
+         ! --------------------------------------------
+         trn(:,:,jk,jpnfe) = trn(:,:,jk,jpnfe) + prorca5(:,:,jk) * ( 1.- excret )  - graznf(:,:,jk)   &
+            &                                  - tortnf (:,:,jk) - respnf(:,:,jk)  - grazpf(:,:,jk)
+
+         ! Evolution of dissolved Silica
+         ! -----------------------------
+         trn(:,:,jk,jpsil) = trn(:,:,jk,jpsil) - ( 1.- excret2 ) * prorca3(:,:,jk) + osil(:,:,jk)
+
+      END DO
+     
+      ! Evolution of calcite and silicates as a function of the two tracers
+      ! -------------------------------------------------------------------     
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+
+               zprodt  = prorca(ji,jj,jk) + prorca2(ji,jj,jk) - olimi(ji,jj,jk) - grarem(ji,jj,jk) * sigma1   &
+                  &                       - grarem2(ji,jj,jk) * sigma2 - denitr(ji,jj,jk)
+               zprodca = pronew(ji,jj,jk) + pronew2(ji,jj,jk) - onitr(ji,jj,jk) + rdenit * denitr(ji,jj,jk)
+    
+               ! potential production of calcite and biogenic silicate
+               ! ------------------------------------------------------     
+               prcaca(ji,jj,jk) = zfracal(ji,jj,jk)   &
+                  &             * (  part * (  unass*grazp(ji,jj,jk) + unass2*grazn(ji,jj,jk)  )   &
+                  &                + tortp(ji,jj,jk) + respp(ji,jj,jk)  )
+
+               ! Consumption of Total (12C)O2
+               ! ----------------------------     
+               trn(ji,jj,jk,jpdic) = trn(ji,jj,jk,jpdic) - zprodt - prcaca(ji,jj,jk)
+
+               ! Consumption of alkalinity due to ca++ uptake and increase of
+               !  alkalinity due to nitrate consumption during organic soft tissue production
+               ! ---------------------------------------------------------  
+               trn(ji,jj,jk,jptal) = trn(ji,jj,jk,jptal) + rno3 * zprodca - 2.* prcaca(ji,jj,jk)
+               !
+            END DO
+         END DO
+      END DO
+
+
+      ! Production of calcite due to biological production
+      ! --------------------------------------------------   
+      DO jk = 1, jpkm1
+         trn(:,:,jk,jpcal) = trn(:,:,jk,jpcal) + prcaca(:,:,jk)
+      END DO
+
+
+      ! Loop to test if tracers concentrations fall below 0.
+      ! ----------------------------------------------------
+
+      znegtr(:,:,:) = 1.e0
+      DO jn = 1, jptra
+         DO jk = 1, jpk
+            DO jj = 1, jpj
+               DO ji = 1, jpi
+                  IF( trn(ji,jj,jk,jn) < 0.e0 )   znegtr(ji,jj,jk) = 0.e0
+               END DO
+            END DO
+         END DO
+      END DO
+      !                                ! where at least 1 tracer concentration becomes negative
+      !                                ! all tracer tendancy are set to zero (i.e. trn = trb)
+      DO jn = 1, jptra
+         trn(:,:,:,jn) = trb(:,:,:,jn) + znegtr(:,:,:) * ( trn(:,:,:,jn) - trb(:,:,:,jn) )
+      END DO
+
+# if defined key_trc_dia3d
+!!gm potential bug  hard coded index on trc3d
+          trc3d(:,:,:, 4) = etot(:,:,:)
+          trc3d(:,:,:, 5) = prorca (:,:,:) * znegtr(:,:,:) * 1.e3 * rfact2r
+          trc3d(:,:,:, 6) = prorca2(:,:,:) * znegtr(:,:,:) * 1.e3 * rfact2r
+          trc3d(:,:,:, 7) = pronew (:,:,:) * znegtr(:,:,:) * 1.e3 * rfact2r
+          trc3d(:,:,:, 8) = pronew2(:,:,:) * znegtr(:,:,:) * 1.e3 * rfact2r
+          trc3d(:,:,:, 9) = prorca3(:,:,:) * znegtr(:,:,:) * 1.e3 * rfact2r
+          trc3d(:,:,:,10) = prorca4(:,:,:) * znegtr(:,:,:) * 1.e3 * rfact2r
+#  if ! defined key_kriest
+          trc3d(:,:,:,11) = prorca5(:,:,:) * znegtr(:,:,:) * 1.e3 * rfact2r
+#  else
+          trc3d(:,:,:,11) = prcaca (:,:,:) * znegtr(:,:,:) * 1.e3 * rfact2r
+#  endif
+# endif
+      !
+   END SUBROUTINE p4z_bio
+
+#else
+   !!======================================================================
+   !!  Dummy module :                                   No PISCES bio-model
+   !!======================================================================
+CONTAINS
+   SUBROUTINE p4z_bio                         ! Empty routine
+   END SUBROUTINE p4z_bio
+#endif 
+
+   !!======================================================================
+END MODULE  p4zbio
Index: branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zbio.kriest.h
===================================================================
--- branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zbio.kriest.h	(revision 773)
+++ 	(revision )
@@ -1,93 +1,0 @@
-
-
-CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
-CCC p4zbio : PISCES MODEL  - Kriest parameterization
-CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
-
-      DO jk = 1,jpkm1
-        DO jj = 1,jpj
-          DO ji = 1,jpi
-C    
-C     Evolution of DOC
-C     ----------------
-C     
-          trn(ji,jj,jk,jpdoc) = trn(ji,jj,jk,jpdoc)
-     &      +orem(ji,jj,jk)+excret2*prorca2(ji,jj,jk)
-     &      +excret*prorca(ji,jj,jk)-olimi(ji,jj,jk)-denitr(ji,jj,jk)
-     &      +grarem(ji,jj,jk)*(1.-sigma1)+grarem2(ji,jj,jk)
-     &      *(1.-sigma2)-xaggdoc(ji,jj,jk)
-          END DO
-        END DO
-      END DO
-
-
-      DO jk = 1,jpkm1
-        DO jj = 1,jpj
-          DO ji = 1,jpi
-C     
-C     Evolution of Detritus
-C     ---------------------
-C  
-            znumpoc=trn(ji,jj,jk,jpnum)/(trn(ji,jj,jk,jppoc)+rtrn)
-            znumdoc=znumpoc
-
-            trn(ji,jj,jk,jppoc) = trn(ji,jj,jk,jppoc)
-     &          -grazpoc(ji,jj,jk)
-     &          +grapoc(ji,jj,jk)+grapoc2(ji,jj,jk)
-     &          -grazm(ji,jj,jk)+tortz2(ji,jj,jk)
-     &          +respz(ji,jj,jk)+respz2(ji,jj,jk)
-     &          +respp(ji,jj,jk)+respp2(ji,jj,jk)
-     &          +tortp2(ji,jj,jk)+tortz(ji,jj,jk)
-     &          +tortp(ji,jj,jk)-orem(ji,jj,jk)
-     &          +xaggdoc(ji,jj,jk)-grazffe(ji,jj,jk)
-C    
-C     Evolution of number of aggregates
-C     ---------------------------------
-C
-            trn(ji,jj,jk,jpnum) = trn(ji,jj,jk,jpnum)
-     &          -xagg(ji,jj,jk)-(orem(ji,jj,jk)
-     &          +grazpoc(ji,jj,jk))*znumpoc
-     &          +(tortp(ji,jj,jk))*xkr_nnano
-     &          +(tortp2(ji,jj,jk)+respp(ji,jj,jk)+tortz(ji,jj,jk)
-     &          +grapoc(ji,jj,jk)-grazm(ji,jj,jk)
-     &          +respz(ji,jj,jk))*xkr_ndiat
-     &          +(grapoc2(ji,jj,jk)+tortz2(ji,jj,jk)
-     &          +respz2(ji,jj,jk))*xkr_nmeso
-     &          +respp2(ji,jj,jk)*xkr_naggr
-     &          +xaggdoc(ji,jj,jk)*znumdoc
-     &          -grazffe(ji,jj,jk)*znumpoc*wsbio4(ji,jj,jk)
-     &          /(wsbio3(ji,jj,jk)+rtrn)
-C
-            trn(ji,jj,jk,jpnum) = max(trn(ji,jj,jk,jpnum),
-     &          trn(ji,jj,jk,jppoc)/xkr_massp/xnumm(jk))
-C
-            trn(ji,jj,jk,jpnum) = min(trn(ji,jj,jk,jpnum),
-     &          trn(ji,jj,jk,jppoc)/xkr_massp/1.1)
-C
-
-          END DO
-        END DO
-      END DO
-
-
-
-      DO jk = 1,jpkm1
-        DO jj = 1,jpj
-          DO ji = 1,jpi
-C
-C     Evolution of biogenic Iron
-C     --------------------------
-C
-          trn(ji,jj,jk,jpsfe) = trn(ji,jj,jk,jpsfe)
-     &     +unass*(grazpf(ji,jj,jk)+grazsf(ji,jj,jk))
-     &     -(1.-unass2)*grazpof(ji,jj,jk)-(1.-unass)*grazmf(ji,jj,jk)
-     &     -(1.-unass2)*grazfff(ji,jj,jk)+unass2*(graznf(ji,jj,jk)
-     &     +grazf(ji,jj,jk)+ferat3*grazz(ji,jj,jk))+ferat3
-     &     *(tortz2(ji,jj,jk)+respz2(ji,jj,jk)+tortz(ji,jj,jk)
-     &     +respz(ji,jj,jk))-ofer(ji,jj,jk)+(respnf(ji,jj,jk)
-     &     +tortnf(ji,jj,jk))+tortdf(ji,jj,jk)+respdf(ji,jj,jk)
-     &     +xbactfer(ji,jj,jk)+xscave(ji,jj,jk)*zdenom1(ji,jj,jk)
-          END DO
-        END DO
-      END DO
-
Index: branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zbio.std.h
===================================================================
--- branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zbio.std.h	(revision 773)
+++ 	(revision )
@@ -1,80 +1,0 @@
-CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
-CCC p4zbio : PISCES MODEL  - Standard parameterization
-CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
-
-      DO jk = 1,jpkm1
-        DO jj = 1,jpj
-          DO ji = 1,jpi
-C    
-C     Evolution of DOC
-C     ----------------
-C     
-          trn(ji,jj,jk,jpdoc) = trn(ji,jj,jk,jpdoc)
-     &      +orem(ji,jj,jk)+excret2*prorca2(ji,jj,jk)
-     &      +excret*prorca(ji,jj,jk)-olimi(ji,jj,jk)-denitr(ji,jj,jk)
-     &      +grarem(ji,jj,jk)*(1.-sigma1)+grarem2(ji,jj,jk)
-     &      *(1.-sigma2)-xaggdoc(ji,jj,jk)-xaggdoc2(ji,jj,jk)
-          END DO
-        END DO
-      END DO
-
-      DO jk = 1,jpkm1
-        DO jj = 1,jpj
-          DO ji = 1,jpi
-C     
-C     Evolution of Detritus
-C     ---------------------
-C     
-          trn(ji,jj,jk,jppoc) = trn(ji,jj,jk,jppoc)
-     &     -grazpoc(ji,jj,jk)+grapoc(ji,jj,jk)-grazm(ji,jj,jk)
-     &     +respz(ji,jj,jk)-xagg(ji,jj,jk)+xaggdoc(ji,jj,jk)
-     &     +(1.-0.5*zfracal(ji,jj,jk))*(tortp(ji,jj,jk)
-     &     +respp(ji,jj,jk))+0.5*tortp2(ji,jj,jk)
-     &     +orem2(ji,jj,jk)+tortz(ji,jj,jk)-orem(ji,jj,jk)
-C    
-C     Evolution of rapid Detritus
-C     ---------------------
-C    
-          trn(ji,jj,jk,jpgoc) = trn(ji,jj,jk,jpgoc)
-     &     +grapoc2(ji,jj,jk)+respp2(ji,jj,jk)+xagg(ji,jj,jk)
-     &     +tortz2(ji,jj,jk)+respz2(ji,jj,jk)-orem2(ji,jj,jk)
-     &     +0.5*zfracal(ji,jj,jk)*(respp(ji,jj,jk)+tortp(ji,jj,jk))
-     &     +0.5*tortp2(ji,jj,jk)+xaggdoc2(ji,jj,jk)-grazffe(ji,jj,jk)
-C
-          END DO
-        END DO
-      END DO
-
-
-
-      DO jk = 1,jpkm1
-        DO jj = 1,jpj
-          DO ji = 1,jpi
-C
-C     Evolution of small biogenic Iron
-C     --------------------------
-C
-          trn(ji,jj,jk,jpsfe) = trn(ji,jj,jk,jpsfe)
-     &     +unass*(grazpf(ji,jj,jk)+grazsf(ji,jj,jk))
-     &     -grazpof(ji,jj,jk)-(1.-unass)*grazmf(ji,jj,jk)
-     &     +(1.-0.5*zfracal(ji,jj,jk))*(tortnf(ji,jj,jk)
-     &     +respnf(ji,jj,jk))+0.5*tortdf(ji,jj,jk)+ferat3*
-     &     (tortz(ji,jj,jk)+respz(ji,jj,jk))-ofer(ji,jj,jk)
-     &     +ofer2(ji,jj,jk)-xaggfe(ji,jj,jk)
-     &     +xscave(ji,jj,jk)*zdenom1(ji,jj,jk)
-C
-C     Evolution of big biogenic Iron
-C     --------------------------
-C
-          trn(ji,jj,jk,jpbfe) = trn(ji,jj,jk,jpbfe)
-     &     +unass2*(graznf(ji,jj,jk)+grazf(ji,jj,jk)+grazfff(ji,jj,jk)
-     &     +grazpof(ji,jj,jk)+ferat3*grazz(ji,jj,jk))+ferat3*
-     &     (tortz2(ji,jj,jk)+respz2(ji,jj,jk))-ofer2(ji,jj,jk)
-     &     +0.5*zfracal(ji,jj,jk)*(respnf(ji,jj,jk)+tortnf(ji,jj,jk))
-     &     +0.5*tortdf(ji,jj,jk)+respdf(ji,jj,jk)+xaggfe(ji,jj,jk)
-     &     +xbactfer(ji,jj,jk)-grazfff(ji,jj,jk)+xscave(ji,jj,jk)
-     &     *zdenom2(ji,jj,jk)
-          END DO
-        END DO
-      END DO
-
Index: branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zbio_kriest.h90
===================================================================
--- branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zbio_kriest.h90	(revision 775)
+++ branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zbio_kriest.h90	(revision 775)
@@ -0,0 +1,64 @@
+
+      !CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
+      !CC p4zbio : PISCES MODEL  - Kriest parameterization
+      !CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
+
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+    
+               !     Evolution of DOC
+               !     ----------------     
+               trn(ji,jj,jk,jpdoc) = trn(ji,jj,jk,jpdoc) + orem(ji,jj,jk)                                  &
+                  &                                      + excret2 * prorca2(ji,jj,jk)                     &
+                  &                                      + excret  * prorca (ji,jj,jk) - olimi(ji,jj,jk)   &
+                  &                                      - denitr(ji,jj,jk)                                &
+                  &                                      + grarem (ji,jj,jk) * (1.-sigma1)                 &
+                  &                                      + grarem2(ji,jj,jk) * (1.-sigma2) - xaggdoc(ji,jj,jk)
+     
+               !     Evolution of Detritus
+               !     ---------------------
+               znumpoc = trn(ji,jj,jk,jpnum) / ( trn(ji,jj,jk,jppoc) + rtrn )
+               znumdoc = znumpoc
+
+               trn(ji,jj,jk,jppoc) = trn(ji,jj,jk,jppoc) - grazpoc(ji,jj,jk)                       &
+                  &                                      + grapoc (ji,jj,jk) + grapoc2(ji,jj,jk)   &
+                  &                                      - grazm  (ji,jj,jk) + tortz2 (ji,jj,jk)   &
+                  &                                      + respz  (ji,jj,jk) + respz2 (ji,jj,jk)   &
+                  &                                      + respp  (ji,jj,jk) + respp2 (ji,jj,jk)   &
+                  &                                      + tortp2 (ji,jj,jk) + tortz  (ji,jj,jk)   &
+                  &                                      + tortp  (ji,jj,jk) - orem   (ji,jj,jk)   &
+                  &                                      + xaggdoc(ji,jj,jk) - grazffe(ji,jj,jk)
+
+               !     Evolution of number of aggregates
+               !     ---------------------------------
+               trn(ji,jj,jk,jpnum) = trn(ji,jj,jk,jpnum) - xagg(ji,jj,jk)                                           &
+                  &                                      - ( orem(ji,jj,jk) + grazpoc(ji,jj,jk) ) * znumpoc         &
+                  &                                      + ( tortp(ji,jj,jk) ) * xkr_nnano                          &
+                  &                                      + ( tortp2(ji,jj,jk) + respp(ji,jj,jk) + tortz(ji,jj,jk)   &
+                  &                                        + grapoc(ji,jj,jk) - grazm(ji,jj,jk)                     &
+                  &                                        + respz(ji,jj,jk) ) * xkr_ndiat                          &
+                  &                                      + ( grapoc2(ji,jj,jk) + tortz2(ji,jj,jk)                   &
+                  &                                        + respz2 (ji,jj,jk) ) * xkr_nmeso                        &
+                  &                                      + respp2(ji,jj,jk) * xkr_naggr                             &
+                  &                                      + xaggdoc(ji,jj,jk) * znumdoc                              &
+                  &                                      - grazffe(ji,jj,jk) * znumpoc * wsbio4(ji,jj,jk)           &
+                  &                                      / ( wsbio3(ji,jj,jk) + rtrn )
+
+               trn(ji,jj,jk,jpnum) = MAX( trn(ji,jj,jk,jpnum), trn(ji,jj,jk,jppoc) / xkr_massp / xnumm(jk) )
+
+               trn(ji,jj,jk,jpnum) = MIN( trn(ji,jj,jk,jpnum), trn(ji,jj,jk,jppoc) / xkr_massp / 1.1       )
+
+               !     Evolution of biogenic Iron
+               !     --------------------------
+               trn(ji,jj,jk,jpsfe) = trn(ji,jj,jk,jpsfe) + unass * ( grazpf(ji,jj,jk) + grazsf(ji,jj,jk) )   &
+                  &                - ( 1.- unass2 ) * grazpof(ji,jj,jk) - ( 1.- unass ) * grazmf(ji,jj,jk)   &
+                  &                - ( 1.- unass2 ) * grazfff(ji,jj,jk) +       unass2  * ( graznf(ji,jj,jk)   &
+                  &                + grazf(ji,jj,jk) + ferat3 * grazz(ji,jj,jk) ) + ferat3                   &
+                  &                * (tortz2(ji,jj,jk)+respz2(ji,jj,jk)+tortz(ji,jj,jk)                      &
+                  &                + respz(ji,jj,jk) ) - ofer(ji,jj,jk) + ( respnf(ji,jj,jk)                 &
+                  &                + tortnf(ji,jj,jk) ) + tortdf(ji,jj,jk) + respdf(ji,jj,jk)                &
+                  &                + xbactfer(ji,jj,jk) + xscave(ji,jj,jk) * zdenom1(ji,jj,jk)
+            END DO
+         END DO
+      END DO
Index: branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zbio_std.h90
===================================================================
--- branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zbio_std.h90	(revision 775)
+++ branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zbio_std.h90	(revision 775)
@@ -0,0 +1,49 @@
+      !CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
+      !CC p4zbio : PISCES MODEL  - Standard parameterization
+      !CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
+
+      DO jk = 1, jpkm1
+    
+         !     Evolution of DOC
+         !     ----------------     
+         trn(:,:,jk,jpdoc) = trn(:,:,jk,jpdoc) + orem(:,:,jk) + excret2 * prorca2(:,:,jk)                       &
+            &                                  + excret * prorca(:,:,jk) - olimi(:,:,jk) - denitr(:,:,jk)       &
+            &                                  + grarem(:,:,jk) * (1.-sigma1) + grarem2(:,:,jk) * (1.-sigma2)   &
+            &                                  - xaggdoc(:,:,jk) - xaggdoc2(:,:,jk)
+     
+         !     Evolution of Detritus
+         !     ---------------------
+         trn(:,:,jk,jppoc) = trn(:,:,jk,jppoc) - grazpoc(:,:,jk) + grapoc(:,:,jk) - grazm  (:,:,jk)                 &
+            &                                  + respz  (:,:,jk) - xagg  (:,:,jk) + xaggdoc(:,:,jk)                 &
+            &                                  + ( 1.-0.5 * zfracal(:,:,jk) ) * ( tortp(:,:,jk) + respp(:,:,jk) )   &
+            &                                  +      0.5 * tortp2 (:,:,jk)                                         &
+            &                                  + orem2(:,:,jk) + tortz(:,:,jk) - orem(:,:,jk)
+
+         !     Evolution of rapid Detritus
+         !     ---------------------------
+         trn(:,:,jk,jpgoc) = trn(:,:,jk,jpgoc) + grapoc2(:,:,jk) + respp2(:,:,jk) + xagg (:,:,jk)            &
+            &                                  + tortz2 (:,:,jk) + respz2(:,:,jk) - orem2(:,:,jk)            &
+            &                                  + 0.5*zfracal(:,:,jk)*(respp(:,:,jk)+tortp(:,:,jk))           &
+            &                                  + 0.5*tortp2(:,:,jk)+xaggdoc2(:,:,jk)-grazffe(:,:,jk)
+
+         !     Evolution of small biogenic Iron
+         !     --------------------------------
+         trn(:,:,jk,jpsfe) = trn(:,:,jk,jpsfe) + unass * ( grazpf(:,:,jk) + grazsf(:,:,jk) )           &
+            &                                  - grazpof(:,:,jk) - ( 1.- unass ) * grazmf(:,:,jk)      &
+            &                                  + ( 1.- 0.5 * zfracal(:,:,jk) ) * ( tortnf(:,:,jk)      &
+            &                                  + respnf(:,:,jk) ) + 0.5 * tortdf(:,:,jk) + ferat3 *    &
+            &                                    ( tortz(:,:,jk) + respz(:,:,jk) ) - ofer(:,:,jk)      &
+            &                                  + ofer2(:,:,jk) - xaggfe(:,:,jk)                        &
+            &                                  + xscave(:,:,jk) * zdenom1(:,:,jk)
+
+         !     Evolution of big biogenic Iron
+         !     ------------------------------
+         trn(:,:,jk,jpbfe) = trn(:,:,jk,jpbfe) + unass2 * ( graznf (:,:,jk) + grazf(:,:,jk) + grazfff(:,:,jk)   &
+            &                                             + grazpof(:,:,jk) + ferat3 * grazz(:,:,jk) )          &
+            &                                  + ferat3 * ( tortz2 (:,:,jk) + respz2(:,:,jk) )                  &
+            &                                  - ofer2(:,:,jk)                                                  &
+            &                                  + 0.5 * zfracal(:,:,jk) * ( respnf(:,:,jk) + tortnf(:,:,jk) )    &
+            &                                  + 0.5 * tortdf (:,:,jk) + respdf(:,:,jk) + xaggfe(:,:,jk)        &
+            &                                  + xbactfer(:,:,jk) - grazfff(:,:,jk) + xscave(:,:,jk) * zdenom2(:,:,jk)
+         !
+      END DO
Index: branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zche.F
===================================================================
--- branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zche.F	(revision 773)
+++ 	(revision )
@@ -1,310 +1,0 @@
-
-CCC $Header$ 
-CCC  TOP 1.0 , LOCEAN-IPSL (2005) 
-C This software is governed by CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
-C ---------------------------------------------------------------------------
-CDIR$ LIST
-      SUBROUTINE p4zche
-#if defined key_top && defined key_pisces
-CCC---------------------------------------------------------------------
-CCC
-CCC          ROUTINE p4zche : PISCES MODEL
-CCC          *****************************
-CCC
-CCC     PURPOSE.
-CCC     --------
-CCC          *P4ZCHE* : Sea water chemistry computed following OCMIP protocol
-CCC
-CCC
-CC     EXTERNALS.
-CC     ----------
-CC          rhop
-CC
-CC   MODIFICATIONS:
-CC   --------------
-CC      original :      1988 E. Maier-Reimer
-CC      additions :     1998 O. Aumont
-CC      modifications : 1999 C. Le Quere
-CC      modifications : 2004 O. Aumont
-CC      modifications : 2006 R. Gangsto
-CC----------------------------------------------------------------------
-CC parameters and commons
-CC ======================
-CDIR$ nolist
-      USE oce_trc
-      USE trp_trc
-      USE sms
-      IMPLICIT NONE
-#include "domzgr_substitute.h90"
-CDIR$ list
-CC----------------------------------------------------------------------
-CC local declarations
-CC ==================
-C
-      INTEGER ji, jj, jk
-      REAL tkel, sal,  qtt, zbuf1, zbuf2
-      REAL pres, tc, cl, cpexp, cek0, oxy, cpexp2
-      REAL zsqrt, ztr, zlogt, cek1
-      REAL zqtt, qtt2, sal15, zis, zis2, zisqrt
-      REAL ckb, ck1, ck2, ckw, ak1, ak2, akb, aksp0, akw
-      REAL ckp1, ckp2, ckp3, cksi, akp1, akp2, akp3, aksi
-      REAL st, ft, cks, ckf, aks, akf, aksp1
-
-C
-C* 1. CHEMICAL CONSTANTS - SURFACE LAYER
-C ---------------------------------------
-C
-      DO jj = 1,jpj
-        DO ji = 1,jpi
-C
-C* 1.1 SET ABSOLUTE TEMPERATURE
-C ------------------------------
-C
-          tkel = tn(ji,jj,1)+273.16
-          qtt = tkel*0.01
-          qtt2=qtt*qtt
-          sal = sn(ji,jj,1) + (1.-tmask(ji,jj,1))*35.
-          zqtt=log(qtt)
-C
-C* 1.2 LN(K0) OF SOLUBILITY OF CO2 (EQ. 12, WEISS, 1980)
-C      AND FOR THE ATMOSPHERE FOR NON IDEAL GAS
-C -------------------------------------------------------
-C
-          cek0 = c00+c01/qtt+c02*zqtt+sal*(c03+c04*qtt+c05*qtt2)
-          cek1 = ca0+ca1/qtt+ca2*zqtt+ca3*qtt2+sal*(ca4
-     &      +ca5*qtt+ca6*qtt2)
-C
-C* 1.3 LN(K0) OF SOLUBILITY OF O2 and N2 (EQ. 4, WEISS, 1970)
-C ------------------------------------------------------------
-C
-          oxy = ox0+ox1/qtt+ox2*zqtt+sal*(ox3+ox4*qtt+ox5*qtt2)
-C
-C* 1.4 SET SOLUBILITIES OF O2 AND CO2
-C -----------------------------------
-C
-          chemc(ji,jj,1) = exp(cek0)*1.E-6*rhop(ji,jj,1)/1000.
-          chemc(ji,jj,2) = exp(oxy)*oxyco
-          chemc(ji,jj,3) = exp(cek1)*1.E-6*rhop(ji,jj,1)/1000.
-C
-        ENDDO
-      END DO
-C
-C* 2 CHEMICAL CONSTANTS - DEEP OCEAN
-C -------------------------------------
-C
-      DO jk = 1,jpk
-        DO jj = 1,jpj
-          DO ji = 1,jpi
-C
-C* 2.1 SET PRESSION
-C -----------------
-C
-            pres = 1.025e-1*fsdept(ji,jj,jk)
-C
-C* 2.2 SET ABSOLUTE TEMPERATURE
-C ------------------------------
-C
-            tkel   = tn(ji,jj,jk)+273.16
-            qtt    = tkel*0.01
-            sal    = sn(ji,jj,jk) + (1.-tmask(ji,jj,jk))*35.
-            zsqrt  = sqrt(sal)
-            sal15  = zsqrt*sal
-            zlogt  = log(tkel)
-            ztr    = 1./tkel
-            zis    = 19.924*sal/(1000.-1.005*sal)
-            zis2   = zis*zis
-            zisqrt = sqrt(zis)
-            tc = tn(ji,jj,jk) + (1.-tmask(ji,jj,jk))*20.
-C
-C* 2.3 CHLORINITY (WOOSTER ET AL., 1969)
-C ---------------------------------------
-C
-            cl = sal*salchl
-C
-C* 2.4 TOTAL SULFATE CONCENTR. [MOLES/kg soln]
-C --------------------------------------------
-C
-            st = st1*cl*st2
-C
-C* 2.5 TOTAL FLUORIDE CONCENTR. [MOLES/kg soln]
-C ---------------------------------------------
-C
-            ft = ft1*cl*ft2
-C
-C* 2.6 DISSOCIATION CONSTANT FOR SULFATES
-C on free H scale (Dickson 1990)
-C -------------------------------------------------------
-C
-            cks=exp(ks1*ztr+ks0+ks2*zlogt+(ks3*ztr+ks4+ks5*zlogt)
-     &      *zisqrt+(ks6*ztr+ks7+ks8*zlogt)*zis+ks9*ztr*zis
-     &      *zisqrt+ks10*ztr*zis2+log(ks11+ks12*sal))
-C
-C* 2.7 DISSOCIATION CONSTANT FOR FLUORIDES
-C on free H scale (Dickson and Riley 79)
-C -------------------------------------------------------
-C
-            ckf=exp(kf1*ztr+kf0+kf2*zisqrt+log(kf3+kf4*sal))
-
-C
-C* 2.4 DISSOCIATION CONSTANT FOR CARBONATE AND BORATE
-C -------------------------------------------------------
-C
-            ckb = (cb0+cb1*zsqrt+cb2*sal+cb3*sal15+cb4*sal*sal)*ztr
-     &          +(cb5+cb6*zsqrt+cb7*sal)+
-     &          (cb8+cb9*zsqrt+cb10*sal)*zlogt+cb11*zsqrt*tkel
-     &          +log((1.+st/cks+ft/ckf)/(1.+st/cks))
-            ck1 = c10*ztr+c11+c12*zlogt+c13*sal+c14*sal**2
-            ck2 = c20*ztr+c21+c22*sal+c23*sal**2
-C
-C* 2.5 PKW (H2O) (DICKSON AND RILEY, 1979)
-C -----------------------------------------
-C
-            ckw = cw0*ztr+cw1+cw2*zlogt+(cw3*ztr+cw4+cw5*zlogt)*
-     &          zsqrt+cw6*sal
-
-C
-C
-C* 2.10 DISSOCIATION CONSTANT FOR PHOSPHATE AND SILICATE (seawater scale)
-C  ---------------------------------------------------------------------
-C
-            ckp1 = cp10+cp11*ztr+cp12*zlogt+zsqrt*(cp13*ztr
-     &           +cp14)+sal*(cp15*ztr+cp16)
-            ckp2 = cp20+cp21*ztr+cp22*zlogt+zsqrt*(cp23*ztr
-     &           +cp24)+sal*(cp25*ztr+cp26)
-            ckp3 = cp30+cp31*ztr+zsqrt*(cp32*ztr
-     &           +cp33)+sal*(cp34*ztr+cp35)
-            cksi = cs10+cs11*ztr+cs12*zlogt+zisqrt*(cs13*ztr
-     &           +cs14)+zis*(cs15*ztr+cs16)+zis2*(cs17*ztr
-     &           +cs18)+log(1.+cs19*sal)
-     &           +log(cs20+cs21*sal)
-
-C
-C*2.7 APPARENT SOLUBILITY PRODUCT K'SP OF CALCITE IN SEAWATER
-C       (S=27-43, T=2-25 DEG C) AT pres =0 (ATMOSPH. PRESSURE)
-C       (MUCCI 1983)
-C -------------------------------------------------------------
-C
-            aksp0 = akcc1+akcc2*tkel+akcc3*ztr+akcc4*log10(tkel)+
-     &      (akcc5+akcc6*tkel+
-     &      akcc7*ztr)*zsqrt+akcc8*sal+akcc9*sal15
-
-
-C
-C* 2.6 K1, K2 OF CARBONIC ACID, KB OF BORIC ACID, KW (H2O) (LIT.?)
-C -----------------------------------------------------------------
-C
-            ak1   = 10**(ck1)
-            ak2   = 10**(ck2)
-            akb   = exp(ckb)
-            akp1  = exp(ckp1)
-            akp2  = exp(ckp2)
-            akp3  = exp(ckp3)
-            aksi  = exp(cksi)
-            akw   = exp(ckw)
-            aksp1 = 10**(aksp0)
-            aks   = exp(cks)
-            akf   = exp(ckf)
-
-
-C
-C* 2.8 FORMULA FOR CPEXP AFTER EDMOND AND GIESKES (1970)
-C        (REFERENCE TO CULBERSON AND PYTKOQICZ (1968) AS MADE
-C        IN BROECKER ET AL. (1982) IS INCORRECT; HERE RGAS IS
-C        TAKEN TENFOLD TO CORRECT FOR THE NOTATION OF pres  IN
-C        DBAR INSTEAD OF BAR AND THE EXPRESSION FOR CPEXP IS
-C        MULTIPLIED BY LN(10.) TO ALLOW USE OF EXP-FUNCTION
-C        WITH BASIS E IN THE FORMULA FOR AKSPP (CF. EDMOND
-C        AND GIESKES (1970), P. 1285 AND P. 1286 (THE SMALL
-C        FORMULA ON P. 1286 IS RIGHT AND CONSISTENT WITH THE
-C        SIGN IN PARTIAL MOLAR VOLUME CHANGE AS SHOWN ON
-C        P. 1285))
-C -----------------------------------------------------------
-C
-            cpexp = pres /(rgas*tkel)
-            cpexp2 = pres * pres/(rgas*tkel)
-C
-C* 2.9 KB OF BORIC ACID, K1,K2 OF CARBONIC ACID PRESSURE
-C        CORRECTION AFTER CULBERSON AND PYTKOWICZ (1968)
-C        (CF. BROECKER ET AL., 1982)
-C --------------------------------------------------------
-C
-            zbuf1 = -(devk1(3)+devk2(3)*tc+devk3(3)*tc*tc)
-            zbuf2 = 0.5*(devk4(3)+devk5(3)*tc)
-            akb3(ji,jj,jk) = akb*exp(zbuf1*cpexp+zbuf2*cpexp2)
-
-            zbuf1 = -(devk1(1)+devk2(1)*tc+devk3(1)*tc*tc)
-            zbuf2 = 0.5*(devk4(1)+devk5(1)*tc)
-            ak13(ji,jj,jk) = ak1*exp(zbuf1*cpexp+zbuf2*cpexp2)
-
-            zbuf1 = -(devk1(2)+devk2(2)*tc+devk3(2)*tc*tc)
-            zbuf2 = 0.5*(devk4(2)+devk5(2)*tc)
-            ak23(ji,jj,jk) = ak2*exp(zbuf1*cpexp+zbuf2*cpexp2)
-
-            zbuf1 = -(devk1(4)+devk2(4)*tc+devk3(4)*tc*tc)
-            zbuf2 = 0.5*(devk4(4)+devk5(4)*tc)
-            akp13(ji,jj,jk) = akp1*exp(zbuf1*cpexp+zbuf2*cpexp2)
-
-            zbuf1 = -(devk1(5)+devk2(5)*tc+devk3(5)*tc*tc)
-            zbuf2 = 0.5*(devk4(5)+devk5(5)*tc)
-            akp23(ji,jj,jk) = akp2*exp(zbuf1*cpexp+zbuf2*cpexp2)
-
-            zbuf1 = -(devk1(6)+devk2(6)*tc+devk3(6)*tc*tc)
-            zbuf2 = 0.5*(devk4(6)+devk5(6)*tc)
-            akp33(ji,jj,jk) = akp3*exp(zbuf1*cpexp+zbuf2*cpexp2)
-
-            zbuf1 = -(devk1(7)+devk2(7)*tc+devk3(7)*tc*tc)
-            zbuf2 = 0.5*(devk4(7)+devk5(7)*tc)
-            akw3(ji,jj,jk) = akw*exp(zbuf1*cpexp+zbuf2*cpexp2)
-
-C  Ksi
-C            aksi3(ji,jj,jk) = aksi
-C
-C  Or using coefficient of borates (cf millero 95+ corrected version html doc co2sys)
-C  "deltaVsi and deltaKsi have been estimated from the value of boric acid"
-C
-            zbuf1 = -(devk1(3)+devk2(3)*tc+devk3(3)*tc*tc)
-            zbuf2 = 0.5*(devk4(3)+devk5(3)*tc)
-            aksi3(ji,jj,jk) = aksi*exp(zbuf1*cpexp+zbuf2*cpexp2)
-
-C
-C
-C* 2.15 APPARENT SOLUBILITY PRODUCT K'SP OF CALCITE 
-C        AS FUNCTION OF PRESSURE FOLLOWING MILLERO
-C        (P. 1285) AND BERNER (1976)
-C -------------------------------------------------
-
-            zbuf1 = -(devk1(8)+devk2(8)*tc+devk3(8)*tc*tc)
-            zbuf2 = 0.5*(devk4(8)+devk5(8)*tc)
-            aksp(ji,jj,jk) = aksp1*exp(zbuf1*cpexp+zbuf2*cpexp2)
-
-C  Pressure correction for sulfate and fluoride
-C
-            zbuf1 = -(devk1(9)+devk2(9)*tc+devk3(9)*tc*tc)
-            zbuf2 = 0.5*(devk4(9)+devk5(9)*tc)
-            aks3(ji,jj,jk) = aks*exp(zbuf1*cpexp+zbuf2*cpexp2)
-
-            zbuf1 = -(devk1(10)+devk2(10)*tc+devk3(10)*tc*tc)
-            zbuf2 = 0.5*(devk4(10)+devk5(10)*tc)
-            akf3(ji,jj,jk) = akf*exp(zbuf1*cpexp+zbuf2*cpexp2)
-
-
-C
-C* 2.11 TOTAL BORATE CONCENTR. [MOLES/L]
-C --------------------------------------
-C
-            borat(ji,jj,jk) = bor1*cl*bor2
-C
-C  2.12 Iron and SIO3 saturation concentration from ...
-C  ----------------------------------------------------
-C
-         sio3eq(ji,jj,jk)=exp(log(10.)*(6.44-968./tkel))*1E-6
-         fekeq(ji,jj,jk)=10**(17.27-1565.7/(273.15+tc))
-C
-          ENDDO
-        ENDDO
-      END DO
-C
-#endif
-C
-      RETURN
-      END
Index: branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zche.F90
===================================================================
--- branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zche.F90	(revision 775)
+++ branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zche.F90	(revision 775)
@@ -0,0 +1,258 @@
+MODULE p4zche
+   !!======================================================================
+   !!                         ***  MODULE p4zche  ***
+   !! TOP :   PISCES Sea water chemistry computed following OCMIP protocol
+   !!======================================================================
+   !! History :    -   !  1988     (E. Maier-Reimer)  Original code
+   !!              -   !  1998     (O. Aumont)  addition
+   !!              -   !  1999     (C. Le Quere)  modification
+   !!             1.0  !  2004     (O. Aumont)  modification
+   !!              -   !  2006     (R. Gangsto)  modification
+   !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
+   !!----------------------------------------------------------------------
+#if defined key_pisces
+   !!----------------------------------------------------------------------
+   !!   'key_pisces'                                       PISCES bio-model
+   !!----------------------------------------------------------------------
+   !!   p4z_che        :  Sea water chemistry computed following OCMIP protocol
+   !!----------------------------------------------------------------------
+   USE oce_trc         !
+   USE trp_trc         !
+   USE sms             ! 
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   p4z_che    ! called in p4zprg.F90
+
+   !!* Substitution
+#include "domzgr_substitute.h90"
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 2.0 , LOCEAN-IPSL (2007) 
+   !! $Header:$ 
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+   SUBROUTINE p4z_che
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE p4z_che  ***
+      !!
+      !! ** Purpose :   Sea water chemistry computed following OCMIP protocol
+      !!
+      !! ** Method  : - ...
+      !!---------------------------------------------------------------------
+      INTEGER  ::   ji, jj, jk
+      REAL(wp) ::   ztkel, zsal , zqtt  , zbuf1 , zbuf2
+      REAL(wp) ::   zpres, ztc  , zcl   , zcpexp, zcek0, zoxy  , zcpexp2
+      REAL(wp) ::   zsqrt, ztr  , zlogt , zcek1
+      REAL(wp) ::   zlqtt, zqtt2, zsal15, zis   , zis2 , zisqrt
+      REAL(wp) ::   zckb , zck1 , zck2  , zckw  , zak1 , zak2  , zakb , zaksp0, zakw
+      REAL(wp) ::   zckp1, zckp2, zckp3 , zcksi , zakp1, zakp2 , zakp3, zaksi
+      REAL(wp) ::   zst  , zft  , zcks  , zckf  , zaks , zakf  , zaksp1
+      !!---------------------------------------------------------------------
+
+      ! CHEMICAL CONSTANTS - SURFACE LAYER
+      ! ----------------------------------
+
+      DO jj = 1, jpj
+         DO ji = 1, jpi
+
+            !                             ! SET ABSOLUTE TEMPERATURE
+            ztkel = tn(ji,jj,1) + 273.16
+            zqtt  = ztkel * 0.01
+            zqtt2 = zqtt * zqtt
+            zsal  = sn(ji,jj,1) + (1.- tmask(ji,jj,1) ) * 35.
+            zlqtt = LOG( zqtt )
+
+            !                             ! LN(K0) OF SOLUBILITY OF CO2 (EQ. 12, WEISS, 1980)
+            !                             !     AND FOR THE ATMOSPHERE FOR NON IDEAL GAS
+            zcek0 = c00 + c01 / zqtt + c02 * zlqtt + zsal * ( c03 + c04 * zqtt + c05 * zqtt2 )
+            zcek1 = ca0 + ca1 / zqtt + ca2 * zlqtt + ca3 * zqtt2 + zsal*( ca4 + ca5 * zqtt + ca6 * zqtt2 )
+
+            !                             ! LN(K0) OF SOLUBILITY OF O2 and N2 (EQ. 4, WEISS, 1970)
+            zoxy  = ox0 + ox1 / zqtt + ox2 * zlqtt + zsal * ( ox3 + ox4 * zqtt + ox5 * zqtt2 )
+
+            !                             ! SET SOLUBILITIES OF O2 AND CO2
+            chemc(ji,jj,1) = EXP( zcek0 ) * 1.e-6 * rhop(ji,jj,1) / 1000.
+            chemc(ji,jj,2) = EXP( zoxy  ) * oxyco
+            chemc(ji,jj,3) = EXP( zcek1 ) * 1.e-6 * rhop(ji,jj,1) / 1000.
+
+         END DO
+      END DO
+
+      ! CHEMICAL CONSTANTS - DEEP OCEAN
+      ! -------------------------------
+
+      DO jk = 1, jpk
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+
+               ! SET PRESSION
+               zpres   = 1.025e-1 * fsdept(ji,jj,jk)
+
+               ! SET ABSOLUTE TEMPERATURE
+               ztkel   = tn(ji,jj,jk) + 273.16
+               zqtt    = ztkel * 0.01
+               zsal    = sn(ji,jj,jk) + ( 1.-tmask(ji,jj,jk) ) * 35.
+               zsqrt  = SQRT( zsal )
+               zsal15  = zsqrt * zsal
+               zlogt  = LOG( ztkel )
+               ztr    = 1. / ztkel
+               zis    = 19.924 * zsal / ( 1000.- 1.005 * zsal )
+               zis2   = zis * zis
+               zisqrt = SQRT( zis )
+               ztc     = tn(ji,jj,jk) + ( 1.- tmask(ji,jj,jk) ) * 20.
+
+               ! CHLORINITY (WOOSTER ET AL., 1969)
+               zcl     = zsal * salchl
+
+               ! TOTAL SULFATE CONCENTR. [MOLES/kg soln]
+               zst     = st1 * zcl * st2
+
+               ! TOTAL FLUORIDE CONCENTR. [MOLES/kg soln]
+               zft     = ft1 * zcl * ft2
+
+               ! DISSOCIATION CONSTANT FOR SULFATES on free H scale (Dickson 1990)
+               zcks    = EXP(  ks1 * ztr + ks0 + ks2 * zlogt                           &
+                  &                     + ( ks3 * ztr + ks4 + ks5 * zlogt ) * zisqrt   &
+                  &                     + ( ks6 * ztr + ks7 + ks8 * zlogt ) * zis      &
+                  &                     + ks9 * ztr * zis * zisqrt + ks10 * ztr *zis2 + LOG( ks11 + ks12 *zsal )  )
+
+               ! DISSOCIATION CONSTANT FOR FLUORIDES on free H scale (Dickson and Riley 79)
+               zckf    = EXP(  kf1 * ztr + kf0 + kf2 * zisqrt + LOG( kf3 + kf4 * zsal )  )
+
+               ! DISSOCIATION CONSTANT FOR CARBONATE AND BORATE
+               zckb    = ( cb0 + cb1 * zsqrt + cb2  * zsal + cb3 * zsal15 + cb4 * zsal * zsal ) * ztr   &
+                  &    + ( cb5 + cb6 * zsqrt + cb7  * zsal )                                            &
+                  &    + ( cb8 + cb9 * zsqrt + cb10 * zsal ) * zlogt + cb11 * zsqrt * ztkel             &
+                  &    + LOG(  ( 1.+ zst / zcks + zft / zckf ) / ( 1.+ zst / zcks )  )
+!!gm zsal**2 to be replaced by a *...
+               zck1    = c10 * ztr + c11 + c12 * zlogt + c13 * zsal + c14 * zsal**2
+               zck2    = c20 * ztr + c21 + c22 * zsal   + c23 * zsal**2
+
+               ! PKW (H2O) (DICKSON AND RILEY, 1979)
+               zckw    = cw0 * ztr + cw1 + cw2 * zlogt + ( cw3 * ztr + cw4 + cw5 * zlogt ) * zsqrt + cw6 * zsal
+
+               ! DISSOCIATION CONSTANT FOR PHOSPHATE AND SILICATE (seawater scale)
+               zckp1 = cp10 + cp11 * ztr + cp12 * zlogt + zsqrt * ( cp13 * ztr + cp14 ) + zsal * ( cp15 * ztr + cp16 )
+               zckp2 = cp20 + cp21 * ztr + cp22 * zlogt + zsqrt * ( cp23 * ztr + cp24 ) + zsal * ( cp25 * ztr + cp26 )
+               zckp3 = cp30 + cp31 * ztr                + zsqrt * ( cp32 * ztr + cp33 ) + zsal * ( cp34 * ztr + cp35 )
+               zcksi = cs10 + cs11 * ztr + cs12 * zlogt + zisqrt* ( cs13 * ztr + cs14 ) + zis * ( cs15 * ztr + cs16 )  &
+                  &                                    + zis2  * ( cs17 * ztr + cs18 ) + LOG( 1.   + cs19 * zsal )     &
+                  &                                                                    + LOG( cs20 + cs21 * zsal )
+
+               ! APPARENT SOLUBILITY PRODUCT K'SP OF CALCITE IN SEAWATER
+               !       (S=27-43, T=2-25 DEG C) at pres =0 (atmos. pressure) (MUCCI 1983)
+               zaksp0  = akcc1 + akcc2 * ztkel + akcc3 * ztr + akcc4 * LOG10( ztkel )   &
+                  &   + ( akcc5 + akcc6 * ztkel + akcc7 * ztr ) * zsqrt + akcc8 * zsal + akcc9 * zsal15
+
+               ! K1, K2 OF CARBONIC ACID, KB OF BORIC ACID, KW (H2O) (LIT.?)
+               zak1    = 10**(zck1)
+               zak2    = 10**(zck2)
+               zakb    = EXP( zckb  )
+               zakp1   = EXP( zckp1 )
+               zakp2   = EXP( zckp2 )
+               zakp3   = EXP( zckp3 )
+               zaksi   = EXP( zcksi )
+               zakw    = EXP( zckw )
+               zaksp1  = 10**(zaksp0)
+               zaks    = exp( zcks )
+               zakf    = exp( zckf )
+
+               ! FORMULA FOR CPEXP AFTER EDMOND & GIESKES (1970)
+               !        (REFERENCE TO CULBERSON & PYTKOQICZ (1968) AS MADE
+               !        IN BROECKER ET AL. (1982) IS INCORRECT; HERE RGAS IS
+               !        TAKEN TENFOLD TO CORRECT FOR THE NOTATION OF pres  IN
+               !        DBAR INSTEAD OF BAR AND THE EXPRESSION FOR CPEXP IS
+               !        MULTIPLIED BY LN(10.) TO ALLOW USE OF EXP-FUNCTION
+               !        WITH BASIS E IN THE FORMULA FOR AKSPP (CF. EDMOND
+               !        & GIESKES (1970), P. 1285-1286 (THE SMALL
+               !        FORMULA ON P. 1286 IS RIGHT AND CONSISTENT WITH THE
+               !        SIGN IN PARTIAL MOLAR VOLUME CHANGE AS SHOWN ON P. 1285))
+               zcpexp  = zpres /(rgas*ztkel)
+               zcpexp2 = zpres * zpres/(rgas*ztkel)
+
+               ! KB OF BORIC ACID, K1,K2 OF CARBONIC ACID PRESSURE
+               !        CORRECTION AFTER CULBERSON AND PYTKOWICZ (1968)
+               !        (CF. BROECKER ET AL., 1982)
+               zbuf1  =     - ( devk1(3) + devk2(3) * ztc + devk3(3) * ztc * ztc )
+               zbuf2  = 0.5 * ( devk4(3) + devk5(3) * ztc )
+               akb3(ji,jj,jk) = zakb * EXP( zbuf1 * zcpexp + zbuf2 * zcpexp2 )
+
+               zbuf1  = -(devk1(1)+devk2(1)*ztc+devk3(1)*ztc*ztc)
+               zbuf2  = 0.5*(devk4(1)+devk5(1)*ztc)
+               ak13(ji,jj,jk) = zak1 * EXP( zbuf1 * zcpexp + zbuf2 * zcpexp2 )
+
+               zbuf1  =     - ( devk1(2) + devk2(2) * ztc + devk3(2) * ztc * ztc )
+               zbuf2  = 0.5 * ( devk4(2) + devk5(2) * ztc )
+               ak23(ji,jj,jk) = zak2 * EXP( zbuf1 * zcpexp + zbuf2 * zcpexp2 )
+
+               zbuf1  =     - ( devk1(4) + devk2(4) * ztc + devk3(4) * ztc * ztc )
+               zbuf2  = 0.5 * ( devk4(4) + devk5(4) * ztc )
+               akp13(ji,jj,jk) = zakp1 * EXP( zbuf1 * zcpexp + zbuf2 * zcpexp2 )
+
+               zbuf1  =     - ( devk1(5) + devk2(5) * ztc + devk3(5) * ztc * ztc )
+               zbuf2  = 0.5 * ( devk4(5) + devk5(5) * ztc )
+               akp23(ji,jj,jk) = zakp2 * EXP( zbuf1 * zcpexp + zbuf2 * zcpexp2 )
+
+               zbuf1  =     - ( devk1(6) + devk2(6) * ztc + devk3(6) * ztc * ztc )
+               zbuf2  = 0.5 * ( devk4(6) + devk5(6) * ztc )
+               akp33(ji,jj,jk) = zakp3 * EXP( zbuf1 * zcpexp + zbuf2 * zcpexp2 )
+
+               zbuf1  =     - ( devk1(7) + devk2(7) * ztc + devk3(7) * ztc * ztc )
+               zbuf2  = 0.5 * ( devk4(7) + devk5(7) * ztc )
+               akw3(ji,jj,jk) = zakw * EXP( zbuf1 * zcpexp + zbuf2 * zcpexp2 )
+
+               !  Ksi
+               !            aksi3(ji,jj,jk) = zaksi
+               !
+               !  Or using coefficient of borates (cf millero 95+ corrected version html doc co2sys)
+               !  "deltaVsi and deltaKsi have been estimated from the value of boric acid"
+               zbuf1  =     - ( devk1(3) + devk2(3) * ztc + devk3(3) * ztc * ztc )
+               zbuf2  = 0.5 * ( devk4(3) + devk5(3) * ztc )
+               aksi3(ji,jj,jk) = zaksi * EXP( zbuf1 * zcpexp + zbuf2 * zcpexp2 )
+
+               ! APPARENT SOLUBILITY PRODUCT K'SP OF CALCITE 
+               !        AS FUNCTION OF PRESSURE FOLLOWING MILLERO
+               !        (P. 1285) AND BERNER (1976)
+               zbuf1  =     - ( devk1(8) + devk2(8) * ztc + devk3(8) * ztc * ztc )
+               zbuf2  = 0.5 * ( devk4(8) + devk5(8) * ztc )
+               aksp(ji,jj,jk) = zaksp1 * EXP( zbuf1 * zcpexp + zbuf2 * zcpexp2 )
+
+               !  Pressure correction for sulfate and fluoride
+               zbuf1  =     - ( devk1(9) + devk2(9) * ztc + devk3(9) * ztc * ztc )
+               zbuf2  = 0.5 * ( devk4(9) + devk5(9) * ztc )
+               aks3(ji,jj,jk) = zaks   * EXP( zbuf1 * zcpexp + zbuf2 * zcpexp2 )
+
+               zbuf1  =     - ( devk1(10) + devk2(10) * ztc + devk3(10) * ztc * ztc )
+               zbuf2  = 0.5 * ( devk4(10) + devk5(10) * ztc )
+               akf3(ji,jj,jk) = zakf   * EXP( zbuf1 * zcpexp + zbuf2 * zcpexp2 )
+
+               ! TOTAL BORATE CONCENTR. [MOLES/L]
+               borat(ji,jj,jk) = bor1 * zcl * bor2
+
+               ! Iron and SIO3 saturation concentration from ...
+               sio3eq(ji,jj,jk) = EXP(  LOG( 10.) * ( 6.44 - 968. / ztkel )  ) * 1.e-6
+               fekeq (ji,jj,jk) = 10**( 17.27 - 1565.7 / ( 273.15 + ztc ) )
+
+            END DO
+         END DO
+      END DO
+      !
+   END SUBROUTINE p4z_che
+
+#else
+   !!======================================================================
+   !!  Dummy module :                                   No PISCES bio-model
+   !!======================================================================
+CONTAINS
+   SUBROUTINE p4z_che( kt )                   ! Empty routine
+      INTEGER, INTENT( in ) ::   kt
+      WRITE(*,*) 'p4z_che: You should not have seen this print! error?', kt
+   END SUBROUTINE p4z_che
+#endif 
+
+   !!======================================================================
+END MODULE  p4zche
Index: branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zday.F
===================================================================
--- branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zday.F	(revision 773)
+++ 	(revision )
@@ -1,85 +1,0 @@
-CCC$Header$
-CCC  TOP 1.0 , LOCEAN-IPSL (2005)
-C This software is governed by CeCILL licence see modipsl/doc/NEMO_CeCILL.txt
-C ---------------------------------------------------------------------------
-CDIR$ LIST
-      SUBROUTINE p4zday
-#if defined key_top && defined key_pisces
-CCC---------------------------------------------------------------------
-CCC
-CCC          ROUTINE p4zday : PISCES MODEL
-CCC          *****************************
-CCC
-CCC  PURPOSE :
-CCC  ---------
-CCC        PISCES : compute the day length depending on latitude
-CCC                 and the day
-CCC
-CC   INPUT :
-CC   -----
-CC      argument
-CC              ktask           : task identificator
-CC      common
-CC              all the common defined in opa
-CC
-CC
-CC   OUTPUT :                   : no
-CC   ------
-CC
-CC   EXTERNAL :
-CC   --------
-CC            None
-CC
-CC   MODIFICATIONS:
-CC   --------------
-CC      original  : E. Maier-Reimer (GBC 1993)
-CC      additions : C. Le Quere (1999)
-CC      modifications : O. Aumont (2004)
-CC----------------------------------------------------------------------
-CC parameters and commons
-CC ======================
-      USE oce_trc
-      USE trp_trc
-      USE sms
-      IMPLICIT NONE
-CC----------------------------------------------------------------------
-CC local declarations
-CC ==================
-      INTEGER ji, jj, iyy
-      REAL rum, delta, codel, phi, argu
-C
-C Get year
-C --------
-C
-      iyy = ndastp/10000
-
-       IF(lwp) write(numout,*)
-       IF(lwp) write(numout,*) 'p4zday - Julian day ', nday_year
-       IF(lwp) write(numout,*)
-
-
-      IF (nleapy.EQ.1 .AND. MOD(iyy,4).EQ.0) THEN
-          rum = FLOAT(nday_year-80)/366.
-      ELSE
-          rum = FLOAT(nday_year-80)/365.
-      ENDIF
-
-C
-      delta = SIN(rum*rpi*2.)*sin(rpi*23.5/180.)
-      codel = asin(delta)
-
-      DO jj = 1,jpj
-        DO ji = 1,jpi
-          phi = gphit(ji,jj)*rpi/180.
-          argu = tan(codel)*tan(phi)
-          strn(ji,jj) = 0.
-          argu=min(1.,argu)
-          argu=max(-1.,argu)
-          strn(ji,jj)=24.-2.*acos(argu)*180./rpi/15.
-          strn(ji,jj)=max(strn(ji,jj),0.)
-        END DO
-      END DO
-C
-#endif
-      RETURN
-      END
Index: branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zday.F90
===================================================================
--- branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zday.F90	(revision 775)
+++ branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zday.F90	(revision 775)
@@ -0,0 +1,92 @@
+MODULE p4zday
+   !!======================================================================
+   !!                         ***  MODULE p4zday  ***
+   !! TOP :   PISCES compute the day length depending on latitude and the day
+   !!======================================================================
+   !! History :    -   !  1993     (E. Maier-Reimer) Original code GBC 1993
+   !!              -   !  1999     (C. Le Quere)
+   !!             1.0  !  2004     (O. Aumont) Original code
+   !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
+   !!----------------------------------------------------------------------
+#if defined key_pisces
+   !!----------------------------------------------------------------------
+   !!   'key_pisces'                                       PISCES bio-model
+   !!----------------------------------------------------------------------
+   !!   p4z_day       :   compute the day length depending on latitude and the day
+   !!----------------------------------------------------------------------
+   USE oce_trc         !
+   USE trp_trc         ! 
+   USE sms             ! 
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   p4z_day    ! called in p4zprod.F90
+
+   !!* Substitution
+#  include "domzgr_substitute.h90"
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 2.0 , LOCEAN-IPSL (2007) 
+   !! $Header:$ 
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+   SUBROUTINE p4z_day
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE p4z_day  ***
+      !!
+      !! ** Purpose :   compute the day length depending on latitude and the day
+      !!
+      !! ** Method  : - ???
+      !!---------------------------------------------------------------------
+      INTEGER  ::   ji, jj
+      INTEGER  ::   iyy
+      REAL(wp) ::   zrum, zdelta, zcodel, zphi, zargu
+      !!---------------------------------------------------------------------
+
+      ! Get year
+      ! --------
+
+      iyy = ndastp / 10000
+
+      IF(lwp) write(numout,*)
+      IF(lwp) write(numout,*) 'p4zday : - Julian day ', nday_year
+      IF(lwp) write(numout,*) '~~~~~~'
+
+
+      IF( nleapy == 1 .AND. MOD( iyy, 4 ) == 0 ) THEN
+         zrum = FLOAT( nday_year - 80 ) / 366.
+      ELSE
+         zrum = FLOAT( nday_year - 80 ) / 365.
+      ENDIF
+
+      zdelta = SIN( zrum * rpi * 2. ) * sin( rpi * 23.5 / 180. )
+      zcodel = ASIN( zdelta )
+
+      DO jj = 1, jpj
+         DO ji = 1, jpi
+            zphi = gphit(ji,jj) * rpi / 180.
+            zargu = TAN( zcodel ) * TAN( zphi )
+            strn(ji,jj) = 0.e0
+            zargu = MIN(  1., zargu )
+            zargu = MAX( -1., zargu )
+            strn(ji,jj) = 24.- 2.* ACOS( zargu ) * 180./ rpi / 15.
+            strn(ji,jj) = MAX( strn(ji,jj), 0.e0 )
+         END DO
+      END DO
+      !
+   END SUBROUTINE p4z_day
+
+#else
+   !!======================================================================
+   !!  Dummy module :                                   No PISCES bio-model
+   !!======================================================================
+CONTAINS
+   SUBROUTINE p4z_day                    ! Empty routine
+   END SUBROUTINE p4z_day
+#endif 
+
+   !!======================================================================
+END MODULE  p4zday
Index: branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zdiat.F
===================================================================
--- branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zdiat.F	(revision 773)
+++ 	(revision )
@@ -1,113 +1,0 @@
-
-CCC $Header$ 
-CCC  TOP 1.0 , LOCEAN-IPSL (2005) 
-C This software is governed by CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
-C ---------------------------------------------------------------------------
-CDIR$ LIST
-      SUBROUTINE p4zdiat
-#if defined key_top && defined key_pisces
-CCC---------------------------------------------------------------------
-CCC
-CCC           ROUTINE p4zdiat : PISCES MODEL
-CCC           ******************************
-CCC
-CCC  PURPOSE :
-CCC  ---------
-CCC         Compute the mortality terms for diatoms
-CCC
-CC   INPUT :
-CC   -----
-CC      argument
-CC              None
-CC      common
-CC              all the common defined in opa
-CC
-CC
-CC   OUTPUT :                   : no
-CC   ------
-CC
-CC   EXTERNAL :
-CC   --------
-CC           None
-CC
-CC   MODIFICATIONS:
-CC   --------------
-CC      original  : O. Aumont (2002)
-CC----------------------------------------------------------------------
-CC parameters and commons
-CC ======================
-CDIR$ NOLIST
-      USE oce_trc
-      USE trp_trc
-      USE sms
-      IMPLICIT NONE
-CDIR$ LIST
-CC----------------------------------------------------------------------
-CC local declarations
-CC ==================
-      INTEGER ji, jj, jk
-      REAL zfact,zstep,compadi
-C
-C      Time step duration for biology
-C      ------------------------------
-C
-        zstep=rfact2/rjjss
-C
-C    Aggregation term for diatoms is increased in case of nutrient
-C    stress as observed in reality. The stressed cells become more
-C    sticky and coagulate to sink quickly out of the euphotic zone
-C     ------------------------------------------------------------
-C
-        DO jk = 1,jpkm1
-          DO jj = 1,jpj
-            DO ji = 1,jpi
-C
-        compadi = max((trn(ji,jj,jk,jpdia)-1E-8),0.)
-        zfact=1./(trn(ji,jj,jk,jpdia)+rtrn)
-C
-C    Aggregation term for diatoms is increased in case of nutrient
-C    stress as observed in reality. The stressed cells become more
-C    sticky and coagulate to sink quickly out of the euphotic zone
-C     ------------------------------------------------------------
-C
-        respp2(ji,jj,jk) = 1E6*zstep
-     &    *(wchl+wchld*(1.-xlimdia(ji,jj,jk)))
-     &    *zdiss(ji,jj,jk)*compadi*trn(ji,jj,jk,jpdia)
-#    if defined key_off_degrad
-     &    *facvol(ji,jj,jk)
-#    endif
-                                                                               
-        respds(ji,jj,jk) = respp2(ji,jj,jk)
-     &    *trn(ji,jj,jk,jpbsi)*zfact
-
-        respdf(ji,jj,jk) = respp2(ji,jj,jk)
-     &    *trn(ji,jj,jk,jpdfe)*zfact
-                                                                               
-        respdch(ji,jj,jk)=respp2(ji,jj,jk)
-     &    *trn(ji,jj,jk,jpdch)*zfact
-C
-C     Phytoplankton mortality. 
-C     ------------------------
-C
-        tortp2(ji,jj,jk) = mprat2*zstep*trn(ji,jj,jk,jpdia)
-     &    /(xkmort+trn(ji,jj,jk,jpdia))*compadi
-#    if defined key_off_degrad
-     &    *facvol(ji,jj,jk)
-#    endif
-
-        tortds(ji,jj,jk) = tortp2(ji,jj,jk)
-     &    *trn(ji,jj,jk,jpbsi)*zfact
-
-        tortdf(ji,jj,jk)=tortp2(ji,jj,jk)
-     &    *trn(ji,jj,jk,jpdfe)*zfact
-
-        tortdch(ji,jj,jk)=tortp2(ji,jj,jk)
-     &    *trn(ji,jj,jk,jpdch)*zfact
-C
-            END DO
-          END DO
-        END DO
-C
-#endif
-      RETURN
-      END
Index: branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zdiat.F90
===================================================================
--- branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zdiat.F90	(revision 775)
+++ branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zdiat.F90	(revision 775)
@@ -0,0 +1,108 @@
+MODULE p4zdiat
+   !!======================================================================
+   !!                         ***  MODULE p4zdiat  ***
+   !! TOP :   PISCES Compute the mortality terms for diatoms
+   !!======================================================================
+   !! History :   1.0  !  2002     (O. Aumont)  Original code
+   !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
+   !!----------------------------------------------------------------------
+#if defined key_pisces
+   !!----------------------------------------------------------------------
+   !!   'key_pisces'                                       PISCES bio-model
+   !!----------------------------------------------------------------------
+   !!   p4z_diat       :   Compute the mortality terms for diatoms
+   !!----------------------------------------------------------------------
+   USE oce_trc         !
+   USE trp_trc         ! 
+   USE sms             ! 
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   p4z_diat    ! called in p4zbio.F90
+
+   !!* Substitution
+#  include "domzgr_substitute.h90"
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 2.0 , LOCEAN-IPSL (2007) 
+   !! $Header:$ 
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+   SUBROUTINE p4z_diat
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE p4z_diat  ***
+      !!
+      !! ** Purpose :   Compute the mortality terms for diatoms
+      !!
+      !! ** Method  : - ???
+      !!---------------------------------------------------------------------
+      INTEGER  ::   ji, jj, jk
+      REAL(wp) ::   zfact, zstep, zcompadi
+      !!---------------------------------------------------------------------
+
+        zstep = rfact2 / rjjss      ! Time step duration for biology
+
+
+!    Aggregation term for diatoms is increased in case of nutrient
+!    stress as observed in reality. The stressed cells become more
+!    sticky and coagulate to sink quickly out of the euphotic zone
+!     ------------------------------------------------------------
+
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+
+               zcompadi = MAX( ( trn(ji,jj,jk,jpdia) - 1e-8), 0. )
+               zfact    = 1. / ( trn(ji,jj,jk,jpdia) + rtrn )
+
+!    Aggregation term for diatoms is increased in case of nutrient
+!    stress as observed in reality. The stressed cells become more
+!    sticky and coagulate to sink quickly out of the euphotic zone
+!     ------------------------------------------------------------
+
+               respp2 (ji,jj,jk) = 1.e6 * zstep * (  wchl + wchld * ( 1.- xlimdia(ji,jj,jk) )  )    &
+# if defined key_off_degrad
+                  &              * facvol(ji,jj,jk)       &
+# endif
+                  &              * zdiss(ji,jj,jk) * zcompadi * trn(ji,jj,jk,jpdia)
+                                                                               
+               respds (ji,jj,jk) = respp2(ji,jj,jk) * trn(ji,jj,jk,jpbsi) * zfact
+
+               respdf (ji,jj,jk) = respp2(ji,jj,jk) * trn(ji,jj,jk,jpdfe) * zfact
+                                                                               
+               respdch(ji,jj,jk) = respp2(ji,jj,jk) * trn(ji,jj,jk,jpdch) * zfact
+
+!     Phytoplankton mortality. 
+!     ------------------------
+               tortp2 (ji,jj,jk) = mprat2 * zstep * trn(ji,jj,jk,jpdia)     &
+# if defined key_off_degrad
+                  &              * facvol(ji,jj,jk)       &
+# endif
+                  &              / ( xkmort + trn(ji,jj,jk,jpdia) ) * zcompadi
+
+               tortds (ji,jj,jk) = tortp2(ji,jj,jk) * trn(ji,jj,jk,jpbsi) * zfact
+
+               tortdf (ji,jj,jk) = tortp2(ji,jj,jk) * trn(ji,jj,jk,jpdfe) * zfact
+
+               tortdch(ji,jj,jk) = tortp2(ji,jj,jk) * trn(ji,jj,jk,jpdch) * zfact
+
+            END DO
+         END DO
+      END DO
+      !
+   END SUBROUTINE p4z_diat
+
+#else
+   !!======================================================================
+   !!  Dummy module :                                   No PISCES bio-model
+   !!======================================================================
+CONTAINS
+   SUBROUTINE p4z_diat                    ! Empty routine
+   END SUBROUTINE p4z_diat
+#endif 
+
+   !!======================================================================
+END MODULE  p4zdiat
Index: branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zflx.F
===================================================================
--- branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zflx.F	(revision 773)
+++ 	(revision )
@@ -1,192 +1,0 @@
-
-CCC $Header$ 
-CCC  TOP 1.0 , LOCEAN-IPSL (2005) 
-C This software is governed by CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
-C ---------------------------------------------------------------------------
-CDIR$ LIST
-      SUBROUTINE p4zflx
-#if defined key_top && defined key_pisces
-CCC---------------------------------------------------------------------
-CCC
-CCC          ROUTINE p4zflx : PISCES MODEL
-CCC          *****************************
-CCC
-CCC
-CC     PURPOSE.
-CC     --------
-CC          *P4ZFLX* CALCULATES GAS EXCHANGE AND CHEMISTRY AT SEA SURFACE
-CC
-CC     EXTERNALS.
-CC     ----------
-CC          NONE.
-CC
-CC   MODIFICATIONS:
-CC   --------------
-CC      original      : 1988-07 E. MAIER-REIMER      MPI HAMBURG
-CC      additions     : 1998    O. Aumont
-CC      modifications : 1999    C. Le Quere
-CC      modifications : 2004    O. Aumont
-CC     -----------------------------------------------------------------
-CC  parameters and commons
-CC ======================
-CDIR$ NOLIST
-      USE oce_trc
-      USE trp_trc
-      USE sms
-      IMPLICIT NONE
-#include "domzgr_substitute.h90"
-CDIR$ LIST
-CC----------------------------------------------------------------------
-CC local declarations
-CC ==================
-C
-      INTEGER nspyr, ji, jj, krorr
-      REAL zpdtan
-      REAL kgco2(jpi,jpj),kgo2(jpi,jpj),h2co3(jpi,jpj)
-      REAL ttc, ws
-      REAL fld, flu, oxy16, flu16, zfact
-      REAL zph,ah2,zbot,zdic,zalk,schmitto2, zalka
-      REAL schmittco2
-C
-C
-C  1. ASSIGNATION TO EXPONENTS IN THE LISS AND MERLIVAT
-C     FORMULATION OF THE GAS EXCHANGE RATE
-c -----------------------------------------------------
-C
-      zpdtan = raass / rdt
-      nspyr  = nint(zpdtan)
-
-C
-C* 1.1 SURFACE CHEMISTRY (PCO2 AND [H+] IN
-C     SURFACE LAYER); THE RESULT OF THIS CALCULATION
-C     IS USED TO COMPUTE AIR-SEA FLUX OF CO2
-C ---------------------------------------------------
-C
-      DO krorr = 1,10
-C
-        DO jj = 1,jpj
-          DO ji = 1,jpi
-C
-C* 1.2 DUMMY VARIABLES FOR DIC, H+, AND BORATE
-C --------------------------------------------
-C
-        zbot = borat(ji,jj,1)
-        zfact = rhop(ji,jj,1)/1000.+rtrn
-        zdic  = trn(ji,jj,1,jpdic)/zfact
-        zph = max(hi(ji,jj,1),1.E-10)/zfact
-        zalka = trn(ji,jj,1,jptal)/zfact
-C
-C* 1.3 CALCULATE [ALK]([CO3--], [HCO3-])
-C ------------------------------------
-C
-        zalk=zalka-
-     &        (akw3(ji,jj,1)/zph-zph+zbot/(1.+zph/akb3(ji,jj,1)))
-C
-C* 1.4 CALCULATE [H+] AND [H2CO3]
-C -----------------------------------------
-C
-         ah2=sqrt((zdic-zalk)**2+4*(zalk*ak23(ji,jj,1)
-     &     /ak13(ji,jj,1))*(2*zdic-zalk))
-        ah2=0.5*ak13(ji,jj,1)/zalk*((zdic-zalk)+ah2)
-        h2co3(ji,jj) = (2*zdic-zalk)/(2.+ak13(ji,jj,1)/ah2)*zfact
-        hi(ji,jj,1)  = ah2*zfact
-          END DO
-        END DO
-      END DO
-C
-C
-C 2. COMPUTE FLUXES
-C --------------
-C
-C 2.1 FIRST COMPUTE GAS EXCHANGE COEFFICIENTS
-C -------------------------------------------
-C
-      DO jj = 1,jpj
-        DO ji = 1,jpi
-C
-          ttc = min(35.,tn(ji,jj,1))
-          schmittco2=2073.1-125.62*ttc+3.6276*ttc**2
-     &      -0.043126*ttc**3
-          ws=vatm(ji,jj)
-C
-C 2.2 COMPUTE GAS EXCHANGE FOR CO2
-C --------------------------------
-C
-          kgco2(ji,jj) = (0.3*ws*ws + 2.5*(0.5246+ttc*(0.016256+
-     &      ttc*0.00049946)))*sqrt(660./schmittco2)
-C
-C 2.3 CONVERT TO m/s, and apply sea-ice cover
-C -----------------------------------------------------
-C
-          kgco2(ji,jj) = kgco2(ji,jj)/(100.*3600.)
-     &      *(1-freeze(ji,jj))*tmask(ji,jj,1)
-#    if defined key_off_degrad
-     &        *facvol(ji,jj,1)
-#    endif
-C
-         END DO
-       END DO
-C
-C 2.5 COMPUTE GAS EXCHANGE COEFFICIENT FO O2 FROM
-C      Waninkhof EQUATIONS
-C -----------------------------------------------
-C
-       DO jj = 1,jpj
-         DO ji = 1,jpi
-C
-          ws = vatm(ji,jj)
-          ttc = min(35.,tn(ji,jj,1))
-          schmitto2 = 1953.4-128.0*ttc+3.9918*ttc**2
-     &      -0.050091*ttc**3
-
-          kgo2(ji,jj) = (0.3*ws*ws + 2.5*(0.5246+ttc*(0.016256+
-     &      ttc*0.00049946)))*sqrt(660./schmitto2)
-
-C
-C CONVERT TO m/s AND APPLY SEA ICE COVER
-C -------------------------------------
-C
-          kgo2(ji,jj) = kgo2(ji,jj)/(100.*3600.)
-     &      *(1-freeze(ji,jj))*tmask(ji,jj,1)
-#    if defined key_off_degrad
-     &        *facvol(ji,jj,1)
-#    endif
-C
-         ENDDO
-       ENDDO
-C
-       DO jj = 1,jpj
-         DO ji = 1,jpi
-C
-C Compute CO2 flux for the sea and air
-C ------------------------------------
-C
-          fld = atcco2*tmask(ji,jj,1)*chemc(ji,jj,3)*kgco2(ji,jj)
-          flu = h2co3(ji,jj)*tmask(ji,jj,1)*kgco2(ji,jj)
-          tra(ji,jj,1,jpdic)= tra(ji,jj,1,jpdic)+(fld-flu)
-     &      /fse3t(ji,jj,1)
-C
-C Compute O2 flux 
-C ---------------
-C
-          oxy16 = trn(ji,jj,1,jpoxy)
-          flu16 = (atcox*chemc(ji,jj,2)-oxy16)*kgo2(ji,jj)
-          tra(ji,jj,1,jpoxy) = tra(ji,jj,1,jpoxy)+flu16
-     &      /fse3t(ji,jj,1)
-C
-C Save diagnostics
-C ----------------
-C
-#    if defined key_trc_diaadd
-          trc2d(ji,jj,1) = (fld-flu)*1000.
-          trc2d(ji,jj,2) = flu16*1000.
-          trc2d(ji,jj,3) = kgco2(ji,jj)
-          trc2d(ji,jj,4) = atcco2-h2co3(ji,jj)/(chemc(ji,jj,3)+rtrn)
-#    endif
-C
-        END DO
-      END DO
-C
-#endif
-      RETURN
-      END
Index: branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zflx.F90
===================================================================
--- branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zflx.F90	(revision 775)
+++ branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zflx.F90	(revision 775)
@@ -0,0 +1,179 @@
+MODULE p4zflx
+   !!======================================================================
+   !!                         ***  MODULE p4zflx  ***
+   !! TOP :   PISCES CALCULATES GAS EXCHANGE AND CHEMISTRY AT SEA SURFACE
+   !!======================================================================
+   !! History :    -   !  1988-07  (E. MAIER-REIMER) Original code
+   !!              -   !  1998     (O. Aumont) additions
+   !!              -   !  1999     (C. Le Quere) modifications
+   !!             1.0  !  2004     (O. Aumont) modifications
+   !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
+   !!----------------------------------------------------------------------
+#if defined key_pisces
+   !!----------------------------------------------------------------------
+   !!   'key_pisces'                                       PISCES bio-model
+   !!----------------------------------------------------------------------
+   !!   p4z_flx       :   CALCULATES GAS EXCHANGE AND CHEMISTRY AT SEA SURFACE
+   !!----------------------------------------------------------------------
+   USE oce_trc         !
+   USE trp_trc
+   USE sms
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   p4z_flx    ! called in p4zprg.F90
+
+   !!* Substitution
+#  include "domzgr_substitute.h90"
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 2.0 , LOCEAN-IPSL (2007) 
+   !! $Header:$ 
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+   SUBROUTINE p4z_flx
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE p4z_flx  ***
+      !!
+      !! ** Purpose :   CALCULATES GAS EXCHANGE AND CHEMISTRY AT SEA SURFACE
+      !!
+      !! ** Method  : - ???
+      !!---------------------------------------------------------------------
+      INTEGER  ::   ji, jj, jrorr
+      REAL(wp) ::   zpdtan, zttc, zws
+      REAL(wp) ::   zfld, zflu, zoxy16, zflu16, zfact
+      REAL(wp) ::   zph, zah2, zbot, zdic, zalk, zschmitto2, zalka, zschmittco2
+      REAL(wp), DIMENSION(jpi,jpj) ::   zkgco2, zkgo2, zh2co3
+      !!---------------------------------------------------------------------
+
+      ! -----------------------------------------------------
+      !     ASSIGNATION TO EXPONENTS IN THE LISS AND MERLIVAT
+      !     FORMULATION OF THE GAS EXCHANGE RATE
+      ! -----------------------------------------------------
+
+      zpdtan = raass / rdt
+
+      ! SURFACE CHEMISTRY (PCO2 AND [H+] IN
+      !     SURFACE LAYER); THE RESULT OF THIS CALCULATION
+      !     IS USED TO COMPUTE AIR-SEA FLUX OF CO2
+
+      DO jrorr = 1, 10
+
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+
+               ! DUMMY VARIABLES FOR DIC, H+, AND BORATE
+               zbot  = borat(ji,jj,1)
+               zfact = rhop(ji,jj,1) / 1000. + rtrn
+               zdic  = trn(ji,jj,1,jpdic) / zfact
+               zph   = MAX( hi(ji,jj,1), 1.e-10 ) / zfact
+               zalka = trn(ji,jj,1,jptal) / zfact
+
+               ! CALCULATE [ALK]([CO3--], [HCO3-])
+               zalk  = zalka - (  akw3(ji,jj,1) / zph - zph + zbot / ( 1.+ zph / akb3(ji,jj,1) )  )
+
+               ! CALCULATE [H+] AND [H2CO3]
+               zah2   = SQRT(  (zdic-zalk)**2 + 4.* ( zalk * ak23(ji,jj,1)   &
+                  &                                        / ak13(ji,jj,1) ) * ( 2.* zdic - zalk )  )
+               zah2   = 0.5 * ak13(ji,jj,1) / zalk * ( ( zdic - zalk ) + zah2 )
+               zh2co3(ji,jj) = ( 2.* zdic - zalk ) / ( 2.+ ak13(ji,jj,1) / zah2 ) * zfact
+               hi(ji,jj,1)   = zah2 * zfact
+            END DO
+         END DO
+      END DO
+
+
+      ! --------------
+      ! COMPUTE FLUXES
+      ! --------------
+
+      ! FIRST COMPUTE GAS EXCHANGE COEFFICIENTS
+      ! -------------------------------------------
+
+      DO jj = 1, jpj
+         DO ji = 1, jpi
+
+            zttc = MIN( 35., tn(ji,jj,1) )
+!!gm  optimisation & more precise computation with factorisation of the polynome
+            zschmittco2 = 2073.1 - 125.62 * zttc + 3.6276 * zttc**2 - 0.043126 * zttc**3
+            zws         = vatm(ji,jj)
+
+            ! COMPUTE GAS EXCHANGE FOR CO2
+            zkgco2(ji,jj) = (  0.3 * zws * zws    &
+               &             + 2.5 * ( 0.5246 + zttc * ( 0.016256 + zttc * 0.00049946 ) )  )   &
+               &          * SQRT( 660./ zschmittco2 )
+
+            ! CONVERT TO m/s, and apply sea-ice cover
+            zkgco2(ji,jj) = zkgco2(ji,jj) / ( 100. * 3600. )      &
+# if defined key_off_degrad
+               &         * facvol(ji,jj,1)      &
+# endif
+               &         * ( 1.- freeze(ji,jj) ) * tmask(ji,jj,1)
+
+         END DO
+      END DO
+
+      ! COMPUTE GAS EXCHANGE COEFFICIENT FO O2 FROM Waninkhof EQUATIONS
+      DO jj = 1, jpj
+         DO ji = 1, jpi
+
+          zws  = vatm(ji,jj)
+          zttc = MIN( 35., tn(ji,jj,1) )
+!!gm  optimisation & more precise computation with factorisation of the polynome
+          zschmitto2   = 1953.4 - 128.0 * zttc + 3.9918 * zttc**2 - 0.050091 * zttc**3
+
+          zkgo2(ji,jj) = (  0.3 * zws * zws   &
+             &            + 2.5 * ( 0.5246 + zttc * ( 0.016256 + zttc * 0.00049946 ) )  )   &
+             &         * SQRT( 660./ zschmitto2 )
+
+          ! CONVERT TO m/s AND APPLY SEA ICE COVER
+          zkgo2(ji,jj) = zkgo2(ji,jj) / ( 100.*3600.)        &
+# if defined key_off_degrad
+             &        * facvol(ji,jj,1)       &
+# endif
+             &        * ( 1.- freeze(ji,jj) ) *tmask(ji,jj,1)
+
+         END DO
+      END DO
+
+      DO jj = 1, jpj
+         DO ji = 1, jpi
+
+            ! Compute CO2 flux for the sea and air
+            zfld = atcco2 * tmask(ji,jj,1) * chemc(ji,jj,3) * zkgco2(ji,jj)
+            zflu = zh2co3(ji,jj) * tmask(ji,jj,1) * zkgco2(ji,jj)
+            tra(ji,jj,1,jpdic) = tra(ji,jj,1,jpdic) + ( zfld - zflu ) / fse3t(ji,jj,1)
+
+            ! Compute O2 flux 
+            zoxy16 = trn(ji,jj,1,jpoxy)
+            zflu16 = ( atcox * chemc(ji,jj,2) - zoxy16 ) * zkgo2(ji,jj)
+            tra(ji,jj,1,jpoxy) = tra(ji,jj,1,jpoxy) + zflu16 / fse3t(ji,jj,1)
+
+# if defined key_trc_diaadd
+            ! Save diagnostics
+            trc2d(ji,jj,1) = ( zfld - zflu ) * 1000.
+            trc2d(ji,jj,2) = zflu16 * 1000.
+            trc2d(ji,jj,3) = zkgco2(ji,jj)
+            trc2d(ji,jj,4) = atcco2 - zh2co3(ji,jj) / ( chemc(ji,jj,3) + rtrn )
+# endif
+         END DO
+      END DO
+      !
+   END SUBROUTINE p4z_flx
+
+#else
+   !!======================================================================
+   !!  Dummy module :                                   No PISCES bio-model
+   !!======================================================================
+CONTAINS
+   SUBROUTINE p4z_flx( kt )                   ! Empty routine
+      INTEGER, INTENT( in ) ::   kt
+      WRITE(*,*) 'p4z_flx: You should not have seen this print! error?', kt
+   END SUBROUTINE p4z_flx
+#endif 
+
+   !!======================================================================
+END MODULE  p4zflx
Index: branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zint.F
===================================================================
--- branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zint.F	(revision 773)
+++ 	(revision )
@@ -1,107 +1,0 @@
-
-CCC $Header$ 
-CCC  TOP 1.0 , LOCEAN-IPSL (2005) 
-C This software is governed by CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
-C ---------------------------------------------------------------------------
-CDIR$ LIST
-      SUBROUTINE p4zint(kt)
-#if defined key_top && defined key_pisces
-CCC
-CCC
-CCC       ROUTINE p4zint : PISCES MODEL
-CCC       *****************************
-CCC
-CC
-CC   PURPOSE :
-CC   ---------
-CC           *P4ZINT* INTERPOLATION AND COMPUTATION OF 
-CC                    VARIOUS ACCESSORY FIELDS
-CC   INPUT :
-CC   -----
-CC      argument
-CC              kt              : time step
-CC
-CC   EXTERNAL :
-CC   ----------
-CC          NONE
-CC
-CC   MODIFICATIONS:
-CC   --------------
-CC      original      : 2004    O. Aumont
-CC ----------------------------------------------------------------
-CC parameters and commons
-CC ======================
-CDIR$ NOLIST
-      USE oce_trc
-      USE trp_trc
-      USE sms
-      IMPLICIT NONE
-CDIR$ LIST
-CC-----------------------------------------------------------------
-CC------
-CC local declarations
-CC ==================
-C
-      INTEGER kt
-      INTEGER ji, jj
-      INTEGER iman
-      INTEGER nspyr,nvit1t,nvit2t
-      REAL zpdtan, zman, zpdtmo, zdemi
-      REAL zt, zdum
-C
-C
-      zpdtan = raass / rdt
-      nspyr  = nint(zpdtan)
-      zman   = 12.
-      iman   = 12
-      zpdtmo = zpdtan / zman
-      zdemi  = zpdtmo / 2.
-      zt     = ( float ( kt) + zdemi) / zpdtmo
-      
-C  recherche de l'indice des enregistrements
-C  du modele dynamique encadrant le pas de temps kt.
-C  --------------------------------------------------
-C
-      xtvit = zt - float(int ( zt))
-      nvit1t = int (zt)
-      nvit2t = nvit1t+1
-      nvit1t = MOD ( nvit1t, iman)
-      IF ( nvit1t .EQ. 0 ) nvit1t = iman
-      nvit2t = MOD ( nvit2t, iman)
-      IF ( nvit2t .EQ. 0 ) nvit2t = iman
-C
-C Interpolation of dust deposition
-C --------------------------------
-C
-         dust(:,:) = (1.-xtvit)*dustmo(:,:,nvit1t)
-     $            +xtvit*dustmo(:,:,nvit2t)
-C
-C
-C Computation of phyto and zoo metabolic rate
-C -------------------------------------------
-C
-
-         Tgfunc(:,:,:) = exp(0.063913*tn(:,:,:))
-         Tgfunc2(:,:,:) = exp(0.07608*tn(:,:,:))
-C
-C      Computation of the silicon dependant half saturation
-C      constant for silica uptake
-C       ---------------------------------------------------
-C
-        DO ji=1,jpi
-          DO jj=1,jpj
-          zdum=trn(ji,jj,1,jpsil)**2
-          xksimax(ji,jj) = max(xksimax(ji,jj),(1.+7.*zdum
-     &      /(xksi2*xksi2*25.+zdum))*1E-6)
-          END DO
-        END DO
-C
-        IF (nday_year.EQ.365) THEN
-           xksi=xksimax
-           xksimax=0.
-        ENDIF
-C
-#endif
-C
-      RETURN
-      END
Index: branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zint.F90
===================================================================
--- branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zint.F90	(revision 775)
+++ branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zint.F90	(revision 775)
@@ -0,0 +1,108 @@
+MODULE p4zint
+   !!======================================================================
+   !!                         ***  MODULE p4zint  ***
+   !! TOP :   PISCES interpolation and computation of various accessory fields
+   !!======================================================================
+   !! History :   1.0  !  2004-03 (O. Aumont) Original code
+   !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
+   !!----------------------------------------------------------------------
+#if defined key_pisces
+   !!----------------------------------------------------------------------
+   !!   'key_pisces'                                       PISCES bio-model
+   !!----------------------------------------------------------------------
+   !!   p4z_int        :  interpolation and computation of various accessory fields
+   !!----------------------------------------------------------------------
+   USE oce_trc         !
+   USE trp_trc
+   USE sms
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   p4z_int    ! called in p4zprg.F90
+
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 2.0 , LOCEAN-IPSL (2007) 
+   !! $Header:$ 
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+   SUBROUTINE p4z_int( kt )
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE p4z_int  ***
+      !!
+      !! ** Purpose :   interpolation and computation of various accessory fields
+      !!
+      !! ** Method  : - ???
+      !!---------------------------------------------------------------------
+      INTEGER, INTENT( in ) ::   kt      ! ocean time-step index      
+      !!
+      INTEGER  ::   ji, jj
+      INTEGER  ::   iman, ivit1t, ivit2t
+      REAL(wp) ::   zpdtan, zman, zpdtmo, zdemi
+      REAL(wp) ::   zt, zdum
+      !!---------------------------------------------------------------------
+
+      zpdtan = raass / rdt
+      zman   = 12.
+      iman   = 12
+      zpdtmo = zpdtan / zman
+      zdemi  = zpdtmo / 2.
+      zt     = ( float ( kt) + zdemi) / zpdtmo
+      
+      !  recherche de l indice des enregistrements
+      !  du modele dynamique encadrant le pas de temps kt.
+      !  --------------------------------------------------
+
+      xtvit = zt - FLOAT( INT( zt ) )
+      ivit1t = INT( zt )
+      ivit2t = ivit1t + 1
+      ivit1t = MOD ( ivit1t, iman )
+      IF( ivit1t == 0 )   ivit1t = iman
+      ivit2t = MOD ( ivit2t, iman )
+      IF( ivit2t == 0 )   ivit2t = iman
+
+      ! Interpolation of dust deposition
+      ! --------------------------------
+
+      dust(:,:) = ( 1.- xtvit ) * dustmo(:,:,ivit1t) + xtvit * dustmo(:,:,ivit2t)
+
+      ! Computation of phyto and zoo metabolic rate
+      ! -------------------------------------------
+
+      Tgfunc (:,:,:) = EXP( 0.063913 * tn(:,:,:) )
+      Tgfunc2(:,:,:) = EXP( 0.07608  * tn(:,:,:) )
+
+      ! Computation of the silicon dependant half saturation
+      ! constant for silica uptake
+      ! ---------------------------------------------------
+
+      DO ji = 1, jpi
+         DO jj = 1, jpj
+            zdum = trn(ji,jj,1,jpsil) * trn(ji,jj,1,jpsil)
+            xksimax(ji,jj) = MAX( xksimax(ji,jj), ( 1.+ 7.* zdum / ( xksi2 * xksi2 * 25. + zdum ) ) * 1e-6 )
+         END DO
+      END DO
+
+      IF( nday_year == 365 ) THEN
+         xksi    = xksimax
+         xksimax = 0.e0
+      ENDIF
+      !
+   END SUBROUTINE p4z_int
+
+#else
+   !!======================================================================
+   !!  Dummy module :                                   No PISCES bio-model
+   !!======================================================================
+CONTAINS
+   SUBROUTINE p4z_int( kt )                   ! Empty routine
+      INTEGER, INTENT( in ) ::   kt
+      WRITE(*,*) 'p4z_int: You should not have seen this print! error?', kt
+   END SUBROUTINE p4z_int
+#endif 
+
+   !!======================================================================
+END MODULE  p4zint
Index: branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zlim.F
===================================================================
--- branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zlim.F	(revision 773)
+++ 	(revision )
@@ -1,143 +1,0 @@
-
-CCC $Header$ 
-CCC  TOP 1.0 , LOCEAN-IPSL (2005) 
-C This software is governed by CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
-C ---------------------------------------------------------------------------
-CDIR$ LIST
-      SUBROUTINE p4zlim
-#if defined key_top && defined key_pisces
-CCC---------------------------------------------------------------------
-CCC
-CCC             ROUTINE p4zlim : PISCES MODEL
-CCC             *****************************
-CCC
-CCC  PURPOSE :
-CCC  ---------
-CCC         Compute the co-limitations by the various nutrients
-CCC         for the various phytoplankton species
-CCC
-CC   INPUT :
-CC   -----
-CC      argument
-CC              None
-CC      common
-CC              all the common defined in opa
-CC
-CC
-CC   OUTPUT :                   : no
-CC   ------
-CC
-CC   MODIFICATIONS:
-CC   --------------
-CC      original  : O. Aumont (2004)
-CC----------------------------------------------------------------------
-CC parameters and commons
-CC ======================
-CDIR$ NOLIST
-      USE oce_trc
-      USE trp_trc
-      USE sms
-      IMPLICIT NONE
-#include "domzgr_substitute.h90"
-CDIR$ LIST
-CC----------------------------------------------------------------------
-CC local declarations
-CC ==================
-      INTEGER ji, jj, jk
-      REAL xlim1,xlim2,xlim3,xlim4,zno3,zferlim
-      REAL xconctemp,xconctemp2,xconctempn,xconctempn2
-C
-C  Tuning of the iron concentration to a minimum
-C  level that is set to the detection limit
-C  -------------------------------------
-C
-        do jk=1,jpk
-          do jj=1,jpj
-            do ji=1,jpi
-        zno3=trn(ji,jj,jk,jpno3)*1E6
-        zferlim=max(1.5E-11*(zno3/40)**2,3E-12)
-        zferlim=min(zferlim,1.5E-11)
-        trn(ji,jj,jk,jpfer)=max(trn(ji,jj,jk,jpfer),zferlim)
-            end do
-          end do
-        end do
-C
-C  Computation of a variable Ks for iron on diatoms
-C  taking into account that increasing biomass is
-C  made of generally bigger cells
-C  ------------------------------------------------
-C
-        DO jk=1,jpkm1
-          DO jj=1,jpj
-            DO ji=1,jpi
-        xconctemp=max(0.,trn(ji,jj,jk,jpdia)-5E-7)
-        xconctemp2=min(5.E-7,trn(ji,jj,jk,jpdia))
-        xconctempn=max(0.,trn(ji,jj,jk,jpphy)-1E-6)
-        xconctempn2=min(1.E-6,trn(ji,jj,jk,jpphy))
-        concdfe(ji,jj,jk)=(xconctemp2*conc3+0.4E-9*
-     .    xconctemp)/(xconctemp2+xconctemp+rtrn)
-        concdfe(ji,jj,jk)=max(conc3,concdfe(ji,jj,jk))
-        concnfe(ji,jj,jk)=(xconctempn2*conc2+0.08E-9*
-     .    xconctempn)/(xconctempn2+xconctempn+rtrn)
-        concnfe(ji,jj,jk)=max(conc2,concnfe(ji,jj,jk))
-            END DO
-          END DO
-        END DO
-C
-        DO jk = 1,jpkm1
-          DO jj = 1,jpj
-            DO ji = 1,jpi
-C    
-C      Michaelis-Menten Limitation term for nutrients
-C      Small flagellates
-C      -----------------------------------------------
-C
-        xnanono3(ji,jj,jk)=trn(ji,jj,jk,jpno3)*concnnh4
-     &      /(conc0*concnnh4+concnnh4*trn(ji,jj,jk,jpno3)+
-     &        conc0*trn(ji,jj,jk,jpnh4))
-        xnanonh4(ji,jj,jk)=trn(ji,jj,jk,jpnh4)*conc0
-     &      /(conc0*concnnh4+concnnh4*trn(ji,jj,jk,jpno3)+
-     &        conc0*trn(ji,jj,jk,jpnh4))
-        xlim1=xnanono3(ji,jj,jk)+xnanonh4(ji,jj,jk)
-        xlim2=trn(ji,jj,jk,jppo4)/(trn(ji,jj,jk,jppo4)+concnnh4)
-        xlim3=trn(ji,jj,jk,jpfer)/(trn(ji,jj,jk,jpfer)
-     &     +concnfe(ji,jj,jk))
-        xlimphy(ji,jj,jk)=min(xlim1,xlim2,xlim3)
-        xlim1=trn(ji,jj,jk,jpnh4)/(concnnh4+trn(ji,jj,jk,jpnh4))
-        xlim3=trn(ji,jj,jk,jpfer)/(trn(ji,jj,jk,jpfer)+conc2)
-        xlim4=trn(ji,jj,jk,jpdoc)/(trn(ji,jj,jk,jpdoc)+xkdoc2)
-        xlimbac(ji,jj,jk)=min(xlim1,xlim2,xlim3)*xlim4
-C
-            END DO
-          END DO
-        END DO
-C
-        DO jk = 1,jpkm1
-          DO jj = 1,jpj
-            DO ji = 1,jpi
-C
-C   Michaelis-Menten Limitation term for nutrients
-C   Diatoms
-C   ----------------------------------------------
-C
-        xdiatno3(ji,jj,jk)=trn(ji,jj,jk,jpno3)*concdnh4
-     &      /(conc1*concdnh4+concdnh4*trn(ji,jj,jk,jpno3)+
-     &        conc1*trn(ji,jj,jk,jpnh4))
-        xdiatnh4(ji,jj,jk)=trn(ji,jj,jk,jpnh4)*conc1
-     &      /(conc1*concdnh4+concdnh4*trn(ji,jj,jk,jpno3)+
-     &        conc1*trn(ji,jj,jk,jpnh4))
-
-        xlim1=xdiatno3(ji,jj,jk)+xdiatnh4(ji,jj,jk)
-        xlim2=trn(ji,jj,jk,jppo4)/(trn(ji,jj,jk,jppo4)+concdnh4)
-        xlim3=trn(ji,jj,jk,jpsil)/(trn(ji,jj,jk,jpsil)+xksi(ji,jj))
-        xlim4=trn(ji,jj,jk,jpfer)/(trn(ji,jj,jk,jpfer)
-     &      +concdfe(ji,jj,jk))
-        xlimdia(ji,jj,jk)=min(xlim1,xlim2,xlim3,xlim4)
-C
-            END DO
-          END DO
-        END DO
-C
-#endif
-      RETURN
-      END
Index: branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zlim.F90
===================================================================
--- branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zlim.F90	(revision 775)
+++ branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zlim.F90	(revision 775)
@@ -0,0 +1,148 @@
+MODULE p4zlim
+   !!======================================================================
+   !!                         ***  MODULE p4zlim  ***
+   !! TOP :   PISCES 
+   !!======================================================================
+   !! History :   1.0  !  2004     (O. Aumont) Original code
+   !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
+   !!----------------------------------------------------------------------
+#if defined key_pisces
+   !!----------------------------------------------------------------------
+   !!   'key_pisces'                                       PISCES bio-model
+   !!----------------------------------------------------------------------
+   !!   p4z_lim        :  
+   !!----------------------------------------------------------------------
+   USE oce_trc         !
+   USE trp_trc         ! 
+   USE sms             ! 
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   p4z_lim    ! called in p4zprg.F90
+
+   !!* Substitution
+#  include "domzgr_substitute.h90"
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 2.0 , LOCEAN-IPSL (2007) 
+   !! $Header:$ 
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+   SUBROUTINE p4z_lim
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE p4z_lim  ***
+      !!
+      !! ** Purpose :   Compute the co-limitations by the various nutrients
+      !!              for the various phytoplankton species
+      !!
+      !! ** Method  : - ???
+      !!---------------------------------------------------------------------
+      INTEGER  ::   ji, jj, jk
+      REAL(wp) ::   zlim1, zlim2, zlim3, zlim4, zno3, zferlim
+      REAL(wp) ::   zconctemp, zconctemp2, zconctempn, zconctempn2
+      !!---------------------------------------------------------------------
+
+!  Tuning of the iron concentration to a minimum
+!  level that is set to the detection limit
+!  -------------------------------------
+
+      DO jk = 1, jpk
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               zno3   = trn(ji,jj,jk,jpno3) * 1.e6
+               zferlim = MAX( 1.5e-11*(zno3/40)**2, 3e-12 )
+               zferlim = MIN( zferlim, 1.5e-11 )
+               trn(ji,jj,jk,jpfer) = MAX( trn(ji,jj,jk,jpfer), zferlim )
+            END DO
+         END DO
+      END DO
+
+!  Computation of a variable Ks for iron on diatoms
+!  taking into account that increasing biomass is
+!  made of generally bigger cells
+!  ------------------------------------------------
+
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               zconctemp   = MAX( 0.e0 , trn(ji,jj,jk,jpdia)-5e-7 )
+               zconctemp2  = MIN( 5.e-7, trn(ji,jj,jk,jpdia)      )
+               zconctempn  = MAX( 0.e0 , trn(ji,jj,jk,jpphy)-1e-6 )
+               zconctempn2 = MIN( 1.e-6, trn(ji,jj,jk,jpphy)      )
+               concdfe(ji,jj,jk) = ( zconctemp2 * conc3 + 0.4e-9 * zconctemp)   &
+                  &              / ( zconctemp2 + zconctemp + rtrn )
+               concdfe(ji,jj,jk) = MAX( conc3, concdfe(ji,jj,jk) )
+               concnfe(ji,jj,jk) = ( zconctempn2 * conc2 + 0.08e-9 * zconctempn)   &
+                  &              / ( zconctempn2 + zconctempn + rtrn )
+               concnfe(ji,jj,jk) = MAX( conc2, concnfe(ji,jj,jk) )
+            END DO
+         END DO
+      END DO
+
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+    
+!      Michaelis-Menten Limitation term for nutrients
+!      Small flagellates
+!      -----------------------------------------------
+
+               xnanono3(ji,jj,jk) = trn(ji,jj,jk,jpno3) * concnnh4           &
+                  &               / ( conc0 * concnnh4 + concnnh4 * trn(ji,jj,jk,jpno3)   &
+                  &                                    + conc0    * trn(ji,jj,jk,jpnh4) )
+               xnanonh4(ji,jj,jk) = trn(ji,jj,jk,jpnh4) * conc0              &
+                  &               / ( conc0 * concnnh4 + concnnh4 * trn(ji,jj,jk,jpno3)   &
+                  &                                    + conc0    * trn(ji,jj,jk,jpnh4) )
+               zlim1 = xnanono3(ji,jj,jk) + xnanonh4(ji,jj,jk)
+               zlim2 = trn(ji,jj,jk,jppo4) / ( trn(ji,jj,jk,jppo4) + concnnh4          ) 
+               zlim3 = trn(ji,jj,jk,jpfer) / ( trn(ji,jj,jk,jpfer) + concnfe(ji,jj,jk) )
+               xlimphy(ji,jj,jk) = MIN( zlim1, zlim2, zlim3 )
+               zlim1 = trn(ji,jj,jk,jpnh4) / ( concnnh4 + trn(ji,jj,jk,jpnh4) )
+               zlim3 = trn(ji,jj,jk,jpfer) / ( conc2    + trn(ji,jj,jk,jpfer) )
+               zlim4 = trn(ji,jj,jk,jpdoc) / ( xkdoc2   + trn(ji,jj,jk,jpdoc) )
+               xlimbac(ji,jj,jk) = MIN( zlim1, zlim2, zlim3 ) * zlim4
+
+            END DO
+         END DO
+      END DO
+
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+
+!   Michaelis-Menten Limitation term for nutrients Diatoms
+!   ----------------------------------------------
+
+               xdiatno3(ji,jj,jk) = trn(ji,jj,jk,jpno3) * concdnh4                         &
+                  &               / ( conc1  * concdnh4 + concdnh4 * trn(ji,jj,jk,jpno3)   &
+                  &                                     + conc1    * trn(ji,jj,jk,jpnh4) )
+               xdiatnh4(ji,jj,jk) = trn(ji,jj,jk,jpnh4) * conc1                            &
+                  &               / ( conc1  * concdnh4 + concdnh4 * trn(ji,jj,jk,jpno3)   &
+                  &                                     + conc1   * trn(ji,jj,jk,jpnh4) )
+
+               zlim1 = xdiatno3(ji,jj,jk) + xdiatnh4(ji,jj,jk)
+               zlim2 = trn(ji,jj,jk,jppo4) / ( trn(ji,jj,jk,jppo4) + concdnh4          )
+               zlim3 = trn(ji,jj,jk,jpsil) / ( trn(ji,jj,jk,jpsil) + xksi   (ji,jj)    )
+               zlim4 = trn(ji,jj,jk,jpfer) / ( trn(ji,jj,jk,jpfer) + concdfe(ji,jj,jk) )
+               xlimdia(ji,jj,jk) = MIN( zlim1, zlim2, zlim3, zlim4 )
+
+            END DO
+         END DO
+      END DO
+      !
+   END SUBROUTINE p4z_lim
+
+#else
+   !!======================================================================
+   !!  Dummy module :                                   No PISCES bio-model
+   !!======================================================================
+CONTAINS
+   SUBROUTINE p4z_lim                   ! Empty routine
+   END SUBROUTINE p4z_lim
+#endif 
+
+   !!======================================================================
+END MODULE  p4zlim
Index: branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zlys.F
===================================================================
--- branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zlys.F	(revision 773)
+++ 	(revision )
@@ -1,166 +1,0 @@
-
-CCC $Header$ 
-CCC  TOP 1.0 , LOCEAN-IPSL (2005) 
-C This software is governed by CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
-C ---------------------------------------------------------------------------
-CDIR$ LIST
-       SUBROUTINE p4zlys
-#if defined key_top && defined key_pisces
-CCC---------------------------------------------------------------------
-CCC
-CCC        ROUTINE p4zlys : PISCES MODEL
-CCC        *****************************
-CCC
-CCC
-CCC     PURPOSE.
-CCC     --------
-CCC          *P4ZLYS*  CALCULATES DEGREE OF CACO3 SATURATION IN THE WATER
-CCC                    COLUMN, DISSOLUTION/PRECIPITATION OF CACO3 AND LOSS
-CCC                    OF CACO3 TO THE CACO3 SEDIMENT POOL.
-CC
-CC     EXTERNALS.
-CC     ----------
-CC          NONE.
-CC
-CC   MODIFICATIONS:
-CC   --------------
-CC      original      : 1988-07 E. MAIER-REIMER      MPI HAMBURG
-CC      additions     : 1998    O. Aumont
-CC      modifications : 1999    C. Le Quere
-CC      modifications : 2004    O. Aumont
-CC ---------------------------------------------------------------------------
-CC parameters and commons
-CC ======================
-CDIR$ NOLIST
-      USE oce_trc
-      USE trp_trc
-      USE sms
-      IMPLICIT NONE
-CDIR$ LIST
-CC----------------------------------------------------------------------
-CC local declarations
-CC ==================
-C
-      INTEGER ji, jj, jk, jn
-      REAL zbot, zalk, zdic, zph, remco3, ah2
-      REAL dispot, zfact, zalka
-      REAL omegaca, excess, excess0
-      REAL co3(jpi,jpj,jpk)
-C
-C
-C* 1.1  BEGIN OF ITERATION
-C ------------------------
-C
-      DO jn = 1,5
-C
-C* 1.2  COMPUTE [CO3--] and [H+] CONCENTRATIONS
-C -------------------------------------------
-C
-      DO jk = 1,jpkm1
-        DO jj=1,jpj
-          DO ji = 1, jpi
-C
-C* 1.3  SET DUMMY VARIABLE FOR TOTAL BORATE
-C -----------------------------------------
-C
-        zbot = borat(ji,jj,jk)
-        zfact=rhop(ji,jj,jk)/1000.+rtrn
-C
-C* 1.4  SET DUMMY VARIABLE FOR [H+]
-C ---------------------------------
-C
-        zph = hi(ji,jj,jk)*tmask(ji,jj,jk)/zfact
-     &    +(1.-tmask(ji,jj,jk))*1.e-9
-C
-C* 1.5  SET DUMMY VARIABLE FOR [SUM(CO2)]GIVEN 
-C -------------------------------------------
-C
-        zdic=trn(ji,jj,jk,jpdic)/zfact
-        zalka=trn(ji,jj,jk,jptal)/zfact
-C
-C* 1.6 CALCULATE [ALK]([CO3--], [HCO3-])
-C ------------------------------------
-C
-        zalk=zalka-(akw3(ji,jj,jk)/zph-zph
-     &     +zbot/(1.+zph/akb3(ji,jj,jk)))
-C
-C* 2.10 CALCULATE [H+] and [CO3--]
-C -----------------------------------------
-C
-        ah2=sqrt((zdic-zalk)*(zdic-zalk)+
-     &     4.*(zalk*ak23(ji,jj,jk)/ak13(ji,jj,jk))
-     &     *(2*zdic-zalk))
-C
-        ah2=0.5*ak13(ji,jj,jk)/zalk*((zdic-zalk)+ah2)
-        co3(ji,jj,jk) = zalk/(2.+ah2/ak23(ji,jj,jk))*zfact
-
-        hi(ji,jj,jk)  = ah2*zfact
-C
-          ENDDO
-        ENDDO
-      END DO
-C
-      END DO 
-C
-C     ---------------------------------------------------------
-C*    2. CALCULATE DEGREE OF CACO3 SATURATION AND CORRESPONDING
-C        DISSOLOUTION AND PRECIPITATION OF CACO3 (BE AWARE OF
-C        MGCO3)
-C     ---------------------------------------------------------
-C
-      DO jk = 1,jpkm1
-        DO jj = 1,jpj
-          DO ji = 1, jpi
-C
-C* 2.1  DEVIATION OF [CO3--] FROM SATURATION VALUE
-C ------------------------------------------------
-C
-            omegaca = ( calcon * co3(ji,jj,jk) )/aksp(ji,jj,jk)
-
-C
-C* 2.2  SET DEGREE OF UNDER-/SUPERSATURATION
-C ------------------------------------------
-C
-            excess0 = max(0.,(1.-omegaca))
-            excess = excess0**nca
-
-C
-C* 2.3  AMOUNT CACO3 (12C) THAT RE-ENTERS SOLUTION
-C       (ACCORDING TO THIS FORMULATION ALSO SOME PARTICULATE
-C       CACO3 GETS DISSOLVED EVEN IN THE CASE OF OVERSATURATION)
-C --------------------------------------------------------------
-C
-            dispot = kdca * excess * trn(ji,jj,jk,jpcal)
-#    if defined key_off_degrad
-     &        *facvol(ji,jj,jk)
-#    endif
-
-C
-C* 2.4  CHANGE OF [CO3--] , [ALK], PARTICULATE [CACO3],
-C       AND [SUM(CO2)] DUE TO CACO3 DISSOLUTION/PRECIPITATION
-C -----------------------------------------------------------
-C
-            remco3=dispot/rmoss
-            co3(ji,jj,jk) = co3(ji,jj,jk)+
-     &        remco3*rfact
-            tra(ji,jj,jk,jptal) = tra(ji,jj,jk,jptal)+
-     &        2.*remco3
-            tra(ji,jj,jk,jpcal) = tra(ji,jj,jk,jpcal)-
-     &        remco3
-            tra(ji,jj,jk,jpdic) = tra(ji,jj,jk,jpdic)+
-     &        remco3
-C
-          ENDDO
-        ENDDO
-      END DO
-
-#    if defined key_trc_dia3d
-         trc3d(:,:,:,1) = rhop(:,:,:)
-         trc3d(:,:,:,2) = co3(:,:,:)
-         trc3d(:,:,:,3) = aksp(:,:,:)/calcon
-#    endif
-
-C
-#endif
-      RETURN
-      END
Index: branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zlys.F90
===================================================================
--- branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zlys.F90	(revision 775)
+++ branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zlys.F90	(revision 775)
@@ -0,0 +1,152 @@
+MODULE p4zlys
+   !!======================================================================
+   !!                         ***  MODULE p4zlys  ***
+   !! TOP :   PISCES 
+   !!======================================================================
+   !! History :    -   !  1988-07  (E. MAIER-REIMER) Original code
+   !!              -   !  1998     (O. Aumont) additions
+   !!              -   !  1999     (C. Le Quere) modifications
+   !!             1.0  !  2004     (O. Aumont) modifications
+   !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
+   !!----------------------------------------------------------------------
+#if defined key_pisces
+   !!----------------------------------------------------------------------
+   !!   'key_pisces'                                       PISCES bio-model
+   !!----------------------------------------------------------------------
+   !!   p4z_lys        :  
+   !!----------------------------------------------------------------------
+   USE oce_trc         !
+   USE trp_trc
+   USE sms
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   p4z_lys    ! called in p4zprg.F90
+
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 2.0 , LOCEAN-IPSL (2007) 
+   !! $Header:$ 
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+   SUBROUTINE p4z_lys
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE p4z_lys  ***
+      !!
+      !! ** Purpose :   CALCULATES DEGREE OF CACO3 SATURATION IN THE WATER
+      !!              COLUMN, DISSOLUTION/PRECIPITATION OF CACO3 AND LOSS
+      !!              OF CACO3 TO THE CACO3 SEDIMENT POOL.
+      !!
+      !! ** Method  : - ???
+      !!---------------------------------------------------------------------
+      INTEGER  ::   ji, jj, jk, jn
+      REAL(wp) ::   zbot, zalk, zdic, zph, zremco3, zah2
+      REAL(wp) ::   zdispot, zfact, zalka
+      REAL(wp) ::   zomegaca, zexcess, zexcess0
+      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zco3
+      !!---------------------------------------------------------------------
+
+
+      !     -------------------------------------------
+      !     COMPUTE [CO3--] and [H+] CONCENTRATIONS
+      !     -------------------------------------------
+      
+      DO jn = 1, 5                               !  BEGIN OF ITERATION
+         !
+         DO jk = 1, jpkm1
+            DO jj = 1, jpj
+               DO ji = 1, jpi
+
+                  ! SET DUMMY VARIABLE FOR TOTAL BORATE
+                  zbot  = borat(ji,jj,jk)
+                  zfact = rhop (ji,jj,jk) / 1000. + rtrn
+
+                  ! SET DUMMY VARIABLE FOR [H+]
+                  zph   = hi(ji,jj,jk) * tmask(ji,jj,jk) / zfact + ( 1.-tmask(ji,jj,jk) ) * 1.e-9
+
+                  ! SET DUMMY VARIABLE FOR [SUM(CO2)]GIVEN 
+                  zdic  = trn(ji,jj,jk,jpdic) / zfact
+                  zalka = trn(ji,jj,jk,jptal) / zfact
+
+                  ! CALCULATE [ALK]([CO3--], [HCO3-])
+                  zalk  = zalka - (  akw3(ji,jj,jk) / zph - zph   &
+                     &             + zbot / (1.+ zph / akb3(ji,jj,jk) )  )
+
+                  ! CALCULATE [H+] and [CO3--]
+                  zah2 = SQRT( (zdic-zalk)*(zdic-zalk)+   &
+                     &     4.*(zalk*ak23(ji,jj,jk)/ak13(ji,jj,jk))   &
+                     &     *(2*zdic-zalk))
+
+                  zah2=0.5*ak13(ji,jj,jk)/zalk*((zdic-zalk)+zah2)
+                  zco3(ji,jj,jk) = zalk/(2.+zah2/ak23(ji,jj,jk))*zfact
+
+                  hi(ji,jj,jk)  = zah2*zfact
+
+               END DO
+            END DO
+         END DO
+         !
+      END DO 
+
+      !     ---------------------------------------------------------
+      !        CALCULATE DEGREE OF CACO3 SATURATION AND CORRESPONDING
+      !        DISSOLOUTION AND PRECIPITATION OF CACO3 (BE AWARE OF
+      !        MGCO3)
+      !     ---------------------------------------------------------
+
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+
+               ! DEVIATION OF [CO3--] FROM SATURATION VALUE
+               zomegaca = ( calcon * zco3(ji,jj,jk) ) / aksp(ji,jj,jk)
+
+               ! SET DEGREE OF UNDER-/SUPERSATURATION
+               zexcess0 = MAX( 0., ( 1.- zomegaca ) )
+               zexcess  = zexcess0**nca
+
+               ! AMOUNT CACO3 (12C) THAT RE-ENTERS SOLUTION
+               !       (ACCORDING TO THIS FORMULATION ALSO SOME PARTICULATE
+               !       CACO3 GETS DISSOLVED EVEN IN THE CASE OF OVERSATURATION)
+# if defined key_off_degrad
+              zdispot = kdca * zexcess * trn(ji,jj,jk,jpcal) * facvol(ji,jj,jk)
+# else
+              zdispot = kdca * zexcess * trn(ji,jj,jk,jpcal)
+# endif
+
+              !  CHANGE OF [CO3--] , [ALK], PARTICULATE [CACO3],
+              !       AND [SUM(CO2)] DUE TO CACO3 DISSOLUTION/PRECIPITATION
+              zremco3 = zdispot / rmoss
+              zco3(ji,jj,jk) = zco3(ji,jj,jk) + zremco3 * rfact
+              tra(ji,jj,jk,jptal) = tra(ji,jj,jk,jptal) + 2.*zremco3
+              tra(ji,jj,jk,jpcal) = tra(ji,jj,jk,jpcal) -    zremco3
+              tra(ji,jj,jk,jpdic) = tra(ji,jj,jk,jpdic) +    zremco3
+
+            END DO
+         END DO
+      END DO
+
+# if defined key_trc_dia3d
+         trc3d(:,:,:,1) = rhop(:,:,:)
+         trc3d(:,:,:,2) = zco3(:,:,:)
+         trc3d(:,:,:,3) = aksp(:,:,:) / calcon
+# endif
+      !
+   END SUBROUTINE p4z_lys
+
+#else
+   !!======================================================================
+   !!  Dummy module :                                   No PISCES bio-model
+   !!======================================================================
+CONTAINS
+   SUBROUTINE p4z_lys( kt )                   ! Empty routine
+      INTEGER, INTENT( in ) ::   kt
+      WRITE(*,*) 'p4z_lys: You should not have seen this print! error?', kt
+   END SUBROUTINE p4z_lys
+#endif 
+
+   !!======================================================================
+END MODULE  p4zlys
Index: branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zmeso.F
===================================================================
--- branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zmeso.F	(revision 773)
+++ 	(revision )
@@ -1,228 +1,0 @@
-
-CCC $Header: /home/opalod/NEMOCVSROOT/NEMO/TOP_SRC/SMS/p4zmeso.F,v 1.8 2007/10/12 09:32:52 opalod Exp $ 
-CCC  TOP 1.0 , LOCEAN-IPSL (2005) 
-C This software is governed by CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
-C ---------------------------------------------------------------------------
-CDIR$ LIST
-      SUBROUTINE p4zmeso
-#if defined key_top && defined key_pisces
-CCC---------------------------------------------------------------------
-CCC
-CCC            ROUTINE p4zmeso : PISCES MODEL
-CCC            ******************************
-CCC
-CCC  PURPOSE :
-CCC  ---------
-CCC         Compute the sources/sinks for mesozooplankton
-CCC
-CC   METHOD :
-CC   -------
-CC      
-CC
-CC   INPUT :
-CC   -----
-CC      argument
-CC              None
-CC      common
-CC              all the common defined in opa
-CC
-CC
-CC   OUTPUT :                   : no
-CC   ------
-CC
-CC   EXTERNAL :
-CC   --------
-CC          None
-CC
-CC   MODIFICATIONS:
-CC   --------------
-CC      original  : O. Aumont (2002)
-CC----------------------------------------------------------------------
-CC parameters and commons
-CC ======================
-CDIR$ NOLIST
-      USE oce_trc
-      USE trp_trc
-      USE sms
-      IMPLICIT NONE
-CDIR$ LIST
-CC----------------------------------------------------------------------
-CC local declarations
-CC ==================
-      INTEGER ji, jj, jk
-      REAL compadi,compaph,compapoc,compaz
-      REAL zfact,zstep,compam,zdenom,graze2
-C
-C
-C
-C     Time step duration for biology
-C     ------------------------------
-C
-        zstep=rfact2/rjjss
-C
-        DO jk = 1,jpkm1
-          DO jj = 1,jpj
-            DO ji = 1,jpi
-C
-        compam=max((trn(ji,jj,jk,jpmes)-1.E-9),0.)
-        zfact=zstep*tgfunc(ji,jj,jk)*compam
-#    if defined key_off_degrad
-     &    *facvol(ji,jj,jk)
-#    endif
-C
-C     Respiration rates of both zooplankton
-C     -------------------------------------
-C
-        respz2(ji,jj,jk) = resrat2*zfact
-     &    *(1.+3.*nitrfac(ji,jj,jk))
-     &    *trn(ji,jj,jk,jpmes)/(xkmort+trn(ji,jj,jk,jpmes))
-C
-C     Zooplankton mortality. A square function has been selected with
-C     no real reason except that it seems to be more stable and may
-C     mimic predation.
-C     ---------------------------------------------------------------
-C
-        tortz2(ji,jj,jk) = mzrat2*1E6*zfact*trn(ji,jj,jk,jpmes)
-C
-            END DO
-          END DO
-        END DO
-
-        DO jk = 1,jpkm1
-          DO jj = 1,jpj
-            DO ji = 1,jpi
-C
-        compadi = max((trn(ji,jj,jk,jpdia)-1E-8),0.)
-        compaz = max((trn(ji,jj,jk,jpzoo)-1.E-8),0.)
-        compaph = max((trn(ji,jj,jk,jpphy)-2E-7),0.)
-        compapoc=max((trn(ji,jj,jk,jppoc)-1E-8),0.)
-C
-C     Microzooplankton grazing
-C     ------------------------
-C
-        zdenom=1./(xkgraz2+xprefc*trn(ji,jj,jk,jpdia)
-     &    +xprefz*trn(ji,jj,jk,jpzoo)
-     &    +xprefp*trn(ji,jj,jk,jpphy)
-     &    +xprefpoc*trn(ji,jj,jk,jppoc))
-
-        graze2 = grazrat2*zstep*Tgfunc2(ji,jj,jk)*zdenom
-     &    *trn(ji,jj,jk,jpmes)
-#    if defined key_off_degrad
-     &    *facvol(ji,jj,jk)
-#    endif
-
-        grazd(ji,jj,jk) = graze2*xprefc*compadi
-        grazz(ji,jj,jk) = graze2*xprefz*compaz
-        grazn(ji,jj,jk) = graze2*xprefp*compaph
-        grazpoc(ji,jj,jk) = graze2*xprefpoc*compapoc
-
-        graznf(ji,jj,jk) = grazn(ji,jj,jk)
-     &    *trn(ji,jj,jk,jpnfe)/(trn(ji,jj,jk,jpphy)+rtrn)
-
-        graznch(ji,jj,jk) = grazn(ji,jj,jk)
-     &    *trn(ji,jj,jk,jpnch)/(trn(ji,jj,jk,jpphy)+rtrn)
-
-        grazs(ji,jj,jk) = grazd(ji,jj,jk)
-     &    *trn(ji,jj,jk,jpbsi)/(trn(ji,jj,jk,jpdia)+rtrn)
-
-        grazf(ji,jj,jk) = grazd(ji,jj,jk)
-     &    *trn(ji,jj,jk,jpdfe)/(trn(ji,jj,jk,jpdia)+rtrn)
-
-        grazdch(ji,jj,jk) = grazd(ji,jj,jk)
-     &    *trn(ji,jj,jk,jpdch)/(trn(ji,jj,jk,jpdia)+rtrn)
-
-        grazpof(ji,jj,jk) = grazpoc(ji,jj,jk)
-     &    *trn(ji,jj,jk,jpsfe)/(trn(ji,jj,jk,jppoc)+rtrn)
-C
-            END DO
-          END DO
-        END DO
-
-        DO jk = 1,jpkm1
-          DO jj = 1,jpj
-            DO ji = 1,jpi
-C
-C    Mesozooplankton flux feeding on GOC
-C    ----------------------------------
-C
-#if ! defined key_kriest
-        grazffe(ji,jj,jk) = 5E3*zstep*wsbio4(ji,jj,jk)
-     &    *tgfunc2(ji,jj,jk)*trn(ji,jj,jk,jpgoc)*trn(ji,jj,jk,jpmes)
-#    if defined key_off_degrad
-     &    *facvol(ji,jj,jk)
-#    endif
-
-        grazfff(ji,jj,jk) = grazffe(ji,jj,jk)
-     &    *trn(ji,jj,jk,jpbfe)/(trn(ji,jj,jk,jpgoc)+rtrn)
-#else
-C KRIEST3
-        grazffe(ji,jj,jk) = 0.5*1.3E-2/5.5E-7*0.3*zstep*wsbio3(ji,jj,jk)
-     &    *tgfunc(ji,jj,jk)*trn(ji,jj,jk,jppoc)*trn(ji,jj,jk,jpmes)
-     &    /(trn(ji,jj,jk,jppoc)*1E7+0.1)
-#    if defined key_off_degrad
-     &    *facvol(ji,jj,jk)
-#    endif
-
-
-C        grazffe(ji,jj,jk) = 5E3*zstep*wsbio3(ji,jj,jk)
-C     &    *tgfunc2(ji,jj,jk)*trn(ji,jj,jk,jppoc)*trn(ji,jj,jk,jpmes)
-C#    if defined key_off_degrad
-C     &    *facvol(ji,jj,jk)
-C#    endif
-        grazfff(ji,jj,jk) = grazffe(ji,jj,jk)
-     &    *trn(ji,jj,jk,jpsfe)/(trn(ji,jj,jk,jppoc)+rtrn)
-#endif
-
-
-C
-            END DO
-          END DO
-        END DO
-
-        DO jk = 1,jpkm1
-          DO jj = 1,jpj
-            DO ji = 1,jpi
-C
-C    Mesozooplankton efficiency
-C    --------------------------
-C
-        grarem2(ji,jj,jk)=(grazd(ji,jj,jk)+grazz(ji,jj,jk)
-     &    +grazn(ji,jj,jk)+grazpoc(ji,jj,jk)+grazffe(ji,jj,jk))
-     &    *(1.-epsher2-unass2)
-#if ! defined key_kriest
-        grafer2(ji,jj,jk)=(grazf(ji,jj,jk)+graznf(ji,jj,jk)
-     &    +grazz(ji,jj,jk)*ferat3+grazpof(ji,jj,jk)
-     &    +grazfff(ji,jj,jk))*(1.-epsher2-unass2)
-     &    +epsher2*(grazd(ji,jj,jk)*max(
-     &    (trn(ji,jj,jk,jpdfe)/(trn(ji,jj,jk,jpdia)+rtrn)
-     &    -ferat3),0.)+grazn(ji,jj,jk)*max(
-     &    (trn(ji,jj,jk,jpnfe)/(trn(ji,jj,jk,jpphy)+rtrn)
-     &    -ferat3),0.)+grazpoc(ji,jj,jk)*max(
-     &    (trn(ji,jj,jk,jpsfe)/(trn(ji,jj,jk,jppoc)+rtrn)
-     &    -ferat3),0.)+grazffe(ji,jj,jk)*max(
-     &    (trn(ji,jj,jk,jpbfe)/(trn(ji,jj,jk,jpgoc)+rtrn)
-     &    -ferat3),0.))
-#else
-        grafer2(ji,jj,jk)=(grazf(ji,jj,jk)+graznf(ji,jj,jk)
-     &    +grazz(ji,jj,jk)*ferat3+grazpof(ji,jj,jk)
-     &    +grazfff(ji,jj,jk))*(1.-epsher2-unass2)
-     &    +epsher2*(grazd(ji,jj,jk)*max(
-     &    (trn(ji,jj,jk,jpdfe)/(trn(ji,jj,jk,jpdia)+rtrn)
-     &    -ferat3),0.)+grazn(ji,jj,jk)*max(
-     &    (trn(ji,jj,jk,jpnfe)/(trn(ji,jj,jk,jpphy)+rtrn)
-     &    -ferat3),0.)+grazpoc(ji,jj,jk)*max(
-     &    (trn(ji,jj,jk,jpsfe)/(trn(ji,jj,jk,jppoc)+rtrn)
-     &    -ferat3),0.)+grazffe(ji,jj,jk)*max(
-     &    (trn(ji,jj,jk,jpsfe)/(trn(ji,jj,jk,jppoc)+rtrn)
-     &    -ferat3),0.))
-#endif
-        grapoc2(ji,jj,jk)=(grazd(ji,jj,jk)+grazz(ji,jj,jk)
-     &    +grazn(ji,jj,jk)+grazpoc(ji,jj,jk)+grazffe(ji,jj,jk))*unass2
-
-            END DO
-          END DO
-        END DO
-C
-#endif
-      RETURN
-      END
Index: branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zmeso.F90
===================================================================
--- branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zmeso.F90	(revision 775)
+++ branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zmeso.F90	(revision 775)
@@ -0,0 +1,209 @@
+MODULE p4zmeso
+   !!======================================================================
+   !!                         ***  MODULE p4zmeso  ***
+   !! TOP :   PISCES Compute the sources/sinks for mesozooplankton
+   !!======================================================================
+   !! History :   1.0  !  2002     (O. Aumont) Original code
+   !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
+   !!----------------------------------------------------------------------
+#if defined key_pisces
+   !!----------------------------------------------------------------------
+   !!   'key_pisces'                                       PISCES bio-model
+   !!----------------------------------------------------------------------
+   !!   p4z_meso       :   Compute the sources/sinks for mesozooplankton
+   !!----------------------------------------------------------------------
+   USE oce_trc         !
+   USE trp_trc         ! 
+   USE sms             ! 
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   p4z_meso    ! called in p4zbio.F90
+
+   !!* Substitution
+#  include "domzgr_substitute.h90"
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 2.0 , LOCEAN-IPSL (2007) 
+   !! $Header:$ 
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+   SUBROUTINE p4z_meso
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE p4z_meso  ***
+      !!
+      !! ** Purpose :   Compute the sources/sinks for mesozooplankton
+      !!
+      !! ** Method  : - ???
+      !!---------------------------------------------------------------------
+      INTEGER  ::   ji, jj, jk
+      REAL(wp) ::   zcompadi, zcompaph, zcompapoc, zcompaz
+      REAL(wp) ::   zfact, zstep, zcompam, zdenom, zgraze2
+      !!---------------------------------------------------------------------
+
+      zstep = rfact2 / rjjss      ! Time step duration for biology
+
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+
+               zcompam = MAX( ( trn(ji,jj,jk,jpmes) - 1.e-9 ), 0.e0 )
+# if defined key_off_degrad
+               zfact   = zstep * tgfunc(ji,jj,jk) * zcompam * facvol(ji,jj,jk)
+# else
+               zfact   = zstep * tgfunc(ji,jj,jk) * zcompam
+# endif
+
+!     Respiration rates of both zooplankton
+!     -------------------------------------
+               respz2(ji,jj,jk) = resrat2 * zfact * ( 1. + 3. * nitrfac(ji,jj,jk) )        &
+                  &             * trn(ji,jj,jk,jpmes) / ( xkmort + trn(ji,jj,jk,jpmes) )
+
+!     Zooplankton mortality. A square function has been selected with
+!     no real reason except that it seems to be more stable and may
+!     mimic predation.
+!     ---------------------------------------------------------------
+               tortz2(ji,jj,jk) = mzrat2 * 1.e6 * zfact * trn(ji,jj,jk,jpmes)
+               !
+            END DO
+         END DO
+      END DO
+
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+
+               zcompadi  = MAX( ( trn(ji,jj,jk,jpdia) - 1.e-8 ), 0.e0 )
+               zcompaz   = MAX( ( trn(ji,jj,jk,jpzoo) - 1.e-8 ), 0.e0 )
+               zcompaph  = MAX( ( trn(ji,jj,jk,jpphy) - 2.e-7 ), 0.e0 )
+               zcompapoc = MAX( ( trn(ji,jj,jk,jppoc) - 1.e-8 ), 0.e0 )
+
+!     Microzooplankton grazing
+!     ------------------------
+               zdenom = 1. / (  xkgraz2 + xprefc   * trn(ji,jj,jk,jpdia)   &
+                  &                     + xprefz   * trn(ji,jj,jk,jpzoo)   &
+                  &                     + xprefp   * trn(ji,jj,jk,jpphy)   &
+                  &                     + xprefpoc * trn(ji,jj,jk,jppoc)  )
+
+               zgraze2 = grazrat2 * zstep * Tgfunc2(ji,jj,jk) * zdenom    &
+# if defined key_off_degrad
+                  &     * facvol(ji,jj,jk)          &
+# endif
+                  &     * trn(ji,jj,jk,jpmes)
+
+               grazd  (ji,jj,jk) = zgraze2 * xprefc   * zcompadi
+               grazz  (ji,jj,jk) = zgraze2 * xprefz   * zcompaz
+               grazn  (ji,jj,jk) = zgraze2 * xprefp   * zcompaph
+               grazpoc(ji,jj,jk) = zgraze2 * xprefpoc * zcompapoc
+
+               graznf (ji,jj,jk) = grazn  (ji,jj,jk) * trn(ji,jj,jk,jpnfe) / (trn(ji,jj,jk,jpphy) + rtrn)
+
+               graznch(ji,jj,jk) = grazn  (ji,jj,jk) * trn(ji,jj,jk,jpnch) / (trn(ji,jj,jk,jpphy) + rtrn)
+
+               grazs  (ji,jj,jk) = grazd  (ji,jj,jk) * trn(ji,jj,jk,jpbsi) / (trn(ji,jj,jk,jpdia) + rtrn)
+
+               grazf  (ji,jj,jk) = grazd  (ji,jj,jk) * trn(ji,jj,jk,jpdfe) / (trn(ji,jj,jk,jpdia) + rtrn)
+
+               grazdch(ji,jj,jk) = grazd  (ji,jj,jk) * trn(ji,jj,jk,jpdch) / (trn(ji,jj,jk,jpdia) + rtrn)
+
+               grazpof(ji,jj,jk) = grazpoc(ji,jj,jk) * trn(ji,jj,jk,jpsfe) / (trn(ji,jj,jk,jppoc) + rtrn)
+            END DO
+         END DO
+      END DO
+
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+
+!    Mesozooplankton flux feeding on GOC
+!    ----------------------------------
+# if ! defined key_kriest
+               grazffe(ji,jj,jk) = 5.e3 * zstep * wsbio4(ji,jj,jk)          &
+#  if defined key_off_degrad
+                  &     * facvol(ji,jj,jk)          &
+#  endif
+                  &     * tgfunc2(ji,jj,jk) * trn(ji,jj,jk,jpgoc) * trn(ji,jj,jk,jpmes)
+
+               grazfff(ji,jj,jk) = grazffe(ji,jj,jk)         &
+                  &     * trn(ji,jj,jk,jpbfe) / (trn(ji,jj,jk,jpgoc) + rtrn)
+# else
+! KRIEST3
+               grazffe(ji,jj,jk) = 0.5 * 1.3e-2 / 5.5e-7 * 0.3 * zstep * wsbio3(ji,jj,jk)     &
+                  &     * tgfunc(ji,jj,jk) * trn(ji,jj,jk,jppoc) * trn(ji,jj,jk,jpmes)    &
+#  if defined key_off_degrad
+                  &     * facvol(ji,jj,jk)          &
+#  endif
+                  &     /  (trn(ji,jj,jk,jppoc) * 1.e7 + 0.1)
+
+!!C        grazffe(ji,jj,jk) = 5.e3 * zstep * wsbio3(ji,jj,jk)
+!!C     &     * tgfunc2(ji,jj,jk) * trn(ji,jj,jk,jppoc) * trn(ji,jj,jk,jpmes)
+!!C#    if defined key_off_degrad
+!!C     &     * facvol(ji,jj,jk)
+!!C#    endif
+
+               grazfff(ji,jj,jk) = grazffe(ji,jj,jk)       &
+                  &     * trn(ji,jj,jk,jpsfe) / (trn(ji,jj,jk,jppoc) + rtrn)
+# endif
+            END DO
+         END DO
+      END DO
+
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+
+!    Mesozooplankton efficiency
+!    --------------------------
+               grarem2(ji,jj,jk) = (grazd(ji,jj,jk) + grazz(ji,jj,jk)              &
+                  &     + grazn(ji,jj,jk) + grazpoc(ji,jj,jk) + grazffe(ji,jj,jk))   &
+                  &     * (1.-epsher2-unass2)
+#if ! defined key_kriest
+               grafer2(ji,jj,jk) = (grazf(ji,jj,jk) + graznf(ji,jj,jk)                       &
+                  &     + grazz(ji,jj,jk) * ferat3 + grazpof(ji,jj,jk)                       &
+                  &     + grazfff(ji,jj,jk)) * (1.-epsher2-unass2)                       &
+                  &     + epsher2 * (grazd(ji,jj,jk) * MAX(                       &
+                  &    (trn(ji,jj,jk,jpdfe) / (trn(ji,jj,jk,jpdia) + rtrn)                       &
+                  &    -ferat3),0.) + grazn(ji,jj,jk) * MAX(                       &
+                  &    (trn(ji,jj,jk,jpnfe) / (trn(ji,jj,jk,jpphy) + rtrn)                       &
+                  &    -ferat3),0.) + grazpoc(ji,jj,jk) * MAX(                       &
+                  &    (trn(ji,jj,jk,jpsfe) / (trn(ji,jj,jk,jppoc) + rtrn)                       &
+                  &    -ferat3),0.) + grazffe(ji,jj,jk) * MAX(                       &
+                  &    (trn(ji,jj,jk,jpbfe) / (trn(ji,jj,jk,jpgoc) + rtrn)                       &
+                  &    -ferat3),0.) )
+#else
+               grafer2(ji,jj,jk) = (grazf(ji,jj,jk) + graznf(ji,jj,jk)                       &
+                  &     + grazz(ji,jj,jk) * ferat3 + grazpof(ji,jj,jk)                       &
+                  &     + grazfff(ji,jj,jk)) * (1.-epsher2-unass2)                       &
+                  &     + epsher2 * (grazd(ji,jj,jk) * MAX(                       &
+                  &    (trn(ji,jj,jk,jpdfe) / (trn(ji,jj,jk,jpdia) + rtrn)                       &
+                  &    -ferat3),0.) + grazn(ji,jj,jk) * MAX(                       &
+                  &    (trn(ji,jj,jk,jpnfe) / (trn(ji,jj,jk,jpphy) + rtrn)                       &
+                  &    -ferat3),0.) + grazpoc(ji,jj,jk) * MAX(                       &
+                  &    (trn(ji,jj,jk,jpsfe) / (trn(ji,jj,jk,jppoc) + rtrn)                       &
+                  &    -ferat3),0.) + grazffe(ji,jj,jk) * MAX(                       &
+                  &    (trn(ji,jj,jk,jpsfe) / (trn(ji,jj,jk,jppoc) + rtrn)                       &
+                  &    -ferat3),0.) )
+#endif
+               grapoc2(ji,jj,jk) = (grazd(ji,jj,jk) + grazz(ji,jj,jk)                     &
+                  &     + grazn(ji,jj,jk) + grazpoc(ji,jj,jk) + grazffe(ji,jj,jk)) * unass2
+               !
+            END DO
+         END DO
+      END DO
+      !
+   END SUBROUTINE p4z_meso
+
+#else
+   !!======================================================================
+   !!  Dummy module :                                   No PISCES bio-model
+   !!======================================================================
+CONTAINS
+   SUBROUTINE p4z_meso                    ! Empty routine
+   END SUBROUTINE p4z_meso
+#endif 
+
+   !!======================================================================
+END MODULE  p4zmeso
Index: branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zmicro.F
===================================================================
--- branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zmicro.F	(revision 773)
+++ 	(revision )
@@ -1,169 +1,0 @@
-
-CCC $Header$ 
-CCC  TOP 1.0 , LOCEAN-IPSL (2005) 
-C This software is governed by CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
-C ---------------------------------------------------------------------------
-CDIR$ LIST
-      SUBROUTINE p4zmicro
-#if defined key_top && defined key_pisces
-CCC---------------------------------------------------------------------
-CCC
-CCC           ROUTINE p4zmicro : PISCES MODEL
-CCC           *******************************
-CCC
-CCC  PURPOSE :
-CCC  ---------
-CCC         Compute the sources/sinks for microzooplankton
-CCC
-CC   INPUT :
-CC   -----
-CC      argument
-CC              None
-CC      common
-CC              all the common defined in opa
-CC
-CC
-CC   OUTPUT :                   : no
-CC   ------
-CC
-CC   EXTERNAL :
-CC   --------
-CC              None
-CC
-CC   MODIFICATIONS:
-CC   --------------
-CC      original  : O. Aumont (2004)
-CC----------------------------------------------------------------------
-CC parameters and commons
-CC ======================
-CDIR$ NOLIST
-      USE oce_trc
-      USE trp_trc
-      USE sms
-      IMPLICIT NONE
-CDIR$ LIST
-CC----------------------------------------------------------------------
-CC local declarations
-CC ==================
-      INTEGER ji, jj, jk
-      REAL compadi,compadi2,compaz,compaph,compapoc
-      REAL graze,zdenom,zdenom2
-      REAL zfact,zstep,zinano,zidiat,zipoc
-C
-C    Time step duration for biology
-C    ------------------------------
-C
-        zstep=rfact2/rjjss
-C
-
-        DO jk = 1,jpkm1
-          DO jj = 1,jpj
-            DO ji = 1,jpi
-C
-        compaz = max((trn(ji,jj,jk,jpzoo)-1.E-9),0.)
-        zfact=zstep*tgfunc(ji,jj,jk)*compaz
-#    if defined key_off_degrad
-     &    *facvol(ji,jj,jk)
-#    endif
-C
-C     Respiration rates of both zooplankton
-C     -------------------------------------
-C
-        respz(ji,jj,jk) = resrat*zfact
-     &    *(1.+3.*nitrfac(ji,jj,jk))
-     &    *trn(ji,jj,jk,jpzoo)/(xkmort+trn(ji,jj,jk,jpzoo))
-C
-C     Zooplankton mortality. A square function has been selected with
-C     no real reason except that it seems to be more stable and may
-C     mimic predation.
-C     ---------------------------------------------------------------
-C
-          tortz(ji,jj,jk) = mzrat*1E6*zfact*trn(ji,jj,jk,jpzoo)
-C
-            END DO
-          END DO
-        END DO
-C
-        DO jk = 1,jpkm1
-          DO jj = 1,jpj
-            DO ji = 1,jpi
-C
-        compadi = max((trn(ji,jj,jk,jpdia)-1E-8),0.)
-        compadi2=min(compadi,5.E-7)
-        compaph = max((trn(ji,jj,jk,jpphy)-2E-7),0.)
-        compapoc=max((trn(ji,jj,jk,jppoc)-1E-8),0.)
-C
-C     Microzooplankton grazing
-C     ------------------------
-C
-          zdenom2 = 1./(zprefp*compaph
-     &      +zprefc*compapoc+zprefd*compadi2+rtrn)
-
-          graze = grazrat*zstep*tgfunc(ji,jj,jk)
-     &      *trn(ji,jj,jk,jpzoo)
-#    if defined key_off_degrad
-     &      *facvol(ji,jj,jk)
-#    endif
-
-          zinano=zprefp*compaph*zdenom2
-          zipoc=zprefc*compapoc*zdenom2
-          zidiat=zprefd*compadi2*zdenom2
-
-          zdenom = 1./(xkgraz+zinano*compaph
-     &      +zipoc*compapoc+zidiat*compadi2)
-
-          grazp(ji,jj,jk) = graze*zinano*compaph*zdenom
-          grazm(ji,jj,jk) = graze*zipoc*compapoc*zdenom
-          grazsd(ji,jj,jk) = graze*zidiat*compadi2*zdenom
-
-          grazpf(ji,jj,jk) = grazp(ji,jj,jk)*
-     &      trn(ji,jj,jk,jpnfe)/(trn(ji,jj,jk,jpphy)+rtrn)
-
-          grazpch(ji,jj,jk) = grazp(ji,jj,jk)*
-     &      trn(ji,jj,jk,jpnch)/(trn(ji,jj,jk,jpphy)+rtrn)
-
-          grazmf(ji,jj,jk) = grazm(ji,jj,jk)
-     &      *trn(ji,jj,jk,jpsfe)/(trn(ji,jj,jk,jppoc)+rtrn)
-
-          grazsf(ji,jj,jk) = grazsd(ji,jj,jk)
-     &      *trn(ji,jj,jk,jpdfe)/(trn(ji,jj,jk,jpdia)+rtrn)
-
-          grazss(ji,jj,jk) = grazsd(ji,jj,jk)
-     &      *trn(ji,jj,jk,jpbsi)/(trn(ji,jj,jk,jpdia)+rtrn)
-
-          grazsch(ji,jj,jk) = grazsd(ji,jj,jk)
-     &      *trn(ji,jj,jk,jpdch)/(trn(ji,jj,jk,jpdia)+rtrn)
-C
-            END DO
-          END DO
-        END DO
-C
-        DO jk = 1,jpkm1
-          DO jj = 1,jpj
-            DO ji = 1,jpi
-C
-C    Various remineralization and excretion terms
-C    --------------------------------------------
-C
-          grarem(ji,jj,jk)=(grazp(ji,jj,jk)+grazm(ji,jj,jk)
-     &      +grazsd(ji,jj,jk))*(1.-epsher-unass)
-
-          grafer(ji,jj,jk)=(grazpf(ji,jj,jk)+grazsf(ji,jj,jk)
-     &      +grazmf(ji,jj,jk))*(1.-epsher-unass)
-     &      +(grazm(ji,jj,jk)*max((trn(ji,jj,jk,jpsfe)/
-     &      (trn(ji,jj,jk,jppoc)+rtrn)-ferat3),0.)
-     &      +grazp(ji,jj,jk)*max((trn(ji,jj,jk,jpnfe)/
-     &      (trn(ji,jj,jk,jpphy)+rtrn)-ferat3),0.)
-     &      +grazsd(ji,jj,jk)*max((trn(ji,jj,jk,jpdfe)/
-     &      (trn(ji,jj,jk,jpdia)+rtrn)-ferat3),0.))*epsher
-
-          grapoc(ji,jj,jk)=(grazp(ji,jj,jk)+grazm(ji,jj,jk)
-     &      +grazsd(ji,jj,jk))*unass
-C
-              END DO
-            END DO
-          END DO
-C
-#endif
-      RETURN
-      END
Index: branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zmicro.F90
===================================================================
--- branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zmicro.F90	(revision 775)
+++ branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zmicro.F90	(revision 775)
@@ -0,0 +1,160 @@
+MODULE p4zmicro
+   !!======================================================================
+   !!                         ***  MODULE p4zmicro  ***
+   !! TOP :   PISCES Compute the sources/sinks for microzooplankton
+   !!======================================================================
+   !! History :   1.0  !  2004     (O. Aumont) Original code
+   !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
+   !!----------------------------------------------------------------------
+#if defined key_pisces
+   !!----------------------------------------------------------------------
+   !!   'key_pisces'                                       PISCES bio-model
+   !!----------------------------------------------------------------------
+   !!   p4z_micro       :   Compute the sources/sinks for microzooplankton
+   !!----------------------------------------------------------------------
+   USE oce_trc         !
+   USE trp_trc         ! 
+   USE sms             ! 
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   p4z_micro    ! called in p4zbio.F90
+
+   !!* Substitution
+#  include "domzgr_substitute.h90"
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 2.0 , LOCEAN-IPSL (2007) 
+   !! $Header:$ 
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+   SUBROUTINE p4z_micro
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE p4z_micro  ***
+      !!
+      !! ** Purpose :   Compute the sources/sinks for microzooplankton
+      !!
+      !! ** Method  : - ???
+      !!---------------------------------------------------------------------
+      INTEGER  ::   ji, jj, jk
+      REAL(wp) ::   zcompadi, zcompadi2, zcompaz , zcompaph, zcompapoc
+      REAL(wp) ::   zgraze  , zdenom  , zdenom2
+      REAL(wp) ::   zfact   , zstep   , zinano , zidiat, zipoc
+      !!---------------------------------------------------------------------
+
+        zstep = rfact2 / rjjss      ! Time step duration for biology
+
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+
+               zcompaz = MAX( ( trn(ji,jj,jk,jpzoo) - 1.e-9 ), 0.e0 )
+# if defined key_off_degrad
+               zfact   = zstep * tgfunc(ji,jj,jk) * zcompaz *facvol(ji,jj,jk)
+# else
+               zfact   = zstep * tgfunc(ji,jj,jk) * zcompaz
+# endif
+
+!     Respiration rates of both zooplankton
+!     -------------------------------------
+
+               respz(ji,jj,jk) = resrat * zfact  * ( 1.+ 3.* nitrfac(ji,jj,jk) )     &
+                  &            * trn(ji,jj,jk,jpzoo) / ( xkmort + trn(ji,jj,jk,jpzoo) )
+
+!     Zooplankton mortality. A square function has been selected with
+!     no real reason except that it seems to be more stable and may
+!     mimic predation.
+!     ---------------------------------------------------------------
+
+               tortz(ji,jj,jk) = mzrat * 1.e6 * zfact * trn(ji,jj,jk,jpzoo)
+
+            END DO
+         END DO
+      END DO
+
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+
+               zcompadi  = MAX( ( trn(ji,jj,jk,jpdia) - 1.e-8 ), 0.e0 )
+               zcompadi2 = MIN( zcompadi, 5.e-7 )
+               zcompaph  = MAX( ( trn(ji,jj,jk,jpphy) - 2.e-7 ), 0.e0 )
+               zcompapoc = MAX( ( trn(ji,jj,jk,jppoc) - 1.e-8 ), 0.e0 )
+
+!     Microzooplankton grazing
+!     ------------------------
+               zdenom2 = 1./ ( zprefp * zcompaph + zprefc * zcompapoc + zprefd * zcompadi2 + rtrn )
+
+               zgraze = grazrat * zstep * tgfunc(ji,jj,jk)     &
+# if defined key_off_degrad
+                  &      * facvol(ji,jj,jk)         &
+# endif
+                  &      * trn(ji,jj,jk,jpzoo)
+
+               zinano = zprefp * zcompaph  * zdenom2
+               zipoc  = zprefc * zcompapoc * zdenom2
+               zidiat = zprefd * zcompadi2 * zdenom2
+
+               zdenom = 1./ ( xkgraz + zinano * zcompaph + zipoc * zcompapoc + zidiat * zcompadi2 )
+
+               grazp (ji,jj,jk) = zgraze * zinano * zcompaph * zdenom
+               grazm (ji,jj,jk) = zgraze * zipoc  * zcompapoc * zdenom
+               grazsd(ji,jj,jk) = zgraze * zidiat * zcompadi2 * zdenom
+
+               grazpf (ji,jj,jk) = grazp (ji,jj,jk) * trn(ji,jj,jk,jpnfe) / (trn(ji,jj,jk,jpphy) + rtrn)
+
+               grazpch(ji,jj,jk) = grazp (ji,jj,jk) * trn(ji,jj,jk,jpnch) / (trn(ji,jj,jk,jpphy) + rtrn)
+
+               grazmf (ji,jj,jk) = grazm (ji,jj,jk) * trn(ji,jj,jk,jpsfe) / (trn(ji,jj,jk,jppoc) + rtrn)
+
+               grazsf (ji,jj,jk) = grazsd(ji,jj,jk) * trn(ji,jj,jk,jpdfe) / (trn(ji,jj,jk,jpdia) + rtrn)
+
+               grazss (ji,jj,jk) = grazsd(ji,jj,jk) * trn(ji,jj,jk,jpbsi) / (trn(ji,jj,jk,jpdia) + rtrn)
+
+               grazsch(ji,jj,jk) = grazsd(ji,jj,jk) * trn(ji,jj,jk,jpdch) / (trn(ji,jj,jk,jpdia) + rtrn)
+
+            END DO
+         END DO
+      END DO
+
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+
+!    Various remineralization and excretion terms
+!    --------------------------------------------
+
+               grarem(ji,jj,jk) = (  grazp(ji,jj,jk) + grazm (ji,jj,jk)        &
+                  &                                  + grazsd(ji,jj,jk)  ) * ( 1.- epsher - unass )
+
+               grafer(ji,jj,jk) = (  grazpf(ji,jj,jk) + grazsf(ji,jj,jk)      &
+                  &                                   + grazmf(ji,jj,jk)  ) * ( 1.- epsher - unass )   &
+                  &             + (  grazm (ji,jj,jk) * MAX( (trn(ji,jj,jk,jpsfe) /     &
+                  &                                          (trn(ji,jj,jk,jppoc) + rtrn) - ferat3), 0.e0 )   &
+                  &                + grazp (ji,jj,jk) * MAX( (trn(ji,jj,jk,jpnfe) /   &
+                  &                                          (trn(ji,jj,jk,jpphy) + rtrn) - ferat3), 0.e0 )   &
+                  &                + grazsd(ji,jj,jk) * MAX( (trn(ji,jj,jk,jpdfe) /   &
+                  &                                         (trn(ji,jj,jk,jpdia) + rtrn) - ferat3), 0.e0 )  ) * epsher 
+
+               grapoc(ji,jj,jk) = (  grazp(ji,jj,jk) + grazm(ji,jj,jk) + grazsd(ji,jj,jk)  ) * unass
+
+            END DO
+         END DO
+      END DO
+      !
+   END SUBROUTINE p4z_micro
+
+#else
+   !!======================================================================
+   !!  Dummy module :                                   No PISCES bio-model
+   !!======================================================================
+CONTAINS
+   SUBROUTINE p4z_micro                    ! Empty routine
+   END SUBROUTINE p4z_micro
+#endif 
+
+   !!======================================================================
+END MODULE  p4zmicro
Index: branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4znano.F
===================================================================
--- branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4znano.F	(revision 773)
+++ 	(revision )
@@ -1,102 +1,0 @@
-
-CCC $Header$ 
-CCC  TOP 1.0 , LOCEAN-IPSL (2005) 
-C This software is governed by CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
-C ---------------------------------------------------------------------------
-CDIR$ LIST
-      SUBROUTINE p4znano
-#if defined key_top && defined key_pisces
-CCC---------------------------------------------------------------------
-CCC
-CCC          ROUTINE p4znano : PISCES MODEL
-CCC          ******************************
-CCC
-CCC  PURPOSE :
-CCC  ---------
-CCC         Compute the mortality terms for nanophytoplankton
-CCC
-CC   INPUT :
-CC   -----
-CC      argument
-CC              None
-CC      common
-CC              all the common defined in opa
-CC
-CC
-CC   OUTPUT :                   : no
-CC   ------
-CC
-CC   EXTERNAL :
-CC   --------
-CC          None
-CC
-CC   MODIFICATIONS:
-CC   --------------
-CC      original  : O. Aumont (2002)
-CC----------------------------------------------------------------------
-CC parameters and commons
-CC ======================
-CDIR$ NOLIST
-      USE oce_trc
-      USE trp_trc
-      USE sms
-      IMPLICIT NONE
-CDIR$ LIST
-CC----------------------------------------------------------------------
-CC local declarations
-CC ==================
-      INTEGER ji, jj, jk
-      REAL zfact,zstep,compaph
-C
-C      Time step duration for biology
-C      ------------------------------
-C
-        zstep=rfact2/rjjss
-C
-        DO jk = 1,jpkm1
-          DO jj = 1,jpj
-            DO ji = 1,jpi
-C
-        compaph = max((trn(ji,jj,jk,jpphy)-1E-8),0.)
-        zfact=1./(trn(ji,jj,jk,jpphy)+rtrn)
-C
-C     Squared mortality of Phyto similar to a sedimentation term during
-C     blooms (Doney et al. 1996)
-C     -----------------------------------------------------------------
-C
-        respp(ji,jj,jk) = wchl*1e6*zstep*zdiss(ji,jj,jk)
-     &    *compaph*trn(ji,jj,jk,jpphy)
-#    if defined key_off_degrad
-     &    *facvol(ji,jj,jk)
-#    endif
-                                                                               
-        respnf(ji,jj,jk) = respp(ji,jj,jk)
-     &    *trn(ji,jj,jk,jpnfe)*zfact
-                                                                               
-        respnch(ji,jj,jk) = respp(ji,jj,jk)
-     &    *trn(ji,jj,jk,jpnch)*zfact
-C
-C     Phytoplankton mortality. This mortality loss is slightly
-C     increased when nutrients are limiting phytoplankton growth
-C     as observed for instance in case of iron limitation.
-C     ----------------------------------------------------------
-C
-        tortp(ji,jj,jk) = mprat*zstep*trn(ji,jj,jk,jpphy)
-     $    /(xkmort+trn(ji,jj,jk,jpphy))*compaph
-#    if defined key_off_degrad
-     &    *facvol(ji,jj,jk)
-#    endif
-                                                                               
-        tortnf(ji,jj,jk)=tortp(ji,jj,jk)
-     &    *trn(ji,jj,jk,jpnfe)*zfact
-                                                                               
-        tortnch(ji,jj,jk)=tortp(ji,jj,jk)
-     &    *trn(ji,jj,jk,jpnch)*zfact
-C
-            END DO
-          END DO
-        END DO
-C
-#endif
-      RETURN
-      END
Index: branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4znano.F90
===================================================================
--- branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4znano.F90	(revision 775)
+++ branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4znano.F90	(revision 775)
@@ -0,0 +1,100 @@
+MODULE p4znano
+   !!======================================================================
+   !!                         ***  MODULE p4znano  ***
+   !! TOP :   PISCES Compute the mortality terms for nanophytoplankton
+   !!======================================================================
+   !! History :   1.0  !  2002     (O. Aumont) Original code
+   !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
+   !!----------------------------------------------------------------------
+#if defined key_pisces
+   !!----------------------------------------------------------------------
+   !!   'key_pisces'                                       PISCES bio-model
+   !!----------------------------------------------------------------------
+   !!   p4z_nano       :   Compute the mortality terms for nanophytoplankton
+   !!----------------------------------------------------------------------
+   USE oce_trc         !
+   USE trp_trc         ! 
+   USE sms             ! 
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   p4z_nano    ! called in p4zbio.F90
+
+   !!* Substitution
+#  include "domzgr_substitute.h90"
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 2.0 , LOCEAN-IPSL (2007) 
+   !! $Header:$ 
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+   SUBROUTINE p4z_nano
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE p4z_nano  ***
+      !!
+      !! ** Purpose :   Compute the mortality terms for nanophytoplankton
+      !!
+      !! ** Method  : - ???
+      !!---------------------------------------------------------------------
+      INTEGER  ::   ji, jj, jk
+      REAL(wp) ::   zfact, zstep, zcompaph
+      !!---------------------------------------------------------------------
+
+
+      zstep = rfact2 / rjjss      ! Time step duration for biology
+
+
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+
+               zcompaph = MAX( ( trn(ji,jj,jk,jpphy) - 1e-8 ), 0.e0 )
+               zfact    = 1./ ( trn(ji,jj,jk,jpphy) + rtrn )
+
+!     Squared mortality of Phyto similar to a sedimentation term during
+!     blooms (Doney et al. 1996)
+!     -----------------------------------------------------------------
+               respp(ji,jj,jk) = wchl * 1.e6 * zstep * zdiss(ji,jj,jk)   &
+# if defined key_off_degrad
+                  &            * facvol(ji,jj,jk)     &
+# endif
+                  &            * zcompaph * trn(ji,jj,jk,jpphy)
+                                                                               
+               respnf (ji,jj,jk) = respp(ji,jj,jk) * trn(ji,jj,jk,jpnfe) * zfact
+                                                                               
+               respnch(ji,jj,jk) = respp(ji,jj,jk) * trn(ji,jj,jk,jpnch) * zfact
+
+!     Phytoplankton mortality. This mortality loss is slightly
+!     increased when nutrients are limiting phytoplankton growth
+!     as observed for instance in case of iron limitation.
+!     ----------------------------------------------------------
+               tortp  (ji,jj,jk) = mprat * zstep * trn(ji,jj,jk,jpphy)          &
+# if defined key_off_degrad
+                  &              * facvol(ji,jj,jk)     &
+# endif
+                  &              / ( xkmort + trn(ji,jj,jk,jpphy) ) * zcompaph
+                                                                               
+               tortnf (ji,jj,jk) = tortp(ji,jj,jk) * trn(ji,jj,jk,jpnfe) * zfact
+                                                                               
+               tortnch(ji,jj,jk) = tortp(ji,jj,jk) * trn(ji,jj,jk,jpnch) * zfact
+
+            END DO
+         END DO
+      END DO
+      !
+   END SUBROUTINE p4z_nano
+
+#else
+   !!======================================================================
+   !!  Dummy module :                                   No PISCES bio-model
+   !!======================================================================
+CONTAINS
+   SUBROUTINE p4z_nano                    ! Empty routine
+   END SUBROUTINE p4z_nano
+#endif 
+
+   !!======================================================================
+END MODULE  p4znano
Index: branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zopt.F
===================================================================
--- branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zopt.F	(revision 773)
+++ 	(revision )
@@ -1,240 +1,0 @@
-
-CCC $Header$ 
-CCC  TOP 1.0 , LOCEAN-IPSL (2005) 
-C This software is governed by CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
-C ---------------------------------------------------------------------------
-CDIR$ LIST
-      SUBROUTINE p4zopt
-#if defined key_top && defined key_pisces
-CCC---------------------------------------------------------------------
-CCC
-CCC             ROUTINE p4zopt : PISCES MODEL
-CCC             *****************************
-CCC
-CCC  PURPOSE :
-CCC  ---------
-CCC         Compute the light availability in the water column
-CCC         depending on the depth and the chlorophyll concentration
-CCC
-CC   INPUT :
-CC   -----
-CC      argument
-CC              None
-CC      common
-CC              all the common defined in opa
-CC
-CC
-CC   OUTPUT :                   : no
-CC   ------
-CC
-CC   MODIFICATIONS:
-CC   --------------
-CC      original  : O. Aumont (2004)
-CC----------------------------------------------------------------------
-CC parameters and commons
-CC ======================
-CDIR$ NOLIST
-      USE oce_trc
-      USE trp_trc
-      USE sms
-      IMPLICIT NONE
-#include "domzgr_substitute.h90"
-CDIR$ LIST
-CC----------------------------------------------------------------------
-CC local declarations
-CC ==================
-      INTEGER ji, jj, jk, mrgb
-      REAL xchl,ekg(jpi,jpj,jpk),ekr(jpi,jpj,jpk),ekb(jpi,jpj,jpk)
-      REAL parlux,e1(jpi,jpj,jpk),e2(jpi,jpj,jpk),e3(jpi,jpj,jpk)
-      REAL zdepmoy(jpi,jpj),etmp(jpi,jpj)
-      REAL zrlight,zblight,zglight
-      REAL zrlight1,zblight1,zglight1
-      REAL e3lum(jpi,jpj,jpk),e4lum(jpi,jpj,jpk)
-      REAL e5lum(jpi,jpj,jpk),e6lum(jpi,jpj,jpk)
-C
-C     Initialisation of variables used to compute PAR
-C     -----------------------------------------------
-C
-        e1     = 0.
-        e2     = 0.
-        e3     = 0.
-        etot   = 0.
-        parlux = 0.43/3.
-
-        IF (ln_qsr_sms) THEN
-C
-C    IF activated, computation of the qsr for the dynamics
-C    -----------------------------------------------------
-C
-          e3lum=0.
-          e4lum=0.
-          e5lum=0.
-          e6lum=0.
-        ENDIF
-
-        DO jk=1,jpkm1
-          DO jj=1,jpj
-            DO ji=1,jpi
-C
-C     Separation in three light bands: red, green, blue
-C     -------------------------------------------------
-C
-        xchl=(trn(ji,jj,jk,jpnch)+trn(ji,jj,jk,jpdch)+rtrn)*1.E6
-        xchl=max(0.03,xchl)
-        xchl=min(10.,xchl)
-                                                                                
-        mrgb = int(41+20.*log10(xchl)+rtrn)
-                                                                                
-        ekb(ji,jj,jk)=xkrgb(1,mrgb)
-        ekg(ji,jj,jk)=xkrgb(2,mrgb)
-        ekr(ji,jj,jk)=xkrgb(3,mrgb)
-C
-            END DO
-          END DO
-        END DO
-C
-          DO jj = 1,jpj
-            DO ji = 1,jpi
-C
-C     Separation in three light bands: red, green, blue
-C     -------------------------------------------------
-C
-        zblight=0.5*ekb(ji,jj,1)*fse3t(ji,jj,1)
-        zglight=0.5*ekg(ji,jj,1)*fse3t(ji,jj,1)
-        zrlight=0.5*ekr(ji,jj,1)*fse3t(ji,jj,1)
-C
-        e1(ji,jj,1) = parlux*qsr(ji,jj)*exp(-zblight)
-        e2(ji,jj,1) = parlux*qsr(ji,jj)*exp(-zglight)
-        e3(ji,jj,1) = parlux*qsr(ji,jj)*exp(-zrlight)
-C
-            END DO
-          END DO
-
-        DO jk = 2,jpkm1
-          DO jj = 1,jpj
-            DO ji = 1,jpi
-C
-C     Separation in three light bands: red, green, blue
-C     -------------------------------------------------
-C
-        zblight=0.5*(ekb(ji,jj,jk-1)*fse3t(ji,jj,jk-1)
-     &    +ekb(ji,jj,jk)*fse3t(ji,jj,jk))
-        zglight=0.5*(ekg(ji,jj,jk-1)*fse3t(ji,jj,jk-1)
-     &    +ekg(ji,jj,jk)*fse3t(ji,jj,jk))
-        zrlight=0.5*(ekr(ji,jj,jk-1)*fse3t(ji,jj,jk-1)
-     &    +ekr(ji,jj,jk)*fse3t(ji,jj,jk))
-C
-        e1(ji,jj,jk) = e1(ji,jj,jk-1)*exp(-zblight)
-        e2(ji,jj,jk) = e2(ji,jj,jk-1)*exp(-zglight)
-        e3(ji,jj,jk) = e3(ji,jj,jk-1)*exp(-zrlight)
-C
-            END DO
-          END DO
-        END DO
-C
-        etot(:,:,:) = e1(:,:,:)+e2(:,:,:)+e3(:,:,:)
-
-        IF (ln_qsr_sms) THEN
-C
-C   In the following, the vertical attenuation of qsr for the 
-C   dynamics is computed
-C   ---------------------------------------------------------
-C
-          DO jj = 1,jpj
-            DO ji = 1,jpi
-C
-C     Separation in three light bands: red, green, blue
-C     -------------------------------------------------
-C
-        zblight=0.5*ekb(ji,jj,1)*fse3t(ji,jj,1)
-        zglight=0.5*ekg(ji,jj,1)*fse3t(ji,jj,1)
-        zrlight=0.5*ekr(ji,jj,1)*fse3t(ji,jj,1)
-C
-        e3lum(ji,jj,1) = parlux*qsr(ji,jj)
-        e4lum(ji,jj,1) = parlux*qsr(ji,jj)
-        e5lum(ji,jj,1) = parlux*qsr(ji,jj)
-        e6lum(ji,jj,1) = (1.-3.*parlux)*qsr(ji,jj)
-C
-            END DO
-          END DO
-
-        DO jk = 2,jpkm1
-          DO jj = 1,jpj
-            DO ji = 1,jpi
-C
-C     Separation in three light bands: red, green, blue
-C     -------------------------------------------------
-C
-        zblight1=ekb(ji,jj,jk-1)*fse3t(ji,jj,jk-1)
-        zglight1=ekg(ji,jj,jk-1)*fse3t(ji,jj,jk-1)
-        zrlight1=ekr(ji,jj,jk-1)*fse3t(ji,jj,jk-1)
-
-        e3lum(ji,jj,jk) = e3lum(ji,jj,jk-1)*exp(-zblight)
-        e4lum(ji,jj,jk) = e4lum(ji,jj,jk-1)*exp(-zglight)
-        e5lum(ji,jj,jk) = e5lum(ji,jj,jk-1)*exp(-zrlight)
-        e6lum(ji,jj,jk) = e6lum(ji,jj,jk-1)
-     &    *exp(-fse3t(ji,jj,jk-1)/xsi1)
-C
-            END DO
-          END DO
-        END DO
-
-        etot3(:,:,:)=e3lum(:,:,:)+e4lum(:,:,:)+e5lum(:,:,:)
-     &    +e6lum(:,:,:)
-
-        ENDIF
-C    
-C     Computation of the euphotic depth
-C     ---------------------------------
-C    
-        zmeu(:,:) = 300.
-
-        DO jk = 2,jpkm1
-          DO jj = 1,jpj
-            DO ji = 1,jpi
-        IF (etot(ji,jj,jk).GE.0.0043*qsr(ji,jj)) THEN
-           zmeu(ji,jj) = fsdepw(ji,jj,jk+1)
-        ENDIF
-            END DO
-          END DO
-        END DO
-C
-        zmeu(:,:)=min(300.,zmeu(:,:))
-C
-C    Computation of the mean light over the mixed layer depth
-C    --------------------------------------------------------
-C
-        zdepmoy  = 0
-        etmp  = 0.
-        emoy  = 0.
-
-        DO jk = 1,jpkm1
-          DO jj = 1,jpj
-            DO ji = 1,jpi
-         if (fsdepw(ji,jj,jk+1).le.hmld(ji,jj)) then
-       etmp(ji,jj) = etmp(ji,jj)+etot(ji,jj,jk)*fse3t(ji,jj,jk)
-       zdepmoy(ji,jj)=zdepmoy(ji,jj)+fse3t(ji,jj,jk)
-         endif
-            END DO
-          END DO
-        END DO
-
-        emoy(:,:,:) = etot(:,:,:)
-
-        DO jk = 1,jpkm1
-          DO jj = 1,jpj
-            DO ji = 1,jpi
-        IF (fsdepw(ji,jj,jk+1).LE.hmld(ji,jj)) THEN
-          emoy(ji,jj,jk) = etmp(ji,jj)/(zdepmoy(ji,jj)+rtrn)
-        ENDIF
-            END DO
-          END DO
-        END DO
-
-#   if defined key_trc_diaadd
-        trc2d(:,:,11) = zmeu(:,:)
-#    endif
-C
-#endif
-      RETURN
-      END
Index: branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zopt.F90
===================================================================
--- branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zopt.F90	(revision 775)
+++ branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zopt.F90	(revision 775)
@@ -0,0 +1,242 @@
+MODULE p4zopt
+   !!======================================================================
+   !!                         ***  MODULE p4zopt  ***
+   !! TOP :   PISCES Compute the light availability in the water column
+   !!======================================================================
+   !! History :   1.0  !  2004     (O. Aumont) Original code
+   !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
+   !!----------------------------------------------------------------------
+#if defined key_pisces
+   !!----------------------------------------------------------------------
+   !!   'key_pisces'                                       PISCES bio-model
+   !!----------------------------------------------------------------------
+   !!   p4z_opt        :   Compute the light availability in the water column
+   !!----------------------------------------------------------------------
+   USE oce_trc         !
+   USE trp_trc
+   USE sms
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   p4z_opt   ! called in p4zprg.F90
+
+   !!* Substitution
+#  include "domzgr_substitute.h90"
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 2.0 , LOCEAN-IPSL (2007) 
+   !! $Header:$ 
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+   SUBROUTINE p4z_opt
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE p4z_opt  ***
+      !!
+      !! ** Purpose :   Compute the light availability in the water column
+      !!              depending on the depth and the chlorophyll concentration
+      !!
+      !! ** Method  : - ???
+      !!---------------------------------------------------------------------
+      INTEGER  ::   ji, jj, jk
+      INTEGER  ::   irgb
+      REAL(wp) ::   zchl, zparlux
+      REAL(wp) ::   zrlight , zblight , zglight
+      REAL(wp) ::   zrlight1, zblight1, zglight1
+      REAL(wp), DIMENSION(jpi,jpj)     ::   zdepmoy, zetmp
+      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zekg, zekr, zekb
+      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   ze1 , ze2 , ze3
+      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   ze3lum, ze4lum
+      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   ze5lum, ze6lum
+      !!---------------------------------------------------------------------
+
+!     Initialisation of variables used to compute PAR
+!     -----------------------------------------------
+      ze1 (:,:,:) = 0.e0
+      ze2 (:,:,:) = 0.e0
+      ze3 (:,:,:) = 0.e0
+      etot(:,:,:) = 0.e0
+        
+      zparlux = 0.43 / 3.
+
+!    IF activated, computation of the qsr for the dynamics
+!    -----------------------------------------------------
+      IF( ln_qsr_sms ) THEN
+         ze3lum(:,:,:) = 0.e0
+         ze4lum(:,:,:) = 0.e0
+         ze5lum(:,:,:) = 0.e0
+         ze6lum(:,:,:) = 0.e0
+      ENDIF
+
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+
+!     Separation in three light bands: red, green, blue
+!     -------------------------------------------------
+               zchl = ( trn(ji,jj,jk,jpnch) + trn(ji,jj,jk,jpdch) + rtrn ) * 1.e6
+               zchl = MAX( 0.03, zchl )
+               zchl = MIN( 10. , zchl )
+                                                                                
+               irgb = INT( 41 + 20.* LOG10( zchl ) + rtrn )
+                                                                                
+               zekb(ji,jj,jk) = xkrgb(1,irgb)
+               zekg(ji,jj,jk) = xkrgb(2,irgb)
+               zekr(ji,jj,jk) = xkrgb(3,irgb)
+
+            END DO
+         END DO
+      END DO
+
+      DO jj = 1,jpj
+         DO ji = 1,jpi
+
+!     Separation in three light bands: red, green, blue
+!     -------------------------------------------------
+
+            zblight = 0.5 * zekb(ji,jj,1) * fse3t(ji,jj,1)
+            zglight = 0.5 * zekg(ji,jj,1) * fse3t(ji,jj,1)
+            zrlight = 0.5 * zekr(ji,jj,1) * fse3t(ji,jj,1)
+
+            ze1(ji,jj,1) = zparlux * qsr(ji,jj) * EXP(-zblight)
+            ze2(ji,jj,1) = zparlux * qsr(ji,jj) * EXP(-zglight)
+            ze3(ji,jj,1) = zparlux * qsr(ji,jj) * EXP(-zrlight)
+
+         END DO
+      END DO
+
+      DO jk = 2, jpkm1
+          DO jj = 1, jpj
+            DO ji = 1, jpi
+
+!     Separation in three light bands: red, green, blue
+!     -------------------------------------------------
+
+               zblight = 0.5 * ( zekb(ji,jj,jk-1) * fse3t(ji,jj,jk-1)   &
+                  &            + zekb(ji,jj,jk  ) * fse3t(ji,jj,jk  ) )
+               zglight = 0.5 * ( zekg(ji,jj,jk-1) * fse3t(ji,jj,jk-1)   &
+                  &            + zekg(ji,jj,jk  ) * fse3t(ji,jj,jk  ) )
+               zrlight = 0.5 * ( zekr(ji,jj,jk-1) * fse3t(ji,jj,jk-1)   &
+                  &            + zekr(ji,jj,jk  ) * fse3t(ji,jj,jk  ) )
+
+               ze1(ji,jj,jk) = ze1(ji,jj,jk-1) * EXP(-zblight)
+               ze2(ji,jj,jk) = ze2(ji,jj,jk-1) * EXP(-zglight)
+               ze3(ji,jj,jk) = ze3(ji,jj,jk-1) * EXP(-zrlight)
+
+            END DO
+         END DO
+      END DO
+
+      etot(:,:,:) = ze1(:,:,:) + ze2(:,:,:) + ze3(:,:,:)
+
+      IF( ln_qsr_sms ) THEN
+
+!   In the following, the vertical attenuation of qsr for the dynamics is computed
+!   ------------------------------------------------------------------------------
+
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+
+!     Separation in three light bands: red, green, blue
+!     -------------------------------------------------
+
+               zblight = 0.5 * zekb(ji,jj,1) * fse3t(ji,jj,1)
+               zglight = 0.5 * zekg(ji,jj,1) * fse3t(ji,jj,1)
+               zrlight = 0.5 * zekr(ji,jj,1) * fse3t(ji,jj,1)
+
+               ze3lum(ji,jj,1) = zparlux * qsr(ji,jj)
+               ze4lum(ji,jj,1) = zparlux * qsr(ji,jj)
+               ze5lum(ji,jj,1) = zparlux * qsr(ji,jj)
+               ze6lum(ji,jj,1) = (1.-3. * zparlux) * qsr(ji,jj)
+
+            END DO
+         END DO
+
+         DO jk = 2, jpkm1
+            DO jj = 1, jpj
+               DO ji = 1, jpi
+
+!     Separation in three light bands: red, green, blue
+!     -------------------------------------------------
+
+                  zblight1 = zekb(ji,jj,jk-1) * fse3t(ji,jj,jk-1)
+                  zglight1 = zekg(ji,jj,jk-1) * fse3t(ji,jj,jk-1)
+                  zrlight1 = zekr(ji,jj,jk-1) * fse3t(ji,jj,jk-1)
+
+                  ze3lum(ji,jj,jk) = ze3lum(ji,jj,jk-1) * EXP( -zblight )
+                  ze4lum(ji,jj,jk) = ze4lum(ji,jj,jk-1) * EXP( -zglight )
+                  ze5lum(ji,jj,jk) = ze5lum(ji,jj,jk-1) * EXP( -zrlight )
+                  ze6lum(ji,jj,jk) = ze6lum(ji,jj,jk-1) * EXP( -fse3t(ji,jj,jk-1) / xsi1 )
+
+               END DO
+            END DO
+         END DO
+
+         etot3(:,:,:) = ze3lum(:,:,:) + ze4lum(:,:,:) + ze5lum(:,:,:) + ze6lum(:,:,:)
+
+      ENDIF
+
+!     Computation of the euphotic depth
+!     ---------------------------------
+    
+      zmeu(:,:) = 300.e0
+
+      DO jk = 2, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               IF( etot(ji,jj,jk) >= 0.0043 * qsr(ji,jj) )   zmeu(ji,jj) = fsdepw(ji,jj,jk+1)
+            END DO
+         END DO
+      END DO
+
+      zmeu(:,:) = MIN( 300., zmeu(:,:) )
+
+!    Computation of the mean light over the mixed layer depth
+!    --------------------------------------------------------
+
+      zdepmoy(:,:)   = 0.e0
+      zetmp  (:,:)   = 0.e0
+      emoy   (:,:,:) = 0.e0
+
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               IF( fsdepw(ji,jj,jk+1) <= hmld(ji,jj) ) THEN
+                  zetmp  (ji,jj) = zetmp  (ji,jj) + etot(ji,jj,jk) * fse3t(ji,jj,jk)
+                  zdepmoy(ji,jj) = zdepmoy(ji,jj) +                  fse3t(ji,jj,jk)
+               ENDIF
+            END DO
+         END DO
+      END DO
+
+      emoy(:,:,:) = etot(:,:,:)
+
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               IF( fsdepw(ji,jj,jk+1) <= hmld(ji,jj) ) THEN
+                  emoy(ji,jj,jk) = zetmp(ji,jj) / ( zdepmoy(ji,jj) + rtrn )
+               ENDIF
+            END DO
+         END DO
+      END DO
+
+# if defined key_trc_diaadd
+      trc2d(:,:,11) = zmeu(:,:)
+# endif
+      !
+   END SUBROUTINE p4z_opt
+
+#else
+   !!======================================================================
+   !!  Dummy module :                                   No PISCES bio-model
+   !!======================================================================
+CONTAINS
+   SUBROUTINE p4z_opt                   ! Empty routine
+   END SUBROUTINE p4z_opt
+#endif 
+
+   !!======================================================================
+END MODULE  p4zopt
Index: branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zprg.F
===================================================================
--- branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zprg.F	(revision 773)
+++ 	(revision )
@@ -1,118 +1,0 @@
-
-CCC $Header$ 
-CCC  TOP 1.0 , LOCEAN-IPSL (2005) 
-C This software is governed by CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
-C ---------------------------------------------------------------------------
-CDIR$ LIST
-       SUBROUTINE p4zprg(kt)
-CCC---------------------------------------------------------------------
-CCC
-CCC           ROUTINE p4zprg : PISCES MODEL
-CCC           *****************************
-CCC
-CCC  PURPOSE :
-CCC  ---------
-CCC     Call Biological sources and sinks subroutines
-CCC
-CC   INPUT :
-CC   -----
-CC      argument
-CC              ktask           : task identificator
-CC              kt              : time step
-CC      common
-CC              all the common defined in opa
-CC
-CC
-CC   OUTPUT :                   : no
-CC   ------
-CC
-CC   WORKSPACE :
-CC   ---------
-CC
-CC   EXTERNAL :
-CC   --------
-CC      p4zche, p4zint, p4zlys, p4zbio, p4zsed, p4zflx
-CC
-CC   MODIFICATIONS:
-CC   --------------
-CC      original  : O. AUMONT (2004)
-CC----------------------------------------------------------------------
-CC parameters and commons
-CC ======================
-CDIR$ NOLIST
-      USE trp_trc
-      USE sms
-CC
-      USE oce_trc
-      USE lbclnk
-      USE lib_mpp
-CC
-      IMPLICIT NONE
-CDIR$ LIST
-CC----------------------------------------------------------------------
-CC local declarations
-CC ==================
-
-      INTEGER kt
-#if defined key_top && defined key_pisces
-      INTEGER jnt, jn
-
-C
-C this part is without macrotasking coding
-C
-C Call an intermediate routine that in turns, calls chemistry
-C and another routine on a daily basis
-C -----------------------------------------------------------
-C
-      CALL p4zslow(kt)
-
-C......................................................................
-C
-C Compute soft tissue production (POC)
-C ------------------------------------
-
-       do jnt=1,nrdttrc
-C
-         CALL p4zbio
-
-C
-C......................................................................
-C
-C Compute soft tissue remineralisation
-C ------------------------------------
-C
-         CALL p4zsed
-
-C
-          trb=trn
-        END DO
-C
-C......................................................................
-C
-C Compute CaCO3 saturation
-C ------------------------
-C
-      CALL p4zlys
-
-C
-C......................................................................
-C
-C Compute surface fluxes
-C ----------------------
-C
-      CALL p4zflx
-
-
-      DO jn=1 , jptra
-        CALL lbc_lnk(trn(:,:,:,jn), 'T', 1. )
-        CALL lbc_lnk(trb(:,:,:,jn), 'T', 1. )
-        CALL lbc_lnk(tra(:,:,:,jn), 'T', 1. )
-      END DO
-
-C
-C......................................................................
-C
-#endif
-C
-      RETURN
-      END
Index: branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zprg.F90
===================================================================
--- branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zprg.F90	(revision 775)
+++ branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zprg.F90	(revision 775)
@@ -0,0 +1,108 @@
+MODULE p4zprg
+   !!======================================================================
+   !!                         ***  MODULE p4zprg  ***
+   !! TOP :   PISCES Source Minus Sink manager
+   !!======================================================================
+   !! History :   1.0  !  2004-03 (O. Aumont) Original code
+   !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
+   !!----------------------------------------------------------------------
+#if defined key_pisces
+   !!----------------------------------------------------------------------
+   !!   'key_pisces'                                       PISCES bio-model
+   !!----------------------------------------------------------------------
+   !!   p4z_prg        :  Time loop of passive tracers sms
+   !!----------------------------------------------------------------------
+   USE oce_trc         !
+   USE trp_trc
+   USE sms
+   USE lbclnk
+   USE lib_mpp
+   
+   USE p4zint          ! 
+   USE p4zche          ! 
+   USE p4zbio          ! 
+   USE p4zsed          ! 
+   USE p4zlys          ! 
+   USE p4zflx          ! 
+   
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   p4z_prg    ! called in trcsms.F90
+
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 2.0 , LOCEAN-IPSL (2007) 
+   !! $Header:$ 
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+   SUBROUTINE p4z_prg( kt )
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE p4z_prg  ***
+      !!
+      !! ** Purpose :   Managment of the call to Biological sources and sinks 
+      !!              routines of PISCES bio-model
+      !!
+      !! ** Method  : - at each new day ...
+      !!              - several calls of bio and sed ???
+      !!              - ...
+      !!---------------------------------------------------------------------
+      INTEGER, INTENT( in ) ::   kt      ! ocean time-step index      
+      !!
+      INTEGER ::   jnt, jn
+      INTEGER ::   iyy, imm, idd
+      !!---------------------------------------------------------------------
+
+
+      iyy = ndastp/10000
+      imm = (ndastp - iyy*10000)/100
+      idd = (ndastp - iyy*10000 - imm*100)
+
+      IF( ndayflxtr /= idd) THEN      ! New days
+         !
+         ndayflxtr = idd
+
+         CALL p4z_che          ! computation of chemical constants
+
+         CALL p4z_int( kt )    ! computation of various rates for biogeochemistry
+         !
+      ENDIF
+
+
+      DO jnt = 1, nrdttrc             ! ???
+         !
+         CALL p4z_bio          ! Compute soft tissue production (POC)
+
+         CALL p4z_sed          ! compute soft tissue remineralisation
+         !
+         trb(:,:,:,:) = trn(:,:,:,:)
+         !
+      END DO
+
+      CALL p4z_lys             ! Compute CaCO3 saturation
+
+      CALL p4z_flx             ! Compute surface fluxes
+
+      DO jn = 1, jptra
+        CALL lbc_lnk( trn(:,:,:,jn), 'T', 1. )
+        CALL lbc_lnk( trb(:,:,:,jn), 'T', 1. )
+        CALL lbc_lnk( tra(:,:,:,jn), 'T', 1. )
+      END DO
+      !
+   END SUBROUTINE p4z_prg
+
+#else
+   !!======================================================================
+   !!  Dummy module :                                   No PISCES bio-model
+   !!======================================================================
+CONTAINS
+   SUBROUTINE p4z_prg( kt )                   ! Empty routine
+      INTEGER, INTENT( in ) ::   kt
+      WRITE(*,*) 'p4z_prg: You should not have seen this print! error?', kt
+   END SUBROUTINE p4z_prg
+#endif 
+
+   !!======================================================================
+END MODULE  p4zprg
Index: branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zprod.F
===================================================================
--- branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zprod.F	(revision 773)
+++ 	(revision )
@@ -1,266 +1,0 @@
-
-CCC $Header$ 
-CCC  TOP 1.0 , LOCEAN-IPSL (2005) 
-C This software is governed by CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
-C ---------------------------------------------------------------------------
-CDIR$ LIST
-      SUBROUTINE p4zprod
-#if defined key_top && defined key_pisces
-CCC---------------------------------------------------------------------
-CCC
-CCC           ROUTINE p4zprod : PISCES MODEL
-CCC           ******************************
-CCC
-CCC  PURPOSE :
-CCC  ---------
-CCC         Compute the phytoplankton production depending on
-CCC         light, temperature and nutrient availability
-CCC
-CC   INPUT :
-CC   -----
-CC      argument
-CC              None
-CC      common
-CC              all the common defined in opa
-CC
-CC
-CC   OUTPUT :                   : no
-CC   ------
-CC
-CC   EXTERNAL :
-CC   --------
-CC             p4zday
-CC
-CC   MODIFICATIONS:
-CC   --------------
-CC      original  : O. Aumont (2004) 
-CC----------------------------------------------------------------------
-CC parameters and commons
-CC ======================
-CDIR$ NOLIST
-      USE oce_trc
-      USE trp_trc
-      USE sms
-      IMPLICIT NONE
-#include "domzgr_substitute.h90"
-CDIR$ LIST
-CC----------------------------------------------------------------------
-CC local declarations
-CC ==================
-      INTEGER ji, jj, jk
-      REAL silfac,pislopen(jpi,jpj,jpk),pislope2n(jpi,jpj,jpk)
-      REAL zmixnano(jpi,jpj),zmixdiat(jpi,jpj),zfact
-      REAL prdiachl,prbiochl,silim,ztn,zadap,zadap2
-      REAL ysopt(jpi,jpj,jpk),pislopead(jpi,jpj,jpk)
-      REAL prdia(jpi,jpj,jpk),prbio(jpi,jpj,jpk)
-      REAL etot2(jpi,jpj,jpk),pislopead2(jpi,jpj,jpk)
-      REAL xlim,silfac2,siborn,zprod
-      REAL zmxltst,zmxlday,xlim1
-C
-C     Computation of the optimal production
-C     -------------------------------------
-C
-C
-        prmax(:,:,:)=0.6/rjjss*tgfunc(:,:,:)
-#    if defined key_off_degrad
-     &  *facvol(:,:,:)
-#    endif
-C
-C     Computation of the day length
-C     -----------------------------
-C
-        call p4zday 
-
-        DO jk = 1,jpkm1
-          DO jj = 1,jpj
-            DO ji = 1,jpi
-C
-C      Computation of the P-I slope for nanos and diatoms
-C      --------------------------------------------------
-C
-        ztn=max(0.,tn(ji,jj,jk)-15.)
-        zadap=1.+2.*ztn/(2.+ztn)
-        zadap2=1.
-
-        zfact=exp(-0.21*emoy(ji,jj,jk))
-
-        pislopead(ji,jj,jk)=pislope*(1.+zadap*zfact)
-        pislopead2(ji,jj,jk)=pislope2*(1.+zadap2*zfact)
-
-        pislopen(ji,jj,jk)=pislopead(ji,jj,jk)
-     &    *trn(ji,jj,jk,jpnch)/(rtrn+trn(ji,jj,jk,jpphy)*12.)
-     &    /(prmax(ji,jj,jk)*rjjss*xlimphy(ji,jj,jk)+rtrn)
-
-        pislope2n(ji,jj,jk)=pislopead2(ji,jj,jk)
-     &    *trn(ji,jj,jk,jpdch)/(rtrn+trn(ji,jj,jk,jpdia)*12.)
-     &    /(prmax(ji,jj,jk)*rjjss*xlimdia(ji,jj,jk)+rtrn)
-C
-            END DO
-          END DO
-        END DO
-
-        DO  jk = 1,jpkm1
-          DO  jj = 1,jpj
-            DO  ji = 1,jpi
-C
-C     Computation of production function
-C     ----------------------------------
-C
-        prbio(ji,jj,jk) = prmax(ji,jj,jk)
-     &    *(1.-exp(-pislopen(ji,jj,jk)*etot(ji,jj,jk)))
-        prdia(ji,jj,jk) = prmax(ji,jj,jk)
-     &    *(1.-exp(-pislope2n(ji,jj,jk)*etot(ji,jj,jk)))
-
-            END DO
-          END DO
-        END DO
-
-        DO  jk = 1,jpkm1
-          DO  jj = 1,jpj
-            DO  ji = 1,jpi
-C
-C    Si/C of diatoms
-C    ------------------------
-C    Si/C increases with iron stress and silicate availability
-C    Si/C is arbitrariliy increased for very high Si concentrations
-C    to mimic the very high ratios observed in the Southern Ocean
-c    (silpot2)
-C
-C
-        xlim1=trn(ji,jj,jk,jpsil)/(trn(ji,jj,jk,jpsil)+xksi1)
-        xlim=xdiatno3(ji,jj,jk)+xdiatnh4(ji,jj,jk)
-C
-        silim=min(prdia(ji,jj,jk)/(rtrn+prmax(ji,jj,jk)),
-     &    trn(ji,jj,jk,jpfer)/(concdfe(ji,jj,jk)+trn(ji,jj,jk,jpfer)),
-     &    trn(ji,jj,jk,jppo4)/(concdnh4+trn(ji,jj,jk,jppo4)),
-     &    xlim)
-        silfac=5.4*exp(-4.23*silim)*max(0.,min(1.,2.2*(xlim1-0.5)))+1.
-        siborn=max(0.,(trn(ji,jj,jk,jpsil)-15.E-6))
-        silfac2=1.+3.*siborn/(siborn+xksi2)
-        silfac=min(6.4,silfac*silfac2)
-C
-        ysopt(ji,jj,jk)=grosip*trn(ji,jj,jk,jpsil)/(trn(ji,jj,jk,jpsil)
-     $    +xksi1)*silfac
-C
-            END DO
-          END DO
-        END DO
-C
-C    Computation of the limitation term due to
-C    A mixed layer deeper than the euphotic depth
-C    --------------------------------------------
-C
-        DO jj=1,jpj
-          DO ji=1,jpi
-         zmxltst=max(0.,hmld(ji,jj)-zmeu(ji,jj))
-         zmxlday=zmxltst**2/rjjss
-         zmixnano(ji,jj)=1.-zmxlday/(1.+zmxlday)
-         zmixdiat(ji,jj)=1.-zmxlday/(3.+zmxlday)
-          END DO
-        END DO
-                                                                                
-        DO  jk = 1,jpkm1
-          DO  jj = 1,jpj
-            DO  ji = 1,jpi
-         if (fsdepw(ji,jj,jk+1).le.hmld(ji,jj)) then
-C
-C     Mixed-layer effect on production
-C     --------------------------------
-C
-         prbio(ji,jj,jk)=prbio(ji,jj,jk)*zmixnano(ji,jj)
-         prdia(ji,jj,jk)=prdia(ji,jj,jk)*zmixdiat(ji,jj)
-         endif
-            END DO
-          END DO
-        END DO
-C
-        DO jk = 1,jpkm1
-          DO jj = 1,jpj
-            DO ji = 1,jpi
-C
-C      Computation of the maximum light intensity
-C      ------------------------------------------
-C
-        etot2(ji,jj,jk)=etot(ji,jj,jk)*24./(strn(ji,jj)+rtrn)
-        IF (strn(ji,jj).lt.1.) etot2(ji,jj,jk)=etot(ji,jj,jk)
-C
-            END DO
-          END DO
-        END DO
-
-        DO jk = 1,jpkm1
-          DO jj = 1,jpj
-            DO ji = 1,jpi
-C
-C     Computation of the various production terms for nanophyto.
-C     ----------------------------------------------------------
-C
-        pislopen(ji,jj,jk)=pislopead(ji,jj,jk)
-     &    *trn(ji,jj,jk,jpnch)/(rtrn+trn(ji,jj,jk,jpphy)*12.)
-     &    /(prmax(ji,jj,jk)*rjjss*max(0.1,xlimphy(ji,jj,jk))+rtrn)
-
-        prbiochl = prmax(ji,jj,jk)
-     &    *(1.-exp(-pislopen(ji,jj,jk)*etot2(ji,jj,jk)))
-
-        prorca(ji,jj,jk) = prbio(ji,jj,jk)
-     &    *xlimphy(ji,jj,jk)*trn(ji,jj,jk,jpphy)*rfact2
-
-        pronew(ji,jj,jk)=prorca(ji,jj,jk)*xnanono3(ji,jj,jk)
-     &    /(xnanono3(ji,jj,jk)+xnanonh4(ji,jj,jk)+rtrn)
-        proreg(ji,jj,jk)=prorca(ji,jj,jk)-pronew(ji,jj,jk)
-C
-        zprod=rjjss*prorca(ji,jj,jk)*prbiochl*trn(ji,jj,jk,jpphy)
-     &    *max(0.1,xlimphy(ji,jj,jk))
-
-        prorca5(ji,jj,jk) = (fecnm)**2*zprod/chlcnm
-     &    /(pislopead(ji,jj,jk)*etot2(ji,jj,jk)*trn(ji,jj,jk,jpnfe)
-     &    +rtrn)
-
-        prorca6(ji,jj,jk) = chlcnm*144.*zprod/(pislopead(ji,jj,jk)
-     &    *etot2(ji,jj,jk)*trn(ji,jj,jk,jpnch)+rtrn)
-
-            END DO
-          END DO
-        END DO
-
-        DO  jk = 1,jpkm1
-          DO  jj = 1,jpj
-            DO  ji = 1,jpi
-C
-C       Computation of the various production terms for diatoms
-C       -------------------------------------------------------
-C
-        pislope2n(ji,jj,jk)=pislopead2(ji,jj,jk)
-     &    *trn(ji,jj,jk,jpdch)/(rtrn+trn(ji,jj,jk,jpdia)*12.)
-     &    /(prmax(ji,jj,jk)*rjjss*max(0.1,xlimdia(ji,jj,jk))+rtrn)
-
-        prdiachl = prmax(ji,jj,jk)
-     &    *(1.-exp(-etot2(ji,jj,jk)*pislope2n(ji,jj,jk)))
-C
-        prorca2(ji,jj,jk) = prdia(ji,jj,jk)
-     &    *xlimdia(ji,jj,jk)*trn(ji,jj,jk,jpdia)*rfact2
-
-C
-        pronew2(ji,jj,jk)=prorca2(ji,jj,jk)*xdiatno3(ji,jj,jk)
-     &    /(xdiatno3(ji,jj,jk)+xdiatnh4(ji,jj,jk)+rtrn)
-        proreg2(ji,jj,jk)=prorca2(ji,jj,jk)-pronew2(ji,jj,jk)
-        prorca3(ji,jj,jk) = prorca2(ji,jj,jk)*ysopt(ji,jj,jk)
-C
-        zprod=rjjss*prorca2(ji,jj,jk)*prdiachl*trn(ji,jj,jk,jpdia)
-     &    *max(0.1,xlimdia(ji,jj,jk))
-
-C
-        prorca4(ji,jj,jk) = (fecdm)**2*zprod/chlcdm
-     &    /(pislopead2(ji,jj,jk)*etot2(ji,jj,jk)*trn(ji,jj,jk,jpdfe)
-     &    +rtrn)
-C
-        prorca7(ji,jj,jk) = chlcdm*144.*zprod/(pislopead2(ji,jj,jk)
-     &    *etot2(ji,jj,jk)*trn(ji,jj,jk,jpdch)+rtrn)
-C
-            END DO
-          END DO
-        END DO
-C
-#endif
-      RETURN
-      END
Index: branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zprod.F90
===================================================================
--- branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zprod.F90	(revision 775)
+++ branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zprod.F90	(revision 775)
@@ -0,0 +1,252 @@
+MODULE p4zprod
+   !!======================================================================
+   !!                         ***  MODULE p4zprod  ***
+   !! TOP :   PISCES 
+   !!======================================================================
+   !! History :   1.0  !  2004     (O. Aumont) Original code
+   !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
+   !!----------------------------------------------------------------------
+#if defined key_pisces
+   !!----------------------------------------------------------------------
+   !!   'key_pisces'                                       PISCES bio-model
+   !!----------------------------------------------------------------------
+   !!   p4z_prod       :  
+   !!----------------------------------------------------------------------
+   USE oce_trc         !
+   USE trp_trc         ! 
+   USE sms             ! 
+   USE p4zday          !
+   
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   p4z_prod    ! called in p4zbio.F90
+
+   !!* Substitution
+#  include "domzgr_substitute.h90"
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 2.0 , LOCEAN-IPSL (2007) 
+   !! $Header:$ 
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+   SUBROUTINE p4z_prod
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE p4z_prod  ***
+      !!
+      !! ** Purpose :   Compute the phytoplankton production depending on
+      !!              light, temperature and nutrient availability
+      !!
+      !! ** Method  : - ???
+      !!---------------------------------------------------------------------
+      INTEGER  ::   ji, jj, jk
+      REAL(wp) ::   zsilfac, zfact
+      REAL(wp) ::   zprdiachl, zprbiochl, zsilim, ztn, zadap, zadap2
+      REAL(wp) ::   zlim, zsilfac2, zsiborn, zprod
+      REAL(wp) ::   zmxltst, zmxlday, zlim1
+      REAL(wp), DIMENSION(jpi,jpj)     ::   zmixnano , zmixdiat
+      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zpislopen, zpislope2n
+      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zsopt    , zpislopead
+      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zprdia   , zprbio
+      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zetot2   , zpislopead2
+      !!---------------------------------------------------------------------
+
+!     Computation of the optimal production
+!     -------------------------------------
+
+# if defined key_off_degrad
+      prmax(:,:,:) = 0.6 / rjjss * tgfunc(:,:,:) * facvol(:,:,:)
+# else
+      prmax(:,:,:) = 0.6 / rjjss * tgfunc(:,:,:)
+# endif
+
+      CALL p4z_day       ! Computation of the day length
+
+
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+
+!      Computation of the P-I slope for nanos and diatoms
+!      --------------------------------------------------
+
+               ztn    = MAX( 0., tn(ji,jj,jk) - 15. )
+               zadap  = 1.+ 2.* ztn / ( 2.+ ztn )
+               zadap2 = 1.e0
+
+               zfact  = EXP( -0.21 * emoy(ji,jj,jk) )
+
+               zpislopead (ji,jj,jk) = pislope  * ( 1.+ zadap  * zfact )
+               zpislopead2(ji,jj,jk) = pislope2 * ( 1.+ zadap2 * zfact )
+
+               zpislopen(ji,jj,jk) = zpislopead(ji,jj,jk) * trn(ji,jj,jk,jpnch)               &
+                  &                / ( trn(ji,jj,jk,jpphy) * 12.                   + rtrn )   &
+                  &                / ( prmax(ji,jj,jk) * rjjss * xlimphy(ji,jj,jk) + rtrn )
+
+               zpislope2n(ji,jj,jk) = zpislopead2(ji,jj,jk) * trn(ji,jj,jk,jpdch)              &
+                  &                 / ( trn(ji,jj,jk,jpdia) * 12.                   + rtrn )   &
+                  &                 / ( prmax(ji,jj,jk) * rjjss * xlimdia(ji,jj,jk) + rtrn )
+
+            END DO
+         END DO
+      END DO
+
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+
+!     Computation of production function
+!     ----------------------------------
+
+               zprbio(ji,jj,jk) = prmax(ji,jj,jk) * (  1.- EXP( -zpislopen (ji,jj,jk) * etot(ji,jj,jk) )  )
+               zprdia(ji,jj,jk) = prmax(ji,jj,jk) * (  1.- EXP( -zpislope2n(ji,jj,jk) * etot(ji,jj,jk) )  )
+
+            END DO
+         END DO
+      END DO
+
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+
+!    Si/C of diatoms
+!    ------------------------
+!    Si/C increases with iron stress and silicate availability
+!    Si/C is arbitrariliy increased for very high Si concentrations
+!    to mimic the very high ratios observed in the Southern Ocean (silpot2)
+
+               zlim1  = trn(ji,jj,jk,jpsil) / ( trn(ji,jj,jk,jpsil) + xksi1 )
+               zlim   = xdiatno3(ji,jj,jk) + xdiatnh4(ji,jj,jk)
+
+               zsilim = MIN( zprdia(ji,jj,jk)    / ( rtrn + prmax(ji,jj,jk) ),                    &
+                  &          trn(ji,jj,jk,jpfer) / ( concdfe(ji,jj,jk) + trn(ji,jj,jk,jpfer) ),   &
+                  &          trn(ji,jj,jk,jppo4) / ( concdnh4 + trn(ji,jj,jk,jppo4) ),            &
+                  &          zlim )
+               zsilfac = 5.4 * EXP( -4.23 * zsilim ) * MAX( 0.e0, MIN( 1., 2.2 * ( zlim1 - 0.5 ) )  ) + 1.e0
+               zsiborn = MAX( 0.e0, ( trn(ji,jj,jk,jpsil) - 15.e-6 ) )
+               zsilfac2 = 1.+ 3.* zsiborn / ( zsiborn + xksi2 )
+               zsilfac = MIN( 6.4,zsilfac * zsilfac2)
+
+               zsopt(ji,jj,jk) = grosip * trn(ji,jj,jk,jpsil) / ( trn(ji,jj,jk,jpsil) + xksi1 ) * zsilfac
+
+            END DO
+         END DO
+      END DO
+
+!    Computation of the limitation term due to
+!    A mixed layer deeper than the euphotic depth
+!    --------------------------------------------
+
+      DO jj = 1, jpj
+         DO ji = 1, jpi
+            zmxltst = MAX( 0.e0, hmld(ji,jj) - zmeu(ji,jj) )
+            zmxlday = zmxltst**2 / rjjss
+            zmixnano(ji,jj) = 1.- zmxlday / ( 1.+ zmxlday )
+            zmixdiat(ji,jj) = 1.- zmxlday / ( 3.+ zmxlday )
+         END DO
+      END DO
+                                                                                
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               IF( fsdepw(ji,jj,jk+1) <= hmld(ji,jj) ) THEN
+
+!     Mixed-layer effect on production
+!     --------------------------------
+                  zprbio(ji,jj,jk) = zprbio(ji,jj,jk) * zmixnano(ji,jj)
+                  zprdia(ji,jj,jk) = zprdia(ji,jj,jk) * zmixdiat(ji,jj)
+               ENDIF
+            END DO
+         END DO
+      END DO
+
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+
+!      Computation of the maximum light intensity
+!      ------------------------------------------
+               zetot2(ji,jj,jk) = etot(ji,jj,jk) * 24. / ( strn(ji,jj) + rtrn )
+               IF( strn(ji,jj) < 1.e0 )   zetot2(ji,jj,jk) = etot(ji,jj,jk)
+
+            END DO
+         END DO
+      END DO
+
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+
+!     Computation of the various production terms for nanophyto.
+!     ----------------------------------------------------------
+               zpislopen(ji,jj,jk) = zpislopead(ji,jj,jk)          &
+                  &                * trn(ji,jj,jk,jpnch) / ( rtrn + trn(ji,jj,jk,jpphy) * 12.)         &
+                  &                / ( prmax(ji,jj,jk) * rjjss * MAX( 0.1, xlimphy(ji,jj,jk) ) + rtrn )
+
+               zprbiochl = prmax(ji,jj,jk) * (  1.- EXP( -zpislopen(ji,jj,jk) * zetot2(ji,jj,jk) )  )
+
+               prorca(ji,jj,jk) = zprbio(ji,jj,jk)  * xlimphy(ji,jj,jk) * trn(ji,jj,jk,jpphy) * rfact2
+
+               pronew(ji,jj,jk) = prorca(ji,jj,jk) * xnanono3(ji,jj,jk)    &
+                  &             / ( xnanono3(ji,jj,jk) + xnanonh4(ji,jj,jk) + rtrn )
+               proreg(ji,jj,jk) = prorca(ji,jj,jk) - pronew(ji,jj,jk)
+
+               zprod = rjjss * prorca(ji,jj,jk) * zprbiochl * trn(ji,jj,jk,jpphy)   &
+                  &                             * MAX( 0.1, xlimphy(ji,jj,jk) )
+
+               prorca5(ji,jj,jk) = (fecnm)**2 * zprod / chlcnm            &
+                  &              / (  zpislopead(ji,jj,jk) * zetot2(ji,jj,jk) * trn(ji,jj,jk,jpnfe) + rtrn  )
+
+               prorca6(ji,jj,jk) = chlcnm * 144. * zprod                  &
+                  &              / (  zpislopead(ji,jj,jk) * zetot2(ji,jj,jk) * trn(ji,jj,jk,jpnch) + rtrn  )
+
+            END DO
+         END DO
+      END DO
+
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+
+!       Computation of the various production terms for diatoms
+!       -------------------------------------------------------
+               zpislope2n(ji,jj,jk) = zpislopead2(ji,jj,jk) * trn(ji,jj,jk,jpdch)        &
+                  &                 / ( rtrn + trn(ji,jj,jk,jpdia) * 12.)        &
+                  &                 / ( prmax(ji,jj,jk) * rjjss * MAX( 0.1, xlimdia(ji,jj,jk) ) + rtrn )
+
+               zprdiachl = prmax(ji,jj,jk) * (  1.- EXP( -zetot2(ji,jj,jk) * zpislope2n(ji,jj,jk) )  )
+
+               prorca2(ji,jj,jk) = zprdia(ji,jj,jk) * xlimdia(ji,jj,jk) * trn(ji,jj,jk,jpdia) * rfact2
+
+               pronew2(ji,jj,jk) = prorca2(ji,jj,jk) * xdiatno3(ji,jj,jk)     &
+                  &              / ( xdiatno3(ji,jj,jk) + xdiatnh4(ji,jj,jk) + rtrn )
+               proreg2(ji,jj,jk) = prorca2(ji,jj,jk) - pronew2(ji,jj,jk)
+               prorca3(ji,jj,jk) = prorca2(ji,jj,jk) * zsopt(ji,jj,jk)
+
+               zprod=rjjss * prorca2(ji,jj,jk) * zprdiachl * trn(ji,jj,jk,jpdia) * MAX( 0.1, xlimdia(ji,jj,jk) )
+
+               prorca4(ji,jj,jk) = (fecdm)**2 * zprod / chlcdm                   &
+                  &              / ( zpislopead2(ji,jj,jk) * zetot2(ji,jj,jk) * trn(ji,jj,jk,jpdfe) + rtrn )
+
+               prorca7(ji,jj,jk) = chlcdm * 144. * zprod       &
+                  &              / ( zpislopead2(ji,jj,jk) * zetot2(ji,jj,jk) * trn(ji,jj,jk,jpdch) + rtrn )
+
+            END DO
+         END DO
+      END DO
+      !
+   END SUBROUTINE p4z_prod
+
+#else
+   !!======================================================================
+   !!  Dummy module :                                   No PISCES bio-model
+   !!======================================================================
+CONTAINS
+   SUBROUTINE p4z_prod                    ! Empty routine
+   END SUBROUTINE p4z_prod
+#endif 
+
+   !!======================================================================
+END MODULE  p4zprod
Index: branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zrem.F
===================================================================
--- branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zrem.F	(revision 773)
+++ 	(revision )
@@ -1,279 +1,0 @@
-
-CCC $Header: /home/opalod/NEMOCVSROOT/NEMO/TOP_SRC/SMS/p4zrem.F,v 1.8 2007/10/12 09:28:41 opalod Exp $ 
-CCC  TOP 1.0 , LOCEAN-IPSL (2005) 
-C This software is governed by CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
-C ---------------------------------------------------------------------------
-CDIR$ LIST
-      SUBROUTINE p4zrem
-#if defined key_top && defined key_pisces
-CCC---------------------------------------------------------------------
-CCC
-CCC          ROUTINE p4zrem : PISCES MODEL
-CCC          *****************************
-CCC
-CCC  PURPOSE :
-CCC  ---------
-CCC         Compute remineralization/scavenging of organic compounds
-CCC
-CC   INPUT :
-CC   -----
-CC      common
-CC              all the common defined in opa
-CC
-CC
-CC   OUTPUT :                   : no
-CC   ------
-CC
-CC   EXTERNAL :
-CC   --------
-CC            None
-CC
-CC   MODIFICATIONS:
-CC   --------------
-CC      original  : 2004 - O. Aumont 
-CC----------------------------------------------------------------------
-CC parameters and commons
-CC ======================
-CDIR$ NOLIST
-      USE oce_trc
-      USE trp_trc
-      USE sms
-      IMPLICIT NONE
-#include "domzgr_substitute.h90"
-CDIR$ LIST
-CC----------------------------------------------------------------------
-CC local declarations
-CC ==================
-      INTEGER ji, jj, jk
-      REAL remip,remik,xlam1b
-      REAL xkeq,xfeequi,siremin
-      REAL zsatur,zsatur2,znusil,zdepbac(jpi,jpj,jpk)
-      REAL zlamfac,zstep,fesatur(jpi,jpj,jpk)
-      REAL ztempbac(jpi,jpj)
-C
-C      Time step duration for the biology
-C
-       zstep=rfact2/rjjss
-C
-C      Computation of the mean phytoplankton concentration as
-C      a crude estimate of the bacterial biomass
-C      --------------------------------------------------
-C
-        DO jk=1,jpkm1
-          DO jj = 1, jpj
-            DO ji = 1, jpi
-         IF (fsdept(ji,jj,jk).lt.120.) THEN
-         zdepbac(ji,jj,jk)=min(0.7*(trn(ji,jj,jk,jpzoo)
-     &     +2*trn(ji,jj,jk,jpmes)),4E-6)
-         ztempbac(ji,jj)=zdepbac(ji,jj,jk)
-         ELSE
-         zdepbac(ji,jj,jk)=min(1.,120./fsdept(ji,jj,jk))
-     &      *ztempbac(ji,jj)
-         ENDIF
-            END DO
-          END DO
-        END DO
-
-         DO jk = 1,jpkm1
-           DO jj = 1,jpj
-             DO ji = 1,jpi
-C
-C    DENITRIFICATION FACTOR COMPUTED FROM O2 LEVELS
-C    ----------------------------------------------
-C
-          nitrfac(ji,jj,jk)=
-     &      max(0.,0.4*(6.E-6-trn(ji,jj,jk,jpoxy))/(oxymin+
-     &      trn(ji,jj,jk,jpoxy)))
-             END DO
-           END DO
-         END DO
-
-          nitrfac(:,:,:)=min(1.,nitrfac(:,:,:))
-
-         DO jk = 1,jpkm1
-           DO jj = 1,jpj
-             DO ji = 1,jpi
-C
-C     DOC ammonification. Depends on depth, phytoplankton biomass
-C     and a limitation term which is supposed to be a parameterization
-C     of the bacterial activity. 
-C     ----------------------------------------------------------------
-C
-         remik = xremik*zstep/1E-6*xlimbac(ji,jj,jk)
-     &     *zdepbac(ji,jj,jk)
-#    if defined key_off_degrad
-     &     *facvol(ji,jj,jk)
-#    endif
-         remik=max(remik,5.5E-4*zstep)
-C
-C     Ammonification in oxic waters with oxygen consumption
-C     -----------------------------------------------------
-C
-         olimi(ji,jj,jk)=min((trn(ji,jj,jk,jpoxy)-rtrn)/o2ut,
-     &     remik*(1.-nitrfac(ji,jj,jk))*trn(ji,jj,jk,jpdoc)) 
-C
-C     Ammonification in suboxic waters with denitrification
-C     -------------------------------------------------------
-C
-         denitr(ji,jj,jk)=min((trn(ji,jj,jk,jpno3)-rtrn)/rdenit,
-     &     remik*nitrfac(ji,jj,jk)*trn(ji,jj,jk,jpdoc))
-             END DO
-           END DO
-         END DO
-C
-         olimi(:,:,:)=max(0.,olimi(:,:,:))
-         denitr(:,:,:)=max(0.,denitr(:,:,:))
-C
-         DO jk = 1,jpkm1
-           DO jj = 1,jpj
-             DO ji = 1,jpi
-C
-C    NH4 nitrification to NO3. Ceased for oxygen concentrations
-C    below 2 umol/L. Inhibited at strong light 
-C    ----------------------------------------------------------
-C
-         onitr(ji,jj,jk)=nitrif*zstep*trn(ji,jj,jk,jpnh4)/(1.
-     &     +emoy(ji,jj,jk))*(1.-nitrfac(ji,jj,jk))
-#    if defined key_off_degrad
-     &     *facvol(ji,jj,jk)
-#    endif
-             END DO
-           END DO
-         END DO
-
-         DO jk = 1,jpkm1
-           DO jj = 1,jpj
-             DO ji = 1,jpi
-C
-C    Bacterial uptake of iron. No iron is available in DOC. So
-C    Bacteries are obliged to take up iron from the water. Some
-C    studies (especially at Papa) have shown this uptake to be
-C    significant
-C    ----------------------------------------------------------
-C
-         xbactfer(ji,jj,jk)=15E-6*rfact2*4.*0.4*prmax(ji,jj,jk)
-     &     *(xlimphy(ji,jj,jk)*zdepbac(ji,jj,jk))**2
-     &     /(xkgraz2+zdepbac(ji,jj,jk))
-     &     *(0.5+sign(0.5,trn(ji,jj,jk,jpfer)-2E-11))
-C
-             END DO
-           END DO
-         END DO
-C
-         DO jk = 1,jpkm1
-           DO jj = 1,jpj
-             DO ji = 1,jpi
-C
-C    POC disaggregation by turbulence and bacterial activity. 
-C    -------------------------------------------------------------
-C
-         remip=xremip*zstep*tgfunc(ji,jj,jk)*(1.-0.5*nitrfac(ji,jj,jk))
-#    if defined key_off_degrad
-     &     *facvol(ji,jj,jk)
-#    endif
-C
-C    POC disaggregation rate is reduced in anoxic zone as shown by
-C    sediment traps data. In oxic area, the exponent of the martin's
-C    law is around -0.87. In anoxic zone, it is around -0.35. This
-C    means a disaggregation constant about 0.5 the value in oxic zones
-C    -----------------------------------------------------------------
-C
-         orem(ji,jj,jk)=remip*trn(ji,jj,jk,jppoc)
-         ofer(ji,jj,jk)=remip*trn(ji,jj,jk,jpsfe)
-#if ! defined key_kriest
-         orem2(ji,jj,jk)=remip*trn(ji,jj,jk,jpgoc)
-         ofer2(ji,jj,jk)=remip*trn(ji,jj,jk,jpbfe)
-#else
-         orem2(ji,jj,jk)=remip*trn(ji,jj,jk,jpnum)
-#endif
-C
-             END DO
-           END DO
-         END DO
-
-         DO jk = 1,jpkm1
-           DO jj = 1,jpj
-             DO ji = 1,jpi
-C
-C     Remineralization rate of BSi depedant on T and saturation
-C     ---------------------------------------------------------
-C
-         zsatur=(sio3eq(ji,jj,jk)-trn(ji,jj,jk,jpsil))/
-     &     (sio3eq(ji,jj,jk)+rtrn)
-         zsatur=max(rtrn,zsatur)
-         zsatur2=zsatur*(1.+tn(ji,jj,jk)/400.)**4
-         znusil=0.225*(1.+tn(ji,jj,jk)/15.)*zsatur+0.775*zsatur2**9
-
-         siremin=xsirem*zstep*znusil
-#    if defined key_off_degrad
-     &     *facvol(ji,jj,jk)
-#    endif
-C
-         osil(ji,jj,jk)=siremin*trn(ji,jj,jk,jpdsi)
-             END DO
-           END DO
-         END DO
-C
-         fesatur(:,:,:)=0.6E-9
-C
-         DO jk = 1,jpkm1
-           DO jj = 1,jpj
-             DO ji = 1,jpi
-C
-C     scavenging rate of iron. this scavenging rate depends on the
-C     load in particles on which they are adsorbed. The
-C     parameterization has been taken from studies on Th
-C     ------------------------------------------------------------
-C
-         xkeq=fekeq(ji,jj,jk)
-         xfeequi=(-(1.+fesatur(ji,jj,jk)*xkeq-xkeq*trn(ji,jj,jk,jpfer))+
-     &     sqrt((1.+fesatur(ji,jj,jk)*xkeq-xkeq*trn(ji,jj,jk,jpfer))**2
-     &     +4.*trn(ji,jj,jk,jpfer)*xkeq))/(2.*xkeq)
-
-#if ! defined key_kriest
-         xlam1b=3E-5+xlam1*(trn(ji,jj,jk,jppoc)
-     &     +trn(ji,jj,jk,jpgoc)+trn(ji,jj,jk,jpcal)+
-     &      trn(ji,jj,jk,jpdsi))*1E6
-#else
-         xlam1b=3E-5+xlam1*(trn(ji,jj,jk,jppoc)
-     &     +trn(ji,jj,jk,jpcal)+trn(ji,jj,jk,jpdsi))*1E6
-#endif
-         xscave(ji,jj,jk)=xfeequi*xlam1b*zstep
-#    if defined key_off_degrad
-     &     *facvol(ji,jj,jk)
-#    endif
-C
-C  Increased scavenging for very high iron concentrations
-C  found near the coasts due to increased lithogenic particles
-C  and let's say it unknown processes (precipitation, ...)
-C  -----------------------------------------------------------
-C
-         zlamfac=max(0.,(gphit(ji,jj)+55.)/30.)
-         zlamfac=min(1.,zlamfac)
-#if ! defined key_kriest
-         xlam1b=(80.*(trn(ji,jj,jk,jpdoc)+35E-6)+698.
-     &    *trn(ji,jj,jk,jppoc)+1.05E4*trn(ji,jj,jk,jpgoc))
-     &    *zdiss(ji,jj,jk)+1E-4*(1.-zlamfac)+xlam1*max(0.,
-     &    (trn(ji,jj,jk,jpfer)*1E9-1.))
-#else
-         xlam1b=(80.*(trn(ji,jj,jk,jpdoc)+35E-6)+698.
-     &    *trn(ji,jj,jk,jppoc))
-     &    *zdiss(ji,jj,jk)+1E-4*(1.-zlamfac)+xlam1*max(0.,
-     &    (trn(ji,jj,jk,jpfer)*1E9-1.))
-#endif
-
-
-         xaggdfe(ji,jj,jk)=xlam1b*zstep*0.5*(trn(ji,jj,jk,jpfer)
-     &     -xfeequi)
-#    if defined key_off_degrad
-     &     *facvol(ji,jj,jk)
-#    endif
-
-C
-             END DO
-           END DO
-         END DO
-C
-#endif
-      RETURN
-      END
Index: branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zrem.F90
===================================================================
--- branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zrem.F90	(revision 775)
+++ branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zrem.F90	(revision 775)
@@ -0,0 +1,268 @@
+MODULE p4zrem
+   !!======================================================================
+   !!                         ***  MODULE p4zrem  ***
+   !! TOP :   PISCES Compute remineralization/scavenging of organic compounds
+   !!======================================================================
+   !! History :   1.0  !  2004     (O. Aumont) Original code
+   !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
+   !!----------------------------------------------------------------------
+#if defined key_pisces
+   !!----------------------------------------------------------------------
+   !!   'key_top'       and                                      TOP models
+   !!   'key_pisces'                                       PISCES bio-model
+   !!----------------------------------------------------------------------
+   !!   p4z_rem       :   Compute remineralization/scavenging of organic compounds
+   !!----------------------------------------------------------------------
+   USE oce_trc         !
+   USE trp_trc         ! 
+   USE sms             ! 
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   p4z_rem    ! called in p4zbio.F90
+
+   !!* Substitution
+#  include "domzgr_substitute.h90"
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 2.0 , LOCEAN-IPSL (2007) 
+   !! $Header:$ 
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+   SUBROUTINE p4z_rem
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE p4z_rem  ***
+      !!
+      !! ** Purpose :   Compute remineralization/scavenging of organic compounds
+      !!
+      !! ** Method  : - ???
+      !!---------------------------------------------------------------------
+      INTEGER  ::   ji, jj, jk
+      REAL(wp) ::   zremip, zremik , zlam1b
+      REAL(wp) ::   zkeq  , zfeequi, zsiremin
+      REAL(wp) ::   zsatur, zsatur2, znusil
+      REAL(wp) ::   zlamfac, zstep
+      REAL(wp), DIMENSION(jpi,jpj)     ::   ztempbac
+      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zdepbac, zfesatur
+      !!---------------------------------------------------------------------
+
+       zstep = rfact2 / rjjss      ! Time step duration for the biology
+
+
+!      Computation of the mean phytoplankton concentration as
+!      a crude estimate of the bacterial biomass
+!      --------------------------------------------------
+
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               IF( fsdept(ji,jj,jk) < 120. ) THEN
+                  zdepbac(ji,jj,jk) = MIN( 0.7 * ( trn(ji,jj,jk,jpzoo) + 2.* trn(ji,jj,jk,jpmes) ), 4.e-6 )
+                  ztempbac(ji,jj)   = zdepbac(ji,jj,jk)
+               ELSE
+                  zdepbac(ji,jj,jk) = MIN( 1., 120./ fsdept(ji,jj,jk) ) * ztempbac(ji,jj)
+               ENDIF
+            END DO
+         END DO
+      END DO
+
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+
+!    DENITRIFICATION FACTOR COMPUTED FROM O2 LEVELS
+!    ----------------------------------------------
+
+               nitrfac(ji,jj,jk) = MAX(  0.e0, 0.4 * ( 6.e-6  - trn(ji,jj,jk,jpoxy) )    &
+                  &                                / ( oxymin + trn(ji,jj,jk,jpoxy) )  )
+            END DO
+         END DO
+      END DO
+
+      nitrfac(:,:,:) = MIN( 1., nitrfac(:,:,:) )
+
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+
+!     DOC ammonification. Depends on depth, phytoplankton biomass
+!     and a limitation term which is supposed to be a parameterization
+!     of the bacterial activity. 
+!     ----------------------------------------------------------------
+               zremik = xremik * zstep / 1.e-6 * xlimbac(ji,jj,jk)         &
+# if defined key_off_degrad
+                  &            * facvol(ji,jj,jk)              &
+# endif
+                  &            * zdepbac(ji,jj,jk)
+               zremik = MAX( zremik, 5.5e-4 * zstep )
+
+!     Ammonification in oxic waters with oxygen consumption
+!     -----------------------------------------------------
+               olimi(ji,jj,jk) = MIN(  ( trn(ji,jj,jk,jpoxy) - rtrn ) / o2ut,                     &
+                  &                    zremik * ( 1.- nitrfac(ji,jj,jk) ) * trn(ji,jj,jk,jpdoc)  ) 
+
+!     Ammonification in suboxic waters with denitrification
+!     -------------------------------------------------------
+               denitr(ji,jj,jk) = MIN(  ( trn(ji,jj,jk,jpno3) - rtrn ) / rdenit,           &
+                  &                     zremik * nitrfac(ji,jj,jk) * trn(ji,jj,jk,jpdoc)  )
+            END DO
+         END DO
+      END DO
+
+      olimi (:,:,:) = MAX( 0.e0, olimi (:,:,:) )
+      denitr(:,:,:) = MAX( 0.e0, denitr(:,:,:) )
+
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+
+!    NH4 nitrification to NO3. Ceased for oxygen concentrations
+!    below 2 umol/L. Inhibited at strong light 
+!    ----------------------------------------------------------
+               onitr(ji,jj,jk) = nitrif * zstep * trn(ji,jj,jk,jpnh4) / ( 1.+ emoy(ji,jj,jk) )     &
+# if defined key_off_degrad
+                  &            * facvol(ji,jj,jk)              &
+# endif
+                  &            * ( 1.- nitrfac(ji,jj,jk) )
+            END DO
+         END DO
+      END DO
+
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+
+!    Bacterial uptake of iron. No iron is available in DOC. So
+!    Bacteries are obliged to take up iron from the water. Some
+!    studies (especially at Papa) have shown this uptake to be
+!    significant
+!    ----------------------------------------------------------
+               xbactfer(ji,jj,jk) = 15.e-6 * rfact2 * 4.* 0.4 * prmax(ji,jj,jk)           &
+                  &               * ( xlimphy(ji,jj,jk) * zdepbac(ji,jj,jk))**2           &
+                  &                  / ( xkgraz2 + zdepbac(ji,jj,jk) )                    &
+                  &                  * ( 0.5 + SIGN( 0.5, trn(ji,jj,jk,jpfer) -2.e-11 )  )
+
+            END DO
+         END DO
+      END DO
+
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+
+!    POC disaggregation by turbulence and bacterial activity. 
+!    -------------------------------------------------------------
+               zremip = xremip * zstep * tgfunc(ji,jj,jk)   &
+# if defined key_off_degrad
+                  &            * facvol(ji,jj,jk)              &
+# endif
+                  &            * ( 1.- 0.5 * nitrfac(ji,jj,jk) )
+
+!    POC disaggregation rate is reduced in anoxic zone as shown by
+!    sediment traps data. In oxic area, the exponent of the martin s
+!    law is around -0.87. In anoxic zone, it is around -0.35. This
+!    means a disaggregation constant about 0.5 the value in oxic zones
+!    -----------------------------------------------------------------
+               orem (ji,jj,jk) = zremip * trn(ji,jj,jk,jppoc)
+               ofer (ji,jj,jk) = zremip * trn(ji,jj,jk,jpsfe)
+#if ! defined key_kriest
+               orem2(ji,jj,jk) = zremip * trn(ji,jj,jk,jpgoc)
+               ofer2(ji,jj,jk) = zremip * trn(ji,jj,jk,jpbfe)
+#else
+               orem2(ji,jj,jk) = zremip * trn(ji,jj,jk,jpnum)
+#endif
+            END DO
+         END DO
+      END DO
+
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+
+!     Remineralization rate of BSi depedant on T and saturation
+!     ---------------------------------------------------------
+               zsatur  = ( sio3eq(ji,jj,jk) - trn(ji,jj,jk,jpsil) ) / ( sio3eq(ji,jj,jk) + rtrn )
+               zsatur  = MAX( rtrn, zsatur )
+               zsatur2 = zsatur * ( 1. + tn(ji,jj,jk) / 400.)**4
+               znusil  = 0.225  * ( 1. + tn(ji,jj,jk) / 15.) * zsatur + 0.775 * zsatur2**9
+#    if defined key_off_degrad
+               zsiremin = xsirem * zstep * znusil * facvol(ji,jj,jk)
+# else
+               zsiremin = xsirem * zstep * znusil
+#    endif
+               osil(ji,jj,jk) = zsiremin * trn(ji,jj,jk,jpdsi)
+               !
+            END DO
+         END DO
+      END DO
+
+      zfesatur(:,:,:) = 0.6e-9
+
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+
+!     scavenging rate of iron. this scavenging rate depends on the
+!     load in particles on which they are adsorbed. The
+!     parameterization has been taken from studies on Th
+!     ------------------------------------------------------------
+               zkeq = fekeq(ji,jj,jk)
+               zfeequi = ( -( 1. + zfesatur(ji,jj,jk) * zkeq - zkeq * trn(ji,jj,jk,jpfer) )               &
+                  &        + SQRT( ( 1. + zfesatur(ji,jj,jk) * zkeq - zkeq * trn(ji,jj,jk,jpfer) )**2       &
+                  &               + 4. * trn(ji,jj,jk,jpfer) * zkeq) ) / ( 2. * zkeq )
+#if ! defined key_kriest
+               zlam1b = 3.e-5 + xlam1 * (  trn(ji,jj,jk,jppoc) + trn(ji,jj,jk,jpgoc)   &
+                  &                      + trn(ji,jj,jk,jpcal) + trn(ji,jj,jk,jpdsi)  ) * 1.e6
+#else
+               zlam1b = 3.e-5 + xlam1 * (  trn(ji,jj,jk,jppoc)                   &
+                  &                      + trn(ji,jj,jk,jpcal) + trn(ji,jj,jk,jpdsi)  ) * 1.e6
+#endif
+# if defined key_off_degrad
+               xscave(ji,jj,jk) = zfeequi * zlam1b * zstep  * facvol(ji,jj,jk)
+# else
+               xscave(ji,jj,jk) = zfeequi * zlam1b * zstep
+# endif
+
+!  Increased scavenging for very high iron concentrations
+!  found near the coasts due to increased lithogenic particles
+!  and let s say it unknown processes (precipitation, ...)
+!  -----------------------------------------------------------
+               zlamfac = MAX( 0.e0, ( gphit(ji,jj) + 55.) / 30. )
+               zlamfac = MIN( 1.  , zlamfac )
+#if ! defined key_kriest
+               zlam1b = (  80.* ( trn(ji,jj,jk,jpdoc) + 35.e-6 )                           &
+                  &     + 698.*   trn(ji,jj,jk,jppoc) + 1.05e4 * trn(ji,jj,jk,jpgoc)  )                    &
+                  &   * zdiss(ji,jj,jk) + 1E-4 * (1.-zlamfac)                &
+                  &   + xlam1 * MAX( 0.e0, ( trn(ji,jj,jk,jpfer) * 1.e9 - 1.)  )
+#else
+               zlam1b = (  80.* (trn(ji,jj,jk,jpdoc) + 35E-6)           &
+                  &     + 698.*  trn(ji,jj,jk,jppoc)  )                    &
+                  &   * zdiss(ji,jj,jk) + 1E-4 * (1.-zlamfac)           &
+                  &   + xlam1 * MAX( 0.e0, ( trn(ji,jj,jk,jpfer) * 1.e9 - 1.)  )
+#endif
+
+# if defined key_off_degrad
+               xaggdfe(ji,jj,jk) = zlam1b * zstep * 0.5 * ( trn(ji,jj,jk,jpfer) - zfeequi ) * facvol(ji,jj,jk)
+# else
+               xaggdfe(ji,jj,jk) = zlam1b * zstep * 0.5 * ( trn(ji,jj,jk,jpfer) - zfeequi )
+# endif
+            END DO
+         END DO
+      END DO
+      !
+   END SUBROUTINE p4z_rem
+
+#else
+   !!======================================================================
+   !!  Dummy module :                                   No PISCES bio-model
+   !!======================================================================
+CONTAINS
+   SUBROUTINE p4z_rem                    ! Empty routine
+   END SUBROUTINE p4z_rem
+#endif 
+
+   !!======================================================================
+END MODULE p4zrem
Index: branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zsed.F
===================================================================
--- branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zsed.F	(revision 773)
+++ 	(revision )
@@ -1,323 +1,0 @@
-
-CCC $Header: /home/opalod/NEMOCVSROOT/NEMO/TOP_SRC/SMS/p4zsed.F,v 1.9 2007/10/12 09:35:04 opalod Exp $ 
-CCC  TOP 1.0 , LOCEAN-IPSL (2005) 
-C This software is governed by CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
-C ---------------------------------------------------------------------------
-CDIR$ LIST
-      SUBROUTINE p4zsed
-#if defined key_top && defined key_pisces
-CCC---------------------------------------------------------------------
-CCC
-CCC          ROUTINE p4zsed : PISCES MODEL
-CCC          *****************************
-CCC
-CCC  PURPOSE :
-CCC  ---------
-CCC         Compute loss of organic matter in the sediments. This
-CCC         is by no way a sediment model. The loss is simply 
-CCC         computed to balance the inout from rivers and dust
-CCC
-CC   INPUT :
-CC   -----
-CC      common
-CC              all the common defined in opa
-CC
-CC
-CC   OUTPUT :                   : no
-CC   ------
-CC
-CC   EXTERNAL :
-CC   --------
-CC             None
-CC
-CC   MODIFICATIONS:
-CC   --------------
-CC      original  : 2004 - O. Aumont 
-CC----------------------------------------------------------------------
-CC parameters and commons
-CC ======================
-CDIR$ NOLIST
-      USE oce_trc
-      USE trp_trc
-      USE sms
-      USE lib_mpp
-      IMPLICIT NONE
-#include "domzgr_substitute.h90"
-CDIR$ LIST
-CC----------------------------------------------------------------------
-CC local declarations
-CC ==================
-      INTEGER ji, jj, jk, ikt
-      REAL sumsedsi,sumsedpo4,sumsedcal
-      REAL xconctmp,denitot,nitrpottot,nitrpot(jpi,jpj,jpk)
-      REAL xlim,xconctmp2,zstep,zfact
-      REAL irondep(jpi,jpj,jpk),sidep(jpi,jpj)
-      REAL zvol
-CC
-C
-C     Time step duration for the biology
-C     ----------------------------------
-C
-        zstep=rfact2/rjjss
-C
-C
-C     Initialisation of variables used to compute deposition
-C     ------------------------------------------------------
-C
-      irondep     = 0.
-      sidep       = 0.
-C
-C     Iron and Si deposition at the surface
-C     -------------------------------------
-C
-       do jj=1,jpj
-         do ji=1,jpi
-         irondep(ji,jj,1)=(0.014*dust(ji,jj)/(55.85*rmoss)
-     &      +3E-10/raass)*rfact2/fse3t(ji,jj,1)
-         sidep(ji,jj)=8.8*0.075*dust(ji,jj)*rfact2
-     &      /(fse3t(ji,jj,1)*28.1*rmoss)
-         end do
-       end do
-C
-C     Iron solubilization of particles in the water column
-C     ----------------------------------------------------
-C
-      do jk=2,jpk-1
-        do jj=1,jpj
-          do ji=1,jpi
-          irondep(ji,jj,jk)=dust(ji,jj)/(10.*55.85*rmoss)*rfact2
-     &      *0.0001
-          end do
-        end do
-      end do
-C
-C    Add the external input of nutrients, carbon and alkalinity
-C    ----------------------------------------------------------
-C
-        DO jj = 1,jpj
-          DO ji = 1,jpi
-          trn(ji,jj,1,jppo4) = trn(ji,jj,1,jppo4)
-     &      +rivinp(ji,jj)*rfact2
-          trn(ji,jj,1,jpno3) = trn(ji,jj,1,jpno3)
-     &      +(rivinp(ji,jj)+nitdep(ji,jj))*rfact2
-          trn(ji,jj,1,jpfer) = trn(ji,jj,1,jpfer)
-     &      +rivinp(ji,jj)*3E-5*rfact2
-          trn(ji,jj,1,jpsil) = trn(ji,jj,1,jpsil)
-     &      +sidep(ji,jj)+cotdep(ji,jj)*rfact2/6.
-          trn(ji,jj,1,jpdic) = trn(ji,jj,1,jpdic)
-     &      +rivinp(ji,jj)*rfact2*2.631
-          trn(ji,jj,1,jptal) = trn(ji,jj,1,jptal)
-     &      +(cotdep(ji,jj)-rno3*(rivinp(ji,jj)
-     &      +nitdep(ji,jj)))*rfact2
-          END DO
-        END DO
-C
-
-C
-C     Add the external input of iron which is 3D distributed
-C     (dust, river and sediment mobilization)
-C     ------------------------------------------------------
-C
-        DO jk=1,jpkm1
-          DO jj=1,jpj
-            DO ji=1,jpi
-          trn(ji,jj,jk,jpfer) = trn(ji,jj,jk,jpfer)
-     &      +irondep(ji,jj,jk)+ironsed(ji,jj,jk)*rfact2
-            END DO
-          END DO
-        END DO
-C
-C     Initialisation of variables used to compute Sinking Speed
-C     ---------------------------------------------------------
-C
-        sumsedsi = 0.
-        sumsedpo4 = 0.
-        sumsedcal = 0.
-C
-C    Loss of biogenic silicon, Caco3 organic carbon in the sediments. 
-C    First, the total loss is computed.
-C    The factor for calcite comes from the alkalinity effect
-C    -------------------------------------------------------------
-C
-        DO jj=1,jpj
-          DO ji=1,jpi
-            ikt=max(mbathy(ji,jj)-1,1)
-            zfact=e1t(ji,jj)*e2t(ji,jj)/rjjss*tmask_i(ji,jj)
-            sumsedsi=sumsedsi+zfact*trn(ji,jj,ikt,jpdsi)
-#if ! defined key_kriest
-     &               *wsbio4(ji,jj,ikt) 
-#else
-     &               *wscal(ji,jj,ikt)
-#endif
-            sumsedcal=sumsedcal+trn(ji,jj,ikt,jpcal)*wscal(ji,jj,ikt)
-     &          *2.*zfact
-#if  defined key_kriest
-            sumsedpo4=sumsedpo4+
-     &          (trn(ji,jj,ikt,jppoc)*wsbio3(ji,jj,ikt))*zfact
-#else
-            sumsedpo4=sumsedpo4+(trn(ji,jj,ikt,jpgoc)*wsbio4(ji,jj,ikt)
-     &    +trn(ji,jj,ikt,jppoc)*wsbio3(ji,jj,ikt))*zfact
-#endif
-          END DO
-        END DO
-
-         IF( lk_mpp ) THEN
-            CALL mpp_sum( sumsedsi )   ! sums over the global domain
-            CALL mpp_sum( sumsedcal )   ! sums over the global domain
-            CALL mpp_sum( sumsedpo4 )   ! sums over the global domain
-         ENDIF
-C
-C    Then this loss is scaled at each bottom grid cell for
-C    equilibrating the total budget of silica in the ocean.
-C    Thus, the amount of silica lost in the sediments equal
-C    the supply at the surface (dust+rivers)
-C    ------------------------------------------------------
-C
-        DO jj=1,jpj
-          DO ji=1,jpi
-            ikt=max(mbathy(ji,jj)-1,1)
-            xconctmp=trn(ji,jj,ikt,jpdsi)*zstep/fse3t(ji,jj,ikt)
-#if ! defined key_kriest
-     &               *wsbio4(ji,jj,ikt) 
-#else
-     &               *wscal(ji,jj,ikt)
-#endif
-            trn(ji,jj,ikt,jpdsi)=trn(ji,jj,ikt,jpdsi)-xconctmp
-            trn(ji,jj,ikt,jpsil)=trn(ji,jj,ikt,jpsil)+xconctmp
-     &          *(1.-(sumdepsi+rivalkinput/raass/6.)/sumsedsi)
-          END DO
-        END DO
-
-        DO jj=1,jpj
-          DO ji=1,jpi
-            ikt=max(mbathy(ji,jj)-1,1)
-            xconctmp=trn(ji,jj,ikt,jpcal)*wscal(ji,jj,ikt)*zstep
-     &          /fse3t(ji,jj,ikt)
-            trn(ji,jj,ikt,jpcal)=trn(ji,jj,ikt,jpcal)-xconctmp
-            trn(ji,jj,ikt,jptal)=trn(ji,jj,ikt,jptal)+xconctmp
-     &          *(1.-(rivalkinput/raass)/sumsedcal)*2.
-            trn(ji,jj,ikt,jpdic)=trn(ji,jj,ikt,jpdic)+xconctmp
-     &          *(1.-(rivalkinput/raass)/sumsedcal)
-          END DO
-        END DO
-
-        DO jj=1,jpj
-          DO ji=1,jpi
-            ikt=max(mbathy(ji,jj)-1,1)
-#if ! defined key_kriest
-            xconctmp=trn(ji,jj,ikt,jpgoc)
-            xconctmp2=trn(ji,jj,ikt,jppoc)
-            trn(ji,jj,ikt,jpgoc)=trn(ji,jj,ikt,jpgoc)
-     &          -xconctmp*wsbio4(ji,jj,ikt)*zstep/fse3t(ji,jj,ikt)
-            trn(ji,jj,ikt,jppoc)=trn(ji,jj,ikt,jppoc)
-     &          -xconctmp2*wsbio3(ji,jj,ikt)*zstep/fse3t(ji,jj,ikt)
-            trn(ji,jj,ikt,jpdoc)=trn(ji,jj,ikt,jpdoc)
-     &          +(xconctmp*wsbio4(ji,jj,ikt)+xconctmp2*wsbio3(ji,jj,ikt)
-     $          )*zstep/fse3t(ji,jj,ikt)*(1.-rivpo4input/(raass
-     $          *sumsedpo4))
-            trn(ji,jj,ikt,jpbfe)=trn(ji,jj,ikt,jpbfe)
-     &          -trn(ji,jj,ikt,jpbfe)*wsbio4(ji,jj,ikt)*zstep
-     &          /fse3t(ji,jj,ikt)
-            trn(ji,jj,ikt,jpsfe)=trn(ji,jj,ikt,jpsfe)
-     &          -trn(ji,jj,ikt,jpsfe)*wsbio3(ji,jj,ikt)*zstep
-     &          /fse3t(ji,jj,ikt)
-#else
-            xconctmp=trn(ji,jj,ikt,jpnum)
-            xconctmp2=trn(ji,jj,ikt,jppoc)
-            trn(ji,jj,ikt,jpnum)=trn(ji,jj,ikt,jpnum)
-     &          -xconctmp*wsbio4(ji,jj,ikt)*zstep/fse3t(ji,jj,ikt)
-            trn(ji,jj,ikt,jppoc)=trn(ji,jj,ikt,jppoc)
-     &          -xconctmp2*wsbio3(ji,jj,ikt)*zstep/fse3t(ji,jj,ikt)
-            trn(ji,jj,ikt,jpdoc)=trn(ji,jj,ikt,jpdoc)
-     &          +(xconctmp2*wsbio3(ji,jj,ikt))
-     $          *zstep/fse3t(ji,jj,ikt)*(1.-rivpo4input/(raass
-     $          *sumsedpo4))
-            trn(ji,jj,ikt,jpsfe)=trn(ji,jj,ikt,jpsfe)
-     &          -trn(ji,jj,ikt,jpsfe)*wsbio3(ji,jj,ikt)*zstep
-     &          /fse3t(ji,jj,ikt)
-
-#endif
-          END DO
-        END DO
-C
-C  Nitrogen fixation (simple parameterization). The total gain
-C  from nitrogen fixation is scaled to balance the loss by 
-C  denitrification
-C  -------------------------------------------------------------
-C
-        denitot=0.
-        DO jk=1,jpk-1
-          DO jj=2,jpj-1
-            DO ji=2,jpi-1
-        denitot=denitot+denitr(ji,jj,jk)*rdenit*e1t(ji,jj)*e2t(ji,jj)
-     &    *fse3t(ji,jj,jk)*tmask(ji,jj,jk)*tmask_i(ji,jj)
-     &    *znegtr(ji,jj,jk)
-            END DO
-          END DO
-        END DO
-
-        IF( lk_mpp )   CALL mpp_sum( denitot )  ! sum over the global domain
-C
-C  Potential nitrogen fication dependant on temperature
-C  and iron
-C  ----------------------------------------------------
-C
-       DO jk=1,jpk
-        DO jj=1,jpj
-          DO ji=1,jpi
-        xlim=(1.-xnanono3(ji,jj,jk)-xnanonh4(ji,jj,jk))
-        if (xlim.le.0.2) xlim=0.01
-        nitrpot(ji,jj,jk)=max(0.,(0.6*tgfunc(ji,jj,jk)-2.15)/rjjss)
-#if defined key_off_degrad
-     &    *facvol(ji,jj,jk)
-#endif
-     &    *xlim*rfact2*trn(ji,jj,jk,jpfer)/(conc3
-     &    +trn(ji,jj,jk,jpfer))*(1.-exp(-etot(ji,jj,jk)/50.))
-          END DO
-        END DO 
-       END DO
-C
-      nitrpottot=0.
-      DO jk=1,jpkm1
-        DO jj=1,jpj
-          DO ji=1,jpi
-        nitrpottot=nitrpottot+nitrpot(ji,jj,jk)*e1t(ji,jj)
-     &    *e2t(ji,jj)*tmask(ji,jj,jk)*tmask_i(ji,jj)*fse3t(ji,jj,jk)
-          END DO
-        END DO
-      END DO
-
-        IF( lk_mpp )   CALL mpp_sum( nitrpottot )  ! sum over the global domain
-C
-C  Nitrogen change due to nitrogen fixation
-C  ----------------------------------------
-C
-       DO jk=1,jpk
-        DO jj=1,jpj
-          DO ji=1,jpi
-#if ! defined key_cfg_1d && ( defined key_orca_r4 || defined key_orca_r2 || defined key_orca_r05 || defined key_orca_r025 )
-        zfact=nitrpot(ji,jj,jk)*denitot/nitrpottot
-#else
-        zfact=nitrpot(ji,jj,jk)*1.E-7
-#endif
-        trn(ji,jj,jk,jpnh4)=trn(ji,jj,jk,jpnh4)+zfact
-        trn(ji,jj,jk,jpoxy)=trn(ji,jj,jk,jpoxy)+zfact*o2nit
-        trn(ji,jj,jk,jppo4)=trn(ji,jj,jk,jppo4)+30./46.*zfact
-          END DO
-        END DO
-       END DO
-C
-#    if defined key_trc_diaadd
-        DO jj = 1,jpj
-          DO ji = 1,jpi
-        trc2d(ji,jj,13) = nitrpot(ji,jj,1)*1E-7*fse3t(ji,jj,1)*1E3
-     &    /rfact2
-        trc2d(ji,jj,12) = irondep(ji,jj,1)*1e3*rfact2r
-     &    *fse3t(ji,jj,1)
-          END DO
-        END DO
-#    endif
-C
-#endif
-      RETURN
-      END
Index: branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zsed.F90
===================================================================
--- branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zsed.F90	(revision 775)
+++ branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zsed.F90	(revision 775)
@@ -0,0 +1,299 @@
+MODULE p4zsed
+   !!======================================================================
+   !!                         ***  MODULE p4sed  ***
+   !! TOP :   PISCES Compute loss of organic matter in the sediments
+   !!======================================================================
+   !! History :   1.0  !  2004-03 (O. Aumont) Original code
+   !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
+   !!----------------------------------------------------------------------
+#if defined key_pisces
+   !!----------------------------------------------------------------------
+   !!   'key_pisces'                                       PISCES bio-model
+   !!----------------------------------------------------------------------
+   !!   p4z_sed        :  Compute loss of organic matter in the sediments
+   !!----------------------------------------------------------------------
+   USE oce_trc         !
+   USE trp_trc
+   USE sms
+   USE lib_mpp
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   p4z_sed    ! called in p4zprg.F90
+
+   !!* Substitution
+#  include "domzgr_substitute.h90"
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 2.0 , LOCEAN-IPSL (2007) 
+   !! $Header:$ 
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+   SUBROUTINE p4z_sed
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE p4z_sed  ***
+      !!
+      !! ** Purpose :   Compute loss of organic matter in the sediments. This
+      !!              is by no way a sediment model. The loss is simply 
+      !!              computed to balance the inout from rivers and dust
+      !!
+      !! ** Method  : - ???
+      !!---------------------------------------------------------------------
+      INTEGER  ::   ji, jj, jk
+      INTEGER  ::   ikt
+      REAL(wp) ::   zsumsedsi, zsumsedpo4, zsumsedcal
+      REAL(wp) ::   zconctmp , zdenitot  , znitrpottot
+      REAL(wp) ::   zlim, zconctmp2, zstep, zfact
+      REAL(wp), DIMENSION(jpi,jpj)     ::   zsidep
+      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   znitrpot, zirondep
+      !!---------------------------------------------------------------------
+
+
+      zstep = rfact2 / rjjss      ! Time step duration for the biology
+
+      zirondep(:,:,:) = 0.e0          ! Initialisation of variables used to compute deposition
+      zsidep  (:,:)   = 0.e0
+
+      ! Iron and Si deposition at the surface
+      ! -------------------------------------
+
+      DO jj = 1, jpj
+         DO ji = 1, jpi
+            zirondep(ji,jj,1) = ( 0.014 * dust(ji,jj) / ( 55.85 * rmoss ) + 3.e-10 / raass )   &
+               &             * rfact2 / fse3t(ji,jj,1)
+            zsidep  (ji,jj)   = 8.8 * 0.075 * dust(ji,jj) * rfact2 / ( fse3t(ji,jj,1) * 28.1 * rmoss )
+         END DO
+      END DO
+
+      ! Iron solubilization of particles in the water column
+      ! ----------------------------------------------------
+
+      DO jk = 2, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               zirondep(ji,jj,jk) = dust(ji,jj) / ( 10. * 55.85 * rmoss ) * rfact2 * 0.0001
+            END DO
+         END DO
+      END DO
+
+      ! Add the external input of nutrients, carbon and alkalinity
+      ! ----------------------------------------------------------
+
+      DO jj = 1, jpj
+         DO ji = 1, jpi
+            trn(ji,jj,1,jppo4) = trn(ji,jj,1,jppo4) +   rivinp(ji,jj)                   * rfact2
+            trn(ji,jj,1,jpno3) = trn(ji,jj,1,jpno3) + ( rivinp(ji,jj) + nitdep(ji,jj) ) * rfact2
+            trn(ji,jj,1,jpfer) = trn(ji,jj,1,jpfer) +   rivinp(ji,jj) * 3.e-5           * rfact2
+            trn(ji,jj,1,jpsil) = trn(ji,jj,1,jpsil) +   zsidep (ji,jj) + cotdep(ji,jj)   * rfact2 / 6.
+            trn(ji,jj,1,jpdic) = trn(ji,jj,1,jpdic) +   rivinp(ji,jj) * 2.631           * rfact2
+            trn(ji,jj,1,jptal) = trn(ji,jj,1,jptal) + ( cotdep(ji,jj) - rno3*(rivinp(ji,jj)   &
+               &                                                      + nitdep(ji,jj) ) ) * rfact2
+         END DO
+      END DO
+
+
+      ! Add the external input of iron which is 3D distributed
+      ! (dust, river and sediment mobilization)
+      ! ------------------------------------------------------
+
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               trn(ji,jj,jk,jpfer) = trn(ji,jj,jk,jpfer)   &
+                  &                + zirondep(ji,jj,jk) + ironsed(ji,jj,jk) * rfact2
+            END DO
+         END DO
+      END DO
+
+      ! Initialisation of variables used to compute Sinking Speed
+      ! ---------------------------------------------------------
+
+      zsumsedsi  = 0.e0
+      zsumsedpo4 = 0.e0
+      zsumsedcal = 0.e0
+
+      ! Loss of biogenic silicon, Caco3 organic carbon in the sediments. 
+      ! First, the total loss is computed.
+      ! The factor for calcite comes from the alkalinity effect
+      ! -------------------------------------------------------------
+
+      DO jj = 1, jpj
+         DO ji = 1, jpi
+            ikt = MAX( mbathy(ji,jj)-1, 1 )
+            zfact = e1t(ji,jj) * e2t(ji,jj) / rjjss * tmask_i(ji,jj)
+# if ! defined key_kriest
+            zsumsedsi  = zsumsedsi  + zfact *  trn(ji,jj,ikt,jpdsi) * wsbio4(ji,jj,ikt) 
+# else
+            zsumsedsi  = zsumsedsi  + zfact *  trn(ji,jj,ikt,jpdsi) * wscal (ji,jj,ikt)
+# endif
+            zsumsedcal = zsumsedcal + zfact *  trn(ji,jj,ikt,jpcal) * wscal (ji,jj,ikt) * 2.e0
+# if  defined key_kriest
+            zsumsedpo4 = zsumsedpo4 + zfact *  trn(ji,jj,ikt,jppoc) * wsbio3(ji,jj,ikt)
+# else
+            zsumsedpo4 = zsumsedpo4 + zfact *( trn(ji,jj,ikt,jpgoc) * wsbio4(ji,jj,ikt)   &
+               &                             + trn(ji,jj,ikt,jppoc) * wsbio3(ji,jj,ikt) )
+# endif
+         END DO
+      END DO
+
+      IF( lk_mpp ) THEN
+         CALL mpp_sum( zsumsedsi  )   ! sums over the global domain
+         CALL mpp_sum( zsumsedcal )   ! sums over the global domain
+         CALL mpp_sum( zsumsedpo4 )   ! sums over the global domain
+      ENDIF
+
+      ! Then this loss is scaled at each bottom grid cell for
+      ! equilibrating the total budget of silica in the ocean.
+      ! Thus, the amount of silica lost in the sediments equal
+      ! the supply at the surface (dust+rivers)
+      ! ------------------------------------------------------
+
+      DO jj = 1, jpj
+         DO ji = 1, jpi
+            ikt = MAX( mbathy(ji,jj) - 1, 1 )
+            zconctmp = trn(ji,jj,ikt,jpdsi) * zstep / fse3t(ji,jj,ikt)   &
+# if ! defined key_kriest
+     &               * wsbio4(ji,jj,ikt) 
+# else
+     &               * wscal (ji,jj,ikt)
+# endif
+            trn(ji,jj,ikt,jpdsi) = trn(ji,jj,ikt,jpdsi) - zconctmp
+            trn(ji,jj,ikt,jpsil) = trn(ji,jj,ikt,jpsil) + zconctmp   &
+               &                 * ( 1.- ( sumdepsi + rivalkinput / raass / 6. ) / zsumsedsi )
+         END DO
+      END DO
+
+      DO jj = 1, jpj
+         DO ji = 1, jpi
+            ikt = MAX( mbathy(ji,jj) - 1, 1 )
+            zconctmp = trn(ji,jj,ikt,jpcal) * wscal(ji,jj,ikt) * zstep / fse3t(ji,jj,ikt)
+            trn(ji,jj,ikt,jpcal) = trn(ji,jj,ikt,jpcal) - zconctmp
+            trn(ji,jj,ikt,jptal) = trn(ji,jj,ikt,jptal) + zconctmp   &
+               &                 * ( 1.- ( rivalkinput / raass ) / zsumsedcal ) * 2.e0
+            trn(ji,jj,ikt,jpdic) = trn(ji,jj,ikt,jpdic) + zconctmp   &
+               &                 * ( 1.- ( rivalkinput / raass ) / zsumsedcal )
+         END DO
+      END DO
+
+      DO jj = 1, jpj
+         DO ji = 1, jpi
+            ikt = MAX( mbathy(ji,jj) - 1, 1 )
+# if ! defined key_kriest
+            zconctmp  = trn(ji,jj,ikt,jpgoc)
+            zconctmp2 = trn(ji,jj,ikt,jppoc)
+            trn(ji,jj,ikt,jpgoc) = trn(ji,jj,ikt,jpgoc) - zconctmp  * wsbio4(ji,jj,ikt)   * zstep / fse3t(ji,jj,ikt)
+            trn(ji,jj,ikt,jppoc) = trn(ji,jj,ikt,jppoc) - zconctmp2 * wsbio3(ji,jj,ikt)   * zstep / fse3t(ji,jj,ikt)
+            trn(ji,jj,ikt,jpdoc) = trn(ji,jj,ikt,jpdoc)    &
+               &      + ( zconctmp  * wsbio4(ji,jj,ikt) + zconctmp2 * wsbio3(ji,jj,ikt) ) * zstep / fse3t(ji,jj,ikt)   &
+               &                                        * ( 1.- rivpo4input / (raass * zsumsedpo4 ) )
+            trn(ji,jj,ikt,jpbfe) = trn(ji,jj,ikt,jpbfe) - trn(ji,jj,ikt,jpbfe) * wsbio4(ji,jj,ikt) * zstep   &
+               &          /fse3t(ji,jj,ikt)
+            trn(ji,jj,ikt,jpsfe) = trn(ji,jj,ikt,jpsfe) - trn(ji,jj,ikt,jpsfe) * wsbio3(ji,jj,ikt) * zstep   &
+               &          /fse3t(ji,jj,ikt)
+# else
+            zconctmp  = trn(ji,jj,ikt,jpnum)
+            zconctmp2 = trn(ji,jj,ikt,jppoc)
+            trn(ji,jj,ikt,jpnum) = trn(ji,jj,ikt,jpnum)   &
+               &          - zconctmp * wsbio4(ji,jj,ikt) * zstep / fse3t(ji,jj,ikt)
+            trn(ji,jj,ikt,jppoc) = trn(ji,jj,ikt,jppoc)   &
+               &          - zconctmp2 * wsbio3(ji,jj,ikt) * zstep / fse3t(ji,jj,ikt)
+            trn(ji,jj,ikt,jpdoc) = trn(ji,jj,ikt,jpdoc)    &
+               &          + ( zconctmp2 * wsbio3(ji,jj,ikt) )   &
+               &          * zstep / fse3t(ji,jj,ikt) * ( 1.- rivpo4input / ( raass * zsumsedpo4 ) )
+            trn(ji,jj,ikt,jpsfe) = trn(ji,jj,ikt,jpsfe)   &
+               &                 - trn(ji,jj,ikt,jpsfe) * wsbio3(ji,jj,ikt) * zstep / fse3t(ji,jj,ikt)
+# endif
+         END DO
+      END DO
+
+      ! Nitrogen fixation (simple parameterization). The total gain
+      ! from nitrogen fixation is scaled to balance the loss by 
+      ! denitrification
+      ! -------------------------------------------------------------
+
+!!gm optimisation : use fs do loop index... or 1 to jpi/j
+      zdenitot = 0.e0
+      DO jk = 1, jpkm1
+         DO jj= 2, jpjm1
+            DO ji = 2, jpim1
+               zdenitot = zdenitot + denitr(ji,jj,jk) * rdenit * e1t(ji,jj) * e2t(ji,jj)   &
+                  &    *fse3t(ji,jj,jk) * tmask(ji,jj,jk) * tmask_i(ji,jj) * znegtr(ji,jj,jk)
+            END DO
+         END DO
+      END DO
+
+      IF( lk_mpp )   CALL mpp_sum( zdenitot )      ! sum over the global domain
+
+      ! Potential nitrogen fication dependant on temperature and iron
+      ! -------------------------------------------------------------
+
+      DO jk = 1, jpk
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               zlim = ( 1.- xnanono3(ji,jj,jk) - xnanonh4(ji,jj,jk) )
+               IF( zlim <= 0.2 )   zlim = 0.01
+               znitrpot(ji,jj,jk) = MAX( 0.e0, ( 0.6 * tgfunc(ji,jj,jk) - 2.15 ) / rjjss )   &
+# if defined key_off_degrad
+                  &               * facvol(ji,jj,jk)   &
+# endif
+                  &               * zlim * rfact2 * trn(ji,jj,jk,jpfer)   &
+                  &               / ( conc3 + trn(ji,jj,jk,jpfer) ) * ( 1.- EXP( -etot(ji,jj,jk) / 50.) )
+            END DO
+         END DO 
+      END DO
+
+      znitrpottot = 0.e0
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               znitrpottot = znitrpottot + znitrpot(ji,jj,jk) * e1t(ji,jj) * e2t(ji,jj) * fse3t(ji,jj,jk)   &
+                  &                                           * tmask(ji,jj,jk) * tmask_i(ji,jj) 
+            END DO
+         END DO
+      END DO
+
+      IF( lk_mpp )   CALL mpp_sum( znitrpottot )  ! sum over the global domain
+
+      ! Nitrogen change due to nitrogen fixation
+      ! ----------------------------------------
+
+      DO jk = 1, jpk
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+# if ! defined key_cfg_1d && ( defined key_orca_r4 || defined key_orca_r2 || defined key_orca_r05 || defined key_orca_r025 )
+               zfact = znitrpot(ji,jj,jk) * zdenitot / znitrpottot
+# else
+               zfact = znitrpot(ji,jj,jk) * 1.e-7
+# endif
+               trn(ji,jj,jk,jpnh4) = trn(ji,jj,jk,jpnh4) + zfact
+               trn(ji,jj,jk,jpoxy) = trn(ji,jj,jk,jpoxy) + zfact   * o2nit
+               trn(ji,jj,jk,jppo4) = trn(ji,jj,jk,jppo4) + 30./ 46.* zfact
+            END DO
+         END DO
+      END DO
+
+# if defined key_trc_diaadd
+      DO jj = 1,jpj
+         DO ji = 1,jpi
+            trc2d(ji,jj,13) = znitrpot(ji,jj,1) * 1.e-7 * fse3t(ji,jj,1) * 1.e+3 / rfact2
+            trc2d(ji,jj,12) = zirondep(ji,jj,1) * 1.e+3 * rfact2r * fse3t(ji,jj,1)
+         END DO
+      END DO
+# endif
+      !
+   END SUBROUTINE p4z_sed
+
+#else
+   !!======================================================================
+   !!  Dummy module :                                   No PISCES bio-model
+   !!======================================================================
+CONTAINS
+   SUBROUTINE p4z_sed                         ! Empty routine
+   END SUBROUTINE p4z_sed
+#endif 
+
+   !!======================================================================
+END MODULE  p4zsed
Index: branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zsink.F
===================================================================
--- branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zsink.F	(revision 773)
+++ 	(revision )
@@ -1,51 +1,0 @@
-      SUBROUTINE p4zsink
-#if defined key_top && defined key_pisces
-CCC---------------------------------------------------------------------
-CCC
-CCC          ROUTINE p4zsink : PISCES MODEL
-CCC          ******************************
-CCC
-CCC  PURPOSE :
-CCC  ---------
-CCC         Compute vertical flux of particulate matter due to
-CCC         gravitational sinking
-CCC
-CC   INPUT :
-CC   -----
-CC      common
-CC              all the common defined in opa
-CC
-CC
-CC   OUTPUT :                   : no
-CC   ------
-CC
-CC   EXTERNAL :
-CC   --------
-CC            p4zsink2
-CC
-CC   MODIFICATIONS:
-CC   --------------
-CC      original  : 2004 - O. Aumont 
-CC----------------------------------------------------------------------
-CC parameters and commons
-CC ======================
-CDIR$ NOLIST
-      USE oce_trc
-      USE trp_trc
-      USE sms
-      IMPLICIT NONE
-#include "domzgr_substitute.h90"
-
-#if defined key_kriest
-
-# include "p4zsink.kriest.h"
-
-#else
-
-# include "p4zsink.std.h"
-
-#endif
-
-#endif
-      RETURN
-      END
Index: branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zsink.F90
===================================================================
--- branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zsink.F90	(revision 775)
+++ branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zsink.F90	(revision 775)
@@ -0,0 +1,201 @@
+MODULE p4zsink
+   !!======================================================================
+   !!                         ***  MODULE p4zsink  ***
+   !! TOP :   PISCES Compute vertical flux of particulate matter due to gravitational sinking
+   !!======================================================================
+   !! History :   1.0  !  2004     (O. Aumont) Original code
+   !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
+   !!----------------------------------------------------------------------
+#if defined key_pisces  && ! defined key_kriest
+   !!----------------------------------------------------------------------
+   !!   'key_pisces'        and                            PISCES bio-model
+   !!   NOT 'key_kriest'                                   No Kriest option
+   !!----------------------------------------------------------------------
+   !!   p4z_sink       :  Compute vertical flux of particulate matter due to gravitational sinking
+   !!----------------------------------------------------------------------
+   USE oce_trc         !
+   USE trp_trc
+   USE sms
+   USE p4zsink2        !
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   p4z_sink    ! called in p4zbio.F90
+
+   !!* Substitution
+#  include "domzgr_substitute.h90"
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 2.0 , LOCEAN-IPSL (2007) 
+   !! $Header:$ 
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+   SUBROUTINE p4z_sink
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE p4z_sink  ***
+      !!
+      !! ** Purpose :   Compute vertical flux of particulate matter due to 
+      !!              gravitational sinking
+      !!
+      !! ** Method  : - ???
+      !!---------------------------------------------------------------------
+      INTEGER  ::   ji, jj, jk
+      INTEGER  ::   iksed
+      REAL(wp) ::   zagg1, zagg2, zagg3, zagg4
+      REAL(wp) ::   zfact, zstep, zwsmax
+#if defined key_trc_dia3d
+      REAL(wp) ::   zrfact2
+#endif
+      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zsinking, zsinking2
+      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zsinkfer, zsinkfer2
+      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zsinkcal, zsinksil
+      !!---------------------------------------------------------------------
+
+       zstep = rfact2 / rjjss      ! Timestep duration for biology
+
+
+!    Sinking speeds of detritus is increased with depth as shown
+!    by data and from the coagulation theory
+!    -----------------------------------------------------------
+
+      iksed = 10
+
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji=1,jpi
+               zfact = MAX( 0., fsdepw(ji,jj,jk+1)-hmld(ji,jj) ) / 4000.
+               wsbio4(ji,jj,jk) = wsbio2 + ( 200.- wsbio2 ) * zfact
+            END DO
+         END DO
+      END DO
+
+!      LIMIT THE VALUES OF THE SINKING SPEEDS 
+!      TO AVOID NUMERICAL INSTABILITIES
+
+      wsbio3(:,:,:) = wsbio
+
+      DO jk = 1,jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               zwsmax = 0.8 * fse3t(ji,jj,jk) / zstep
+               wsbio4(ji,jj,jk) = MIN( wsbio4(ji,jj,jk), zwsmax )
+               wsbio3(ji,jj,jk) = MIN( wsbio3(ji,jj,jk), zwsmax )
+            END DO
+         END DO
+      END DO
+
+      wscal(:,:,:) = wsbio4(:,:,:)
+
+
+!   INITIALIZE TO ZERO ALL THE SINKING ARRAYS
+!   -----------------------------------------
+
+      zsinking (:,:,:) = 0.e0
+      zsinking2(:,:,:) = 0.e0
+      zsinkcal (:,:,:) = 0.e0
+      zsinkfer (:,:,:) = 0.e0
+      zsinksil (:,:,:) = 0.e0
+      zsinkfer2(:,:,:) = 0.e0
+
+!   Compute the sedimentation term using p4zsink2 for all
+!   the sinking particles
+!   -----------------------------------------------------
+
+      CALL p4z_sink2( wsbio3, zsinking , jppoc )
+      CALL p4z_sink2( wsbio3, zsinkfer , jpsfe )
+      CALL p4z_sink2( wsbio4, zsinking2, jpgoc )
+      CALL p4z_sink2( wsbio4, zsinkfer2, jpbfe )
+      CALL p4z_sink2( wsbio4, zsinksil , jpdsi )
+      CALL p4z_sink2( wscal , zsinkcal , jpcal )
+
+!  Exchange between organic matter compartments due to
+!  coagulation/disaggregation
+!  ---------------------------------------------------
+
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+
+               zfact = zstep * zdiss(ji,jj,jk)
+
+!    Part I : Coagulation dependent on turbulence
+!    ----------------------------------------------
+
+# if defined key_off_degrad
+               zagg1 = 940.* zfact * trn(ji,jj,jk,jppoc) * trn(ji,jj,jk,jppoc) * facvol(ji,jj,jk)
+# else
+               zagg1 = 940.* zfact * trn(ji,jj,jk,jppoc) * trn(ji,jj,jk,jppoc)
+# endif
+
+# if defined key_off_degrad
+               zagg2 = 1.054e4 * zfact * trn(ji,jj,jk,jppoc) * trn(ji,jj,jk,jpgoc) * facvol(ji,jj,jk)
+# else
+               zagg2 = 1.054e4 * zfact * trn(ji,jj,jk,jppoc) * trn(ji,jj,jk,jpgoc)
+# endif
+
+!    Aggregation of small into large particles
+!    Part II : Differential settling
+!    ----------------------------------------------
+
+# if defined key_off_degrad
+               zagg3 = 0.66 * zstep * trn(ji,jj,jk,jppoc) * trn(ji,jj,jk,jpgoc) * facvol(ji,jj,jk)
+# else
+               zagg3 = 0.66 * zstep * trn(ji,jj,jk,jppoc) * trn(ji,jj,jk,jpgoc)
+# endif
+
+# if defined key_off_degrad
+!!gm  zagg4 set to zero ????
+               zagg4 = 0.e0 * zstep * trn(ji,jj,jk,jppoc) * trn(ji,jj,jk,jppoc) * facvol(ji,jj,jk)
+# else
+!!gm  zagg4 set to zero ????
+               zagg4 = 0.e0 * zstep * trn(ji,jj,jk,jppoc) * trn(ji,jj,jk,jppoc)
+# endif
+
+               xagg  (ji,jj,jk) = zagg1 + zagg2 + zagg3 + zagg4
+               xaggfe(ji,jj,jk) = xagg(ji,jj,jk) * trn(ji,jj,jk,jpsfe) / ( trn(ji,jj,jk,jppoc) + rtrn )
+
+!     Aggregation of DOC to small particles
+!     --------------------------------------
+
+               xaggdoc(ji,jj,jk) = ( 80.* trn(ji,jj,jk,jpdoc) + 698. * trn(ji,jj,jk,jppoc) )       &
+# if defined key_off_degrad
+                  &              * facvol(ji,jj,jk)                           &
+# endif
+                  &              * zfact * trn(ji,jj,jk,jpdoc)
+
+               xaggdoc2(ji,jj,jk) = 1.05e4 * zfact * trn(ji,jj,jk,jpgoc)   &
+# if defined key_off_degrad
+                  &               * facvol(ji,jj,jk)                            &
+# endif      
+                  &               * trn(ji,jj,jk,jpdoc)
+
+            END DO
+         END DO
+      END DO
+
+# if defined key_trc_dia3d
+      zrfact2 = 1.e3 * rfact2r
+      trc2d(:,:, 5) = zsinking (:,:,iksed+1) * zrfact2
+      trc2d(:,:, 6) = zsinking2(:,:,iksed+1) * zrfact2
+      trc2d(:,:, 7) = zsinkfer (:,:,iksed+1) * zrfact2
+      trc2d(:,:, 8) = zsinkfer2(:,:,iksed+1) * zrfact2
+      trc2d(:,:, 9) = zsinksil (:,:,iksed+1) * zrfact2
+      trc2d(:,:,10) = zsinkcal (:,:,iksed+1) * zrfact2
+# endif
+      !
+   END SUBROUTINE p4z_sink
+
+#else
+   !!======================================================================
+   !!  Dummy module :                                   No PISCES bio-model
+   !!======================================================================
+CONTAINS
+   SUBROUTINE p4z_sink                    ! Empty routine
+   END SUBROUTINE p4z_sink
+#endif 
+
+   !!======================================================================
+END MODULE  p4zsink
Index: branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zsink.kriest.h
===================================================================
--- branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zsink.kriest.h	(revision 773)
+++ 	(revision )
@@ -1,211 +1,0 @@
-CCCCCC PISCES MODEL: Kriest parameterization
-CDIR$ LIST
-CC----------------------------------------------------------------------
-CC local declarations
-CC ==================
-      INTEGER jksed, ji, jj, jk
-      REAL xagg1,xagg2,xagg3,xagg4,xagg5,xaggsi,xaggsh
-      REAL znum(jpi,jpj,jpk)
-      REAL xnum,xeps,xfm,xgm,xsm
-      REAL xdiv,xdiv1,xdiv2,xdiv3,xdiv4,xdiv5
-      REAL zval1, zval2, zval3, zval4
-      REAL zstep
-#if defined key_trc_dia3d
-      REAL zrfact2
-#endif
-      REAL sinking(jpi,jpj,jpk),sinking2(jpi,jpj,jpk)
-      REAL sinkfer(jpi,jpj,jpk)
-      REAL sinkcal(jpi,jpj,jpk),sinksil(jpi,jpj,jpk)
-C
-C
-C    Time step duration for biology
-C    ------------------------------
-C
-       zstep=rfact2/rjjss
-       
-C
-C
-C     Initialisation of variables used to compute Sinking Speed
-C     ---------------------------------------------------------
-C
-       znum(:,:,:) = 0.
-       jksed = 10
-       zval1 = 1. + xkr_zeta
-       zval2 = 1. + xkr_zeta + xkr_eta
-       zval3 = 1. + xkr_eta
-C
-C     Computation of the vertical sinking speed : Kriest et Evans, 2000
-C     -----------------------------------------------------------------
-C    
-       do jk=1,jpk-1
-         do jj=1,jpj
-           do ji=1,jpi
-             IF (tmask(ji,jj,jk).NE.0) THEN
-                 xnum = trn(ji,jj,jk,jppoc) / (trn(ji,jj,jk,jpnum)+rtrn)
-     &                     / xkr_massp
-C -------------- To avoid sinking speed over 50 m/day -------
-                 xnum = min( xnumm(jk), xnum )
-                 xnum = max( 1.1, xnum )
-                 znum(ji,jj,jk) = xnum
-C------------------------------------------------------------
-                 xeps = ( zval1 * xnum - 1. )/ ( xnum - 1. )
-                 xfm  = xkr_frac**( 1. - xeps )
-                 xgm  = xkr_frac**( zval1 - xeps )
-                 xdiv = max(1E-4,abs(xeps-zval2))*sign(1.,(xeps-zval2))
-                 xdiv1=(xeps-zval3)
-                 wsbio3(ji,jj,jk)= xkr_wsbio_min * ( xeps-zval1 ) / xdiv
-     &                           - xkr_wsbio_max * xgm * xkr_eta / xdiv
-                 wsbio4(ji,jj,jk)= xkr_wsbio_min * ( xeps-1. ) / xdiv1
-     &                           - xkr_wsbio_max * xfm * xkr_eta / xdiv1
-                 IF( xnum == 1.1) THEN
-                     wsbio3(ji,jj,jk) = wsbio4(ji,jj,jk)
-                 ENDIF
-             ENDIF
-           end do
-         end do
-       end do
-C
-       wscal(:,:,:)=max(wsbio3(:,:,:),50.)
-C
-C
-C   INITIALIZE TO ZERO ALL THE SINKING ARRAYS
-C   -----------------------------------------
-C
-         sinking=0.
-         sinking2=0.
-         sinkcal=0.
-         sinkfer=0.
-         sinksil=0.
-C
-C   Compute the sedimentation term using p4zsink2 for all
-C   the sinking particles
-C   -----------------------------------------------------
-C
-         CALL p4zsink2(wsbio3,sinking,jppoc)
-         CALL p4zsink2(wsbio4,sinking2,jpnum)
-         CALL p4zsink2(wsbio3,sinkfer,jpsfe)
-         CALL p4zsink2(wscal,sinksil,jpdsi)
-         CALL p4zsink2(wscal,sinkcal,jpcal)
-
-C
-C  Exchange between organic matter compartments due to
-C  coagulation/disaggregation
-C  ---------------------------------------------------
-C
-         zval1 = 1. + xkr_zeta
-         zval2 = 1. + xkr_eta
-         zval3 = 3. + xkr_eta
-         zval4 = 4. + xkr_eta
-
-         DO jk = 1,jpkm1
-           DO jj = 1,jpj
-             DO ji = 1,jpi
-               IF (tmask(ji,jj,jk).NE.0.) THEN
-C
-                   xnum=trn(ji,jj,jk,jppoc)/(trn(ji,jj,jk,jpnum)+rtrn)
-     &                         /xkr_massp
-C -------------- To avoid sinking speed over 50 m/day -------
-                   xnum=min(xnumm(jk),xnum)
-                   xnum=max(1.1,xnum)
-C------------------------------------------------------------
-                   xeps =(zval1*xnum-1.)/(xnum-1.)
-                   xdiv =max(1E-4,abs(xeps-zval3))*sign(1.,(xeps-zval3))
-                   xdiv1=max(1E-4,abs(xeps-4.))*sign(1.,(xeps-4.))
-                   xdiv2=(xeps-2.)
-                   xdiv3=(xeps-3.)
-                   xdiv4=(xeps-zval2)
-                   xdiv5=(2*xeps-zval4)
-                   xfm=xkr_frac**(1.-xeps)
-                   xsm=xkr_frac**xkr_eta
-C
-C    Part I : Coagulation dependant on turbulence
-C    ----------------------------------------------
-C
-                   xagg1=(0.163*trn(ji,jj,jk,jpnum)**2
-     &           *2.*( (xfm-1.)*(xfm*xkr_mass_max**3-xkr_mass_min**3)
-     &           *(xeps-1)/xdiv1 + 3.*(xfm*xkr_mass_max-xkr_mass_min)
-     &           *(xfm*xkr_mass_max**2-xkr_mass_min**2)
-     &           *(xeps-1.)**2/(xdiv2*xdiv3)))
-#    if defined key_off_degrad
-     &                 *facvol(ji,jj,jk)
-#    endif
-
-C
-                   xagg2=(2*0.163*trn(ji,jj,jk,jpnum)**2*xfm*
-     &                   ((xkr_mass_max**3+3.*(xkr_mass_max**2
-     &                    *xkr_mass_min*(xeps-1.)/xdiv2
-     &                    +xkr_mass_max*xkr_mass_min**2*(xeps-1.)/xdiv3)
-     &                    +xkr_mass_min**3*(xeps-1)/xdiv1)
-     &                    -xfm*xkr_mass_max**3*(1.+3.*((xeps-1.)/
-     &                    (xeps-2.)+(xeps-1.)/xdiv3)+(xeps-1.)/xdiv1)))
-#    if defined key_off_degrad
-     &                 *facvol(ji,jj,jk)
-#    endif
-C
-                   xagg3=(0.163*trn(ji,jj,jk,jpnum)**2*xfm**2*8.
-     &                 *xkr_mass_max**3)
-#    if defined key_off_degrad
-     &                 *facvol(ji,jj,jk)
-#    endif
-C
-                   xaggsh=(xagg1+xagg2+xagg3)*rfact2*zdiss(ji,jj,jk)
-     &                 /1000.
-C
-C    Aggregation of small into large particles
-C    Part II : Differential settling
-C    ----------------------------------------------
-C
-                   xagg4=(2.*3.141*0.125*trn(ji,jj,jk,jpnum)**2*
-     &                 xkr_wsbio_min*(xeps-1.)**2
-     &                 *(xkr_mass_min**2*((1.-xsm*xfm)/(xdiv3*xdiv4)
-     &                 -(1.-xfm)/(xdiv*(xeps-1.)))-
-     &                 ((xfm*xfm*xkr_mass_max**2*xsm-xkr_mass_min**2)
-     &                 *xkr_eta)/(xdiv*xdiv3*xdiv5)))
-#    if defined key_off_degrad
-     &                 *facvol(ji,jj,jk)
-#    endif
-C
-                   xagg5=(2.*3.141*0.125*trn(ji,jj,jk,jpnum)**2
-     &                 *(xeps-1.)*xfm*xkr_wsbio_min
-     &                 *(xsm*(xkr_mass_min**2-xfm*xkr_mass_max**2)
-     &                 /xdiv3-(xkr_mass_min**2-xfm*xsm*xkr_mass_max**2)
-     &                 /xdiv))
-#    if defined key_off_degrad
-     &                 *facvol(ji,jj,jk)
-#    endif
-C
-                   xaggsi=(xagg4+xagg5)*zstep/10.
-C
-                   xagg(ji,jj,jk)=0.5 * xkr_stick*(xaggsh+xaggsi)
-C
-C     Aggregation of DOC to small particles
-C     --------------------------------------
-C
-                   xaggdoc(ji,jj,jk)=(0.4*trn(ji,jj,jk,jpdoc)
-     &                 +1018.*trn(ji,jj,jk,jppoc))*zstep
-     &                 *zdiss(ji,jj,jk)*trn(ji,jj,jk,jpdoc)
-#    if defined key_off_degrad
-     &                 *facvol(ji,jj,jk)
-#    endif
-C
-
-               ENDIF
-             END DO
-           END DO
-         END DO
-C
-#    if defined key_trc_dia3d
-         zrfact2 = 1.e3*rfact2r
-         trc2d(:,:,5) = sinking(:,:,jksed+1)*zrfact2
-         trc2d(:,:,6) = sinking2(:,:,jksed+1)*zrfact2
-         trc2d(:,:,7) = sinkfer(:,:,jksed+1)*zrfact2
-         trc2d(:,:,9) = sinksil(:,:,jksed+1)*zrfact2
-         trc2d(:,:,10) = sinkcal(:,:,jksed+1)*zrfact2
-         trc3d(:,:,:,12) = sinking(:,:,:)*zrfact2
-         trc3d(:,:,:,13) = sinking2(:,:,:)*zrfact2
-         trc3d(:,:,:,14) = sinksil(:,:,:)*zrfact2
-         trc3d(:,:,:,15) = sinkcal(:,:,:)*zrfact2
-         trc3d(:,:,:,16) = znum(:,:,:)
-         trc3d(:,:,:,17) = wsbio3(:,:,:)
-         trc3d(:,:,:,18) = wsbio4(:,:,:)
-#    endif
Index: branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zsink.std.h
===================================================================
--- branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zsink.std.h	(revision 773)
+++ 	(revision )
@@ -1,143 +1,0 @@
-
-CDIR$ LIST
-CC----------------------------------------------------------------------
-CC local declarations
-CC ==================
-      INTEGER jksed, ji, jj, jk
-      REAL xagg1,xagg2,xagg3,xagg4
-      REAL zfact,zstep,wsmax
-#if defined key_trc_dia3d
-      REAL zrfact2
-#endif
-      REAL sinking(jpi,jpj,jpk),sinking2(jpi,jpj,jpk)
-      REAL sinkfer(jpi,jpj,jpk),sinkfer2(jpi,jpj,jpk)
-      REAL sinkcal(jpi,jpj,jpk),sinksil(jpi,jpj,jpk)
-C
-C    Time step duration for biology
-C    ------------------------------
-C
-       zstep=rfact2/rjjss
-C
-C    Sinking speeds of detritus is increased with depth as shown
-C    by data and from the coagulation theory
-C    -----------------------------------------------------------
-C
-       jksed=10
-C
-       DO jk=1,jpk-1
-         DO jj=1,jpj
-           DO ji=1,jpi
-       zfact=max(0.,fsdepw(ji,jj,jk+1)-hmld(ji,jj))/4000.
-       wsbio4(ji,jj,jk)=wsbio2+(200.-wsbio2)*zfact
-             END DO
-           END DO
-         END DO
-C
-C      LIMIT THE VALUES OF THE SINKING SPEEDS 
-C      TO AVOID NUMERICAL INSTABILITIES
-C
-      wsbio3(:,:,:)=wsbio
-
-      Do jk=1,jpk-1
-        DO jj=1,jpj
-          DO ji=1,jpi
-       wsmax=0.8*fse3t(ji,jj,jk)/zstep
-       wsbio4(ji,jj,jk)=min(wsbio4(ji,jj,jk),wsmax)
-       wsbio3(ji,jj,jk)=min(wsbio3(ji,jj,jk),wsmax)
-          END DO
-        END DO
-       END DO
-
-      wscal(:,:,:)=wsbio4(:,:,:)
-C
-C
-C   INITIALIZE TO ZERO ALL THE SINKING ARRAYS
-C   -----------------------------------------
-C
-         sinking=0.
-         sinking2=0.
-         sinkcal=0.
-         sinkfer=0.
-         sinksil=0.
-         sinkfer2=0.
-C
-C   Compute the sedimentation term using p4zsink2 for all
-C   the sinking particles
-C   -----------------------------------------------------
-C
-         CALL p4zsink2(wsbio3,sinking,jppoc)
-         CALL p4zsink2(wsbio3,sinkfer,jpsfe)
-         CALL p4zsink2(wsbio4,sinking2,jpgoc)
-         CALL p4zsink2(wsbio4,sinkfer2,jpbfe)
-         CALL p4zsink2(wsbio4,sinksil,jpdsi)
-         CALL p4zsink2(wscal,sinkcal,jpcal)
-C
-C  Exchange between organic matter compartments due to
-C  coagulation/disaggregation
-C  ---------------------------------------------------
-C
-         DO jk = 1,jpkm1
-           DO jj = 1,jpj
-             DO ji = 1,jpi
-C
-        zfact=zstep*zdiss(ji,jj,jk)
-C
-C    Part I : Coagulation dependent on turbulence
-C    ----------------------------------------------
-C
-         xagg1=940.*zfact*trn(ji,jj,jk,jppoc)*trn(ji,jj,jk,jppoc)
-#    if defined key_off_degrad
-     &     *facvol(ji,jj,jk)
-#    endif
-
-         xagg2=1.054E4*zfact*trn(ji,jj,jk,jppoc)*trn(ji,jj,jk,jpgoc)
-#    if defined key_off_degrad
-     &     *facvol(ji,jj,jk)
-#    endif
-C
-C    Aggregation of small into large particles
-C    Part II : Differential settling
-C    ----------------------------------------------
-C
-         xagg3=0.66*zstep*trn(ji,jj,jk,jppoc)*trn(ji,jj,jk,jpgoc)
-#    if defined key_off_degrad
-     &     *facvol(ji,jj,jk)
-#    endif
-
-         xagg4=0.*zstep*trn(ji,jj,jk,jppoc)*trn(ji,jj,jk,jppoc)
-#    if defined key_off_degrad
-     &     *facvol(ji,jj,jk)
-#    endif
-C
-         xagg(ji,jj,jk)=xagg1+xagg2+xagg3+xagg4
-         xaggfe(ji,jj,jk)=xagg(ji,jj,jk)*trn(ji,jj,jk,jpsfe)/
-     &     (trn(ji,jj,jk,jppoc)+rtrn)
-C
-C     Aggregation of DOC to small particles
-C     --------------------------------------
-C
-         xaggdoc(ji,jj,jk)=(80*trn(ji,jj,jk,jpdoc)+698.
-     &     *trn(ji,jj,jk,jppoc))*zfact*trn(ji,jj,jk,jpdoc)
-#    if defined key_off_degrad
-     &     *facvol(ji,jj,jk)
-#    endif
-
-         xaggdoc2(ji,jj,jk)=1.05E4*zfact*trn(ji,jj,jk,jpgoc)
-     &     *trn(ji,jj,jk,jpdoc)
-#    if defined key_off_degrad
-     &     *facvol(ji,jj,jk)
-#    endif
-C
-             END DO
-           END DO
-         END DO
-
-#    if defined key_trc_dia3d
-         zrfact2 = 1.e3*rfact2r
-         trc2d(:,:,5) = sinking(:,:,jksed+1)*zrfact2
-         trc2d(:,:,6) = sinking2(:,:,jksed+1)*zrfact2
-         trc2d(:,:,7) = sinkfer(:,:,jksed+1)*zrfact2
-         trc2d(:,:,8) = sinkfer2(:,:,jksed+1)*zrfact2
-         trc2d(:,:,9) = sinksil(:,:,jksed+1)*zrfact2
-         trc2d(:,:,10) = sinkcal(:,:,jksed+1)*zrfact2
-#    endif
Index: branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zsink2.F
===================================================================
--- branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zsink2.F	(revision 773)
+++ 	(revision )
@@ -1,151 +1,0 @@
-
-CCC $Header$ 
-CCC  TOP 1.0 , LOCEAN-IPSL (2005) 
-C This software is governed by CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
-C ---------------------------------------------------------------------------
-      SUBROUTINE p4zsink2(wstmp,sinktemp,jn)
-CDIR$ LIST
-#if defined key_top && defined key_pisces
-!!!
-!!!       p4zsink2 : PISCES model
-!!!       ***********************
-!!!
-!!
-!!  PURPOSE :
-!!  ---------
-!!     Compute the sedimentation terms for the various sinking
-!!     particles. The scheme used to compute the trends is based
-!!     on MUSCL. 
-!!
-!!   METHOD :
-!!   -------
-!!      this ROUTINE compute not exactly the advection but the
-!!      transport term, i.e.  div(u*tra).
-!!
-!!
-!!   REFERENCES :                
-!!   ----------                  
-!!
-!!   References :
-!!      Estubier, A., and M. Levy, Notes Techn. Pole de Modelisation
-!!      IPSL, Sept. 2000 (http://www.lodyc.jussieu.fr/opa)
-!!
-!!
-!!   MODIFICATIONS:
-!!   --------------
-!!       original :  06-00 (A.Estublier)
-!!       modifications : 2004 (O. Aumont)
-!!       
-!!----------------------------------------------------------------------
-CC ----------------------------------------------------------------
-CC parameters and commons
-CC ======================
-CDIR$ NOLIST
-      USE oce_trc
-      USE trp_trc
-      USE sms
-      IMPLICIT NONE
-#include "domzgr_substitute.h90"
-CDIR$ LIST
-CC-----------------------------------------------------------------
-CC local declarations
-CC ==================
-C
-      INTEGER ji,jj,jk,jn
-      REAL ztraz(jpi,jpj,jpk),zakz(jpi,jpj,jpk)
-      REAL zkz(jpi,jpj,jpk)
-      REAL zigma,zew,zstep,zign
-      REAL wstmp(jpi,jpj,jpk),sinktemp(jpi,jpj,jpk)
-      REAL wstmp2(jpi,jpj,jpk)
-
-!!!---------------------------------------------------------------------
-!!!  OPA8, LODYC (01/00)
-!!!---------------------------------------------------------------------
-! 1. Initialization
-! --------------
-
-        zstep  = rfact2
-
-        ztraz  = 0
-        zkz    = 0
-        zakz   = 0.
-
-        do jk=1,jpk-1
-         wstmp2(:,:,jk+1)=-wstmp(:,:,jk)/rjjss*tmask(:,:,jk+1)
-#    if defined key_off_degrad
-     &      *facvol(:,:,jk)
-#    endif
-        end do
- 
-        wstmp2(:,:,1)=0.
-!
-! 3. Vertical advective flux
-!-------------------------------
-! ... first guess of the slopes
-!   ... interior values
-!
-        DO jk=2,jpkm1
-              ztraz(:,:,jk) = (trn(:,:,jk-1,jn) - trn(:,:,jk,jn))
-     $                          *tmask(:,:,jk)
-        ENDDO
-!
-! slopes
-!
-        DO jk=2,jpkm1
-          DO jj = 1,jpj
-            DO ji = 1, jpi
-            zign = 0.5*(sign(1.,ztraz(ji,jj,jk)*ztraz(ji,jj,jk+1))+1)
-            zakz(ji,jj,jk) = 0.5*(ztraz(ji,jj,jk)
-     $                          +ztraz(ji,jj,jk+1))*zign
-            ENDDO
-          ENDDO
-        ENDDO        
-!
-! Slopes limitation
-!
-        DO jk=2,jpkm1
-          DO jj = 1,jpj
-            DO ji = 1,jpi
-              zakz(ji,jj,jk) = sign(1.,zakz(ji,jj,jk)) * 
-     $                        min(abs(zakz(ji,jj,jk)),
-     $                        2.*abs(ztraz(ji,jj,jk+1)),
-     $                        2.*abs(ztraz(ji,jj,jk)))
-            ENDDO
-          ENDDO
-        ENDDO        
-
-! vertical advective flux
-        DO jk=1,jpkm1
-          DO jj = 1,jpj      
-            DO ji = 1, jpi    
-              zigma = wstmp2(ji,jj,jk+1)*zstep/fse3w(ji,jj,jk+1)
-              zew   = wstmp2(ji,jj,jk+1)
-              sinktemp(ji,jj,jk+1) = -zew*(trn(ji,jj,jk,jn)
-     $           -0.5*(1+zigma)*zakz(ji,jj,jk))*zstep
-            ENDDO
-          ENDDO
-        ENDDO 
-!
-! Boundary conditions
-!
-         sinktemp(:,:,1)=0.
-         sinktemp(:,:,jpk)=0.
-C
-       DO jk=1,jpkm1
-          DO jj = 1,jpj
-            DO ji = 1, jpi
-!
-            trn(ji,jj,jk,jn) = trn(ji,jj,jk,jn)
-     &        + (sinktemp(ji,jj,jk)-sinktemp(ji,jj,jk+1))
-     &        /fse3t(ji,jj,jk)
-!
-            ENDDO
-          ENDDO
-        ENDDO
-!
-        trb(:,:,:,jn)=trn(:,:,:,jn)
-!
-#endif
-C
-      RETURN
-      END
Index: branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zsink2.F90
===================================================================
--- branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zsink2.F90	(revision 775)
+++ branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zsink2.F90	(revision 775)
@@ -0,0 +1,145 @@
+MODULE p4zsink2
+   !!======================================================================
+   !!                         ***  MODULE p4zsink2  ***
+   !! TOP :   PISCES Compute vertical flux of particulate matter due to gravitational sinking
+   !!======================================================================
+   !! History :   1.0  !  2004     (O. Aumont) Original code
+   !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
+   !!----------------------------------------------------------------------
+#if defined key_pisces
+   !!----------------------------------------------------------------------
+   !!   'key_pisces'                                       PISCES bio-model
+   !!----------------------------------------------------------------------
+   !!   p4z_sink2       :  Compute vertical flux of particulate matter due to gravitational sinking
+   !!----------------------------------------------------------------------
+   USE oce_trc         !
+   USE trp_trc
+   USE sms
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   p4z_sink2    ! called in p4zbio.F90
+
+   !!* Substitution
+#  include "domzgr_substitute.h90"
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 2.0 , LOCEAN-IPSL (2007) 
+   !! $Header:$ 
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+   SUBROUTINE p4z_sink2( wstmp, sinktemp, jn )
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE p4z_sink2  ***
+      !!
+      !! ** Purpose :   Compute the sedimentation terms for the various sinking
+      !!     particles. The scheme used to compute the trends is based
+      !!     on MUSCL.
+      !!
+      !! ** Method  : - this ROUTINE compute not exactly the advection but the
+      !!      transport term, i.e.  div(u*tra).
+      !!---------------------------------------------------------------------
+      INTEGER , INTENT(in   )                         ::   jn         ! tracer index index      
+      REAL(wp), INTENT(in   ), DIMENSION(jpi,jpj,jpk) ::   wstmp      ! ???
+      REAL(wp), INTENT(inout), DIMENSION(jpi,jpj,jpk) ::   sinktemp   ! ???
+      !!
+      INTEGER  ::   ji, jj, jk
+      REAL(wp) ::   zigma,zew,zstep,zign
+      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   ztraz, zakz
+      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zkz  , wstmp2
+      !!---------------------------------------------------------------------
+
+      zstep  = rfact2
+
+      ztraz(:,:,:) = 0.e0
+      zkz  (:,:,:) = 0.e0
+      zakz (:,:,:) = 0.e0
+
+      DO jk = 1, jpkm1
+# if defined key_off_degrad
+         wstmp2(:,:,jk+1)=-wstmp(:,:,jk)/rjjss*tmask(:,:,jk+1)*facvol(:,:,jk)
+# else
+         wstmp2(:,:,jk+1)=-wstmp(:,:,jk)/rjjss*tmask(:,:,jk+1)
+
+# endif
+      END DO
+ 
+      wstmp2(:,:,1) = 0.e0
+!
+! Vertical advective flux
+!-------------------------------
+! ... first guess of the slopes
+!   ... interior values
+      DO jk = 2, jpkm1
+         ztraz(:,:,jk) = (trn(:,:,jk-1,jn) - trn(:,:,jk,jn)) *tmask(:,:,jk)
+      END DO
+!
+! slopes
+      DO jk=2,jpkm1
+         DO jj = 1,jpj
+            DO ji = 1, jpi
+               zign = 0.5*(sign(1.,ztraz(ji,jj,jk)*ztraz(ji,jj,jk+1))+1)
+               zakz(ji,jj,jk) = 0.5*(ztraz(ji,jj,jk) + ztraz(ji,jj,jk+1) ) * zign
+            END DO
+          END DO
+        END DO        
+!
+! Slopes limitation
+      DO jk = 2, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               zakz(ji,jj,jk) = sign(1.,zakz(ji,jj,jk)) *        &
+                  &             min(abs(zakz(ji,jj,jk)),         &
+                  &             2.*abs(ztraz(ji,jj,jk+1)),       &
+                  &             2.*abs(ztraz(ji,jj,jk)))
+            END DO
+         END DO
+      END DO        
+
+! vertical advective flux
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj      
+            DO ji = 1, jpi    
+               zigma = wstmp2(ji,jj,jk+1)*zstep/fse3w(ji,jj,jk+1)
+               zew   = wstmp2(ji,jj,jk+1)
+               sinktemp(ji,jj,jk+1) = -zew*(trn(ji,jj,jk,jn)                &
+                  &                 -0.5*(1+zigma)*zakz(ji,jj,jk))*zstep
+            END DO
+         END DO
+      END DO 
+!
+! Boundary conditions
+      sinktemp(:,:,1  ) = 0.e0
+      sinktemp(:,:,jpk) = 0.e0
+
+      DO jk=1,jpkm1
+         DO jj = 1,jpj
+            DO ji = 1, jpi
+               trn(ji,jj,jk,jn) = trn(ji,jj,jk,jn)               &
+                  &        + (sinktemp(ji,jj,jk)-sinktemp(ji,jj,jk+1))     &
+                  &        /fse3t(ji,jj,jk)
+            END DO
+         END DO
+      END DO
+
+      trb(:,:,:,jn) = trn(:,:,:,jn)
+      !
+   END SUBROUTINE p4z_sink2
+
+#else
+   !!======================================================================
+   !!  Dummy module :                                   No PISCES bio-model
+   !!======================================================================
+CONTAINS
+   SUBROUTINE p4z_sink2( wstmp, sinktemp, jn )         ! Empty routine
+      INTEGER, INTENT( in ) ::   jn
+      REAL   , INTENT( in ) ::   wstmp,sinktemp    
+      WRITE(*,*) 'p4z_sink2: You should not have seen this print! error?', jn, wstmp, sinktemp
+   END SUBROUTINE p4z_sink2
+#endif 
+
+   !!======================================================================
+END MODULE  p4zsink2
Index: branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zsink_kriest.F90
===================================================================
--- branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zsink_kriest.F90	(revision 775)
+++ branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zsink_kriest.F90	(revision 775)
@@ -0,0 +1,260 @@
+MODULE p4zsink_kriest
+   !!======================================================================
+   !!                   ***  MODULE p4zsink_kriest  ***
+   !! TOP :   PISCES Compute vertical flux of particulate matter due to gravitational sinking
+   !!         Kriest parameterization
+   !!======================================================================
+   !! History :   1.0  !  2004     (O. Aumont) Original code
+   !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
+   !!----------------------------------------------------------------------
+#if defined key_pisces  &&  defined key_kriest
+   !!----------------------------------------------------------------------
+   !!   'key_pisces'    and                                PISCES bio-model
+   !!   'key_kriest'                                          kriest option
+   !!----------------------------------------------------------------------
+   !!   p4z_sink_kriest :  Compute vertical flux of particulate matter due 
+   !!                      to gravitational sinking (Kriest parameterization)
+   !!----------------------------------------------------------------------
+   USE oce_trc         !
+   USE trp_trc
+   USE sms
+   USE p4zsink2
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   p4z_sink_kriest    ! called in p4zbio.F90
+
+   !!* Substitution
+#  include "domzgr_substitute.h90"
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 2.0 , LOCEAN-IPSL (2007) 
+   !! $Header:$ 
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+   SUBROUTINE p4z_sink_kriest
+      !!---------------------------------------------------------------------
+      !!                ***  ROUTINE p4z_sink_kriest  ***
+      !!
+      !! ** Purpose :   Compute vertical flux of particulate matter due to 
+      !!              gravitational sinking - Kriest parameterization
+      !!
+      !! ** Method  : - ???
+      !!---------------------------------------------------------------------
+      INTEGER  ::   ji, jj, jk
+      INTEGER  ::   iksed
+      REAL(wp) ::   zagg1, zagg2, zagg3, zagg4, zagg5, zaggsi, zaggsh
+      REAL(wp) ::   znum , zeps, zfm, zgm, zsm
+      REAL(wp) ::   zdiv , zdiv1, zdiv2, zdiv3, zdiv4, zdiv5
+      REAL(wp) ::   zval1, zval2, zval3, zval4
+      REAL(wp) ::   zstep
+#if defined key_trc_dia3d
+      REAL(wp) ::   zrfact2
+#endif
+      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   znum3d
+      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   sinking, sinking2
+      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   sinkfer
+      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   sinkcal, sinksil
+      !!---------------------------------------------------------------------
+
+       zstep=rfact2/rjjss      ! Time step duration for biology
+
+
+!     Initialisation of variables used to compute Sinking Speed
+!     ---------------------------------------------------------
+
+       znum3d(:,:,:) = 0.e0
+       iksed = 10
+       zval1 = 1. + xkr_zeta
+       zval2 = 1. + xkr_zeta + xkr_eta
+       zval3 = 1. + xkr_eta
+
+!     Computation of the vertical sinking speed : Kriest et Evans, 2000
+!     -----------------------------------------------------------------
+    
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               IF( tmask(ji,jj,jk) /= 0.e0 ) THEN
+                  znum = trn(ji,jj,jk,jppoc) / ( trn(ji,jj,jk,jpnum) + rtrn ) / xkr_massp
+! -------------- To avoid sinking speed over 50 m/day -------
+                  znum  = MIN( xnumm(jk), znum )
+                  znum  = MAX( 1.1      , znum )
+                  znum3d(ji,jj,jk) = znum
+!------------------------------------------------------------
+                  zeps  = ( zval1 * znum - 1. )/ ( znum - 1. )
+                  zfm   = xkr_frac**( 1. - zeps )
+                  zgm   = xkr_frac**( zval1 - zeps )
+                  zdiv  = MAX( 1.e-4, ABS( zeps - zval2 ) ) * SIGN( 1., ( zeps - zval2 ) )
+                  zdiv1 = zeps - zval3
+!!gmoptimisation possible below
+                  wsbio3(ji,jj,jk) = xkr_wsbio_min * ( zeps - zval1 ) / zdiv    &
+     &                             - xkr_wsbio_max *   zgm * xkr_eta  / zdiv
+                  wsbio4(ji,jj,jk) = xkr_wsbio_min *   ( zeps-1. )    / zdiv1   &
+     &                             - xkr_wsbio_max *   zfm * xkr_eta  / zdiv1
+                  IF( znum == 1.1)   wsbio3(ji,jj,jk) = wsbio4(ji,jj,jk)
+               ENDIF
+            END DO
+         END DO
+      END DO
+
+      wscal(:,:,:) = MAX( wsbio3(:,:,:), 50. )
+
+
+!   INITIALIZE TO ZERO ALL THE SINKING ARRAYS
+!   -----------------------------------------
+
+      sinking (:,:,:) = 0.e0
+      sinking2(:,:,:) = 0.e0
+      sinkcal (:,:,:) = 0.e0
+      sinkfer (:,:,:) = 0.e0
+      sinksil (:,:,:) = 0.e0
+
+!   Compute the sedimentation term using p4zsink2 for all
+!   the sinking particles
+!   -----------------------------------------------------
+
+      CALL p4z_sink2( wsbio3, sinking , jppoc )
+      CALL p4z_sink2( wsbio4, sinking2, jpnum )
+      CALL p4z_sink2( wsbio3, sinkfer , jpsfe )
+      CALL p4z_sink2( wscal , sinksil , jpdsi )
+      CALL p4z_sink2( wscal , sinkcal , jpcal )
+
+!  Exchange between organic matter compartments due to
+!  coagulation/disaggregation
+!  ---------------------------------------------------
+
+      zval1 = 1. + xkr_zeta
+      zval2 = 1. + xkr_eta
+      zval3 = 3. + xkr_eta
+      zval4 = 4. + xkr_eta
+
+      DO jk = 1,jpkm1
+         DO jj = 1,jpj
+            DO ji = 1,jpi
+               IF( tmask(ji,jj,jk) /= 0.e0 ) THEN
+
+                  znum = trn(ji,jj,jk,jppoc)/(trn(ji,jj,jk,jpnum)+rtrn) / xkr_massp
+! -------------- To avoid sinking speed over 50 m/day -------
+                  znum  = min(xnumm(jk),znum)
+                  znum  = MAX( 1.1,znum)
+!------------------------------------------------------------
+                  zeps  = ( zval1 * znum - 1.) / ( znum - 1.)
+                  zdiv  = MAX( 1.e-4, ABS( zeps - zval3) ) * SIGN( 1., zeps - zval3 )
+                  zdiv1 = MAX( 1.e-4, ABS( zeps - 4.   ) ) * SIGN( 1., zeps - 4.    )
+                  zdiv2 = zeps - 2.
+                  zdiv3 = zeps - 3.
+                  zdiv4 = zeps - zval2
+                  zdiv5 = 2.* zeps - zval4
+                  zfm   = xkr_frac**( 1.- zeps )
+                  zsm   = xkr_frac**xkr_eta
+
+!    Part I : Coagulation dependant on turbulence
+!    ----------------------------------------------
+
+                  zagg1 = ( 0.163 * trn(ji,jj,jk,jpnum)**2               &
+                     &            * 2.*( (zfm-1.)*(zfm*xkr_mass_max**3-xkr_mass_min**3)    &
+                     &            * (zeps-1)/zdiv1 + 3.*(zfm*xkr_mass_max-xkr_mass_min)    &
+                     &            * (zfm*xkr_mass_max**2-xkr_mass_min**2)                  &
+                     &            * (zeps-1.)**2/(zdiv2*zdiv3))            &
+# if defined key_off_degrad
+                     &                 *facvol(ji,jj,jk)       &
+# endif
+                     &    )
+
+                  zagg2 = (  2*0.163*trn(ji,jj,jk,jpnum)**2*zfm*                       &
+                     &                   ((xkr_mass_max**3+3.*(xkr_mass_max**2          &
+                     &                    *xkr_mass_min*(zeps-1.)/zdiv2                 &
+                     &                    +xkr_mass_max*xkr_mass_min**2*(zeps-1.)/zdiv3)    &
+                     &                    +xkr_mass_min**3*(zeps-1)/zdiv1)                  &
+                     &                    -zfm*xkr_mass_max**3*(1.+3.*((zeps-1.)/           &
+                     &                    (zeps-2.)+(zeps-1.)/zdiv3)+(zeps-1.)/zdiv1))      &
+#    if defined key_off_degrad
+                     &                 *facvol(ji,jj,jk)             &
+#    endif
+                     &    )
+
+                  zagg3 = (  0.163*trn(ji,jj,jk,jpnum)**2*zfm**2*8. * xkr_mass_max**3   &
+#    if defined key_off_degrad
+                     &                 *facvol(ji,jj,jk)             &
+#    endif
+                     &    )
+
+                  zaggsh = ( zagg1 + zagg2 + zagg3 ) * rfact2 * zdiss(ji,jj,jk) / 1000.
+
+!    Aggregation of small into large particles
+!    Part II : Differential settling
+!    ----------------------------------------------
+
+                  zagg4 = (  2.*3.141*0.125*trn(ji,jj,jk,jpnum)**2*                       &
+                     &                 xkr_wsbio_min*(zeps-1.)**2                         &
+                     &                 *(xkr_mass_min**2*((1.-zsm*zfm)/(zdiv3*zdiv4)      &
+                     &                 -(1.-zfm)/(zdiv*(zeps-1.)))-                       &
+                     &                 ((zfm*zfm*xkr_mass_max**2*zsm-xkr_mass_min**2)     &
+                     &                 *xkr_eta)/(zdiv*zdiv3*zdiv5) )                     &
+# if defined key_off_degrad
+                     &                 *facvol(ji,jj,jk)        &
+# endif
+                     &    )
+
+                  zagg5 = (  2.*3.141*0.125*trn(ji,jj,jk,jpnum)**2                         &
+                     &                 *(zeps-1.)*zfm*xkr_wsbio_min                        &
+                     &                 *(zsm*(xkr_mass_min**2-zfm*xkr_mass_max**2)         &
+                     &                 /zdiv3-(xkr_mass_min**2-zfm*zsm*xkr_mass_max**2)    &
+                     &                 /zdiv)                   &
+# if defined key_off_degrad
+                     &                 *facvol(ji,jj,jk)        &
+# endif
+                     &    )
+
+                  zaggsi = ( zagg4 + zagg5 ) * zstep / 10.
+
+                  xagg(ji,jj,jk) = 0.5 * xkr_stick * ( zaggsh + zaggsi )
+
+!     Aggregation of DOC to small particles
+!     --------------------------------------
+
+                  xaggdoc(ji,jj,jk) = (     0.4 * trn(ji,jj,jk,jpdoc)               &
+                     &                 + 1018.  * trn(ji,jj,jk,jppoc)  ) * zstep    &
+# if defined key_off_degrad
+                     &              * facvol(ji,jj,jk)                              &
+# endif
+                     &              * zdiss(ji,jj,jk) * trn(ji,jj,jk,jpdoc)
+
+               ENDIF
+            END DO
+         END DO
+      END DO
+
+#    if defined key_trc_dia3d
+      zrfact2 = 1.e3 * rfact2r
+      trc2d(:,:, 5)   = sinking (:,:,iksed+1) * zrfact2
+      trc2d(:,:, 6)   = sinking2(:,:,iksed+1) * zrfact2
+      trc2d(:,:, 7)   = sinkfer (:,:,iksed+1) * zrfact2
+      trc2d(:,:, 9)   = sinksil (:,:,iksed+1) * zrfact2
+      trc2d(:,:,10)   = sinkcal (:,:,iksed+1) * zrfact2
+      trc3d(:,:,:,12) = sinking (:,:,:)       * zrfact2
+      trc3d(:,:,:,13) = sinking2(:,:,:)       * zrfact2
+      trc3d(:,:,:,14) = sinksil (:,:,:)       * zrfact2
+      trc3d(:,:,:,15) = sinkcal (:,:,:)       * zrfact2
+      trc3d(:,:,:,16) = znum3d  (:,:,:)
+      trc3d(:,:,:,17) = wsbio3  (:,:,:)
+      trc3d(:,:,:,18) = wsbio4  (:,:,:)
+#    endif
+      !
+   END SUBROUTINE p4z_sink_kriest
+
+#else
+   !!======================================================================
+   !!  Dummy module :                                   No PISCES bio-model
+   !!======================================================================
+CONTAINS
+   SUBROUTINE p4z_sink_kriest                    ! Empty routine
+   END SUBROUTINE p4z_sink_kriest
+#endif 
+
+   !!======================================================================
+END MODULE  p4zsink_kriest
Index: branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zslow.F
===================================================================
--- branches/dev_001_GM/NEMO/TOP_SRC/PISCES_SMS/p4zslow.F	(revision 773)
+++ 	(revision )
@@ -1,63 +1,0 @@
-
-CCC $Header$ 
-CCC  TOP 1.0 , LOCEAN-IPSL (2005) 
-C This software is governed by CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
-C ---------------------------------------------------------------------------
-CDIR$ LIST
-      SUBROUTINE p4zslow(kt)
-#if defined key_top && defined key_pisces
-CCC---------------------------------------------------------------------
-CCC
-CCC          ROUTINE p4zslow : PISCES MODEL
-CCC          *****************************
-CCC
-CCC     PURPOSE.
-CCC     --------
-CCC          *P4ZSLOW* CALL VARIOUS ROUTINES ON A DAILY BASIS
-CCC
-CCC
-CC     EXTERNALS.
-CC     ----------
-CC          p4zche, p4zint
-CC
-CC   MODIFICATIONS:
-CC   --------------
-CC      NEW : 2004 O. Aumont
-CC----------------------------------------------------------------------
-CC parameters and commons
-CC ======================
-CDIR$ nolist
-      USE oce_trc
-      USE trp_trc
-      USE sms
-      IMPLICIT NONE
-CDIR$ list
-CC----------------------------------------------------------------------
-CC local declarations
-CC ==================
-C
-      INTEGER iyy, imm, idd, kt
-C
-      iyy = ndastp/10000
-      imm = (ndastp - iyy*10000)/100
-      idd = (ndastp - iyy*10000 - imm*100)
-
-       IF (ndayflxtr /= idd) THEN
-           ndayflxtr = idd
-C
-C* 1. COMPUTATION OF THE CHEMICAL CONSTANTS
-C  ----------------------------------------
-C
-       CALL p4zche
-C
-C  2. COMPUTATION OF VARIOUS RATES FOR BIOGEOCHEMISTRY
-C  ---------------------------------------------------
-C
-       CALL p4zint(kt)
-C
-      ENDIF
-C      
-#endif
-C
-      RETURN
-      END
