Index: /branches/UKMO/AMM15_v3_6_STABLE_package_collate_sit/NEMOGCM/NEMO/OPA_SRC/ASM/asminc.F90
===================================================================
--- /branches/UKMO/AMM15_v3_6_STABLE_package_collate_sit/NEMOGCM/NEMO/OPA_SRC/ASM/asminc.F90	(revision 12606)
+++ /branches/UKMO/AMM15_v3_6_STABLE_package_collate_sit/NEMOGCM/NEMO/OPA_SRC/ASM/asminc.F90	(revision 12607)
@@ -21,5 +21,6 @@
    !!   dyn_asm_inc    : Apply the dynamic (u and v) increments
    !!   ssh_asm_inc    : Apply the SSH increment
-   !!   seaice_asm_inc : Apply the seaice increment
+   !!   seaice_asm_inc : Apply the sea ice concentration increment
+   !!   sit_asm_inc    : Apply the sea ice thickness increment
    !!----------------------------------------------------------------------
    USE wrk_nemo         ! Memory Allocation
@@ -62,5 +63,6 @@
    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
+   PUBLIC   seaice_asm_inc !: Apply the seaice concentration increment
+   PUBLIC   sit_asm_inc    !: Apply the seaice thickness increment
    PUBLIC   bgc_asm_inc    !: Apply the biogeochemistry increments
 
@@ -77,5 +79,6 @@
    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             !: No sea ice concentration increment
+   LOGICAL, PUBLIC :: ln_seaiceinc = .FALSE.   !: No sea ice concentration increment
+   LOGICAL, PUBLIC :: ln_sitinc = .FALSE.      !: No sea ice thickness increment
    LOGICAL, PUBLIC :: lk_bgcinc = .FALSE.      !: No biogeochemistry increments
    LOGICAL, PUBLIC :: ln_salfix = .FALSE.      !: Apply minimum salinity check
@@ -189,9 +192,12 @@
       ln_dyninc = .FALSE.
       ln_sshinc = .FALSE.
-      ln_seaiceinc = .FALSE.
       ln_asmdin = .FALSE.
       ln_asmiau = .TRUE.
       ln_salfix = .FALSE.
+
+      ln_seaiceinc = .FALSE.
+      ln_sitinc = .FALSE.
       ln_temnofreeze = .FALSE.
+
       salfixmin = -9999
       nitbkg    = 0
@@ -223,28 +229,7 @@
          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 applying SIC increments               ln_seaiceinc = ', ln_seaiceinc
+         WRITE(numout,*) '      Logical switch for applying SIT increments               ln_sitinc = ', ln_sitinc
          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 phytoplankton balancing             ln_phytobal = ', ln_phytobal
-         WRITE(numout,*) '      Logical switch for applying slchltot increments     ln_slchltotinc = ', ln_slchltotinc
-         WRITE(numout,*) '      Logical switch for applying slchldia increments     ln_slchldiainc = ', ln_slchldiainc
-         WRITE(numout,*) '      Logical switch for applying slchlnon increments     ln_slchlnoninc = ', ln_slchlnoninc
-         WRITE(numout,*) '      Logical switch for applying slchlnan increments     ln_slchlnaninc = ', ln_slchlnaninc
-         WRITE(numout,*) '      Logical switch for applying slchlpic increments     ln_slchlpicinc = ', ln_slchlpicinc
-         WRITE(numout,*) '      Logical switch for applying slchldin increments     ln_slchldininc = ', ln_slchldininc
-         WRITE(numout,*) '      Logical switch for applying schltot increments       ln_schltotinc = ', ln_schltotinc
-         WRITE(numout,*) '      Logical switch for applying slphytot increments     ln_slphytotinc = ', ln_slphytotinc
-         WRITE(numout,*) '      Logical switch for applying slphydia increments     ln_slphydiainc = ', ln_slphydiainc
-         WRITE(numout,*) '      Logical switch for applying slphynon increments     ln_slphynoninc = ', ln_slphynoninc
-         WRITE(numout,*) '      Logical switch for applying spco2 increments           ln_spco2inc = ', ln_spco2inc
-         WRITE(numout,*) '      Logical switch for applying sfco2 increments           ln_sfco2inc = ', ln_sfco2inc
-         WRITE(numout,*) '      Logical switch for applying plchltot increments     ln_plchltotinc = ', ln_plchltotinc
-         WRITE(numout,*) '      Logical switch for applying pchltot increments       ln_pchltotinc = ', ln_pchltotinc
-         WRITE(numout,*) '      Logical switch for applying pno3 increments             ln_pno3inc = ', ln_pno3inc
-         WRITE(numout,*) '      Logical switch for applying psi4 increments             ln_psi4inc = ', ln_psi4inc
-         WRITE(numout,*) '      Logical switch for applying ppo4 increments             ln_ppo4inc = ', ln_ppo4inc
-         WRITE(numout,*) '      Logical switch for applying pdic increments             ln_pdicinc = ', ln_pdicinc
-         WRITE(numout,*) '      Logical switch for applying palk increments             ln_palkinc = ', ln_palkinc
-         WRITE(numout,*) '      Logical switch for applying pph increments               ln_pphinc = ', ln_pphinc
-         WRITE(numout,*) '      Logical switch for applying po2 increments               ln_po2inc = ', ln_po2inc
          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
