Index: trunk/NEMOGCM/NEMO/TOP_SRC/SED/sed.F90
===================================================================
--- trunk/NEMOGCM/NEMO/TOP_SRC/SED/sed.F90	(revision 2730)
+++ trunk/NEMOGCM/NEMO/TOP_SRC/SED/sed.F90	(revision 2761)
@@ -9,208 +9,178 @@
    !!----------------------------------------------------------------------
    USE par_sed
-
    USE in_out_manager
 
-   USE dom_oce , ONLY :       &
-      nidom    =>   nidom  ,  & !:
-      glamt    =>   glamt  ,  & !: longitude of t-point (degre)
-      gphit    =>   gphit  ,  & !: latitude  of t-point (degre)
-      e3t_0    =>   e3t_0  ,  & !: reference depth of t-points (m)
-      mbkt     =>   mbkt   ,  & !: vertical index of the bottom last T- ocean level
-      tmask    =>   tmask  ,  & !: land/ocean mask at t-points
-      rdt      =>   rdt         !: time step for the dynamics
+   IMPLICIT NONE
+   PUBLIC
 
-      nyear     =>   nyear    ,   & !: Current year
-      nmonth    =>   nmonth   ,   & !: Current month
-      nday      =>   nday     ,   & !: Current day
-      ndastp    =>   ndastp   ,   & !: time step date in year/month/day aammjj
-      nday_year =>   nday_year,   & !: curent day counted from jan 1st of the current year
-      adatrj    =>   adatrj         !: number of elapsed days since the begining of the run
+   PUBLIC sed_alloc   
+
+   USE dom_oce , ONLY :   nidom     =>   nidom          !:
+   USE dom_oce , ONLY :   glamt     =>   glamt          !: longitude of t-point (degre)
+   USE dom_oce , ONLY :   gphit     =>   gphit          !: latitude  of t-point (degre)
+   USE dom_oce , ONLY :   e3t_0     =>   e3t_0          !: reference depth of t-points (m)
+   USE dom_oce , ONLY :   mbkt      =>   mbkt           !: vertical index of the bottom last T- ocean level
+   USE dom_oce , ONLY :   tmask     =>   tmask          !: land/ocean mask at t-points
+   USE dom_oce , ONLY :   rdt       =>   rdt            !: time step for the dynamics
+   USE dom_oce , ONLY :   nyear     =>   nyear          !: Current year
+   USE dom_oce , ONLY :   nmonth    =>   nmonth         !: Current month
+   USE dom_oce , ONLY :   nday      =>   nday           !: Current day
+   USE dom_oce , ONLY :   ndastp    =>   ndastp         !: time step date in year/month/day aammjj
+   USE dom_oce , ONLY :   nday_year =>   nday_year      !: curent day counted from jan 1st of the current year
+   USE dom_oce , ONLY :   adatrj    =>   adatrj         !: number of elapsed days since the begining of the run
    !                                !: it is the accumulated duration of previous runs
    !                                !: that may have been run with different time steps.
 
-
 #if ! defined key_sed_off
 
-   USE oce , ONLY :            &
-      tsn      =>    tsn       & !: pot. temperature (celsius) and salinity (psu)
+   USE oce     , ONLY :  tsn        =>   tsn             !: pot. temperature (celsius) and salinity (psu)
 
-   USE trc, ONLY :  &
-      trn        , & !: tracer 
-      nwritetrc      !: outputs frequency of tracer model
+   USE trc     , ONLY :  trn        =>   trc             !: tracer 
+   USE trc     , ONLY :  nwritetrc  =>   nwritetrc       !: outputs frequency of tracer model
 
-   USE p4zsink, ONLY :  &
-      sinking  ,     & !: sinking flux for POC
+   USE p4zsink , ONLY :  sinking    =>   sinking         !: sinking flux for POC
 #if ! defined key_kriest
-      sinking2 ,     & !: sinking flux for GOC
+   USE p4zsink , ONLY :  sinking2   =>   sinking2        !: sinking flux for GOC
 #endif
-      sinkcal ,      & !: sinking flux for calcite 
-      sinksil          !: sinking flux for opal ( dsi )
+   USE p4zsink , ONLY :  sinkcal    =>   sinkcal         !: sinking flux for calcite
+   USE p4zsink , ONLY :  sinksil    =>   sinksil         !: sinking flux for opal ( dsi )
 
-   USE sms_pisces, ONLY :  &
-      akb3  ,     & 
-      ak13  ,     & 
-      ak23  ,     & 
-      akw3  ,     & 
-      aksp  ,     & 
-      borat 
+   USE sms_pisces, ONLY : akb3      =>   akb3            !: Chemical constants  
+   USE sms_pisces, ONLY : ak13      =>   ak13            !: Chemical constants  
+   USE sms_pisces, ONLY : ak23      =>   ak23            !: Chemical constants  
+   USE sms_pisces, ONLY : akw3      =>   akw3            !: Chemical constants  
+   USE sms_pisces, ONLY : aksp      =>   aksp            !: Chemical constants  
+   USE sms_pisces, ONLY : borat     =>   borat           !: Chemical constants ( borat ) 
 
 #endif   
 
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpdta) :: &
-      trc_data           !: tracer data to share with sediment model
 
-   INTEGER, PUBLIC :: &
-      nitsed000, nitsedend, nwrised, nfreq
+   !! Namelist
+   REAL(wp), PUBLIC, DIMENSION(5) ::  reac                !: reactivity rc in  [l.mol-1.s-1]
+   REAL(wp), PUBLIC               ::  reac_sil            !: reactivity of silicate in  [l.mol-1.s-1]
+   REAL(wp), PUBLIC               ::  reac_clay           !: reactivity of clay in  [l.mol-1.s-1]
+   REAL(wp), PUBLIC               ::  reac_poc            !: reactivity of poc in  [l.mol-1.s-1]
+   REAL(wp), PUBLIC               ::  reac_no3            !: reactivity of no3 in  [l.mol-1.s-1]
+   REAL(wp), PUBLIC               ::  reac_cal            !: reactivity of cal in  [l.mol-1.s-1]
+   REAL(wp), PUBLIC               ::  sat_sil             !: saturation concentration for silicate in [mol.l-1]
+   REAL(wp), PUBLIC               ::  sat_clay            !: saturation concentration for clay in [mol.l-1]
+   REAL(wp), PUBLIC               ::  so2ut 
+   REAL(wp), PUBLIC               ::  srno3 
+   REAL(wp), PUBLIC               ::  spo4r 
+   REAL(wp), PUBLIC               ::  srDnit 
+   REAL(wp), PUBLIC               ::  sthro2              !: threshold O2 concen. in [mol.l-1]
+   REAL(wp), PUBLIC               ::  pdb = 0.0112372     !: 13C/12C in PD Belemnite
+   REAL(wp), PUBLIC               ::  rc13P  = 0.980      !: 13C/12C in POC = rc13P*PDB
+   REAL(wp), PUBLIC               ::  rc13Ca = 1.001      !: 13C/12C in CaCO3 = rc13Ca*PDB
+   REAL(wp), PUBLIC               ::  dtsed               !: sedimentation time step
+   REAL(wp), PUBLIC               ::  db                  !: bioturb coefficient in [cm2.s-1]
 
