Index: /branches/UKMO/dev_r5518_GO6_package_FOAMv14_readchl/NEMOGCM/NEMO/OPA_SRC/TRA/traqsr.F90
===================================================================
--- /branches/UKMO/dev_r5518_GO6_package_FOAMv14_readchl/NEMOGCM/NEMO/OPA_SRC/TRA/traqsr.F90	(revision 14387)
+++ /branches/UKMO/dev_r5518_GO6_package_FOAMv14_readchl/NEMOGCM/NEMO/OPA_SRC/TRA/traqsr.F90	(revision 14388)
@@ -35,5 +35,5 @@
    USE stopack
 #if defined key_medusa
-   USE trc, ONLY: trn      ! MEDUSA variables
+   USE trc, ONLY: trn, chl_for_qsr      ! MEDUSA variables
    USE par_medusa, ONLY: & ! MEDUSA parameters
       & jpchn, &
@@ -221,28 +221,9 @@
                   !
                   CALL fld_read( kt, 1, sf_chl )            ! Read Chl data and provides it at the current time step
-!CDIR NOVERRCHK   !
-                  DO jj = 1, jpj
-!CDIR NOVERRCHK
-                     DO ji = 1, jpi
-                        zchl    = sf_chl(1)%fnow(ji,jj,1)
-                        zCtot   = 40.6  * zchl**0.459
-                        zze     = 568.2 * zCtot**(-0.746)
-                        IF( zze > 102. ) zze = 200.0 * zCtot**(-0.293)
-                        zlogc   = LOG( zchl )
-                        zlogc2  = zlogc * zlogc
-                        zlogc3  = zlogc * zlogc * zlogc
-                        zCb     = 0.768 + 0.087 * zlogc - 0.179 * zlogc2 - 0.025 * zlogc3
-                        zCmax   = 0.299 - 0.289 * zlogc + 0.579 * zlogc2
-                        zpsimax = 0.6   - 0.640 * zlogc + 0.021 * zlogc2 + 0.115 * zlogc3
-                        zdelpsi = 0.710 + 0.159 * zlogc + 0.021 * zlogc2
-                        zCze    = 1.12  * (zchl)**0.803
-                        DO jk = 1, nksr + 1
-                           zpsi = fsdept(ji,jj,jk) / zze
-                           zchl3d(ji,jj,jk) = zCze * ( zCb + zCmax * EXP( -( (zpsi - zpsimax) / zdelpsi )**2 ) )
-                        END DO
-                        !
-                      END DO
-                   END DO
-                     !
+                  DO jk = 1, nksr + 1
+                     zchl3d(:,:,jk) = sf_chl(1)%fnow(:,:,jk)
+                  ENDDO
+                  chl_for_qsr(:,:,:) = zchl3d(:,:,:)
+                  !
                ELSE IF( nn_chldta == 3 ) THEN
                   !
@@ -259,4 +240,9 @@
                   DO jk = 1, nksr + 1
                      zchl3d(:,:,jk) = 0.05
+                  ENDDO
+                  CALL fld_read( kt, 1, sf_chl )            ! Read Chl data and provides it at the current time step
+                  !
+                  DO jk = 1, nksr + 1
+                     chl_for_qsr(:,:,jk) = sf_chl(1)%fnow(:,:,jk)
                   ENDDO
                ENDIF
@@ -559,7 +545,13 @@
                   CALL ctl_stop( 'tra_qsr_init: unable to allocate sf_chl structure' )   ;   RETURN
                ENDIF
-               ALLOCATE( sf_chl(1)%fnow(jpi,jpj,1)   )
-               IF( sn_chl%ln_tint )ALLOCATE( sf_chl(1)%fdta(jpi,jpj,1,2) )
-               !                                        ! fill sf_chl with sn_chl and control print
+               IF( nn_chldta == 1 ) THEN
+                  ALLOCATE( sf_chl(1)%fnow(jpi,jpj,1)   )
+                  IF( sn_chl%ln_tint )ALLOCATE( sf_chl(1)%fdta(jpi,jpj,1,2) )
+                  !                                        ! fill sf_chl with sn_chl and control print
+               ELSE IF( nn_chldta == 2 ) THEN
+                  ALLOCATE( sf_chl(1)%fnow(jpi,jpj,jpk)   )
+                  IF( sn_chl%ln_tint )ALLOCATE( sf_chl(1)%fdta(jpi,jpj,jpk,2) )
+                  !   
+               ENDIF
                CALL fld_fill( sf_chl, (/ sn_chl /), cn_dir, 'tra_qsr_init',   &
                   &                                         'Solar penetration function of read chlorophyll', 'namtra_qsr' )
