Index: /trunk/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zmeso.F90
===================================================================
--- /trunk/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zmeso.F90	(revision 3855)
+++ /trunk/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zmeso.F90	(revision 3856)
@@ -54,5 +54,5 @@
    !!----------------------------------------------------------------------
    !! NEMO/TOP 3.3 , NEMO Consortium (2010)
-   !! $Id: p4zmeso.F90 3295 2012-01-30 15:49:07Z cetlod $ 
+   !! $Id: p4zmeso.F90 3160 2011-11-20 14:27:18Z cetlod $ 
    !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
@@ -72,7 +72,8 @@
       REAL(wp) :: zcompadi, zcompaph, zcompapoc, zcompaz, zcompam
       REAL(wp) :: zgraze2 , zdenom, zdenom2, zncratio
-      REAL(wp) :: zfact   , zstep, zfood, zfoodlim
+      REAL(wp) :: zfact   , zstep, zfood, zfoodlim, zproport
+      REAL(wp) :: zmortzgoc, zfrac, zfracfe, zratio, zratio2
       REAL(wp) :: zepshert, zepsherv, zgrarsig, zgraztot, zgraztotf
-      REAL(wp) :: zgrarem2, zgrafer2, zgrapoc2, zprcaca, zmortz2, zmortzgoc, zgrasrat
+      REAL(wp) :: zgrarem2, zgrafer2, zgrapoc2, zprcaca, zmortz2, zgrasrat
 #if defined key_kriest
       REAL znumpoc
@@ -80,14 +81,18 @@
       REAL(wp) :: zrespz2, ztortz2, zgrazd, zgrazz, zgrazpof
       REAL(wp) :: zgrazn, zgrazpoc, zgraznf, zgrazf
-      REAL(wp) :: zgrazfff, zgrazffe
+      REAL(wp) :: zgrazfffp, zgrazfffg, zgrazffep, zgrazffeg
+      CHARACTER (len=25) :: charout
       REAL(wp) :: zrfact2
       REAL(wp), POINTER, DIMENSION(:,:,:) :: zgrazing
-      CHARACTER (len=25) :: charout
+
       !!---------------------------------------------------------------------
       !
       IF( nn_timing == 1 )  CALL timing_start('p4z_meso')
       !
-      IF( ln_diatrc .AND. lk_iomput )  CALL wrk_alloc( jpi, jpj, jpk, zgrazing )
-      !
+      IF( ln_diatrc .AND. lk_iomput ) THEN
+         CALL wrk_alloc( jpi, jpj, jpk, zgrazing )
+         zgrazing(:,:,:) = 0._wp
+      ENDIF
+
       DO jk = 1, jpkm1
          DO jj = 1, jpj
@@ -118,5 +123,5 @@
 
                zfood     = xprefc * zcompadi + xprefz * zcompaz + xprefp * zcompaph + xprefpoc * zcompapoc 
-               zfoodlim  = MAX( 0., zfood - MIN( 0.5 * zfood , xthresh2 ) )
+               zfoodlim  = MAX( 0., zfood - MIN( 0.5 * zfood, xthresh2 ) )
                zdenom    = zfoodlim / ( xkgraz2 + zfoodlim )
                zdenom2   = zdenom / ( zfood + rtrn )
@@ -135,15 +140,44 @@
                !  ----------------------------------
 # if ! defined key_kriest
-               zgrazffe  = grazflux * zstep * wsbio4(ji,jj,jk)          &
-                 &                 * tgfunc2(ji,jj,jk) * trn(ji,jj,jk,jpgoc) * trn(ji,jj,jk,jpmes)
-               zgrazfff  = zgrazffe * trn(ji,jj,jk,jpbfe) / (trn(ji,jj,jk,jpgoc) + rtrn)
+               zgrazffeg = grazflux  * zstep * wsbio4(ji,jj,jk)      &
+!                 &                   * tgfunc2(ji,jj,jk) * trn(ji,jj,jk,jpgoc) * trn(ji,jj,jk,jpmes)
+               &                     * 2. *  trn(ji,jj,jk,jpgoc) * trn(ji,jj,jk,jpmes)
+               zgrazfffg = zgrazffeg * trn(ji,jj,jk,jpbfe) / (trn(ji,jj,jk,jpgoc) + rtrn)
+# endif
+               zgrazffep = grazflux  * zstep *  wsbio3(ji,jj,jk)     &
+!                 &                   * tgfunc2(ji,jj,jk) * trn(ji,jj,jk,jppoc) * trn(ji,jj,jk,jpmes)
+               &                     * 2. * trn(ji,jj,jk,jppoc) * trn(ji,jj,jk,jpmes)
+               zgrazfffp = zgrazffep * trn(ji,jj,jk,jpsfe) / (trn(ji,jj,jk,jppoc) + rtrn)
+              !
+# if ! defined key_kriest
+              zgraztot  = zgrazd + zgrazz + zgrazn + zgrazpoc + zgrazffep + zgrazffeg
+              ! Compute the proportion of filter feeders
+              zproport  = (zgrazffep + zgrazffeg)/(rtrn + zgraztot)
+              zratio    = trn(ji,jj,jk,jpgsi) / ( trn(ji,jj,jk,jpgoc) + rtrn )
+              zratio2   = zratio * zratio
+!              zfrac =  zproport * 0.15 * zstep *                     &
+!                       ( 0.2 + 0.8 * zratio2 / ( 1.5**2 + zratio2 ) )   &
+!                      *trn(ji,jj,jk,jpmes)/3E-7 *trn(ji,jj,jk,jpgoc)
+              zfrac     = zproport * grazflux  * zstep * wsbio4(ji,jj,jk)      &
+                 &       * ( 0.1 + 3.9 * zratio2 / ( 1.**2 + zratio2 ) )       &
+                 &       * 2. * trn(ji,jj,jk,jpmes) * trn(ji,jj,jk,jpgoc) 
+
+              zfracfe   = zfrac * trn(ji,jj,jk,jpbfe) / (trn(ji,jj,jk,jpgoc) + rtrn)
+
+              zgrazffep = zproport * zgrazffep
+              zgrazffeg = zproport * zgrazffeg
+              zgrazfffp = zproport * zgrazfffp
+              zgrazfffg = zproport * zgrazfffg
+              zgraztot  = zgrazd + zgrazz + zgrazn + zgrazpoc + zgrazffep + zgrazffeg
+              zgraztotf = zgrazf + zgraznf + zgrazz * ferat3 + zgrazpof + zgrazfffp + zgrazfffg
 # else