-   REAL(wp), PUBLIC, DIMENSION(:,:,:) , ALLOCATABLE ::   &
-      pwcp  ,      &     !: pore water sediment data at given time-step
-      pwcp0              !: pore water sediment data at initial time
-
-   REAL(wp), PUBLIC, DIMENSION(:,:,:) , ALLOCATABLE ::   &
-      solcp ,      &     !: solid sediment data at given time-step
-      solcp0             !: solid sediment at initial time
+   INTEGER , PUBLIC               ::  nitsed000
+   INTEGER , PUBLIC               ::  nitsedend
+   INTEGER , PUBLIC               ::  nwrised
+   INTEGER , PUBLIC               ::  nfreq
+   REAL(wp), PUBLIC               ::  dens                !: density of solid material
+   !
+   REAL(wp), PUBLIC, DIMENSION(:,:,:), ALLOCATABLE ::  pwcp       !: pore water sediment data at given time-step
+   REAL(wp), PUBLIC, DIMENSION(:,:,:), ALLOCATABLE ::  pwcp0      !: pore water sediment data at initial time
+   REAL(wp), PUBLIC, DIMENSION(:,:,:), ALLOCATABLE ::  solcp      !: solid sediment data at given time-step
+   REAL(wp), PUBLIC, DIMENSION(:,:,:), ALLOCATABLE ::  solcp0     !: solid sediment data at initial time
 
    !! * Shared module variables
-   REAL(wp), PUBLIC, DIMENSION(:,:) , ALLOCATABLE ::   &
-      pwcp_dta           !: pore water data at given time-step
+   REAL(wp), PUBLIC, DIMENSION(:,:  ), ALLOCATABLE ::  pwcp_dta   !: pore water data at given time-step
+   REAL(wp), PUBLIC, DIMENSION(:,:  ), ALLOCATABLE ::  rainrm_dta !: rain data at at initial time
+   REAL(wp), PUBLIC, DIMENSION(:,:  ), ALLOCATABLE ::  rainrm     !: rain data at given time-step
+   REAL(wp), PUBLIC, DIMENSION(:,:  ), ALLOCATABLE ::  rainrg     !: rain of each solid component in [g/(cm**2.s)]
+   REAL(wp), PUBLIC, DIMENSION(:,:  ), ALLOCATABLE ::  fromsed    !:
+   REAL(wp), PUBLIC, DIMENSION(:,:  ), ALLOCATABLE ::  tosed      !:
+   REAL(wp), PUBLIC, DIMENSION(:,:  ), ALLOCATABLE ::  rloss      !: 
+   REAL(wp), PUBLIC, DIMENSION(:,:  ), ALLOCATABLE ::  tokbot        
+   !
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  temp       !: temperature
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  salt       !: salinity
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  press      !: pressure
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  raintg     !: total massic flux rained in each cell (sum of sol. comp.)
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  dzdep      !: total thickness of solid material rained [cm] in each cell
+   !
+   REAL(wp), PUBLIC, DIMENSION(:,:  ), ALLOCATABLE ::  hipor      !: [h+] in mol/kg*densSW 
+   REAL(wp), PUBLIC, DIMENSION(:,:  ), ALLOCATABLE ::  co3por     !: [co3--]solid sediment at initial time
+   REAL(wp), PUBLIC, DIMENSION(:,:  ), ALLOCATABLE ::  dz3d       !:  ???
+   REAL(wp), PUBLIC, DIMENSION(:,:  ), ALLOCATABLE ::  volw3d     !:  ???
+   REAL(wp), PUBLIC, DIMENSION(:,:  ), ALLOCATABLE ::  vols3d     !:  ???
 
-   REAL(wp), PUBLIC, DIMENSION(:,:) , ALLOCATABLE ::   &
-      rainrm_dta,  &     !: rain data at at initial time
-      rainrm    ,  &     !: rain data at given time-step
-      rainrg    ,  &     !: rain of each solid component in [g/(cm**2.s)]
-      fromsed   ,  &     !:
-      tosed     ,  &     !:
-      rloss              !: 
-
-   REAL(wp), PUBLIC, DIMENSION(:,:) , ALLOCATABLE  ::   &
-      tokbot             !: 
-
-   REAL(wp), PUBLIC, DIMENSION(:) , ALLOCATABLE  ::   & 
-      temp  ,      &     !: temperature
-      salt  ,      &     !: salinity
-      press ,      &     !: pressure
-      raintg,      &     !: total massic flux rained in each cell (sum of sol. comp.)
-      dzdep              !: total thickness of solid material rained [cm] in each cell
-
-   REAL(wp), PUBLIC, DIMENSION(:,:) , ALLOCATABLE  ::   &
-      hipor  ,     &     !: [h+] in mol/kg*densSW 
-      co3por             !: [co3--]solid sediment at initial time
-
-   REAL(wp), PUBLIC, DIMENSION(jpsol) ::   &
-      mol_wgt            !: molecular weight of solid sediment data
-
-   
-   !! Geometry
-   INTEGER, PUBLIC, SAVE :: &
-      jpoce ,  &             !: sediment points
-      indoce
-
-   INTEGER , PUBLIC, DIMENSION(:) , ALLOCATABLE  ::   &  !:
-      iarroce      !: ! Computation of 1D array of sediments points
-
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) :: &
-      epkbot             !: ocean bottom layer thickness
-
-   REAL(wp), PUBLIC, DIMENSION(:) , ALLOCATABLE  :: &
-      dzkbot             !: ocean bottom layer thickness in meters
-
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpksed) :: &
-      tmasksed           !: sediment mask
-
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) :: &
-      sbathy
- 
-   REAL(wp), PUBLIC, DIMENSION(jpksed) :: &
-      dz      ,    &     !: sediment layers thickness
-      por     ,    &     !: porosity profile     
-      por1    ,    &     !: 1 - por 
-      profsed ,    &     !: depth of middle of each layer
-      volw    ,    &     !: volume of pore water cell fraction
-      vols    ,    &     !: volume of solid cell fraction
-      diff    ,    &     !: diffusion ceofficient
-      rdtsed             !: 
-
-   REAL(wp), PUBLIC, DIMENSION(:,:) , ALLOCATABLE :: &
-      dz3d   ,     &     !: 
-      volw3d ,     &     !: 
-      vols3d             !: 
-
-   REAL(wp)  ::    &
-      dens               !: density of solid material
-
-   !! Namelist
-   REAL(wp), PUBLIC, DIMENSION(5) :: &   
-      reac               !: reactivity rc in  [l.mol-1.s-1]
-
-   REAL(wp), PUBLIC       :: &   
-      sat_sil,      &     !: saturation concentration for silicate in [mol.l-1]
-      sat_clay,     &     !:                              clay    
-      reac_sil,     &     !: reactivity rc in  [l.mol-1.s-1]
-      reac_clay,    &     
-      reac_poc,     &     
-      reac_no3,     &     
-      reac_cal         
-
-   REAL(wp), PUBLIC    :: &   
-      so2ut   ,     &     !:
-      srno3   ,     &     !: 
-      spo4r   ,     &     !:
-      srDnit  ,     &     !: 
-      sthro2              !: threshold O2 concen. in [mol.l-1]
-
-   REAL(wp), PUBLIC    :: &   
-      pdb    = 0.0112372, & !: 13C/12C in PD Belemnite
-      rc13P  = 0.980    , & !: 13C/12C in POC = rc13P*PDB
-      rc13Ca = 1.001        !: 13C/12C in CaCO3 = rc13Ca*PDB
-
-   REAL(wp) , PUBLIC ::   &
-      dtsed  ,     &     !: sedimentation time step
-      db                 !: bioturb coefficient in [cm2.s-1]
 
    !! Chemistry
