Index: /branches/2016/dev_r6859_LIM3_meltponds/NEMOGCM/NEMO/LIM_SRC_3/limistate.F90
===================================================================
--- /branches/2016/dev_r6859_LIM3_meltponds/NEMOGCM/NEMO/LIM_SRC_3/limistate.F90	(revision 8084)
+++ /branches/2016/dev_r6859_LIM3_meltponds/NEMOGCM/NEMO/LIM_SRC_3/limistate.F90	(revision 8085)
@@ -87,6 +87,6 @@
       INTEGER    :: ji, jj, jk, jl             ! dummy loop indices
       REAL(wp)   :: ztmelts, zdh
-      INTEGER    :: i_hemis, i_fill, jl0  
-      REAL(wp)   :: zarg, zV, zconv, zdv 
+      INTEGER    :: i_hemis, i_fill, jl0
+      REAL(wp)   :: zarg, zV, zconv, zdv, z1_jpl 
       REAL(wp), POINTER, DIMENSION(:,:)   :: zswitch    ! ice indicator
       REAL(wp), POINTER, DIMENSION(:,:)   :: zht_i_ini, zat_i_ini, zvt_i_ini            !data from namelist or nc file
@@ -378,4 +378,33 @@
          tn_ice (:,:,:) = t_su (:,:,:)
 
+         ! MV MP 2016
+         ! Melt pond volume and fraction
+         
+         z1_jpl =  1. / REAL(jpl)
+   
+         SELECT CASE ( nn_pnd_scheme )
+   
+            CASE ( 0 )           !--- Prescribed melt ponds
+   
+               DO jl = 1, jpl
+   
+                  a_ip(:,:,jl) = rn_apnd * z1_jpl * zswitch(:,:)
+                  v_ip(:,:,jl) = 0.1 * zswitch(:,:) * a_ip(:,:,jl)
+   
+               END DO
+   
+            CASE ( 1, 2 )        !--- Prognostic melt ponds
+   
+               DO jl = 1, jpl
+   
+                  a_ip(:,:,jl) = 0.1 * zswitch(:,:)
+                  v_ip(:,:,jl) = 0.1 * zswitch(:,:) * a_ip(:,:,jl)
+   
+               END DO
+   
+         END SELECT
+   
+         ! END MV MP 2016
+
       ELSE ! if ln_limini=false
          a_i  (:,:,:) = 0._wp
@@ -401,4 +430,11 @@
          END DO
 
+         ! MV MP 2016
+         a_ip(:,:,:)      = 0._wp
+         v_ip(:,:,:)      = 0._wp
+         h_ip(:,:,:)      = 0._wp
+         a_ip_frac(:,:,:) = 0._wp
+         ! END MV MP 2016
+
       ENDIF ! ln_limini
       
@@ -408,43 +444,4 @@
       END DO
 
-      ! MV MP 2016
-
-      ! For now, we just assume that melt ponds are absent initially
-      ! We probably have to revise this and code it as for all other sea ice variables later on
-      !
-      !--------------------------------------------------------------------
-      ! X) Melt pond variables
-      !--------------------------------------------------------------------
-      !
-      !IF ( ln_pnd   ) THEN
-      SELECT CASE ( nn_pnd_scheme )
-
-         z1_jpl =  1 / REAL(jpl)
-
-         CASE ( 0 )           !--- Prescribed melt ponds
-
-            DO jl = 1, jpl
-
-               a_ip(:,:,jl) = rn_apnd * z1_jpl * zswitch(:,:)
-               h_ip(:,:,jl) = 0.1 * zswitch(:,:)
-
-            END DO
-
-         CASE ( 1, 2 )        !--- Prognostic melt ponds
-
-            DO jl = 1, jpl
-
-               a_ip(:,:,jl) = 0.1 * zswitch(:,:)
-               h_ip(:,:,jl) = 0.1 * zswitch(:,:)
-
-            END DO
-
-      END SELECT
-
-      v_ip(:,:,:)      = a_ip(:,:,:)  * h_i_p(:,:,:)
-      a_ip_frac(:,:,:) = a_ip(:,:,:) / a_i(:,:,:)
-
-      ! END MV MP 2016
-
       !--------------------------------------------------------------------
       ! 4) Global ice variables for output diagnostics                    | 
