Index: branches/DEV_r1837_mass_heat_salt_fluxes/NEMO/LIM_SRC_2/ice_2.F90
===================================================================
--- branches/DEV_r1837_mass_heat_salt_fluxes/NEMO/LIM_SRC_2/ice_2.F90	(revision 1850)
+++ branches/DEV_r1837_mass_heat_salt_fluxes/NEMO/LIM_SRC_2/ice_2.F90	(revision 1855)
@@ -4,5 +4,6 @@
    !! Sea Ice physics:  diagnostics variables of ice defined in memory
    !!=====================================================================
-   !! History :  2.0  !  03-08  (C. Ethe)  F90: Free form and module
+   !! History :  2.0  !  2003-08 (C. Ethe)  F90: Free form and module
+   !!             -   !  2010-05 (G. Madec) suppression of thd_ice_2
    !!----------------------------------------------------------------------
 #if defined key_lim2
@@ -10,9 +11,4 @@
    !!   'key_lim2' :                                  LIM 2.0 sea-ice model
    !!----------------------------------------------------------------------
-   !!  LIM 2.0, UCL-LOCEAN-IPSL (2006)
-   !! $Id$
-   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
-   !!----------------------------------------------------------------------
-   !! * Modules used
    USE par_ice_2          ! LIM sea-ice parameters
 
@@ -20,72 +16,126 @@
    PRIVATE
 
-   !!* Share parameters namelist (namicerun read in iceini) *
-   CHARACTER(len=32)     , PUBLIC ::   cn_icerst_in  = "restart_ice_in"   !: suffix of ice restart name (input)
-   CHARACTER(len=32)     , PUBLIC ::   cn_icerst_out = "restart_ice"      !: suffix of ice restart name (output)
-   LOGICAL               , PUBLIC ::   ln_limdyn     = .TRUE.             !: flag for ice dynamics (T) or not (F)
-   LOGICAL               , PUBLIC ::   ln_limdmp     = .FALSE.            !: Ice damping
-   REAL(wp)              , PUBLIC ::   hsndif        = 0.e0               !: computation of temp. in snow (0) or not (9999)
-   REAL(wp)              , PUBLIC ::   hicdif        = 0.e0               !: computation of temp. in ice (0) or not (9999)
-   REAL(wp), DIMENSION(2), PUBLIC ::   acrit = (/ 1.e-06 , 1.e-06 /)      !: minimum fraction for leads in 
-   !                                                                      !: north and south hemisphere
-   !!* ice-dynamic namelist (namicedyn) *
-   INTEGER , PUBLIC ::   nbiter = 1         !: number of sub-time steps for relaxation
-   INTEGER , PUBLIC ::   nbitdr = 250       !: maximum number of iterations for relaxation
-   REAL(wp), PUBLIC ::   rdt_ice            !: ice time step
-   REAL(wp), PUBLIC ::   epsd   = 1.0e-20   !: tolerance parameter for dynamic
-   REAL(wp), PUBLIC ::   alpha  = 0.5       !: coefficient for semi-implicit coriolis
-   REAL(wp), PUBLIC ::   dm     = 0.6e+03   !: diffusion constant for dynamics
-   REAL(wp), PUBLIC ::   om     = 0.5       !: relaxation constant
-   REAL(wp), PUBLIC ::   resl   = 5.0e-05   !: maximum value for the residual of relaxation
-   REAL(wp), PUBLIC ::   cw     = 5.0e-03   !: drag coefficient for oceanic stress
-   REAL(wp), PUBLIC ::   angvg  = 0.e0      !: turning angle for oceanic stress
-   REAL(wp), PUBLIC ::   pstar  = 1.0e+04   !: first bulk-rheology parameter
-   REAL(wp), PUBLIC ::   c_rhg  = 20.e0     !: second bulk-rhelogy parameter
-   REAL(wp), PUBLIC ::   etamn  = 0.e+07    !: minimun value for viscosity
-   REAL(wp), PUBLIC ::   creepl = 2.e-08    !: creep limit
-   REAL(wp), PUBLIC ::   ecc    = 2.e0      !: eccentricity of the elliptical yield curve
-   REAL(wp), PUBLIC ::   ahi0   = 350.e0    !: sea-ice hor. eddy diffusivity coeff. (m2/s)
+   !---------------------------------------------------!
+   !                 Sea-Ice namelist                  !
+   !---------------------------------------------------!
+   !                                                                !!! **  Namelist namicerun  **
+   CHARACTER(len=32), PUBLIC ::   cn_icerst_in  = "restart_ice_in"   !: suffix of ice restart name (input)
+   CHARACTER(len=32), PUBLIC ::   cn_icerst_out = "restart_ice"      !: suffix of ice restart name (output)
+   LOGICAL          , PUBLIC ::   ln_limdyn     = .TRUE.             !: flag for ice dynamics (T) or not (F)
+   LOGICAL          , PUBLIC ::   ln_limdmp     = .FALSE.            !: Ice damping
+   REAL(wp)         , PUBLIC ::   hsndif        = 0.e0               !: computation of temp. in snow (0) or not (9999)
+   REAL(wp)         , PUBLIC ::   hicdif        = 0.e0               !: computation of temp. in ice (0) or not (9999)
+   REAL(wp)         , PUBLIC ::   acrit(2) = (/ 1.e-06 , 1.e-06 /)   !: min lead fraction in north and south hemispheres
+   
+   !                                         !!! **  Namelist  namicedyn  **
+   INTEGER , PUBLIC ::   nbiter =   1         !: number of sub-time steps for relaxation
+   INTEGER , PUBLIC ::   nbitdr = 250         !: maximum number of iterations for relaxation
+   REAL(wp), PUBLIC ::   rdt_ice              !: ice time step
+   REAL(wp), PUBLIC ::   epsd   =   1.0e-20   !: tolerance parameter for dynamic
+   REAL(wp), PUBLIC ::   alpha  =   0.5       !: coefficient for semi-implicit coriolis
+   REAL(wp), PUBLIC ::   dm     =   0.6e+03   !: diffusion constant for dynamics
+   REAL(wp), PUBLIC ::   om     =   0.5       !: relaxation constant
+   REAL(wp), PUBLIC ::   resl   =   5.0e-05   !: maximum value for the residual of relaxation
+   REAL(wp), PUBLIC ::   cw     =   5.0e-03   !: drag coefficient for oceanic stress
+   REAL(wp), PUBLIC ::   angvg  =   0.e0      !: turning angle for oceanic stress
+   REAL(wp), PUBLIC ::   pstar  =   1.0e+04   !: first bulk-rheology parameter
+   REAL(wp), PUBLIC ::   c_rhg  =  20.e0      !: second bulk-rhelogy parameter
+   REAL(wp), PUBLIC ::   etamn  =   0.e+07    !: minimun value for viscosity
+   REAL(wp), PUBLIC ::   creepl =   2.e-08    !: creep limit
+   REAL(wp), PUBLIC ::   ecc    =   2.e0      !: eccentricity of the elliptical yield curve
+   REAL(wp), PUBLIC ::   ahi0   = 350.e0      !: sea-ice hor. eddy diffusivity coeff. (m2/s)
 