-   REAL(wp), PUBLIC, DIMENSION(:) , ALLOCATABLE  :: &
-      densSW ,     &
-      borats ,     &
-      calcon2,     &
-      akbs   ,     &
-      ak1s   ,     &
-      ak2s   ,     &
-      akws   ,     &
-      ak12s  ,     &
-      ak1ps  ,     &
-      ak2ps  ,     &
-      ak3ps  ,     &
-      ak12ps ,     &
-      ak123ps,     &
-      aksis  ,     & 
-      aksps 
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  densSW 
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  borats 
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  calcon2
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  akbs  
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  ak1s 
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  ak2s   
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  akws  
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  ak12s  
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  ak1ps 
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  ak2ps  
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  ak3ps 
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  ak12ps 
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  ak123ps
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  aksis 
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  aksps 
 
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  mol_wgt    !: molecular weight of solid sediment data
+ 
+   REAL(wp), PUBLIC, DIMENSION(:,:,:), ALLOCATABLE ::  trc_data    !: tracer data to share with sediment model
+   !! Geometry
+   INTEGER , PUBLIC, SAVE                          ::  jpoce, indoce !: Ocean points ( number/indices )
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  iarroce       !: Computation of 1D array of sediments points
+   REAL(wp), PUBLIC, DIMENSION(:,:  ), ALLOCATABLE ::  epkbot        !: ocean bottom layer thickness
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  dzkbot        !: ocean bottom layer thickness in meters
+   REAL(wp), PUBLIC, DIMENSION(:,:,:), ALLOCATABLE ::  tmasksed      !: sediment mask
+   REAL(wp), PUBLIC, DIMENSION(:,:  ), ALLOCATABLE ::  sbathy        !: bathymetry
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  dz            !: sediment layers thickness
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  por           !: porosity profile     
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  por1          !: 1-por 
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  profsed       !: depth of middle of each layer
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  volw          !: volume of pore water cell fraction
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  vols          !: volume of solid cell fraction
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  diff          !: diffusion ceofficient
+   REAL(wp), PUBLIC, DIMENSION(:    ), ALLOCATABLE ::  rdtsed        !:  sediment model time-step
+   REAL(wp)  ::   dens               !: density of solid material
    !! Inputs / Outputs
-   CHARACTER( len = 80 ), DIMENSION(jptrased) :: &
-      sedtrcl
-   CHARACTER( len = 20 ), DIMENSION(jptrased) :: &
-      sedtrcd , sedtrcu
+   CHARACTER( len = 80 ), DIMENSION(jptrased  ) ::  sedtrcl
+   CHARACTER( len = 20 ), DIMENSION(jptrased  ) ::  sedtrcd , sedtrcu
+   CHARACTER( len = 80 ), DIMENSION(jpdia3dsed) ::  seddia3l 
+   CHARACTER( len = 20 ), DIMENSION(jpdia3dsed) ::  seddia3d, seddia3u
+   CHARACTER( len = 80 ), DIMENSION(jpdia2dsed) ::  seddia2l 
+   CHARACTER( len = 20 ), DIMENSION(jpdia2dsed) ::  seddia2d, seddia2u
+   !
+   REAL(wp), PUBLIC, DIMENSION(:,:,:,:), ALLOCATABLE ::  trcsedi
+   REAL(wp), PUBLIC, DIMENSION(:,:,:,:), ALLOCATABLE ::  flxsedi3d
+   REAL(wp), PUBLIC, DIMENSION(:,:,:  ), ALLOCATABLE ::  flxsedi2d
 
-   CHARACTER( len = 80 ), DIMENSION(jpdia3dsed) :: &
-      seddia3l 
-   CHARACTER( len = 20 ), DIMENSION(jpdia3dsed) :: &
-      seddia3d , seddia3u
+   INTEGER, PUBLIC ::  numsed = 27    ! units
 
-   CHARACTER( len = 80 ), DIMENSION(jpdia2dsed) :: &
-      seddia2l 
-   CHARACTER( len = 20 ), DIMENSION(jpdia2dsed) :: &
-      seddia2d , seddia2u
+CONTAINS
 
-   REAL(wp), DIMENSION(jpi,jpj,jpksed,jptrased) :: &
-      trcsedi
-   REAL(wp), DIMENSION(jpi,jpj,jpksed,jpdia3dsed) :: &
-      flxsedi3d
-   REAL(wp), DIMENSION(jpi,jpj,jpdia2dsed) :: &
-      flxsedi2d
+   INTEGER FUNCTION sed_alloc()
+      !!-------------------------------------------------------------------
+      !!                    *** ROUTINE sed_alloc ***
+      !!-------------------------------------------------------------------
+      USE lib_mpp, ONLY: ctl_warn
+      !!-------------------------------------------------------------------
+      !
+      ALLOCATE( trc_dta(jpi,jpj,jdta)                                     ,   &
+         &      epkbot(jpi,jpj), sbathy(jpi,jpj)                          ,   &
+         &      tmasksed(jpi,jpj,jpksed)                                  ,   &
+         &      dz(jpksed)  , por(jpksed) , por1(jpksed), profsed(jpksed) ,   &
+         &      volw(jpksed), vols(jpksed), diff(jpksed), rdtsed(jpksed)  ,   &
+         &      trcsedi  (jpi,jpj,jpksed,jptrased)                        ,   &
+         &      flxsedi3d(jpi,jpj,jpksed,jpdia3dsed)                      ,   &
+         &      flxsedi2d(jpi,jpj,jpksed,jpdia2dsed)                      ,   &
+         &      mol_wgt(jpsol),                                           STAT=sed_alloc )
 