@@ -491,5 +488,5 @@
 
       ! MV MP 2016
-      IF ( nn_pnd_scheme > 1 ) THEN
+      IF ( nn_pnd_scheme >= 1 ) THEN
          sxap  (:,:,:) = 0._wp    ; sxvp  (:,:,:) = 0._wp 
          syap  (:,:,:) = 0._wp    ; syvp  (:,:,:) = 0._wp 
Index: /branches/2016/dev_r6859_LIM3_meltponds/NEMOGCM/NEMO/LIM_SRC_3/limitd_me.F90
===================================================================
--- /branches/2016/dev_r6859_LIM3_meltponds/NEMOGCM/NEMO/LIM_SRC_3/limitd_me.F90	(revision 8084)
+++ /branches/2016/dev_r6859_LIM3_meltponds/NEMOGCM/NEMO/LIM_SRC_3/limitd_me.F90	(revision 8085)
@@ -608,5 +608,5 @@
             esrdg (ij) = e_s  (ji,jj,1,jl1) * afrac(ij)
             !MV MP 2016
-            IF ( nn_pnd_scheme > 1 ) THEN
+            IF ( nn_pnd_scheme > 0 ) THEN
                vprdg(ij) = v_ip(ji,jj, jl1) * afrac(ij)
             ENDIF
@@ -620,5 +620,5 @@
             vsrft (ij) = v_s  (ji,jj,  jl1) * afrft(ij)
             !MV MP 2016
-            IF ( nn_pnd_scheme > 1 ) THEN
+            IF ( nn_pnd_scheme > 0 ) THEN
                vprft(ij) = v_ip(ji,jj,jl1) * afrft(ij)
             ENDIF
@@ -665,5 +665,5 @@
             !------------------------------------------            
             !  Place part of the melt pond volume into the ocean. 
-            IF ( ( nn_pnd_scheme > 0 ) .AND. ( ( nn_pnd_cpl == 1 ) .OR. ( nn_pnd_cpl == 3 ) ) )
+            IF ( ( nn_pnd_scheme > 0 ) .AND. ( ( nn_pnd_cpl == 1 ) .OR. ( nn_pnd_cpl == 3 ) ) ) THEN
                wfx_pnd(ji,jj) = wfx_pnd(ji,jj) + ( rhofw * vprdg(ij) * ( 1._wp - rn_fpondrdg )   & 
                &                                 + rhofw * vprft(ij) * ( 1._wp - rn_fpondrft ) ) * r1_rdtice  ! fresh water source for ocean
Index: /branches/2016/dev_r6859_LIM3_meltponds/NEMOGCM/NEMO/LIM_SRC_3/limmp.F90
===================================================================
--- /branches/2016/dev_r6859_LIM3_meltponds/NEMOGCM/NEMO/LIM_SRC_3/limmp.F90	(revision 8084)
+++ /branches/2016/dev_r6859_LIM3_meltponds/NEMOGCM/NEMO/LIM_SRC_3/limmp.F90	(revision 8085)
@@ -101,6 +101,14 @@
          WRITE(numout,*)'    Activate melt ponds                                         ln_pnd        = ', ln_pnd
          WRITE(numout,*)'    Type of melt pond scheme =0 presc, =1 empirical = 2 topo    nn_pnd_scheme = ', nn_pnd_scheme
-         WRITE(numout,*)'    Type of melt pond coupling =0 pass., =1 full, =2 rad, 3=fw  nn_pnd_cpl    = ', nn_pnd_cp
+         WRITE(numout,*)'    Type of melt pond coupling =0 pass., =1 full, =2 rad, 3=fw  nn_pnd_cpl    = ', nn_pnd_cpl
          WRITE(numout,*)'    Prescribed pond fraction                                    rn_apnd       = ', rn_apnd
