Index: branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/LIM_SRC_3/limsbc.F90
===================================================================
--- branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/LIM_SRC_3/limsbc.F90	(revision 5343)
+++ branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/LIM_SRC_3/limsbc.F90	(revision 5352)
@@ -30,5 +30,5 @@
    USE sbc_oce          ! Surface boundary condition: ocean fields
    USE sbccpl
-   USE oce       , ONLY : fraqsr_1lev, sshn, sshb, snwice_mass, snwice_mass_b, snwice_fmass
+   USE oce       , ONLY : sshn, sshb, snwice_mass, snwice_mass_b, snwice_fmass
    USE albedo           ! albedo parameters
    USE lbclnk           ! ocean lateral boundary condition - MPP exchanges
@@ -346,8 +346,4 @@
             sice_0(:,:) = 2._wp
          END WHERE
-      ENDIF
-      
-      IF( .NOT. ln_rstart ) THEN
-         fraqsr_1lev(:,:) = 1._wp
       ENDIF
       !
Index: branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/LIM_SRC_3/limthd.F90
===================================================================
--- branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/LIM_SRC_3/limthd.F90	(revision 5343)
+++ branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/LIM_SRC_3/limthd.F90	(revision 5352)
@@ -22,5 +22,4 @@
    USE phycst         ! physical constants
    USE dom_oce        ! ocean space and time domain variables
-   USE oce     , ONLY : fraqsr_1lev 
    USE ice            ! LIM: sea-ice variables
    USE sbc_oce        ! Surface boundary condition: ocean fields
@@ -172,13 +171,13 @@
             IF ( ln_cpl ) THEN
                zqld =  tmask(ji,jj,1) * rdt_ice *  &
-                  &    (   zqsr(ji,jj) * fraqsr_1lev(ji,jj) + zqns(ji,jj)               &   ! pfrld already included in coupled mode
-                  &    + ( pfrld(ji,jj)**rn_betas - pfrld(ji,jj) ) * sprecip(ji,jj)  *     &   ! heat content of precip
+                  &    (   zqsr(ji,jj) * frq_m(ji,jj) + zqns(ji,jj)                     &   ! pfrld already included in coupled mode
+                  &    + ( pfrld(ji,jj)**rn_betas - pfrld(ji,jj) ) * sprecip(ji,jj) *   &   ! heat content of precip
                   &      ( cpic * ( MIN( tatm_ice(ji,jj), rt0_snow ) - rt0 ) - lfus )   &
                   &    + ( 1._wp - pfrld(ji,jj) ) * ( tprecip(ji,jj) - sprecip(ji,jj) ) * rcp * ( tatm_ice(ji,jj) - rt0 ) )
             ELSE
                zqld =  tmask(ji,jj,1) * rdt_ice *  &
-                  &      ( pfrld(ji,jj) * ( zqsr(ji,jj) * fraqsr_1lev(ji,jj) + zqns(ji,jj) )    &
-                  &    + ( pfrld(ji,jj)**rn_betas - pfrld(ji,jj) ) * sprecip(ji,jj)  *             &  ! heat content of precip
-                  &      ( cpic * ( MIN( tatm_ice(ji,jj), rt0_snow ) - rt0 ) - lfus )           &
+                  &      ( pfrld(ji,jj) * ( zqsr(ji,jj) * frq_m(ji,jj) + zqns(ji,jj) )   &
+                  &    + ( pfrld(ji,jj)**rn_betas - pfrld(ji,jj) ) * sprecip(ji,jj) *    &  ! heat content of precip
+                  &      ( cpic * ( MIN( tatm_ice(ji,jj), rt0_snow ) - rt0 ) - lfus )    &
                   &    + ( 1._wp - pfrld(ji,jj) ) * ( tprecip(ji,jj) - sprecip(ji,jj) ) * rcp * ( tatm_ice(ji,jj) - rt0 ) )
             ENDIF
Index: branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/OPA_SRC/IOM/restart.F90
===================================================================
--- branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/OPA_SRC/IOM/restart.F90	(revision 5343)
+++ branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/OPA_SRC/IOM/restart.F90	(revision 5352)
@@ -135,7 +135,4 @@
                      CALL iom_rstput( kt, nitrst, numrow, 'rhd'    , rhd       )
 #endif
-                  IF( lk_lim3 .OR. ( nn_components == jp_iam_opa ) ) THEN
-                     CALL iom_rstput( kt, nitrst, numrow, 'fraqsr_1lev'  , fraqsr_1lev     ) !clem modif
-                  ENDIF
       IF( kt == nitrst ) THEN
          CALL iom_close( numrow )     ! close the restart file (only at last time step)
@@ -268,9 +265,4 @@
       ENDIF
       !
-!EM Idem
-!EM      IF( lk_lim3 .OR. ( nn_components == jp_iam_opa ) ) THEN
-         CALL iom_get( numror, jpdom_autoglo, 'fraqsr_1lev' , fraqsr_1lev )
-!EM      ENDIF
-      !
    END SUBROUTINE rst_read
 
Index: branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/OPA_SRC/SBC/sbc_oce.F90
===================================================================
--- branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/OPA_SRC/SBC/sbc_oce.F90	(revision 5343)
+++ branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/OPA_SRC/SBC/sbc_oce.F90	(revision 5352)
@@ -136,4 +136,5 @@
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   ssh_m     !: mean (nn_fsbc time-step) sea surface height                [m]
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   e3t_m     !: mean (nn_fsbc time-step) sea surface layer thickness       [m]
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   frq_m     !: mean (nn_fsbc time-step) fraction of solar net radiation absorbed in the 1st T level [-]
 
    !! * Substitutions
@@ -169,6 +170,6 @@
          &      atm_co2(jpi,jpj) ,                                        &
 #endif
-         &      ssu_m  (jpi,jpj) , sst_m(jpi,jpj) ,                       &
-         &      ssv_m  (jpi,jpj) , sss_m  (jpi,jpj), ssh_m(jpi,jpj) , STAT=ierr(4) )
+         &      ssu_m  (jpi,jpj) , sst_m(jpi,jpj) , frq_m(jpi,jpj) ,      &
+         &      ssv_m  (jpi,jpj) , sss_m(jpi,jpj) , ssh_m(jpi,jpj) , STAT=ierr(4) )
          !
 #if defined key_vvl