-   !! Units
-   INTEGER, PUBLIC :: &
-     numsed = 27
+      IF( sed_alloc /= 0 )   CALL ctl_warn('sed_alloc: failed to allocate arrays')
+      !
+   END FUNCTION sed_alloc
+
 #else
    !!======================================================================
Index: trunk/NEMOGCM/NEMO/TOP_SRC/SED/sedadv.F90
===================================================================
--- trunk/NEMOGCM/NEMO/TOP_SRC/SED/sedadv.F90	(revision 2730)
+++ trunk/NEMOGCM/NEMO/TOP_SRC/SED/sedadv.F90	(revision 2761)
@@ -14,18 +14,12 @@
 
    !! * Module variable
-   INTEGER, PARAMETER  ::   &
-      nztime = jpksed         ! number of time step between sunrise and sunset
-   !      
-   
-   REAL(wp), DIMENSION(jpksed), SAVE :: &
-      dvolsp, dvolsm, &
-      c2por, ckpor
-
-   REAL(wp), SAVE :: &
-      por1clay , &
-      cpor   
-
-   REAL(wp) :: &
-      eps = 1.e-13
+   INTEGER, PARAMETER  ::  nztime = jpksed         ! number of time step between sunrise and sunset
+
+   REAL(wp), DIMENSION(jpksed), SAVE :: dvolsp, dvolsm
+   REAL(wp), DIMENSION(jpksed), SAVE :: c2por, ckpor
+
+   REAL(wp) :: cpor
+   REAL(wp) :: por1clay 
+   REAL(wp) :: eps = 1.e-13
 
 CONTAINS
@@ -52,23 +46,14 @@
          kt                     ! time step
       ! * local variables
-
-      INTEGER ::  &
-         ji, jk, js
-
-      INTEGER ::  &
-         jn, ntimes, ikwneg
+      INTEGER :: ji, jk, js 
+      INTEGER :: jn, ntimes, ikwneg
       
-      REAL(wp), DIMENSION(jpksed,jpsol) :: zsolcpno
-      REAL(wp), DIMENSION(jpksed)       :: zfilled, zfull, zfromup, zempty
-     
+      REAL(wp), DIMENSION(:,:), ALLOCATABLE :: zsolcpno
+      REAL(wp), DIMENSION(:  ), ALLOCATABLE :: zfilled, zfull, zfromup, zempty
       REAL(wp), DIMENSION(:,:), ALLOCATABLE :: zgap, zwb
-      REAL(wp), DIMENSION(jpoce,jpsol)      :: zrainrf
-
+      REAL(wp), DIMENSION(:,:), ALLOCATABLE :: zrainrf
       REAL(wp), DIMENSION(nztime) ::  zraipush
 
-      REAL(wp) :: &
-         zkwnup, zkwnlo, zfrac, &
-         zfromce, zrest
-
+      REAL(wp) :: zkwnup, zkwnlo, zfrac,  zfromce, zrest
 
       !------------------------------------------------------------------------
@@ -93,7 +78,7 @@
       ENDIF
 
-
-      ALLOCATE( zgap (jpoce,jpksed) )    ;   ALLOCATE( zwb(jpoce,jpksed) )
-
+      ALLOCATE( zsolcpno(jpksed,jpsol), zrainrf(jpoce,jpsol) )
+      ALLOCATE( zfilled(jpksed), zfull(jpksed), zfromup(jpksed), zempty(jpksed) )
+      ALLOCATE( zgap (jpoce,jpksed)   , zwb(jpoce,jpksed)  )  
 
       ! Initialization of data for mass balance calculation
@@ -438,6 +423,12 @@
       raintg(:)   = 0.
 
-
-      DEALLOCATE( zgap  ) ;  DEALLOCATE( zwb )
+      DEALLOCATE( zsolcpno )   
+      DEALLOCATE( zrainrf  )
+      DEALLOCATE( zfilled  )
+      DEALLOCATE( zfull    )
+      DEALLOCATE( zfromup  )
+      DEALLOCATE( zempty   )
+      DEALLOCATE( zgap     )  
+      DEALLOCATE( zwb      )
 
 
Index: trunk/NEMOGCM/NEMO/TOP_SRC/SED/sedbtb.F90
===================================================================
--- trunk/NEMOGCM/NEMO/TOP_SRC/SED/sedbtb.F90	(revision 2730)
+++ trunk/NEMOGCM/NEMO/TOP_SRC/SED/sedbtb.F90	(revision 2761)
@@ -28,14 +28,9 @@
       !!----------------------------------------------------------------------
       !!* Arguments
-      INTEGER, INTENT(in) ::  &
-         kt              ! time step
+      INTEGER, INTENT(in) ::  kt              ! time step
 
       ! * local variables
-
-      INTEGER :: &
-         ji, jk, js
-
-      REAL(wp), DIMENSION(:,:,:) , ALLOCATABLE ::  &
-         zsol                      ! solution
+      INTEGER :: ji, jk, js
+      REAL(wp), DIMENSION(:,:,:) , ALLOCATABLE ::  zsol  !   solution
       !------------------------------------------------------------------------
 
Index: trunk/NEMOGCM/NEMO/TOP_SRC/SED/sedchem.F90
===================================================================
--- trunk/NEMOGCM/NEMO/TOP_SRC/SED/sedchem.F90	(revision 2730)
+++ trunk/NEMOGCM/NEMO/TOP_SRC/SED/sedchem.F90	(revision 2761)
@@ -163,9 +163,4 @@
    DATA Ddsw / 999.842594 , 6.793952E-2 , -9.095290E-3, 1.001685E-4, -1.120083E-6, 6.536332E-9/
 
-
-   !! * Module variables
-   REAL(wp), DIMENSION(jpi,jpj,10) :: &
-      chem_data
-
 CONTAINS
 
@@ -181,22 +176,16 @@
       !!----------------------------------------------------------------------
       !!* Arguments
-      INTEGER, INTENT(in) ::  &
-         kt                     ! time step
+      INTEGER, INTENT(in) :: kt                     ! time step
 
 #if ! defined key_sed_off