@@ -259,4 +244,26 @@
          WRITE(numout,*) '      Choice of MLD for BGC assimilation                  mld_choice_bgc = ', mld_choice_bgc
          WRITE(numout,*) '      Maximum absolute chlorophyll increment (<=0 = off)    rn_maxchlinc = ', rn_maxchlinc
+         WRITE(numout,*) '      Logical switch for phytoplankton balancing               ln_phytobal = ', ln_phytobal
+         WRITE(numout,*) '      Logical switch for applying slchltot increments          ln_slchltotinc = ', ln_slchltotinc
+         WRITE(numout,*) '      Logical switch for applying slchldia increments          ln_slchldiainc = ', ln_slchldiainc
+         WRITE(numout,*) '      Logical switch for applying slchlnon increments          ln_slchlnoninc = ', ln_slchlnoninc
+         WRITE(numout,*) '      Logical switch for applying slchlnan increments          ln_slchlnaninc = ', ln_slchlnaninc
+         WRITE(numout,*) '      Logical switch for applying slchlpic increments          ln_slchlpicinc = ', ln_slchlpicinc
+         WRITE(numout,*) '      Logical switch for applying slchldin increments          ln_slchldininc = ', ln_slchldininc
+         WRITE(numout,*) '      Logical switch for applying schltot increments           ln_schltotinc = ', ln_schltotinc
+         WRITE(numout,*) '      Logical switch for applying slphytot increments          ln_slphytotinc = ', ln_slphytotinc
+         WRITE(numout,*) '      Logical switch for applying slphydia increments          ln_slphydiainc = ', ln_slphydiainc
+         WRITE(numout,*) '      Logical switch for applying slphynon increments          ln_slphynoninc = ', ln_slphynoninc
+         WRITE(numout,*) '      Logical switch for applying spco2 increments             ln_spco2inc = ', ln_spco2inc
+         WRITE(numout,*) '      Logical switch for applying sfco2 increments             ln_sfco2inc = ', ln_sfco2inc
+         WRITE(numout,*) '      Logical switch for applying plchltot increments          ln_plchltotinc = ', ln_plchltotinc
+         WRITE(numout,*) '      Logical switch for applying pchltot increments           ln_pchltotinc = ', ln_pchltotinc
+         WRITE(numout,*) '      Logical switch for applying pno3 increments              ln_pno3inc = ', ln_pno3inc
+         WRITE(numout,*) '      Logical switch for applying psi4 increments              ln_psi4inc = ', ln_psi4inc
+         WRITE(numout,*) '      Logical switch for applying ppo4 increments              ln_ppo4inc = ', ln_ppo4inc
+         WRITE(numout,*) '      Logical switch for applying pdic increments              ln_pdicinc = ', ln_pdicinc
+         WRITE(numout,*) '      Logical switch for applying palk increments              ln_palkinc = ', ln_palkinc
+         WRITE(numout,*) '      Logical switch for applying pph increments               ln_pphinc = ', ln_pphinc
+         WRITE(numout,*) '      Logical switch for applying po2 increments               ln_po2inc = ', ln_po2inc
       ENDIF
 
@@ -320,7 +327,7 @@
       IF (      ( ( .NOT. ln_asmdin ).AND.( .NOT. ln_asmiau ) ) &
          & .AND.( ( ln_trainc ).OR.( ln_dyninc ).OR.( ln_sshinc ).OR.( ln_seaiceinc ).OR. &
-         &        ( lk_bgcinc ) )) &
+         &        ( ln_sitinc ).OR.( lk_bgcinc ) )) &
          & CALL ctl_stop( ' One or more of ln_trainc, ln_dyninc, ln_sshinc, ln_seaiceinc,', &
-         &                ' ln_(bgc-variable)inc is set to .true.', &
+         &                ' ln_sitinc and ln_(bgc-variable)inc is set to .true.', &
          &                ' but ln_asmdin and ln_asmiau are both set to .false. :', &
          &                ' Inconsistent options')