-   REAL(wp), PUBLIC ::   usecc2             !:  = 1.0 / ( ecc * ecc )
-   REAL(wp), PUBLIC ::   rhoco              !: = rau0 * cw
-   REAL(wp), PUBLIC ::   sangvg, cangvg     !: sin and cos of the turning angle for ocean stress
-   REAL(wp), PUBLIC ::   pstarh             !: pstar / 2.0
+   !                                              !!! ** Namelist  namicethd  **
+   REAL(wp), PUBLIC ::   hmelt      = -0.15        !: maximum melting at the bottom
+   REAL(wp), PUBLIC ::   hicmin     =  0.2         !: ice th. corr. to max. ener. in brine pocket
+   REAL(wp), PUBLIC ::   hiclim     =  0.05        !: minimum ice thickness
+   REAL(wp), PUBLIC ::   amax       =  0.999       !: maximum lead fraction
+   REAL(wp), PUBLIC ::   swiqst     =  1.0         !: energy stored in brine pocket (1) or not (0)
+   REAL(wp), PUBLIC ::   sbeta      =  1.0         !: numerical scheme for diffusion in ice 
+   REAL(wp), PUBLIC ::   parlat     =  0.0         !: percent. of energy used for lateral ablation
+   REAL(wp), PUBLIC ::   hakspl     =  0.5         !: slope of distr. for Hakkinen-Mellro's lat. melt
+   REAL(wp), PUBLIC ::   hibspl     =  0.5         !: slope of distribution for Hibler's lat. melt
+   REAL(wp), PUBLIC ::   exld       =  2.0         !: exponent for leads-closure rate
+   REAL(wp), PUBLIC ::   hakdif     =  1.0         !: coefficient for diffusions of ice and snow
+   REAL(wp), PUBLIC ::   thth       =  0.2         !: thick. for comp. of eq. thermal conduct
+   REAL(wp), PUBLIC ::   hnzst      =  0.1         !: thick. of the surf. layer in temp. comp.
+   REAL(wp), PUBLIC ::   parsub     =  1.0         !: switch for snow sublimation or not
+   REAL(wp), PUBLIC ::   alphs      =  1.0         !: coef. for snow density when snow-ice formation
+   REAL(wp), PUBLIC ::   hiccrit(2) = (/0.3,0.3/)  !: ice th. for lateral accretion in the NH (SH) (m)
+
+   !---------------------------------------------------!
+   !                Sea-Ice variables                  !
+   !---------------------------------------------------!
+
+   REAL(wp), PUBLIC ::   usecc2           !:  = 1.0 / ( ecc * ecc )
+   REAL(wp), PUBLIC ::   rhoco            !: = rau0 * cw
+   REAL(wp), PUBLIC ::   sangvg, cangvg   !: sin and cos of the turning angle for ocean stress
+   REAL(wp), PUBLIC ::   pstarh           !: pstar / 2.0
+   REAL(wp), PUBLIC ::   uscomi           !: inverse of minimum lead fraction      !!gm to be suppress
+   REAL(wp), PUBLIC ::   cnscg            !: ratio  rcpsn/rcpic                    !!gm to be suppress
 
    REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   ahiu , ahiv   !: hor. diffusivity coeff. at ocean U- and V-points (m2/s)
    REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   pahu , pahv   !: ice hor. eddy diffusivity coef. at ocean U- and V-points
    REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   hsnm , hicm   !: mean snow and ice thicknesses
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   ust2s                 !: friction velocity
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   ust2s         !: friction velocity
 