Index: branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/OPA_SRC/SBC/sbccpl.F90
===================================================================
--- branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/OPA_SRC/SBC/sbccpl.F90	(revision 5343)
+++ branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/OPA_SRC/SBC/sbccpl.F90	(revision 5352)
@@ -33,5 +33,5 @@
    USE cpl_oasis3      ! OASIS3 coupling
    USE geo2ocean       ! 
-   USE oce   , ONLY : tsn, un, vn, sshn, ub, vb, tsb, sshb, fraqsr_1lev
+   USE oce   , ONLY : tsn, un, vn, sshn, ub, vb, tsb, sshb
    USE albedo          !
    USE in_out_manager  ! I/O manager
@@ -1027,6 +1027,6 @@
       !                                                      !  fraction of solar net radiation !
       !                                                      ! ================================ !
-      IF( srcv(jpr_fraqsr)%laction ) THEN                      ! received by sas in case of opa <-> sas coupling
-         fraqsr_1lev(:,:) = frcv(jpr_fraqsr)%z3(:,:,1)
+      IF( srcv(jpr_fraqsr)%laction ) THEN                    ! received by sas in case of opa <-> sas coupling
+         frq_m(:,:) = frcv(jpr_fraqsr)%z3(:,:,1)
       ENDIF
       
@@ -1880,21 +1880,18 @@
          ELSE                    ;   ztmp1(:,:) = sshn(:,:)
          ENDIF
-         CALL cpl_snd( jps_ssh, isec, RESHAPE ( ztmp1, (/jpi,jpj,1/) ), info )
+         CALL cpl_snd( jps_ssh   , isec, RESHAPE ( ztmp1            , (/jpi,jpj,1/) ), info )
 
       ENDIF
       !                                                        ! SSS
       IF( ssnd(jps_soce  )%laction )  THEN
