Index: LMDZ6/trunk/libf/dynphy_lonlat/phylmd/init_ssrf_m.F90
===================================================================
--- LMDZ6/trunk/libf/dynphy_lonlat/phylmd/init_ssrf_m.F90	(revision 3006)
+++ LMDZ6/trunk/libf/dynphy_lonlat/phylmd/init_ssrf_m.F90	(revision 4283)
@@ -3,12 +3,13 @@
 !*******************************************************************************
 
-  USE indice_sol_mod, ONLY: is_ter, is_oce, is_oce, is_lic, epsfra
+  USE indice_sol_mod,     ONLY: is_ter, is_oce, is_oce, is_lic, epsfra
   USE dimphy,             ONLY: klon, zmasq
   USE phys_state_var_mod, ONLY: pctsrf
-  USE geometry_mod, ONLY : longitude_deg, latitude_deg
+  USE geometry_mod,       ONLY : longitude_deg, latitude_deg
   USE grid_atob_m,        ONLY: grille_m
   USE ioipsl,             ONLY: flininfo, flinopen, flinget, flinclo
   USE ioipsl_getin_p_mod, ONLY: getin_p
-  USE comconst_mod, ONLY: im, pi
+  USE comconst_mod,       ONLY: im, pi
+  USE surface_data,       ONLY: landice_opt
 
   CHARACTER(LEN=256), PARAMETER :: icefname="landiceref.nc", icevar="landice"
@@ -58,64 +59,75 @@
 ! Sub-surfaces initialization
 !*******************************************************************************
-!--- Read and interpolate on model T-grid soil fraction and soil ice fraction.
-  CALL flininfo(icefname, iml_lic, jml_lic, llm_tmp, ttm_tmp, fid)
-  ALLOCATE(lat_lic(iml_lic,jml_lic),lon_lic(iml_lic,jml_lic))
-  ALLOCATE(fraclic(iml_lic,jml_lic))
-  CALL flinopen(icefname, .FALSE., iml_lic, jml_lic, llm_tmp,  &
- &               lon_lic, lat_lic, lev, ttm_tmp, itaul, date, dt, fid)
-  CALL flinget(fid, icevar, iml_lic, jml_lic, llm_tmp, ttm_tmp, 1,1, fraclic)
-  CALL flinclo(fid)
-  WRITE(lunout,*)'landice dimensions: iml_lic, jml_lic : ',iml_lic,jml_lic
+  IF (landice_opt .LT. 2) THEN
+     ! Continue with reading landice.nc file
+     WRITE(lunout,*)"Read landice.nc file to attribute is_lic fraction"
 
