Index: /branches/2013/dev_r3856_MERCATOR3_QSRMEAN24H/NEMOGCM/NEMO/OPA_SRC/SBC/sbc_oce.F90
===================================================================
--- /branches/2013/dev_r3856_MERCATOR3_QSRMEAN24H/NEMOGCM/NEMO/OPA_SRC/SBC/sbc_oce.F90	(revision 4159)
+++ /branches/2013/dev_r3856_MERCATOR3_QSRMEAN24H/NEMOGCM/NEMO/OPA_SRC/SBC/sbc_oce.F90	(revision 4160)
@@ -64,5 +64,5 @@
    !! wndm is used onmpute surface gases exchanges in ice-free ocean or leads
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   wndm              !: wind speed module at T-point (=|U10m-Uoce|)  [m/s]
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   qsr               !: sea heat flux:     solar                     [W/m2]
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:),TARGET ::   qsr               !: sea heat flux:     solar                     [W/m2]
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:),TARGET ::   qsr_mean          !: daily mean sea heat flux: solar              [W/m2]
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   qns    , qns_b    !: sea heat flux: non solar                     [W/m2]
Index: /branches/2013/dev_r3856_MERCATOR3_QSRMEAN24H/NEMOGCM/NEMO/TOP_SRC/PISCES/P2Z/p2zopt.F90
===================================================================
--- /branches/2013/dev_r3856_MERCATOR3_QSRMEAN24H/NEMOGCM/NEMO/TOP_SRC/PISCES/P2Z/p2zopt.F90	(revision 4159)
+++ /branches/2013/dev_r3856_MERCATOR3_QSRMEAN24H/NEMOGCM/NEMO/TOP_SRC/PISCES/P2Z/p2zopt.F90	(revision 4160)
@@ -89,5 +89,5 @@
 
       !                                          ! surface irradiance
-      zpar0m (:,:)   = qsr   (:,:) * 0.43        ! ------------------
+      zpar0m (:,:)   = qsr_top(:,:) * 0.43        ! ------------------
       zpar100(:,:)   = zpar0m(:,:) * 0.01
       zparr  (:,:,1) = zpar0m(:,:) * 0.5
Index: /branches/2013/dev_r3856_MERCATOR3_QSRMEAN24H/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zopt.F90
===================================================================
--- /branches/2013/dev_r3856_MERCATOR3_QSRMEAN24H/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zopt.F90	(revision 4159)
+++ /branches/2013/dev_r3856_MERCATOR3_QSRMEAN24H/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zopt.F90	(revision 4160)
@@ -72,4 +72,5 @@
       INTEGER  ::   irgb
       REAL(wp) ::   zchl, zxsi0r
+      REAL(wp) ::   zmin,zmax
       REAL(wp) ::   zc0 , zc1 , zc2, zc3, z1_dep
       REAL(wp), POINTER, DIMENSION(:,:  ) :: zdepmoy, zetmp, zetmp1, zetmp2
@@ -111,12 +112,13 @@
       !                                        !* Photosynthetically Available Radiation (PAR)
       !                                        !  --------------------------------------
+
       IF( ln_varpar ) THEN
-         ze1(:,:,1) = par_varsw(:,:) * qsr(:,:) * EXP( -0.5 * zekb(:,:,1) )
-         ze2(:,:,1) = par_varsw(:,:) * qsr(:,:) * EXP( -0.5 * zekg(:,:,1) )
-         ze3(:,:,1) = par_varsw(:,:) * qsr(:,:) * EXP( -0.5 * zekr(:,:,1) )
+         ze1(:,:,1) = par_varsw(:,:) * qsr_top(:,:) * EXP( -0.5 * zekb(:,:,1) )
+         ze2(:,:,1) = par_varsw(:,:) * qsr_top(:,:) * EXP( -0.5 * zekg(:,:,1) )
+         ze3(:,:,1) = par_varsw(:,:) * qsr_top(:,:) * EXP( -0.5 * zekr(:,:,1) )
       ELSE