-         ztmp1(:,:) =  tsn(:,:,1,jp_sal)
-         CALL cpl_snd( jps_soce ,  isec, RESHAPE ( ztmp1, (/jpi,jpj,1/) ), info )
+         CALL cpl_snd( jps_soce  , isec, RESHAPE ( tsn(:,:,1,jp_sal), (/jpi,jpj,1/) ), info )
       ENDIF
       !                                                        ! first T level thickness 
       IF( ssnd(jps_e3t1st )%laction )  THEN
-         ztmp1(:,:) =  fse3t_n(:,:,1)
-         CALL cpl_snd( jps_e3t1st,  isec, RESHAPE ( ztmp1, (/jpi,jpj,1/) ), info )
+         CALL cpl_snd( jps_e3t1st, isec, RESHAPE ( fse3t_n(:,:,1)   , (/jpi,jpj,1/) ), info )
       ENDIF
       !                                                        ! Qsr fraction
       IF( ssnd(jps_fraqsr)%laction )  THEN
-         ztmp1(:,:) =  fraqsr_1lev(:,:) 
-         CALL cpl_snd( jps_fraqsr, isec, RESHAPE ( ztmp1, (/jpi,jpj,1/) ), info )
+         CALL cpl_snd( jps_fraqsr, isec, RESHAPE ( frq_m            , (/jpi,jpj,1/) ), info )
       ENDIF
       !
Index: branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/OPA_SRC/SBC/sbcssm.F90
===================================================================
--- branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/OPA_SRC/SBC/sbcssm.F90	(revision 5343)
+++ branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/OPA_SRC/SBC/sbcssm.F90	(revision 5352)
@@ -17,4 +17,5 @@
    USE sbcapr          ! surface boundary condition: atmospheric pressure
    USE eosbn2          ! equation of state and related derivatives
+   USE traqsr, ONLY: ln_qsr_ice,fraqsr_1lev
    !
    USE in_out_manager  ! I/O manager
@@ -59,5 +60,5 @@
       REAL(wp), DIMENSION(jpi,jpj,jpts) :: zts
       !!---------------------------------------------------------------------
-      
+
       !                                        !* surface T-, U-, V- ocean level variables (T, S, depth, velocity)
       DO jj = 1, jpj
@@ -81,5 +82,7 @@
          ENDIF
          !
-         IF( lk_vvl )   fse3t_m(:,:) = fse3t_n(:,:,1)
+         IF( lk_vvl     )   e3t_m(:,:) = fse3t_n(:,:,1)
+         !
+         IF( ln_qsr_ice )   frq_m(:,:) = fraqsr_1lev(:,:)
          !
       ELSE
@@ -101,5 +104,7 @@
             ENDIF
             !
-            IF( lk_vvl )   fse3t_m(:,:) = zcoef * fse3t_n(:,:,1)
+            IF( lk_vvl     )   e3t_m(:,:) = zcoef * fse3t_n(:,:,1)
+            !
+            IF( ln_qsr_ice )   frq_m(:,:) = zcoef * fraqsr_1lev(:,:)
             !                                             ! ---------------------------------------- !
          ELSEIF( MOD( kt - 2 , nn_fsbc ) == 0 ) THEN      !   Initialisation: New mean computation   !
@@ -110,5 +115,6 @@
             sss_m(:,:) = 0.e0
             ssh_m(:,:) = 0.e0
-            IF( lk_vvl )   fse3t_m(:,:) = 0.e0
+            IF( lk_vvl     )   e3t_m(:,:) = 0.e0
+            IF( ln_qsr_ice )   frq_m(:,:) = 0.e0
          ENDIF
          !                                                ! ---------------------------------------- !
@@ -126,5 +132,7 @@
          ENDIF
          !
-         IF( lk_vvl )   fse3t_m(:,:) = fse3t_m(:,:) + fse3t_n(:,:,1)
+         IF( lk_vvl     )   e3t_m(:,:) = fse3t_m(:,:) + fse3t_n(:,:,1)
+         !
+         IF( ln_qsr_ice )   frq_m(:,:) =   frq_m(:,:) + fraqsr_1lev(:,:)
 
          !                                                ! ---------------------------------------- !
@@ -137,5 +145,6 @@
             ssv_m(:,:) = ssv_m(:,:) * zcoef           !
             ssh_m(:,:) = ssh_m(:,:) * zcoef           ! mean SSH             [m]
