Index: trunk/NEMO/TOP_SRC/LOBSTER/par_lobster.F90
===================================================================
--- trunk/NEMO/TOP_SRC/LOBSTER/par_lobster.F90	(revision 934)
+++ trunk/NEMO/TOP_SRC/LOBSTER/par_lobster.F90	(revision 934)
@@ -0,0 +1,54 @@
+MODULE par_lobster
+   !!======================================================================
+   !!                        ***  par_lobster  ***
+   !! TOP :   set the LOBSTER parameters
+   !!======================================================================
+   !! History :   2.0  !  2007-12  (C. Ethe, G. Madec)  revised architecture
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 2.0 , LOCEAN-IPSL (2007) 
+   !! $Id:$ 
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+   IMPLICIT NONE
+   PUBLIC
+
+#if defined key_lobster
+   !!---------------------------------------------------------------------
+   !!   'key_lobster'   :                                LOBSTER bio-model
+   !!---------------------------------------------------------------------
+   LOGICAL, PUBLIC, PARAMETER ::   lk_lobster     = .TRUE.    !: LOBSTER flag 
+   INTEGER, PUBLIC, PARAMETER ::   jp_lobster     =  6        !: number of LOBSTER tracers
+   INTEGER, PUBLIC, PARAMETER ::   jp_lobster_2d  = 19        !: additional 2d output arrays ('key_trc_diaadd')
+   INTEGER, PUBLIC, PARAMETER ::   jp_lobster_3d  =  3        !: additional 3d output arrays ('key_trc_diaadd')
+   INTEGER, PUBLIC, PARAMETER ::   jp_lobster_trd = 15        !: number of sms trends for LOBSTER
+
+   ! assign an index in trc arrays for each LOBSTER prognostic variables
+   INTEGER, PUBLIC, PARAMETER ::   jpdet          =  1        !: detritus                    [mmoleN/m3]
+   INTEGER, PUBLIC, PARAMETER ::   jpzoo          =  2        !: zooplancton concentration   [mmoleN/m3]
+   INTEGER, PUBLIC, PARAMETER ::   jpphy          =  3        !: phytoplancton concentration [mmoleN/m3]
+   INTEGER, PUBLIC, PARAMETER ::   jpno3          =  4        !: nitrate concentration       [mmoleN/m3]
+   INTEGER, PUBLIC, PARAMETER ::   jpnh4          =  5        !: ammonium concentration      [mmoleN/m3]
+   INTEGER, PUBLIC, PARAMETER ::   jpdom          =  6        !: dissolved organic matter    [mmoleN/m3]
+
+   ! productive layer depth
+   INTEGER, PUBLIC, PARAMETER ::   jpkb           = 12        !: first vertical layers where biology is active
+   INTEGER, PUBLIC, PARAMETER ::   jpkbm1         = jpkb - 1  !: first vertical layers where biology is active
+
+#else
+   !!---------------------------------------------------------------------
+   !!   Default                                           No LOBSTER model
+   !!---------------------------------------------------------------------
+   LOGICAL, PUBLIC, PARAMETER ::   lk_lobster     = .FALSE.   !: LOBSTER flag 
+   INTEGER, PUBLIC, PARAMETER ::   jp_lobster     =  0        !: No LOBSTER tracers
+   INTEGER, PUBLIC, PARAMETER ::   jp_lobster_2d  =  0        !: No LOBSTER additional 2d output arrays 
+   INTEGER, PUBLIC, PARAMETER ::   jp_lobster_3d  =  0        !: No LOBSTER additional 3d output arrays 
+   INTEGER, PUBLIC, PARAMETER ::   jp_lobster_trd =  0        !: number of sms trends for LOBSTER
+#endif
+
+   ! Starting/ending LOBSTER do-loop indices (N.B. no LOBSTER : jpl_lob < jpf_lob the do-loop are never done)
+   INTEGER, PUBLIC, PARAMETER ::   jp_lob0 =          1       !: First index of LOBSTER tracers
+   INTEGER, PUBLIC, PARAMETER ::   jp_lob1 = jp_lobster       !: Last  index of LOBSTER tracers
+
+   !!======================================================================
+END MODULE par_lobster
Index: trunk/NEMO/TOP_SRC/LOBSTER/sms_lobster.h90
===================================================================
--- trunk/NEMO/TOP_SRC/LOBSTER/sms_lobster.h90	(revision 934)
+++ trunk/NEMO/TOP_SRC/LOBSTER/sms_lobster.h90	(revision 934)
@@ -0,0 +1,117 @@
+   !!----------------------------------------------------------------------
+   !!                     ***  sms_lobster1.h90  ***  
+   !! TOP :   LOBSTER 1 Source Minus Sink valiables
+   !!----------------------------------------------------------------------
+   !! History :    -   !  1999-09 (M. Levy)  original code
+   !!              -   !  2000-12 (O. Aumont, E. Kestenare) add sediment 
+   !!             1.0  !  2005-10 (C. Ethe) F90
+   !!             1.0  !  2005-03  (A-S Kremeur) add fphylab, fzoolab, fdetlab, fdbod
+   !!              -   !  2005-06  (A-S Kremeur) add sedpocb, sedpocn, sedpoca
+   !!             2.0  !  2007-04  (C. Deltel, G. Madec) Free form and modules
+   !!----------------------------------------------------------------------
+
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 1.0 , LOCEAN-IPSL (2005) 
+   !! $Header$ 
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+   !!  biological parameters
+   !! ----------------------
+   REAL(wp) ::   apmin    !: minimum phytoplancton concentration              (NAMELIST)
+   REAL(wp) ::   azmin    !: minimum zooplancton concentration                (NAMELIST)
+   REAL(wp) ::   anmin    !: minimum nutrients concentration                  (NAMELIST)
+   REAL(wp) ::   admin    !: minimum detritus concentration                   (NAMELIST)
+   REAL(wp) ::   redf     !: redfield ratio c:n                               (NAMELIST)
+   REAL(wp) ::   reddom   !: redfield ratio c:n for DOM                       
+   REAL(wp) ::   slopet   !: van t hoff coefficient                           (NAMELIST)
+   REAL(wp) ::   toptp    !: optimal photosynthesis temperature               (NAMELIST) 
+   REAL(wp) ::   aknut    !: half-saturation nutrient                         (NAMELIST)
+   REAL(wp) ::   psinut   !: inhibition of nitrate uptake by ammonium         (NAMELIST)
+   REAL(wp) ::   akno3    !: half-saturation for nitrate                      (NAMELIST)
+   REAL(wp) ::   aknh4    !: half-saturation for ammonium                     (NAMELIST)
+   REAL(wp) ::   rcchl    !: ???                                              
+   REAL(wp) ::   rgamma   !: phytoplankton exudation fraction                 (NAMELIST)
+   REAL(wp) ::   toptgz   !: optimal temperature for zooplankton growth       (NAMELIST)
+   REAL(wp) ::   tmaxgz   !: maximal temperature for zooplankton growth       (NAMELIST) 
+   REAL(wp) ::   rgz      !: widtht of zooplankton temperature FUNCTION       (NAMELIST)
+   REAL(wp) ::   rppz     !: zooplankton nominal preference for phytoplancton food (NAMELIST)
+   REAL(wp) ::   taus     !: maximum specific zooplankton grazing rate        (NAMELIST)
+   REAL(wp) ::   aks      !: half saturation constant for total zooplankton grazing (NAMELIST)
+   REAL(wp) ::   filmax   !: maximum mass clearance rate for zooplankton      (NAMELIST)
+   REAL(wp) ::   rpnaz    !: non-assimilated phytoplankton by zooplancton     (NAMELIST)
+   REAL(wp) ::   rdnaz    !: non-assimilated detritus by zooplankton          (NAMELIST) 
+   REAL(wp) ::   eggzoo   !: minimum for zooplankton concentration            (NAMELIST)
+   REAL(wp) ::   tauzn    !: zooplancton specific excretion rate              (NAMELIST)
+   REAL(wp) ::   tmmaxp   !: maximal phytoplancton mortality rate             (NAMELIST)
+   REAL(wp) ::   tmminp   !: minimal phytoplancton mortality rate             (NAMELIST)
+   REAL(wp) ::   tmmaxz   !: maximal zooplankton mortality rate               (NAMELIST)
+   REAL(wp) ::   tmminz   !: minimal zooplankton mortality rate               (NAMELIST)
+   REAL(wp) ::   anumin   !: nutrient threshold for phytoplankton mortality   (NAMELIST)
+   REAL(wp) ::   afdmin   !: food threshold for zooplankton mortality         (NAMELIST)
+   REAL(wp) ::   taudn    !: detrital breakdown rate                          (NAMELIST)
+   REAL(wp) ::   vsed     !: sedimentation speed                              (NAMELIST)
+   REAL(wp) ::   tmumax   !: maximal phytoplankton growth rate                (NAMELIST)
+   REAL(wp) ::   aki      !: light photosynthesis half saturation constant    (NAMELIST)
+   REAL(wp) ::   tmaxr    !: maximum coefficient for passive tracer damping   (NAMELIST)
+   REAL(wp) ::   tminr    !: minimum coefficient for passive tracer damping   (NAMELIST)
+   REAL(wp) ::   fdoml    !: fraction of exsudation that goes to nh4 (should be labile dom)
+   REAL(wp) ::   taunn    !: nitrification rate
+   REAL(wp) ::   taudomn  !: slow remineralization rate of semi-labile dom to nh4
+   REAL(wp) ::   xhr      !: coeff for Martin's remineralistion profile
+   REAL(wp) ::   fphylab  !: NH4 fraction of phytoplankton excretion
+   REAL(wp) ::   fzoolab  !: NH4 fraction of zooplankton excretion
+   REAL(wp) ::   fdetlab  !: NH4 fraction of detritus dissolution
+   REAL(wp) ::   fdbod    !: zooplankton mortality fraction that goes to detritus
+
+   REAL(wp), DIMENSION(jpk,jp_lobster) ::   remdmp   !: depth dependant damping coefficient of passive tracers 
+   
+
+# if defined key_trc_diabio
+
+   !! Biological trends 
+   !! -----------------
+   CHARACTER(len=8),  DIMENSION(jpdiabio) ::   ctrbio   !: biological trends name      (NAMELIST)
+   CHARACTER(len=20), DIMENSION(jpdiabio) ::   ctrbiu   !: biological trends unit      (NAMELIST)
+   CHARACTER(len=80), DIMENSION(jpdiabio) ::   ctrbil   !: biological trends long name (NAMELIST)
+   REAL(wp), DIMENSION(jpi,jpj,jpk,jpdiabio) :: trbio   !: biological trends
+
+   !! Netcdf output parameters
+   !! ------------------------
+   INTEGER ::   nwritebio   !: time step frequency for biological outputs (NAMELIST)
+   INTEGER ::   nitb        !:         id.         for additional array output file
+   INTEGER ::   ndepitb     !:         id.         for depth mesh
+   INTEGER ::   nhoritb     !:         id.         for horizontal mesh
+
+# endif 
+
+   !! Optical parameters                                
+   !! ------------------                                
+   REAL(wp) ::   xkr0       !: water coefficient absorption in red      (NAMELIST)
+   REAL(wp) ::   xkg0       !: water coefficient absorption in green    (NAMELIST)
+   REAL(wp) ::   xkrp       !: pigment coefficient absorption in red    (NAMELIST)
+   REAL(wp) ::   xkgp       !: pigment coefficient absorption in green  (NAMELIST)
+   REAL(wp) ::   xlr        !: exposant for pigment absorption in red   (NAMELIST)
+   REAL(wp) ::   xlg        !: exposant for pigment absorption in green (NAMELIST)
+   REAL(wp) ::   rpig       !: chla/chla+phea ratio                     (NAMELIST)
+                                                        
+   INTEGER , DIMENSION(jpi,jpj)     ::   neln    !: number of levels in the euphotic layer
+   REAL(wp), DIMENSION(jpi,jpj)     ::   xze     !: euphotic layer depth
+   REAL(wp), DIMENSION(jpi,jpj,jpk) ::   xpar    !: par (photosynthetic available radiation)
+
+   !! Sediment parameters                               
+   !! -------------------                               
+   REAL(wp) ::   sedlam       !: time coefficient of POC remineralization in sediments
+   REAL(wp) ::   sedlostpoc   !: ???
+   REAL(wp) ::   areacot      !: ???
+                                                        
+   REAL(wp), DIMENSION(jpi,jpj)     ::   dminl   !: fraction of sinking POC released in sediments
+   REAL(wp), DIMENSION(jpi,jpj,jpk) ::   dmin3   !: fraction of sinking POC released at each level
+                                                        
+   REAL(wp), DIMENSION(jpi,jpj) ::   sedpocb     !: mass of POC in sediments
+   REAL(wp), DIMENSION(jpi,jpj) ::   sedpocn     !: mass of POC in sediments
+   REAL(wp), DIMENSION(jpi,jpj) ::   sedpoca     !: mass of POC in sediments
+                                                        
+   REAL(wp), DIMENSION(jpi,jpj) ::   fbod        !: rapid sinking particles
+   REAL(wp), DIMENSION(jpi,jpj) ::   cmask       !: ???
+
Index: trunk/NEMO/TOP_SRC/LOBSTER/trcbio.F90
===================================================================
--- trunk/NEMO/TOP_SRC/LOBSTER/trcbio.F90	(revision 934)
+++ trunk/NEMO/TOP_SRC/LOBSTER/trcbio.F90	(revision 934)
@@ -0,0 +1,401 @@
+MODULE trcbio
+   !!======================================================================
+   !!                         ***  MODULE trcbio  ***
+   !! TOP :   LOBSTER
+   !!======================================================================
+   !! History :    -   !  1999-07  (M. Levy) Original code
+   !!              -   !  2000-12  (E. Kestenare) assign a parameter to name individual tracers
+   !!              -   !  2001-03  (M. Levy)  LNO3 + dia2d 
+   !!             2.0  !  2007-12  (C. Deltel, G. Madec)  F90
+   !!----------------------------------------------------------------------
+#if defined key_lobster
+   !!----------------------------------------------------------------------
+   !!   'key_lobster'                                     LOBSTER bio-model
+   !!----------------------------------------------------------------------
+   !!   trc_bio        :  
+   !!----------------------------------------------------------------------
+   USE oce_trc         !
+   USE trp_trc         ! 
+   USE sms             ! 
+   USE lbclnk          ! 
+   USE prtctl_trc      ! Print control for debbuging
+   
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   trc_bio    ! called in ???
+
+   !!* Substitution
+#  include "domzgr_substitute.h90"
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 2.0 , LOCEAN-IPSL (2007) 
+   !! $Id: trcbio.F90 777 2007-12-19 18:40:57Z gm $ 
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+   SUBROUTINE trc_bio( kt )
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE trc_bio  ***
+      !!
+      !! ** Purpose :   compute the now trend due to biogeochemical processes
+      !!              and add it to the general trend of passive tracers equations
+      !!
+      !! ** Method  :   each now biological flux is calculated in function of now
+      !!              concentrations of tracers.
+      !!              depending on the tracer, these fluxes are sources or sinks.
+      !!              the total of the sources and sinks for each tracer
+      !!              is added to the general trend.
+      !!        
+      !!                      tra = tra + zf...tra - zftra...
+      !!                                     |         |
+      !!                                     |         |
+      !!                                  source      sink
+      !!        
+      !!              IF 'key_trc_diabio' defined , the biogeochemical trends
+      !!              for passive tracers are saved for futher diagnostics.
+      !!---------------------------------------------------------------------
+      INTEGER, INTENT( in ) ::   kt      ! ocean time-step index      
+      !!
+      INTEGER  ::   ji, jj, jk
+      REAL(wp) ::   zdet, zzoo, zphy, zno3, znh4, zdom      ! now concentrations
+      REAL(wp) ::   zlno3, zlnh4, zle, zlt                  ! limitation terms for phyto
+      REAL(wp) ::   zno3phy, znh4phy, zphynh4, zphydom
+      REAL(wp) ::   zphydet, zphyzoo, zdetzoo
+      REAL(wp) ::   zzoonh4, zzoodom, zzoodet, zdetnh4, zdetdom
+      REAL(wp) ::   znh4no3, zdomnh4, zppz, zpdz, zpppz, zppdz, zfood
+      REAL(wp) ::   zfilpz, zfildz, zphya, zzooa, zno3a
+      REAL(wp) ::   znh4a, zdeta, zdoma, zzoobod, zboddet, zdomaju
+#if defined key_trc_diaadd
+      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   ze3t
+#endif
+      CHARACTER (len=25) :: charout
+      !!---------------------------------------------------------------------
+
+      IF( kt == nit000 ) THEN
+         IF(lwp) WRITE(numout,*)
+         IF(lwp) WRITE(numout,*) ' trc_bio: LOBSTER bio-model'
+         IF(lwp) WRITE(numout,*) ' ~~~~~~~'
+      ENDIF
+
+#if defined key_trc_diaadd
+      ! convert fluxes in per day
+      ze3t(:,:,:) = 0.e0
+      DO jk = 1, jpkbm1
+         ze3t(:,:,jk) = fse3t(:,:,jk) * 86400.
+      END DO 
+#endif
+
+      fbod(:,:) = 0.e0
+#if defined key_trc_diaadd
+      DO ji = 1, jpdia2d
+         trc2d(:,:,ji) = 0.e0
+      END DO 
+#endif
+
+
+      !                                      ! -------------------------- !
+      DO jk = 1, jpkbm1                      !  Upper ocean (bio-layers)  !
+         !                                   ! -------------------------- !
+         DO jj = 2, jpjm1
+            DO ji = 2, jpim1           !!gm  use of fs_2 fs_jpm1  required here
+
+               ! trophic variables( det, zoo, phy, no3, nh4, dom)
+               ! ------------------------------------------------
+
+               ! negative trophic variables DO not contribute to the fluxes
+               zdet = MAX( 0.e0, trn(ji,jj,jk,jpdet) )
+               zzoo = MAX( 0.e0, trn(ji,jj,jk,jpzoo) )
+               zphy = MAX( 0.e0, trn(ji,jj,jk,jpphy) )
+               zno3 = MAX( 0.e0, trn(ji,jj,jk,jpno3) )
+               znh4 = MAX( 0.e0, trn(ji,jj,jk,jpnh4) )
+               zdom = MAX( 0.e0, trn(ji,jj,jk,jpdom) )
+
+               ! Limitations
+               zlt   = 1.
+               zle   = 1. - EXP( -xpar(ji,jj,jk) / aki / zlt )
+               ! psinut,akno3,aknh4 added by asklod AS Kremeur 2005-03
+               zlno3 = zno3 * EXP( -psinut * znh4 ) / ( akno3 + zno3 )
+               zlnh4 = znh4 / (znh4+aknh4) 
+
+
+               ! sinks and sources
+               !    phytoplankton production and exsudation
+               zno3phy = tmumax * zle * zlt * zlno3 * zphy
+               znh4phy = tmumax * zle * zlt * zlnh4 * zphy
+
+               !    fphylab added by asklod AS Kremeur 2005-03
+               zphydom = rgamma * (1 - fphylab) * (zno3phy + znh4phy)
+               zphynh4 = rgamma * fphylab * (zno3phy + znh4phy)
+
+               ! zooplankton production
+               !    preferences
+               zppz = rppz
+               zpdz = 1. - rppz
+               zpppz = ( zppz * zphy ) / ( ( zppz * zphy + zpdz * zdet ) + 1.e-13 )
+               zppdz = ( zpdz * zdet ) / ( ( zppz * zphy + zpdz * zdet ) + 1.e-13 )
+               zfood = zpppz * zphy + zppdz * zdet
+               !    filtration
+               zfilpz = taus * zpppz / (aks + zfood)
+               zfildz = taus * zppdz / (aks + zfood)
+               !    grazing
+               zphyzoo = zfilpz * zphy * zzoo
+               zdetzoo = zfildz * zdet * zzoo
+
+               ! fecal pellets production
+               zzoodet = rpnaz * zphyzoo + rdnaz * zdetzoo
+ 
+               ! zooplankton liquide excretion
+               zzoonh4 = tauzn * fzoolab * zzoo 
+               zzoodom = tauzn * (1 - fzoolab) * zzoo
+
+               ! mortality
+               !    phytoplankton mortality 
+               zphydet = tmminp * zphy
+
+               !    zooplankton mortality
+               !    closure : flux fbod is redistributed below level jpkbio
+               zzoobod = tmminz * zzoo * zzoo
+               fbod(ji,jj) = fbod(ji,jj) + (1-fdbod) * zzoobod * fse3t(ji,jj,jk)
+               zboddet = fdbod * zzoobod
+
+               ! detritus and dom breakdown
+               zdetnh4 = taudn * fdetlab * zdet
+               zdetdom = taudn * (1 - fdetlab) * zdet 
+
+               zdomnh4 = taudomn * zdom
+
+               ! flux added to express how the excess of nitrogen from
+               ! PHY, ZOO and DET to DOM goes directly to NH4 (flux of ajustment)
+               zdomaju = (1 - redf/reddom) * (zphydom + zzoodom + zdetdom)
+
+               ! Nitrification
+               znh4no3 = taunn * znh4
+
+               ! determination of trends
+               !    total trend for each biological tracer
+               zphya =   zno3phy + znh4phy - zphynh4 - zphydom - zphyzoo - zphydet
+               zzooa =   zphyzoo + zdetzoo - zzoodet - zzoodom - zzoonh4 - zzoobod
+               zno3a = - zno3phy + znh4no3
+               znh4a = - znh4phy - znh4no3 + zphynh4 + zzoonh4 + zdomnh4 + zdetnh4 + zdomaju
+               zdeta =   zphydet + zzoodet - zdetzoo - zdetnh4 - zdetdom + zboddet
+               zdoma =   zphydom + zzoodom + zdetdom - zdomnh4 - zdomaju
+   
+#if defined key_trc_diabio
+               trbio(ji,jj,jk, 1) = zno3phy
+               trbio(ji,jj,jk, 2) = znh4phy
+               trbio(ji,jj,jk, 3) = zphynh4
+               trbio(ji,jj,jk, 4) = zphydom
+               trbio(ji,jj,jk, 5) = zphyzoo
+               trbio(ji,jj,jk, 6) = zphydet
+               trbio(ji,jj,jk, 7) = zdetzoo
+               trbio(ji,jj,jk, 9) = zzoodet
+               trbio(ji,jj,jk,10) = zzoobod
+               trbio(ji,jj,jk,11) = zzoonh4
+               trbio(ji,jj,jk,12) = zzoodom
+               trbio(ji,jj,jk,13) = znh4no3
+               trbio(ji,jj,jk,14) = zdomnh4
+               trbio(ji,jj,jk,15) = zdetnh4
+#endif
+#if defined key_trc_diaadd
+               trc2d(ji,jj, 1) = trc2d(ji,jj, 1) + zno3phy * ze3t(ji,jj,jk) 
+               trc2d(ji,jj, 2) = trc2d(ji,jj, 2) + znh4phy * ze3t(ji,jj,jk)
+               trc2d(ji,jj, 3) = trc2d(ji,jj, 3) + zphydom * ze3t(ji,jj,jk)
+               trc2d(ji,jj, 4) = trc2d(ji,jj, 4) + zphynh4 * ze3t(ji,jj,jk)
+               trc2d(ji,jj, 5) = trc2d(ji,jj, 5) + zphyzoo * ze3t(ji,jj,jk)
+               trc2d(ji,jj, 6) = trc2d(ji,jj, 6) + zphydet * ze3t(ji,jj,jk)
+               trc2d(ji,jj, 7) = trc2d(ji,jj, 7) + zdetzoo * ze3t(ji,jj,jk)
+! trend number 8 is in trcsed.F            
+               trc2d(ji,jj, 9) = trc2d(ji,jj, 9) + zzoodet * ze3t(ji,jj,jk)
+               trc2d(ji,jj,10) = trc2d(ji,jj,10) + zzoobod * ze3t(ji,jj,jk)
+               trc2d(ji,jj,11) = trc2d(ji,jj,11) + zzoonh4 * ze3t(ji,jj,jk)
+               trc2d(ji,jj,12) = trc2d(ji,jj,12) + zzoodom * ze3t(ji,jj,jk)
+               trc2d(ji,jj,13) = trc2d(ji,jj,13) + znh4no3 * ze3t(ji,jj,jk)
+               trc2d(ji,jj,14) = trc2d(ji,jj,14) + zdomnh4 * ze3t(ji,jj,jk)
+               trc2d(ji,jj,15) = trc2d(ji,jj,15) + zdetnh4 * ze3t(ji,jj,jk)
+             
+               trc2d(ji,jj,16) = trc2d(ji,jj,16) + (  zno3phy + znh4phy - zphynh4   &
+                  &                                 - zphydom - zphyzoo - zphydet ) * ze3t(ji,jj,jk)
+               trc2d(ji,jj,17) = trc2d(ji,jj,17) + (  zphyzoo + zdetzoo - zzoodet   &
+                  &                                 - zzoobod - zzoonh4 - zzoodom ) * ze3t(ji,jj,jk)
+               trc2d(ji,jj,18) = trc2d(ji,jj,18) + zdetdom * ze3t(ji,jj,jk)
+! trend number 19 is in trcexp.F
+               trc3d(ji,jj,jk,1) = zno3phy * 86400     
+               trc3d(ji,jj,jk,2) = znh4phy * 86400     
+               trc3d(ji,jj,jk,3) = znh4no3 * 86400     
+#endif
+
+               ! tracer flux at totox-point added to the general trend
+               tra(ji,jj,jk,jpdet) = tra(ji,jj,jk,jpdet) + zdeta
+               tra(ji,jj,jk,jpzoo) = tra(ji,jj,jk,jpzoo) + zzooa
+               tra(ji,jj,jk,jpphy) = tra(ji,jj,jk,jpphy) + zphya
+               tra(ji,jj,jk,jpno3) = tra(ji,jj,jk,jpno3) + zno3a
+               tra(ji,jj,jk,jpnh4) = tra(ji,jj,jk,jpnh4) + znh4a
+               tra(ji,jj,jk,jpdom) = tra(ji,jj,jk,jpdom) + zdoma
+
+            END DO
+         END DO
+      END DO
+
+!!gm do loop until jpkm1 only!
+      !                                      ! -------------------------- !
+      DO jk = jpkb, jpk                      !  Upper ocean (bio-layers)  !
+         !                                   ! -------------------------- !
+
+         DO jj = 2, jpjm1
+            DO ji = 2,jpim1             !!gm use of fs_2 & fs_jpim1 required
+ 
+               ! remineralisation of all quantities towards nitrate 
+
+               !    trophic variables( det, zoo, phy, no3, nh4, dom)
+               !       negative trophic variables DO not contribute to the fluxes
+               zdet = MAX( 0.e0, trn(ji,jj,jk,jpdet) )
+               zzoo = MAX( 0.e0, trn(ji,jj,jk,jpzoo) )
+               zphy = MAX( 0.e0, trn(ji,jj,jk,jpphy) )
+               zno3 = MAX( 0.e0, trn(ji,jj,jk,jpno3) )
+               znh4 = MAX( 0.e0, trn(ji,jj,jk,jpnh4) )
+               zdom = MAX( 0.e0, trn(ji,jj,jk,jpdom) )
+
+               !    Limitations
+               zlt   = 0.e0
+               zle   = 0.e0
+               zlno3 = 0.e0
+               zlnh4 = 0.e0
+
+               !    sinks and sources
+               !       phytoplankton production and exsudation
+               zno3phy = 0.e0
+               znh4phy = 0.e0
+               zphydom = 0.e0
+               zphynh4 = 0.e0
+
+               !    zooplankton production
+               zphyzoo = 0.e0      ! grazing
+               zdetzoo = 0.e0
+
+               zzoodet = 0.e0      ! fecal pellets production
+
+               zzoonh4 = tauzn * fzoolab * zzoo         ! zooplankton liquide excretion
+               zzoodom = tauzn * (1 - fzoolab) * zzoo
+
+               !    mortality
+               zphydet = tmminp * zphy      ! phytoplankton mortality 
+
+               zzoobod = 0.e0               ! zooplankton mortality
+               zboddet = 0.e0               ! closure : flux fbod is redistributed below level jpkbio
+
+               !    detritus and dom breakdown
+               zdetnh4 = taudn * fdetlab * zdet
+               zdetdom = taudn * (1 - fdetlab) * zdet 
+
+               zdomnh4 = taudomn * zdom
+               zdomaju = (1 - redf/reddom) * (zphydom + zzoodom + zdetdom)
+
+               !    Nitrification
+               znh4no3 = taunn * znh4
+
+
+               ! determination of trends
+               !     total trend for each biological tracer
+               zphya =   zno3phy + znh4phy - zphynh4 - zphydom - zphyzoo - zphydet
+               zzooa =   zphyzoo + zdetzoo - zzoodet - zzoodom - zzoonh4 - zzoobod
+               zno3a = - zno3phy + znh4no3
+               znh4a = - znh4phy - znh4no3 + zphynh4 + zzoonh4 + zdomnh4 + zdetnh4 + zdomaju
+               zdeta = zphydet + zzoodet  - zdetzoo - zdetnh4 - zdetdom + zboddet
+               zdoma = zphydom + zzoodom + zdetdom - zdomnh4 - zdomaju
+
+#if defined key_trc_diabio
+               trbio(ji,jj,jk, 1) = zno3phy
+               trbio(ji,jj,jk, 2) = znh4phy
+               trbio(ji,jj,jk, 3) = zphynh4
+               trbio(ji,jj,jk, 4) = zphydom
+               trbio(ji,jj,jk, 5) = zphyzoo
+               trbio(ji,jj,jk, 6) = zphydet
+               trbio(ji,jj,jk, 7) = zdetzoo
+               trbio(ji,jj,jk, 9) = zzoodet
+               trbio(ji,jj,jk,10) = zzoobod
+               trbio(ji,jj,jk,11) = zzoonh4
+               trbio(ji,jj,jk,12) = zzoodom
+               trbio(ji,jj,jk,13) = znh4no3
+               trbio(ji,jj,jk,14) = zdomnh4
+               trbio(ji,jj,jk,15) = zdetnh4
+#endif
+#if defined key_trc_diaadd
+               trc2d(ji,jj, 1) = trc2d(ji,jj, 1) + zno3phy * ze3t(ji,jj,jk)          
+               trc2d(ji,jj, 2) = trc2d(ji,jj, 2) + znh4phy * ze3t(ji,jj,jk)
+               trc2d(ji,jj, 3) = trc2d(ji,jj, 3) + zphydom * ze3t(ji,jj,jk)
+               trc2d(ji,jj, 4) = trc2d(ji,jj, 4) + zphynh4 * ze3t(ji,jj,jk)
+               trc2d(ji,jj, 5) = trc2d(ji,jj, 5) + zphyzoo * ze3t(ji,jj,jk)
+               trc2d(ji,jj, 6) = trc2d(ji,jj, 6) + zphydet * ze3t(ji,jj,jk)
+               trc2d(ji,jj, 7) = trc2d(ji,jj, 7) + zdetzoo * ze3t(ji,jj,jk)
+               ! trend number 8 is in trcsed.F            
+               trc2d(ji,jj, 9) = trc2d(ji,jj, 9) + zzoodet * ze3t(ji,jj,jk)
+               trc2d(ji,jj,10) = trc2d(ji,jj,10) + zzoobod * ze3t(ji,jj,jk)
+               trc2d(ji,jj,11) = trc2d(ji,jj,11) + zzoonh4 * ze3t(ji,jj,jk)
+               trc2d(ji,jj,12) = trc2d(ji,jj,12) + zzoodom * ze3t(ji,jj,jk)
+               trc2d(ji,jj,13) = trc2d(ji,jj,13) + znh4no3 * ze3t(ji,jj,jk)
+               trc2d(ji,jj,14) = trc2d(ji,jj,14) + zdomnh4 * ze3t(ji,jj,jk)
+               trc2d(ji,jj,15) = trc2d(ji,jj,15) + zdetnh4 * ze3t(ji,jj,jk)
+             
+               trc2d(ji,jj,16) = trc2d(ji,jj,16) + (  zno3phy + znh4phy - zphynh4   &
+                  &                                 - zphydom - zphyzoo - zphydet  ) * ze3t(ji,jj,jk)
+               trc2d(ji,jj,17) = trc2d(ji,jj,17) + (  zphyzoo + zdetzoo - zzoodet   &
+                  &                                 - zzoobod - zzoonh4 - zzoodom  ) * ze3t(ji,jj,jk)
+               trc2d(ji,jj,18) = trc2d(ji,jj,18) + zdetdom * ze3t(ji,jj,jk)
+
+               trc3d(ji,jj,jk,1) =  zno3phy * 86400     
+               trc3d(ji,jj,jk,2) =  znh4phy * 86400     
+               trc3d(ji,jj,jk,3) =  znh4no3 * 86400     
+#endif
+
+               ! tracer flux at totox-point added to the general trend
+               tra(ji,jj,jk,jpdet) = tra(ji,jj,jk,jpdet) + zdeta
+               tra(ji,jj,jk,jpzoo) = tra(ji,jj,jk,jpzoo) + zzooa
+               tra(ji,jj,jk,jpphy) = tra(ji,jj,jk,jpphy) + zphya
+               tra(ji,jj,jk,jpno3) = tra(ji,jj,jk,jpno3) + zno3a
+               tra(ji,jj,jk,jpnh4) = tra(ji,jj,jk,jpnh4) + znh4a
+               tra(ji,jj,jk,jpdom) = tra(ji,jj,jk,jpdom) + zdoma
+               !
+            END DO
+         END DO
+      END DO
+
+#if defined key_trc_diaadd
+      ! Lateral boundary conditions on trc2d and trc3d
+      DO ji = 1, jpdia2d
+          CALL lbc_lnk( trc2d(:,:,ji),'T', 1. )
+      END DO 
+      DO ji = 1, jpdia3d
+          CALL lbc_lnk( trc3d(:,:,1,ji),'T', 1. )
+      END DO 
+#endif
+
+#if defined key_trc_diabio
+      ! Lateral boundary conditions on trcbio
+      DO ji = 1, jpdiabio
+          CALL lbc_lnk( trbio(:,:,1,ji),'T', 1. )
+      END DO 
+#endif
+      !
+      IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
+         WRITE(charout, FMT="('bio')")
+         CALL prt_ctl_trc_info(charout)
+         CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm)
+      ENDIF
+
+   END SUBROUTINE trc_bio
+
+#else
+   !!======================================================================
+   !!  Dummy module :                                   No PISCES bio-model
+   !!======================================================================
+CONTAINS
+   SUBROUTINE trc_bio( kt )                   ! Empty routine
+      INTEGER, INTENT( in ) ::   kt
+      WRITE(*,*) 'trc_bio: You should not have seen this print! error?', kt
+   END SUBROUTINE trc_bio
+#endif 
+
+   !!======================================================================
+END MODULE  trcbio
Index: trunk/NEMO/TOP_SRC/LOBSTER/trcctl.lobster.h90
===================================================================
--- trunk/NEMO/TOP_SRC/LOBSTER/trcctl.lobster.h90	(revision 934)
+++ trunk/NEMO/TOP_SRC/LOBSTER/trcctl.lobster.h90	(revision 934)
@@ -0,0 +1,75 @@
+   !!======================================================================
+   !!                         ***  trcctl.lobster.h90  ***
+   !! TOP :   Control of LOBSTER 1 biological model
+   !!======================================================================
+   !!----------------------------------------------------------------------
+   !! History :   1.0  !  2000-12 (E. Kestenare) assign a parameter to name individual tracers
+   !!----------------------------------------------------------------------
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 1.0 , LOCEAN-IPSL (2005) 
+   !! $Id: trcctl.lobster1.h90 764 2007-12-14 06:32:58Z gm $ 
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+      IF(lwp) WRITE(numout,*)
+      IF(lwp) WRITE(numout,*) ' use LOBSTER biological model '
+
+      ! Check number of tracers
+      ! -----------------------
+      IF (jp_lobster /= 6) THEN 
+          IF (lwp) THEN 
+              WRITE (numout,*) ' ===>>>> : w a r n i n g '
+              WRITE (numout,*) ' =======   ============= '
+              WRITE (numout,*)                             &
+              &   ' STOP, change jp_lobster to 6 in '           &
+              &   ,'par_lobster.F90 '  
+          END IF 
+          STOP 'TRC_CTL'
+      END IF 
+
+      ! Check tracer names
+      ! ------------------
+      IF(   ctrcnm(jpdet) /= 'DET' .OR. ctrcnm(jpzoo) /= 'ZOO' .OR.   &
+         &  ctrcnm(jpphy) /= 'PHY' .OR. ctrcnm(jpno3) /= 'NO3' .OR.   &
+         &  ctrcnm(jpnh4) /= 'NH4' .OR. ctrcnm(jpdom) /= 'DOM' .OR.   & 
+         &  ctrcnl(jpdet) /= 'Detritus'                        .OR.   &
+         &  ctrcnl(jpzoo) /= 'Zooplankton concentration'       .OR.   &
+         &  ctrcnl(jpphy) /= 'Phytoplankton concentration'     .OR.   &
+         &  ctrcnl(jpno3) /= 'Nitrate concentration'           .OR.   &
+         &  ctrcnl(jpnh4) /= 'Ammonium concentration'          .OR.   &
+         &  ctrcnl(jpdom) /= 'Dissolved organic matter' ) THEN 
+         ctrcnm(jpdet)='DET'
+         ctrcnl(jpdet)='Detritus'
+         ctrcnm(jpzoo)='ZOO'
+         ctrcnl(jpzoo)='Zooplankton concentration'
+         ctrcnm(jpphy)='PHY'
+         ctrcnl(jpphy)='Phytoplankton concentration'
+         ctrcnm(jpno3)='NO3'
+         ctrcnl(jpno3)='Nitrate concentration'
+         ctrcnm(jpnh4)='NH4'
+         ctrcnl(jpnh4)='Ammonium concentration'
+         ctrcnm(jpdom)='DOM'
+         ctrcnl(jpdom)='Dissolved organic matter'          
+         IF(lwp) THEN
+            WRITE (numout,*) ' ===>>>> : w a r n i n g '
+            WRITE (numout,*) ' =======   ============= '
+            WRITE (numout,*) ' we force tracer names'
+            DO jn = jp_lob0, jp_lob1
+               WRITE(numout,*) ' tracer nb: ',jn,' name = ',ctrcnm(jn), ctrcnl(jn)
+            END DO
+            WRITE(numout,*) ' '
+         ENDIF 
+      ENDIF 
+
+      ! Check tracer units
+      DO jn = jp_lob0, jp_lob1
+         IF( ctrcun(jn) /= 'mmole-N/m3') THEN
+            ctrcun(jn)='mmole-N/m3'
+            IF(lwp) THEN
+               WRITE (numout,*) ' ===>>>> : w a r n i n g '
+               WRITE (numout,*) ' =======   ============= '
+               WRITE (numout,*) ' we force tracer unit'
+               WRITE(numout,*) ' tracer  ',ctrcnm(jn), 'UNIT= ',ctrcun(jn)
+            ENDIF 
+         ENDIF 
+      END DO              
Index: trunk/NEMO/TOP_SRC/LOBSTER/trcexp.F90
===================================================================
--- trunk/NEMO/TOP_SRC/LOBSTER/trcexp.F90	(revision 934)
+++ trunk/NEMO/TOP_SRC/LOBSTER/trcexp.F90	(revision 934)
@@ -0,0 +1,190 @@
+MODULE trcexp
+   !!======================================================================
+   !!                         ***  MODULE p4sed  ***
+   !! TOP :   PISCES Compute loss of organic matter in the sediments
+   !!======================================================================
+   !! History :    -   !  1999    (O. Aumont, C. Le Quere)  original code
+   !!              -   !  2001-05 (O. Aumont, E. Kestenare) add sediment computations
+   !!             1.0  !  2005-06 (A.-S. Kremeur) new temporal integration for sedpoc
+   !!             2.0  !  2007-12  (C. Deltel, G. Madec)  F90
+   !!----------------------------------------------------------------------
+#if defined key_lobster
+   !!----------------------------------------------------------------------
+   !!   'key_lobster'                                     LOBSTER bio-model
+   !!----------------------------------------------------------------------
+   !!   trc_exp        :  Compute loss of organic matter in the sediments
+   !!----------------------------------------------------------------------
+   USE oce_trc         !
+   USE trp_trc
+   USE sms
+   USE lbclnk
+   USE trc
+   USE trctrp_lec
+   USE prtctl_trc      ! Print control for debbuging
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   trc_exp    ! called in p4zprg.F90
+
+   !!* Substitution
+#  include "domzgr_substitute.h90"
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 2.0 , LOCEAN-IPSL (2007) 
+   !! $Id: trcexp.F90 777 2007-12-19 18:40:57Z gm $ 
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+   SUBROUTINE trc_exp( kt )
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE trc_exp  ***
+      !!
+      !! ** Purpose :   MODELS EXPORT OF BIOGENIC MATTER (POC ''SOFT
+      !!              TISSUE'') AND ITS DISTRIBUTION IN WATER COLUMN
+      !!
+      !! ** Method  : - IN THE SURFACE LAYER POC IS PRODUCED ACCORDING TO
+      !!              NURTRIENTS AVAILABLE AND GROWTH CONDITIONS. NUTRIENT UPTAKE
+      !!              KINETICS FOLLOW MICHAELIS-MENTON FORMULATION. 
+      !!              THE TOTAL PARTICLE AMOUNT PRODUCED, IS DISTRIBUTED IN THE WATER
+      !!              COLUMN BELOW THE SURFACE LAYER.
+      !!---------------------------------------------------------------------
+      INTEGER, INTENT( in ) ::   kt      ! ocean time-step index      
+      !!
+      INTEGER  ::   ji, jj, jk
+      REAL(wp) ::   zgeolpoc, zfact
+      INTEGER , DIMENSION(jpi,jpj) ::   ikbot
+      REAL(wp), DIMENSION(jpi,jpj) ::   zwork
+
+      CHARACTER (len=25) :: charout
+      !!---------------------------------------------------------------------
+
+      IF( kt == nit000 ) THEN
+         IF(lwp) WRITE(numout,*)
+         IF(lwp) WRITE(numout,*) ' trc_exp: LOBSTER export'
+         IF(lwp) WRITE(numout,*) ' ~~~~~~~'
+      ENDIF
+
+! VERTICAL DISTRIBUTION OF NEWLY PRODUCED BIOGENIC
+! POC IN THE WATER COLUMN
+! (PARTS OF NEWLY FORMED MATTER REMAINING IN THE DIFFERENT
+! LAYERS IS DETERMINED BY DMIN3 DEFINED IN common.passivetrc.*.h
+! ----------------------------------------------------------------------
+
+      DO jk = 1, jpkm1
+         DO jj = 2, jpjm1
+            DO ji = 2, jpim1
+               tra(ji,jj,jk,jpno3) = tra(ji,jj,jk,jpno3)   &
+     &                             + (1./fse3t(ji,jj,jk)) * dmin3(ji,jj,jk) * fbod(ji,jj)
+            END DO
+         END DO
+      END DO
+
+!     Find the last level of the water column
+!     Compute fluxes due to sinking particles (slow)
+   
+      ikbot(:,:) = jpk
+      zwork(:,:) = 0.e0
+
+!!gm ikbot already exist in opa...
+      DO jk = 1, jpkm1
+         DO jj = 2, jpjm1
+            DO ji = 2, jpim1
+               IF( tmask(ji,jj,jk) == 1 .AND.  tmask(ji,jj,jk+1) == 0 ) THEN
+                  ikbot(ji,jj) = jk
+                  zwork(ji,jj) = vsed * trn(ji,jj,jk,jpdet)
+               ENDIF
+            END DO
+         END DO
+      END DO
+
+      zgeolpoc = 0.e0         !     Initialization
+
+      ! Release of nutrients from the "simple" sediment
+      DO jj = 2, jpjm1
+         DO ji = 2, jpim1
+            tra(ji,jj,ikbot(ji,jj),jpno3) = tra(ji,jj,ikbot(ji,jj),jpno3)   &
+               &                          + sedlam * sedpocn(ji,jj) / fse3t(ji,jj,ikbot(ji,jj))
+
+            !     Deposition of organic matter in the sediment
+            zgeolpoc = zgeolpoc + sedlostpoc * sedpocn(ji,jj) * e1t(ji,jj) * e2t(ji,jj)
+
+!!gm factorisationof rdt just bellow...
+            sedpoca(ji,jj) = zwork(ji,jj) * rdt + dminl(ji,jj) * fbod(ji,jj) * rdt   &
+               &           - sedlam * sedpocn(ji,jj) * rdt - sedlostpoc * sedpocn(ji,jj) * rdt
+
+         END DO
+      END DO
+
+      DO jj = 2,jpjm1
+         DO ji = 2,jpim1
+            tra(ji,jj,1,jpno3) = tra(ji,jj,1,jpno3) + zgeolpoc * cmask(ji,jj) / areacot / fse3t(ji,jj,1)
+         END DO
+      END DO
+
+      CALL lbc_lnk( sedpocn, 'T', 1. )
+ 
+      ! Oa & Ek: diagnostics depending on jpdia2d !          left as example
+# if defined key_trc_diaadd
+      trc2d(:,:,19) = sedpocn(:,:)
+# endif
+
+      ! Leap-frog scheme (only in explicit case, otherwise the 
+      ! ----------------  time stepping is already done in trczdf)
+      IF( l_trczdf_exp .AND. (ln_trcadv_cen2 .OR. ln_trcadv_tvd) ) THEN
+         zfact = 2. * rdttra(jk) * FLOAT( ndttrc ) 
+         IF( neuler == 0 .AND. kt == nittrc000 )   zfact = rdttra(jk) * FLOAT(ndttrc) 
+         sedpoca(:,:) =  sedpocb(:,:) + zfact * sedpoca(:,:) 
+      ENDIF
+
+      
+      ! Time filter and swap of arrays
+      ! ------------------------------
+      IF( ln_trcadv_cen2 .OR. ln_trcadv_tvd  ) THEN         ! centred or tvd scheme
+         IF( neuler == 0 .AND. kt == nittrc000 ) THEN
+            DO jj = 1, jpj
+               DO ji = 1, jpi
+                  sedpocb(ji,jj) = sedpocn(ji,jj)
+                  sedpocn(ji,jj) = sedpoca(ji,jj)
+                  sedpoca(ji,jj) = 0.e0
+               END DO
+            END DO
+         ELSE
+            DO jj = 1, jpj
+               DO ji = 1, jpi
+                  sedpocb(ji,jj) = atfp  * ( sedpocb(ji,jj) + sedpoca(ji,jj) )    &
+                     &           + atfp1 *   sedpocn(ji,jj)
+                  sedpocn(ji,jj) = sedpoca(ji,jj)
+                  sedpoca(ji,jj) = 0.e0
+               END DO
+            END DO
+         ENDIF
+      ELSE                                                   !  case of smolar scheme or muscl
+         sedpocb(:,:) = sedpoca(:,:)
+         sedpocn(:,:) = sedpoca(:,:)
+         sedpoca(:,:) = 0.e0
+      ENDIF
+      !
+
+      IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
+         WRITE(charout, FMT="('exp')")
+         CALL prt_ctl_trc_info(charout)
+         CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm)
+      ENDIF
+
+   END SUBROUTINE trc_exp
+
+#else
+   !!======================================================================
+   !!  Dummy module :                                   No PISCES bio-model
+   !!======================================================================
+CONTAINS
+   SUBROUTINE trc_exp( kt )                   ! Empty routine
+      INTEGER, INTENT( in ) ::   kt
+      WRITE(*,*) 'trc_exp: You should not have seen this print! error?', kt
+   END SUBROUTINE trc_exp
+#endif 
+
+   !!======================================================================
+END MODULE  trcexp
Index: trunk/NEMO/TOP_SRC/LOBSTER/trcini_lobster.F90
===================================================================
--- trunk/NEMO/TOP_SRC/LOBSTER/trcini_lobster.F90	(revision 934)
+++ trunk/NEMO/TOP_SRC/LOBSTER/trcini_lobster.F90	(revision 934)
@@ -0,0 +1,156 @@
+MODULE trcini_lobster
+   !!======================================================================
+   !!                         ***  MODULE trcini_lobster  ***
+   !! TOP :   initialisation of the LOBSTER biological model
+   !!======================================================================
+   !! History :    -   !  1999-09  (M. Levy) Original code
+   !!              -   !  2000-12  (0. Aumont, E. Kestenare) add sediment 
+   !!             1.0  !  2004-03  (C. Ethe) Modularity
+   !!              -   !  2005-03  (O. Aumont, A. El Moussaoui) F90
+   !! History :   2.0  !  2007-12  (C. Ethe, G. Madec) from trcini.lobster1.h90
+   !!----------------------------------------------------------------------
+#if defined key_lobster
+   !!----------------------------------------------------------------------
+   !!   'key_lobster'                                     LOBSTER bio-model
+   !!----------------------------------------------------------------------
+   !! trc_ini_lobster  : LOBSTER model initialisation
+   !!----------------------------------------------------------------------
+   USE par_trc         ! TOP parameters
+   USE sms             ! Source Minus Sink variables
+   USE oce_trc         ! ocean variables
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   trc_ini_lobster   ! called by trcini.F90 module
+
+#  include "domzgr_substitute.h90"
+#  include "top_substitute.h90"
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 2.0 , LOCEAN-IPSL (2007) 
+   !! $Id: trcini_lobster.F90 776 2007-12-19 14:10:14Z gm $ 
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+   SUBROUTINE trc_ini_lobster
+      !!----------------------------------------------------------------------
+      !!                    ***  ROUTINE trc_ini_lobster  ***
+      !! ** purpose :   specific initialisation for LOBSTER bio-model
+      !!----------------------------------------------------------------------
+      INTEGER  ::   ji, jj, jk, jn
+      REAL(wp) ::   ztest, zfluo, zfluu
+      REAL(wp), DIMENSION(jpi,jpj)     ::   zrro
+      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zdm0
+      !!----------------------------------------------------------------------
+
+      IF(lwp) WRITE(numout,*)
+      IF(lwp) WRITE(numout,*) ' trc_ini_lobster :   LOBSTER biochemical model initialisation'
+      IF(lwp) WRITE(numout,*) ' ~~~~~~~~~~~~~~~'
+
+
+      ! initialization of fields for optical model
+      ! --------------------------------------------
+      xze (:,:)   = 5.e0
+      xpar(:,:,:) = 0.e0
+
+      ! initialization for passive tracer remineralisation-damping  array
+      ! -----------------------------------------------------------------
+
+      DO jn = jp_lob0, jp_lob1
+         remdmp(:,jn) = tminr
+      END DO
+
+      IF(lwp) THEN
+         WRITE(numout,*) ' '
+         WRITE(numout,*) ' trcini: compute remineralisation-damping  '
+         WRITE(numout,*) '         arrays for tracers'
+      ENDIF
+
+      ! initialization of biological variables
+      ! ------------------------------------------
+
+      ! Calculate vertical distribution of newly formed biogenic poc
+      ! in the water column in the case of max. possible bottom depth
+      ! ------------------------------------------------------------
+
+      zdm0   = 0.e0
+      zrro = 1.e0
+      DO jk = jpkb,jpkm1
+         DO jj =1, jpj
+            DO ji =1, jpi
+               zfluo = ( fsdepw(ji,jj,jk  ) / fsdepw(ji,jj,jpkb) )**xhr 
+               zfluu = ( fsdepw(ji,jj,jk+1) / fsdepw(ji,jj,jpkb) )**xhr
+               IF( zfluo.GT.1. )   zfluo = 1.e0
+               zdm0(ji,jj,jk) = zfluo - zfluu
+               IF( jk <= jpkb-1 )   zdm0(ji,jj,jk) = 0.e0
+               zrro(ji,jj) = zrro(ji,jj) - zdm0(ji,jj,jk)
+            END DO
+         END DO
+      END DO
+
+      zdm0(:,:,jpk) = zrro(:,:)
+
+      ! Calculate vertical distribution of newly formed biogenic poc
+      ! in the water column with realistic topography (first "dry" layer
+      ! contains total fraction, which has passed to the upper layers)
+      ! ----------------------------------------------------------------------
+      dminl = 0.
+      dmin3 = zdm0
+      DO jk = 1, jpk
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               IF( tmask(ji,jj,jk) == 0. ) THEN
+                  dminl(ji,jj) = dminl(ji,jj) + dmin3(ji,jj,jk)
+                  dmin3(ji,jj,jk) = 0.e0
+               ENDIF
+            END DO
+         END DO
+      END DO
+
+      DO jj = 1, jpj
+         DO ji = 1, jpi
+            IF( tmask(ji,jj,1) == 0 )   dmin3(ji,jj,1) = 0.e0
+         END DO
+      END DO
+
+      ! Coastal mask 
+      ! ------------   
+      cmask = 0.e0
+      DO ji = 2, jpi-1
+         DO jj = 2, jpj-1
+            if (tmask(ji,jj,1) == 1) then
+               ztest=tmask(ji+1,jj,1)*tmask(ji-1,jj,1)*tmask(ji,jj+1,1)*tmask(ji,jj-1,1)
+               IF (ztest == 0) cmask(ji,jj) = 1.
+            endif
+         END DO
+      END DO
+
+      cmask( 1 ,:) = cmask(jpi-1,:)
+      cmask(jpi,:) = cmask( 2   ,:)
+
+      !!gm BUG !!!!!   not valid in mpp and also not valid for north fold   !!!!!
+
+      ! Coastal surface
+      ! ---------------
+      areacot = 0.e0
+      DO ji = 2, jpi-1
+         DO jj = 2, jpj-1
+            areacot = areacot + e1t(ji,jj) * e2t(ji,jj) * cmask(ji,jj)
+         END DO
+      END DO
+      !
+   END SUBROUTINE trc_ini_lobster
+
+#else
+   !!----------------------------------------------------------------------
+   !!   Dummy module                                   No LOBSTER bio-model
+   !!----------------------------------------------------------------------
+CONTAINS
+   SUBROUTINE trc_ini_lobster             ! Empty routine
+   END SUBROUTINE trc_ini_lobster
+#endif
+
+   !!======================================================================
+END MODULE trcini_lobster
Index: trunk/NEMO/TOP_SRC/LOBSTER/trclsm_lobster.F90
===================================================================
--- trunk/NEMO/TOP_SRC/LOBSTER/trclsm_lobster.F90	(revision 934)
+++ trunk/NEMO/TOP_SRC/LOBSTER/trclsm_lobster.F90	(revision 934)
@@ -0,0 +1,231 @@
+MODULE trclsm_lobster
+   !!======================================================================
+   !!                      ***  MODULE trclsm_lobster  ***
+   !! TOP :   initialisation of some run parameters for LOBSTER bio-model
+   !!======================================================================
+   !! History :   2.0  !  2007-12  (C. Ethe, G. Madec) from trclsm.lobster1.h90
+   !!----------------------------------------------------------------------
+#if defined key_lobster
+   !!----------------------------------------------------------------------
+   !!   'key_lobster'   :                                 LOBSTER bio-model
+   !!----------------------------------------------------------------------
+   !! trc_lsm_lobster      : LOBSTER model namelist read
+   !!----------------------------------------------------------------------
+   USE oce_trc         ! Ocean variables
+   USE par_trc         ! TOP parameters
+   USE trc             ! TOP variables
+   USE sms             ! sms trends
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   trc_lsm_lobster   ! called by trclsm.F90 module
+
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 2.0 , LOCEAN-IPSL (2007) 
+   !! $Id: trclsm_lobster.F90 772 2007-12-17 11:59:33Z gm $ 
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+   SUBROUTINE trc_lsm_lobster
+      !!----------------------------------------------------------------------
+      !!                     ***  trc_lsm_lobster  ***  
+      !!
+      !! ** Purpose :   read LOBSTER namelist
+      !!
+      !! ** input   :   file 'namelist.trc.sms' containing the following
+      !!             namelist: natbio, natopt, and natdbi ("key_trc_diabio")
+      !!----------------------------------------------------------------------
+      CHARACTER (len=32) :: clname
+      !!
+      NAMELIST/natbio/ apmin, azmin, anmin, admin,                       &
+         &   redf, reddom, slopet, toptp, psinut, akno3, aknh4, rcchl,   &
+         &   rgamma, toptgz, tmaxgz, rgz,                                &
+         &   rppz, taus, aks, filmax, rpnaz, rdnaz, eggzoo, tauzn,       &
+         &   tmmaxp, tmminp, tmmaxz, tmminz, anumin, afdmin, taudn,      &
+         &   vsed, tmumax, aki, tmaxr, tminr, taunn, taudomn, xhr,       &
+         &   sedlam, sedlostpoc,                                         &
+         &   fphylab, fzoolab, fdetlab, fdbod
+      NAMELIST/natopt/ xkg0, xkr0, xkgp, xkrp, xlg, xlr, rpig
+#if defined key_trc_diabio
+      INTEGER :: ji
+      NAMELIST/natdbi/ctrbio,ctrbil,ctrbiu,nwritebio
+#endif
+      !!----------------------------------------------------------------------
+
+      IF(lwp) WRITE(numout,*)
+      IF(lwp) WRITE(numout,*) ' trc_lsm_lobster : read LOBSTER namelists'
+      IF(lwp) WRITE(numout,*) ' ~~~~~~~~~~~~~~~'
+
+      !                               ! Open the namelist file
+      !                               ! ----------------------
+      clname ='namelist.trc.sms'
+      CALL ctlopn( numnat, clname, 'OLD', 'FORMATTED', 'SEQUENTIAL',   &
+         &           1, numout, .FALSE., 1 )
+
+      !                               ! natbio : biological parameters
+      !                               ! ------------------------------
+      apmin = 0.                           ! default values
+      azmin = 0.
+      anmin = 0.
+      admin = 0.
+      redf  = 0.
+      reddom = 0.
+      slopet = 0.
+      toptp = 0.
+      psinut = 0.
+      akno3  = 0.
+      aknh4 = 0.
+      rcchl = 0.
+      rgamma= 0.
+      toptgz= 0.
+      tmaxgz= 0.
+      rgz   = 0.
+      rppz  = 0.
+      taus  = 0.
+      aks   = 0.
+      filmax= 0.
+      rpnaz = 0.
+      rdnaz = 0.
+      eggzoo= 0.
+      tauzn = 0.
+      tmmaxp= 0.
+      tmminp= 0.
+      tmmaxz= 0.
+      tmminz= 0.
+      anumin= 0.
+      afdmin= 0.
+      taudn = 0.
+      vsed  = 0.
+      tmumax= 0.
+      aki   = 0.
+      tmaxr   = 1./(     4.*rday)*0.
+      tminr   = 1./(24.*30.*rday)*0.
+      xhr=0.
+      sedlam=0.
+      sedlostpoc=0.
+      taudomn = 0.
+      taunn = 0.
+      fphylab = 0.
+      fzoolab = 0.
+      fdetlab = 0.
+      fdbod = 0.
+
+      REWIND( numnat )                     ! read natbio
+      READ  ( numnat, natbio )
+
+      IF(lwp) THEN
+          WRITE(numout,*) ' Namelist natbio'
+          WRITE(numout,*) '    minimum phytoplancton concentration                  apmin     =', apmin
+          WRITE(numout,*) '    minimum zooplancton   concentration                  azmin     =', azmin
+          WRITE(numout,*) '    minimum nutrients     concentration                  anmin     =', anmin
+          WRITE(numout,*) '    minimum detritus      concentration                  admin     =', admin
+          WRITE(numout,*) '    redfield ratio  c:n                                  redf      =', redf
+          WRITE(numout,*) '    van t hoff coefficient                               slopet    =', slopet
+          WRITE(numout,*) '    optimal photosynthesis temperature                   toptp     =', toptp
+          WRITE(numout,*) '    inhibition of no3 uptake by nh4                      psinut    =', psinut
+          WRITE(numout,*) '    half-saturation nutrient for no3 uptake              akno3     =', akno3
+          WRITE(numout,*) '    half-saturation nutrient for nh4 uptake              aknh4     =', aknh4
+          WRITE(numout,*) '    carbone/chlorophyl ratio                             rcchl     =', rcchl
+          WRITE(numout,*) '    phytoplankton exudation fraction                     rgamma    =', rgamma
+          WRITE(numout,*) '    optimal temperature for zoo growth                   toptgz    =', toptgz
+          WRITE(numout,*) '    maximal temperature for zoo growth                   tmaxgz    =', tmaxgz
+          WRITE(numout,*) '    widtht of zoo temperature FUNCTION                   rgz       =', rgz
+          WRITE(numout,*) '    zoo preference for phyto                             rppz      =', rppz
+          WRITE(numout,*) '    maximal zoo grazing rate                             taus      =', 86400 * taus, ' d'
+          WRITE(numout,*) '    half saturation constant for zoo food                aks       =', aks
+          WRITE(numout,*) '    maximal mass clearance rate for zoo                  filmax    =', filmax
+          WRITE(numout,*) '    non-assimilated phyto by zoo                         rpnaz     =', rpnaz
+          WRITE(numout,*) '    non-assimilated detritus by zoo                      rdnaz     =', rdnaz
+          WRITE(numout,*) '    minimum  for zoo concentration                       eggzoo    =', eggzoo
+          WRITE(numout,*) '    zoo specific excretion rate                          tauzn     =', 86400 * tauzn
+          WRITE(numout,*) '    maximal phyto mortality rate                         tmmaxp    =', 86400 * tmmaxp
+          WRITE(numout,*) '    minimal phyto mortality rate                         tmminp    =', 86400 * tmminp
+          WRITE(numout,*) '    maximal zoo mortality rate                           tmmaxz    =', 86400 * tmmaxz
+          WRITE(numout,*) '    minimal zoo mortality rate                           tmminz    =', 86400 * tmminz
+          WRITE(numout,*) '    nutrient threshold for phyto mort                    anumin    =', anumin
+          WRITE(numout,*) '    food threshold for zoo mort                          afdmin    =', afdmin
+          WRITE(numout,*) '    detrital breakdown rate                              taudn     =', 86400 * taudn , ' d'
+          WRITE(numout,*) '    detritus sedimentation speed                         vsed      =', 86400 * vsed  , ' d'
+          WRITE(numout,*) '    phyto max growth rate                                tmumax    =', 86400 * tmumax, ' d'
+          WRITE(numout,*) '    light hlaf saturation constant                       aki       =', aki
+          WRITE(numout,*) '    maximum damping for d z or p                         tmaxr     =', tmaxr
+          WRITE(numout,*) '    damping-remineralisation rate                        tminr     =', tminr
+          WRITE(numout,*) '    nitrification rate                                   taunn     =', taunn
+          WRITE(numout,*) '    dom remineralisation rate                            taudomn   =', taudomn
+          WRITE(numout,*) '    coeff for martin''s remineralistion                  xhr       =', xhr
+          WRITE(numout,*) '    time coeff of POC in sediments                       sedlam    =', sedlam
+          WRITE(numout,*) '    Sediment geol loss for POC                           sedlostpoc=', sedlostpoc
+          WRITE(numout,*) '    NH4 fraction of phytoplankton exsudation             fphylab   =', fphylab
+          WRITE(numout,*) '    NH4 fraction of zooplankton excretion                fzoolab   =', fzoolab
+          WRITE(numout,*) '    NH4 fraction of detritus dissolution                 fdetlab   =', fdetlab
+          WRITE(numout,*) '    Zooplankton mortality fraction that goes to detritus fdbod     =', fdbod
+      ENDIF
+
+      !                               ! natopt : optical parameters
+      !                               ! ---------------------------
+      xkg0  = 0.                           ! default values
+      xkr0  = 0.
+      xkgp  = 0.
+      xkrp  = 0.
+      xlg   = 0.
+      xlr   = 0.
+      rpig  = 0.
+
+      REWIND( numnat )                     ! read natopt
+      READ  ( numnat, natopt )       
+
+      IF(lwp) THEN                         ! control print
+         WRITE(numout,*)
+         WRITE(numout,*) ' Namelist natopt'
+         WRITE(numout,*) '    green   water absorption coeff                       xkg0  = ', xkg0
+         WRITE(numout,*) '    red water absorption coeff                           xkr0  = ', xkr0
+         WRITE(numout,*) '    pigment red absorption coeff                         xkrp  = ', xkrp
+         WRITE(numout,*) '    pigment green absorption coeff                       xkgp  = ', xkgp
+         WRITE(numout,*) '    green chl exposant                                   xlg   = ', xlg
+         WRITE(numout,*) '    red   chl exposant                                   xlr   = ', xlr
+         WRITE(numout,*) '    chla/chla+phea ratio                                 rpig  = ', rpig
+      ENDIF
+
+#if defined key_trc_diabio
+
+      !                               ! natdbi : bio diagnostics
+      !                               ! ------------------------
+      nwritebio = 10                     ! default values
+      DO ji = 1, jpdiabio
+         IF(     ji <  10 ) THEN   ;   WRITE (ctrbio(ji),'("BIO_",I1)') ji      ! short name
+         ELSEIF (ji < 100 ) THEN   ;   WRITE (ctrbio(ji),'("BIO_",I2)') ji   
+         ELSE                      ;   WRITE (ctrbio(ji),'("BIO_",I3)') ji
+         ENDIF
+         WRITE(ctrbil(ji),'("BIOLOGICAL TREND NUMBER ",I2)') ji                 ! long name
+         ctrbiu(ji) = 'mmoleN/m3/s '                                            ! units
+      END DO
+
+      REWIND( numnat )                     ! read natdbi
+      READ  ( numnat, natdbi )  
+
+      IF(lwp) THEN
+         WRITE(numout,*)
+         WRITE(numout,*) ' Namelist natdbi'
+         WRITE(numout,*) '    frequency of outputs for biological outputs  nwritebio = ', nwritebio
+         DO ji = 1, jpdiabio
+            WRITE(numout,*) '     name of biological trend No :',ji,' : ',ctrbio(ji), ctrbil(ji), ' in ', ctrbiu(ji)
+         END DO
+      END IF
+#endif
+      !
+   END SUBROUTINE trc_lsm_lobster
+   
+#else
+   !!----------------------------------------------------------------------
+   !!  Dummy module :                                            No LOBSTER
+   !!----------------------------------------------------------------------
+CONTAINS
+   SUBROUTINE trc_lsm_lobster                      ! Empty routine
+   END  SUBROUTINE  trc_lsm_lobster
+#endif  
+
+   !!======================================================================
+END MODULE trclsm_lobster
Index: trunk/NEMO/TOP_SRC/LOBSTER/trcopt.F90
===================================================================
--- trunk/NEMO/TOP_SRC/LOBSTER/trcopt.F90	(revision 934)
+++ trunk/NEMO/TOP_SRC/LOBSTER/trcopt.F90	(revision 934)
@@ -0,0 +1,155 @@
+MODULE trcopt
+   !!======================================================================
+   !!                         ***  MODULE trcopt  ***
+   !! TOP :   LOBSTER Compute the light availability in the water column
+   !!======================================================================
+   !! History :    -   !  1995-05  (M. Levy) Original code
+   !!              -   !  1999-09  (J.-M. Andre, M. Levy) 
+   !!              -   !  1999-11  (C. Menkes, M.-A. Foujols) itabe initial
+   !!              -   !  2000-02  (M.A. Foujols) change x**y par exp(y*log(x))
+   !!             2.0  !  2007-12  (C. Deltel, G. Madec)  F90
+   !!----------------------------------------------------------------------
+#if defined key_lobster
+   !!----------------------------------------------------------------------
+   !!   'key_lobster'                                     LOBSTER bio-model
+   !!----------------------------------------------------------------------
+   !!   trc_opt        :   Compute the light availability in the water column
+   !!----------------------------------------------------------------------
+   USE oce_trc         !
+   USE trp_trc
+   USE sms
+   USE prtctl_trc      ! Print control for debbuging
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   trc_opt   ! called in trcprg.F90
+
+   !!* Substitution
+#  include "domzgr_substitute.h90"
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 2.0 , LOCEAN-IPSL (2007) 
+   !! $Id: trcopt.F90 777 2007-12-19 18:40:57Z gm $ 
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+   SUBROUTINE trc_opt( kt )
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE trc_opt  ***
+      !!
+      !! ** Purpose :   computes the light propagation in the water column
+      !!              and the euphotic layer depth
+      !!
+      !! ** Method  :   local par is computed in w layers using light propagation
+      !!              mean par in t layers are computed by integration
+      !!---------------------------------------------------------------------
+      INTEGER, INTENT( in ) ::   kt   ! index of the time stepping
+      INTEGER  ::   ji, jj, jk
+      INTEGER , DIMENSION(jpi,jpj)     ::   itabe           ! euphotic layer last k index
+      INTEGER , DIMENSION(jpi,jpj,jpk) ::   imaske          ! euphotic layer mask
+      REAL(wp) ::   zpig                                    ! total pigment
+      REAL(wp) ::   zkr                                     ! total absorption coefficient in red
+      REAL(wp) ::   zkg                                     ! total absorption coefficient in green
+      REAL(wp), DIMENSION(jpi,jpj)     ::   zpar100         ! irradiance at euphotic layer depth
+      REAL(wp), DIMENSION(jpi,jpj)     ::   zpar0m          ! irradiance just below the surface
+      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zparr, zparg    ! red and green compound of par
+
+      CHARACTER (len=25) :: charout
+      !!---------------------------------------------------------------------
+
+      IF( kt == nit000 ) THEN
+         IF(lwp) WRITE(numout,*)
+         IF(lwp) WRITE(numout,*) ' trc_opt: LOBSTER optic-model'
+         IF(lwp) WRITE(numout,*) ' ~~~~~~~'
+      ENDIF
+
+      ! determination of surface irradiance
+      ! -----------------------------------
+      zpar0m (:,:)   = qsr   (:,:) * 0.43
+      zpar100(:,:)   = zpar0m(:,:) * 0.01
+      xpar   (:,:,1) = zpar0m(:,:)
+      zparr  (:,:,1) = 0.5 * zpar0m(:,:)
+      zparg  (:,:,1) = 0.5 * zpar0m(:,:)
+
+
+      ! determination of xpar
+      ! ---------------------
+
+      DO jk = 2, jpk                     ! determination of local par in w levels
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               zpig = MAX( TINY(0.), trn(ji,jj,jk-1,jpphy) ) * 12 * redf / rcchl / rpig
+               zkr  = xkr0 + xkrp * EXP( xlr * LOG( zpig ) )
+               zkg  = xkg0 + xkgp * EXP( xlg * LOG( zpig ) )
+               zparr(ji,jj,jk) = zparr(ji,jj,jk-1) * EXP( -zkr * fse3t(ji,jj,jk-1) )
+               zparg(ji,jj,jk) = zparg(ji,jj,jk-1) * EXP( -zkg * fse3t(ji,jj,jk-1) )
+            END DO
+        END DO
+      END DO
+
+      DO jk = 1, jpkm1                   ! mean par in t levels
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               zpig = MAX( TINY(0.), trn(ji,jj,jk,jpphy) ) * 12 * redf / rcchl / rpig
+               zkr  = xkr0 + xkrp * EXP( xlr * LOG( zpig ) )
+               zkg  = xkg0 + xkgp * EXP( xlg * LOG( zpig ) )
+               zparr(ji,jj,jk)    = zparr(ji,jj,jk) / zkr / fse3t(ji,jj,jk) * ( 1 - EXP( -zkr*fse3t(ji,jj,jk) ) )
+               zparg(ji,jj,jk)    = zparg(ji,jj,jk) / zkg / fse3t(ji,jj,jk) * ( 1 - EXP( -zkg*fse3t(ji,jj,jk) ) )
+               xpar (ji,jj,jk) = MAX( zparr(ji,jj,jk) + zparg(ji,jj,jk), 1.e-15 )
+            END DO
+         END DO
+      END DO
+
+      ! determination of euphotic layer depth (xze)
+      ! -------------------------------------
+
+      DO jk = 1, jpk                   ! imaske equal 1 in the euphotic layer, and 0 without
+         DO jj = 1, jpj
+            DO ji = 1,jpi
+               IF( xpar(ji,jj,jk) >= zpar100(ji,jj) ) THEN
+                  imaske(ji,jj,jk) = 1
+               ELSE
+                  imaske(ji,jj,jk) = 0
+               ENDIF
+            END DO
+         END DO
+      END DO
+      !                                ! sum of imaske Cover the vertical with a minimim value of 1 
+      itabe(:,:) = 1                   !   surface value setto 1 <=> set a ninimum value to 1
+      DO jk = 2, jpk
+         DO jj = 1, jpj
+            DO ji = 1,jpi
+               itabe(ji,jj) = itabe(ji,jj) + imaske(ji,jj,jk)
+            END DO
+         END DO
+      END DO
+      DO jj = 1, jpj                  ! converte the number of level into depth
+         DO ji = 1,jpi
+            xze(ji,jj) = fsdepw(ji,jj,itabe(ji,jj)+1)
+         END DO
+      END DO
+      !
+
+      IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
+         WRITE(charout, FMT="('opt')")
+         CALL prt_ctl_trc_info(charout)
+         CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm )
+      ENDIF
+
+   END SUBROUTINE trc_opt
+
+#else
+   !!======================================================================
+   !!  Dummy module :                                   No PISCES bio-model
+   !!======================================================================
+CONTAINS
+   SUBROUTINE trc_opt( kt )                   ! Empty routine
+      INTEGER, INTENT( in ) ::   kt
+      WRITE(*,*) 'trc_opt: You should not have seen this print! error?', kt
+   END SUBROUTINE trc_opt
+#endif 
+
+   !!======================================================================
+END MODULE  trcopt
Index: trunk/NEMO/TOP_SRC/LOBSTER/trcsed.F90
===================================================================
--- trunk/NEMO/TOP_SRC/LOBSTER/trcsed.F90	(revision 934)
+++ trunk/NEMO/TOP_SRC/LOBSTER/trcsed.F90	(revision 934)
@@ -0,0 +1,130 @@
+MODULE trcsed
+   !!======================================================================
+   !!                         ***  MODULE p4sed  ***
+   !! TOP :   PISCES Compute loss of organic matter in the sediments
+   !!======================================================================
+   !! History :    -   !  1995-06 (M. Levy)  original code
+   !!              -   !  2000-12 (E. Kestenare)  clean up
+   !!             2.0  !  2007-12  (C. Deltel, G. Madec)  F90 + simplifications
+   !!----------------------------------------------------------------------
+#if defined key_lobster
+   !!----------------------------------------------------------------------
+   !!   'key_lobster'                                     LOBSTER bio-model
+   !!----------------------------------------------------------------------
+   !!   trc_sed        :  Compute loss of organic matter in the sediments
+   !!----------------------------------------------------------------------
+   USE oce_trc         !
+   USE trp_trc
+   USE sms
+   USE lbclnk
+
+   USE prtctl_trc      ! Print control for debbuging
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   trc_sed    ! called in ???
+
+   !!* Substitution
+#  include "domzgr_substitute.h90"
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 2.0 , LOCEAN-IPSL (2007) 
+   !! $Id: trcsed.F90 777 2007-12-19 18:40:57Z gm $ 
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+   SUBROUTINE trc_sed( kt )
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE trc_sed  ***
+      !!
+      !! ** Purpose :   compute the now trend due to the vertical sedimentation of
+      !!              detritus and add it to the general trend of detritus equations
+      !!
+      !! ** Method  :   this ROUTINE compute not exactly the advection but the
+      !!              transport term, i.e.  dz(wt) and dz(ws)., dz(wtr)
+      !!              using an upstream scheme
+      !!              the now vertical advection of tracers is given by:
+      !!                      dz(trn wn) = 1/bt dk+1( e1t e2t vsed (trn) )
+      !!              add this trend now to the general trend of tracer (ta,sa,tra):
+      !!                             tra = tra + dz(trn wn)
+      !!        
+      !!              IF 'key_trc_diabio' is defined, the now vertical advection
+      !!              trend of passive tracers is saved for futher diagnostics.
+      !!---------------------------------------------------------------------
+      INTEGER, INTENT( in ) ::   kt      ! ocean time-step index      
+      !!
+      INTEGER  ::   ji, jj, jk
+      REAL(wp) ::   ztra
+      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zwork
+
+      CHARACTER (len=25) :: charout
+      !!---------------------------------------------------------------------
+
+      IF( kt == nit000 ) THEN
+         IF(lwp) WRITE(numout,*)
+         IF(lwp) WRITE(numout,*) ' trc_sed: LOBSTER sedimentation'
+         IF(lwp) WRITE(numout,*) ' ~~~~~~~'
+      ENDIF
+
+      ! sedimentation of detritus  : upstream scheme
+      ! --------------------------------------------
+
+      ! for detritus sedimentation only - jpdet
+
+      zwork(:,:,1  ) = 0.e0      ! surface value set to zero
+      zwork(:,:,jpk) = 0.e0      ! bottom value  set to zero
+
+      ! tracer flux at w-point: we use -vsed (downward flux)  with simplification : no e1*e2
+
+      DO jk = 2, jpkm1
+         zwork(:,:,jk) = -vsed * trn(:,:,jk-1,jpdet)
+      END DO
+
+      ! tracer flux divergence at t-point added to the general trend
+
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1,jpi
+               ztra  = - ( zwork(ji,jj,jk) - zwork(ji,jj,jk+1) ) / fse3t(ji,jj,jk)
+               tra(ji,jj,jk,jpdet) = tra(ji,jj,jk,jpdet) + ztra
+# if defined key_trc_diabio
+               trbio(ji,jj,jk,8) = ztra
+# endif
+# if defined key_trc_diaadd
+               trc2d(ji,jj,8) = trc2d(ji,jj,8) + ztra * fse3t(ji,jj,jk) * 86400.
+# endif
+            END DO
+         END DO
+      END DO
+
+#if defined key_trc_diabio
+      CALL lbc_lnk (trbio(:,:,1,8), 'T', 1. )    ! Lateral boundary conditions on trcbio
+#endif
+#if defined key_trc_diaadd
+      CALL lbc_lnk( trc2d(:,:,8), 'T', 1. )      ! Lateral boundary conditions on trc2d
+#endif
+      !
+
+      IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
+         WRITE(charout, FMT="('sed')")
+         CALL prt_ctl_trc_info(charout)
+         CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm)
+      ENDIF
+
+   END SUBROUTINE trc_sed
+
+#else
+   !!======================================================================
+   !!  Dummy module :                                   No PISCES bio-model
+   !!======================================================================
+CONTAINS
+   SUBROUTINE trc_sed( kt )                   ! Empty routine
+      INTEGER, INTENT( in ) ::   kt
+      WRITE(*,*) 'trc_sed: You should not have seen this print! error?', kt
+   END SUBROUTINE trc_sed
+#endif 
+
+   !!======================================================================
+END MODULE  trcsed
Index: trunk/NEMO/TOP_SRC/LOBSTER/trcsms_lobster.F90
===================================================================
--- trunk/NEMO/TOP_SRC/LOBSTER/trcsms_lobster.F90	(revision 934)
+++ trunk/NEMO/TOP_SRC/LOBSTER/trcsms_lobster.F90	(revision 934)
@@ -0,0 +1,67 @@
+MODULE trcsms_lobster
+   !!======================================================================
+   !!                         ***  MODULE trcsms_lobster  ***
+   !! TOP :   Time loop of LOBSTER model
+   !!======================================================================
+   !! History :   1.0  !            M. Levy
+   !!             2.0  !  2007-12  (C. Ethe, G. Madec)  revised architecture
+   !!----------------------------------------------------------------------
+#if defined key_lobster
+   !!----------------------------------------------------------------------
+   !!   'key_lobster'                                       LOBSTER bio-model
+   !!----------------------------------------------------------------------
+   !!   trcsms_lobster        :  Time loop of passive tracers sms
+   !!----------------------------------------------------------------------
+   USE trcbio
+   USE trcopt
+   USE trcsed
+   USE trcexp
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   trc_sms_lobster    ! 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 trc_sms_lobster( kt )
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE trc_sms_lobster  ***
+      !!
+      !! ** Purpose :  Managment of the call to Biological sources and sinks 
+      !!               routines of LOBSTER bio-model 
+      !!
+      !! ** Method  : - ???
+      !! -------------------------------------------------------------------------------------
+      INTEGER, INTENT( in ) ::   kt      ! ocean time-step index      
+      !!
+
+      CALL trc_opt( kt )      ! optical model
+
+      CALL trc_bio( kt )      ! biological model
+
+      CALL trc_sed( kt )      ! sedimentation model
+
+      CALL trc_exp( kt )      ! export
+
+   END SUBROUTINE trc_sms_lobster
+
+#else
+   !!======================================================================
+   !!  Dummy module :                                     No passive tracer
+   !!======================================================================
+CONTAINS
+   SUBROUTINE trc_sms_lobster( kt )                   ! Empty routine
+      INTEGER, INTENT( in ) ::   kt
+      WRITE(*,*) 'trc_sms_lobster: You should not have seen this print! error?', kt
+   END SUBROUTINE trc_sms_lobster
+#endif 
+
+   !!======================================================================
+END MODULE  trcsms_lobster