@@ -331,7 +338,7 @@
 
       IF ( ( .NOT. ln_trainc ).AND.( .NOT. ln_dyninc ).AND.( .NOT. ln_sshinc ).AND.( .NOT. ln_seaiceinc ) &
-         & .AND.( .NOT. lk_bgcinc ) )  &
+         & .AND.( .NOT. ln_sitinc ).AND.( .NOT. lk_bgcinc ) )  &
          & CALL ctl_warn( ' ln_trainc, ln_dyninc, ln_sshinc, ln_seaiceinc,', &
-         &                ' ln_(bgc-variable)inc are set to .false. :', &
+         &                ' ln_sitinc and ln_(bgc-variable)inc are set to .false. :', &
          &                ' The assimilation increments are not applied')
 
@@ -458,4 +465,8 @@
          seaice_bkginc(:,:) = 0.0
       ENDIF
+      IF ( ln_sitinc ) THEN 
+         ALLOCATE( sit_bkginc(jpi,jpj))
+         sit_bkginc(:,:) = 0.0
+      ENDIF
 #if defined key_asminc
       ALLOCATE( ssh_iau(jpi,jpj)      )
@@ -463,5 +474,5 @@
 #endif
       IF ( ( ln_trainc ).OR.( ln_dyninc ).OR.( ln_sshinc ).OR.( ln_seaiceinc ) &
-         &  .OR.( lk_bgcinc ) ) THEN
+         &  .OR.( ln_sitinc ).OR.( lk_bgcinc ) ) THEN
 
          !--------------------------------------------------------------------
@@ -953,4 +964,5 @@
       ! Perhaps the following call should be in step
       IF   ( ln_seaiceinc  )   CALL seaice_asm_inc ( kt )   ! apply sea ice concentration increment
+      IF   ( ln_sitinc  )      CALL sit_asm_inc ( kt )      ! apply sea ice thickness increment
       !
    END SUBROUTINE tra_asm_inc
@@ -1114,4 +1126,92 @@
    END SUBROUTINE ssh_asm_inc
 
+   SUBROUTINE sit_asm_inc( kt, kindic )
+      !!----------------------------------------------------------------------
+      !!                    ***  ROUTINE sit_asm_inc  ***
+      !!          
+      !! ** Purpose : Apply the sea ice thickness assimilation increment.
+      !!
+      !! ** Method  : Direct initialization or Incremental Analysis Updating.
+      !!
+      !! ** Action  : 
+      !!
+      !!----------------------------------------------------------------------
+      IMPLICIT NONE
+      !
+      INTEGER, INTENT(in)           ::   kt   ! Current time step
+      INTEGER, INTENT(in), OPTIONAL ::   kindic   ! flag for disabling the deallocation
+      !
+      INTEGER  ::   it
+      REAL(wp) ::   zincwgt   ! IAU weight for current time step
+      !!----------------------------------------------------------------------
+
+      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)
+            ! EF: Actually CICE is expecting a tendency so is divided by rdt below
+
+            IF(lwp) THEN
+               WRITE(numout,*) 
+               WRITE(numout,*) 'sit_asm_inc : sea ice thick IAU at time step = ', &
+                  &  kt,' with IAU weight = ', wgtiau(it)
+               WRITE(numout,*) '~~~~~~~~~~~~'
+            ENDIF
+
+#if defined key_cice && defined key_asminc
+            ! Sea-ice thickness : CICE case. Pass ice thickness increment tendency into CICE
+            ndsit_da(:,:) = sit_bkginc(:,:) * zincwgt / rdt
+#endif
+
+            IF ( kt == nitiaufin_r ) THEN
+               DEALLOCATE( sit_bkginc )
+            ENDIF
+
+         ELSE
+
+#if defined key_cice && defined key_asminc
+            ! Sea-ice thickness : CICE case. Zero ice increment tendency into CICE
+            ndsit_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_cice && defined key_asminc
+            ! Sea-ice thickness : CICE case. Pass ice thickness increment tendency into CICE
+           ndsit_da(:,:) = sit_bkginc(:,:) / rdt
+#endif
+           IF ( .NOT. PRESENT(kindic) ) THEN
+              DEALLOCATE( sit_bkginc )
+           END IF
+
+         ELSE
+
+#if defined key_cice && defined key_asminc
+            ! Sea-ice thicnkness : CICE case. Zero ice thickness increment tendency into CICE 
+            ndsit_da(:,:) = 0.0_wp
+#endif
+         
+         ENDIF
+
+      ENDIF
+
+   END SUBROUTINE sit_asm_inc
 
    SUBROUTINE seaice_asm_inc( kt, kindic )