@@ -568,5 +560,13 @@
                IF(lwp) WRITE(numout,*)
                IF(lwp) WRITE(numout,*) '        Chlorophyll will be taken from model at each time step'
-            ELSE                                !* constant Chl : compute once for all the distribution of light (etot3)
+            ELSE      
+               ALLOCATE( sf_chl(1), STAT=ierror )
+               IF( ierror > 0 ) THEN
+                  CALL ctl_stop( 'tra_qsr_init: unable to allocate sf_chl structure' )   ;   RETURN
+               ENDIF
+               ALLOCATE( sf_chl(1)%fnow(jpi,jpj,jpk)   )
+               IF( sn_chl%ln_tint )ALLOCATE( sf_chl(1)%fdta(jpi,jpj,jpk,2) )
+               CALL fld_fill( sf_chl, (/ sn_chl /), cn_dir, 'tra_qsr_init',   &
+                  &                                         'Solar penetration function of read chlorophyll', 'namtra_qsr' )
                IF(lwp) WRITE(numout,*)
                IF(lwp) WRITE(numout,*) '        Constant Chlorophyll concentration = 0.05'
Index: /branches/UKMO/dev_r5518_GO6_package_FOAMv14_readchl/NEMOGCM/NEMO/TOP_SRC/MEDUSA/trcopt_medusa.F90
===================================================================
--- /branches/UKMO/dev_r5518_GO6_package_FOAMv14_readchl/NEMOGCM/NEMO/TOP_SRC/MEDUSA/trcopt_medusa.F90	(revision 14387)
+++ /branches/UKMO/dev_r5518_GO6_package_FOAMv14_readchl/NEMOGCM/NEMO/TOP_SRC/MEDUSA/trcopt_medusa.F90	(revision 14388)
@@ -126,5 +126,6 @@
             DO jj = 1, jpj
                DO ji = 1, jpi
-                  totchl = trn(ji,jj,jk,jpchn) + trn(ji,jj,jk,jpchd)
+                  !totchl = trn(ji,jj,jk,jpchn) + trn(ji,jj,jk,jpchd)
+                  totchl = chl_for_qsr(ji,jj,jk)
                   totchl = MIN( 10. , MAX( 0.05, totchl ) )
                   irgb = NINT( 41 + 20.* LOG10( totchl ) + 1.e-15 )
Index: /branches/UKMO/dev_r5518_GO6_package_FOAMv14_readchl/NEMOGCM/NEMO/TOP_SRC/trc.F90
===================================================================
--- /branches/UKMO/dev_r5518_GO6_package_FOAMv14_readchl/NEMOGCM/NEMO/TOP_SRC/trc.F90	(revision 14387)
+++ /branches/UKMO/dev_r5518_GO6_package_FOAMv14_readchl/NEMOGCM/NEMO/TOP_SRC/trc.F90	(revision 14388)
@@ -20,4 +20,6 @@
 
    PUBLIC   trc_alloc   ! called by nemogcm.F90
+
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)           ::  chl_for_qsr
 
    !! parameters for the control of passive tracers
@@ -276,5 +278,5 @@
          &      cycletot(6), cycletot2(6)                                             ,       &
 # endif
-         &      ln_trc_ini(jptra)     , ln_trc_wri(jptra)     , qsr_mean(jpi,jpj)     ,  STAT = trc_alloc  )  
+         &      ln_trc_ini(jptra)     , ln_trc_wri(jptra)     , qsr_mean(jpi,jpj), chl_for_qsr(jpi,jpj,jpk)     ,  STAT = trc_alloc  )  
 
       IF( trc_alloc /= 0 )   CALL ctl_warn('trc_alloc: failed to allocate arrays')