-            IF( lk_vvl )   fse3t_m(:,:) = fse3t_m(:,:) * zcoef   ! mean vertical scale factor [m]
+            IF( lk_vvl     )   e3t_m(:,:) = fse3t_m(:,:) * zcoef   ! mean vertical scale factor [m]
+            IF( ln_qsr_ice )   frq_m(:,:) =   frq_m(:,:) * zcoef   ! mean fraction of solar net radiation absorbed in the 1st T level [-]
             !
          ENDIF
@@ -154,7 +163,6 @@
             CALL iom_rstput( kt, nitrst, numrow, 'sss_m'  , sss_m  )
             CALL iom_rstput( kt, nitrst, numrow, 'ssh_m'  , ssh_m  )
-            IF( lk_vvl ) THEN
-               CALL iom_rstput( kt, nitrst, numrow, 'fse3t_m'  , fse3t_m(:,:)  )
-            END IF
+            IF( lk_vvl     )   CALL iom_rstput( kt, nitrst, numrow, 'e3t_m'  , e3t_m  )
+            IF( ln_qsr_ice )   CALL iom_rstput( kt, nitrst, numrow, 'frq_m'  , frq_m  )
             !
          ENDIF
@@ -168,5 +176,6 @@
          CALL iom_put( 'sss_m', sss_m )
          CALL iom_put( 'ssh_m', ssh_m )
-         IF( lk_vvl )   CALL iom_put( 'e3t_m', fse3t_m(:,:) )
+         IF( lk_vvl     )   CALL iom_put( 'e3t_m', e3t_m )
+         IF( ln_qsr_ice )   CALL iom_put( 'frq_m', frq_m )
       ENDIF
       !
@@ -204,5 +213,11 @@
             CALL iom_get( numror, jpdom_autoglo, 'sss_m'  , sss_m  )   !   "         "    salinity    (T-point)
             CALL iom_get( numror, jpdom_autoglo, 'ssh_m'  , ssh_m  )   !   "         "    height      (T-point)
-            IF( lk_vvl ) CALL iom_get( numror, jpdom_autoglo, 'fse3t_m', fse3t_m(:,:) )
+            IF( lk_vvl ) CALL iom_get( numror, jpdom_autoglo, 'e3t_m', e3t_m )
+            ! fraction of solar net radiation absorbed in 1st T level
+            IF( iom_varid( numror, 'frq_m', ldstop = .FALSE. ) > 0 ) THEN
+               CALL iom_get( numror, jpdom_autoglo, 'frq_m'  , frq_m  )
+            ELSE
+               frq_m(:,:) = 1._wp   ! default definition
+            ENDIF
             !
             IF( zf_sbc /= REAL( nn_fsbc, wp ) ) THEN      ! nn_fsbc has changed between 2 runs
@@ -215,5 +230,6 @@
                sss_m(:,:) = zcoef * sss_m(:,:)
                ssh_m(:,:) = zcoef * ssh_m(:,:)
-               IF( lk_vvl ) fse3t_m(:,:) = zcoef * fse3t_m(:,:)
+               IF( lk_vvl )   e3t_m(:,:) = zcoef * fse3t_m(:,:)
+               frq_m(:,:) = zcoef * frq_m(:,:)   ! bug: must not be done if ln_qsr_ice = .false. 
             ELSE
                IF(lwp) WRITE(numout,*) '~~~~~~~   mean fields read in the ocean restart file'
@@ -232,5 +248,6 @@
          sss_m(:,:) = tsn(:,:,1,jp_sal)
          ssh_m(:,:) = sshn(:,:)
-         IF( lk_vvl )   fse3t_m(:,:) = fse3t_n(:,:,1)
+         IF( lk_vvl )   e3t_m(:,:) = fse3t_n(:,:,1)
+         frq_m(:,:) = 1._wp
          !
       ENDIF
Index: branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/OPA_SRC/TRA/traqsr.F90
===================================================================
--- branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/OPA_SRC/TRA/traqsr.F90	(revision 5343)
+++ branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/OPA_SRC/TRA/traqsr.F90	(revision 5352)
@@ -32,5 +32,4 @@
    USE wrk_nemo       ! Memory Allocation
    USE timing         ! Timing