-      INTEGER :: &
-         ji, jj, ikt
-
-      REAL(wp) :: &
-         ztkel, ztc, ztc2, zpres, ztr ,   &
-         zsal, zsal2, zsqrt, zsal15   ,   &
-         zis, zis2, zisqrt            ,   &
-         zdens0, zaw, zbw, zcw        ,   &
-         zbuf1, zbuf2 ,   & 
-         zcpexp, zcpexp2              ,   &
-         zck1p, zck2p, zck3p, zcksi   
-
-     REAL(wp), DIMENSION(jpi,jpj,6) :: &
-        zchem_data
+      INTEGER  :: ji, jj, ikt
+      REAL(wp) :: ztkel, ztc, ztc2, zpres, ztr 
+      REAL(wp) :: zsal, zsal2, zsqrt, zsal15  
+      REAL(wp) :: zis, zis2, zisqrt          
+      REAL(wp) :: zdens0, zaw, zbw, zcw    
+      REAL(wp) :: zbuf1, zbuf2 
+      REAL(wp) :: zcpexp, zcpexp2
+      REAL(wp) :: zck1p, zck2p, zck3p, zcksi   
+      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) ::   zchem_data
 
 #endif
@@ -213,5 +202,6 @@
 #else
       ! reading variables
-      zchem_data(:,:,:) = 0.
+      ALLOCATE( zchem_data(jpi,jpj,6) )   ;   zchem_data(:,:,:) = 0.
+
       DO jj = 1,jpj
          DO ji = 1, jpi
@@ -234,4 +224,6 @@
       CALL pack_arr ( jpoce, aksps (1:jpoce), zchem_data(1:jpi,1:jpj,5), iarroce(1:jpoce) )
       CALL pack_arr ( jpoce, borats(1:jpoce), zchem_data(1:jpi,1:jpj,6), iarroce(1:jpoce) )
+
+      DEALLOCATE( zchem_data )
 
       DO ji = 1, jpoce
@@ -320,4 +312,6 @@
          calcon2(ji) = 0.01028 * ( salt(ji) / 35. ) * densSW(ji)
       ENDDO
+
+       
 #endif
 
@@ -337,18 +331,16 @@
       !!----------------------------------------------------------------------  
       !! * Local declarations
-      INTEGER :: &
-         ji
-
-      REAL(wp) :: &
-         ztkel, ztc, ztc2, zpres, ztr ,   &
-         zsal, zsal2, zsqrt, zsal15   ,   &
-         zis, zis2, zisqrt            ,   &
-         zdens0, zaw, zbw, zcw        ,   &
-         zchl, zst, zft, zbuf1, zbuf2 ,   & 
-         zcpexp, zcpexp2              ,   &
-         zckb, zck1, zck2, zckw       ,   &
-         zck1p, zck2p, zck3p, zcksi   ,   &
-         zak1, zak2, zakb, zakw       ,   &        
-         zaksp0, zksp, zks, zkf 
+      INTEGER :: ji
+
+      REAL(wp) ::  ztkel, ztc, ztc2, zpres, ztr 
+      REAL(wp) ::  zsal, zsal2, zsqrt, zsal15   
+      REAL(wp) ::  zis, zis2, zisqrt            
+      REAL(wp) ::  zdens0, zaw, zbw, zcw        
+      REAL(wp) ::  zchl, zst, zft, zbuf1, zbuf2 
+      REAL(wp) ::  zcpexp, zcpexp2              
+      REAL(wp) ::  zckb, zck1, zck2, zckw       
+      REAL(wp) ::  zck1p, zck2p, zck3p, zcksi   
+      REAL(wp) ::  zak1, zak2, zakb, zakw              
+      REAL(wp) ::  zaksp0, zksp, zks, zkf 
 
 
Index: trunk/NEMOGCM/NEMO/TOP_SRC/SED/sedco3.F90
===================================================================
--- trunk/NEMOGCM/NEMO/TOP_SRC/SED/sedco3.F90	(revision 2730)
+++ trunk/NEMOGCM/NEMO/TOP_SRC/SED/sedco3.F90	(revision 2761)
@@ -17,6 +17,5 @@
 
    !! * Module variables
-   REAL(wp) ::           & !! 
-      epsmax   =  1.e-12      ! convergence limite value
+   REAL(wp) :: epsmax   =  1.e-12      ! convergence limite value
 
    !!----------------------------------------------------------------------
@@ -44,32 +43,21 @@
       !!----------------------------------------------------------------------
       !! * Arguments
-      INTEGER, INTENT(in)  :: &
-         kt   ! time step
+      INTEGER, INTENT(in)  :: kt   ! time step
 
       !
       !---Local variables
-      INTEGER :: &
-         jiter, ji, jk, ipt    ! dummy loop indices
-
-      INTEGER :: &
-         itermax    ,  &  ! maximum number of Newton-Raphson iterations
-         itime            ! number of time to perform Newton-Raphson algorithm
-
-      LOGICAL :: &
-         lconv = .FALSE.           ! flag for convergence
-
-      REAL(wp) ::      & 
-         brems            ! relaxation. parameter
-
-      REAL(wp) ::      &  ! temporay variables
-         zresm, zresm1, zhipor_min , &
-         zalk, zbor, zsil, zpo4, zdic, &
-         zh_old, zh_old2, zh_old3, zh_old4, &
-         zuu, zvv, zduu, zdvv , &
-         zup, zvp, zdup, zdvp , &
-         zah_old, zah_olds,     &
-         zh_new, zh_new2,       &
-         zco3
-
+      INTEGER  :: jiter, ji, jk, ipt  ! dummy loop indices
+
+      INTEGER  :: itermax             ! maximum number of Newton-Raphson iterations
+      INTEGER  :: itime               ! number of time to perform Newton-Raphson algorithm
+      LOGICAL  :: lconv = .FALSE.     ! flag for convergence
+      REAL(wp) :: brems               !  relaxation. parameter
+      REAL(wp) :: zresm, zresm1, zhipor_min 
+      REAL(wp) :: zalk, zbor, zsil, zpo4, zdic
+      REAL(wp) :: zh_old, zh_old2, zh_old3, zh_old4
+      REAL(wp) :: zuu, zvv, zduu, zdvv 
+      REAL(wp) :: zup, zvp, zdup, zdvp
+      REAL(wp) :: zah_old, zah_olds
+      REAL(wp) :: zh_new, zh_new2, zco3
 
      !!----------------------------------------------------------------------
Index: trunk/NEMOGCM/NEMO/TOP_SRC/SED/seddsr.F90
===================================================================
--- trunk/NEMOGCM/NEMO/TOP_SRC/SED/seddsr.F90	(revision 2730)
+++ trunk/NEMOGCM/NEMO/TOP_SRC/SED/seddsr.F90	(revision 2761)
@@ -14,13 +14,10 @@
    !! * Module variables
 
