Index: /trunk/NEMOGCM/CONFIG/AMM12/EXP00/namelist
===================================================================
--- /trunk/NEMOGCM/CONFIG/AMM12/EXP00/namelist	(revision 3603)
+++ /trunk/NEMOGCM/CONFIG/AMM12/EXP00/namelist	(revision 3604)
@@ -3,5 +3,5 @@
 !! namelists    2 - Domain           (namzgr, namzgr_sco, namdom, namtsd)
 !!              3 - Surface boundary (namsbc, namsbc_ana, namsbc_flx, namsbc_clio, namsbc_core
-!!                                    namsbc_cpl, namtra_qsr, namsbc_rnf, 
+!!                                    namsbc_cpl, namtra_qsr, namsbc_rnf,
 !!                                    namsbc_apr, namsbc_ssr, namsbc_alb)
 !!              4 - lateral boundary (namlbc, namcla, namobc, namagrif, nambdy, nambdy_tide)
@@ -25,5 +25,5 @@
 !-----------------------------------------------------------------------
    nn_no       =       0   !  job number (no more used...)
-   cn_exp      =  "AMM12"  !  experience name 
+   cn_exp      =  "AMM12"  !  experience name
    nn_it000    =       1   !  first time step
    nn_itend    =     576   !  last  time step (std 1 day = 576)
@@ -52,5 +52,5 @@
 !!   namzgr_sco   s-coordinate or hybrid z-s-coordinate
 !!   namdom       space and time domain (bathymetry, mesh, timestep)
-!!   namtsd       data: temperature & salinity                         
+!!   namtsd       data: temperature & salinity
 !!======================================================================
 !
@@ -72,5 +72,5 @@
    ln_s_sigma  = .true.    !  hybrid s-sigma coordinates
    rn_bb       =    0.8    !  stretching with s-sigma
-   rn_hc       =  150.0    !  critical depth with s-sigma 
+   rn_hc       =  150.0    !  critical depth with s-sigma
 /
 !-----------------------------------------------------------------------
@@ -94,5 +94,5 @@
 /
 !-----------------------------------------------------------------------
-&namtsd    !   data : Temperature  & Salinity                           
+&namtsd    !   data : Temperature  & Salinity
 !-----------------------------------------------------------------------
 !          ! file name ! frequency (hours)    ! variable ! time interp. ! clim  !'yearly' or ! weights  ! rotation !
@@ -129,6 +129,6 @@
    ln_ana      = .false    !  analytical formulation (T => fill namsbc_ana )
    ln_flx      = .true.    !  flux formulation       (T => fill namsbc_flx )
-   ln_blk_clio = .false.   !  CLIO bulk formulation                     (T => fill namsbc_clio) 
-   ln_blk_core = .false.   !  CORE bulk formulation                     (T => fill namsbc_core) 
+   ln_blk_clio = .false.   !  CLIO bulk formulation                     (T => fill namsbc_clio)
+   ln_blk_core = .false.   !  CORE bulk formulation                     (T => fill namsbc_core)
    ln_blk_mfs  = .false.   !  MFS bulk formulation                      (T => fill namsbc_mfs )
    ln_cpl      = .false.   !  Coupled formulation                       (T => fill namsbc_cpl )
@@ -140,6 +140,6 @@
    ln_rnf      = .true.    !  runoffs                                   (T => fill namsbc_rnf)
    ln_ssr      = .false.   !  Sea Surface Restoring on T and/or S       (T => fill namsbc_ssr)
-   nn_fwb      = 0         !  FreshWater Budget: =0 unchecked 
-                           !     =1 global mean of e-p-r set to zero at each time step 
+   nn_fwb      = 0         !  FreshWater Budget: =0 unchecked
+                           !     =1 global mean of e-p-r set to zero at each time step
                            !     =2 annual global mean of e-p-r set to zero
                            !     =3 global emp set to zero and spread out over erp area
@@ -167,5 +167,5 @@
    sn_emp      = 'amm12_flx'      ,          3        ,  'sowafldo'  ,  .true.      , .false. , 'daily'   ,  ''      ,  ''
    cn_dir      = './fluxes/'        !  root directory for the location of the flux files
-/      
+/
 !-----------------------------------------------------------------------
 &namsbc_clio   !   namsbc_clio  CLIO bulk formulae
@@ -224,20 +224,20 @@
 !                    !                       ! categories !  reference  !    orientation       ! grids  !
 ! send
-sn_snd_temp   =       'weighted oce and ice' ,    'no'    ,     ''      ,         ''           ,   ''    
-sn_snd_alb    =       'weighted ice'         ,    'no'    ,     ''      ,         ''           ,   ''    
-sn_snd_thick  =       'none'                 ,    'no'   ,     ''      ,         ''           ,   ''    
-sn_snd_crt    =       'none'                 ,    'no'    , 'spherical' , 'eastward-northward' ,  'T'       
-sn_snd_co2    =       'coupled'              ,    'no'    ,     ''      ,         ''           ,   ''        
+sn_snd_temp   =       'weighted oce and ice' ,    'no'    ,     ''      ,         ''           ,   ''
+sn_snd_alb    =       'weighted ice'         ,    'no'    ,     ''      ,         ''           ,   ''
+sn_snd_thick  =       'none'                 ,    'no'   ,     ''      ,         ''           ,   ''
+sn_snd_crt    =       'none'                 ,    'no'    , 'spherical' , 'eastward-northward' ,  'T'
+sn_snd_co2    =       'coupled'              ,    'no'    ,     ''      ,         ''           ,   ''
 ! receive
-sn_rcv_w10m   =       'none'                 ,    'no'    ,     ''      ,         ''          ,   ''    
-sn_rcv_taumod =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''    
-sn_rcv_tau    =       'oce only'             ,    'no'    , 'cartesian' , 'eastward-northward',  'U,V'   
-sn_rcv_dqnsdt =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''    
-sn_rcv_qsr    =       'oce and ice'          ,    'no'    ,     ''      ,         ''          ,   ''    
-sn_rcv_qns    =       'oce and ice'          ,    'no'    ,     ''      ,         ''          ,   ''    
-sn_rcv_emp    =       'conservative'         ,    'no'    ,     ''      ,         ''          ,   ''    
-sn_rcv_rnf    =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''    
-sn_rcv_cal    =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''    
-sn_rcv_co2    =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''    
+sn_rcv_w10m   =       'none'                 ,    'no'    ,     ''      ,         ''          ,   ''
+sn_rcv_taumod =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''
+sn_rcv_tau    =       'oce only'             ,    'no'    , 'cartesian' , 'eastward-northward',  'U,V'
+sn_rcv_dqnsdt =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''
+sn_rcv_qsr    =       'oce and ice'          ,    'no'    ,     ''      ,         ''          ,   ''
+sn_rcv_qns    =       'oce and ice'          ,    'no'    ,     ''      ,         ''          ,   ''
+sn_rcv_emp    =       'conservative'         ,    'no'    ,     ''      ,         ''          ,   ''
+sn_rcv_rnf    =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''
+sn_rcv_cal    =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''
+sn_rcv_co2    =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''
 /
 !-----------------------------------------------------------------------
@@ -305,12 +305,12 @@
    ln_sssr_bnd =   .true.  !  flag to bound erp term (associated with nn_sssr=2)
    rn_sssr_bnd =   4.e0    !  ABS(Max/Min) value of the damping erp term [mm/day]
-/      
+/
 !-----------------------------------------------------------------------
 &namsbc_alb    !   albedo parameters
 !-----------------------------------------------------------------------
-   rn_cloud    =    0.06   !  cloud correction to snow and ice albedo 
+   rn_cloud    =    0.06   !  cloud correction to snow and ice albedo
    rn_albice   =    0.53   !  albedo of melting ice in the arctic and antarctic
    rn_alphd    =    0.80   !  coefficients for linear interpolation used to
-   rn_alphc    =    0.65   !  compute albedo between two extremes values 
+   rn_alphc    =    0.65   !  compute albedo between two extremes values
    rn_alphdi   =    0.72   !  (Pyane, 1972)
 /
@@ -322,5 +322,5 @@
 !!   namcla        cross land advection
 !!   namobc        open boundaries parameters                           ("key_obc")
-!!   namagrif      agrif nested grid ( read by child model only )       ("key_agrif") 
+!!   namagrif      agrif nested grid ( read by child model only )       ("key_agrif")
 !!   nambdy        Unstructured open boundaries                         ("key_bdy")
 !!   namtide       Tidal forcing at open boundaries                     ("key_bdy_tides")
@@ -344,5 +344,5 @@
    ln_obc_clim = .false.   !  climatological obc data files (T) or not (F)
    ln_vol_cst  = .true.    !  impose the total volume conservation (T) or not (F)
-   ln_obc_fla  = .false.   !  Flather open boundary condition 
+   ln_obc_fla  = .false.   !  Flather open boundary condition
    nn_obcdta   =    1      !  = 0 the obc data are equal to the initial state
                            !  = 1 the obc data are read in 'obc.dta' files
@@ -388,5 +388,5 @@
 &nambdy        !  unstructured open boundaries                          ("key_bdy")
 !-----------------------------------------------------------------------
-    nb_bdy = 1                            !  number of open boundary sets       
+    nb_bdy = 1                            !  number of open boundary sets
     ln_coords_file = .true.               !  =T : read bdy coordinates from file
     cn_coords_file = 'coordinates.bdy.nc' !  bdy coordinates files
@@ -424,5 +424,5 @@
 /
 !-----------------------------------------------------------------------
-&nambdy_tide     ! tidal forcing at open boundaries              
+&nambdy_tide     ! tidal forcing at open boundaries
 !-----------------------------------------------------------------------
    filtide      = 'bdydta/amm12_bdytide_'         !  file name root of tidal forcing files
@@ -463,5 +463,5 @@
 !!======================================================================
 !!   nambfr        bottom friction
-!!   nambbc        bottom temperature boundary condition               
+!!   nambbc        bottom temperature boundary condition
 !!   nambbl        bottom boundary layer scheme                         ("key_trabbl")
 !!======================================================================
@@ -483,7 +483,7 @@
 !-----------------------------------------------------------------------
    ln_trabbc   = .false.   !  Apply a geothermal heating at the ocean bottom
-   nn_geoflx   =    2      !  geothermal heat flux: = 0 no flux 
+   nn_geoflx   =    2      !  geothermal heat flux: = 0 no flux
                            !     = 1 constant flux
-                           !     = 2 variable flux (read in geothermal_heating.nc in mW/m2) 
+                           !     = 2 variable flux (read in geothermal_heating.nc in mW/m2)
    rn_geoflx_cst = 86.4e-3 !  Constant value of geothermal heat flux [W/m2]
 /
@@ -503,5 +503,5 @@
 !!   namtra_adv    advection scheme
 !!   namtra_ldf    lateral diffusion scheme
-!!   namtra_dmp    T & S newtonian damping                        
+!!   namtra_dmp    T & S newtonian damping
 !!======================================================================
 !
@@ -517,12 +517,12 @@
 /
 !-----------------------------------------------------------------------
-&namtra_adv    !   advection scheme for tracer 
-!-----------------------------------------------------------------------
-   ln_traadv_cen2   =  .false.  !  2nd order centered scheme   
-   ln_traadv_tvd    =  .true.   !  TVD scheme                
-   ln_traadv_muscl  =  .false.  !  MUSCL scheme             
-   ln_traadv_muscl2 =  .false.  !  MUSCL2 scheme + cen2 at boundaries  
-   ln_traadv_ubs    =  .false.  !  UBS scheme                 
-   ln_traadv_qck    =  .false.  !  QUICKEST scheme                 
+&namtra_adv    !   advection scheme for tracer
+!-----------------------------------------------------------------------
+   ln_traadv_cen2   =  .false.  !  2nd order centered scheme
+   ln_traadv_tvd    =  .true.   !  TVD scheme
+   ln_traadv_muscl  =  .false.  !  MUSCL scheme
+   ln_traadv_muscl2 =  .false.  !  MUSCL2 scheme + cen2 at boundaries
+   ln_traadv_ubs    =  .false.  !  UBS scheme
+   ln_traadv_qck    =  .false.  !  QUICKEST scheme
 /
 !----------------------------------------------------------------------------------
@@ -551,5 +551,5 @@
 /
 !-----------------------------------------------------------------------
-&namtra_dmp    !   tracer: T & S newtonian damping                  
+&namtra_dmp    !   tracer: T & S newtonian damping
 !-----------------------------------------------------------------------
    ln_tradmp   =  .false.  !  add a damping termn (T) or not (F)
@@ -579,20 +579,20 @@
 &namdyn_adv    !   formulation of the momentum advection
 !-----------------------------------------------------------------------
-   ln_dynadv_vec = .true.  !  vector form (T) or flux form (F)  
+   ln_dynadv_vec = .true.  !  vector form (T) or flux form (F)
    ln_dynadv_cen2= .false. !  flux form - 2nd order centered scheme
-   ln_dynadv_ubs = .false. !  flux form - 3rd order UBS      scheme 
-/  
+   ln_dynadv_ubs = .false. !  flux form - 3rd order UBS      scheme
+/
 !-----------------------------------------------------------------------
 &namdyn_vor    !   option of physics/algorithm (not control by CPP keys)
 !-----------------------------------------------------------------------
-   ln_dynvor_ene = .false. !  enstrophy conserving scheme  
-   ln_dynvor_ens = .false. !  energy conserving scheme    
-   ln_dynvor_mix = .false. !  mixed scheme               
-   ln_dynvor_een = .true.  !  energy & enstrophy scheme  
+   ln_dynvor_ene = .false. !  enstrophy conserving scheme
+   ln_dynvor_ens = .false. !  energy conserving scheme
+   ln_dynvor_mix = .false. !  mixed scheme
+   ln_dynvor_een = .true.  !  energy & enstrophy scheme
 /
 !-----------------------------------------------------------------------
 &namdyn_hpg    !   Hydrostatic pressure gradient option
 !-----------------------------------------------------------------------
-   ln_hpg_zco  = .false.   !  z-coordinate - full steps                   
+   ln_hpg_zco  = .false.   !  z-coordinate - full steps
    ln_hpg_zps  = .false.   !  z-coordinate - partial steps (interpolation)
    ln_hpg_sco  = .true.    !  s-coordinate (standard jacobian formulation)
@@ -612,12 +612,12 @@
 &namdyn_ldf    !   lateral diffusion on momentum
 !-----------------------------------------------------------------------
-   !                       !  Type of the operator : 
-   ln_dynldf_lap    =  .true.   !  laplacian operator         
+   !                       !  Type of the operator :
+   ln_dynldf_lap    =  .true.   !  laplacian operator
    ln_dynldf_bilap  =  .true.   !  bilaplacian operator
                            !  Direction of action  :
-   ln_dynldf_level  =  .false.  !  iso-level               
+   ln_dynldf_level  =  .false.  !  iso-level
    ln_dynldf_hor    =  .true.   !  horizontal (geopotential)            (require "key_ldfslp" in s-coord.)
    ln_dynldf_iso    =  .false.  !  iso-neutral                          (require "key_ldfslp")
-                           !  Coefficient 
+                           !  Coefficient
    rn_ahm_0_lap     = 60.0      !  horizontal laplacian eddy viscosity   [m2/s]
    rn_ahmb_0        =  0.0      !  background eddy viscosity for ldf_iso [m2/s]
@@ -695,11 +695,11 @@
 &namzdf_kpp    !   K-Profile Parameterization dependent vertical mixing  ("key_zdfkpp", and optionally:
 !------------------------------------------------------------------------ "key_kppcustom" or "key_kpplktb")
-   ln_kpprimix = .true.    !  shear instability mixing 
+   ln_kpprimix = .true.    !  shear instability mixing
    rn_difmiw   =  1.0e-04  !  constant internal wave viscosity [m2/s]
    rn_difsiw   =  0.1e-04  !  constant internal wave diffusivity [m2/s]
    rn_riinfty  =  0.8      !  local Richardson Number limit for shear instability
    rn_difri    =  0.0050   !  maximum shear mixing at Rig = 0    [m2/s]
-   rn_bvsqcon  = -0.01e-07 !  Brunt-Vaisala squared for maximum convection [1/s2] 
-   rn_difcon   =  1.       !  maximum mixing in interior convection [m2/s] 
+   rn_bvsqcon  = -0.01e-07 !  Brunt-Vaisala squared for maximum convection [1/s2]
+   rn_difcon   =  1.       !  maximum mixing in interior convection [m2/s]
    nn_avb      =  0        !  horizontal averaged (=1) or not (=0) on avt and amv
    nn_ave      =  1        !  constant (=0) or profile (=1) background on avt
@@ -735,5 +735,5 @@
    rn_n2min    = 1.e-8     !  threshold of the Brunt-Vaisala frequency (s-1)
    rn_tfe      = 0.333     !  tidal dissipation efficiency
-   rn_me       = 0.2       !  mixing efficiency 
+   rn_me       = 0.2       !  mixing efficiency
    ln_tmx_itf  = .FALSE.   !  ITF specific parameterisation
    rn_tfe_itf  = 1.        !  ITF tidal dissipation efficiency