+      ENDIF
+
+      IF ( ln_pnd == .FALSE. ) THEN
+         WRITE(numout) ' Melt ponds are not activated '
+         WRITE(numout) ' nn_pnd_scheme, nn_pnd_cpl and rn_apnd are set to zero '
+         nn_pnd_scheme = 0
+         nn_pnd_cpl    = 0
+         rn_apnd       = 0._wp
       ENDIF
       !
@@ -134,13 +142,13 @@
       SELECT CASE ( nn_pnd_scheme )
 
-          CASE (1)
-
-             CALL lim_mp_cesm ! empirical melt ponds
-
-          CASE (2)
-
-             CALL lim_mp_topo    (at_i, a_i,                                       &
-                       &          vt_i, v_i, v_s,            t_i, s_i, a_ip_frac,  &
-                       &          h_ip,     t_su)
+         CASE (1)
+
+            CALL lim_mp_cesm ! empirical melt ponds
+
+         CASE (2)
+
+            CALL lim_mp_topo    (at_i, a_i,                                       &
+                      &          vt_i, v_i, v_s,            t_i, s_i, a_ip_frac,  &
+                      &          h_ip,     t_su)
 
       END SELECT
@@ -193,5 +201,5 @@
        REAL(wp)                            :: z1_rhofw          ! inverse freshwater density
        REAL(wp)                            :: z1_zpnd_aspect    ! inverse pond aspect ratio
-       REAL(wp)                            :: zvold             ! dummy pond volume
+       REAL(wp)                            :: zvpold            ! dummy pond volume
 
        INTEGER                             :: ji, jj, jl, ij    ! loop indices
@@ -261,5 +269,5 @@
             ELSE                        !--- Update pond characteristics
 
-               !--- Add retained melt water
+               !--- Add retained melt water to melt ponds
                v_ip(ji,jj,jl)      = v_ip(ji,jj,jl) + zrfrac(ji,jj,jl) * z1_rhofw * zwfx_mlw(ji,jj) * a_i(ji,jj,jl) * rdt_ice
 
Index: /branches/2016/dev_r6859_LIM3_meltponds/NEMOGCM/NEMO/LIM_SRC_3/limvar.F90
===================================================================
--- /branches/2016/dev_r6859_LIM3_meltponds/NEMOGCM/NEMO/LIM_SRC_3/limvar.F90	(revision 8084)
+++ /branches/2016/dev_r6859_LIM3_meltponds/NEMOGCM/NEMO/LIM_SRC_3/limvar.F90	(revision 8085)
@@ -526,5 +526,5 @@
       !!-------------------------------------------------------------------
       INTEGER  ::   ji, jj, jl, jk   ! dummy loop indices
-      REAL(wp) ::   zsal, zvi, zvs, zei, zes
+      REAL(wp) ::   zsal, zvi, zvs, zei, zes, zvp
       !!-------------------------------------------------------------------
       at_i (:,:) = 0._wp
@@ -566,4 +566,5 @@
                zvs  = v_s  (ji,jj,  jl)
                zes  = e_s  (ji,jj,1,jl)
+               zvp  = v_ip (ji,jj  ,jl)
                !-----------------------------------------------------------------
                ! Zap snow energy 
@@ -582,4 +583,10 @@
                oa_i (ji,jj,jl) = oa_i (ji,jj,jl) * rswitch
                smv_i(ji,jj,jl) = smv_i(ji,jj,jl) * rswitch
+
+               ! MV MP 2016
+               a_ip (ji,jj,jl) = a_ip (ji,jj,jl) * rswitch
+               v_ip (ji,jj,jl) = v_ip (ji,jj,jl) * rswitch
+               wfx_res(ji,jj)  = wfx_res(ji,jj) - ( v_ip(ji,jj,jl)  - zvp  ) * rhofw * r1_rdtice
+               ! END MV MP 2016
 
                ! update exchanges with ocean