-   REAL(wp), DIMENSION(:), PUBLIC, ALLOCATABLE :: &
-      cons_o2   , &
-      cons_no3  , &
-      sour_no3  , &
-      sour_c13
-
-    REAL(wp), DIMENSION(jpsol), PUBLIC :: &
-       dens_mol_wgt
-  
+   REAL(wp), DIMENSION(:), ALLOCATABLE, PUBLIC :: cons_o2
+   REAL(wp), DIMENSION(:), ALLOCATABLE, PUBLIC :: cons_no3
+   REAL(wp), DIMENSION(:), ALLOCATABLE, PUBLIC :: sour_no3
+   REAL(wp), DIMENSION(:), ALLOCATABLE, PUBLIC :: sour_c13
+   REAL(wp), DIMENSION(:), ALLOCATABLE, PUBLIC ::  dens_mol_wgt  ! molecular density 
+
 CONTAINS
    
@@ -49,26 +46,15 @@
       INTEGER, INTENT(in) ::   kt       ! number of iteration
       ! --- local variables
-      INTEGER :: &
-         ji, jk, js, jw
-      
-      INTEGER  ::    &
-         nv                        ! number of variables in linear tridiagonal eq
-   
-      REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: &
-         zrearat,  &            ! reaction rate in pore water
-         zundsat                ! undersaturation ; indice jpwatp1 is for calcite   
-     
-      REAL(wp), DIMENSION(:) , ALLOCATABLE :: &    ! temp. variables
-         zmo2_0 , zmo2_1 ,    &          ! mass balance calculation
-         zmno3_0, zmno3_1, zmno3_2,    &
-         zmc13_0, zmc13_1, zmc13_2, zmc13_3
- 
-      REAL(wp), DIMENSION(:,:,:) , ALLOCATABLE :: &    ! temp. variables
-         zvolc
-
-      REAL(wp)  ::  &
-         zsolid1, zsolid2, zsolid3, &
-         zvolw, zreasat
-      
+      INTEGER :: ji, jk, js, jw   ! dummy looop indices
+      INTEGER :: nv               ! number of variables in linear tridiagonal eq
+
+      REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: zrearat    ! reaction rate in pore water
+      REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: zundsat    ! undersaturation ; indice jpwatp1 is for calcite   
+      REAL(wp), DIMENSION(:    ), ALLOCATABLE :: zmo2_0, zmo2_1  ! temp. array for mass balance calculation
+      REAL(wp), DIMENSION(:    ), ALLOCATABLE :: zmno3_0, zmno3_1, zmno3_2
+      REAL(wp), DIMENSION(:    ), ALLOCATABLE :: zmc13_0, zmc13_1, zmc13_2, zmc13_3
+      REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: zvolc    ! temp. variables
+      REAL(wp)  ::  zsolid1, zsolid2, zsolid3, zvolw, zreasat
+
       !!
       !!----------------------------------------------------------------------
@@ -77,9 +63,10 @@
          WRITE(numsed,*) ' sed_dsr : Dissolution reaction '
          WRITE(numsed,*) ' '