-         ze1(:,:,1) = xparsw         * qsr(:,:) * EXP( -0.5 * zekb(:,:,1) )
-         ze2(:,:,1) = xparsw         * qsr(:,:) * EXP( -0.5 * zekg(:,:,1) )
-         ze3(:,:,1) = xparsw         * qsr(:,:) * EXP( -0.5 * zekr(:,:,1) )
+         ze1(:,:,1) = xparsw         * qsr_top(:,:) * EXP( -0.5 * zekb(:,:,1) )
+         ze2(:,:,1) = xparsw         * qsr_top(:,:) * EXP( -0.5 * zekg(:,:,1) )
+         ze3(:,:,1) = xparsw         * qsr_top(:,:) * EXP( -0.5 * zekr(:,:,1) )
       ENDIF
 
@@ -157,18 +159,18 @@
          zxsi0r = 1.e0 / rn_si0
          !
-         ze0(:,:,1) = rn_abs * qsr(:,:)
+         ze0(:,:,1) = rn_abs * qsr_top(:,:)
          !                                                    ! surface value : separation in R-G-B + near surface
          IF( ln_varpar ) THEN
-            ze0(:,:,1) = ( 1. - 3. * par_varsw(:,:) ) * qsr(:,:)
-            ze1(:,:,1) = par_varsw(:,:)               * qsr(:,:)         
-            ze2(:,:,1) = par_varsw(:,:)               * qsr(:,:)
-            ze3(:,:,1) = par_varsw(:,:)               * qsr(:,:)
+            ze0(:,:,1) = ( 1. - 3. * par_varsw(:,:) ) * qsr_top(:,:)
+            ze1(:,:,1) = par_varsw(:,:)               * qsr_top(:,:)         
+            ze2(:,:,1) = par_varsw(:,:)               * qsr_top(:,:)
+            ze3(:,:,1) = par_varsw(:,:)               * qsr_top(:,:)
          ELSE
-            ze0(:,:,1) = ( 1. - 3. * xparsw )  * qsr(:,:)
-            ze1(:,:,1) = xparsw                * qsr(:,:)         
-            ze2(:,:,1) = xparsw                * qsr(:,:)
-            ze3(:,:,1) = xparsw                * qsr(:,:)
+            ze0(:,:,1) = ( 1. - 3. * xparsw )  * qsr_top(:,:)
+            ze1(:,:,1) = xparsw                * qsr_top(:,:)         
+            ze2(:,:,1) = xparsw                * qsr_top(:,:)
+            ze3(:,:,1) = xparsw                * qsr_top(:,:)
          ENDIF
-         etot3(:,:,1) =  qsr(:,:) * tmask(:,:,1)
+         etot3(:,:,1) =  qsr_top(:,:) * tmask(:,:,1)
          !
          !
@@ -202,5 +204,5 @@
          DO jj = 1, jpj
            DO ji = 1, jpi
-              IF( etot(ji,jj,jk) >= 0.0043 * qsr(ji,jj) )  THEN
+              IF( etot(ji,jj,jk) >= 0.0043 * qsr_top(ji,jj) )  THEN
                  neln(ji,jj) = jk+1                    ! Euphotic level : 1rst T-level strictly below Euphotic layer
                  !                                     ! nb: ensure the compatibility with nmld_trc definition in trd_mld_trc_zint
Index: /branches/2013/dev_r3856_MERCATOR3_QSRMEAN24H/NEMOGCM/NEMO/TOP_SRC/oce_trc.F90
===================================================================
--- /branches/2013/dev_r3856_MERCATOR3_QSRMEAN24H/NEMOGCM/NEMO/TOP_SRC/oce_trc.F90	(revision 4159)
+++ /branches/2013/dev_r3856_MERCATOR3_QSRMEAN24H/NEMOGCM/NEMO/TOP_SRC/oce_trc.F90	(revision 4160)
@@ -96,6 +96,4 @@
    USE sbc_oce , ONLY :   vtau       =>    vtau       !: j-surface stress component
    USE sbc_oce , ONLY :   wndm       =>    wndm       !: 10m wind speed 
