Index: /NEMO/releases/r4.0/r4.0-HEAD/cfgs/SHARED/namelist_top_ref
===================================================================
--- /NEMO/releases/r4.0/r4.0-HEAD/cfgs/SHARED/namelist_top_ref	(revision 15612)
+++ /NEMO/releases/r4.0/r4.0-HEAD/cfgs/SHARED/namelist_top_ref	(revision 15613)
@@ -100,4 +100,9 @@
 /
 !-----------------------------------------------------------------------
+&namtrc_opt      !  Optical
+!-----------------------------------------------------------------------
+   ln_trcdc2dm   =  .false.   !  Diurnal cycle for TOP
+/
+!-----------------------------------------------------------------------
 &namtrc_dmp      !   passive tracer newtonian damping                   (ln_trcdmp=T)
 !-----------------------------------------------------------------------
Index: /NEMO/releases/r4.0/r4.0-HEAD/src/OCE/SBC/sbcblk.F90
===================================================================
--- /NEMO/releases/r4.0/r4.0-HEAD/src/OCE/SBC/sbcblk.F90	(revision 15612)
+++ /NEMO/releases/r4.0/r4.0-HEAD/src/OCE/SBC/sbcblk.F90	(revision 15613)
@@ -40,4 +40,5 @@
    USE fldread        ! read input fields
    USE sbc_oce        ! Surface boundary condition: ocean fields
+   USE trc_oce         ! share SMS/Ocean variables
    USE cyclone        ! Cyclone 10m wind form trac of cyclone centres
    USE sbcdcy         ! surface boundary condition: diurnal cycle
@@ -441,4 +442,12 @@
       ELSE                  ;   qsr(:,:) = zztmp *          sf(jp_qsr)%fnow(:,:,1)   * tmask(:,:,1)
       ENDIF
+
+#if defined key_top
+      IF( ln_trcdc2dm )  THEN      !  diurnal cycle in TOP
+         IF( ln_dm2dc )  THEN  ;  qsr_mean(:,:) = zztmp * sf(jp_qsr)%fnow(:,:,1)  * tmask(:,:,1)
+         ELSE                  ;  ncpl_qsr_freq = sf(jp_qsr)%freqh * 3600 !   qsr_mean will be computed in TOP
+         ENDIF
+      ENDIF
+#endif
 
       zqlw(:,:) = (  sf(jp_qlw)%fnow(:,:,1) - Stef * zst(:,:)*zst(:,:)*zst(:,:)*zst(:,:)  ) * tmask(:,:,1)   ! Long  Wave
Index: /NEMO/releases/r4.0/r4.0-HEAD/src/OCE/SBC/sbccpl.F90
===================================================================
--- /NEMO/releases/r4.0/r4.0-HEAD/src/OCE/SBC/sbccpl.F90	(revision 15612)
+++ /NEMO/releases/r4.0/r4.0-HEAD/src/OCE/SBC/sbccpl.F90	(revision 15613)
@@ -1153,5 +1153,4 @@
          IF( ln_dm2dc .AND. ncpl_qsr_freq /= 86400 )   &
             &   CALL ctl_stop( 'sbc_cpl_rcv: diurnal cycle reconstruction (ln_dm2dc) needs daily couping for solar radiation' )
-         ncpl_qsr_freq = 86400 / ncpl_qsr_freq   ! used by top
       ENDIF
       !
Index: /NEMO/releases/r4.0/r4.0-HEAD/src/OCE/SBC/sbcflx.F90
===================================================================
--- /NEMO/releases/r4.0/r4.0-HEAD/src/OCE/SBC/sbcflx.F90	(revision 15612)
+++ /NEMO/releases/r4.0/r4.0-HEAD/src/OCE/SBC/sbcflx.F90	(revision 15613)
@@ -15,4 +15,5 @@
    USE dom_oce         ! ocean space and time domain
    USE sbc_oce         ! surface boundary condition: ocean fields
+   USE trc_oce         ! share SMS/Ocean variables
    USE sbcdcy          ! surface boundary condition: diurnal cycle on qsr
    USE phycst          ! physical constants
@@ -132,4 +133,11 @@
          ELSE                  ;   qsr(:,:) =          sf(jp_qsr)%fnow(:,:,1)   * tmask(:,:,1)
          ENDIF
+#if defined key_top
+      IF( ln_trcdc2dm )  THEN      !  diurnal cycle in TOP
+         IF( ln_dm2dc )  THEN  ;  qsr_mean(:,:) = sf(jp_qsr)%fnow(:,:,1)  * tmask(:,:,1)
+         ELSE                  ;  ncpl_qsr_freq = sf(jp_qsr)%freqh * 3600 !  qsr_mean will be computed in TOP
+         ENDIF
+      ENDIF
+#endif         
          DO jj = 1, jpj                                           ! set the ocean fluxes from read fields
             DO ji = 1, jpi