-   !!* diagnostic quantities
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   sist          !: Sea-Ice Surface Temperature (Kelvin)
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   tfu           !: Freezing/Melting point temperature of sea water at SSS
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   hicif         !: Ice thickness
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   hsnif         !: Snow thickness
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   hicifp        !: Ice production/melting
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   frld          !: Leads fraction = 1-a/totalarea
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   phicif        !: ice thickness  at previous time 
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   pfrld         !: Leads fraction at previous time  
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   qstoif        !: Energy stored in the brine pockets
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   fbif          !: Heat flux at the ice base
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   rdmsnif       !: Variation of snow mass
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   rdmicif       !: Variation of ice mass
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   qldif         !: heat balance of the lead (or of the open ocean)
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   qcmif         !: Energy needed to bring the ocean surface layer until its freezing 
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   fdtcn         !: net downward heat flux from the ice to the ocean
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   qdtcn         !: energy from the ice to the ocean point (at a factor 2)
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   thcm          !: part of the solar energy used in the lead heat budget
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   fstric        !: Solar flux transmitted trough the ice
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   ffltbif       !: Array linked with the max heat contained in brine pockets (?)
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   fscmbq        !: Linked with the solar flux below the ice (?)
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   fsbbq         !: Also linked with the solar flux below the ice (?)
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   qfvbq         !: Array used to store energy in case of toral lateral ablation (?)
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   dmgwi         !: Variation of the mass of snow ice
+   INTEGER , PUBLIC, DIMENSION(jpij) ::   npb         !: number of points where computations has to be done
+   INTEGER , PUBLIC, DIMENSION(jpij) ::   npac        !: correspondance between the points
 
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   u_ice, v_ice   !: two components of the ice   velocity at I-point (m/s)
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   u_oce, v_oce   !: two components of the ocean velocity at I-point (m/s)
+   !                                                         !!* sea-ice variables *
+   REAL(wp), PUBLIC ::   sist   (jpi,jpj), sist_1d   (jpij)   !: Sea-Ice Surface Temperature (Kelvin)
+   REAL(wp), PUBLIC ::   tfu    (jpi,jpj), tfu_1d    (jpij)   !: Freezing/Melting point temperature of sea water at SSS
+   REAL(wp), PUBLIC ::   hicif  (jpi,jpj), h_ice_1d  (jpij)   !: ice thickness
+   REAL(wp), PUBLIC ::   phicif (jpi,jpj)                     !: ice thickness  at previous time 
+   REAL(wp), PUBLIC ::   hsnif  (jpi,jpj), h_snow_1d (jpij)   !: Snow thickness
+   REAL(wp), PUBLIC ::   hicifp (jpi,jpj)                     !: Ice production/melting
+   REAL(wp), PUBLIC ::   frld   (jpi,jpj), frld_1d   (jpij)   !: Leads fraction = 1-a/totalarea
+   REAL(wp), PUBLIC ::   pfrld  (jpi,jpj)                     !: Leads fraction at previous time  
+   REAL(wp), PUBLIC ::   qstoif (jpi,jpj), qstbif_1d (jpij)   !: Energy stored in the brine pockets         !!gm 
+   REAL(wp), PUBLIC ::   fbif   (jpi,jpj), fbif_1d   (jpij)   !: Heat flux at the ice base
+   REAL(wp), PUBLIC ::   rdmsnif(jpi,jpj), rdmsnif_1d(jpij)   !: Variation of snow mass
+   REAL(wp), PUBLIC ::   rdmicif(jpi,jpj), rdmicif_1d(jpij)   !: Variation of ice mass
+   REAL(wp), PUBLIC ::   qldif  (jpi,jpj), qldif_1d  (jpij)   !: heat balance of the lead (or of the open ocean)
+   REAL(wp), PUBLIC ::   qcmif  (jpi,jpj), qcmif_1d  (jpij)   !: Energy needed to freeze the ocean surface layer 
+   REAL(wp), PUBLIC ::   fdtcn  (jpi,jpj)                     !: net downward heat flux from the ice to the ocean
+   REAL(wp), PUBLIC ::   qdtcn  (jpi,jpj)                     !: energy from the ice to the ocean point (at a factor 2)
+   REAL(wp), PUBLIC ::   thcm   (jpi,jpj), thcm_1d   (jpij)   !: part of the solar energy used in the lead heat budget
+   REAL(wp), PUBLIC ::   fstric (jpi,jpj), fstric_1d (jpij)   !: Solar flux transmitted trough the ice
+   REAL(wp), PUBLIC ::   ffltbif(jpi,jpj), fltbif_1d (jpij)   !: Array linked with the max heat contained in brine pockets (?)
+   REAL(wp), PUBLIC ::   fscmbq (jpi,jpj), fscbq_1d  (jpij)   !: Linked with the solar flux below the ice (?)
+   REAL(wp), PUBLIC ::   fsbbq  (jpi,jpj)                     !: Also linked with the solar flux below the ice (?)
+   REAL(wp), PUBLIC ::   qfvbq  (jpi,jpj), qfvbq_1d  (jpij)   !: Array used to store energy in case of total lateral ablation (?)
+   REAL(wp), PUBLIC ::   dmgwi(jpi,jpj), dmgwi_1d(jpij)       !: Variation of the mass of snow ice
 
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jplayersp1) ::   tbif  !: Temperature inside the ice/snow layer
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   u_ice, v_ice     !: two components of the ice   velocity at I-point (m/s)
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   u_oce, v_oce     !: two components of the ocean velocity at I-point (m/s)
 