-  ALLOCATE(dlon_lic(iml_lic),dlat_lic(jml_lic))
-  dlon_lic(:)=lon_lic(:,1); IF(MAXVAL(dlon_lic)>pi) dlon_lic=dlon_lic*pi/180.
-  dlat_lic(:)=lat_lic(1,:); IF(MAXVAL(dlat_lic)>pi) dlat_lic=dlat_lic*pi/180.
-  DEALLOCATE(lon_lic,lat_lic); ALLOCATE(flic_tmp(iip1,jjp1))
-  CALL grille_m(dlon_lic,dlat_lic,fraclic,rlonv(1:iim),rlatu,flic_tmp(1:iim,:))
-  flic_tmp(iip1,:)=flic_tmp(1,:)
-
-!--- To the physical grid
-  pctsrf(:,:) = 0.
-  CALL gr_dyn_fi(1, iip1, jjp1, klon, flic_tmp, pctsrf(:,is_lic))
-  DEALLOCATE(flic_tmp)
-
-!--- Adequation with soil/sea mask
-  WHERE(pctsrf(:,is_lic)<EPSFRA) pctsrf(:,is_lic)=0. 
-  WHERE(zmasq(:)<EPSFRA)         pctsrf(:,is_lic)=0.
-  pctsrf(:,is_ter)=zmasq(:)
-  DO ji=1,klon
-    IF(zmasq(ji)>EPSFRA) THEN 
-      IF(pctsrf(ji,is_lic)>=zmasq(ji)) THEN
-        pctsrf(ji,is_lic)=zmasq(ji)
-        pctsrf(ji,is_ter)=0.
-      ELSE
-        pctsrf(ji,is_ter)=zmasq(ji)-pctsrf(ji,is_lic)
-        IF(pctsrf(ji,is_ter)<EPSFRA) THEN
-          pctsrf(ji,is_ter)=0.
-          pctsrf(ji,is_lic)=zmasq(ji)
-        END IF 
-      END IF 
-    END IF 
-  END DO 
-
-
-  !--- Option no_ter_antartique removes all land fractions souther than 60S.
-  !--- Land ice is set instead of the land fractions on these latitudes.
-  !--- The ocean and sea-ice fractions are not changed.
-  no_ter_antartique=.FALSE.
-  CALL getin_p('no_ter_antartique',no_ter_antartique)
-  WRITE(lunout,*)"no_ter_antartique=",no_ter_antartique
-  IF (no_ter_antartique) THEN
-     ! Remove all land fractions souther than 60S and set land-ice instead
-     WRITE(lunout,*) "Remove land fractions souther than 60deg south by increasing"
-     WRITE(lunout,*) "the continental ice fractions. No land can now be found at Antartic."
-     DO ji=1, klon
-        IF (latitude_deg(ji)<-60.0) THEN
-           pctsrf(ji,is_lic) = pctsrf(ji,is_lic) + pctsrf(ji,is_ter)
-           pctsrf(ji,is_ter) = 0
+     !--- Read and interpolate on model T-grid soil fraction and soil ice fraction.
+     CALL flininfo(icefname, iml_lic, jml_lic, llm_tmp, ttm_tmp, fid)
+     ALLOCATE(lat_lic(iml_lic,jml_lic),lon_lic(iml_lic,jml_lic))
+     ALLOCATE(fraclic(iml_lic,jml_lic))
+     CALL flinopen(icefname, .FALSE., iml_lic, jml_lic, llm_tmp,  &
+          &               lon_lic, lat_lic, lev, ttm_tmp, itaul, date, dt, fid)
+     CALL flinget(fid, icevar, iml_lic, jml_lic, llm_tmp, ttm_tmp, 1,1, fraclic)
+     CALL flinclo(fid)
+     WRITE(lunout,*)'landice dimensions: iml_lic, jml_lic : ',iml_lic,jml_lic
+     
+     ALLOCATE(dlon_lic(iml_lic),dlat_lic(jml_lic))
+     dlon_lic(:)=lon_lic(:,1); IF(MAXVAL(dlon_lic)>pi) dlon_lic=dlon_lic*pi/180.
+     dlat_lic(:)=lat_lic(1,:); IF(MAXVAL(dlat_lic)>pi) dlat_lic=dlat_lic*pi/180.
+     DEALLOCATE(lon_lic,lat_lic); ALLOCATE(flic_tmp(iip1,jjp1))
+     CALL grille_m(dlon_lic,dlat_lic,fraclic,rlonv(1:iim),rlatu,flic_tmp(1:iim,:))
+     flic_tmp(iip1,:)=flic_tmp(1,:)
+     
+     !--- To the physical grid
+     pctsrf(:,:) = 0.
+     CALL gr_dyn_fi(1, iip1, jjp1, klon, flic_tmp, pctsrf(:,is_lic))
+     DEALLOCATE(flic_tmp)
+     
+     !--- Adequation with soil/sea mask
+     WHERE(pctsrf(:,is_lic)<EPSFRA) pctsrf(:,is_lic)=0. 
+     WHERE(zmasq(:)<EPSFRA)         pctsrf(:,is_lic)=0.
+     pctsrf(:,is_ter)=zmasq(:)
+     DO ji=1,klon
+        IF(zmasq(ji)>EPSFRA) THEN 
+           IF(pctsrf(ji,is_lic)>=zmasq(ji)) THEN
+              pctsrf(ji,is_lic)=zmasq(ji)
+              pctsrf(ji,is_ter)=0.
+           ELSE
+              pctsrf(ji,is_ter)=zmasq(ji)-pctsrf(ji,is_lic)
+              IF(pctsrf(ji,is_ter)<EPSFRA) THEN
+                 pctsrf(ji,is_ter)=0.
+                 pctsrf(ji,is_lic)=zmasq(ji)
+              END IF
+           END IF
         END IF
      END DO
+     
+     
+     !--- Option no_ter_antartique removes all land fractions souther than 60S.
+     !--- Land ice is set instead of the land fractions on these latitudes.
+     !--- The ocean and sea-ice fractions are not changed.
+     no_ter_antartique=.FALSE.
+     CALL getin_p('no_ter_antartique',no_ter_antartique)
+     WRITE(lunout,*)"no_ter_antartique=",no_ter_antartique
+     IF (no_ter_antartique) THEN
+        ! Remove all land fractions souther than 60S and set land-ice instead
+        WRITE(lunout,*) "Remove land fractions souther than 60deg south by increasing"
+        WRITE(lunout,*) "the continental ice fractions. No land can now be found at Antartic."
+        DO ji=1, klon
+           IF (latitude_deg(ji)<-60.0) THEN
+              pctsrf(ji,is_lic) = pctsrf(ji,is_lic) + pctsrf(ji,is_ter)
+              pctsrf(ji,is_ter) = 0
+           END IF
+        END DO
+     END IF
+     
+  ELSE
+     ! landice_opt=2 and higher
+     WRITE(lunout,*) 'No landice is attributed is_lic sub-surface because landice_opt=2 or higher.'
+     WRITE(lunout,*) 'This means that the land model will handel land ice as well as all other land areas.'
+     pctsrf(:,is_ter) = zmasq(:)
+     pctsrf(:,is_lic) = 0.0
   END IF
-
 
 !--- Sub-surface ocean and sea ice (sea ice set to zero for start).