@@ -745,9 +745,9 @@
 !!   nammpp            Massively Parallel Processing                    ("key_mpp_mpi)
 !!   namctl            Control prints & Benchmark
-!!   namsol            elliptic solver / island / free surface 
-!!======================================================================
-!
-!-----------------------------------------------------------------------
-&namsol        !   elliptic solver / island / free surface 
+!!   namsol            elliptic solver / island / free surface
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&namsol        !   elliptic solver / island / free surface
 !-----------------------------------------------------------------------
    nn_solv     =      1    !  elliptic solver: =1 preconditioned conjugate gradient (pcg)
@@ -795,5 +795,5 @@
 !!   namflo       float parameters                                      ("key_float")
 !!   namptr       Poleward Transport Diagnostics
-!!   namhsb       Heat and salt budgets 
+!!   namhsb       Heat and salt budgets
 !!======================================================================
 !
@@ -833,6 +833,6 @@
    jpnnewflo     = 0          !  number of floats for the restart
    ln_rstflo     = .false.    !  float restart (T) or not (F)
-   nn_writefl    =      75    !  frequency of writing in float output file 
-   nn_stockfl    =    5475    !  frequency of creation of the float restart file 
+   nn_writefl    =      75    !  frequency of writing in float output file
+   nn_stockfl    =    5475    !  frequency of creation of the float restart file
    ln_argo       = .false.    !  Argo type floats (stay at the surface each 10 days)
    ln_flork4     = .false.    !  trajectories computed with a 4th order Runge-Kutta (T)
@@ -846,5 +846,5 @@
    ln_diaptr  = .false.    !  Poleward heat and salt transport (T) or not (F)
    ln_diaznl  = .false.    !  Add zonal means and meridional stream functions
-   ln_subbas  = .false.    !  Atlantic/Pacific/Indian basins computation (T) or not 
+   ln_subbas  = .false.    !  Atlantic/Pacific/Indian basins computation (T) or not
                            !  (orca configuration only, need input basins mask file named "subbasins.nc"
    ln_ptrcomp = .false.    !  Add decomposition : overturning
@@ -853,5 +853,5 @@
 /
 !-----------------------------------------------------------------------
-&namhsb       !  Heat and salt budgets 
+&namhsb       !  Heat and salt budgets
 !-----------------------------------------------------------------------
    ln_diahsb  = .false.    !  check the heat and salt budgets (T) or not (F)
@@ -885,72 +885,71 @@
 &namobs       !  observation usage switch                               ('key_diaobs')
 !-----------------------------------------------------------------------
-   ln_t3d     = .false.    ! Logical switch for T profile observations         
-   ln_s3d     = .false.    ! Logical switch for S profile observations          
-   ln_ena     = .false.    ! Logical switch for ENACT insitu data set           
-   !                       !     ln_cor                  Logical switch for Coriolis insitu data set       
-   ln_profb   = .false.    ! Logical switch for feedback insitu data set     
-   ln_sla     = .false.    ! Logical switch for SLA observations               
-
-   ln_sladt   = .false.    ! Logical switch for AVISO SLA data              
-
-   ln_slafb   = .false.    ! Logical switch for feedback SLA data            
-                           !     ln_ssh                  Logical switch for SSH observations              
-
-   ln_sst     = .false.    ! Logical switch for SST observations              
-                           !     ln_reysst               Logical switch for Reynolds observations       
-                           !     ln_ghrsst               Logical switch for GHRSST observations          
-
-   ln_sstfb   = .false.    ! Logical switch for feedback SST data          
-                           !     ln_sss                  Logical switch for SSS observations              
-                           !     ln_seaice               Logical switch for Sea Ice observations        
-                           !     ln_vel3d                Logical switch for velocity observations         
-                           !     ln_velavcur             Logical switch for velocity daily av. cur.    
-                           !     ln_velhrcur             Logical switch for velocity high freq. cur.   
-                           !     ln_velavadcp            Logical switch for velocity daily av. ADCP  
+   ln_t3d     = .false.    ! Logical switch for T profile observations
+   ln_s3d     = .false.    ! Logical switch for S profile observations
+   ln_ena     = .false.    ! Logical switch for ENACT insitu data set
+   !                       !     ln_cor                  Logical switch for Coriolis insitu data set
+   ln_profb   = .false.    ! Logical switch for feedback insitu data set
+   ln_sla     = .false.    ! Logical switch for SLA observations
+
+   ln_sladt   = .false.    ! Logical switch for AVISO SLA data
+
+   ln_slafb   = .false.    ! Logical switch for feedback SLA data
+                           !     ln_ssh                  Logical switch for SSH observations
+
+   ln_sst     = .false.    ! Logical switch for SST observations
+                           !     ln_reysst               Logical switch for Reynolds observations
+                           !     ln_ghrsst               Logical switch for GHRSST observations
+
+   ln_sstfb   = .false.    ! Logical switch for feedback SST data
+                           !     ln_sss                  Logical switch for SSS observations
+                           !     ln_seaice               Logical switch for Sea Ice observations
+                           !     ln_vel3d                Logical switch for velocity observations
+                           !     ln_velavcur             Logical switch for velocity daily av. cur.
+                           !     ln_velhrcur             Logical switch for velocity high freq. cur.
+                           !     ln_velavadcp            Logical switch for velocity daily av. ADCP
                            !     ln_velhradcp            Logical switch for velocity high freq. ADCP
-                           !     ln_velfb                Logical switch for feedback velocity data       
-                           !     ln_grid_global          Global distribtion of observations         
-                           !     ln_grid_search_lookup   Logical switch for obs grid search w/lookup table  
-                           !     grid_search_file        Grid search lookup file header 
-                           !     enactfiles              ENACT input observation file names 
-                           !     coriofiles              Coriolis input observation file name  
-   !                       ! profbfiles: Profile feedback input observation file name 
+                           !     ln_velfb                Logical switch for feedback velocity data
+                           !     ln_grid_global          Global distribtion of observations
+                           !     ln_grid_search_lookup   Logical switch for obs grid search w/lookup table
+                           !     grid_search_file        Grid search lookup file header
+                           !     enactfiles              ENACT input observation file names
+                           !     coriofiles              Coriolis input observation file name
+   !                       ! profbfiles: Profile feedback input observation file name
    profbfiles = 'profiles_01.nc'
-                           !     ln_profb_enatim         Enact feedback input time setting switch    
+                           !     ln_profb_enatim         Enact feedback input time setting switch
                            !     slafilesact             Active SLA input observation file name
-                           !     slafilespas             Passive SLA input observation file name 
-   !                       ! slafbfiles: Feedback SLA input observation file name 
+                           !     slafilespas             Passive SLA input observation file name
+   !                       ! slafbfiles: Feedback SLA input observation file name
    slafbfiles = 'sla_01.nc'
-                           !     sstfiles                GHRSST input observation file name       
-   !                       ! sstfbfiles: Feedback SST input observation file name 
+                           !     sstfiles                GHRSST input observation file name
+   !                       ! sstfbfiles: Feedback SST input observation file name
    sstfbfiles = 'sst_01.nc' 'sst_02.nc' 'sst_03.nc' 'sst_04.nc' 'sst_05.nc'
-                           !     seaicefiles             Sea Ice input observation file name 
-                           !     velavcurfiles           Vel. cur. daily av. input file name  
-                           !     velhvcurfiles           Vel. cur. high freq. input file name  
-                           !     velavadcpfiles          Vel. ADCP daily av. input file name    
-                           !     velhvadcpfiles          Vel. ADCP high freq. input file name 
-                           !     velfbfiles              Vel. feedback input observation file name 
-                           !     dobsini                 Initial date in window YYYYMMDD.HHMMSS       
-                           !     dobsend                 Final date in window YYYYMMDD.HHMMSS         
-                           !     n1dint                  Type of vertical interpolation method        
-                           !     n2dint                  Type of horizontal interpolation method       
-                           !     ln_nea                  Rejection of observations near land switch    
-   nmsshc     = 0          ! MSSH correction scheme                         
-                           !     mdtcorr                 MDT  correction                               
-                           !     mdtcutoff               MDT cutoff for computed correction          
-   ln_altbias = .false.    ! Logical switch for alt bias                
-   ln_ignmis  = .true.     ! Logical switch for ignoring missing files   
-                           !     endailyavtypes   ENACT daily average types                    
+                           !     seaicefiles             Sea Ice input observation file name
+                           !     velavcurfiles           Vel. cur. daily av. input file name
+                           !     velhvcurfiles           Vel. cur. high freq. input file name
+                           !     velavadcpfiles          Vel. ADCP daily av. input file name
+                           !     velhvadcpfiles          Vel. ADCP high freq. input file name
+                           !     velfbfiles              Vel. feedback input observation file name
+                           !     dobsini                 Initial date in window YYYYMMDD.HHMMSS
+                           !     dobsend                 Final date in window YYYYMMDD.HHMMSS
+                           !     n1dint                  Type of vertical interpolation method
+                           !     n2dint                  Type of horizontal interpolation method
+                           !     ln_nea                  Rejection of observations near land switch
+   nmsshc     = 0          ! MSSH correction scheme
+                           !     mdtcorr                 MDT  correction
+                           !     mdtcutoff               MDT cutoff for computed correction
+   ln_altbias = .false.    ! Logical switch for alt bias
+   ln_ignmis  = .true.     ! Logical switch for ignoring missing files
+                           !     endailyavtypes   ENACT daily average types
    ln_grid_global = .true.
    ln_grid_search_lookup = .false.
-/ 
+/
 !-----------------------------------------------------------------------
 &nam_asminc   !   assimilation increments                               ('key_asminc')
 !-----------------------------------------------------------------------
-    ln_bkgwri = .false.    !  Logical switch for writing out background state 
-    ln_trjwri = .false.    !  Logical switch for writing out state trajectory
+    ln_bkgwri = .false.    !  Logical switch for writing out background state
     ln_trainc = .false.    !  Logical switch for applying tracer increments
     ln_dyninc = .false.    !  Logical switch for applying velocity increments
-    ln_sshinc = .false.    !  Logical switch for applying SSH increments 
+    ln_sshinc = .false.    !  Logical switch for applying SSH increments
     ln_asmdin = .false.    !  Logical switch for Direct Initialization (DI)
     ln_asmiau = .false.    !  Logical switch for Incremental Analysis Updating (IAU)
@@ -960,5 +959,4 @@
     nitiaufin = 15         !  Timestep of end of IAU interval in [0,nitend-nit000-1]
     niaufn    = 0          !  Type of IAU weighting function
-    nittrjfrq = 0          !  Frequency of trajectory output for 4D-VAR
     ln_salfix = .false.    !  Logical switch for ensuring that the sa > salfixmin
     salfixmin = -9999      !  Minimum salinity after applying the increments
@@ -989,2 +987,10 @@
    rn_htrmax         =  200.0   ! max. depth of transition range
 /
+!-----------------------------------------------------------------------
+&namtrj ! Handling non-linear trajectory for TAM (output for direct model, input for TAM)
+!-----------------------------------------------------------------------
+    cn_dirtrj   = 'tam_trajectory'   ! prefix for input/ouput files
+    ln_trjhand  = .false.            ! Handling non linear trajectory
+    nn_ittrjfrq = 20                 ! Output/input frequency
+    ln_trj_spl = .false.             ! Handling trajectory at simple precision
+/
Index: /trunk/NEMOGCM/CONFIG/AMM12_PISCES/EXP00/namelist
===================================================================
--- /trunk/NEMOGCM/CONFIG/AMM12_PISCES/EXP00/namelist	(revision 3603)
+++ /trunk/NEMOGCM/CONFIG/AMM12_PISCES/EXP00/namelist	(revision 3604)
@@ -3,5 +3,5 @@
 !! namelists    2 - Domain           (namzgr, namzgr_sco, namdom, namtsd)
 !!              3 - Surface boundary (namsbc, namsbc_ana, namsbc_flx, namsbc_clio, namsbc_core
-!!                                    namsbc_cpl, namtra_qsr, namsbc_rnf, 
+!!                                    namsbc_cpl, namtra_qsr, namsbc_rnf,
 !!                                    namsbc_apr, namsbc_ssr, namsbc_alb)
 !!              4 - lateral boundary (namlbc, namcla, namobc, namagrif, nambdy, nambdy_tide)
@@ -25,5 +25,5 @@
 !-----------------------------------------------------------------------
    nn_no       =       0   !  job number (no more used...)
-   cn_exp      =  "AMM12"  !  experience name 
+   cn_exp      =  "AMM12"  !  experience name
    nn_it000    =       1   !  first time step
    nn_itend    =     576   !  last  time step (std 1 day = 576)
@@ -52,5 +52,5 @@
 !!   namzgr_sco   s-coordinate or hybrid z-s-coordinate
 !!   namdom       space and time domain (bathymetry, mesh, timestep)
-!!   namtsd       data: temperature & salinity                         
+!!   namtsd       data: temperature & salinity
 !!======================================================================
 !
@@ -72,5 +72,5 @@
    ln_s_sigma  = .true.    !  hybrid s-sigma coordinates
    rn_bb       =    0.8    !  stretching with s-sigma
-   rn_hc       =  150.0    !  critical depth with s-sigma 
+   rn_hc       =  150.0    !  critical depth with s-sigma
 /
 !-----------------------------------------------------------------------
@@ -94,5 +94,5 @@
 /
 !-----------------------------------------------------------------------
-&namtsd    !   data : Temperature  & Salinity                           
+&namtsd    !   data : Temperature  & Salinity
 !-----------------------------------------------------------------------
 !          ! file name ! frequency (hours)    ! variable ! time interp. ! clim  !'yearly' or ! weights  ! rotation !
@@ -129,6 +129,6 @@
    ln_ana      = .false    !  analytical formulation (T => fill namsbc_ana )
    ln_flx      = .true.    !  flux formulation       (T => fill namsbc_flx )
-   ln_blk_clio = .false.   !  CLIO bulk formulation                     (T => fill namsbc_clio) 
-   ln_blk_core = .false.   !  CORE bulk formulation                     (T => fill namsbc_core) 
+   ln_blk_clio = .false.   !  CLIO bulk formulation                     (T => fill namsbc_clio)
+   ln_blk_core = .false.   !  CORE bulk formulation                     (T => fill namsbc_core)
    ln_blk_mfs  = .false.   !  MFS bulk formulation                      (T => fill namsbc_mfs )
    ln_cpl      = .false.   !  Coupled formulation                       (T => fill namsbc_cpl )
@@ -140,6 +140,6 @@
    ln_rnf      = .true.    !  runoffs                                   (T => fill namsbc_rnf)
    ln_ssr      = .false.   !  Sea Surface Restoring on T and/or S       (T => fill namsbc_ssr)
-   nn_fwb      = 0         !  FreshWater Budget: =0 unchecked 
-                           !     =1 global mean of e-p-r set to zero at each time step 
+   nn_fwb      = 0         !  FreshWater Budget: =0 unchecked
+                           !     =1 global mean of e-p-r set to zero at each time step
                            !     =2 annual global mean of e-p-r set to zero
                            !     =3 global emp set to zero and spread out over erp area
@@ -167,5 +167,5 @@
    sn_emp      = 'amm12_flx'      ,          3        ,  'sowafldo'  ,  .true.      , .false. , 'daily'   ,  ''      ,  ''
    cn_dir      = './fluxes/'        !  root directory for the location of the flux files
-/      
+/
 !-----------------------------------------------------------------------
 &namsbc_clio   !   namsbc_clio  CLIO bulk formulae
@@ -224,20 +224,20 @@
 !                    !                       ! categories !  reference  !    orientation       ! grids  !
 ! send
-sn_snd_temp   =       'weighted oce and ice' ,    'no'    ,     ''      ,         ''           ,   ''    
-sn_snd_alb    =       'weighted ice'         ,    'no'    ,     ''      ,         ''           ,   ''    
-sn_snd_thick  =       'none'                 ,    'no'   ,     ''      ,         ''           ,   ''    
-sn_snd_crt    =       'none'                 ,    'no'    , 'spherical' , 'eastward-northward' ,  'T'       
-sn_snd_co2    =       'coupled'              ,    'no'    ,     ''      ,         ''           ,   ''        
+sn_snd_temp   =       'weighted oce and ice' ,    'no'    ,     ''      ,         ''           ,   ''
+sn_snd_alb    =       'weighted ice'         ,    'no'    ,     ''      ,         ''           ,   ''
+sn_snd_thick  =       'none'                 ,    'no'   ,     ''      ,         ''           ,   ''
+sn_snd_crt    =       'none'                 ,    'no'    , 'spherical' , 'eastward-northward' ,  'T'
+sn_snd_co2    =       'coupled'              ,    'no'    ,     ''      ,         ''           ,   ''
 ! receive
-sn_rcv_w10m   =       'none'                 ,    'no'    ,     ''      ,         ''          ,   ''    
-sn_rcv_taumod =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''    
-sn_rcv_tau    =       'oce only'             ,    'no'    , 'cartesian' , 'eastward-northward',  'U,V'   
-sn_rcv_dqnsdt =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''    
-sn_rcv_qsr    =       'oce and ice'          ,    'no'    ,     ''      ,         ''          ,   ''    
-sn_rcv_qns    =       'oce and ice'          ,    'no'    ,     ''      ,         ''          ,   ''    
-sn_rcv_emp    =       'conservative'         ,    'no'    ,     ''      ,         ''          ,   ''    
-sn_rcv_rnf    =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''    
-sn_rcv_cal    =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''    
-sn_rcv_co2    =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''    
+sn_rcv_w10m   =       'none'                 ,    'no'    ,     ''      ,         ''          ,   ''
+sn_rcv_taumod =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''
+sn_rcv_tau    =       'oce only'             ,    'no'    , 'cartesian' , 'eastward-northward',  'U,V'
+sn_rcv_dqnsdt =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''
+sn_rcv_qsr    =       'oce and ice'          ,    'no'    ,     ''      ,         ''          ,   ''
+sn_rcv_qns    =       'oce and ice'          ,    'no'    ,     ''      ,         ''          ,   ''
+sn_rcv_emp    =       'conservative'         ,    'no'    ,     ''      ,         ''          ,   ''
+sn_rcv_rnf    =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''
+sn_rcv_cal    =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''
+sn_rcv_co2    =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''
 /
 !-----------------------------------------------------------------------
@@ -305,12 +305,12 @@
    ln_sssr_bnd =   .true.  !  flag to bound erp term (associated with nn_sssr=2)
    rn_sssr_bnd =   4.e0    !  ABS(Max/Min) value of the damping erp term [mm/day]
-/      
+/
 !-----------------------------------------------------------------------
 &namsbc_alb    !   albedo parameters
 !-----------------------------------------------------------------------
-   rn_cloud    =    0.06   !  cloud correction to snow and ice albedo 
+   rn_cloud    =    0.06   !  cloud correction to snow and ice albedo
    rn_albice   =    0.53   !  albedo of melting ice in the arctic and antarctic
    rn_alphd    =    0.80   !  coefficients for linear interpolation used to
-   rn_alphc    =    0.65   !  compute albedo between two extremes values 
+   rn_alphc    =    0.65   !  compute albedo between two extremes values
    rn_alphdi   =    0.72   !  (Pyane, 1972)
 /
@@ -322,5 +322,5 @@
 !!   namcla        cross land advection
 !!   namobc        open boundaries parameters                           ("key_obc")
-!!   namagrif      agrif nested grid ( read by child model only )       ("key_agrif") 
+!!   namagrif      agrif nested grid ( read by child model only )       ("key_agrif")
 !!   nambdy        Unstructured open boundaries                         ("key_bdy")
 !!   namtide       Tidal forcing at open boundaries                     ("key_bdy_tides")
@@ -344,5 +344,5 @@
    ln_obc_clim = .false.   !  climatological obc data files (T) or not (F)
    ln_vol_cst  = .true.    !  impose the total volume conservation (T) or not (F)
-   ln_obc_fla  = .false.   !  Flather open boundary condition 
+   ln_obc_fla  = .false.   !  Flather open boundary condition
    nn_obcdta   =    1      !  = 0 the obc data are equal to the initial state
                            !  = 1 the obc data are read in 'obc.dta' files
@@ -388,5 +388,5 @@
 &nambdy        !  unstructured open boundaries                          ("key_bdy")
 !-----------------------------------------------------------------------
-    nb_bdy = 1                            !  number of open boundary sets       
+    nb_bdy = 1                            !  number of open boundary sets
     ln_coords_file = .true.               !  =T : read bdy coordinates from file
     cn_coords_file = 'coordinates.bdy.nc' !  bdy coordinates files
@@ -424,5 +424,5 @@
 /
 !-----------------------------------------------------------------------
-&nambdy_tide     ! tidal forcing at open boundaries              
+&nambdy_tide     ! tidal forcing at open boundaries
 !-----------------------------------------------------------------------
    filtide      = 'bdydta/amm12_bdytide_'         !  file name root of tidal forcing files
@@ -463,5 +463,5 @@
 !!======================================================================
 !!   nambfr        bottom friction
-!!   nambbc        bottom temperature boundary condition               
+!!   nambbc        bottom temperature boundary condition
 !!   nambbl        bottom boundary layer scheme                         ("key_trabbl")
 !!======================================================================
@@ -483,7 +483,7 @@
 !-----------------------------------------------------------------------
    ln_trabbc   = .false.   !  Apply a geothermal heating at the ocean bottom
-   nn_geoflx   =    2      !  geothermal heat flux: = 0 no flux 
+   nn_geoflx   =    2      !  geothermal heat flux: = 0 no flux
                            !     = 1 constant flux
-                           !     = 2 variable flux (read in geothermal_heating.nc in mW/m2) 
+                           !     = 2 variable flux (read in geothermal_heating.nc in mW/m2)
    rn_geoflx_cst = 86.4e-3 !  Constant value of geothermal heat flux [W/m2]
 /
@@ -503,5 +503,5 @@
 !!   namtra_adv    advection scheme
 !!   namtra_ldf    lateral diffusion scheme
-!!   namtra_dmp    T & S newtonian damping                        
+!!   namtra_dmp    T & S newtonian damping
 !!======================================================================
 !
@@ -517,12 +517,12 @@
 /
 !-----------------------------------------------------------------------
-&namtra_adv    !   advection scheme for tracer 
-!-----------------------------------------------------------------------
-   ln_traadv_cen2   =  .false.  !  2nd order centered scheme   
-   ln_traadv_tvd    =  .true.   !  TVD scheme                
-   ln_traadv_muscl  =  .false.  !  MUSCL scheme             
-   ln_traadv_muscl2 =  .false.  !  MUSCL2 scheme + cen2 at boundaries  
-   ln_traadv_ubs    =  .false.  !  UBS scheme                 
-   ln_traadv_qck    =  .false.  !  QUICKEST scheme                 
+&namtra_adv    !   advection scheme for tracer
+!-----------------------------------------------------------------------
+   ln_traadv_cen2   =  .false.  !  2nd order centered scheme
+   ln_traadv_tvd    =  .true.   !  TVD scheme
+   ln_traadv_muscl  =  .false.  !  MUSCL scheme
+   ln_traadv_muscl2 =  .false.  !  MUSCL2 scheme + cen2 at boundaries
+   ln_traadv_ubs    =  .false.  !  UBS scheme
+   ln_traadv_qck    =  .false.  !  QUICKEST scheme
 /
 !----------------------------------------------------------------------------------
@@ -551,5 +551,5 @@
 /
 !-----------------------------------------------------------------------
-&namtra_dmp    !   tracer: T & S newtonian damping                  
+&namtra_dmp    !   tracer: T & S newtonian damping
 !-----------------------------------------------------------------------
    ln_tradmp   =  .false.  !  add a damping termn (T) or not (F)
@@ -579,20 +579,20 @@
 &namdyn_adv    !   formulation of the momentum advection
 !-----------------------------------------------------------------------
-   ln_dynadv_vec = .true.  !  vector form (T) or flux form (F)  
+   ln_dynadv_vec = .true.  !  vector form (T) or flux form (F)
    ln_dynadv_cen2= .false. !  flux form - 2nd order centered scheme
-   ln_dynadv_ubs = .false. !  flux form - 3rd order UBS      scheme 
-/  
+   ln_dynadv_ubs = .false. !  flux form - 3rd order UBS      scheme
+/
 !-----------------------------------------------------------------------
 &namdyn_vor    !   option of physics/algorithm (not control by CPP keys)
 !-----------------------------------------------------------------------
-   ln_dynvor_ene = .false. !  enstrophy conserving scheme  
-   ln_dynvor_ens = .false. !  energy conserving scheme    
-   ln_dynvor_mix = .false. !  mixed scheme               
-   ln_dynvor_een = .true.  !  energy & enstrophy scheme  
+   ln_dynvor_ene = .false. !  enstrophy conserving scheme
+   ln_dynvor_ens = .false. !  energy conserving scheme
+   ln_dynvor_mix = .false. !  mixed scheme
+   ln_dynvor_een = .true.  !  energy & enstrophy scheme
 /
 !-----------------------------------------------------------------------
 &namdyn_hpg    !   Hydrostatic pressure gradient option
 !-----------------------------------------------------------------------
-   ln_hpg_zco  = .false.   !  z-coordinate - full steps                   
+   ln_hpg_zco  = .false.   !  z-coordinate - full steps
    ln_hpg_zps  = .false.   !  z-coordinate - partial steps (interpolation)
    ln_hpg_sco  = .true.    !  s-coordinate (standard jacobian formulation)
@@ -612,12 +612,12 @@
 &namdyn_ldf    !   lateral diffusion on momentum
 !-----------------------------------------------------------------------
-   !                       !  Type of the operator : 
-   ln_dynldf_lap    =  .true.   !  laplacian operator         
+   !                       !  Type of the operator :
+   ln_dynldf_lap    =  .true.   !  laplacian operator
    ln_dynldf_bilap  =  .true.   !  bilaplacian operator
                            !  Direction of action  :
-   ln_dynldf_level  =  .false.  !  iso-level               
+   ln_dynldf_level  =  .false.  !  iso-level
    ln_dynldf_hor    =  .true.   !  horizontal (geopotential)            (require "key_ldfslp" in s-coord.)
    ln_dynldf_iso    =  .false.  !  iso-neutral                          (require "key_ldfslp")
-                           !  Coefficient 
+                           !  Coefficient
    rn_ahm_0_lap     = 60.0      !  horizontal laplacian eddy viscosity   [m2/s]
    rn_ahmb_0        =  0.0      !  background eddy viscosity for ldf_iso [m2/s]
@@ -695,11 +695,11 @@
 &namzdf_kpp    !   K-Profile Parameterization dependent vertical mixing  ("key_zdfkpp", and optionally:
 !------------------------------------------------------------------------ "key_kppcustom" or "key_kpplktb")
-   ln_kpprimix = .true.    !  shear instability mixing 
+   ln_kpprimix = .true.    !  shear instability mixing
    rn_difmiw   =  1.0e-04  !  constant internal wave viscosity [m2/s]
    rn_difsiw   =  0.1e-04  !  constant internal wave diffusivity [m2/s]
    rn_riinfty  =  0.8      !  local Richardson Number limit for shear instability
    rn_difri    =  0.0050   !  maximum shear mixing at Rig = 0    [m2/s]
-   rn_bvsqcon  = -0.01e-07 !  Brunt-Vaisala squared for maximum convection [1/s2] 
-   rn_difcon   =  1.       !  maximum mixing in interior convection [m2/s] 
+   rn_bvsqcon  = -0.01e-07 !  Brunt-Vaisala squared for maximum convection [1/s2]
+   rn_difcon   =  1.       !  maximum mixing in interior convection [m2/s]
    nn_avb      =  0        !  horizontal averaged (=1) or not (=0) on avt and amv
    nn_ave      =  1        !  constant (=0) or profile (=1) background on avt
@@ -735,5 +735,5 @@
    rn_n2min    = 1.e-8     !  threshold of the Brunt-Vaisala frequency (s-1)
    rn_tfe      = 0.333     !  tidal dissipation efficiency
-   rn_me       = 0.2       !  mixing efficiency 
+   rn_me       = 0.2       !  mixing efficiency
    ln_tmx_itf  = .FALSE.   !  ITF specific parameterisation
    rn_tfe_itf  = 1.        !  ITF tidal dissipation efficiency
@@ -745,9 +745,9 @@
 !!   nammpp            Massively Parallel Processing                    ("key_mpp_mpi)
 !!   namctl            Control prints & Benchmark
-!!   namsol            elliptic solver / island / free surface 
-!!======================================================================
-!
-!-----------------------------------------------------------------------
-&namsol        !   elliptic solver / island / free surface 
+!!   namsol            elliptic solver / island / free surface
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&namsol        !   elliptic solver / island / free surface
 !-----------------------------------------------------------------------
    nn_solv     =      1    !  elliptic solver: =1 preconditioned conjugate gradient (pcg)
@@ -795,5 +795,5 @@
 !!   namflo       float parameters                                      ("key_float")
 !!   namptr       Poleward Transport Diagnostics
-!!   namhsb       Heat and salt budgets 
+!!   namhsb       Heat and salt budgets
 !!======================================================================
 !
@@ -833,6 +833,6 @@
    jpnnewflo     = 0          !  number of floats for the restart
    ln_rstflo     = .false.    !  float restart (T) or not (F)
-   nn_writefl    =      75    !  frequency of writing in float output file 
-   nn_stockfl    =    5475    !  frequency of creation of the float restart file 
+   nn_writefl    =      75    !  frequency of writing in float output file
+   nn_stockfl    =    5475    !  frequency of creation of the float restart file
    ln_argo       = .false.    !  Argo type floats (stay at the surface each 10 days)
    ln_flork4     = .false.    !  trajectories computed with a 4th order Runge-Kutta (T)
@@ -846,5 +846,5 @@
    ln_diaptr  = .false.    !  Poleward heat and salt transport (T) or not (F)
    ln_diaznl  = .false.    !  Add zonal means and meridional stream functions
-   ln_subbas  = .false.    !  Atlantic/Pacific/Indian basins computation (T) or not 
+   ln_subbas  = .false.    !  Atlantic/Pacific/Indian basins computation (T) or not
                            !  (orca configuration only, need input basins mask file named "subbasins.nc"
    ln_ptrcomp = .false.    !  Add decomposition : overturning
@@ -853,5 +853,5 @@
 /
 !-----------------------------------------------------------------------
-&namhsb       !  Heat and salt budgets 
+&namhsb       !  Heat and salt budgets
 !-----------------------------------------------------------------------
    ln_diahsb  = .false.    !  check the heat and salt budgets (T) or not (F)
@@ -886,72 +886,71 @@
 &namobs       !  observation usage switch                               ('key_diaobs')
 !-----------------------------------------------------------------------
-   ln_t3d     = .false.    ! Logical switch for T profile observations         
-   ln_s3d     = .false.    ! Logical switch for S profile observations          
-   ln_ena     = .false.    ! Logical switch for ENACT insitu data set           
-   !                       !     ln_cor                  Logical switch for Coriolis insitu data set       
-   ln_profb   = .false.    ! Logical switch for feedback insitu data set     
-   ln_sla     = .false.    ! Logical switch for SLA observations               
-
-   ln_sladt   = .false.    ! Logical switch for AVISO SLA data              
-
-   ln_slafb   = .false.    ! Logical switch for feedback SLA data            
-                           !     ln_ssh                  Logical switch for SSH observations              
-
-   ln_sst     = .false.    ! Logical switch for SST observations              
-                           !     ln_reysst               Logical switch for Reynolds observations       
-                           !     ln_ghrsst               Logical switch for GHRSST observations          
-
-   ln_sstfb   = .false.    ! Logical switch for feedback SST data          
-                           !     ln_sss                  Logical switch for SSS observations              
-                           !     ln_seaice               Logical switch for Sea Ice observations        
-                           !     ln_vel3d                Logical switch for velocity observations         
-                           !     ln_velavcur             Logical switch for velocity daily av. cur.    
-                           !     ln_velhrcur             Logical switch for velocity high freq. cur.   
-                           !     ln_velavadcp            Logical switch for velocity daily av. ADCP  
+   ln_t3d     = .false.    ! Logical switch for T profile observations
+   ln_s3d     = .false.    ! Logical switch for S profile observations
+   ln_ena     = .false.    ! Logical switch for ENACT insitu data set
+   !                       !     ln_cor                  Logical switch for Coriolis insitu data set
+   ln_profb   = .false.    ! Logical switch for feedback insitu data set
+   ln_sla     = .false.    ! Logical switch for SLA observations
+
+   ln_sladt   = .false.    ! Logical switch for AVISO SLA data
+
+   ln_slafb   = .false.    ! Logical switch for feedback SLA data
+                           !     ln_ssh                  Logical switch for SSH observations
+
+   ln_sst     = .false.    ! Logical switch for SST observations
+                           !     ln_reysst               Logical switch for Reynolds observations
+                           !     ln_ghrsst               Logical switch for GHRSST observations
+
+   ln_sstfb   = .false.    ! Logical switch for feedback SST data
+                           !     ln_sss                  Logical switch for SSS observations
+                           !     ln_seaice               Logical switch for Sea Ice observations
+                           !     ln_vel3d                Logical switch for velocity observations
+                           !     ln_velavcur             Logical switch for velocity daily av. cur.
+                           !     ln_velhrcur             Logical switch for velocity high freq. cur.
+                           !     ln_velavadcp            Logical switch for velocity daily av. ADCP
                            !     ln_velhradcp            Logical switch for velocity high freq. ADCP
-                           !     ln_velfb                Logical switch for feedback velocity data       
-                           !     ln_grid_global          Global distribtion of observations         
-                           !     ln_grid_search_lookup   Logical switch for obs grid search w/lookup table  
-                           !     grid_search_file        Grid search lookup file header 
-                           !     enactfiles              ENACT input observation file names 
-                           !     coriofiles              Coriolis input observation file name  
-   !                       ! profbfiles: Profile feedback input observation file name 
+                           !     ln_velfb                Logical switch for feedback velocity data
+                           !     ln_grid_global          Global distribtion of observations
+                           !     ln_grid_search_lookup   Logical switch for obs grid search w/lookup table
+                           !     grid_search_file        Grid search lookup file header
+                           !     enactfiles              ENACT input observation file names
+                           !     coriofiles              Coriolis input observation file name
+   !                       ! profbfiles: Profile feedback input observation file name
    profbfiles = 'profiles_01.nc'
-                           !     ln_profb_enatim         Enact feedback input time setting switch    
+                           !     ln_profb_enatim         Enact feedback input time setting switch
                            !     slafilesact             Active SLA input observation file name
-                           !     slafilespas             Passive SLA input observation file name 
-   !                       ! slafbfiles: Feedback SLA input observation file name 
+                           !     slafilespas             Passive SLA input observation file name
+   !                       ! slafbfiles: Feedback SLA input observation file name
    slafbfiles = 'sla_01.nc'
-                           !     sstfiles                GHRSST input observation file name       
-   !                       ! sstfbfiles: Feedback SST input observation file name 
+                           !     sstfiles                GHRSST input observation file name
+   !                       ! sstfbfiles: Feedback SST input observation file name
    sstfbfiles = 'sst_01.nc' 'sst_02.nc' 'sst_03.nc' 'sst_04.nc' 'sst_05.nc'
-                           !     seaicefiles             Sea Ice input observation file name 
-                           !     velavcurfiles           Vel. cur. daily av. input file name  
-                           !     velhvcurfiles           Vel. cur. high freq. input file name  
-                           !     velavadcpfiles          Vel. ADCP daily av. input file name    
-                           !     velhvadcpfiles          Vel. ADCP high freq. input file name 
-                           !     velfbfiles              Vel. feedback input observation file name 
-                           !     dobsini                 Initial date in window YYYYMMDD.HHMMSS       
-                           !     dobsend                 Final date in window YYYYMMDD.HHMMSS         
-                           !     n1dint                  Type of vertical interpolation method        
-                           !     n2dint                  Type of horizontal interpolation method       
-                           !     ln_nea                  Rejection of observations near land switch    
-   nmsshc     = 0          ! MSSH correction scheme                         
-                           !     mdtcorr                 MDT  correction                               
-                           !     mdtcutoff               MDT cutoff for computed correction          
-   ln_altbias = .false.    ! Logical switch for alt bias                
-   ln_ignmis  = .true.     ! Logical switch for ignoring missing files   
-                           !     endailyavtypes   ENACT daily average types                    
+                           !     seaicefiles             Sea Ice input observation file name
+                           !     velavcurfiles           Vel. cur. daily av. input file name
+                           !     velhvcurfiles           Vel. cur. high freq. input file name
+                           !     velavadcpfiles          Vel. ADCP daily av. input file name
+                           !     velhvadcpfiles          Vel. ADCP high freq. input file name
+                           !     velfbfiles              Vel. feedback input observation file name
+                           !     dobsini                 Initial date in window YYYYMMDD.HHMMSS
+                           !     dobsend                 Final date in window YYYYMMDD.HHMMSS
+                           !     n1dint                  Type of vertical interpolation method
+                           !     n2dint                  Type of horizontal interpolation method
+                           !     ln_nea                  Rejection of observations near land switch
+   nmsshc     = 0          ! MSSH correction scheme
+                           !     mdtcorr                 MDT  correction
+                           !     mdtcutoff               MDT cutoff for computed correction
+   ln_altbias = .false.    ! Logical switch for alt bias
+   ln_ignmis  = .true.     ! Logical switch for ignoring missing files
+                           !     endailyavtypes   ENACT daily average types
    ln_grid_global = .true.
    ln_grid_search_lookup = .false.
-/ 
+/
 !-----------------------------------------------------------------------
 &nam_asminc   !   assimilation increments                               ('key_asminc')
 !-----------------------------------------------------------------------
-    ln_bkgwri = .false.    !  Logical switch for writing out background state 
-    ln_trjwri = .false.    !  Logical switch for writing out state trajectory
+    ln_bkgwri = .false.    !  Logical switch for writing out background state
     ln_trainc = .false.    !  Logical switch for applying tracer increments
     ln_dyninc = .false.    !  Logical switch for applying velocity increments
-    ln_sshinc = .false.    !  Logical switch for applying SSH increments 
+    ln_sshinc = .false.    !  Logical switch for applying SSH increments
     ln_asmdin = .false.    !  Logical switch for Direct Initialization (DI)
     ln_asmiau = .false.    !  Logical switch for Incremental Analysis Updating (IAU)
@@ -961,5 +960,4 @@
     nitiaufin = 15         !  Timestep of end of IAU interval in [0,nitend-nit000-1]
     niaufn    = 0          !  Type of IAU weighting function
-    nittrjfrq = 0          !  Frequency of trajectory output for 4D-VAR
     ln_salfix = .false.    !  Logical switch for ensuring that the sa > salfixmin
     salfixmin = -9999      !  Minimum salinity after applying the increments
@@ -990,2 +988,10 @@
    rn_htrmax         =  200.0   ! max. depth of transition range
 /
+!-----------------------------------------------------------------------
+&namtrj ! Handling non-linear trajectory for TAM (output for direct model, input for TAM)
+!-----------------------------------------------------------------------
+    cn_dirtrj   = 'tam_trajectory'   ! prefix for input/ouput files
+    ln_trjhand  = .false.            ! Handling non linear trajectory
+    nn_ittrjfrq = 20                 ! Output/input frequency
+    ln_trj_spl = .false.             ! Handling trajectory at simple precision
+/
Index: /trunk/NEMOGCM/CONFIG/GYRE/EXP00/namelist
===================================================================
--- /trunk/NEMOGCM/CONFIG/GYRE/EXP00/namelist	(revision 3603)
+++ /trunk/NEMOGCM/CONFIG/GYRE/EXP00/namelist	(revision 3604)
@@ -3,5 +3,5 @@
 !! namelists    2 - Domain           (namzgr, namzgr_sco, namdom, namtsd)
 !!              3 - Surface boundary (namsbc, namsbc_ana, namsbc_flx, namsbc_clio, namsbc_core
-!!                                    namsbc_cpl, namtra_qsr, namsbc_rnf, 
+!!                                    namsbc_cpl, namtra_qsr, namsbc_rnf,
 !!                                    namsbc_apr, namsbc_ssr, namsbc_alb)
 !!              4 - lateral boundary (namlbc, namcla, namobc, namagrif, nambdy, nambdy_tide)
@@ -25,5 +25,5 @@
 !-----------------------------------------------------------------------
    nn_no       =       0   !  job number (no more used...)
-   cn_exp      =  "GYRE"   !  experience name 
+   cn_exp      =  "GYRE"   !  experience name
    nn_it000    =       1   !  first time step
    nn_itend    =    4320   !  last  time step
@@ -52,5 +52,5 @@
 !!   namzgr_sco   s-coordinate or hybrid z-s-coordinate
 !!   namdom       space and time domain (bathymetry, mesh, timestep)
-!!   namtsd       data: temperature & salinity         
+!!   namtsd       data: temperature & salinity
 !!======================================================================
 !
@@ -72,5 +72,5 @@
    ln_s_sigma  = .false.   !  hybrid s-sigma coordinates
    rn_bb       =    0.8    !  stretching with s-sigma
-   rn_hc       =  150.0    !  critical depth with s-sigma 
+   rn_hc       =  150.0    !  critical depth with s-sigma
 /
 !-----------------------------------------------------------------------
@@ -94,5 +94,5 @@
 /
 !-----------------------------------------------------------------------
-&namtsd    !   data : Temperature  & Salinity                           
+&namtsd    !   data : Temperature  & Salinity
 !-----------------------------------------------------------------------
 !          ! file name ! frequency (hours)    ! variable ! time interp. ! clim  !'yearly' or ! weights  ! rotation !
@@ -125,10 +125,10 @@
 &namsbc        !   Surface Boundary Condition (surface module)
 !-----------------------------------------------------------------------
-   nn_fsbc     = 1         !  frequency of surface boundary condition computation 
+   nn_fsbc     = 1         !  frequency of surface boundary condition computation
                            !     (also = the frequency of sea-ice model call)
-   ln_ana      = .true.    !  analytical formulation                    (T => fill namsbc_ana ) 
+   ln_ana      = .true.    !  analytical formulation                    (T => fill namsbc_ana )
    ln_flx      = .false.   !  flux formulation                          (T => fill namsbc_flx )
-   ln_blk_clio = .false.   !  CLIO bulk formulation                     (T => fill namsbc_clio) 
-   ln_blk_core = .false.   !  CORE bulk formulation                     (T => fill namsbc_core) 
+   ln_blk_clio = .false.   !  CLIO bulk formulation                     (T => fill namsbc_clio)
+   ln_blk_core = .false.   !  CORE bulk formulation                     (T => fill namsbc_core)
    ln_blk_mfs  = .false.   !  MFS bulk formulation                      (T => fill namsbc_mfs )
    ln_cpl      = .false.   !  Coupled formulation                       (T => fill namsbc_cpl )
@@ -140,6 +140,6 @@
    ln_rnf      = .false.   !  runoffs                                   (T => fill namsbc_rnf)
    ln_ssr      = .false.   !  Sea Surface Restoring on T and/or S       (T => fill namsbc_ssr)
-   nn_fwb      = 0         !  FreshWater Budget: =0 unchecked 
-                           !     =1 global mean of e-p-r set to zero at each time step 
+   nn_fwb      = 0         !  FreshWater Budget: =0 unchecked
+                           !     =1 global mean of e-p-r set to zero at each time step
                            !     =2 annual global mean of e-p-r set to zero
                            !     =3 global emp set to zero and spread out over erp area
@@ -168,5 +168,5 @@
 
    cn_dir      = './'      !  root directory for the location of the flux files
-/      
+/
 !-----------------------------------------------------------------------
 &namsbc_clio   !   namsbc_clio  CLIO bulk formulae
@@ -225,20 +225,20 @@
 !                    !                       ! categories !  reference  !    orientation       ! grids  !
 ! send
-sn_snd_temp   =       'weighted oce and ice' ,    'no'    ,     ''      ,         ''           ,   ''    
-sn_snd_alb    =       'weighted ice'         ,    'no'    ,     ''      ,         ''           ,   ''    
-sn_snd_thick  =       'none'                 ,    'no'   ,     ''      ,         ''           ,   ''    
-sn_snd_crt    =       'none'                 ,    'no'    , 'spherical' , 'eastward-northward' ,  'T'       
-sn_snd_co2    =       'coupled'              ,    'no'    ,     ''      ,         ''           ,   ''        
+sn_snd_temp   =       'weighted oce and ice' ,    'no'    ,     ''      ,         ''           ,   ''
+sn_snd_alb    =       'weighted ice'         ,    'no'    ,     ''      ,         ''           ,   ''
+sn_snd_thick  =       'none'                 ,    'no'   ,     ''      ,         ''           ,   ''
+sn_snd_crt    =       'none'                 ,    'no'    , 'spherical' , 'eastward-northward' ,  'T'
+sn_snd_co2    =       'coupled'              ,    'no'    ,     ''      ,         ''           ,   ''
 ! receive
-sn_rcv_w10m   =       'none'                 ,    'no'    ,     ''      ,         ''          ,   ''    
-sn_rcv_taumod =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''    
-sn_rcv_tau    =       'oce only'             ,    'no'    , 'cartesian' , 'eastward-northward',  'U,V'   
-sn_rcv_dqnsdt =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''    
-sn_rcv_qsr    =       'oce and ice'          ,    'no'    ,     ''      ,         ''          ,   ''    
-sn_rcv_qns    =       'oce and ice'          ,    'no'    ,     ''      ,         ''          ,   ''    
-sn_rcv_emp    =       'conservative'         ,    'no'    ,     ''      ,         ''          ,   ''    
-sn_rcv_rnf    =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''    
-sn_rcv_cal    =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''    
-sn_rcv_co2    =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''    
+sn_rcv_w10m   =       'none'                 ,    'no'    ,     ''      ,         ''          ,   ''
+sn_rcv_taumod =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''
+sn_rcv_tau    =       'oce only'             ,    'no'    , 'cartesian' , 'eastward-northward',  'U,V'
+sn_rcv_dqnsdt =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''
+sn_rcv_qsr    =       'oce and ice'          ,    'no'    ,     ''      ,         ''          ,   ''
+sn_rcv_qns    =       'oce and ice'          ,    'no'    ,     ''      ,         ''          ,   ''
+sn_rcv_emp    =       'conservative'         ,    'no'    ,     ''      ,         ''          ,   ''
+sn_rcv_rnf    =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''
+sn_rcv_cal    =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''
+sn_rcv_co2    =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''
 /
 !-----------------------------------------------------------------------
@@ -248,5 +248,5 @@
 !              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
    sn_chl      ='chlorophyll',        -1         , 'CHLA'    ,   .true.     , .true. , 'yearly'  , ''       , ''
- 
+
    cn_dir      = './'      !  root directory for the location of the runoff files
    ln_traqsr   = .true.    !  Light penetration (T) or not (F)
@@ -297,5 +297,5 @@
    sn_sst      = 'sst_data'  ,        24         ,  'sst'    ,    .false.   , .false., 'yearly'  , ''       , ''
    sn_sss      = 'sss_data'  ,        -1         ,  'sss'    ,    .true.    , .true. , 'yearly'  , ''       , ''
-    
+
    cn_dir      = './'      !  root directory for the location of the runoff files
    nn_sstr     =     0     !  add a retroaction term in the surface heat       flux (=1) or not (=0)
@@ -306,12 +306,12 @@
    ln_sssr_bnd =   .false. !  flag to bound erp term (associated with nn_sssr=2)
    rn_sssr_bnd =   4.e0    !  ABS(Max/Min) value of the damping erp term [mm/day]
-/      
+/
 !-----------------------------------------------------------------------
 &namsbc_alb    !   albedo parameters
 !-----------------------------------------------------------------------
-   rn_cloud    =    0.06   !  cloud correction to snow and ice albedo 
+   rn_cloud    =    0.06   !  cloud correction to snow and ice albedo
    rn_albice   =    0.53   !  albedo of melting ice in the arctic and antarctic
    rn_alphd    =    0.80   !  coefficients for linear interpolation used to
-   rn_alphc    =    0.65   !  compute albedo between two extremes values 
+   rn_alphc    =    0.65   !  compute albedo between two extremes values
    rn_alphdi   =    0.72   !  (Pyane, 1972)
 /
@@ -323,5 +323,5 @@
 !!   namcla        cross land advection
 !!   namobc        open boundaries parameters                           ("key_obc")
-!!   namagrif      agrif nested grid ( read by child model only )       ("key_agrif") 
+!!   namagrif      agrif nested grid ( read by child model only )       ("key_agrif")
 !!   nambdy        Unstructured open boundaries                         ("key_bdy")
 !!   namtide       Tidal forcing at open boundaries                     ("key_bdy_tides")
@@ -345,5 +345,5 @@
    ln_obc_clim = .false.   !  climatological obc data files (T) or not (F)
    ln_vol_cst  = .true.    !  impose the total volume conservation (T) or not (F)
-   ln_obc_fla  = .false.   !  Flather open boundary condition 
+   ln_obc_fla  = .false.   !  Flather open boundary condition
    nn_obcdta   =    1      !  = 0 the obc data are equal to the initial state
                            !  = 1 the obc data are read in 'obc.dta' files
@@ -394,5 +394,5 @@
 &nambdy        !  unstructured open boundaries                          ("key_bdy")
 !-----------------------------------------------------------------------
-    nb_bdy = 1                            !  number of open boundary sets       
+    nb_bdy = 1                            !  number of open boundary sets
     ln_coords_file = .true.               !  =T : read bdy coordinates from file
     cn_coords_file = 'coordinates.bdy.nc' !  bdy coordinates files
@@ -430,5 +430,5 @@
 /
 !-----------------------------------------------------------------------
-&nambdy_tide     ! tidal forcing at open boundaries              
+&nambdy_tide     ! tidal forcing at open boundaries
 !-----------------------------------------------------------------------
    filtide      = 'bdydta/amm12_bdytide_'         !  file name root of tidal forcing files
@@ -469,5 +469,5 @@
 !!======================================================================
 !!   nambfr        bottom friction
-!!   nambbc        bottom temperature boundary condition               
+!!   nambbc        bottom temperature boundary condition
 !!   nambbl        bottom boundary layer scheme                         ("key_trabbl")
 !!======================================================================
@@ -489,7 +489,7 @@
 !-----------------------------------------------------------------------
    ln_trabbc   = .false.   !  Apply a geothermal heating at the ocean bottom
-   nn_geoflx   =    0      !  geothermal heat flux: = 0 no flux 
+   nn_geoflx   =    0      !  geothermal heat flux: = 0 no flux
                            !     = 1 constant flux
-                           !     = 2 variable flux (read in geothermal_heating.nc in mW/m2) 
+                           !     = 2 variable flux (read in geothermal_heating.nc in mW/m2)
    rn_geoflx_cst = 86.4e-3 !  Constant value of geothermal heat flux [W/m2]
 /
@@ -509,5 +509,5 @@
 !!   namtra_adv    advection scheme
 !!   namtra_ldf    lateral diffusion scheme
-!!   namtra_dmp    T & S newtonian damping                        
+!!   namtra_dmp    T & S newtonian damping
 !!======================================================================
 !
@@ -523,12 +523,12 @@
 /
 !-----------------------------------------------------------------------
-&namtra_adv    !   advection scheme for tracer 
-!-----------------------------------------------------------------------
-   ln_traadv_cen2   =  .false.  !  2nd order centered scheme   
-   ln_traadv_tvd    =  .true.   !  TVD scheme                
-   ln_traadv_muscl  =  .false.  !  MUSCL scheme             
-   ln_traadv_muscl2 =  .false.  !  MUSCL2 scheme + cen2 at boundaries  
-   ln_traadv_ubs    =  .false.  !  UBS scheme                 
-   ln_traadv_qck    =  .false.  !  QUICKEST scheme                 
+&namtra_adv    !   advection scheme for tracer
+!-----------------------------------------------------------------------
+   ln_traadv_cen2   =  .false.  !  2nd order centered scheme
+   ln_traadv_tvd    =  .true.   !  TVD scheme
+   ln_traadv_muscl  =  .false.  !  MUSCL scheme
+   ln_traadv_muscl2 =  .false.  !  MUSCL2 scheme + cen2 at boundaries
+   ln_traadv_ubs    =  .false.  !  UBS scheme
+   ln_traadv_qck    =  .false.  !  QUICKEST scheme
 /
 !----------------------------------------------------------------------------------
@@ -557,5 +557,5 @@
 /
 !-----------------------------------------------------------------------
-&namtra_dmp    !   tracer: T & S newtonian damping                      
+&namtra_dmp    !   tracer: T & S newtonian damping
 !-----------------------------------------------------------------------
    ln_tradmp   =  .false.  !  add a damping termn (T) or not (F)
@@ -585,20 +585,20 @@
 &namdyn_adv    !   formulation of the momentum advection
 !-----------------------------------------------------------------------
-   ln_dynadv_vec = .true.  !  vector form (T) or flux form (F)  
+   ln_dynadv_vec = .true.  !  vector form (T) or flux form (F)
    ln_dynadv_cen2= .false. !  flux form - 2nd order centered scheme
-   ln_dynadv_ubs = .false. !  flux form - 3rd order UBS      scheme 
-/  
+   ln_dynadv_ubs = .false. !  flux form - 3rd order UBS      scheme
+/
 !-----------------------------------------------------------------------
 &namdyn_vor    !   option of physics/algorithm (not control by CPP keys)
 !-----------------------------------------------------------------------
-   ln_dynvor_ene = .true.  !  enstrophy conserving scheme  
-   ln_dynvor_ens = .false. !  energy conserving scheme    
-   ln_dynvor_mix = .false. !  mixed scheme               
-   ln_dynvor_een = .false. !  energy & enstrophy scheme  
+   ln_dynvor_ene = .true.  !  enstrophy conserving scheme
+   ln_dynvor_ens = .false. !  energy conserving scheme
+   ln_dynvor_mix = .false. !  mixed scheme
+   ln_dynvor_een = .false. !  energy & enstrophy scheme
 /
 !-----------------------------------------------------------------------
 &namdyn_hpg    !   Hydrostatic pressure gradient option
 !-----------------------------------------------------------------------
-   ln_hpg_zco  = .true.    !  z-coordinate - full steps                   
+   ln_hpg_zco  = .true.    !  z-coordinate - full steps
    ln_hpg_zps  = .false.   !  z-coordinate - partial steps (interpolation)
    ln_hpg_sco  = .false.   !  s-coordinate (standard jacobian formulation)
@@ -618,9 +618,9 @@
 &namdyn_ldf    !   lateral diffusion on momentum
 !-----------------------------------------------------------------------
-   !                       !  Type of the operator : 
-   ln_dynldf_lap    =  .true.   !  laplacian operator         
-   ln_dynldf_bilap  =  .false.  !  bilaplacian operator    
-   !                       !  Direction of action  : 
-   ln_dynldf_level  =  .false.  !  iso-level               
+   !                       !  Type of the operator :
+   ln_dynldf_lap    =  .true.   !  laplacian operator
+   ln_dynldf_bilap  =  .false.  !  bilaplacian operator
+   !                       !  Direction of action  :
+   ln_dynldf_level  =  .false.  !  iso-level
    ln_dynldf_hor    =  .true.   !  horizontal (geopotential)            (require "key_ldfslp" in s-coord.)
    ln_dynldf_iso    =  .false.  !  iso-neutral                          (require "key_ldfslp")
@@ -701,11 +701,11 @@
 &namzdf_kpp    !   K-Profile Parameterization dependent vertical mixing  ("key_zdfkpp", and optionally:
 !------------------------------------------------------------------------ "key_kppcustom" or "key_kpplktb")
-   ln_kpprimix = .true.    !  shear instability mixing 
+   ln_kpprimix = .true.    !  shear instability mixing
    rn_difmiw   =  1.0e-04  !  constant internal wave viscosity [m2/s]
    rn_difsiw   =  0.1e-04  !  constant internal wave diffusivity [m2/s]
    rn_riinfty  =  0.8      !  local Richardson Number limit for shear instability
    rn_difri    =  0.0050   !  maximum shear mixing at Rig = 0    [m2/s]
-   rn_bvsqcon  = -0.01e-07 !  Brunt-Vaisala squared for maximum convection [1/s2] 
-   rn_difcon   =  1.       !  maximum mixing in interior convection [m2/s] 
+   rn_bvsqcon  = -0.01e-07 !  Brunt-Vaisala squared for maximum convection [1/s2]
+   rn_difcon   =  1.       !  maximum mixing in interior convection [m2/s]
    nn_avb      =  0        !  horizontal averaged (=1) or not (=0) on avt and amv
    nn_ave      =  1        !  constant (=0) or profile (=1) background on avt
@@ -741,5 +741,5 @@
    rn_n2min    = 1.e-8     !  threshold of the Brunt-Vaisala frequency (s-1)
    rn_tfe      = 0.333     !  tidal dissipation efficiency
-   rn_me       = 0.2       !  mixing efficiency 
+   rn_me       = 0.2       !  mixing efficiency
    ln_tmx_itf  = .false.   !  ITF specific parameterisation
    rn_tfe_itf  = 1.        !  ITF tidal dissipation efficiency
@@ -751,9 +751,9 @@
 !!   nammpp            Massively Parallel Processing                    ("key_mpp_mpi)
 !!   namctl            Control prints & Benchmark
-!!   namsol            elliptic solver / island / free surface 
-!!======================================================================
-!
-!-----------------------------------------------------------------------
-&namsol        !   elliptic solver / island / free surface 
+!!   namsol            elliptic solver / island / free surface
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&namsol        !   elliptic solver / island / free surface
 !-----------------------------------------------------------------------
    nn_solv     =      2    !  elliptic solver: =1 preconditioned conjugate gradient (pcg)
@@ -774,7 +774,7 @@
    nn_buffer   =   0       !  size in bytes of exported buffer ('B' case), 0 no exportation
    ln_nnogather=  .false.  !  activate code to avoid mpi_allgather use at the northfold
-   jpni        =   0       !  jpni   number of processors following i (set automatically if < 1)     
-   jpnj        =   0       !  jpnj   number of processors following j (set automatically if < 1)     
-   jpnij       =   0       !  jpnij  number of local domains (set automatically if < 1)              
+   jpni        =   0       !  jpni   number of processors following i (set automatically if < 1)
+   jpnj        =   0       !  jpnj   number of processors following j (set automatically if < 1)
+   jpnij       =   0       !  jpnij  number of local domains (set automatically if < 1)
 /
 !-----------------------------------------------------------------------
@@ -801,5 +801,5 @@
 !!   namflo       float parameters                                      ("key_float")
 !!   namptr       Poleward Transport Diagnostics
-!!   namhsb       Heat and salt budgets 
+!!   namhsb       Heat and salt budgets
 !!======================================================================
 !
@@ -846,5 +846,5 @@
    ln_diaptr  = .false.    !  Poleward heat and salt transport (T) or not (F)
    ln_diaznl  = .true.     !  Add zonal means and meridional stream functions
-   ln_subbas  = .true.     !  Atlantic/Pacific/Indian basins computation (T) or not 
+   ln_subbas  = .true.     !  Atlantic/Pacific/Indian basins computation (T) or not
                            !  (orca configuration only, need input basins mask file named "subbasins.nc"
    ln_ptrcomp = .true.     !  Add decomposition : overturning
@@ -853,5 +853,5 @@
 /
 !-----------------------------------------------------------------------
-&namhsb       !  Heat and salt budgets 
+&namhsb       !  Heat and salt budgets
 !-----------------------------------------------------------------------
    ln_diahsb  = .false.    !  check the heat and salt budgets (T) or not (F)
@@ -865,5 +865,5 @@
                            !     -1 : debug all section
                            !  0 < n : debug section number n
-/ 
+/
 
 !!======================================================================
@@ -877,72 +877,71 @@
 &namobs       !  observation usage switch                               ('key_diaobs')
 !-----------------------------------------------------------------------
-   ln_t3d     = .false.    ! Logical switch for T profile observations         
-   ln_s3d     = .false.    ! Logical switch for S profile observations          
-   ln_ena     = .false.    ! Logical switch for ENACT insitu data set           
-   !                       !     ln_cor                  Logical switch for Coriolis insitu data set       
-   ln_profb   = .false.    ! Logical switch for feedback insitu data set     
-   ln_sla     = .false.    ! Logical switch for SLA observations               
-
-   ln_sladt   = .false.    ! Logical switch for AVISO SLA data              
-
-   ln_slafb   = .false.    ! Logical switch for feedback SLA data            
-                           !     ln_ssh                  Logical switch for SSH observations              
-
-   ln_sst     = .false.    ! Logical switch for SST observations              
-                           !     ln_reysst               Logical switch for Reynolds observations       
-                           !     ln_ghrsst               Logical switch for GHRSST observations          
-
-   ln_sstfb   = .false.    ! Logical switch for feedback SST data          
-                           !     ln_sss                  Logical switch for SSS observations              
-                           !     ln_seaice               Logical switch for Sea Ice observations        
-                           !     ln_vel3d                Logical switch for velocity observations         
-                           !     ln_velavcur             Logical switch for velocity daily av. cur.    
-                           !     ln_velhrcur             Logical switch for velocity high freq. cur.   
-                           !     ln_velavadcp            Logical switch for velocity daily av. ADCP  
+   ln_t3d     = .false.    ! Logical switch for T profile observations
+   ln_s3d     = .false.    ! Logical switch for S profile observations
+   ln_ena     = .false.    ! Logical switch for ENACT insitu data set
+   !                       !     ln_cor                  Logical switch for Coriolis insitu data set
+   ln_profb   = .false.    ! Logical switch for feedback insitu data set
+   ln_sla     = .false.    ! Logical switch for SLA observations
+
+   ln_sladt   = .false.    ! Logical switch for AVISO SLA data
+
+   ln_slafb   = .false.    ! Logical switch for feedback SLA data
+                           !     ln_ssh                  Logical switch for SSH observations
+
+   ln_sst     = .false.    ! Logical switch for SST observations
+                           !     ln_reysst               Logical switch for Reynolds observations
+                           !     ln_ghrsst               Logical switch for GHRSST observations
+
+   ln_sstfb   = .false.    ! Logical switch for feedback SST data
+                           !     ln_sss                  Logical switch for SSS observations
+                           !     ln_seaice               Logical switch for Sea Ice observations
+                           !     ln_vel3d                Logical switch for velocity observations
+                           !     ln_velavcur             Logical switch for velocity daily av. cur.
+                           !     ln_velhrcur             Logical switch for velocity high freq. cur.
+                           !     ln_velavadcp            Logical switch for velocity daily av. ADCP
                            !     ln_velhradcp            Logical switch for velocity high freq. ADCP
-                           !     ln_velfb                Logical switch for feedback velocity data       
-                           !     ln_grid_global          Global distribtion of observations         
-                           !     ln_grid_search_lookup   Logical switch for obs grid search w/lookup table  
-                           !     grid_search_file        Grid search lookup file header 
-                           !     enactfiles              ENACT input observation file names 
-                           !     coriofiles              Coriolis input observation file name  
-   !                       ! profbfiles: Profile feedback input observation file name 
+                           !     ln_velfb                Logical switch for feedback velocity data
+                           !     ln_grid_global          Global distribtion of observations
+                           !     ln_grid_search_lookup   Logical switch for obs grid search w/lookup table
+                           !     grid_search_file        Grid search lookup file header
+                           !     enactfiles              ENACT input observation file names
+                           !     coriofiles              Coriolis input observation file name
+   !                       ! profbfiles: Profile feedback input observation file name
    profbfiles = 'profiles_01.nc'
-                           !     ln_profb_enatim         Enact feedback input time setting switch    
+                           !     ln_profb_enatim         Enact feedback input time setting switch
                            !     slafilesact             Active SLA input observation file name
-                           !     slafilespas             Passive SLA input observation file name 
-   !                       ! slafbfiles: Feedback SLA input observation file name 
+                           !     slafilespas             Passive SLA input observation file name
+   !                       ! slafbfiles: Feedback SLA input observation file name
    slafbfiles = 'sla_01.nc'
-                           !     sstfiles                GHRSST input observation file name       
-   !                       ! sstfbfiles: Feedback SST input observation file name 
+                           !     sstfiles                GHRSST input observation file name
+   !                       ! sstfbfiles: Feedback SST input observation file name
    sstfbfiles = 'sst_01.nc' 'sst_02.nc' 'sst_03.nc' 'sst_04.nc' 'sst_05.nc'
-                           !     seaicefiles             Sea Ice input observation file name 
-                           !     velavcurfiles           Vel. cur. daily av. input file name  
-                           !     velhvcurfiles           Vel. cur. high freq. input file name  
-                           !     velavadcpfiles          Vel. ADCP daily av. input file name    
-                           !     velhvadcpfiles          Vel. ADCP high freq. input file name 
-                           !     velfbfiles              Vel. feedback input observation file name 
-                           !     dobsini                 Initial date in window YYYYMMDD.HHMMSS       
-                           !     dobsend                 Final date in window YYYYMMDD.HHMMSS         
-                           !     n1dint                  Type of vertical interpolation method        
-                           !     n2dint                  Type of horizontal interpolation method       
-                           !     ln_nea                  Rejection of observations near land switch    
-   nmsshc     = 0          ! MSSH correction scheme                         
-                           !     mdtcorr                 MDT  correction                               
-                           !     mdtcutoff               MDT cutoff for computed correction          
-   ln_altbias = .false.    ! Logical switch for alt bias                
-   ln_ignmis  = .true.     ! Logical switch for ignoring missing files   
-                           !     endailyavtypes   ENACT daily average types                    
+                           !     seaicefiles             Sea Ice input observation file name
+                           !     velavcurfiles           Vel. cur. daily av. input file name
+                           !     velhvcurfiles           Vel. cur. high freq. input file name
+                           !     velavadcpfiles          Vel. ADCP daily av. input file name
+                           !     velhvadcpfiles          Vel. ADCP high freq. input file name
+                           !     velfbfiles              Vel. feedback input observation file name
+                           !     dobsini                 Initial date in window YYYYMMDD.HHMMSS
+                           !     dobsend                 Final date in window YYYYMMDD.HHMMSS
+                           !     n1dint                  Type of vertical interpolation method
+                           !     n2dint                  Type of horizontal interpolation method
+                           !     ln_nea                  Rejection of observations near land switch
+   nmsshc     = 0          ! MSSH correction scheme
+                           !     mdtcorr                 MDT  correction
+                           !     mdtcutoff               MDT cutoff for computed correction
+   ln_altbias = .false.    ! Logical switch for alt bias
+   ln_ignmis  = .true.     ! Logical switch for ignoring missing files
+                           !     endailyavtypes   ENACT daily average types
    ln_grid_global = .true.
    ln_grid_search_lookup = .false.
-/ 
+/
 !-----------------------------------------------------------------------
 &nam_asminc   !   assimilation increments                               ('key_asminc')
 !-----------------------------------------------------------------------
-    ln_bkgwri = .false.    !  Logical switch for writing out background state 
-    ln_trjwri = .false.    !  Logical switch for writing out state trajectory
+    ln_bkgwri = .false.    !  Logical switch for writing out background state
     ln_trainc = .false.    !  Logical switch for applying tracer increments
     ln_dyninc = .false.    !  Logical switch for applying velocity increments
-    ln_sshinc = .false.    !  Logical switch for applying SSH increments 
+    ln_sshinc = .false.    !  Logical switch for applying SSH increments
     ln_asmdin = .false.    !  Logical switch for Direct Initialization (DI)
     ln_asmiau = .false.    !  Logical switch for Incremental Analysis Updating (IAU)
@@ -952,5 +951,4 @@
     nitiaufin = 15         !  Timestep of end of IAU interval in [0,nitend-nit000-1]
     niaufn    = 0          !  Type of IAU weighting function
-    nittrjfrq = 0          !  Frequency of trajectory output for 4D-VAR
     ln_salfix = .false.    !  Logical switch for ensuring that the sa > salfixmin
     salfixmin = -9999      !  Minimum salinity after applying the increments
@@ -981,2 +979,10 @@
    rn_htrmax         =  200.0   ! max. depth of transition range
 /
+!-----------------------------------------------------------------------
+&namtrj ! Handling non-linear trajectory for TAM (output for direct model, input for TAM)
+!-----------------------------------------------------------------------
+    cn_dirtrj   = 'tam_trajectory'   ! prefix for input/ouput files
+    ln_trjhand  = .false.            ! Handling non linear trajectory
+    nn_ittrjfrq = 20                 ! Output/input frequency
+    ln_trj_spl = .false.             ! Handling trajectory at simple precision
+/
Index: /trunk/NEMOGCM/CONFIG/ORCA2_LIM/EXP00/namelist
===================================================================
--- /trunk/NEMOGCM/CONFIG/ORCA2_LIM/EXP00/namelist	(revision 3603)
+++ /trunk/NEMOGCM/CONFIG/ORCA2_LIM/EXP00/namelist	(revision 3604)
@@ -3,5 +3,5 @@
 !! namelists    2 - Domain           (namzgr, namzgr_sco, namdom, namtsd)
 !!              3 - Surface boundary (namsbc, namsbc_ana, namsbc_flx, namsbc_clio, namsbc_core
-!!                                    namsbc_cpl, namtra_qsr, namsbc_rnf, 
+!!                                    namsbc_cpl, namtra_qsr, namsbc_rnf,
 !!                                    namsbc_apr, namsbc_ssr, namsbc_alb)
 !!              4 - lateral boundary (namlbc, namcla, namobc, namagrif, nambdy, nambdy_tide)
@@ -25,5 +25,5 @@
 !-----------------------------------------------------------------------
    nn_no       =       0   !  job number (no more used...)
-   cn_exp      =  "ORCA2"  !  experience name 
+   cn_exp      =  "ORCA2"  !  experience name
    nn_it000    =       1   !  first time step
    nn_itend    =    5475   !  last  time step (std 5475)
@@ -52,5 +52,5 @@
 !!   namzgr_sco   s-coordinate or hybrid z-s-coordinate
 !!   namdom       space and time domain (bathymetry, mesh, timestep)
-!!   namtsd       data: temperature & salinity                         
+!!   namtsd       data: temperature & salinity
 !!======================================================================
 !
@@ -72,5 +72,5 @@
    ln_s_sigma  = .false.   !  hybrid s-sigma coordinates
    rn_bb       =    0.8    !  stretching with s-sigma
-   rn_hc       =  150.0    !  critical depth with s-sigma 
+   rn_hc       =  150.0    !  critical depth with s-sigma
 /
 !-----------------------------------------------------------------------
@@ -94,5 +94,5 @@
 /
 !-----------------------------------------------------------------------
-&namtsd    !   data : Temperature  & Salinity                           
+&namtsd    !   data : Temperature  & Salinity
 !-----------------------------------------------------------------------
 !          ! file name ! frequency (hours)    ! variable ! time interp. ! clim  !'yearly' or ! weights  ! rotation !
@@ -125,10 +125,10 @@
 &namsbc        !   Surface Boundary Condition (surface module)
 !-----------------------------------------------------------------------
-   nn_fsbc     = 5         !  frequency of surface boundary condition computation 
+   nn_fsbc     = 5         !  frequency of surface boundary condition computation
                            !     (also = the frequency of sea-ice model call)
-   ln_ana      = .false.   !  analytical formulation                    (T => fill namsbc_ana ) 
+   ln_ana      = .false.   !  analytical formulation                    (T => fill namsbc_ana )
    ln_flx      = .false.   !  flux formulation                          (T => fill namsbc_flx )
-   ln_blk_clio = .false.   !  CLIO bulk formulation                     (T => fill namsbc_clio) 
-   ln_blk_core = .true.    !  CORE bulk formulation                     (T => fill namsbc_core) 
+   ln_blk_clio = .false.   !  CLIO bulk formulation                     (T => fill namsbc_clio)
+   ln_blk_core = .true.    !  CORE bulk formulation                     (T => fill namsbc_core)
    ln_blk_mfs  = .false.   !  MFS bulk formulation                      (T => fill namsbc_mfs )
    ln_cpl      = .false.   !  Coupled formulation                       (T => fill namsbc_cpl )
@@ -140,6 +140,6 @@
    ln_rnf      = .true.    !  runoffs                                   (T => fill namsbc_rnf)
    ln_ssr      = .true.    !  Sea Surface Restoring on T and/or S       (T => fill namsbc_ssr)
-   nn_fwb      = 3         !  FreshWater Budget: =0 unchecked 
-                           !     =1 global mean of e-p-r set to zero at each time step 
+   nn_fwb      = 3         !  FreshWater Budget: =0 unchecked
+                           !     =1 global mean of e-p-r set to zero at each time step
                            !     =2 annual global mean of e-p-r set to zero
                            !     =3 global emp set to zero and spread out over erp area
@@ -168,5 +168,5 @@
 
    cn_dir      = './'      !  root directory for the location of the flux files
-/      
+/
 !-----------------------------------------------------------------------
 &namsbc_clio   !   namsbc_clio  CLIO bulk formulae
@@ -225,20 +225,20 @@
 !                    !                       ! categories !  reference  !    orientation       ! grids  !
 ! send
-sn_snd_temp   =       'weighted oce and ice' ,    'no'    ,     ''      ,         ''           ,   ''    
-sn_snd_alb    =       'weighted ice'         ,    'no'    ,     ''      ,         ''           ,   ''    
-sn_snd_thick  =       'none'                 ,    'no'   ,     ''      ,         ''           ,   ''    
-sn_snd_crt    =       'none'                 ,    'no'    , 'spherical' , 'eastward-northward' ,  'T'       
-sn_snd_co2    =       'coupled'              ,    'no'    ,     ''      ,         ''           ,   ''        
+sn_snd_temp   =       'weighted oce and ice' ,    'no'    ,     ''      ,         ''           ,   ''
+sn_snd_alb    =       'weighted ice'         ,    'no'    ,     ''      ,         ''           ,   ''
+sn_snd_thick  =       'none'                 ,    'no'   ,     ''      ,         ''           ,   ''
+sn_snd_crt    =       'none'                 ,    'no'    , 'spherical' , 'eastward-northward' ,  'T'
+sn_snd_co2    =       'coupled'              ,    'no'    ,     ''      ,         ''           ,   ''
 ! receive
-sn_rcv_w10m   =       'none'                 ,    'no'    ,     ''      ,         ''          ,   ''    
-sn_rcv_taumod =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''    
-sn_rcv_tau    =       'oce only'             ,    'no'    , 'cartesian' , 'eastward-northward',  'U,V'   
-sn_rcv_dqnsdt =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''    
-sn_rcv_qsr    =       'oce and ice'          ,    'no'    ,     ''      ,         ''          ,   ''    
-sn_rcv_qns    =       'oce and ice'          ,    'no'    ,     ''      ,         ''          ,   ''    
-sn_rcv_emp    =       'conservative'         ,    'no'    ,     ''      ,         ''          ,   ''    
-sn_rcv_rnf    =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''    
-sn_rcv_cal    =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''    
-sn_rcv_co2    =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''    
+sn_rcv_w10m   =       'none'                 ,    'no'    ,     ''      ,         ''          ,   ''
+sn_rcv_taumod =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''
+sn_rcv_tau    =       'oce only'             ,    'no'    , 'cartesian' , 'eastward-northward',  'U,V'
+sn_rcv_dqnsdt =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''
+sn_rcv_qsr    =       'oce and ice'          ,    'no'    ,     ''      ,         ''          ,   ''
+sn_rcv_qns    =       'oce and ice'          ,    'no'    ,     ''      ,         ''          ,   ''
+sn_rcv_emp    =       'conservative'         ,    'no'    ,     ''      ,         ''          ,   ''
+sn_rcv_rnf    =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''
+sn_rcv_cal    =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''
+sn_rcv_co2    =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''
 /
 !-----------------------------------------------------------------------
@@ -300,5 +300,5 @@
    cn_dir      = './'      !  root directory for the location of the runoff files
    nn_sstr     =     0     !  add a retroaction term in the surface heat       flux (=1) or not (=0)
-   nn_sssr     =     2     !  add a damping     term in the surface freshwater flux (=2) 
+   nn_sssr     =     2     !  add a damping     term in the surface freshwater flux (=2)
                            !  or to SSS only (=1) or no damping term (=0)
    rn_dqdt     =   -40.    !  magnitude of the retroaction on temperature   [W/m2/K]
@@ -306,12 +306,12 @@
    ln_sssr_bnd =   .true.  !  flag to bound erp term (associated with nn_sssr=2)
    rn_sssr_bnd =   4.e0    !  ABS(Max/Min) value of the damping erp term [mm/day]
-/      
+/
 !-----------------------------------------------------------------------
 &namsbc_alb    !   albedo parameters
 !-----------------------------------------------------------------------
-   rn_cloud    =    0.06   !  cloud correction to snow and ice albedo 
+   rn_cloud    =    0.06   !  cloud correction to snow and ice albedo
    rn_albice   =    0.53   !  albedo of melting ice in the arctic and antarctic
    rn_alphd    =    0.80   !  coefficients for linear interpolation used to
-   rn_alphc    =    0.65   !  compute albedo between two extremes values 
+   rn_alphc    =    0.65   !  compute albedo between two extremes values
    rn_alphdi   =    0.72   !  (Pyane, 1972)
 /
@@ -323,5 +323,5 @@
 !!   namcla        cross land advection
 !!   namobc        open boundaries parameters                           ("key_obc")
-!!   namagrif      agrif nested grid ( read by child model only )       ("key_agrif") 
+!!   namagrif      agrif nested grid ( read by child model only )       ("key_agrif")
 !!   nambdy        Unstructured open boundaries                         ("key_bdy")
 !!   namtide       Tidal forcing at open boundaries                     ("key_bdy_tides")
@@ -345,5 +345,5 @@
    ln_obc_clim = .false.   !  climatological obc data files (T) or not (F)
    ln_vol_cst  = .true.    !  impose the total volume conservation (T) or not (F)
-   ln_obc_fla  = .false.   !  Flather open boundary condition 
+   ln_obc_fla  = .false.   !  Flather open boundary condition
    nn_obcdta   =    1      !  = 0 the obc data are equal to the initial state
                            !  = 1 the obc data are read in 'obc.dta' files
@@ -389,5 +389,5 @@
 &nambdy        !  unstructured open boundaries                          ("key_bdy")
 !-----------------------------------------------------------------------
-    nb_bdy = 1                            !  number of open boundary sets       
+    nb_bdy = 1                            !  number of open boundary sets
     ln_coords_file = .true.               !  =T : read bdy coordinates from file
     cn_coords_file = 'coordinates.bdy.nc' !  bdy coordinates files
@@ -425,5 +425,5 @@
 /
 !-----------------------------------------------------------------------
-&nambdy_tide     ! tidal forcing at open boundaries              
+&nambdy_tide     ! tidal forcing at open boundaries
 !-----------------------------------------------------------------------
    filtide      = 'bdydta/amm12_bdytide_'         !  file name root of tidal forcing files
@@ -464,5 +464,5 @@
 !!======================================================================
 !!   nambfr        bottom friction
-!!   nambbc        bottom temperature boundary condition               
+!!   nambbc        bottom temperature boundary condition
 !!   nambbl        bottom boundary layer scheme                         ("key_trabbl")
 !!======================================================================
@@ -484,7 +484,7 @@
 !-----------------------------------------------------------------------
    ln_trabbc   = .true.    !  Apply a geothermal heating at the ocean bottom
-   nn_geoflx   =    2      !  geothermal heat flux: = 0 no flux 
+   nn_geoflx   =    2      !  geothermal heat flux: = 0 no flux
                            !     = 1 constant flux
-                           !     = 2 variable flux (read in geothermal_heating.nc in mW/m2) 
+                           !     = 2 variable flux (read in geothermal_heating.nc in mW/m2)
    rn_geoflx_cst = 86.4e-3 !  Constant value of geothermal heat flux [W/m2]
 /
@@ -504,5 +504,5 @@
 !!   namtra_adv    advection scheme
 !!   namtra_ldf    lateral diffusion scheme
-!!   namtra_dmp    T & S newtonian damping                        
+!!   namtra_dmp    T & S newtonian damping
 !!======================================================================
 !
@@ -518,12 +518,12 @@
 /
 !-----------------------------------------------------------------------
-&namtra_adv    !   advection scheme for tracer 
-!-----------------------------------------------------------------------
-   ln_traadv_cen2   =  .false.  !  2nd order centered scheme   
-   ln_traadv_tvd    =  .true.   !  TVD scheme                
-   ln_traadv_muscl  =  .false.  !  MUSCL scheme             
-   ln_traadv_muscl2 =  .false.  !  MUSCL2 scheme + cen2 at boundaries  
-   ln_traadv_ubs    =  .false.  !  UBS scheme                 
-   ln_traadv_qck    =  .false.  !  QUICKEST scheme                 
+&namtra_adv    !   advection scheme for tracer
+!-----------------------------------------------------------------------
+   ln_traadv_cen2   =  .false.  !  2nd order centered scheme
+   ln_traadv_tvd    =  .true.   !  TVD scheme
+   ln_traadv_muscl  =  .false.  !  MUSCL scheme
+   ln_traadv_muscl2 =  .false.  !  MUSCL2 scheme + cen2 at boundaries
+   ln_traadv_ubs    =  .false.  !  UBS scheme
+   ln_traadv_qck    =  .false.  !  QUICKEST scheme
 /
 !----------------------------------------------------------------------------------
@@ -552,5 +552,5 @@
 /
 !-----------------------------------------------------------------------
-&namtra_dmp    !   tracer: T & S newtonian damping                  
+&namtra_dmp    !   tracer: T & S newtonian damping
 !-----------------------------------------------------------------------
    ln_tradmp   =  .true.   !  add a damping termn (T) or not (F)
@@ -580,20 +580,20 @@
 &namdyn_adv    !   formulation of the momentum advection
 !-----------------------------------------------------------------------
-   ln_dynadv_vec = .true.  !  vector form (T) or flux form (F)  
+   ln_dynadv_vec = .true.  !  vector form (T) or flux form (F)
    ln_dynadv_cen2= .false. !  flux form - 2nd order centered scheme
-   ln_dynadv_ubs = .false. !  flux form - 3rd order UBS      scheme 
-/  
+   ln_dynadv_ubs = .false. !  flux form - 3rd order UBS      scheme
+/
 !-----------------------------------------------------------------------
 &namdyn_vor    !   option of physics/algorithm (not control by CPP keys)
 !-----------------------------------------------------------------------
-   ln_dynvor_ene = .false. !  enstrophy conserving scheme  
-   ln_dynvor_ens = .false. !  energy conserving scheme    
-   ln_dynvor_mix = .false. !  mixed scheme               
-   ln_dynvor_een = .true.  !  energy & enstrophy scheme  
+   ln_dynvor_ene = .false. !  enstrophy conserving scheme
+   ln_dynvor_ens = .false. !  energy conserving scheme
+   ln_dynvor_mix = .false. !  mixed scheme
+   ln_dynvor_een = .true.  !  energy & enstrophy scheme
 /
 !-----------------------------------------------------------------------
 &namdyn_hpg    !   Hydrostatic pressure gradient option
 !-----------------------------------------------------------------------
-   ln_hpg_zco  = .false.   !  z-coordinate - full steps                   
+   ln_hpg_zco  = .false.   !  z-coordinate - full steps
    ln_hpg_zps  = .true.    !  z-coordinate - partial steps (interpolation)
    ln_hpg_sco  = .false.   !  s-coordinate (standard jacobian formulation)
@@ -613,9 +613,9 @@
 &namdyn_ldf    !   lateral diffusion on momentum
 !-----------------------------------------------------------------------
-   !                       !  Type of the operator : 
-   ln_dynldf_lap    =  .true.   !  laplacian operator         
-   ln_dynldf_bilap  =  .false.  !  bilaplacian operator    
-   !                       !  Direction of action  : 
-   ln_dynldf_level  =  .false.  !  iso-level               
+   !                       !  Type of the operator :
+   ln_dynldf_lap    =  .true.   !  laplacian operator
+   ln_dynldf_bilap  =  .false.  !  bilaplacian operator
+   !                       !  Direction of action  :
+   ln_dynldf_level  =  .false.  !  iso-level
    ln_dynldf_hor    =  .true.   !  horizontal (geopotential)            (require "key_ldfslp" in s-coord.)
    ln_dynldf_iso    =  .false.  !  iso-neutral                          (require "key_ldfslp")
@@ -623,5 +623,5 @@
    rn_ahm_0_lap     = 40000.    !  horizontal laplacian eddy viscosity   [m2/s]
    rn_ahmb_0        =     0.    !  background eddy viscosity for ldf_iso [m2/s]
-   rn_ahm_0_blp     =     0.    !  horizontal bilaplacian eddy viscosity [m4/s] 
+   rn_ahm_0_blp     =     0.    !  horizontal bilaplacian eddy viscosity [m4/s]
 /
 
@@ -696,11 +696,11 @@
 &namzdf_kpp    !   K-Profile Parameterization dependent vertical mixing  ("key_zdfkpp", and optionally:
 !------------------------------------------------------------------------ "key_kppcustom" or "key_kpplktb")
-   ln_kpprimix = .true.    !  shear instability mixing 
+   ln_kpprimix = .true.    !  shear instability mixing
    rn_difmiw   =  1.0e-04  !  constant internal wave viscosity [m2/s]
    rn_difsiw   =  0.1e-04  !  constant internal wave diffusivity [m2/s]
    rn_riinfty  =  0.8      !  local Richardson Number limit for shear instability
    rn_difri    =  0.0050   !  maximum shear mixing at Rig = 0    [m2/s]
-   rn_bvsqcon  = -0.01e-07 !  Brunt-Vaisala squared for maximum convection [1/s2] 
-   rn_difcon   =  1.       !  maximum mixing in interior convection [m2/s] 
+   rn_bvsqcon  = -0.01e-07 !  Brunt-Vaisala squared for maximum convection [1/s2]
+   rn_difcon   =  1.       !  maximum mixing in interior convection [m2/s]
    nn_avb      =  0        !  horizontal averaged (=1) or not (=0) on avt and amv
    nn_ave      =  1        !  constant (=0) or profile (=1) background on avt
@@ -736,5 +736,5 @@
    rn_n2min    = 1.e-8     !  threshold of the Brunt-Vaisala frequency (s-1)
    rn_tfe      = 0.333     !  tidal dissipation efficiency
-   rn_me       = 0.2       !  mixing efficiency 
+   rn_me       = 0.2       !  mixing efficiency
    ln_tmx_itf  = .true.    !  ITF specific parameterisation
    rn_tfe_itf  = 1.        !  ITF tidal dissipation efficiency
@@ -746,9 +746,9 @@
 !!   nammpp            Massively Parallel Processing                    ("key_mpp_mpi)
 !!   namctl            Control prints & Benchmark
-!!   namsol            elliptic solver / island / free surface 
-!!======================================================================
-!
-!-----------------------------------------------------------------------
-&namsol        !   elliptic solver / island / free surface 
+!!   namsol            elliptic solver / island / free surface
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&namsol        !   elliptic solver / island / free surface
 !-----------------------------------------------------------------------
    nn_solv     =      1    !  elliptic solver: =1 preconditioned conjugate gradient (pcg)
@@ -796,5 +796,5 @@
 !!   namflo       float parameters                                      ("key_float")
 !!   namptr       Poleward Transport Diagnostics
-!!   namhsb       Heat and salt budgets 
+!!   namhsb       Heat and salt budgets
 !!======================================================================
 !
@@ -828,6 +828,6 @@
    jpnnewflo     = 0          !  number of floats for the restart
    ln_rstflo     = .false.    !  float restart (T) or not (F)
-   nn_writefl    =      75    !  frequency of writing in float output file 
-   nn_stockfl    =    5475    !  frequency of creation of the float restart file 
+   nn_writefl    =      75    !  frequency of writing in float output file
+   nn_stockfl    =    5475    !  frequency of creation of the float restart file
    ln_argo       = .false.    !  Argo type floats (stay at the surface each 10 days)
    ln_flork4     = .false.    !  trajectories computed with a 4th order Runge-Kutta (T)
@@ -841,5 +841,5 @@
    ln_diaptr  = .false.    !  Poleward heat and salt transport (T) or not (F)
    ln_diaznl  = .true.     !  Add zonal means and meridional stream functions
-   ln_subbas  = .true.     !  Atlantic/Pacific/Indian basins computation (T) or not 
+   ln_subbas  = .true.     !  Atlantic/Pacific/Indian basins computation (T) or not
                            !  (orca configuration only, need input basins mask file named "subbasins.nc"
    ln_ptrcomp = .true.     !  Add decomposition : overturning
@@ -848,5 +848,5 @@
 /
 !-----------------------------------------------------------------------
-&namhsb       !  Heat and salt budgets 
+&namhsb       !  Heat and salt budgets
 !-----------------------------------------------------------------------
    ln_diahsb  = .false.    !  check the heat and salt budgets (T) or not (F)
@@ -881,72 +881,71 @@
 &namobs       !  observation usage switch                               ('key_diaobs')
 !-----------------------------------------------------------------------
-   ln_t3d     = .false.    ! Logical switch for T profile observations         
-   ln_s3d     = .false.    ! Logical switch for S profile observations          
-   ln_ena     = .false.    ! Logical switch for ENACT insitu data set           
-   !                       !     ln_cor                  Logical switch for Coriolis insitu data set       
-   ln_profb   = .false.    ! Logical switch for feedback insitu data set     
-   ln_sla     = .false.    ! Logical switch for SLA observations               
-
-   ln_sladt   = .false.    ! Logical switch for AVISO SLA data              
-
-   ln_slafb   = .false.    ! Logical switch for feedback SLA data            
-                           !     ln_ssh                  Logical switch for SSH observations              
-
-   ln_sst     = .false.    ! Logical switch for SST observations              
-                           !     ln_reysst               Logical switch for Reynolds observations       
-                           !     ln_ghrsst               Logical switch for GHRSST observations          
-
-   ln_sstfb   = .false.    ! Logical switch for feedback SST data          
-                           !     ln_sss                  Logical switch for SSS observations              
-                           !     ln_seaice               Logical switch for Sea Ice observations        
-                           !     ln_vel3d                Logical switch for velocity observations         
-                           !     ln_velavcur             Logical switch for velocity daily av. cur.    
-                           !     ln_velhrcur             Logical switch for velocity high freq. cur.   
-                           !     ln_velavadcp            Logical switch for velocity daily av. ADCP  
+   ln_t3d     = .false.    ! Logical switch for T profile observations
+   ln_s3d     = .false.    ! Logical switch for S profile observations
+   ln_ena     = .false.    ! Logical switch for ENACT insitu data set
+   !                       !     ln_cor                  Logical switch for Coriolis insitu data set
+   ln_profb   = .false.    ! Logical switch for feedback insitu data set
+   ln_sla     = .false.    ! Logical switch for SLA observations
+
+   ln_sladt   = .false.    ! Logical switch for AVISO SLA data
+
+   ln_slafb   = .false.    ! Logical switch for feedback SLA data
+                           !     ln_ssh                  Logical switch for SSH observations
+
+   ln_sst     = .false.    ! Logical switch for SST observations
+                           !     ln_reysst               Logical switch for Reynolds observations
+                           !     ln_ghrsst               Logical switch for GHRSST observations
+
+   ln_sstfb   = .false.    ! Logical switch for feedback SST data
+                           !     ln_sss                  Logical switch for SSS observations
+                           !     ln_seaice               Logical switch for Sea Ice observations
+                           !     ln_vel3d                Logical switch for velocity observations
+                           !     ln_velavcur             Logical switch for velocity daily av. cur.
+                           !     ln_velhrcur             Logical switch for velocity high freq. cur.
+                           !     ln_velavadcp            Logical switch for velocity daily av. ADCP
                            !     ln_velhradcp            Logical switch for velocity high freq. ADCP
-                           !     ln_velfb                Logical switch for feedback velocity data       
-                           !     ln_grid_global          Global distribtion of observations         
-                           !     ln_grid_search_lookup   Logical switch for obs grid search w/lookup table  
-                           !     grid_search_file        Grid search lookup file header 
-                           !     enactfiles              ENACT input observation file names 
-                           !     coriofiles              Coriolis input observation file name  
-   !                       ! profbfiles: Profile feedback input observation file name 
+                           !     ln_velfb                Logical switch for feedback velocity data
+                           !     ln_grid_global          Global distribtion of observations
+                           !     ln_grid_search_lookup   Logical switch for obs grid search w/lookup table
+                           !     grid_search_file        Grid search lookup file header
+                           !     enactfiles              ENACT input observation file names
+                           !     coriofiles              Coriolis input observation file name
+   !                       ! profbfiles: Profile feedback input observation file name
    profbfiles = 'profiles_01.nc'
-                           !     ln_profb_enatim         Enact feedback input time setting switch    
+                           !     ln_profb_enatim         Enact feedback input time setting switch
                            !     slafilesact             Active SLA input observation file name
-                           !     slafilespas             Passive SLA input observation file name 
-   !                       ! slafbfiles: Feedback SLA input observation file name 
+                           !     slafilespas             Passive SLA input observation file name
+   !                       ! slafbfiles: Feedback SLA input observation file name
    slafbfiles = 'sla_01.nc'
-                           !     sstfiles                GHRSST input observation file name       
-   !                       ! sstfbfiles: Feedback SST input observation file name 
+                           !     sstfiles                GHRSST input observation file name
+   !                       ! sstfbfiles: Feedback SST input observation file name
    sstfbfiles = 'sst_01.nc' 'sst_02.nc' 'sst_03.nc' 'sst_04.nc' 'sst_05.nc'
-                           !     seaicefiles             Sea Ice input observation file name 
-                           !     velavcurfiles           Vel. cur. daily av. input file name  
-                           !     velhvcurfiles           Vel. cur. high freq. input file name  
-                           !     velavadcpfiles          Vel. ADCP daily av. input file name    
-                           !     velhvadcpfiles          Vel. ADCP high freq. input file name 
-                           !     velfbfiles              Vel. feedback input observation file name 
-                           !     dobsini                 Initial date in window YYYYMMDD.HHMMSS       
-                           !     dobsend                 Final date in window YYYYMMDD.HHMMSS         
-                           !     n1dint                  Type of vertical interpolation method        
-                           !     n2dint                  Type of horizontal interpolation method       
-                           !     ln_nea                  Rejection of observations near land switch    
-   nmsshc     = 0          ! MSSH correction scheme                         
-                           !     mdtcorr                 MDT  correction                               
-                           !     mdtcutoff               MDT cutoff for computed correction          
-   ln_altbias = .false.    ! Logical switch for alt bias                
-   ln_ignmis  = .true.     ! Logical switch for ignoring missing files   
-                           !     endailyavtypes   ENACT daily average types                    
+                           !     seaicefiles             Sea Ice input observation file name
+                           !     velavcurfiles           Vel. cur. daily av. input file name
+                           !     velhvcurfiles           Vel. cur. high freq. input file name
+                           !     velavadcpfiles          Vel. ADCP daily av. input file name
+                           !     velhvadcpfiles          Vel. ADCP high freq. input file name
+                           !     velfbfiles              Vel. feedback input observation file name
+                           !     dobsini                 Initial date in window YYYYMMDD.HHMMSS
+                           !     dobsend                 Final date in window YYYYMMDD.HHMMSS
+                           !     n1dint                  Type of vertical interpolation method
+                           !     n2dint                  Type of horizontal interpolation method
+                           !     ln_nea                  Rejection of observations near land switch
+   nmsshc     = 0          ! MSSH correction scheme
+                           !     mdtcorr                 MDT  correction
+                           !     mdtcutoff               MDT cutoff for computed correction
+   ln_altbias = .false.    ! Logical switch for alt bias
+   ln_ignmis  = .true.     ! Logical switch for ignoring missing files
+                           !     endailyavtypes   ENACT daily average types
    ln_grid_global = .true.
    ln_grid_search_lookup = .false.
-/ 
+/
 !-----------------------------------------------------------------------
 &nam_asminc   !   assimilation increments                               ('key_asminc')
 !-----------------------------------------------------------------------
-    ln_bkgwri = .false.    !  Logical switch for writing out background state 
-    ln_trjwri = .false.    !  Logical switch for writing out state trajectory
+    ln_bkgwri = .false.    !  Logical switch for writing out background state
     ln_trainc = .false.    !  Logical switch for applying tracer increments
     ln_dyninc = .false.    !  Logical switch for applying velocity increments
-    ln_sshinc = .false.    !  Logical switch for applying SSH increments 
+    ln_sshinc = .false.    !  Logical switch for applying SSH increments
     ln_asmdin = .false.    !  Logical switch for Direct Initialization (DI)
     ln_asmiau = .false.    !  Logical switch for Incremental Analysis Updating (IAU)
@@ -956,5 +955,4 @@
     nitiaufin = 15         !  Timestep of end of IAU interval in [0,nitend-nit000-1]
     niaufn    = 0          !  Type of IAU weighting function
-    nittrjfrq = 0          !  Frequency of trajectory output for 4D-VAR
     ln_salfix = .false.    !  Logical switch for ensuring that the sa > salfixmin
     salfixmin = -9999      !  Minimum salinity after applying the increments
@@ -985,2 +983,10 @@
    rn_htrmax         =  200.0   ! max. depth of transition range
 /
+!-----------------------------------------------------------------------
+&namtrj ! Handling non-linear trajectory for TAM (output for direct model, input for TAM)
+!-----------------------------------------------------------------------
+    cn_dirtrj   = 'tam_trajectory'   ! prefix for input/ouput files
+    ln_trjhand  = .false.            ! Handling non linear trajectory
+    nn_ittrjfrq = 20                 ! Output/input frequency
+    ln_trj_spl = .false.             ! Handling trajectory at simple precision
+/
Index: /trunk/NEMOGCM/NEMO/OPA_SRC/ASM/asmbkg.F90
===================================================================
--- /trunk/NEMOGCM/NEMO/OPA_SRC/ASM/asmbkg.F90	(revision 3604)
+++ /trunk/NEMOGCM/NEMO/OPA_SRC/ASM/asmbkg.F90	(revision 3604)
@@ -0,0 +1,170 @@
+MODULE asmbkg
+   !!======================================================================
+   !!                       ***  MODULE asmtrj -> asmbkg  ***
+   !! Assimilation trajectory interface: Write to file the background state and the model state trajectory
+   !!======================================================================
+   !! History :       ! 2007-03 (M. Martin)  Met. Office version
+   !!                 ! 2007-04 (A. Weaver)  asm_trj_wri, original code
+   !!                 ! 2007-03 (K. Mogensen)  Adapt to NEMOVAR and use IOM instead of IOIPSL
+   !!                 ! 2007-04 (A. Weaver)  Name change (formally asmbkg.F90). Distinguish
+   !!                                        background states in Jb term and at analysis time.
+   !!                                        Include state trajectory routine (currently empty)
+   !!                 ! 2007-07 (A. Weaver)  Add tke_rst and flt_rst for case nitbkg=0 
+   !!                 ! 2009-03 (F. Vigilant)  Add hmlp (zdfmxl) for no tracer nmldp=2 
+   !!                 ! 2009-06 (F. Vigilant) asm_trj_wri: special case when kt=nit000-1
+   !!                 ! 2009-07 (F. Vigilant) asm_trj_wri: add computation of eiv at restart
+   !!                 ! 2010-01 (A. Vidard) split asm_trj_wri into tam_trj_wri and asm_bkg_wri
+   !!----------------------------------------------------------------------
+
+   !!----------------------------------------------------------------------
+   !!   'key_asminc' : Switch on the assimilation increment interface
+   !!----------------------------------------------------------------------
+   !!   asm_bkg_wri  : Write out the background state
+   !!   asm_trj_wri  : Write out the model state trajectory (used with 4D-Var)
+   !!----------------------------------------------------------------------
+   USE oce                ! Dynamics and active tracers defined in memory
+   USE sbc_oce            ! Ocean surface boundary conditions
+   USE zdf_oce            ! Vertical mixing variables
+   USE zdfddm             ! Double diffusion mixing parameterization
+   USE ldftra_oce         ! Lateral tracer mixing coefficient defined in memory
+   USE ldfslp             ! Slopes of neutral surfaces
+   USE tradmp             ! Tracer damping
+#if defined key_zdftke
+   USE zdftke             ! TKE vertical physics
+#endif
+   USE eosbn2             ! Equation of state (eos_bn2 routine)
+   USE zdfmxl             ! Mixed layer depth
+   USE dom_oce, ONLY :   ndastp
+   USE sol_oce, ONLY :   gcx   ! Solver variables defined in memory
+   USE in_out_manager     ! I/O manager
+   USE iom                ! I/O module
+   USE asmpar             ! Parameters for the assmilation interface
+   USE zdfmxl             ! mixed layer depth
+#if defined key_traldf_c2d
+   USE ldfeiv             ! eddy induced velocity coef.      (ldf_eiv routine)
+#endif
+#if defined key_lim2
+   USE ice_2
+#endif
+#if defined key_lim3
+   USE ice
+#endif
+   IMPLICIT NONE
+   PRIVATE
+   
+   PUBLIC   asm_bkg_wri   !: Write out the background state
+
+   !!----------------------------------------------------------------------
+   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
+   !! $Id: $
+   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+CONTAINS
+
+   SUBROUTINE asm_bkg_wri( kt )
+      !!-----------------------------------------------------------------------
+      !!                  ***  ROUTINE asm_bkg_wri ***
+      !!
+      !! ** Purpose : Write to file the background state for later use in the
+      !!              inner loop of data assimilation or for direct initialization
+      !!              in the outer loop.
+      !!
+      !! ** Method  : Write out the background state for use in the Jb term
+      !!              in the cost function and for use with direct initialization
+      !!              at analysis time.
+      !!-----------------------------------------------------------------------
+      INTEGER, INTENT( IN ) :: kt               ! Current time-step
+      !
+      CHARACTER (LEN=50) :: cl_asmbkg
+      CHARACTER (LEN=50) :: cl_asmdin
+      LOGICAL :: llok          ! Check if file exists
+      INTEGER :: inum          ! File unit number
+      REAL(wp) :: zdate        ! Date
+      !!-----------------------------------------------------------------------
+
+      !                                !-------------------------------------------
+      IF( kt == nitbkg_r ) THEN        ! Write out background at time step nitbkg_r
+         !                             !-----------------------------------========
+         !
+         WRITE(cl_asmbkg, FMT='(A,".nc")' ) TRIM( c_asmbkg )
+         cl_asmbkg = TRIM( cl_asmbkg )
+         INQUIRE( FILE = cl_asmbkg, EXIST = llok )
+         !
+         IF( .NOT. llok ) THEN
+            IF(lwp) WRITE(numout,*) ' Setting up assimilation background file '// TRIM( c_asmbkg )
+            !
+            !                                      ! Define the output file        
+            CALL iom_open( c_asmbkg, inum, ldwrt = .TRUE., kiolib = jprstlib)
+            !
+            IF( nitbkg_r == nit000 - 1 ) THEN      ! Treat special case when nitbkg = 0
+               zdate = REAL( ndastp )
+#if defined key_zdftke
+               ! lk_zdftke=T :   Read turbulent kinetic energy ( en )
+               IF(lwp) WRITE(numout,*) ' Reading TKE (en) from restart...'
+               CALL tke_rst( nit000, 'READ' )               ! lk_zdftke=T :   Read turbulent kinetic energy ( en )
+
+#endif
+            ELSE
+               zdate = REAL( ndastp )
+            ENDIF
+            !
+            !                                      ! Write the information
+            CALL iom_rstput( kt, nitbkg_r, inum, 'rdastp' , zdate             )
+            CALL iom_rstput( kt, nitbkg_r, inum, 'un'     , un                )
+            CALL iom_rstput( kt, nitbkg_r, inum, 'vn'     , vn                )
+            CALL iom_rstput( kt, nitbkg_r, inum, 'tn'     , tsn(:,:,:,jp_tem) )
+            CALL iom_rstput( kt, nitbkg_r, inum, 'sn'     , tsn(:,:,:,jp_sal) )
+            CALL iom_rstput( kt, nitbkg_r, inum, 'sshn'   , sshn              )
+#if defined key_zdftke
+            CALL iom_rstput( kt, nitbkg_r, inum, 'en'     , en                )
+#endif
+            CALL iom_rstput( kt, nitbkg_r, inum, 'gcx'    , gcx               )
+            !
+            CALL iom_close( inum )
+         ENDIF
+         !
+      ENDIF
+
+      !                                !-------------------------------------------
+      IF( kt == nitdin_r ) THEN        ! Write out background at time step nitdin_r
+         !                             !-----------------------------------========
+         !
+         WRITE(cl_asmdin, FMT='(A,".nc")' ) TRIM( c_asmdin )
+         cl_asmdin = TRIM( cl_asmdin )
+         INQUIRE( FILE = cl_asmdin, EXIST = llok )
+         !
+         IF( .NOT. llok ) THEN
+            IF(lwp) WRITE(numout,*) ' Setting up assimilation background file '// TRIM( c_asmdin )
+            !
+            !                                      ! Define the output file        
+            CALL iom_open( c_asmdin, inum, ldwrt = .TRUE., kiolib = jprstlib)
+            !
+            IF( nitdin_r == nit000 - 1 ) THEN      ! Treat special case when nitbkg = 0
+
+               zdate = REAL( ndastp )
+            ELSE
+               zdate = REAL( ndastp )
+            ENDIF
+            !
+            !                                      ! Write the information
+            CALL iom_rstput( kt, nitdin_r, inum, 'rdastp' , zdate             )
+            CALL iom_rstput( kt, nitdin_r, inum, 'un'     , un                )
+            CALL iom_rstput( kt, nitdin_r, inum, 'vn'     , vn                )
+            CALL iom_rstput( kt, nitdin_r, inum, 'tn'     , tsn(:,:,:,jp_tem) )
+            CALL iom_rstput( kt, nitdin_r, inum, 'sn'     , tsn(:,:,:,jp_sal) )
+            CALL iom_rstput( kt, nitdin_r, inum, 'sshn'   , sshn              )
+#if defined key_lim2 || defined key_lim3
+            IF(( nn_ice == 2 ) .OR. ( nn_ice == 3 )) THEN
+               CALL iom_rstput( kt, nitdin_r, inum, 'iceconc', 1.0 - frld(:,:)   )
+            ENDIF
+#endif
+            !
+            CALL iom_close( inum )
+         ENDIF
+         !
+      ENDIF
+      !                    
+   END SUBROUTINE asm_bkg_wri
+
+   !!======================================================================
+END MODULE asmbkg
Index: /trunk/NEMOGCM/NEMO/OPA_SRC/ASM/asminc.F90
===================================================================
--- /trunk/NEMOGCM/NEMO/OPA_SRC/ASM/asminc.F90	(revision 3603)
+++ /trunk/NEMOGCM/NEMO/OPA_SRC/ASM/asminc.F90	(revision 3604)
@@ -10,4 +10,5 @@
    !!   NEMO     3.3  ! 2010-05  (D. Lea)  Update to work with NEMO v3.2
    !!             -   ! 2010-05  (D. Lea)  add calc_month_len routine based on day_init 
+   !!            3.4  ! 2012-10  (A. Weaver and K. Mogensen) Fix for direct initialization
    !!----------------------------------------------------------------------
 
@@ -20,4 +21,5 @@
    !!   dyn_asm_inc  : Apply the dynamic (u and v) increments
    !!   ssh_asm_inc  : Apply the SSH increment
+   !!   seaice_asm_inc  : Apply the seaice increment
    !!----------------------------------------------------------------------
    USE wrk_nemo         ! Memory Allocation
@@ -25,5 +27,4 @@
    USE dom_oce          ! Ocean space and time domain
    USE oce              ! Dynamics and active tracers defined in memory
-   USE divcur           ! Horizontal divergence and relative vorticity
    USE ldfdyn_oce       ! ocean dynamics: lateral physics
    USE eosbn2           ! Equation of state - in situ and potential density
@@ -33,5 +34,12 @@
    USE c1d              ! 1D initialization
    USE in_out_manager   ! I/O manager
-   USE lib_mpp           ! MPP library
+   USE lib_mpp          ! MPP library
+#if defined key_lim3
+   USE ice              ! LIM3
+#endif
+#if defined key_lim2
+   USE ice_2            ! LIM2
+#endif
+   USE sbc_oce          ! Surface boundary condition variables.
 
    IMPLICIT NONE
@@ -43,4 +51,5 @@
    PUBLIC   dyn_asm_inc    !: Apply the dynamic (u and v) increments
    PUBLIC   ssh_asm_inc    !: Apply the SSH increment
+   PUBLIC   seaice_asm_inc !: Apply the seaice increment
 
 #if defined key_asminc
@@ -50,5 +59,4 @@
 #endif
    LOGICAL, PUBLIC :: ln_bkgwri = .FALSE. !: No output of the background state fields
-   LOGICAL, PUBLIC :: ln_trjwri = .FALSE. !: No output of the state trajectory fields
    LOGICAL, PUBLIC :: ln_asmiau = .FALSE. !: No applying forcing with an assimilation increment
    LOGICAL, PUBLIC :: ln_asmdin = .FALSE. !: No direct initialization
@@ -56,5 +64,7 @@
    LOGICAL, PUBLIC :: ln_dyninc = .FALSE. !: No dynamics (u and v) assimilation increments
    LOGICAL, PUBLIC :: ln_sshinc = .FALSE. !: No sea surface height assimilation increment
+   LOGICAL, PUBLIC :: ln_seaiceinc = .FALSE. !: No sea ice concentration increment
    LOGICAL, PUBLIC :: ln_salfix = .FALSE. !: Apply minimum salinity check
+   LOGICAL, PUBLIC :: ln_temnofreeze = .FALSE. !: Don't allow the temperature to drop below freezing
    INTEGER, PUBLIC :: nn_divdmp = 0       !: Apply divergence damping filter nn_divdmp times
 
@@ -78,4 +88,5 @@
 
    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::   ssh_bkg, ssh_bkginc   ! Background sea surface height and its increment
+   REAL(wp), DIMENSION(:,:), ALLOCATABLE ::   seaice_bkginc         ! Increment to the background sea ice conc
 
    !! * Substitutions
@@ -125,9 +136,9 @@
       REAL(wp), POINTER, DIMENSION(:,:) :: hdiv
       !!
-      NAMELIST/nam_asminc/ ln_bkgwri, ln_trjwri,                           &
+      NAMELIST/nam_asminc/ ln_bkgwri,                                      &
          &                 ln_trainc, ln_dyninc, ln_sshinc,                &
          &                 ln_asmdin, ln_asmiau,                           &
          &                 nitbkg, nitdin, nitiaustr, nitiaufin, niaufn,   &
-         &                 nittrjfrq, ln_salfix, salfixmin,                &
+         &                 ln_salfix, salfixmin,                &
          &                 nn_divdmp
       !!----------------------------------------------------------------------
@@ -139,11 +150,12 @@
       ! Set default values
       ln_bkgwri = .FALSE.
-      ln_trjwri = .FALSE.
       ln_trainc = .FALSE.
       ln_dyninc = .FALSE.
       ln_sshinc = .FALSE.
+      ln_seaiceinc = .FALSE.
       ln_asmdin = .FALSE.
       ln_asmiau = .TRUE.
       ln_salfix = .FALSE.
+      ln_temnofreeze = .FALSE.
       salfixmin = -9999
       nitbkg    = 0
@@ -152,5 +164,4 @@
       nitiaufin = 150      ! = 10 days with ORCA2
       niaufn    = 0
-      nittrjfrq = 1
 
       REWIND ( numnam )
@@ -164,9 +175,9 @@
          WRITE(numout,*) '   Namelist namasm : set assimilation increment parameters'
          WRITE(numout,*) '      Logical switch for writing out background state          ln_bkgwri = ', ln_bkgwri
-         WRITE(numout,*) '      Logical switch for writing out state trajectory          ln_trjwri = ', ln_trjwri
          WRITE(numout,*) '      Logical switch for applying tracer increments            ln_trainc = ', ln_trainc
          WRITE(numout,*) '      Logical switch for applying velocity increments          ln_dyninc = ', ln_dyninc
          WRITE(numout,*) '      Logical switch for applying SSH increments               ln_sshinc = ', ln_sshinc
          WRITE(numout,*) '      Logical switch for Direct Initialization (DI)            ln_asmdin = ', ln_asmdin
+         WRITE(numout,*) '      Logical switch for applying sea ice increments        ln_seaiceinc = ', ln_seaiceinc
          WRITE(numout,*) '      Logical switch for Incremental Analysis Updating (IAU)   ln_asmiau = ', ln_asmiau
          WRITE(numout,*) '      Timestep of background in [0,nitend-nit000-1]            nitbkg    = ', nitbkg
@@ -175,5 +186,4 @@
          WRITE(numout,*) '      Timestep of end of IAU interval in [0,nitend-nit000-1]   nitiaufin = ', nitiaufin
          WRITE(numout,*) '      Type of IAU weighting function                           niaufn    = ', niaufn
-         WRITE(numout,*) '      Frequency of trajectory output for 4D-VAR                nittrjfrq = ', nittrjfrq
          WRITE(numout,*) '      Logical switch for ensuring that the sa > salfixmin      ln_salfix = ', ln_salfix
          WRITE(numout,*) '      Minimum salinity after applying the increments           salfixmin = ', salfixmin
@@ -213,5 +223,4 @@
          WRITE(numout,*) '       nitiaustr_r = ', nitiaustr_r
          WRITE(numout,*) '       nitiaufin_r = ', nitiaufin_r
-         WRITE(numout,*) '       nittrjfrq   = ', nittrjfrq
          WRITE(numout,*)
          WRITE(numout,*) '   Dates referenced to current cycle:'
@@ -235,6 +244,6 @@
 
       IF (      ( ( .NOT. ln_asmdin ).AND.( .NOT. ln_asmiau ) ) &
-           .AND.( ( ln_trainc ).OR.( ln_dyninc ).OR.( ln_sshinc ) ) ) &
-         & CALL ctl_stop( ' One or more of ln_trainc, ln_dyninc and ln_sshinc is set to .true.', &
+           .AND.( ( ln_trainc ).OR.( ln_dyninc ).OR.( ln_sshinc ) .OR. ( ln_seaiceinc) )) &
+         & CALL ctl_stop( ' One or more of ln_trainc, ln_dyninc, ln_sshinc and ln_seaiceinc is set to .true.', &
          &                ' but ln_asmdin and ln_asmiau are both set to .false. :', &
          &                ' Inconsistent options')
@@ -248,7 +257,7 @@
          &                ' Type IAU weighting function is invalid')
 
-      IF ( ( .NOT. ln_trainc ).AND.( .NOT. ln_dyninc ).AND.( .NOT. ln_sshinc ) &
+      IF ( ( .NOT. ln_trainc ).AND.( .NOT. ln_dyninc ).AND.( .NOT. ln_sshinc ).AND.( .NOT. ln_seaiceinc ) &
          &                     )  &
-         & CALL ctl_warn( ' ln_trainc, ln_dyninc and ln_sshinc are set to .false. :', &
+         & CALL ctl_warn( ' ln_trainc, ln_dyninc, ln_sshinc and ln_seaiceinc are set to .false. :', &
          &                ' The assimilation increments are not applied')
 
@@ -353,4 +362,5 @@
       ALLOCATE( v_bkginc(jpi,jpj,jpk) )
       ALLOCATE( ssh_bkginc(jpi,jpj)   )
+      ALLOCATE( seaice_bkginc(jpi,jpj))
 #if defined key_asminc
       ALLOCATE( ssh_iau(jpi,jpj)      )
@@ -361,8 +371,9 @@
       v_bkginc(:,:,:) = 0.0
       ssh_bkginc(:,:) = 0.0
+      seaice_bkginc(:,:) = 0.0
 #if defined key_asminc
       ssh_iau(:,:)    = 0.0
 #endif
-      IF ( ( ln_trainc ).OR.( ln_dyninc ).OR.( ln_sshinc ) ) THEN
+      IF ( ( ln_trainc ).OR.( ln_dyninc ).OR.( ln_sshinc ).OR.( ln_seaiceinc ) ) THEN
 
          !--------------------------------------------------------------------
@@ -429,4 +440,13 @@
          ENDIF
 
+         IF ( ln_seaiceinc ) THEN
+            CALL iom_get( inum, jpdom_autoglo, 'bckinseaice', seaice_bkginc, 1 )
+            ! Apply the masks
+            seaice_bkginc(:,:) = seaice_bkginc(:,:) * tmask(:,:,1)
+            ! Set missing increments to 0.0 rather than 1e+20
+            ! to allow for differences in masks
+            WHERE( ABS( seaice_bkginc(:,:) ) > 1.0e+10 ) seaice_bkginc(:,:) = 0.0
+         ENDIF
+
          CALL iom_close( inum )
  
@@ -437,44 +457,43 @@
       !-----------------------------------------------------------------------
 
-
       IF ( ln_dyninc .AND. nn_divdmp > 0 ) THEN
 
-      CALL wrk_alloc(jpi,jpj,hdiv) 
-
-       DO  jt = 1, nn_divdmp
-
-           DO jk = 1, jpkm1
-
-                  hdiv(:,:) = 0._wp
-
-            DO jj = 2, jpjm1
-               DO ji = fs_2, fs_jpim1   ! vector opt.
-                  hdiv(ji,jj) =   &
-                     (  e2u(ji  ,jj)*fse3u(ji  ,jj,jk) * u_bkginc(ji  ,jj,jk)       &
-                      - e2u(ji-1,jj)*fse3u(ji-1,jj,jk) * u_bkginc(ji-1,jj,jk)       &
-                      + e1v(ji,jj  )*fse3v(ji,jj  ,jk) * v_bkginc(ji,jj  ,jk)       &
-                      - e1v(ji,jj-1)*fse3v(ji,jj-1,jk) * v_bkginc(ji,jj-1,jk)  )    &
-                      / ( e1t(ji,jj) * e2t(ji,jj) * fse3t(ji,jj,jk) )
+         CALL wrk_alloc(jpi,jpj,hdiv) 
+
+         DO  jt = 1, nn_divdmp
+
+            DO jk = 1, jpkm1
+
+               hdiv(:,:) = 0._wp
+
+               DO jj = 2, jpjm1
+                  DO ji = fs_2, fs_jpim1   ! vector opt.
+                     hdiv(ji,jj) =   &
+                        (  e2u(ji  ,jj  ) * fse3u(ji  ,jj  ,jk) * u_bkginc(ji  ,jj  ,jk)     &
+                         - e2u(ji-1,jj  ) * fse3u(ji-1,jj  ,jk) * u_bkginc(ji-1,jj  ,jk)     &
+                         + e1v(ji  ,jj  ) * fse3v(ji  ,jj  ,jk) * v_bkginc(ji  ,jj  ,jk)     &
+                         - e1v(ji  ,jj-1) * fse3v(ji  ,jj-1,jk) * v_bkginc(ji  ,jj-1,jk)  )  &
+                         / ( e1t(ji,jj) * e2t(ji,jj) * fse3t(ji,jj,jk) )
+                  END DO
                END DO
+
+               CALL lbc_lnk( hdiv, 'T', 1. )   ! lateral boundary cond. (no sign change)
+
+               DO jj = 2, jpjm1
+                  DO ji = fs_2, fs_jpim1   ! vector opt.
+                     u_bkginc(ji,jj,jk) = u_bkginc(ji,jj,jk) + 0.2_wp * ( e1t(ji+1,jj)*e2t(ji+1,jj) * hdiv(ji+1,jj)   &
+                                                                        - e1t(ji  ,jj)*e2t(ji  ,jj) * hdiv(ji  ,jj) ) &
+                                                                      / e1u(ji,jj) * umask(ji,jj,jk) 
+                     v_bkginc(ji,jj,jk) = v_bkginc(ji,jj,jk) + 0.2_wp * ( e1t(ji,jj+1)*e2t(ji,jj+1) * hdiv(ji,jj+1)   &
+                                                                        - e1t(ji,jj  )*e2t(ji,jj  ) * hdiv(ji,jj  ) ) &
+                                                                      / e2v(ji,jj) * vmask(ji,jj,jk) 
+                  END DO
+               END DO
+
             END DO
 
-            CALL lbc_lnk( hdiv, 'T', 1. )   ! lateral boundary cond. (no sign change)
-
-            DO jj = 2, jpjm1
-               DO ji = fs_2, fs_jpim1   ! vector opt.
-                  u_bkginc(ji,jj,jk) = u_bkginc(ji,jj,jk) + 0.2 * ( e1t(ji+1,jj)*e2t(ji+1,jj) * hdiv(ji+1,jj)   &
-                                                                  - e1t(ji  ,jj)*e2t(ji  ,jj) * hdiv(ji  ,jj) ) &
-                                                                / e1u(ji,jj) * umask(ji,jj,jk) 
-                  v_bkginc(ji,jj,jk) = v_bkginc(ji,jj,jk) + 0.2 * ( e1t(ji,jj+1)*e2t(ji,jj+1) * hdiv(ji,jj+1)   &
-                                                                  - e1t(ji,jj  )*e2t(ji,jj  ) * hdiv(ji,jj  ) ) &
-                                                                / e2v(ji,jj) * vmask(ji,jj,jk) 
-               END DO
-            END DO
-
-           END DO
-
-       END DO
-
-       CALL wrk_dealloc(jpi,jpj,hdiv) 
+         END DO
+
+         CALL wrk_dealloc(jpi,jpj,hdiv) 
 
       ENDIF
@@ -506,5 +525,5 @@
          CALL iom_open( c_asmdin, inum )
 
-         CALL iom_get( inum, 'zdate', zdate_bkg ) 
+         CALL iom_get( inum, 'rdastp', zdate_bkg ) 
         
          IF(lwp) THEN
@@ -662,5 +681,23 @@
       INTEGER :: it
       REAL(wp) :: zincwgt  ! IAU weight for current time step
-      !!----------------------------------------------------------------------
+      REAL (wp), DIMENSION(jpi,jpj,jpk) :: fzptnz ! 3d freezing point values
+      !!----------------------------------------------------------------------
+
+      ! freezing point calculation taken from oc_fz_pt (but calculated for all depths) 
+      ! used to prevent the applied increments taking the temperature below the local freezing point 
+
+#if defined key_cice 
+        fzptnz(:,:,:) = -1.8_wp
+#else 
+        DO jk = 1, jpk
+           DO jj = 1, jpj
+              DO ji = 1, jpk
+                 fzptnz (ji,jj,jk) = ( -0.0575_wp + 1.710523e-3_wp * SQRT( tsn(ji,jj,jk,jp_sal) )                   & 
+                                                  - 2.154996e-4_wp *       tsn(ji,jj,jk,jp_sal)   ) * tsn(ji,jj,jk,jp_sal)  & 
+                                                  - 7.53e-4_wp * fsdepw(ji,jj,jk)       ! (pressure in dbar) 
+              END DO
+           END DO
+        END DO
+#endif 
 
       IF ( ln_asmiau ) THEN
@@ -684,18 +721,24 @@
             ! Update the tracer tendencies
             DO jk = 1, jpkm1
-               tsa(:,:,jk,jp_tem) = tsa(:,:,jk,jp_tem) + t_bkginc(:,:,jk) * zincwgt  
-               tsa(:,:,jk,jp_sal) = tsa(:,:,jk,jp_sal) + s_bkginc(:,:,jk) * zincwgt
+               IF (ln_temnofreeze) THEN
+                  ! Do not apply negative increments if the temperature will fall below freezing
+                  WHERE(t_bkginc(:,:,jk) > 0.0_wp .OR. &
+                     &   tsn(:,:,jk,jp_tem) + tsa(:,:,jk,jp_tem) + t_bkginc(:,:,jk) * wgtiau(it) > fzptnz(:,:,jk) ) 
+                     tsa(:,:,jk,jp_tem) = tsa(:,:,jk,jp_tem) + t_bkginc(:,:,jk) * zincwgt  
+                  END WHERE
+               ELSE
+                  tsa(:,:,jk,jp_tem) = tsa(:,:,jk,jp_tem) + t_bkginc(:,:,jk) * zincwgt  
+               ENDIF
+               IF (ln_salfix) THEN
+                  ! Do not apply negative increments if the salinity will fall below a specified
+                  ! minimum value salfixmin
+                  WHERE(s_bkginc(:,:,jk) > 0.0_wp .OR. &
+                     &   tsn(:,:,jk,jp_sal) + tsa(:,:,jk,jp_sal) + s_bkginc(:,:,jk) * wgtiau(it) > salfixmin ) 
+                     tsa(:,:,jk,jp_sal) = tsa(:,:,jk,jp_sal) + s_bkginc(:,:,jk) * zincwgt
+                  END WHERE
+               ELSE
+                  tsa(:,:,jk,jp_sal) = tsa(:,:,jk,jp_sal) + s_bkginc(:,:,jk) * zincwgt
+               ENDIF
             END DO
-
-            ! Salinity fix
-            IF (ln_salfix) THEN
-               DO jk = 1, jpkm1
-                  DO jj = 1, jpj
-                     DO ji= 1, jpi
-                        tsa(ji,jj,jk,jp_sal) = MAX( tsa(ji,jj,jk,jp_sal), salfixmin )
-                     END DO
-                  END DO
-               END DO
-            ENDIF
 
          ENDIF
@@ -718,26 +761,36 @@
 
             ! Initialize the now fields with the background + increment
-            tsn(:,:,:,jp_tem) = t_bkg(:,:,:) + t_bkginc(:,:,:)   
-            tsn(:,:,:,jp_sal) = s_bkg(:,:,:) + s_bkginc(:,:,:)   
-
-            ! Optional salinity fix
+            IF (ln_temnofreeze) THEN
+               ! Do not apply negative increments if the temperature will fall below freezing
+               WHERE(t_bkginc(:,:,:) > 0.0_wp .OR. &
+                  &   tsn(:,:,:,jp_tem) + t_bkginc(:,:,:) > fzptnz(:,:,:) ) 
+                  tsn(:,:,:,jp_tem) = t_bkg(:,:,:) + t_bkginc(:,:,:)   
+               END WHERE
+            ELSE
+               tsn(:,:,:,jp_tem) = t_bkg(:,:,:) + t_bkginc(:,:,:)   
+            ENDIF
             IF (ln_salfix) THEN
-               DO jk = 1, jpkm1
-                  DO jj = 1, jpj
-                     DO ji= 1, jpi
-                        tsn(ji,jj,jk,jp_sal) = MAX( tsn(ji,jj,jk,jp_sal), salfixmin )
-                     END DO
-                  END DO
-               END DO
+               ! Do not apply negative increments if the salinity will fall below a specified
+               ! minimum value salfixmin
+               WHERE(s_bkginc(:,:,:) > 0.0_wp .OR. &
+                  &   tsn(:,:,:,jp_sal) + s_bkginc(:,:,:) > salfixmin ) 
+                  tsn(:,:,:,jp_sal) = s_bkg(:,:,:) + s_bkginc(:,:,:)   
+               END WHERE
+            ELSE
+               tsn(:,:,:,jp_sal) = s_bkg(:,:,:) + s_bkginc(:,:,:)   
             ENDIF
 
-            tsb(:,:,:,:) = tsn(:,:,:,:)                        ! Update before fields
+            tsb(:,:,:,:) = tsn(:,:,:,:)               ! Update before fields
 
             CALL eos( tsb, rhd, rhop )                ! Before potential and in situ densities
          
             IF( ln_zps .AND. .NOT. lk_c1d ) &
-               &  CALL zps_hde( nit000, jpts, tsb,   &  ! Partial steps: before horizontal derivative
-               &                gtsu, gtsv, rhd,        &  ! of T, S, rd at the bottom ocean level
+               &  CALL zps_hde( nit000, jpts, tsb, &  ! Partial steps: before horizontal derivative
+               &                gtsu, gtsv, rhd,   &  ! of T, S, rd at the bottom ocean level
                &                gru , grv )
+
+#if defined key_zdfkpp
+            CALL eos( tsn, rhd )                      ! Compute rhd
+#endif
 
             DEALLOCATE( t_bkginc )
@@ -748,4 +801,6 @@
          !  
       ENDIF
+      ! Perhaps the following call should be in step
+      IF   ( ln_seaiceinc  )   CALL seaice_asm_inc ( kt )   ! apply sea ice concentration increment
       !
    END SUBROUTINE tra_asm_inc
@@ -817,9 +872,4 @@
             vb(:,:,:) = vn(:,:,:)
  
-            CALL div_cur( kt )            ! Compute divergence and curl for now fields
-
-            rotb (:,:,:) = rotn (:,:,:)   ! Update before fields
-            hdivb(:,:,:) = hdivn(:,:,:)
-
             DEALLOCATE( u_bkg    )
             DEALLOCATE( v_bkg    )
@@ -846,4 +896,5 @@
       !
       INTEGER :: it
+      INTEGER :: jk
       REAL(wp) :: zincwgt  ! IAU weight for current time step
       !!----------------------------------------------------------------------
@@ -891,5 +942,12 @@
             sshn(:,:) = ssh_bkg(:,:) + ssh_bkginc(:,:)  
 
-            sshb(:,:) = sshn(:,:)         ! Update before fields
+            ! Update before fields
+            sshb(:,:) = sshn(:,:)         
+
+            IF( lk_vvl ) THEN
+               DO jk = 1, jpk
+                  fse3t_b(:,:,jk) = fse3t_n(:,:,jk)
+               END DO
+            ENDIF
 
             DEALLOCATE( ssh_bkg    )
@@ -902,4 +960,242 @@
    END SUBROUTINE ssh_asm_inc
 
+   SUBROUTINE seaice_asm_inc( kt, kindic )
+      !!----------------------------------------------------------------------
+      !!                    ***  ROUTINE seaice_asm_inc  ***
+      !!          
+      !! ** Purpose : Apply the sea ice assimilation increment.
+      !!
+      !! ** Method  : Direct initialization or Incremental Analysis Updating.
+      !!
+      !! ** Action  : 
+      !!
+      !! History :
+      !!        !  07-2011  (D. Lea)  Initial version based on ssh_asm_inc
+      !!----------------------------------------------------------------------
+
+      IMPLICIT NONE
+
+      !! * Arguments
+      INTEGER, INTENT(IN) :: kt   ! Current time step
+      INTEGER, OPTIONAL, INTENT(IN) :: kindic ! flag for disabling the deallocation
+
+      !! * Local declarations
+      INTEGER :: it
+      REAL(wp) :: zincwgt  ! IAU weight for current time step
+
+#if defined key_lim3 || defined key_lim2
+      REAL(wp), DIMENSION(jpi,jpj) :: zofrld, zohicif, zseaicendg, zhicifinc  ! LIM
+      REAL(wp) :: zhicifmin=0.5_wp      ! ice minimum depth in metres
+
+#endif
+
+
+      IF ( ln_asmiau ) THEN
+
+         !--------------------------------------------------------------------
+         ! Incremental Analysis Updating
+         !--------------------------------------------------------------------
+
+         IF ( ( kt >= nitiaustr_r ).AND.( kt <= nitiaufin_r ) ) THEN
+
+            it = kt - nit000 + 1
+            zincwgt = wgtiau(it)      ! IAU weight for the current time step 
+            ! note this is not a tendency so should not be divided by rdt (as with the tracer and other increments)
+
+            IF(lwp) THEN
+               WRITE(numout,*) 
+               WRITE(numout,*) 'seaice_asm_inc : sea ice conc IAU at time step = ', &
+                  &  kt,' with IAU weight = ', wgtiau(it)
+               WRITE(numout,*) '~~~~~~~~~~~~'
+            ENDIF
+
+#if defined key_lim3 || defined key_lim2
+
+            zofrld(:,:)=frld(:,:)
+            zohicif(:,:)=hicif(:,:)
+
+            frld = MIN( MAX( frld(:,:) - seaice_bkginc(:,:) * zincwgt, 0.0_wp), 1.0_wp)
+            pfrld = MIN( MAX( pfrld(:,:) - seaice_bkginc(:,:) * zincwgt, 0.0_wp), 1.0_wp)
+            fr_i(:,:) = 1.0_wp - frld(:,:)        ! adjust ice fraction
+
+            zseaicendg(:,:)=zofrld(:,:) - frld(:,:)         ! find out actual sea ice nudge applied
+
+            ! Nudge sea ice depth to bring it up to a required minimum depth
+
+            WHERE( zseaicendg(:,:) > 0.0_wp .AND. hicif(:,:) < zhicifmin ) 
+               zhicifinc(:,:) = (zhicifmin - hicif(:,:)) * zincwgt    
+            ELSEWHERE
+               zhicifinc(:,:) = 0.0_wp
+            END WHERE
+
+! nudge ice depth
+            hicif(:,:)=hicif(:,:) + zhicifinc(:,:)
+            phicif(:,:)=phicif(:,:) + zhicifinc(:,:)       
+
+! seaice salinity balancing (to add)
+
+#endif
+
+#if defined key_cice
+
+! Pass ice increment tendency into CICE
+            ndaice_da(:,:) = seaice_bkginc(:,:) * zincwgt / rdt
+
+#endif
+
+            IF ( kt == nitiaufin_r ) THEN
+               DEALLOCATE( seaice_bkginc )
+            ENDIF
+
+         ELSE
+
+#if defined key_cice
+
+! Zero ice increment tendency into CICE
+            ndaice_da(:,:) = 0.0_wp
+
+#endif
+
+         ENDIF
+
+      ELSEIF ( ln_asmdin ) THEN
+
+         !--------------------------------------------------------------------
+         ! Direct Initialization
+         !--------------------------------------------------------------------
+
+         IF ( kt == nitdin_r ) THEN
+
+            neuler = 0                    ! Force Euler forward step
+
+#if defined key_lim3 || defined key_lim2
+
+            zofrld(:,:)=frld(:,:)
+            zohicif(:,:)=hicif(:,:)
+ 
+            ! Initialize the now fields the background + increment
+
+            frld(:,:) = MIN( MAX( frld(:,:) - seaice_bkginc(:,:), 0.0_wp), 1.0_wp)
+            pfrld(:,:) = frld(:,:) 
+            fr_i(:,:) = 1.0_wp - frld(:,:)        ! adjust ice fraction
+
+            zseaicendg(:,:)=zofrld(:,:) - frld(:,:)         ! find out actual sea ice nudge applied
+
+            ! Nudge sea ice depth to bring it up to a required minimum depth
+
+            WHERE( zseaicendg(:,:) > 0.0_wp .AND. hicif(:,:) < zhicifmin ) 
+               zhicifinc(:,:) = (zhicifmin - hicif(:,:)) * zincwgt    
+            ELSEWHERE
+               zhicifinc(:,:) = 0.0_wp
+            END WHERE
+
+! nudge ice depth
+            hicif(:,:)=hicif(:,:) + zhicifinc(:,:)
+            phicif(:,:)=phicif(:,:)       
+
+! seaice salinity balancing (to add)
+  
+#endif
+ 
+#if defined key_cice
+
+! Pass ice increment tendency into CICE - is this correct?
+           ndaice_da(:,:) = seaice_bkginc(:,:) / rdt
+
+#endif
+           IF ( .NOT. PRESENT(kindic) ) THEN
+              DEALLOCATE( seaice_bkginc )
+           END IF
+
+         ELSE
+
+#if defined key_cice
+
+! Zero ice increment tendency into CICE 
+            ndaice_da(:,:) = 0.0_wp
+
+#endif
+         
+         ENDIF
+
+!#if defined key_lim3 || defined key_lim2 || defined key_cice
+!
+!            IF (ln_seaicebal ) THEN       
+!             !! balancing salinity increments
+!             !! simple case from limflx.F90 (doesn't include a mass flux)
+!             !! assumption is that as ice concentration is reduced or increased
+!             !! the snow and ice depths remain constant
+!             !! note that snow is being created where ice concentration is being increased
+!             !! - could be more sophisticated and
+!             !! not do this (but would need to alter h_snow)
+!
+!             usave(:,:,:)=sb(:,:,:)   ! use array as a temporary store
+!
+!             DO jj = 1, jpj
+!               DO ji = 1, jpi 
+!           ! calculate change in ice and snow mass per unit area
+!           ! positive values imply adding salt to the ocean (results from ice formation)
+!           ! fwf : ice formation and melting
+!
+!                 zfons = ( -nfresh_da(ji,jj)*soce + nfsalt_da(ji,jj) )*rdt
+!
+!           ! change salinity down to mixed layer depth
+!                 mld=hmld_kara(ji,jj)
+!
+!           ! prevent small mld
+!           ! less than 10m can cause salinity instability 
+!                 IF (mld < 10) mld=10
+!
+!           ! set to bottom of a level 
+!                 DO jk = jpk-1, 2, -1
+!                   IF ((mld > gdepw(ji,jj,jk)) .and. (mld < gdepw(ji,jj,jk+1))) THEN 
+!                     mld=gdepw(ji,jj,jk+1)
+!                     jkmax=jk
+!                   ENDIF
+!                 ENDDO
+!
+!            ! avoid applying salinity balancing in shallow water or on land
+!            ! 
+!
+!            ! dsal_ocn (psu kg m^-2) / (kg m^-3 * m)
+!
+!                 dsal_ocn=0.0_wp
+!                 sal_thresh=5.0_wp        ! minimum salinity threshold for salinity balancing
+!
+!                 if (tmask(ji,jj,1) > 0 .AND. tmask(ji,jj,jkmax) > 0 ) &
+!                              dsal_ocn = zfons / (rhop(ji,jj,1) * mld)
+!
+!           ! put increments in for levels in the mixed layer
+!           ! but prevent salinity below a threshold value 
+!
+!                   DO jk = 1, jkmax              
+!
+!                     IF (dsal_ocn > 0.0_wp .or. sb(ji,jj,jk)+dsal_ocn > sal_thresh) THEN 
+!                           sb(ji,jj,jk) = sb(ji,jj,jk) + dsal_ocn
+!                           sn(ji,jj,jk) = sn(ji,jj,jk) + dsal_ocn
+!                     ENDIF
+!
+!                   ENDDO
+!
+!      !            !  salt exchanges at the ice/ocean interface
+!      !            zpmess         = zfons / rdt_ice    ! rdt_ice is ice timestep
+!      !
+!      !! Adjust fsalt. A +ve fsalt means adding salt to ocean
+!      !!           fsalt(ji,jj) =  fsalt(ji,jj) + zpmess     ! adjust fsalt  
+!      !!               
+!      !!           emps(ji,jj) = emps(ji,jj) + zpmess        ! or adjust emps (see icestp1d) 
+!      !!                                                     ! E-P (kg m-2 s-2)
+!      !            emp(ji,jj) = emp(ji,jj) + zpmess          ! E-P (kg m-2 s-2)
+!               ENDDO !ji
+!             ENDDO !jj!
+!
+!            ENDIF !ln_seaicebal
+!
+!#endif
+
+
+      ENDIF
+
+   END SUBROUTINE seaice_asm_inc
    !!======================================================================
 END MODULE asminc
Index: /trunk/NEMOGCM/NEMO/OPA_SRC/DOM/daymod.F90
===================================================================
--- /trunk/NEMOGCM/NEMO/OPA_SRC/DOM/daymod.F90	(revision 3603)
+++ /trunk/NEMOGCM/NEMO/OPA_SRC/DOM/daymod.F90	(revision 3604)
@@ -2,18 +2,18 @@
    !!======================================================================
    !!                       ***  MODULE  daymod  ***
-   !! Ocean        :  calendar 
+   !! Ocean        :  calendar
    !!=====================================================================
    !! History :  OPA  ! 1994-09  (M. Pontaud M. Imbard)  Original code
    !!                 ! 1997-03  (O. Marti)
-   !!                 ! 1997-05  (G. Madec) 
+   !!                 ! 1997-05  (G. Madec)
    !!                 ! 1997-08  (M. Imbard)
    !!   NEMO     1.0  ! 2003-09  (G. Madec)  F90 + nyear, nmonth, nday
    !!                 ! 2004-01  (A.M. Treguier) new calculation based on adatrj
    !!                 ! 2006-08  (G. Madec)  surface module major update
-   !!----------------------------------------------------------------------      
+   !!----------------------------------------------------------------------
 
    !!----------------------------------------------------------------------
    !!   day        : calendar
-   !!  
+   !!
    !!           -------------------------------
    !!           ----------- WARNING -----------
@@ -24,13 +24,13 @@
    !!           ----------- WARNING -----------
    !!           -------------------------------
-   !!  
+   !!
    !!----------------------------------------------------------------------
    USE dom_oce         ! ocean space and time domain
    USE phycst          ! physical constants
    USE in_out_manager  ! I/O manager
-   USE iom             ! 
+   USE iom             !
    USE ioipsl, ONLY :   ymds2ju   ! for calendar
    USE prtctl          ! Print control
-   USE restart         ! 
+   USE restart         !
    USE trc_oce, ONLY : lk_offline ! offline flag
    USE timing          ! Timing
@@ -41,6 +41,7 @@
    PUBLIC   day        ! called by step.F90
    PUBLIC   day_init   ! called by istate.F90
-
-   INTEGER ::   nsecd, nsecd05, ndt, ndt05
+   PUBLIC   day_mth    ! Needed by TAM
+
+   INTEGER, PUBLIC ::   nsecd, nsecd05, ndt, ndt05 ! (PUBLIC for TAM)
 
    !!----------------------------------------------------------------------
@@ -54,6 +55,6 @@
       !!----------------------------------------------------------------------
       !!                   ***  ROUTINE day_init  ***
-      !! 
-      !! ** Purpose :   Initialization of the calendar values to their values 1 time step before nit000 
+      !!
+      !! ** Purpose :   Initialization of the calendar values to their values 1 time step before nit000
       !!                because day will be called at the beginning of step
       !!
@@ -81,5 +82,5 @@
       ndt05   = NINT(0.5 * rdttra(1))
 
-      IF( .NOT. lk_offline ) CALL day_rst( nit000, 'READ' ) 
+      IF( .NOT. lk_offline ) CALL day_rst( nit000, 'READ' )
 
       ! set the calandar from ndastp (read in restart file and namelist)
@@ -87,5 +88,5 @@
       nyear   =   ndastp / 10000
       nmonth  = ( ndastp - (nyear * 10000) ) / 100
-      nday    =   ndastp - (nyear * 10000) - ( nmonth * 100 ) 
+      nday    =   ndastp - (nyear * 10000) - ( nmonth * 100 )
 
       CALL ymds2ju( nyear, nmonth, nday, 0.0, fjulday )  ! we assume that we start run at 00:00
@@ -95,7 +96,7 @@
       nsec1jan000 = 0
       CALL day_mth
-      
+
       IF ( nday == 0 ) THEN     !   for ex if ndastp = ndate0 - 1
-         nmonth = nmonth - 1  
+         nmonth = nmonth - 1
          nday = nmonth_len(nmonth)
       ENDIF
@@ -106,12 +107,12 @@
          IF( nleapy == 1 )   CALL day_mth
       ENDIF
-      
+
       ! day since january 1st
       nday_year = nday + SUM( nmonth_len(1:nmonth - 1) )
 
-      !compute number of days between last monday and today      
+      !compute number of days between last monday and today
       CALL ymds2ju( 1900, 01, 01, 0.0, zjul )  ! compute julian day value of 01.01.1900 (our reference that was a Monday)
-      inbday = NINT(fjulday - zjul)            ! compute nb day between  01.01.1900 and current day  
-      idweek = MOD(inbday, 7)                  ! compute nb day between last monday and current day  
+      inbday = NINT(fjulday - zjul)            ! compute nb day between  01.01.1900 and current day
+      idweek = MOD(inbday, 7)                  ! compute nb day between last monday and current day
 
       ! number of seconds since the beginning of current year/month/week/day at the middle of the time-step
@@ -135,5 +136,5 @@
       !!----------------------------------------------------------------------
       !!                   ***  ROUTINE day_init  ***
-      !! 
+      !!
       !! ** Purpose :   calendar values related to the months
       !!
@@ -147,5 +148,5 @@
 
       ! length of the month of the current year (from nleapy, read in namelist)
-      IF ( nleapy < 2 ) THEN 
+      IF ( nleapy < 2 ) THEN
          nmonth_len(:) = (/ 31, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 31 /)
          nyear_len(:) = 365
@@ -167,5 +168,5 @@
       ! time since Jan 1st   0     1     2    ...    11    12    13
       !          ---------*--|--*--|--*--| ... |--*--|--*--|--*--|--------------------------------------
-      !                 <---> <---> <--->  ...  <---> <---> <--->        
+      !                 <---> <---> <--->  ...  <---> <---> <--->
       ! month number      0     1     2    ...    11    12    13
       !
@@ -180,6 +181,6 @@
          nmonth_end(jm) = nmonth_end(jm-1) + nsecd * nmonth_len(jm)
       END DO
-      !           
-   END SUBROUTINE 
+      !
+   END SUBROUTINE
 
 
@@ -187,5 +188,5 @@
       !!----------------------------------------------------------------------
       !!                      ***  ROUTINE day  ***
-      !! 
+      !!
       !! ** Purpose :   Compute the date with a day iteration IF necessary.
       !!
@@ -199,5 +200,5 @@
       !!              - adatrj    : date in days since the beginning of the run
       !!              - nsec_year : current time of the year (in second since 00h, jan 1st)
-      !!----------------------------------------------------------------------      
+      !!----------------------------------------------------------------------
       INTEGER, INTENT(in) ::   kt        ! ocean time-step indices
       !
@@ -210,13 +211,13 @@
       zprec = 0.1 / rday
       !                                                 ! New time-step
-      nsec_year  = nsec_year  + ndt 
-      nsec_month = nsec_month + ndt                 
+      nsec_year  = nsec_year  + ndt
+      nsec_month = nsec_month + ndt
       nsec_week  = nsec_week  + ndt
-      nsec_day   = nsec_day   + ndt                
+      nsec_day   = nsec_day   + ndt
       adatrj  = adatrj  + rdttra(1) / rday
       fjulday = fjulday + rdttra(1) / rday
       IF( ABS(fjulday - REAL(NINT(fjulday),wp)) < zprec )   fjulday = REAL(NINT(fjulday),wp)   ! avoid truncation error
       IF( ABS(adatrj  - REAL(NINT(adatrj ),wp)) < zprec )   adatrj  = REAL(NINT(adatrj ),wp)   ! avoid truncation error
-      
+
       IF( nsec_day > nsecd ) THEN                       ! New day
          !
@@ -251,5 +252,5 @@
 
       IF( nsec_week > 7*nsecd )   nsec_week = ndt05     ! New week
-      
+
       IF(ln_ctl) THEN
          WRITE(charout,FMT="('kt =', I4,'  d/m/y =',I2,I2,I4)") kt, nday, nmonth, nyear
@@ -268,14 +269,14 @@
       !!---------------------------------------------------------------------
       !!                   ***  ROUTINE ts_rst  ***
-      !! 
+      !!
       !!  ** Purpose : Read or write calendar in restart file:
-      !! 
+      !!
       !!  WRITE(READ) mode:
-      !!       kt        : number of time step since the begining of the experiment at the 
+      !!       kt        : number of time step since the begining of the experiment at the
       !!                   end of the current(previous) run
-      !!       adatrj(0) : number of elapsed days since the begining of the experiment at the 
+      !!       adatrj(0) : number of elapsed days since the begining of the experiment at the
       !!                   end of the current(previous) run (REAL -> keep fractions of day)
       !!       ndastp    : date at the end of the current(previous) run (coded as yyyymmdd integer)
-      !! 
+      !!
       !!   According to namelist parameter nrstdt,
       !!       nrstdt = 0  no control on the date (nit000 is  arbitrary).
@@ -295,5 +296,5 @@
       REAL(wp) ::   zkt, zndastp
       !!----------------------------------------------------------------------
-      
+
       IF( TRIM(cdrw) == 'READ' ) THEN
 
@@ -312,24 +313,24 @@
                WRITE(numout,*)
             ENDIF
-            ! Control of date 
-            IF( nit000 - NINT( zkt ) /= 1 .AND. nrstdt /= 0 )                                         & 
-                 &   CALL ctl_stop( ' ===>>>> : problem with nit000 for the restart',                 & 
+            ! Control of date
+            IF( nit000 - NINT( zkt ) /= 1 .AND. nrstdt /= 0 )                                         &
+                 &   CALL ctl_stop( ' ===>>>> : problem with nit000 for the restart',                 &
                  &                  ' verify the restart file or rerun with nrstdt = 0 (namelist)' )
             ! define ndastp and adatrj
-            IF ( nrstdt == 2 ) THEN 
+            IF ( nrstdt == 2 ) THEN
                ! read the parameters correspondting to nit000 - 1 (last time step of previous run)
                CALL iom_get( numror, 'ndastp', zndastp )
                ndastp = NINT( zndastp )
                CALL iom_get( numror, 'adatrj', adatrj  )
-            ELSE 
+            ELSE
                ! parameters correspondting to nit000 - 1 (as we start the step loop with a call to day)
                ndastp = ndate0 - 1     ! ndate0 read in the namelist in dom_nam, we assume that we start run at 00:00
-               adatrj = ( REAL( nit000-1, wp ) * rdttra(1) ) / rday 
-               ! note this is wrong if time step has changed during run 
+               adatrj = ( REAL( nit000-1, wp ) * rdttra(1) ) / rday
+               ! note this is wrong if time step has changed during run
             ENDIF
          ELSE
             ! parameters correspondting to nit000 - 1 (as we start the step loop with a call to day)
             ndastp = ndate0 - 1        ! ndate0 read in the namelist in dom_nam, we assume that we start run at 00:00
-            adatrj = ( REAL( nit000-1, wp ) * rdttra(1) ) / rday 
+            adatrj = ( REAL( nit000-1, wp ) * rdttra(1) ) / rday
          ENDIF
          IF( ABS(adatrj  - REAL(NINT(adatrj),wp)) < 0.1 / rday )   adatrj = REAL(NINT(adatrj),wp)   ! avoid truncation error
@@ -347,8 +348,8 @@
             IF(lwp) WRITE(numout,*)
             IF(lwp) WRITE(numout,*) 'rst_write : write oce restart file  kt =', kt
-            IF(lwp) WRITE(numout,*) '~~~~~~~'         
+            IF(lwp) WRITE(numout,*) '~~~~~~~'
          ENDIF
          ! calendar control
-         CALL iom_rstput( kt, nitrst, numrow, 'kt'     , REAL( kt    , wp) )   ! time-step 
+         CALL iom_rstput( kt, nitrst, numrow, 'kt'     , REAL( kt    , wp) )   ! time-step
          CALL iom_rstput( kt, nitrst, numrow, 'ndastp' , REAL( ndastp, wp) )   ! date
          CALL iom_rstput( kt, nitrst, numrow, 'adatrj' , adatrj            )   ! number of elapsed days since
Index: /trunk/NEMOGCM/NEMO/OPA_SRC/LBC/lib_mpp.F90
===================================================================
--- /trunk/NEMOGCM/NEMO/OPA_SRC/LBC/lib_mpp.F90	(revision 3603)
+++ /trunk/NEMOGCM/NEMO/OPA_SRC/LBC/lib_mpp.F90	(revision 3604)
@@ -128,18 +128,18 @@
    INTEGER, DIMENSION(:), ALLOCATABLE, SAVE ::   nrank_znl  ! dimension ndim_rank_znl, number of the procs into the same znl domain
 
-   ! North fold condition in mpp_mpi with jpni > 1
-   INTEGER ::   ngrp_world        ! group ID for the world processors
-   INTEGER ::   ngrp_opa          ! group ID for the opa processors
-   INTEGER ::   ngrp_north        ! group ID for the northern processors (to be fold)
-   INTEGER ::   ncomm_north       ! communicator made by the processors belonging to ngrp_north
-   INTEGER ::   ndim_rank_north   ! number of 'sea' processor in the northern line (can be /= jpni !)
-   INTEGER ::   njmppmax          ! value of njmpp for the processors of the northern line
-   INTEGER ::   north_root        ! number (in the comm_opa) of proc 0 in the northern comm
-   INTEGER, DIMENSION(:), ALLOCATABLE, SAVE ::   nrank_north   ! dimension ndim_rank_north
+   ! North fold condition in mpp_mpi with jpni > 1 (PUBLIC for TAM)
+   INTEGER, PUBLIC ::   ngrp_world        ! group ID for the world processors
+   INTEGER, PUBLIC ::   ngrp_opa          ! group ID for the opa processors
+   INTEGER, PUBLIC ::   ngrp_north        ! group ID for the northern processors (to be fold)
+   INTEGER, PUBLIC ::   ncomm_north       ! communicator made by the processors belonging to ngrp_north
+   INTEGER, PUBLIC ::   ndim_rank_north   ! number of 'sea' processor in the northern line (can be /= jpni !)
+   INTEGER, PUBLIC ::   njmppmax          ! value of njmpp for the processors of the northern line
+   INTEGER, PUBLIC ::   north_root        ! number (in the comm_opa) of proc 0 in the northern comm
+   INTEGER, DIMENSION(:), ALLOCATABLE, SAVE, PUBLIC ::   nrank_north   ! dimension ndim_rank_north
 
    ! Type of send : standard, buffered, immediate
-   CHARACTER(len=1) ::   cn_mpi_send = 'S'    ! type od mpi send/recieve (S=standard, B=bsend, I=isend)
-   LOGICAL          ::   l_isend = .FALSE.   ! isend use indicator (T if cn_mpi_send='I')
-   INTEGER          ::   nn_buffer = 0       ! size of the buffer in case of mpi_bsend
+   CHARACTER(len=1), PUBLIC ::   cn_mpi_send = 'S'    ! type od mpi send/recieve (S=standard, B=bsend, I=isend)
+   LOGICAL, PUBLIC          ::   l_isend = .FALSE.   ! isend use indicator (T if cn_mpi_send='I')
+   INTEGER, PUBLIC          ::   nn_buffer = 0       ! size of the buffer in case of mpi_bsend
 
    REAL(wp), DIMENSION(:), ALLOCATABLE, SAVE :: tampon  ! buffer in case of bsend
Index: /trunk/NEMOGCM/NEMO/OPA_SRC/TAM/tamtrj.F90
===================================================================
--- /trunk/NEMOGCM/NEMO/OPA_SRC/TAM/tamtrj.F90	(revision 3604)
+++ /trunk/NEMOGCM/NEMO/OPA_SRC/TAM/tamtrj.F90	(revision 3604)
@@ -0,0 +1,219 @@
+MODULE tamtrj
+   !!======================================================================
+   !!                       ***  MODULE tamtrj  ***
+   !! Tangent and adjoint  trajectory interface: Write to file
+   !!                                    the model state trajectory
+   !!======================================================================
+   !!----------------------------------------------------------------------
+   !!   tam_trj_ini  : init: read the namelist
+   !!   tam_trj_wri  : Write out the model state trajectory
+   !!----------------------------------------------------------------------
+   !! * Modules used
+   USE oce                ! Dynamics and active tracers defined in memory
+   USE sbc_oce            ! Ocean surface boundary conditions
+   USE zdf_oce            ! Vertical mixing variables
+#if defined key_zdfddm
+   USE zdfddm             ! Double diffusion mixing parameterization
+#endif
+   USE ldftra_oce         ! Lateral tracer mixing coefficient defined in memory
+#if   defined key_ldfslp
+   USE ldfslp
+#endif
+#if defined key_traldf_c2d
+   USE ldfeiv             ! eddy induced velocity coef.      (ldf_eiv routine)
+#endif
+#if defined key_zdftke
+   USE zdftke             ! TKE vertical physics
+#endif
+   USE eosbn2             ! Equation of state (eos_bn2 routine)
+   USE zdfbfr
+   USE tradmp             ! Tracer damping
+   USE sol_oce
+   USE trc_oce
+   USE in_out_manager
+   USE dom_oce
+   USE iom                 ! I/O module
+   USE zdfmxl
+
+   IMPLICIT NONE
+
+   !! * Routine accessibility
+   PRIVATE
+   PUBLIC tam_trj_init, &  !: Write out the background state
+      &   tam_trj_wri      !: Write out the background state
+
+   LOGICAL, PUBLIC :: &
+      & ln_trjhand = .FALSE.   !: No output of the state trajectory fields
+
+   LOGICAL :: &
+      & ln_trj_spl            !: save the trajectory at simple precision
+
+   CHARACTER (LEN=40), PUBLIC :: &
+      & cn_dirtrj                                  !: Filename for storing the
+                                                   !: reference trajectory
+   INTEGER, PUBLIC :: &
+      & nn_ittrjfrq         !: Frequency of trajectory output for 4D-VAR
+
+CONTAINS
+   SUBROUTINE tam_trj_init
+      !!-----------------------------------------------------------------------
+      !!
+      !!                  ***  ROUTINE tam_trj_init ***
+      !!
+      !! ** Purpose : initialize the model state trajectory
+      !!
+      !! ** Method  :
+      !!
+      !! ** Action  :
+      !!
+      !! References :
+      !!
+      !! History :
+      !!        ! 10-01 (A. Vidard)
+      !!-----------------------------------------------------------------------
+
+      IMPLICIT NONE
+
+      !! * Modules used
+      NAMELIST/namtrj/ nn_ittrjfrq, ln_trjhand, cn_dirtrj, ln_trj_spl
+
+      cn_dirtrj   = 'tam_trajectory'
+      ln_trjhand = .FALSE.
+      nn_ittrjfrq = 1
+      ln_trj_spl  = .TRUE.
+
+      REWIND ( numnam )
+      READ   ( numnam, namtrj )
+
+      ! Control print
+      IF(lwp) THEN
+         WRITE(numout,*)
+         WRITE(numout,*) 'tam_trj_ini : Trajectory handling:'
+         WRITE(numout,*) '~~~~~~~~~~~~'
+         WRITE(numout,*) '          Namelist namtam : set trajectory parameters'
+         WRITE(numout,*) '             Logical switch for handling state trajectory         ', &
+            &            ' ln_trjhand = ', ln_trjhand
+         WRITE(numout,*) '             Logical switch for handling it at simple precision       ', &
+            &            ' ln_trj_spl  = ', ln_trj_spl
+         WRITE(numout,*) '             Frequency of trajectory output (or input for TAM)                          ', &
+            &            ' nn_ittrjfrq = ', nn_ittrjfrq
+      END IF
+   END SUBROUTINE tam_trj_init
+   SUBROUTINE tam_trj_wri( kt )
+      !!-----------------------------------------------------------------------
+      !!
+      !!                  ***  ROUTINE tam_trj_wri ***
+      !!
+      !! ** Purpose : Write to file the model state trajectory
+      !!
+      !! ** Method  :
+      !!
+      !! ** Action  :
+      !!
+      !! References :
+      !!
+      !! History :
+      !!        ! 2007-04 (A. Weaver)
+      !!        ! 2009-03 (F. Vigilant) Add hmlp (zdfmxl) for no tracer nmldp=2
+      !!        ! 2009-06 (F. Vigilant) special case when kt=nit000-1
+      !!        ! 2009-07 (F. Vigilant) add computation of eiv at restart
+      !!        ! 2010-01 (A. Vidard) asm_trj_wri->tam_trj_wri
+      !!        ! 2010-04 (F. Vigilant) converison to 3.2
+      !!-----------------------------------------------------------------------
+
+      !! * Arguments
+      INTEGER, INTENT( IN ) :: &
+         & kt                    ! Current time-step
+
+      !! * Local declarations
+      INTEGER :: &
+         & inum                  ! File unit number
+      INTEGER :: &
+         & it
+      INTEGER :: &
+         & ntype
+      CHARACTER (LEN=50) :: &
+         & cl_dirtrj
+      REAL(wp) :: &
+         & zdate            ! Date
+
+      IF ( ln_trj_spl ) THEN ; ntype = jp_r4
+                        ELSE ; ntype = jp_r8 ; ENDIF
+      !------------------------------------------------------------------------
+      ! Write a single file for each trajectory time step
+      !------------------------------------------------------------------------
+      !------------------------------------------------------------------------
+      ! Write a single file for each trajectory time step
+      !------------------------------------------------------------------------
+      IF( ( MOD( kt - nit000 + 1, nn_ittrjfrq ) == 0 ) .OR. ( kt == nitend ) ) THEN
+
+         IF( kt == nit000 - 1 ) THEN         ! Treat special case when kt = nit000-1
+            !
+#if defined key_zdftke
+            IF(lwp) WRITE(numout,*) ' Computing  zdf_tke coeff. form restart...'
+            ! Compute the vertical eddy viscosity and diffusivity coefficients
+            CALL zdf_tke( nit000 )
+#endif
+#if defined key_zdfddm
+            IF(lwp) WRITE(numout,*) ' Computing zdf_ddm coeff. from restart...'
+            ! Compute the vertical eddy viscosity and diffusivity coefficients (salt effect)
+            CALL zdf_ddm( nit000 )
+#endif
+            IF(lwp) WRITE(numout,*) ' Computing zdf_mxl coeff. from restart...'
+            ! Compute the turbocline depth and the mixed layer depth
+            CALL zdf_mxl( nit000 )
+#if defined key_ldfslp
+            IF(lwp) WRITE(numout,*) ' Compute the slopes of neutral surface...'
+            CALL bn2( tsb, rn2 )
+            CALL ldf_slp( nit000, rhd, rn2 )
+#endif
+#if defined key_traldf_c2d
+            IF(lwp) WRITE(numout,*) ' Computing ldf_eiv coeff. from restart...'
+            ! Compute eddy induced velocity coefficient
+            IF( lk_traldf_eiv )   CALL ldf_eiv( nit000 )
+#endif
+         ENDIF
+         !
+         it = kt - nit000 + 1
+         !
+         ! Define the output file
+         WRITE(cl_dirtrj, FMT='(I5.5,A,A)' ) it, '_', TRIM( cn_dirtrj )
+         cl_dirtrj = TRIM( cl_dirtrj )
+         CALL iom_open( cl_dirtrj, inum, ldwrt = .TRUE., kiolib = jprstlib)
+
+         ! Output trajectory fields
+         CALL iom_rstput( it, it, inum, 'emp'   , emp   , ktype = ntype )
+         CALL iom_rstput( it, it, inum, 'emps'  , emps  , ktype = ntype )
+         CALL iom_rstput( it, it, inum, 'un'    , un    , ktype = ntype )
+         CALL iom_rstput( it, it, inum, 'vn'    , vn    , ktype = ntype )
+         CALL iom_rstput( it, it, inum, 'tn'    , tsn(:,:,:,jp_tem)    , ktype = ntype )
+         CALL iom_rstput( it, it, inum, 'sn'    , tsn(:,:,:,jp_sal)    , ktype = ntype )
+         CALL iom_rstput( it, it, inum, 'avmu'  , avmu  , ktype = ntype )
+         CALL iom_rstput( it, it, inum, 'avmv'  , avmv  , ktype = ntype )
+         CALL iom_rstput( it, it, inum, 'avt'   , avt   , ktype = ntype )
+         CALL iom_rstput( it, it, inum, 'bfrua' , bfrua , ktype = ntype )
+         CALL iom_rstput( it, it, inum, 'bfrva' , bfrva , ktype = ntype )
+         CALL iom_rstput( it, it, inum, 'etot3' , etot3 , ktype = ntype )
+#if defined key_ldfslp
+         CALL iom_rstput( it, it, inum, 'uslp'  , uslp  , ktype = ntype )
+         CALL iom_rstput( it, it, inum, 'vslp'  , vslp  , ktype = ntype )
+         CALL iom_rstput( it, it, inum, 'wslpi' , wslpi , ktype = ntype )
+         CALL iom_rstput( it, it, inum, 'wslpj' , wslpj , ktype = ntype )
+#endif
+#if defined key_zdfddm
+         CALL iom_rstput( it, it, inum, 'avs'   , avs , ktype = ntype )
+#endif
+         IF( ln_tradmp ) THEN
+            CALL iom_rstput( it, it, inum, 'hmlp'  , hmlp  , ktype = ntype )
+            CALL iom_rstput( it, it, inum, 'strdmp', strdmp, ktype = ntype )
+         END IF
+         CALL iom_rstput( it, it, inum, 'aeiu'  , aeiu, ktype = ntype )
+         CALL iom_rstput( it, it, inum, 'aeiv'  , aeiv, ktype = ntype )
+         CALL iom_rstput( it, it, inum, 'aeiw'  , aeiw, ktype = ntype )
+
+         CALL iom_close( inum )
+
+      ENDIF
+
+   END SUBROUTINE tam_trj_wri
+END MODULE tamtrj
Index: /trunk/NEMOGCM/NEMO/OPA_SRC/lib_fortran.F90
===================================================================
--- /trunk/NEMOGCM/NEMO/OPA_SRC/lib_fortran.F90	(revision 3603)
+++ /trunk/NEMOGCM/NEMO/OPA_SRC/lib_fortran.F90	(revision 3604)
@@ -8,7 +8,7 @@
 
    !!----------------------------------------------------------------------
-   !!   glob_sum    : generic interface for global masked summation over 
+   !!   glob_sum    : generic interface for global masked summation over
    !!                 the interior domain for 1 or 2 2D or 3D arrays
-   !!                 it works only for T points   
+   !!                 it works only for T points
    !!   SIGN        : generic interface for SIGN to overwrite f95 behaviour
    !!                 of intrinsinc sign function
@@ -29,12 +29,13 @@
 
    INTERFACE glob_sum
-      MODULE PROCEDURE glob_sum_2d, glob_sum_3d,glob_sum_2d_a, glob_sum_3d_a 
+      MODULE PROCEDURE glob_sum_1d, glob_sum_2d, glob_sum_3d, &
+         &             glob_sum_2d_a, glob_sum_3d_a
    END INTERFACE
 
-#if defined key_nosignedzero   
+#if defined key_nosignedzero
    INTERFACE SIGN
       MODULE PROCEDURE SIGN_SCALAR, SIGN_ARRAY_1D, SIGN_ARRAY_2D, SIGN_ARRAY_3D,   &
-         &             SIGN_ARRAY_1D_A, SIGN_ARRAY_2D_A, SIGN_ARRAY_3D_A,          & 
-         &             SIGN_ARRAY_1D_B, SIGN_ARRAY_2D_B, SIGN_ARRAY_3D_B 
+         &             SIGN_ARRAY_1D_A, SIGN_ARRAY_2D_A, SIGN_ARRAY_3D_A,          &
+         &             SIGN_ARRAY_1D_B, SIGN_ARRAY_2D_B, SIGN_ARRAY_3D_B
    END INTERFACE
 #endif
@@ -42,12 +43,27 @@
    !!----------------------------------------------------------------------
    !! NEMO/OPA 3.3 , NEMO Consortium (2010)
-   !! $Id$ 
+   !! $Id$
    !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
-CONTAINS 
+CONTAINS
 
 #if ! defined key_mpp_rep
-
-   FUNCTION glob_sum_2d( ptab ) 
+   FUNCTION glob_sum_1d( ptab, kdim )
+      !!-----------------------------------------------------------------------
+      !!                  ***  FUNCTION  glob_sum_1D  ***
+      !!
+      !! ** Purpose : perform a masked sum on the inner global domain of a 1D array
+      !!-----------------------------------------------------------------------
+      INTEGER :: kdim
+      REAL(wp), INTENT(in), DIMENSION(kdim) ::   ptab        ! input 1D array
+      REAL(wp)                              ::   glob_sum_1d ! global sum
+      !!-----------------------------------------------------------------------
+      !
+      glob_sum_1d = SUM( ptab(:) )
+      IF( lk_mpp )   CALL mpp_sum( glob_sum_1d )
+      !
+   END FUNCTION glob_sum_1d
+
+   FUNCTION glob_sum_2d( ptab )
       !!-----------------------------------------------------------------------
       !!                  ***  FUNCTION  glob_sum_2D  ***
@@ -63,7 +79,7 @@
       !
    END FUNCTION glob_sum_2d
-   
-   
-   FUNCTION glob_sum_3d( ptab ) 
+
+
+   FUNCTION glob_sum_3d( ptab )
       !!-----------------------------------------------------------------------
       !!                  ***  FUNCTION  glob_sum_3D  ***
@@ -86,5 +102,5 @@
 
 
-   FUNCTION glob_sum_2d_a( ptab1, ptab2 ) 
+   FUNCTION glob_sum_2d_a( ptab1, ptab2 )
       !!-----------------------------------------------------------------------
       !!                  ***  FUNCTION  glob_sum_2D _a ***
@@ -95,5 +111,5 @@
       REAL(wp)            , DIMENSION(2)   ::   glob_sum_2d_a   ! global masked sum
       !!-----------------------------------------------------------------------
-      !             
+      !
       glob_sum_2d_a(1) = SUM( ptab1(:,:)*tmask_i(:,:) )
       glob_sum_2d_a(2) = SUM( ptab2(:,:)*tmask_i(:,:) )
@@ -101,7 +117,7 @@
       !
    END FUNCTION glob_sum_2d_a
- 
- 
-   FUNCTION glob_sum_3d_a( ptab1, ptab2 ) 
+
+
+   FUNCTION glob_sum_3d_a( ptab1, ptab2 )
       !!-----------------------------------------------------------------------
       !!                  ***  FUNCTION  glob_sum_3D_a ***
@@ -124,10 +140,36 @@
    END FUNCTION glob_sum_3d_a
 
-#else  
+#else
    !!----------------------------------------------------------------------
    !!   'key_mpp_rep'                                   MPP reproducibility
    !!----------------------------------------------------------------------
-   
-   FUNCTION glob_sum_2d( ptab ) 
+
+   FUNCTION glob_sum_1d( ptab, kdim )
+      !!----------------------------------------------------------------------
+      !!                  ***  FUNCTION  glob_sum_1d ***
+      !!
+      !! ** Purpose : perform a sum in calling DDPDD routine
+      !!----------------------------------------------------------------------
+      INTEGER , INTENT(in) :: kdim
+      REAL(wp), INTENT(in), DIMENSION(kdim) ::   ptab
+      REAL(wp)                              ::   glob_sum_1d   ! global sum
+      !!
+      COMPLEX(wp)::   ctmp
+      REAL(wp)   ::   ztmp
+      INTEGER    ::   ji   ! dummy loop indices
+      !!-----------------------------------------------------------------------
+      !
+      ztmp = 0.e0
+      ctmp = CMPLX( 0.e0, 0.e0, wp )
+      DO ji = 1, kdim
+         ztmp =  ptab(ji)
+         CALL DDPDD( CMPLX( ztmp, 0.e0, wp ), ctmp )
+         END DO
+      IF( lk_mpp )   CALL mpp_sum( ctmp )   ! sum over the global domain
+      glob_sum_1d = REAL(ctmp,wp)
+      !
+   END FUNCTION glob_sum_1d
+
+   FUNCTION glob_sum_2d( ptab )
       !!----------------------------------------------------------------------
       !!                  ***  FUNCTION  glob_sum_2d ***
@@ -154,8 +196,8 @@
       glob_sum_2d = REAL(ctmp,wp)
       !
-   END FUNCTION glob_sum_2d   
-
-
-   FUNCTION glob_sum_3d( ptab ) 
+   END FUNCTION glob_sum_2d
+
+
+   FUNCTION glob_sum_3d( ptab )
       !!----------------------------------------------------------------------
       !!                  ***  FUNCTION  glob_sum_3d ***
@@ -179,13 +221,13 @@
             CALL DDPDD( CMPLX( ztmp, 0.e0, wp ), ctmp )
             END DO
-         END DO    
+         END DO
       END DO
       IF( lk_mpp )   CALL mpp_sum( ctmp )   ! sum over the global domain
       glob_sum_3d = REAL(ctmp,wp)
       !
-   END FUNCTION glob_sum_3d   
-
-
-   FUNCTION glob_sum_2d_a( ptab1, ptab2 ) 
+   END FUNCTION glob_sum_3d
+
+
+   FUNCTION glob_sum_2d_a( ptab1, ptab2 )
       !!----------------------------------------------------------------------
       !!                  ***  FUNCTION  glob_sum_2d_a ***
@@ -214,8 +256,8 @@
       glob_sum_2d_a = REAL(ctmp,wp)
       !
-   END FUNCTION glob_sum_2d_a   
-
-
-   FUNCTION glob_sum_3d_a( ptab1, ptab2 ) 
+   END FUNCTION glob_sum_2d_a
+
+
+   FUNCTION glob_sum_3d_a( ptab1, ptab2 )
       !!----------------------------------------------------------------------
       !!                  ***  FUNCTION  glob_sum_3d_a ***
@@ -241,10 +283,10 @@
             CALL DDPDD( CMPLX( ztmp, 0.e0, wp ), ctmp )
             END DO
-         END DO    
+         END DO
       END DO
       IF( lk_mpp )   CALL mpp_sum( ctmp )   ! sum over the global domain
       glob_sum_3d_a = REAL(ctmp,wp)
       !
-   END FUNCTION glob_sum_3d_a   
+   END FUNCTION glob_sum_3d_a
 
 #endif
@@ -253,17 +295,17 @@
       !!----------------------------------------------------------------------
       !!               ***  ROUTINE DDPDD ***
-      !!          
+      !!
       !! ** Purpose : Add a scalar element to a sum
-      !!             
-      !!
-      !! ** Method  : The code uses the compensated summation with doublet 
+      !!
+      !!
+      !! ** Method  : The code uses the compensated summation with doublet
       !!              (sum,error) emulated useing complex numbers. ydda is the
-      !!               scalar to add to the summ yddb 
-      !! 
-      !! ** Action  : This does only work for MPI. 
+      !!               scalar to add to the summ yddb
+      !!
+      !! ** Action  : This does only work for MPI.
       !!
       !! References : Using Acurate Arithmetics to Improve Numerical
       !!              Reproducibility and Sability in Parallel Applications
-      !!              Yun HE and Chris H. Q. DING, Journal of Supercomputing 18, 259-277, 2001 
+      !!              Yun HE and Chris H. Q. DING, Journal of Supercomputing 18, 259-277, 2001
       !!----------------------------------------------------------------------
       COMPLEX(wp), INTENT(in   ) ::   ydda
@@ -288,5 +330,5 @@
    !!   'key_nosignedzero'                                         F90 SIGN
    !!----------------------------------------------------------------------
-   
+
    FUNCTION SIGN_SCALAR( pa, pb )
       !!-----------------------------------------------------------------------
@@ -304,5 +346,5 @@
 
 
-   FUNCTION SIGN_ARRAY_1D( pa, pb ) 
+   FUNCTION SIGN_ARRAY_1D( pa, pb )
       !!-----------------------------------------------------------------------
       !!                  ***  FUNCTION SIGN_ARRAY_1D  ***
@@ -319,5 +361,5 @@
 
 
-   FUNCTION SIGN_ARRAY_2D(pa,pb) 
+   FUNCTION SIGN_ARRAY_2D(pa,pb)
       !!-----------------------------------------------------------------------
       !!                  ***  FUNCTION SIGN_ARRAY_2D  ***
@@ -333,5 +375,5 @@
    END FUNCTION SIGN_ARRAY_2D
 
-   FUNCTION SIGN_ARRAY_3D(pa,pb) 
+   FUNCTION SIGN_ARRAY_3D(pa,pb)
       !!-----------------------------------------------------------------------
       !!                  ***  FUNCTION SIGN_ARRAY_3D  ***
@@ -348,5 +390,5 @@
 
 
-   FUNCTION SIGN_ARRAY_1D_A(pa,pb) 
+   FUNCTION SIGN_ARRAY_1D_A(pa,pb)
       !!-----------------------------------------------------------------------
       !!                  ***  FUNCTION SIGN_ARRAY_1D_A  ***
@@ -363,5 +405,5 @@
 
 
-   FUNCTION SIGN_ARRAY_2D_A(pa,pb) 
+   FUNCTION SIGN_ARRAY_2D_A(pa,pb)
       !!-----------------------------------------------------------------------
       !!                  ***  FUNCTION SIGN_ARRAY_2D_A  ***
@@ -378,5 +420,5 @@
 
 
-   FUNCTION SIGN_ARRAY_3D_A(pa,pb) 
+   FUNCTION SIGN_ARRAY_3D_A(pa,pb)
       !!-----------------------------------------------------------------------
       !!                  ***  FUNCTION SIGN_ARRAY_3D_A  ***
@@ -393,5 +435,5 @@
 
 
-   FUNCTION SIGN_ARRAY_1D_B(pa,pb) 
+   FUNCTION SIGN_ARRAY_1D_B(pa,pb)
       !!-----------------------------------------------------------------------
       !!                  ***  FUNCTION SIGN_ARRAY_1D_B  ***
@@ -408,5 +450,5 @@
 
 
-   FUNCTION SIGN_ARRAY_2D_B(pa,pb) 
+   FUNCTION SIGN_ARRAY_2D_B(pa,pb)
       !!-----------------------------------------------------------------------
       !!                  ***  FUNCTION SIGN_ARRAY_2D_B  ***
@@ -423,5 +465,5 @@
 
 
-   FUNCTION SIGN_ARRAY_3D_B(pa,pb) 
+   FUNCTION SIGN_ARRAY_3D_B(pa,pb)
       !!-----------------------------------------------------------------------
       !!                  ***  FUNCTION SIGN_ARRAY_3D_B  ***
Index: /trunk/NEMOGCM/NEMO/OPA_SRC/nemogcm.F90
===================================================================
--- /trunk/NEMOGCM/NEMO/OPA_SRC/nemogcm.F90	(revision 3603)
+++ /trunk/NEMOGCM/NEMO/OPA_SRC/nemogcm.F90	(revision 3604)
@@ -6,13 +6,13 @@
    !! History :  OPA  ! 1990-10  (C. Levy, G. Madec)  Original code
    !!            7.0  ! 1991-11  (M. Imbard, C. Levy, G. Madec)
-   !!            7.1  ! 1993-03  (M. Imbard, C. Levy, G. Madec, O. Marti, M. Guyon, A. Lazar, 
-   !!                             P. Delecluse, C. Perigaud, G. Caniaux, B. Colot, C. Maes) release 7.1 
+   !!            7.1  ! 1993-03  (M. Imbard, C. Levy, G. Madec, O. Marti, M. Guyon, A. Lazar,
+   !!                             P. Delecluse, C. Perigaud, G. Caniaux, B. Colot, C. Maes) release 7.1
    !!             -   ! 1992-06  (L.Terray)  coupling implementation
-   !!             -   ! 1993-11  (M.A. Filiberti) IGLOO sea-ice 
-   !!            8.0  ! 1996-03  (M. Imbard, C. Levy, G. Madec, O. Marti, M. Guyon, A. Lazar, 
+   !!             -   ! 1993-11  (M.A. Filiberti) IGLOO sea-ice
+   !!            8.0  ! 1996-03  (M. Imbard, C. Levy, G. Madec, O. Marti, M. Guyon, A. Lazar,
    !!                             P. Delecluse, L.Terray, M.A. Filiberti, J. Vialar, A.M. Treguier, M. Levy) release 8.0
    !!            8.1  ! 1997-06  (M. Imbard, G. Madec)
-   !!            8.2  ! 1999-11  (M. Imbard, H. Goosse)  LIM sea-ice model 
-   !!                 ! 1999-12  (V. Thierry, A-M. Treguier, M. Imbard, M-A. Foujols)  OPEN-MP 
+   !!            8.2  ! 1999-11  (M. Imbard, H. Goosse)  LIM sea-ice model
+   !!                 ! 1999-12  (V. Thierry, A-M. Treguier, M. Imbard, M-A. Foujols)  OPEN-MP
    !!                 ! 2000-07  (J-M Molines, M. Imbard)  Open Boundary Conditions  (CLIPPER)
    !!   NEMO     1.0  ! 2002-08  (G. Madec)  F90: Free form and modules
@@ -25,5 +25,5 @@
    !!             -   ! 2007-07  (J. Chanut, A. Sellar) Unstructured open boundaries (BDY)
    !!            3.2  ! 2009-08  (S. Masson)  open/write in the listing file in mpp
-   !!            3.3  ! 2010-05  (K. Mogensen, A. Weaver, M. Martin, D. Lea) Assimilation interface 
+   !!            3.3  ! 2010-05  (K. Mogensen, A. Weaver, M. Martin, D. Lea) Assimilation interface
    !!             -   ! 2010-10  (C. Ethe, G. Madec) reorganisation of initialisation phase
    !!            3.3.1! 2011-01  (A. R. Porter, STFC Daresbury) dynamical allocation
@@ -34,5 +34,5 @@
    !!   nemo_gcm       : solve ocean dynamics, tracer, biogeochemistry and/or sea-ice
    !!   nemo_init      : initialization of the NEMO system
-   !!   nemo_ctl       : initialisation of the contol print 
+   !!   nemo_ctl       : initialisation of the contol print
    !!   nemo_closefile : close remaining open files
    !!   nemo_alloc     : dynamical allocation
@@ -56,5 +56,5 @@
    USE phycst          ! physical constant                  (par_cst routine)
    USE trdmod          ! momentum/tracers trends       (trd_mod_init routine)
-   USE asmtrj          ! writing out state trajectory
+   USE asmbkg          ! writing out state trajectory
    USE diaptr          ! poleward transports           (dia_ptr_init routine)
    USE diadct          ! sections transports           (dia_dct_init routine)
@@ -76,4 +76,5 @@
    USE mod_ioclient
 #endif
+   USE tamtrj          ! Output trajectory, needed for TAM
 
    IMPLICIT NONE
@@ -82,4 +83,5 @@
    PUBLIC   nemo_gcm    ! called by model.F90
    PUBLIC   nemo_init   ! needed by AGRIF
+   PUBLIC   nemo_alloc  ! needed by TAM
 
    CHARACTER(lc) ::   cform_aaa="( /, 'AAAAAAAA', / ) "     ! flag for output listing
@@ -96,5 +98,5 @@
       !!                     ***  ROUTINE nemo_gcm  ***
       !!
-      !! ** Purpose :   NEMO solves the primitive equations on an orthogonal 
+      !! ** Purpose :   NEMO solves the primitive equations on an orthogonal
       !!              curvilinear mesh on the sphere.
       !!
@@ -140,15 +142,11 @@
           IF( lk_asminc ) THEN
              IF( ln_bkgwri ) CALL asm_bkg_wri( nit000 - 1 )    ! Output background fields
-             IF( ln_trjwri ) CALL asm_trj_wri( nit000 - 1 )    ! Output trajectory fields
              IF( ln_asmdin ) THEN                        ! Direct initialization
                 IF( ln_trainc ) CALL tra_asm_inc( nit000 - 1 )    ! Tracers
-                IF( ln_dyninc ) THEN 
-                   CALL dyn_asm_inc( nit000 - 1 )    ! Dynamics
-                   IF ( ln_asmdin ) CALL ssh_wzv ( nit000 - 1 )      ! update vertical velocity 
-                ENDIF
+                IF( ln_dyninc ) CALL dyn_asm_inc( nit000 - 1 )    ! Dynamics
                 IF( ln_sshinc ) CALL ssh_asm_inc( nit000 - 1 )    ! SSH
              ENDIF
           ENDIF
-        
+
          DO WHILE ( istp <= nitend .AND. nstop == 0 )
 #if defined key_agrif
@@ -163,5 +161,5 @@
 
       IF( lk_diaobs ) CALL dia_obs_wri
-       
+
       !                            !------------------------!
       !                            !==  finalize the run  ==!
@@ -171,5 +169,5 @@
       IF( nstop /= 0 .AND. lwp ) THEN   ! error print
          WRITE(numout,cform_err)
-         WRITE(numout,*) nstop, ' error have been found' 
+         WRITE(numout,*) nstop, ' error have been found'
       ENDIF
       !
@@ -240,5 +238,5 @@
       lwp = (narea == 1) .OR. ln_ctl                        ! control of all listing output print
 
-      ! If dimensions of processor grid weren't specified in the namelist file 
+      ! If dimensions of processor grid weren't specified in the namelist file
       ! then we calculate them here now that we have our communicator size
       IF( (jpni < 1) .OR. (jpnj < 1) )THEN
@@ -258,5 +256,5 @@
          jpi = ( jpiglo-2*jpreci + (jpni-1) ) / jpni + 2*jpreci   ! first  dim.
 #if defined key_nemocice_decomp
-         jpj = ( jpjglo+1-2*jprecj + (jpnj-1) ) / jpnj + 2*jprecj ! second dim. 
+         jpj = ( jpjglo+1-2*jprecj + (jpnj-1) ) / jpnj + 2*jprecj ! second dim.
 #else
          jpj = ( jpjglo-2*jprecj + (jpnj-1) ) / jpnj + 2*jprecj   ! second dim.
@@ -280,5 +278,5 @@
          WRITE(numout,*)
          WRITE(numout,*)
-         DO ji = 1, SIZE(cltxt) 
+         DO ji = 1, SIZE(cltxt)
             IF( TRIM(cltxt(ji)) /= '' )   WRITE(numout,*) cltxt(ji)      ! control print of mynode
          END DO
@@ -287,5 +285,5 @@
       ENDIF
 
-      ! Now we know the dimensions of the grid and numout has been set we can 
+      ! Now we know the dimensions of the grid and numout has been set we can
       ! allocate arrays
       CALL nemo_alloc()
@@ -314,5 +312,5 @@
       IF( ln_ctl        )   CALL prt_ctl_init   ! Print control
 
-      IF( lk_obc        )   CALL     obc_init   ! Open boundaries 
+      IF( lk_obc        )   CALL     obc_init   ! Open boundaries
       IF( lk_bdy        )   CALL     bdy_init       ! Open boundaries initialisation
       IF( lk_bdy        )   CALL     bdy_dta_init   ! Open boundaries initialisation of external data arrays
@@ -326,5 +324,5 @@
 
       !                                     ! Ocean physics
-                            CALL     sbc_init   ! Forcings : surface module 
+                            CALL     sbc_init   ! Forcings : surface module
       !                                         ! Vertical physics
                             CALL     zdf_init      ! namelist read
@@ -335,5 +333,5 @@
       IF( lk_zdfkpp     )   CALL zdf_kpp_init      ! KPP closure scheme
       IF( lk_zdftmx     )   CALL zdf_tmx_init      ! tidal vertical mixing
-      IF( lk_zdfddm .AND. .NOT. lk_zdfkpp )   & 
+      IF( lk_zdfddm .AND. .NOT. lk_zdfkpp )   &
          &                  CALL zdf_ddm_init      ! double diffusive mixing
       !                                         ! Lateral physics
@@ -358,8 +356,8 @@
                             CALL dyn_zdf_init   ! vertical diffusion
                             CALL dyn_spg_init   ! surface pressure gradient
-                            
+
       !                                     ! Misc. options
       IF( nn_cla == 1   )   CALL cla_init       ! Cross Land Advection
-      
+
 #if defined key_top
       !                                     ! Passive tracers
@@ -377,8 +375,9 @@
                             CALL dia_obs_init            ! Initialize observational data
                             CALL dia_obs( nit000 - 1 )   ! Observation operator for restart
-      ENDIF      
+      ENDIF
       !                                     ! Assimilation increments
       IF( lk_asminc     )   CALL asm_inc_init   ! Initialize assimilation increments
       IF(lwp) WRITE(numout,*) 'Euler time step switch is ', neuler
+                            CALL tam_trj_init ! Trajectory handling
       !
    END SUBROUTINE nemo_init
@@ -389,5 +388,5 @@
       !!                     ***  ROUTINE nemo_ctl  ***
       !!
-      !! ** Purpose :   control print setting 
+      !! ** Purpose :   control print setting
       !!
       !! ** Method  : - print namctl information and check some consistencies
@@ -436,5 +435,5 @@
          !                              ! indices used for the SUM control
          IF( nictls+nictle+njctls+njctle == 0 )   THEN    ! print control done over the default area
-            lsp_area = .FALSE.                        
+            lsp_area = .FALSE.
          ELSE                                             ! print control done over a specific  area
             lsp_area = .TRUE.
@@ -458,5 +457,5 @@
       ENDIF
       !
-      IF( nbench == 1 ) THEN              ! Benchmark 
+      IF( nbench == 1 ) THEN              ! Benchmark
          SELECT CASE ( cp_cfg )
          CASE ( 'gyre' )   ;   CALL ctl_warn( ' The Benchmark is activated ' )
@@ -521,5 +520,5 @@
       !!----------------------------------------------------------------------
       !
-      ierr =        oce_alloc       ()          ! ocean 
+      ierr =        oce_alloc       ()          ! ocean
       ierr = ierr + dia_wri_alloc   ()
       ierr = ierr + dom_oce_alloc   ()          ! ocean domain
@@ -541,5 +540,5 @@
       !!                 ***  ROUTINE nemo_partition  ***
       !!
-      !! ** Purpose :   
+      !! ** Purpose :
       !!
       !! ** Method  :
@@ -589,5 +588,5 @@
       !!
       !! ** Purpose :   return the prime factors of n.
-      !!                knfax factors are returned in array kfax which is of 
+      !!                knfax factors are returned in array kfax which is of
       !!                maximum dimension kmaxfax.
       !! ** Method  :
@@ -657,8 +656,8 @@
       !!=====================================================================
       !!----------------------------------------------------------------------
-      !! 
+      !!
       !! ** Purpose :   Initialization of the northern neighbours lists.
       !!----------------------------------------------------------------------
-      !!    1.0  ! 2011-10  (A. C. Coward, NOCS & J. Donners, PRACE) 
+      !!    1.0  ! 2011-10  (A. C. Coward, NOCS & J. Donners, PRACE)
       !!----------------------------------------------------------------------
 
@@ -742,5 +741,5 @@
       jtyp = 5
       lrankset = .FALSE.
-      znnbrs = narea 
+      znnbrs = narea
       CALL lbc_lnk( znnbrs, 'J', 1. ) ! first ice U-V point
 
@@ -755,5 +754,5 @@
       ENDIF
 
-      znnbrs = narea 
+      znnbrs = narea
       CALL lbc_lnk( znnbrs, 'K', 1. ) ! second ice U-V point
 
@@ -778,5 +777,5 @@
          END DO
          !
-         ! For northern row areas, set l_north_nogather so that all subsequent exchanges 
+         ! For northern row areas, set l_north_nogather so that all subsequent exchanges
          ! can use peer to peer communications at the north fold
          !
Index: /trunk/NEMOGCM/NEMO/OPA_SRC/step.F90
===================================================================
--- /trunk/NEMOGCM/NEMO/OPA_SRC/step.F90	(revision 3603)
+++ /trunk/NEMOGCM/NEMO/OPA_SRC/step.F90	(revision 3604)
@@ -29,5 +29,5 @@
    !!   stp             : OPA system time-stepping
    !!----------------------------------------------------------------------
-   USE step_oce         ! time stepping definition modules 
+   USE step_oce         ! time stepping definition modules
 #if defined key_top
    USE trcstp           ! passive tracer time-stepping      (trc_stp routine)
@@ -61,13 +61,13 @@
       !!----------------------------------------------------------------------
       !!                     ***  ROUTINE stp  ***
-      !!                      
+      !!
       !! ** Purpose : - Time stepping of OPA (momentum and active tracer eqs.)
       !!              - Time stepping of LIM (dynamic and thermodynamic eqs.)
       !!              - Tme stepping  of TRC (passive tracer eqs.)
-      !! 
-      !! ** Method  : -1- Update forcings and data  
-      !!              -2- Update ocean physics 
-      !!              -3- Compute the t and s trends 
-      !!              -4- Update t and s 
+      !!
+      !! ** Method  : -1- Update forcings and data
+      !!              -2- Update ocean physics
+      !!              -3- Compute the t and s trends
+      !!              -4- Update t and s
       !!              -5- Compute the momentum trends
       !!              -6- Update the horizontal velocity
@@ -85,6 +85,6 @@
 # if defined key_iomput
       IF( Agrif_Nbstepint() == 0 )   CALL iom_swap
-# endif   
-#endif   
+# endif
+#endif
                              indic = 0                ! reset to no error condition
       IF( kstp /= nit000 )   CALL day( kstp )         ! Calendar (day was already called at nit000 in day_init)
@@ -111,7 +111,7 @@
                          CALL bn2( tsn, rn2  )        ! now    Brunt-Vaisala frequency
       !
-      !  VERTICAL PHYSICS   
+      !  VERTICAL PHYSICS
                          CALL zdf_bfr( kstp )         ! bottom friction
-                         
+
       !                                               ! Vertical eddy viscosity and diffusivity coefficients
       IF( lk_zdfric  )   CALL zdf_ric( kstp )            ! Richardson number dependent Kz
@@ -133,5 +133,5 @@
       IF( lk_zdfddm .AND. .NOT. lk_zdfkpp )   &
          &               CALL zdf_ddm( kstp )         ! double diffusive mixing
-         
+
                          CALL zdf_mxl( kstp )         ! mixed layer depth
 
@@ -140,5 +140,5 @@
       IF( lrst_oce .AND. lk_zdfgls )   CALL gls_rst( kstp, 'WRITE' )
       !
-      !  LATERAL  PHYSICS 
+      !  LATERAL  PHYSICS
       !
       IF( lk_ldfslp ) THEN                            ! slope of lateral mixing
@@ -179,4 +179,7 @@
       !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
                              tsa(:,:,:,:) = 0.e0            ! set tracer trends to zero
+      ! Saving non-linear trajectory at restart state
+      ! May not be exact for sbc and zdf parameters
+      IF( ( ln_trjhand ) .AND. ( kstp == nit000 ) ) CALL tam_trj_wri( kstp - 1 )
 
       IF(  ln_asmiau .AND. &
@@ -201,5 +204,5 @@
          IF( ln_zps      )   CALL zps_hde( kstp, jpts, tsa, gtsu, gtsv,  &    ! zps: time filtered hor. derivative
             &                                          rhd, gru , grv  )      ! of t, s, rd at the last ocean level
-         
+
       ELSE                                                  ! centered hpg  (eos then time stepping)
                              CALL eos    ( tsn, rhd, rhop )      ! now in situ density for hpg computation
@@ -208,5 +211,5 @@
          IF( ln_zdfnpc   )   CALL tra_npc( kstp )                ! update after fields by non-penetrative convection
                              CALL tra_nxt( kstp )                ! tracer fields at next time step
-      ENDIF 
+      ENDIF
 
       !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
@@ -218,4 +221,5 @@
       IF(  ln_asmiau .AND. &
          & ln_dyninc       )   CALL dyn_asm_inc( kstp )     ! apply dynamics assimilation increment
+      IF( ln_bkgwri )          CALL asm_bkg_wri( kstp )     ! output background fields
       IF( ln_neptsimp )        CALL dyn_nept_cor( kstp )    ! subtract Neptune velocities (simplified)
                                CALL dyn_adv( kstp )         ! advection (vector or flux form)
@@ -227,5 +231,5 @@
 #endif
                                CALL dyn_hpg( kstp )         ! horizontal gradient of Hydrostatic pressure
-                               CALL dyn_bfr( kstp )         ! bottom friction   
+                               CALL dyn_bfr( kstp )         ! bottom friction
                                CALL dyn_zdf( kstp )         ! vertical diffusion
                                CALL dyn_spg( kstp, indic )  ! surface pressure gradient
@@ -252,10 +256,16 @@
       ! Trends                              (ua, va, tsa used as workspace)
       !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-      IF( nstop == 0 ) THEN                         
-         IF( lk_trddyn     )   CALL trd_dwr( kstp )         ! trends: dynamics 
+      IF( nstop == 0 ) THEN
+         IF( lk_trddyn     )   CALL trd_dwr( kstp )         ! trends: dynamics
          IF( lk_trdtra     )   CALL trd_twr( kstp )         ! trends: active tracers
-         IF( lk_trdmld     )   CALL trd_mld( kstp )         ! trends: Mixed-layer 
+         IF( lk_trdmld     )   CALL trd_mld( kstp )         ! trends: Mixed-layer
          IF( lk_trdvor     )   CALL trd_vor( kstp )         ! trends: vorticity budget
       ENDIF
+
+      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+      ! Trajectory for TAM
+      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
+      IF( ln_trjhand ) CALL tam_trj_wri( kstp )          ! Output trajectory fields
 
       !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Index: /trunk/NEMOGCM/NEMO/OPA_SRC/step_oce.F90
===================================================================
--- /trunk/NEMOGCM/NEMO/OPA_SRC/step_oce.F90	(revision 3603)
+++ /trunk/NEMOGCM/NEMO/OPA_SRC/step_oce.F90	(revision 3604)
@@ -7,5 +7,5 @@
    !!----------------------------------------------------------------------
    USE oce              ! ocean dynamics and tracers variables
-   USE dom_oce          ! ocean space and time domain variables 
+   USE dom_oce          ! ocean space and time domain variables
    USE zdf_oce          ! ocean vertical physics variables
    USE ldftra_oce       ! ocean tracer   - trends
@@ -79,5 +79,5 @@
    USE trdmld_rst       ! restart for mixed-layer trends
    USE trdmod_oce       ! ocean momentum/tracers trends
-   USE trdmod           ! momentum/tracers trends   
+   USE trdmod           ! momentum/tracers trends
    USE trdvor           ! vorticity budget                 (trd_vor routine)
    USE diaptr           ! poleward transports              (dia_ptr routine)
@@ -93,5 +93,5 @@
    USE asminc           ! assimilation increments      (tra_asm_inc routine)
    !                                                   (dyn_asm_inc routine)
-
+   USE asmbkg
    USE stpctl           ! time stepping control            (stp_ctl routine)
    USE restart          ! ocean restart                    (rst_wri routine)
@@ -100,5 +100,6 @@
    USE diaobs           ! Observation operator
 
-   USE timing           ! Timing            
+   USE timing           ! Timing
+   USE tamtrj           ! Needed by TAM
 
 #if defined key_agrif