Index: /branches/2016/dev_r6859_LIM3_meltponds/NEMOGCM/NEMO/LIM_SRC_3/limwri.F90
===================================================================
--- /branches/2016/dev_r6859_LIM3_meltponds/NEMOGCM/NEMO/LIM_SRC_3/limwri.F90	(revision 8084)
+++ /branches/2016/dev_r6859_LIM3_meltponds/NEMOGCM/NEMO/LIM_SRC_3/limwri.F90	(revision 8085)
@@ -171,5 +171,5 @@
       CALL iom_put( "vfxice"     , wfx_ice * ztmp       )        ! total ice growth/melt 
 
-      IF ( nn_pnd_scheme >= 0 ) &
+      IF ( ln_pnd .AND. ( nn_pnd_scheme >= 0 ) ) &
          CALL iom_put( "vfxpnd"  , wfx_pnd * ztmp       )        ! melt pond water flux
 
@@ -211,5 +211,5 @@
 
       ! MV MP 2016
-      IF ( nn_pnd_scheme >= 0 ) THEN ! change once we are sure
+      IF ( ln_pnd ) THEN
          CALL iom_put( "iceamp"  , at_ip  * zswi        )   ! melt pond total fraction
          CALL iom_put( "icevmp"  , vt_ip  * zswi        )   ! melt pond total volume per unit area
@@ -235,5 +235,5 @@
 
       ! MV MP 2016
-      IF ( nn_pnd_scheme >= 0 ) THEN ! change once we are sure that case = 0 works
+      IF ( ln_pnd .AND. ( nn_pnd_scheme >= 0 ) ) THEN
          IF ( iom_use( "iceamp_cat"  ) )  CALL iom_put( "iceamp_cat"     , a_ip   * zswi2   )       ! melt pond frac for categories
          IF ( iom_use( "icevmp_cat"  ) )  CALL iom_put( "icevmp_cat"     , v_ip   * zswi2   )       ! melt pond frac for categories
@@ -304,5 +304,5 @@
 
       ! MV MP 2016
-      IF ( nn_pnd_scheme >= 0 ) THEN
+      IF ( ln_pnd .AND. ( nn_pnd_scheme >= 0 ) ) THEN
          CALL histdef( kid, "si_amp", "Melt pond fraction"      , "%"      ,   &
       &         jpi, jpj, kh_i, 1, 1, 1, -99, 32, "inst(x)", rdt, rdt )
@@ -357,5 +357,5 @@
 
       ! MV MP 2016
-      IF ( nn_pnd_scheme >= 0 ) THEN
+      IF ( ln_pnd .AND. ( nn_pnd_scheme >= 0 ) ) THEN
          CALL histwrite( kid, "si_amp", kt, at_ip         , jpi*jpj, (/1/) )
          CALL histwrite( kid, "si_vmp", kt, vt_ip         , jpi*jpj, (/1/) )
@@ -370,5 +370,5 @@
       CALL histwrite( kid, "vfxbom", kt, wfx_bom        , jpi*jpj, (/1/) )
       CALL histwrite( kid, "vfxsum", kt, wfx_sum        , jpi*jpj, (/1/) )
-      IF ( nn_pnd_scheme >= 0 ) &
+      IF ( ln_pnd .AND. ( nn_pnd_scheme >= 0 ) ) &
          CALL histwrite( kid, "vfxpnd", kt, wfx_pnd     , jpi*jpj, (/1/) )
 
Index: /branches/2016/dev_r6859_LIM3_meltponds/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_lim.F90
===================================================================
--- /branches/2016/dev_r6859_LIM3_meltponds/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_lim.F90	(revision 8084)
+++ /branches/2016/dev_r6859_LIM3_meltponds/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_lim.F90	(revision 8085)
@@ -263,5 +263,5 @@
 
          ! MV MP 2016
-         IF ( ln_limMP)               CALL lim_mp( kt )         ! -- Melt ponds
+         IF ( ln_pnd )                CALL lim_mp( kt )         ! -- Melt ponds
          ! END MV MP 2016
 