-   USE sbc_oce , ONLY :   qsr        =>    qsr        !: penetrative solar radiation (w m-2)  
-   USE sbc_oce , ONLY :   qsr_mean                    !: penetrative solar radiation (w m-2)  
    USE sbc_oce , ONLY :   emp        =>    emp        !: freshwater budget: volume flux               [Kg/m2/s]
    USE sbc_oce , ONLY :   emp_b      =>    emp_b      !: freshwater budget: volume flux               [Kg/m2/s]
@@ -150,4 +148,23 @@
 # endif
 
+   REAL(wp),DIMENSION(:,:),POINTER :: qsr_top
+
+CONTAINS
+
+   INTEGER FUNCTION oce_trc_alloc()
+      !!----------------------------------------------------------------------
+      !!                  ***  trc_oce_alloc  ***
+      !!----------------------------------------------------------------------
+      !!----------------------------------------------------------------------
+      INTEGER ::   ierr(1)        ! Local variables
+      !!----------------------------------------------------------------------
+      ierr(:) = 0
+      ALLOCATE( qsr_top(jpi,jpj), STAT=ierr(1) )
+      oce_trc_alloc  = MAXVAL( ierr )
+      !
+      IF( oce_trc_alloc /= 0 )   CALL ctl_warn('oce_trc_alloc: failed to allocate qsr_top array')
+
+   END FUNCTION oce_trc_alloc
+
 #else
    !!----------------------------------------------------------------------
Index: /branches/2013/dev_r3856_MERCATOR3_QSRMEAN24H/NEMOGCM/NEMO/TOP_SRC/trcini.F90
===================================================================
--- /branches/2013/dev_r3856_MERCATOR3_QSRMEAN24H/NEMOGCM/NEMO/TOP_SRC/trcini.F90	(revision 4159)
+++ /branches/2013/dev_r3856_MERCATOR3_QSRMEAN24H/NEMOGCM/NEMO/TOP_SRC/trcini.F90	(revision 4160)
@@ -31,4 +31,6 @@
    USE trcsub          ! variables to substep passive tracers
    USE lib_mpp         ! distribued memory computing library
+   USE sbc_oce, ONLY : qsr_mean
+   USE sbc_oce, ONLY : qsr
  
    IMPLICIT NONE
@@ -81,4 +83,10 @@
          IF( ierr  > 0 )   CALL ctl_warn('trc_ini: allocation of arrays qsr_mean failed')
 
+         qsr_top => qsr_mean
+
+      ELSE
+
+         qsr_top => qsr
+
       ENDIF
 
@@ -210,4 +218,5 @@
       ierr =        trc_adv_alloc()          ! Start of TOP-related alloc routines...
       ierr = ierr + trc_alloc    ()
+      ierr = ierr + oce_trc_alloc()
       ierr = ierr + trc_nxt_alloc()
       ierr = ierr + trc_zdf_alloc()
Index: /branches/2013/dev_r3856_MERCATOR3_QSRMEAN24H/NEMOGCM/NEMO/TOP_SRC/trcstp.F90
===================================================================
--- /branches/2013/dev_r3856_MERCATOR3_QSRMEAN24H/NEMOGCM/NEMO/TOP_SRC/trcstp.F90	(revision 4159)
+++ /branches/2013/dev_r3856_MERCATOR3_QSRMEAN24H/NEMOGCM/NEMO/TOP_SRC/trcstp.F90	(revision 4160)
@@ -66,8 +66,4 @@
       ENDIF
       !    
-      IF( ln_dm2dc .AND. lk_pisces )THEN
-         qsr(:,:) = qsr_mean(:,:)
-      ENDIF
-      !    
       IF( nn_dttrc /= 1 )   CALL trc_sub_stp( kt )  ! averaging physical variables for sub-stepping
       !    
Index: /branches/2013/dev_r3856_MERCATOR3_QSRMEAN24H/NEMOGCM/NEMO/TOP_SRC/trcsub.F90
===================================================================
--- /branches/2013/dev_r3856_MERCATOR3_QSRMEAN24H/NEMOGCM/NEMO/TOP_SRC/trcsub.F90	(revision 4159)
+++ /branches/2013/dev_r3856_MERCATOR3_QSRMEAN24H/NEMOGCM/NEMO/TOP_SRC/trcsub.F90	(revision 4160)
@@ -27,5 +27,4 @@
    USE divcur          ! hor. divergence and curl      (div & cur routines)
    USE sbcrnf, ONLY: h_rnf, nk_rnf   ! River runoff 