Index: /NEMO/releases/r4.0/r4.0-HEAD/src/OCE/trc_oce.F90
===================================================================
--- /NEMO/releases/r4.0/r4.0-HEAD/src/OCE/trc_oce.F90	(revision 15612)
+++ /NEMO/releases/r4.0/r4.0-HEAD/src/OCE/trc_oce.F90	(revision 15613)
@@ -28,7 +28,9 @@
    INTEGER , PUBLIC ::   nn_dttrc              !: frequency of step on passive tracers
    REAL(wp), PUBLIC ::   r_si2                 !: largest depth of extinction (blue & 0.01 mg.m-3)  (RGB)
+   LOGICAL , PUBLIC ::   ln_trcdc2dm           !: Diurnal cycle for TOP
    !
-   REAL(wp), PUBLIC, SAVE, ALLOCATABLE, DIMENSION(:,:,:) ::   etot3     !: light absortion coefficient
-   REAL(wp), PUBLIC, SAVE, ALLOCATABLE, DIMENSION(:,:)   ::   oce_co2   !: ocean carbon flux
+   REAL(wp), PUBLIC, SAVE, ALLOCATABLE, DIMENSION(:,:,:) ::  etot3     !: light absortion coefficient
+   REAL(wp), PUBLIC, SAVE, ALLOCATABLE, DIMENSION(:,:)   ::  oce_co2   !: ocean carbon flux
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::  qsr_mean  !: daily mean qsr
 
 #if defined key_top 
@@ -54,5 +56,5 @@
       !!                  ***  trc_oce_alloc  ***
       !!----------------------------------------------------------------------
-      ALLOCATE( etot3(jpi,jpj,jpk), oce_co2(jpi,jpj), STAT=trc_oce_alloc )
+      ALLOCATE( etot3(jpi,jpj,jpk), oce_co2(jpi,jpj), qsr_mean(jpi,jpj), STAT=trc_oce_alloc )
       IF( trc_oce_alloc /= 0 )   CALL ctl_warn('trc_oce_alloc: failed to allocate etot3 array')
       !
Index: /NEMO/releases/r4.0/r4.0-HEAD/src/OFF/dtadyn.F90
===================================================================
--- /NEMO/releases/r4.0/r4.0-HEAD/src/OFF/dtadyn.F90	(revision 15612)
+++ /NEMO/releases/r4.0/r4.0-HEAD/src/OFF/dtadyn.F90	(revision 15613)
@@ -410,4 +410,6 @@
       IF(lwp) WRITE(numout,*) ' max depht of runoff : ', hrnf_max,'    max level  : ', nkrnf_max
       IF(lwp) WRITE(numout,*) ' '
+      !
+      ncpl_qsr_freq = sf_dyn(jf_qsr)%freqh  * 3600   !  Get qsr frequency ( needed if diurnal cycle in TOP )
       !
       CALL dta_dyn( nit000 )
Index: /NEMO/releases/r4.0/r4.0-HEAD/src/TOP/PISCES/P4Z/p4zopt.F90
===================================================================
--- /NEMO/releases/r4.0/r4.0-HEAD/src/TOP/PISCES/P4Z/p4zopt.F90	(revision 15612)
+++ /NEMO/releases/r4.0/r4.0-HEAD/src/TOP/PISCES/P4Z/p4zopt.F90	(revision 15613)
@@ -96,5 +96,5 @@
       !                                        !* Photosynthetically Available Radiation (PAR)
       !                                        !  --------------------------------------
-      IF( l_trcdm2dc ) THEN                     !  diurnal cycle
+      IF( ln_trcdc2dm ) THEN                     !  diurnal cycle
          !
          zqsr_corr(:,:) = qsr_mean(:,:) / ( 1.-fr_i(:,:) + rtrn )
Index: /NEMO/releases/r4.0/r4.0-HEAD/src/TOP/trc.F90
===================================================================
--- /NEMO/releases/r4.0/r4.0-HEAD/src/TOP/trc.F90	(revision 15612)
+++ /NEMO/releases/r4.0/r4.0-HEAD/src/TOP/trc.F90	(revision 15613)
@@ -49,5 +49,4 @@
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)   ::  gtrui          !: hor. gradient at u-points at top    ocean level
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)   ::  gtrvi          !: hor. gradient at v-points at top    ocean level
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)     ::  qsr_mean        !: daily mean qsr
    
    !! passive tracers  (input and output)
@@ -153,5 +152,5 @@
          &      trc_ice_ratio(jptra)  , trc_ice_prescr(jptra) , cn_trc_o(jptra)       ,       &
          &      sbc_trc_b(jpi,jpj,jptra), sbc_trc(jpi,jpj,jptra)                      ,       &  