-   USE sbc_ice, ONLY : lk_lim3
 
    IMPLICIT NONE
@@ -50,5 +49,8 @@
    REAL(wp), PUBLIC ::   rn_si0       !: very near surface depth of extinction      (RGB & 2 bands)
    REAL(wp), PUBLIC ::   rn_si1       !: deepest depth of extinction (water type I)       (2 bands)
-   
+ 
+   !! Energy budget of the leads (open water embedded in sea ice)
+   REAL(wp), PUBLIC, ALLOCATABLE, DIMENSION(:,:)   ::   fraqsr_1lev   !: fraction of solar net radiation absorbed in the 1st T level [-]
+
    ! Module variables
    REAL(wp) ::   xsi0r                           !: inverse of rn_si0
@@ -165,9 +167,11 @@
          CALL iom_put( 'qsr3d', etot3 )   ! Shortwave Radiation 3D distribution
          ! clem: store attenuation coefficient of the first ocean level
-         IF ( lk_lim3 .AND. ln_qsr_ice ) THEN
+         IF ( ln_qsr_ice ) THEN
             DO jj = 1, jpj
                DO ji = 1, jpi
                   IF ( qsr(ji,jj) /= 0._wp ) THEN
                      fraqsr_1lev(ji,jj) = ( qsr_hc(ji,jj,1) / ( r1_rau0_rcp * qsr(ji,jj) ) )
+                  ELSE
+                     fraqsr_1lev(ji,jj) = 1.
                   ENDIF
                END DO
@@ -380,9 +384,4 @@
       IF( nn_timing == 1 )  CALL timing_start('tra_qsr_init')
       !
-      ! Default value for fraqsr_1lev
-      IF( .NOT. ln_rstart ) THEN
-         fraqsr_1lev(:,:) = 1._wp
-      ENDIF
-      !
       CALL wrk_alloc( jpi, jpj,      zekb, zekg, zekr        ) 
       CALL wrk_alloc( jpi, jpj, jpk, ze0, ze1, ze2, ze3, zea ) 
@@ -412,7 +411,15 @@
          WRITE(numout,*) '      RGB & 2 bands: shortess depth of extinction  rn_si0 = ', rn_si0
          WRITE(numout,*) '      2 bands: longest depth of extinction         rn_si1 = ', rn_si1
-         WRITE(numout,*) '      light penetration for ice-model LIM3     ln_qsr_ice = ', ln_qsr_ice    
-      ENDIF
-
+      ENDIF
+
+      ! allocate fraqsr_1lev if we have ln_qsr_ice
+      IF( ln_qsr_ice ) THEN
+         ALLOCATE( fraqsr_1lev(jpi,jpj) , STAT=ierror )
+         IF( ierror > 0 ) THEN
+            CALL ctl_stop( 'tra_qsr_init: unable to allocate fraqsr_1lev array' )   ;   RETURN
+         ENDIF
+         fraqsr_1lev(:,:) = 1._wp   !  default definition used in the 1st time step as sbc_ssm is called before tra_qsr
+      ENDIF
+      
       IF( ln_traqsr ) THEN     ! control consistency
          !                      
Index: branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/OPA_SRC/oce.F90
===================================================================
--- branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/OPA_SRC/oce.F90	(revision 5343)
+++ branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/OPA_SRC/oce.F90	(revision 5352)
@@ -69,7 +69,4 @@
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   snwice_fmass       !: time evolution of mass of snow+ice               [Kg/m2/s]
 
-   !! Energy budget of the leads (open water embedded in sea ice)
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   fraqsr_1lev        !: fraction of solar net radiation absorbed in the first ocean level [-]
-
    !!----------------------------------------------------------------------
    !! NEMO/OPA 4.0 , NEMO Consortium (2011)
@@ -83,5 +80,5 @@
       !!                   ***  FUNCTION oce_alloc  ***
       !!----------------------------------------------------------------------
-      INTEGER :: ierr(4)
+      INTEGER :: ierr(3)
       !!----------------------------------------------------------------------
       !