+         ! 
+         ALLOCATE( dens_mol_wgt((jpoce) ) 
          dens_mol_wgt(1:jpsol) = dens / mol_wgt(1:jpsol)
-
+         ! 
          ALLOCATE( cons_o2 (jpoce) ) ;   ALLOCATE( cons_no3(jpoce) ) 
          ALLOCATE( sour_no3(jpoce) ) ;   ALLOCATE( sour_c13(jpoce) )  
-    
       ENDIF
 
Index: trunk/NEMOGCM/NEMO/TOP_SRC/SED/seddta.F90
===================================================================
--- trunk/NEMOGCM/NEMO/TOP_SRC/SED/seddta.F90	(revision 2730)
+++ trunk/NEMOGCM/NEMO/TOP_SRC/SED/seddta.F90	(revision 2761)
@@ -17,18 +17,13 @@
 
    !! *  Module variables
-   REAL(wp), DIMENSION(:), ALLOCATABLE :: &
-      smask       ! mask for sediments points
-
-   REAL(wp) ::  &
-      rsecday  , &  ! number of second per a day
-      conv1    , &  ! [m/day]--->[cm/s]  
-      conv2         ! [kg/m2/month]-->[g/cm2/s] ( 1 month has 30 days )
-
-   INTEGER ::     &
-     numbio 
+   REAL(wp), DIMENSION(:), ALLOCATABLE ::  smask       ! mask for sediments points
+   REAL(wp) ::  rsecday  ! number of second per a day
+   REAL(wp) ::  conv1    ! [m/day]--->[cm/s]  
+   REAL(wp) ::  conv2    ! [kg/m2/month]-->[g/cm2/s] ( 1 month has 30 days )
+
+   INTEGER ::  numbio
 
 #if defined key_sed_off
-   INTEGER ::     &
-     numoce
+   INTEGER ::  numoce
 #endif
 
@@ -53,13 +48,12 @@
 
       !! Arguments
-      INTEGER, INTENT(in) :: &
-         kt
+      INTEGER, INTENT(in) ::  kt    ! time-step
 
       !! * Local declarations
       INTEGER  ::  ji, jj, js, jw, ikt
 
-      REAL(wp) , DIMENSION (jpi,jpj) :: zdta
+      REAL(wp), DIMENSION(:,:), ALLOCATABLE :: zdta
 #if ! defined key_kriest
-      REAL(wp) , DIMENSION (:), ALLOCATABLE  :: zdtap , zdtag
+      REAL(wp), DIMENSION(:)  , ALLOCATABLE :: zdtap, zdtag
 #endif 
 
@@ -90,4 +84,5 @@
 
          ! Compute sediment mask
+         ALLOCATE( zdta(jpi,jpj) ) 
          DO jj = 1, jpj
             DO ji = 1, jpi
@@ -104,6 +99,6 @@
 #if ! defined key_kriest   
       ! Initialization of temporaries arrays  
-      ALLOCATE( zdtap   (jpoce) )    ;   zdtap(:)    = 0. 
-      ALLOCATE( zdtag   (jpoce) )    ;   zdtag(:)    = 0.  
+      ALLOCATE( zdtap(jpoce) )    ;   zdtap(:)    = 0. 
+      ALLOCATE( zdtag(jpoce) )    ;   zdtag(:)    = 0.  
 #endif
 
@@ -255,4 +250,5 @@
 
 
+      DEALLOCATE( zdta ) 
 #if ! defined key_kriest
       DEALLOCATE( zdtap    ) ;  DEALLOCATE( zdtag    ) 
Index: trunk/NEMOGCM/NEMO/TOP_SRC/SED/sedini.F90
===================================================================
--- trunk/NEMOGCM/NEMO/TOP_SRC/SED/sedini.F90	(revision 2730)
+++ trunk/NEMOGCM/NEMO/TOP_SRC/SED/sedini.F90	(revision 2761)
@@ -79,5 +79,5 @@
       INTEGER  :: numblt         
       INTEGER  :: nummsh   
-      REAL(wp) , DIMENSION(jpi,jpj) :: zdta
+      REAL(wp), ALLOCATABLE, DIMENSION(:,:) :: zdta
 #endif
       !!----------------------------------------------------------------------
@@ -99,4 +99,8 @@
       WRITE(numsed,*) ' sed_init : Initialization of sediment module  '
       WRITE(numsed,*) ' '
+
+      !                                ! Allocate LOBSTER arrays
+      IF( sed_alloc() /= 0 )   CALL ctl_stop( 'STOP', 'sed_ini: unable to allocate sediment model arrays' )
+
 
       ! Determination of sediments number of points and allocate global variables
@@ -118,4 +122,5 @@
     
       ! bottom layer thickness
+      ALLOCATE( zdta(jpi,jpj) )
       CALL iom_get  ( numblt, jpdom_data, 'E3TBOT', zdta(:,:) )
       epkbot(:,:) = 0.
@@ -129,4 +134,6 @@
       CALL iom_close( nummsh )  
       CALL iom_close( numblt ) 
+
+      DEALLOCATE( zdta )
 #else
 
Index: trunk/NEMOGCM/NEMO/TOP_SRC/SED/sedmat.F90
===================================================================
--- trunk/NEMOGCM/NEMO/TOP_SRC/SED/sedmat.F90	(revision 2730)
+++ trunk/NEMOGCM/NEMO/TOP_SRC/SED/sedmat.F90	(revision 2761)
@@ -47,28 +47,20 @@
        !!----------------------------------------------------------------------
        !! * Arguments
-       INTEGER , INTENT(in) :: &
-          nvar , &  ! number of variables
-          ndim , &  ! number of points
-          nlev      ! number of sediment levels
-
-       REAL(wp), DIMENSION(ndim,nlev,nvar), INTENT(in) :: &
-          preac     ! reaction rates
-
-       REAL(wp), DIMENSION(ndim,nlev,nvar), INTENT(inout) :: &
-          psol         ! solution ( undersaturation values )
-
-
+       INTEGER , INTENT(in) ::  nvar  ! number of variables
+       INTEGER , INTENT(in) ::  ndim  ! number of points
+       INTEGER , INTENT(in) ::  nlev  ! number of sediment levels
+
+       REAL(wp), DIMENSION(ndim,nlev,nvar), INTENT(in   ) :: preac  ! reaction rates
+       REAL(wp), DIMENSION(ndim,nlev,nvar), INTENT(inout) :: psol   ! solution ( undersaturation values )
+ 
        !---Local declarations
-       INTEGER  ::  &
-          ji, jk, jn
-
+       INTEGER  ::  ji, jk, jn
        REAL(wp), DIMENSION(ndim,nlev) :: za, zb, zc, zr
        REAL(wp), DIMENSION(ndim)      :: zbet
        REAL(wp), DIMENSION(ndim,nmax) :: zgamm
 
-       REAL(wp) ::  &
-          aplus,aminus   ,  & 
-          rplus,rminus   ,  &
-          dxplus,dxminus
+       REAL(wp) ::  aplus,aminus  
+       REAL(wp) ::  rplus,rminus   
+       REAL(wp) ::  dxplus,dxminus
 
        !----------------------------------------------------------------------
Index: trunk/NEMOGCM/NEMO/TOP_SRC/SED/sedmbc.F90
===================================================================
--- trunk/NEMOGCM/NEMO/TOP_SRC/SED/sedmbc.F90	(revision 2730)
+++ trunk/NEMOGCM/NEMO/TOP_SRC/SED/sedmbc.F90	(revision 2761)
@@ -20,23 +20,19 @@
 
    !! * Module variables
-   REAL(wp), DIMENSION(jpsol) :: &
-      rain_tot     ,  &      !
-      fromsed_tot  ,  &      ! 
-      tosed_tot    ,  &      !
-      rloss_tot              !
-
-   REAL(wp), DIMENSION(jpwat) :: &
-      diss_in_tot  ,  &      !
-      diss_out_tot           !
-
-   REAL(wp)  :: &
-      cons_tot_o2  ,  &      !
-      sour_tot_no3 ,  &      !
-      cons_tot_no3 ,  &      !
-      sour_tot_c13           !
-
-   REAL(wp) ::  &
-      src13p  , &
-      src13ca
+   REAL(wp), DIMENSION(jpsol) :: rain_tot      ! total input rain
+   REAL(wp), DIMENSION(jpsol) :: fromsed_tot   ! tota input from sediment
+   REAL(wp), DIMENSION(jpsol) :: tosed_tot     ! total output from sediment
+   REAL(wp), DIMENSION(jpsol) :: rloss_tot     ! total rain loss
+
+   REAL(wp), DIMENSION(jpwat) :: diss_in_tot   ! total input in pore water
+   REAL(wp), DIMENSION(jpwat) :: diss_out_tot  ! total output from pore water
+
+   REAL(wp)  :: cons_tot_o2                   ! cumulative o2 consomation
+   REAL(wp)  :: sour_tot_no3                  ! cumulative no3 source
+   REAL(wp)  :: cons_tot_no3                  ! cumulative no3 consomation
+   REAL(wp)  :: sour_tot_c13                  ! cumulative o2 source
+
+   REAL(wp)  :: src13p  
+   REAL(wp)  :: src13ca  
 
 CONTAINS
@@ -60,29 +56,17 @@
 
       !! Arguments
-      INTEGER, INTENT(in) :: &
-         kt
+      INTEGER, INTENT(in) :: kt     ! time step
 
       !! local declarations
-      INTEGER  :: &
-         ji, js, jw, jk
-
-      REAL(wp) ::  &
-         zinit, zfinal, &
-         zinput, zoutput
-
-      REAL(wp) ::  &
-         zdsw, zvol
-
-      REAL, DIMENSION(jpsol) ::  &
-         zsolcp_inv_i, zsolcp_inv_f
-
-      REAL, DIMENSION(jpwat) ::  &
-         zpwcp_inv_i, zpwcp_inv_f
-       
-      REAL(wp) :: &
-         zdelta_sil, zdelta_clay, &
-         zdelta_co2, zdelta_oxy,  &
-         zdelta_po4, zdelta_no3,  &
-         zdelta_c13, zdelta_c13b
+      INTEGER  :: ji,js, jw, jk
+      REAL(wp) :: zinit, zfinal 
+      REAL(wp) :: zinput, zoutput
+      REAL(wp) :: zdsw, zvol
+      REAL, DIMENSION(jpsol) :: zsolcp_inv_i, zsolcp_inv_f
+      REAL, DIMENSION(jpwat) :: zpwcp_inv_i, zpwcp_inv_f
+      REAL(wp) ::  zdelta_sil, zdelta_clay
+      REAL(wp) ::  zdelta_co2, zdelta_oxy
+      REAL(wp) ::  zdelta_po4, zdelta_no3
+      REAL(wp) ::  zdelta_c13, zdelta_c13b
 
       !!----------------------------------------------------------------------
Index: trunk/NEMOGCM/NEMO/TOP_SRC/SED/sedrst.F90
===================================================================
--- trunk/NEMOGCM/NEMO/TOP_SRC/SED/sedrst.F90	(revision 2730)
+++ trunk/NEMOGCM/NEMO/TOP_SRC/SED/sedrst.F90	(revision 2761)
@@ -43,15 +43,8 @@
 
       !! * local declarations
-      INTEGER :: &
-         ji, jk, jn
-      REAL(wp), DIMENSION(jpi,jpj,jpksed,jptrased) :: &
-         zdta
-
-      REAL(wp), DIMENSION(jpi,jpj,jpksed,2) :: &
-         zdta1
-
-      REAL(wp), DIMENSION(:,:), ALLOCATABLE :: &
-         zhipor
-
+      INTEGER :: ji, jk, jn 
+      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:) :: zdta
+      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:  ) :: zdta1 
+      REAL(wp), ALLOCATABLE, DIMENSION(:,:    ) :: zhipor
       REAL(wp) :: zkt
       CHARACTER(len = 20) ::   cltra