-   USE sbc_oce         ! surface boundary condition: ocean
    USE bdy_oce
 #if defined key_obc
@@ -125,5 +124,5 @@
           emp_tm   (:,:)         = emp_tm   (:,:)         + emp   (:,:) 
           sfx_tm   (:,:)         = sfx_tm   (:,:)         + sfx   (:,:)
-          qsr_tm   (:,:)         = qsr_tm   (:,:)         + qsr   (:,:)
+          qsr_tm   (:,:)         = qsr_tm   (:,:)         + qsr_top(:,:)
           wndm_tm  (:,:)         = wndm_tm  (:,:)         + wndm  (:,:)
           !
@@ -213,5 +212,5 @@
          emp_b_temp (:,:)        = emp_b (:,:)
          sfx_temp   (:,:)        = sfx   (:,:)
-         qsr_temp   (:,:)        = qsr   (:,:)
+         qsr_temp   (:,:)        = qsr_top   (:,:)
          wndm_temp  (:,:)        = wndm  (:,:)
 #if defined key_traldf_c3d
@@ -317,5 +316,5 @@
          emp_tm   (:,:)          = emp_tm     (:,:)       + emp   (:,:) 
          sfx_tm   (:,:)          = sfx_tm     (:,:)       + sfx   (:,:)
-         qsr_tm   (:,:)          = qsr_tm     (:,:)       + qsr   (:,:)
+         qsr_tm   (:,:)          = qsr_tm     (:,:)       + qsr_top (:,:)
          wndm_tm  (:,:)          = wndm_tm    (:,:)       + wndm  (:,:)
          !
@@ -333,5 +332,5 @@
          IF( kt == nittrc000 ) THEN
             wndm  (:,:)          = wndm_tm    (:,:) * r1_ndttrc 
-            qsr   (:,:)          = qsr_tm     (:,:) * r1_ndttrc 
+            qsr_top   (:,:)          = qsr_tm     (:,:) * r1_ndttrc 
             emp   (:,:)          = emp_tm     (:,:) * r1_ndttrc 
             sfx   (:,:)          = sfx_tm     (:,:) * r1_ndttrc 
@@ -349,5 +348,5 @@
          ELSE
             wndm  (:,:)          = wndm_tm    (:,:) * r1_ndttrcp1 
-            qsr   (:,:)          = qsr_tm     (:,:) * r1_ndttrcp1 
+            qsr_top   (:,:)          = qsr_tm     (:,:) * r1_ndttrcp1 
             emp   (:,:)          = emp_tm     (:,:) * r1_ndttrcp1 
             sfx   (:,:)          = sfx_tm     (:,:) * r1_ndttrcp1 
@@ -502,5 +501,5 @@
          CALL lbc_lnk( emp_b (:,:)         , 'T', 1. ) 
          CALL lbc_lnk( sfx   (:,:)         , 'T', 1. ) 
-         CALL lbc_lnk( qsr   (:,:)         , 'T', 1. ) 
+         CALL lbc_lnk( qsr_top   (:,:)         , 'T', 1. ) 
          CALL lbc_lnk( wndm  (:,:)         , 'T', 1. ) 
 # if defined key_trabbl
@@ -710,5 +709,5 @@
       sfx   (:,:)     =  sfx_temp   (:,:)
       emp_b (:,:)     =  emp_b_temp (:,:)
-      qsr   (:,:)     =  qsr_temp   (:,:)
+      qsr_top   (:,:)     =  qsr_temp   (:,:)
       wndm  (:,:)     =  wndm_temp  (:,:)
 # if defined key_trabbl
@@ -828,5 +827,5 @@
       emp_tm     (:,:) = emp   (:,:)
       sfx_tm     (:,:) = sfx   (:,:)
-      qsr_tm     (:,:) = qsr   (:,:)
+      qsr_tm     (:,:) = qsr_top   (:,:)
       wndm_tm    (:,:) = wndm  (:,:)
 # if defined key_trabbl