-   !!* moment used in the advection scheme
+   REAL(wp), PUBLIC ::   tbif(jpi,jpj,jplayersp1), tbif_1d(jpij,jplayersp1)  !: Temperature inside the ice+snow layer
+
+   ! Surface forcing transford into  1D field  (2D field defined in /OPA_SRC/SBC/sbc_ice.F90)
+   REAL(wp), PUBLIC, DIMENSION(jpij) ::   qns_ice_1d   !:   qns_ice   
+   REAL(wp), PUBLIC, DIMENSION(jpij) ::   qsr_ice_1d   !:   qsr_ice
+   REAL(wp), PUBLIC, DIMENSION(jpij) ::   qla_ice_1d   !:   qla_ice
+   REAL(wp), PUBLIC, DIMENSION(jpij) ::   dqla_ice_1d  !:   dqla_ice
+   REAL(wp), PUBLIC, DIMENSION(jpij) ::   dqns_ice_1d  !:   dqns_ice
+   REAL(wp), PUBLIC, DIMENSION(jpij) ::   fr1_i0_1d    !:   fr1_i0
+   REAL(wp), PUBLIC, DIMENSION(jpij) ::   fr2_i0_1d    !:   fr2_i0
+
+   ! Surface forcing transformed into 1D field  (2D field defined in /OPA_SRC/SBC/sbc_oce.F90)
+   REAL(wp), PUBLIC, DIMENSION(jpij) ::   sprecip_1d   !:   sprecip
+   
+   ! local variable  transformed into 1D field  (2D field defined in /LIM_SRC_2/limthd_2.F90)
+   REAL(wp), PUBLIC, DIMENSION(jpij) ::   qlbbq_1d     !:   zqlbsbq
+   REAL(wp), PUBLIC, DIMENSION(jpij) ::   dvsbq_1d     !:   zdvosif
+   REAL(wp), PUBLIC, DIMENSION(jpij) ::   dvbbq_1d     !:   zdvobif
+   REAL(wp), PUBLIC, DIMENSION(jpij) ::   dvlbq_1d     !:   zdvolif
+   REAL(wp), PUBLIC, DIMENSION(jpij) ::   dvnbq_1d     !:   zdvonif
+   
+   
+   REAL(wp), PUBLIC, DIMENSION(jpij) ::   rdvomif_1d    !:   rdvomif       <<<== !gm should be suppressed !
+
+   !---------------------------------------------------!
+   !   Prather' advection scheme : 1st & 2nd moments   !
+   !---------------------------------------------------!
    REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   sxice, syice, sxxice, syyice, sxyice   !: for ice  volume
    REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   sxsn,  sysn,  sxxsn,  syysn,  sxysn    !: for snow volume
@@ -102,4 +152,8 @@
 #endif
 
+   !!-------- -------------------------------------------------------------
+   !! NEMO/LIM 3.3,  UCL-LOCEAN-IPSL (2010) 
+   !! $Id$
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
    !!======================================================================
 END MODULE ice_2