@@ -65,5 +58,5 @@
       WRITE(numsed,*) ' '
 
-      ALLOCATE( zhipor(jpoce,jpksed) ) 
+      ALLOCATE( zdta(jpi,jpj,jpksed,jptrased), zdta1(jpi,jpj,jpksed,2), zhipor(jpoce,jpksed) ) 
 
       IF ( jprstlib == jprstdimg ) THEN
@@ -144,4 +137,6 @@
       pwcp (1:jpoce,1,:) = 0.
 
+      DEALLOCATE( zdta   )
+      DEALLOCATE( zdta1  )
       DEALLOCATE( zhipor )
      
@@ -162,20 +157,10 @@
       INTEGER, INTENT(in) ::   kt       ! number of iteration
       !! * local declarations
-
-      CHARACTER (len=50) :: clname,cln
-
-      INTEGER ::  &
-         ic,jc,jn,      &
-         itime
-
-     REAL(wp) ::  &
-         zdate0
-
-     REAL(wp), DIMENSION(1) :: &
-        zinfo
-
-      CHARACTER(len = 20)  ::  cltra 
-
-      INTEGER   :: ji, jk
+      INTEGER  :: ji, jk
+      INTEGER  :: ic, jc, jn, itime 
+      REAL(wp) :: zdate0
+      REAL(wp), DIMENSION(1) ::  zinfo
+      CHARACTER(len=50) :: clname,cln
+      CHARACTER(len=20) :: cltra 
       REAL(wp), DIMENSION(:,:) , ALLOCATABLE  :: zdta   
       !! -----------------------------------------------------------------------
Index: trunk/NEMOGCM/NEMO/TOP_SRC/SED/sedsfc.F90
===================================================================
--- trunk/NEMOGCM/NEMO/TOP_SRC/SED/sedsfc.F90	(revision 2730)
+++ trunk/NEMOGCM/NEMO/TOP_SRC/SED/sedsfc.F90	(revision 2761)
@@ -25,11 +25,8 @@
       !!----------------------------------------------------------------------
       !!* Arguments
-      INTEGER, INTENT(in) ::  &
-         kt              ! time step
+      INTEGER, INTENT(in) ::  kt              ! time step
 
       ! * local variables
-      INTEGER :: &
-         ji, jj, ikt     ! dummy loop indices
-
+      INTEGER :: ji, jj, ikt     ! dummy loop indices
 
       !------------------------------------------------------------------------
Index: trunk/NEMOGCM/NEMO/TOP_SRC/SED/sedwri.F90
===================================================================
--- trunk/NEMOGCM/NEMO/TOP_SRC/SED/sedwri.F90	(revision 2730)
+++ trunk/NEMOGCM/NEMO/TOP_SRC/SED/sedwri.F90	(revision 2761)
@@ -7,4 +7,6 @@
    USE sed
    USE sedarr
+   USE ioipsl
+   USE dianam    ! build name of file (routine)
 
    IMPLICIT NONE
@@ -13,4 +15,13 @@
    !! * Accessibility
    PUBLIC sed_wri 
+
+   INTEGER  :: nised
+   INTEGER  :: nhorised
+   INTEGER  :: ndimt52
+   INTEGER  :: ndimt51
+   INTEGER  :: ndepsed
+   REAL(wp) :: zjulian
+   INTEGER, ALLOCATABLE, SAVE, DIMENSION(:) :: ndext52  
+   INTEGER, ALLOCATABLE, SAVE, DIMENSION(:) :: ndext51
 
 CONTAINS
@@ -28,24 +39,15 @@
       !!        !  06-07  (C. Ethe)  original
       !!----------------------------------------------------------------------
-      !! * Local variables
-      USE ioipsl
-      USE dianam    ! build name of file (routine)
 
       INTEGER, INTENT(in) :: kt
 
       CHARACTER(len = 60)  ::  clhstnam, clop
-      INTEGER , SAVE :: nised, nhorised, ndimt52, ndimt51, ndepsed
-      REAL(wp), SAVE :: zjulian
-      INTEGER , DIMENSION(jpij*jpksed) , SAVE :: ndext52  
-      INTEGER , DIMENSION(jpij) , SAVE :: ndext51
+      INTEGER  :: ji, jk, js, jw, jn
       REAL(wp) :: zsto,zout, zdt
-      INTEGER :: iimi, iima, ijmi, ijma,ipk, it, itmod
-      INTEGER :: jn
+      INTEGER  :: iimi, iima, ijmi, ijma,ipk, it, itmod
       CHARACTER(len = 20)  ::  cltra , cltrau
       CHARACTER(len = 80)  ::  cltral
-
-      INTEGER   :: ji, jk, js, jw
       REAL(wp)  :: zrate
-      REAL(wp), DIMENSION(:,:) , ALLOCATABLE  :: zdta, zflx
+      REAL(wp), ALLOCATABLE, DIMENSION(:,:) :: zdta, zflx
 
       !!-------------------------------------------------------------------
@@ -54,5 +56,5 @@
       ! Initialisation
       ! ----------------- 
-
+      IF( kt == nit000 )   ALLOCATE( ndext52(jpij*jpksed), ndext51(jpij) )
 
       ! Define frequency of output and means
