Index: branches/2017/dev_r7881_ENHANCE09_RK3/NEMOGCM/NEMO/RK3_SRC/TRA/traqsr.F90
===================================================================
--- branches/2017/dev_r7881_ENHANCE09_RK3/NEMOGCM/NEMO/RK3_SRC/TRA/traqsr.F90	(revision 8367)
+++ branches/2017/dev_r7881_ENHANCE09_RK3/NEMOGCM/NEMO/RK3_SRC/TRA/traqsr.F90	(revision 8568)
@@ -29,10 +29,9 @@
    USE in_out_manager ! I/O manager
    USE prtctl         ! Print control
-   USE iom            ! I/O manager
+   USE iom            ! I/O library
    USE fldread        ! read input fields
    USE restart        ! ocean restart
    USE lib_mpp        ! MPP library
    USE lbclnk         ! ocean lateral boundary conditions (or mpp link)
-   USE wrk_nemo       ! Memory Allocation
    USE timing         ! Timing
 
@@ -113,10 +112,10 @@
       REAL(wp) ::   zCb, zCmax, zze, zpsi, zpsimax, zdelpsi, zCtot, zCze
       REAL(wp) ::   zlogc, zlogc2, zlogc3 
-      REAL(wp), POINTER, DIMENSION(:,:)   :: zekb, zekg, zekr
-      REAL(wp), POINTER, DIMENSION(:,:,:) :: ze0, ze1, ze2, ze3, zea, ztrdt
-      REAL(wp), POINTER, DIMENSION(:,:,:) :: zetot, zchl3d
-      !!----------------------------------------------------------------------
-      !
-      IF( nn_timing == 1 )  CALL timing_start('tra_qsr')
+      REAL(wp), ALLOCATABLE, DIMENSION(:,:)   :: zekb, zekg, zekr
+      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) :: ze0, ze1, ze2, ze3, zea, ztrdt
+      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) :: zetot, zchl3d
+      !!----------------------------------------------------------------------
+      !
+      IF( ln_timing )   CALL timing_start('tra_qsr')
       !
       IF( kt == nit000 ) THEN
@@ -127,5 +126,5 @@
       !
       IF( l_trdtra ) THEN      ! trends diagnostic: save the input temperature trend
-         CALL wrk_alloc( jpi,jpj,jpk,   ztrdt ) 
+         ALLOCATE( ztrdt(jpi,jpj,jpk) ) 
          ztrdt(:,:,:) = tsa(:,:,:,jp_tem)
       ENDIF
@@ -161,6 +160,7 @@
       CASE( np_RGB , np_RGBc )         !==  R-G-B fluxes  ==!
          !
-         CALL wrk_alloc( jpi,jpj,       zekb, zekg, zekr        ) 
-         CALL wrk_alloc( jpi,jpj,jpk,   ze0, ze1, ze2, ze3, zea, zchl3d ) 
+         ALLOCATE( zekb(jpi,jpj)     , zekg(jpi,jpj)     , zekr  (jpi,jpj)     , &
+            &      ze0 (jpi,jpj,jpk) , ze1 (jpi,jpj,jpk) , ze2   (jpi,jpj,jpk) , &
+            &      ze3 (jpi,jpj,jpk) , zea (jpi,jpj,jpk) , zchl3d(jpi,jpj,jpk)   ) 
          !
          IF( nqsr == np_RGBc ) THEN          !*  Variable Chlorophyll
@@ -240,6 +240,5 @@
          END DO
          !
-         CALL wrk_dealloc( jpi,jpj,        zekb, zekg, zekr        ) 
-         CALL wrk_dealloc( jpi,jpj,jpk,   ze0, ze1, ze2, ze3, zea, zchl3d ) 
+         DEALLOCATE( zekb , zekg , zekr , ze0 , ze1 , ze2 , ze3 , zea , zchl3d ) 
          !
       CASE( np_2BD  )            !==  2-bands fluxes  ==!
@@ -282,13 +281,11 @@
       !
       IF( iom_use('qsr3d') ) THEN      ! output the shortwave Radiation distribution
-         CALL wrk_alloc( jpi,jpj,jpk,   zetot )
-         !
+         ALLOCATE( zetot(jpi,jpj,jpk) )
          zetot(:,:,nksr+1:jpk) = 0._wp     ! below ~400m set to zero
          DO jk = nksr, 1, -1
-            zetot(:,:,jk) = zetot(:,:,jk+1) + qsr_hc(:,:,jk) / r1_rau0_rcp
+            zetot(:,:,jk) = zetot(:,:,jk+1) + qsr_hc(:,:,jk) * rau0_rcp
          END DO         
          CALL iom_put( 'qsr3d', zetot )   ! 3D distribution of shortwave Radiation
-         !
-         CALL wrk_dealloc( jpi,jpj,jpk,   zetot ) 
+         DEALLOCATE( zetot ) 
       ENDIF
       !
@@ -301,10 +298,10 @@
          ztrdt(:,:,:) = tsa(:,:,:,jp_tem) - ztrdt(:,:,:)
          CALL trd_tra( kt, 'TRA', jp_tem, jptra_qsr, ztrdt )
-         CALL wrk_dealloc( jpi,jpj,jpk,   ztrdt ) 
+         DEALLOCATE( ztrdt ) 
       ENDIF
       !                       ! print mean trends (used for debugging)
       IF(ln_ctl)   CALL prt_ctl( tab3d_1=tsa(:,:,:,jp_tem), clinfo1=' qsr  - Ta: ', mask1=tmask, clinfo3='tra-ta' )
       !
-      IF( nn_timing == 1 )  CALL timing_stop('tra_qsr')
+      IF( ln_timing )   CALL timing_stop('tra_qsr')
       !
    END SUBROUTINE tra_qsr
@@ -340,5 +337,5 @@
       !!----------------------------------------------------------------------
       !
-      IF( nn_timing == 1 )   CALL timing_start('tra_qsr_init')
+      IF( ln_timing )   CALL timing_start('tra_qsr_init')
       !
       REWIND( numnam_ref )              ! Namelist namtra_qsr in reference     namelist
@@ -435,5 +432,5 @@
       ENDIF
       !
-      IF( nn_timing == 1 )   CALL timing_stop('tra_qsr_init')
+      IF( ln_timing )   CALL timing_stop('tra_qsr_init')
       !
    END SUBROUTINE tra_qsr_init