-               zgrazffe = grazflux * zstep * wsbio3(ji,jj,jk)     &
-                 &                 * tgfunc2(ji,jj,jk) * trn(ji,jj,jk,jppoc) * trn(ji,jj,jk,jpmes)
-               zgrazfff   = zgrazffe * trn(ji,jj,jk,jpsfe) / (trn(ji,jj,jk,jppoc) + rtrn)
+              zgraztot  = zgrazd + zgrazz + zgrazn + zgrazpoc + zgrazffep
+              ! Compute the proportion of filter feeders
+              zproport  = zgrazffep / ( zgraztot + rtrn )
+              zgrazffep = zproport * zgrazffep
+              zgrazfffp = zproport * zgrazfffp
+              zgraztot  = zgrazd + zgrazz + zgrazn + zgrazpoc + zgrazffep
+              zgraztotf = zgrazf + zgraznf + zgrazz * ferat3 + zgrazpof + zgrazfffp
 # endif
-              !
-              zgraztot   = zgrazd + zgrazz + zgrazn + zgrazpoc + zgrazffe
-              zgraztotf  = zgrazf + zgraznf + zgrazz * ferat3 + zgrazpof + zgrazfff 
 
               ! Total grazing ( grazing by microzoo is already computed in p4zmicro )
@@ -179,6 +213,9 @@
                tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) + zgraztotf * unass2
 #else
-               tra(ji,jj,jk,jpgoc) = tra(ji,jj,jk,jpgoc) + zgrapoc2
-               tra(ji,jj,jk,jpbfe) = tra(ji,jj,jk,jpbfe) + zgraztotf * unass2
+               tra(ji,jj,jk,jpgoc) = tra(ji,jj,jk,jpgoc) + zgrapoc2 - zfrac 
+               tra(ji,jj,jk,jppoc) = tra(ji,jj,jk,jppoc) + zfrac
+               tra(ji,jj,jk,jpbfe) = tra(ji,jj,jk,jpbfe) + zgraztotf * unass2 - zfracfe
+               tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) + zfracfe
+
 #endif
                zmortz2 = ztortz2 + zrespz2
@@ -205,13 +242,13 @@
 #if defined key_kriest
                znumpoc = trn(ji,jj,jk,jpnum) / ( trn(ji,jj,jk,jppoc) + rtrn )
-               tra(ji,jj,jk,jppoc) = tra(ji,jj,jk,jppoc) + zmortzgoc - zgrazpoc - zgrazffe
+               tra(ji,jj,jk,jppoc) = tra(ji,jj,jk,jppoc) + zmortzgoc - zgrazpoc - zgrazffep
                tra(ji,jj,jk,jpnum) = tra(ji,jj,jk,jpnum) - zgrazpoc * znumpoc &
-                  &    + zmortzgoc  * xkr_dmeso - zgrazffe * znumpoc * wsbio4(ji,jj,jk) / ( wsbio3(ji,jj,jk) + rtrn )
-               tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) + ferat3 * zmortz2 - zgrazfff - zgrazpof
+               &   + zmortzgoc * xkr_dmeso - zgrazffep * znumpoc * wsbio4(ji,jj,jk) / ( wsbio3(ji,jj,jk) + rtrn )
+               tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) + ferat3 * zmortz2 - zgrazfffp - zgrazpof
 #else
-               tra(ji,jj,jk,jppoc) = tra(ji,jj,jk,jppoc) - zgrazpoc
-               tra(ji,jj,jk,jpgoc) = tra(ji,jj,jk,jpgoc) + zmortzgoc - zgrazffe
-               tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) - zgrazpof
-               tra(ji,jj,jk,jpbfe) = tra(ji,jj,jk,jpbfe) + ferat3 * zmortzgoc - zgrazfff
+               tra(ji,jj,jk,jppoc) = tra(ji,jj,jk,jppoc) - zgrazpoc - zgrazffep
+               tra(ji,jj,jk,jpgoc) = tra(ji,jj,jk,jpgoc) + zmortzgoc - zgrazffeg
+               tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) - zgrazpof - zgrazfffp
+               tra(ji,jj,jk,jpbfe) = tra(ji,jj,jk,jpbfe) + ferat3 * zmortzgoc - zgrazfffg
 #endif
 