@@ -117,6 +114,4 @@
       ALLOCATE( snwice_mass(jpi,jpj) , snwice_mass_b(jpi,jpj), snwice_fmass(jpi,jpj) , STAT=ierr(3) )
          !
-      ALLOCATE( fraqsr_1lev(jpi,jpj) , STAT=ierr(4) )
-         !
       oce_alloc = MAXVAL( ierr )
       IF( oce_alloc /= 0 )   CALL ctl_warn('oce_alloc: failed to allocate arrays')
Index: branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/SAS_SRC/nemogcm.F90
===================================================================
--- branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/SAS_SRC/nemogcm.F90	(revision 5343)
+++ branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/SAS_SRC/nemogcm.F90	(revision 5352)
@@ -501,5 +501,5 @@
       USE oce       , ONLY : sshn, sshb, snwice_mass, snwice_mass_b, snwice_fmass 
       !
-      INTEGER :: ierr,ierr1,ierr2,ierr3,ierr4,ierr5,ierr6,ierr7
+      INTEGER :: ierr,ierr1,ierr2,ierr3,ierr4,ierr5,ierr6
       INTEGER :: jpm
       !!----------------------------------------------------------------------
@@ -520,7 +520,6 @@
       ALLOCATE( tsb(jpi,jpj,1,jpm)  , STAT=ierr5 )
       ALLOCATE( sshn(jpi,jpj)       , STAT=ierr6 )
-      ALLOCATE( fraqsr_1lev(jpi,jpj), STAT=ierr7 )
-
-      ierr = ierr + ierr1 + ierr2 + ierr3 + ierr4 + ierr5 + ierr6 + ierr7
+
+      ierr = ierr + ierr1 + ierr2 + ierr3 + ierr4 + ierr5 + ierr6 
       !
       IF( lk_mpp    )   CALL mpp_sum( ierr )
Index: branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/SAS_SRC/sbcssm.F90
===================================================================
--- branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/SAS_SRC/sbcssm.F90	(revision 5343)
+++ branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/SAS_SRC/sbcssm.F90	(revision 5352)
@@ -36,6 +36,7 @@
    PUBLIC   sbc_ssm        ! called by sbc
 
-   CHARACTER(len=100)   ::   cn_dir      !: Root directory for location of ssm files
-   LOGICAL              ::   ln_3d_uve   !: specify whether input velocity data is 3D
+   CHARACTER(len=100)   ::   cn_dir        !: Root directory for location of ssm files
+   LOGICAL              ::   ln_3d_uve     !: specify whether input velocity data is 3D
+   LOGICAL              ::   ln_read_frq   !: specify whether we must read frq or not
    INTEGER     ::   nfld_3d
    INTEGER     ::   nfld_2d
@@ -47,4 +48,5 @@
    INTEGER     ::   jf_ssh         ! index of sea surface height
    INTEGER     ::   jf_e3t         ! index of first T level thickness
+   INTEGER     ::   jf_frq         ! index of fraction of qsr absorbed in the 1st T level
 
    TYPE(FLD), ALLOCATABLE, DIMENSION(:) :: sf_ssm_3d  ! structure of input fields (file information, fields read)
@@ -95,4 +97,5 @@
       sss_m(:,:) = sf_ssm_2d(jf_sal)%fnow(:,:,1) * tmask(:,:,1)    ! salinity
       ssh_m(:,:) = sf_ssm_2d(jf_ssh)%fnow(:,:,1) * tmask(:,:,1)    ! sea surface height
+      IF( ln_read_frq )   frq_m(:,:) = sf_ssm_2d(jf_frq)%fnow(:,:,1) * tmask(:,:,1)    ! sea surface height
       !
       tsn(:,:,1,jp_tem) = sst_m(:,:)
@@ -111,5 +114,6 @@
          CALL prt_ctl(tab2d_1=ssv_m, clinfo1=' ssv_m   - : ', mask1=vmask, ovlap=1   )
          CALL prt_ctl(tab2d_1=ssh_m, clinfo1=' ssh_m   - : ', mask1=tmask, ovlap=1   )