-         &      cvol(jpi,jpj,jpk)     , trai(jptra)           , qsr_mean(jpi,jpj)     ,       &
+         &      cvol(jpi,jpj,jpk)     , trai(jptra)                                   ,       &
          &      ctrcnm(jptra)         , ctrcln(jptra)         , ctrcun(jptra)         ,       &
          &      ln_trc_ini(jptra)     ,                                                       &
Index: /NEMO/releases/r4.0/r4.0-HEAD/src/TOP/trcnam.F90
===================================================================
--- /NEMO/releases/r4.0/r4.0-HEAD/src/TOP/trcnam.F90	(revision 15612)
+++ /NEMO/releases/r4.0/r4.0-HEAD/src/TOP/trcnam.F90	(revision 15613)
@@ -85,4 +85,6 @@
         WRITE(numout,*) '   ==>>>   Passive Tracer  time step    rdttrc = nn_dttrc*rdt = ', rdttrc
       ENDIF
+      !
+                            CALL trc_nam_opt    ! Optical
       !
       IF( l_trdtrc )        CALL trc_nam_trd    ! Passive tracer trends
@@ -236,4 +238,36 @@
    END SUBROUTINE trc_nam_trc
 
+   SUBROUTINE trc_nam_opt
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE trc_nam_opt  ***
+      !!
+      !! ** Purpose :   read options for the passive tracer diagnostics
+      !!
+      !!---------------------------------------------------------------------
+      INTEGER  ::   ios, ierr                 ! Local integer
+      !!
+      NAMELIST/namtrc_opt/ ln_trcdc2dm
+      !!---------------------------------------------------------------------
+      !
+      IF(lwp) WRITE(numout,*)
+      IF(lwp) WRITE(numout,*) 'trc_nam_opt : read the passive tracer optical options'
+      IF(lwp) WRITE(numout,*) '~~~~~~~~~~~'
+      !
+      !
+      REWIND( numnat_ref )              ! Namelist namtrc_opt in reference namelist : Passive tracer trends
+      READ  ( numnat_ref, namtrc_opt, IOSTAT = ios, ERR = 905)
+905   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namtrc_opt in reference namelist' )
+      REWIND( numnat_cfg )              ! Namelist namtrc_trd in configuration namelist : Passive tracer trends
+      READ  ( numnat_cfg, namtrc_opt, IOSTAT = ios, ERR = 906 )
+906   IF( ios >  0 )   CALL ctl_nam ( ios , 'namtrc_opt in configuration namelist' )
+      IF(lwm) WRITE( numont, namtrc_opt )
+
+      IF(lwp) THEN
+         WRITE(numout,*) '   Namelist : namtrc_opt                    '
+         WRITE(numout,*) '      Diurnal cycle for TOP ln_trcdc2dm    = ', ln_trcdc2dm
+      ENDIF
+
+   END SUBROUTINE trc_nam_opt
+
 
    SUBROUTINE trc_nam_trd
Index: /NEMO/releases/r4.0/r4.0-HEAD/src/TOP/trcstp.F90
===================================================================
--- /NEMO/releases/r4.0/r4.0-HEAD/src/TOP/trcstp.F90	(revision 15612)
+++ /NEMO/releases/r4.0/r4.0-HEAD/src/TOP/trcstp.F90	(revision 15613)
@@ -134,6 +134,5 @@
       !
       ! Define logical parameter ton control dirunal cycle in TOP
-      l_trcdm2dc = ln_dm2dc .OR. ( ln_cpl .AND. ncpl_qsr_freq /= 1 )
-      l_trcdm2dc = l_trcdm2dc  .AND. .NOT. l_offline
+      l_trcdm2dc = ( ln_trcdc2dm .AND. .NOT. ln_dm2dc  ) 
       IF( l_trcdm2dc .AND. lwp )   CALL ctl_warn( 'Coupling with passive tracers and used of diurnal cycle.',   &
          &                           'Computation of a daily mean shortwave for some biogeochemical models ' )
@@ -165,11 +164,6 @@
       !
       IF( kt == nittrc000 ) THEN
-         IF( ln_cpl )  THEN  
-            rdt_sampl = rday / ncpl_qsr_freq
-            nb_rec_per_day = ncpl_qsr_freq
-         ELSE  
-            rdt_sampl = MAX( 3600., rdttrc )
-            nb_rec_per_day = INT( rday / rdt_sampl )
-         ENDIF
+         rdt_sampl = REAL( ncpl_qsr_freq )
+         nb_rec_per_day = INT( rday / ncpl_qsr_freq )
          !
          IF(lwp) THEN