-         IF( lk_vvl )   CALL prt_ctl(tab2d_1=ssh_m, clinfo1=' e3t_m   - : ', mask1=tmask, ovlap=1   )
+         IF( lk_vvl      )   CALL prt_ctl(tab2d_1=ssh_m, clinfo1=' e3t_m   - : ', mask1=tmask, ovlap=1   )
+         IF( ln_read_frq )   CALL prt_ctl(tab2d_1=frq_m, clinfo1=' frq_m   - : ', mask1=tmask, ovlap=1   )
       ENDIF
       !
@@ -138,7 +142,7 @@
       TYPE(FLD_N) :: sn_tem, sn_sal                     ! information about the fields to be read
       TYPE(FLD_N) :: sn_usp, sn_vsp
-      TYPE(FLD_N) :: sn_ssh, sn_e3t
-      !
-      NAMELIST/namsbc_sas/cn_dir, ln_3d_uve, sn_tem, sn_sal, sn_usp, sn_vsp, sn_ssh, sn_e3t
+      TYPE(FLD_N) :: sn_ssh, sn_e3t, sn_frq
+      !
+      NAMELIST/namsbc_sas/cn_dir, ln_3d_uve, ln_read_frq, sn_tem, sn_sal, sn_usp, sn_vsp, sn_ssh, sn_e3t, sn_frq
       !!----------------------------------------------------------------------
       
@@ -159,4 +163,6 @@
          WRITE(numout,*) '~~~~~~~~~~~ '
          WRITE(numout,*) '   Namelist namsbc_sas'
+         WRITE(numout,*) '      Are we supplying a 3D u,v and e3 field                             ln_3d_uve   = ', ln_3d_uve
+         WRITE(numout,*) '      Are we reading frq (fraction of qsr absorbed in the 1st T level)   ln_read_frq = ', ln_read_frq
          WRITE(numout,*)
       ENDIF
@@ -199,14 +205,14 @@
       !! and the rest of the logic should still work
       !
-      jf_tem = 1 ; jf_sal = 2 ; jf_ssh = 3
+      jf_tem = 1 ; jf_sal = 2 ; jf_ssh = 3 ; jf_frq = 4   ! default 2D fields index
       !
       IF( ln_3d_uve ) THEN
-         jf_usp = 1 ; jf_vsp = 2 ; jf_e3t = 3
-         nfld_3d  = 2 + COUNT( (/lk_vvl/) )
-         nfld_2d  = 3
+         jf_usp = 1 ; jf_vsp = 2 ; jf_e3t = 3      ! define 3D fields index
+         nfld_3d  = 2 + COUNT( (/lk_vvl/) )        ! number of 3D fields to read
+         nfld_2d  = 3 + COUNT( (/ln_read_frq/) )   ! number of 2D fields to read
       ELSE
-         jf_usp = 4 ; jf_vsp = 5 ; jf_e3t = 6
-         nfld_3d  = 0
-         nfld_2d  = 5 + COUNT( (/lk_vvl/) )
+         jf_usp = 4 ; jf_vsp = 5 ; jf_e3t = 6 ; jf_frq = 6 + COUNT( (/lk_vvl/) )   ! update 2D fields index
+         nfld_3d  = 0                                                              ! no 3D fields to read
+         nfld_2d  = 5 + COUNT( (/lk_vvl/) ) + COUNT( (/ln_read_frq/) )             ! number of 2D fields to read
       ENDIF
 
@@ -227,4 +233,5 @@
          ENDIF
          slf_2d(jf_tem) = sn_tem ; slf_2d(jf_sal) = sn_sal ; slf_2d(jf_ssh) = sn_ssh
+         IF( ln_read_frq )   slf_2d(jf_frq) = sn_frq
          IF( .NOT. ln_3d_uve ) THEN
             slf_2d(jf_usp) = sn_usp ; slf_2d(jf_vsp) = sn_vsp
@@ -271,5 +278,6 @@
       IF( nfld_2d > 0 ) DEALLOCATE( slf_2d, STAT=ierr )
 
-      call sbc_ssm( nit000 )   ! need to define ss?_m arrays used in limistate
+      CALL sbc_ssm( nit000 )   ! need to define ss?_m arrays used in limistate
+      IF( .NOT. ln_read_frq )   frq_m(:,:) = 1.
       !
    END SUBROUTINE sbc_ssm_init
