Index: NEMO/branches/2019/dev_r10742_ENHANCE-12_SimonM-Tides/src/OCE/BDY/bdytides.F90
===================================================================
--- NEMO/branches/2019/dev_r10742_ENHANCE-12_SimonM-Tides/src/OCE/BDY/bdytides.F90	(revision 10811)
+++ NEMO/branches/2019/dev_r10742_ENHANCE-12_SimonM-Tides/src/OCE/BDY/bdytides.F90	(revision 10822)
@@ -115,5 +115,5 @@
                     WRITE(numout,*) '             Tidal components: ' 
                DO itide = 1, nb_harmo
-                  WRITE(numout,*)  '                 ', tide_components(itide)%cname_tide 
+                  WRITE(numout,*)  '                 ', tide_harmonics(itide)%cname_tide 
                END DO
             ENDIF 
@@ -156,6 +156,6 @@
                igrd = 1                       ! Everything is at T-points here
                DO itide = 1, nb_harmo
-                  CALL iom_get( inum, jpdom_autoglo, TRIM(tide_components(itide)%cname_tide)//'_z1', ztr(:,:) )
-                  CALL iom_get( inum, jpdom_autoglo, TRIM(tide_components(itide)%cname_tide)//'_z2', zti(:,:) ) 
+                  CALL iom_get( inum, jpdom_autoglo, TRIM(tide_harmonics(itide)%cname_tide)//'_z1', ztr(:,:) )
+                  CALL iom_get( inum, jpdom_autoglo, TRIM(tide_harmonics(itide)%cname_tide)//'_z2', zti(:,:) ) 
                   DO ib = 1, ilen0(igrd)
                      ii = idx_bdy(ib_bdy)%nbi(ib,igrd)
@@ -172,6 +172,6 @@
                igrd = 2                       ! Everything is at U-points here
                DO itide = 1, nb_harmo
-                  CALL iom_get  ( inum, jpdom_autoglo, TRIM(tide_components(itide)%cname_tide)//'_u1', ztr(:,:) )
-                  CALL iom_get  ( inum, jpdom_autoglo, TRIM(tide_components(itide)%cname_tide)//'_u2', zti(:,:) )
+                  CALL iom_get  ( inum, jpdom_autoglo, TRIM(tide_harmonics(itide)%cname_tide)//'_u1', ztr(:,:) )
+                  CALL iom_get  ( inum, jpdom_autoglo, TRIM(tide_harmonics(itide)%cname_tide)//'_u2', zti(:,:) )
                   DO ib = 1, ilen0(igrd)
                      ii = idx_bdy(ib_bdy)%nbi(ib,igrd)
@@ -188,6 +188,6 @@
                igrd = 3                       ! Everything is at V-points here
                DO itide = 1, nb_harmo
-                  CALL iom_get  ( inum, jpdom_autoglo, TRIM(tide_components(itide)%cname_tide)//'_v1', ztr(:,:) )
-                  CALL iom_get  ( inum, jpdom_autoglo, TRIM(tide_components(itide)%cname_tide)//'_v2', zti(:,:) )
+                  CALL iom_get  ( inum, jpdom_autoglo, TRIM(tide_harmonics(itide)%cname_tide)//'_v1', ztr(:,:) )
+                  CALL iom_get  ( inum, jpdom_autoglo, TRIM(tide_harmonics(itide)%cname_tide)//'_v2', zti(:,:) )
                   DO ib = 1, ilen0(igrd)
                      ii = idx_bdy(ib_bdy)%nbi(ib,igrd)
@@ -217,5 +217,5 @@
                DO itide = 1, nb_harmo
                   !                                                              ! SSH fields
-                  clfile = TRIM(filtide)//TRIM(tide_components(itide)%cname_tide)//'_grid_T.nc'
+                  clfile = TRIM(filtide)//TRIM(tide_harmonics(itide)%cname_tide)//'_grid_T.nc'
                   CALL iom_open( clfile, inum )
                   CALL fld_map( inum, 'z1' , dta_read(1:ilen0(1),1:1,1:1) , 1,  ibmap_ptr(1) )
@@ -225,5 +225,5 @@
                   CALL iom_close( inum )
                   !                                                              ! U fields
-                  clfile = TRIM(filtide)//TRIM(tide_components(itide)%cname_tide)//'_grid_U.nc'
+                  clfile = TRIM(filtide)//TRIM(tide_harmonics(itide)%cname_tide)//'_grid_U.nc'
                   CALL iom_open( clfile, inum )
                   CALL fld_map( inum, 'u1' , dta_read(1:ilen0(2),1:1,1:1) , 1, ibmap_ptr(2) )
@@ -233,5 +233,5 @@
                   CALL iom_close( inum )
                   !                                                              ! V fields
-                  clfile = TRIM(filtide)//TRIM(tide_components(itide)%cname_tide)//'_grid_V.nc'
+                  clfile = TRIM(filtide)//TRIM(tide_harmonics(itide)%cname_tide)//'_grid_V.nc'
                   CALL iom_open( clfile, inum )
                   CALL fld_map( inum, 'v1' , dta_read(1:ilen0(3),1:1,1:1) , 1, ibmap_ptr(3) )
@@ -335,5 +335,5 @@
 
       DO itide = 1, nb_harmo
-         z_sarg = z_arg * omega_tide(itide)
+         z_sarg = z_arg * tide_harmonics(itide)%omega
          z_cost(itide) = COS( z_sarg )
          z_sist(itide) = SIN( z_sarg )
@@ -440,5 +440,5 @@
             DO itide = 1, nb_harmo
                !
-               z_sarg = (z_arg + zoff) * omega_tide(itide)
+               z_sarg = (z_arg + zoff) * tide_harmonics(itide)%omega
                z_cost = zramp * COS( z_sarg )
                z_sist = zramp * SIN( z_sarg )
@@ -501,6 +501,6 @@
          END DO
          DO ib = 1 , ilen0(igrd)
-            mod_tide(ib)=mod_tide(ib)*ftide(itide)
-            phi_tide(ib)=phi_tide(ib)+v0tide(itide)+utide(itide)
+            mod_tide(ib)=mod_tide(ib)*tide_harmonics(itide)%f
+            phi_tide(ib)=phi_tide(ib)+tide_harmonics(itide)%v0+tide_harmonics(itide)%u
          ENDDO
          DO ib = 1 , ilen0(igrd)
@@ -540,6 +540,6 @@
          END DO
          DO ib = 1, ilen0(igrd)
-            mod_tide(ib)=mod_tide(ib)*ftide(itide)
-            phi_tide(ib)=phi_tide(ib)+v0tide(itide)+utide(itide)
+            mod_tide(ib)=mod_tide(ib)*tide_harmonics(itide)%f
+            phi_tide(ib)=phi_tide(ib)+tide_harmonics(itide)%v0 + tide_harmonics(itide)%u
          ENDDO
          DO ib = 1, ilen0(igrd)
@@ -561,6 +561,6 @@
          END DO
          DO ib = 1, ilen0(igrd)
-            mod_tide(ib)=mod_tide(ib)*ftide(itide)
-            phi_tide(ib)=phi_tide(ib)+v0tide(itide)+utide(itide)
+            mod_tide(ib)=mod_tide(ib)*tide_harmonics(itide)%f
+            phi_tide(ib)=phi_tide(ib)+tide_harmonics(itide)%v0 + tide_harmonics(itide)%u
          ENDDO
          DO ib = 1, ilen0(igrd)
Index: NEMO/branches/2019/dev_r10742_ENHANCE-12_SimonM-Tides/src/OCE/DIA/diaharm.F90
===================================================================
--- NEMO/branches/2019/dev_r10742_ENHANCE-12_SimonM-Tides/src/OCE/DIA/diaharm.F90	(revision 10811)
+++ NEMO/branches/2019/dev_r10742_ENHANCE-12_SimonM-Tides/src/OCE/DIA/diaharm.F90	(revision 10822)
@@ -39,5 +39,4 @@
 
    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:) ::   ana_temp
-   REAL(wp), ALLOCATABLE, DIMENSION(:)       ::   ana_freq, ut   , vt   , ft
    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:)   ::   out_eta , out_u, out_v
 
@@ -73,4 +72,5 @@
       INTEGER ::   ios                 ! Local integer output status for namelist read
       TYPE(tide), PUBLIC, DIMENSION(:), POINTER ::   tide_components ! Selected tidal components
+      TYPE(tide),         DIMENSION(:), POINTER ::   tide_harmonics  ! Oscillation parameters of selected tidal components
 
       NAMELIST/nam_diaharm/ nit000_han, nitend_han, nstep_han, tname
@@ -127,14 +127,12 @@
       ENDIF
 
-      ! Initialize frequency array:
-      ! ---------------------------
-      ALLOCATE( ana_freq(nb_ana), ut(nb_ana), vt(nb_ana), ft(nb_ana) )
-
-      CALL tide_harmo( ana_freq, vt, ut, ft, nb_ana )
+      ! Initialize oscillation parameters of selected tidal components
+      ! --------------------------------------------------------------
+      CALL tide_init_harmonics( tide_components, tide_harmonics)
 
       IF(lwp) WRITE(numout,*) 'Analysed frequency  : ',nb_ana ,'Frequency '
 
       DO jh = 1, nb_ana
-        IF(lwp) WRITE(numout,*) '                    : ',tname(jh),' ',ana_freq(jh)
+        IF(lwp) WRITE(numout,*) '                    : ',tname(jh),' ',tide_harmonics(jh)%omega
       END DO
 
@@ -173,6 +171,8 @@
             DO jc = 1, 2
                nhc = nhc+1
-               ztemp =(     MOD(jc,2) * ft(jh) *COS(ana_freq(jh)*ztime + vt(jh) + ut(jh))  &
-                  &    +(1.-MOD(jc,2))* ft(jh) *SIN(ana_freq(jh)*ztime + vt(jh) + ut(jh)))
+               ztemp =(     MOD(jc,2) * tide_harmonics(jh)%f *COS(tide_harmonics(jh)%omega*ztime + &
+                  &                                 tide_harmonics(jh)%v0 + tide_harmonics(jh)%u)  &
+                  &    +(1.-MOD(jc,2))* tide_harmonics(jh)%f *SIN(tide_harmonics(jh)%omega*ztime + &
+                  &                                 tide_harmonics(jh)%v0 + tide_harmonics(jh)%u))
                   !
                DO jj = 1,jpj
@@ -235,6 +235,8 @@
                nisparse(ksp) = keq
                njsparse(ksp) = kun
-               valuesparse(ksp) = (   MOD(jc,2) * ft(jh) * COS(ana_freq(jh)*ztime + vt(jh) + ut(jh))   &
-                  &             + (1.-MOD(jc,2))* ft(jh) * SIN(ana_freq(jh)*ztime + vt(jh) + ut(jh)) )
+               valuesparse(ksp) = (   MOD(jc,2) * tide_harmonics(jh)%f * COS(tide_harmonics(jh)%omega*ztime &
+                  &                                          + tide_harmonics(jh)%v0 + tide_harmonics(jh)%u)   &
+                  &             + (1.-MOD(jc,2))* tide_harmonics(jh)%f * SIN(tide_harmonics(jh)%omega*ztime &
+                  &                                          + tide_harmonics(jh)%v0 + tide_harmonics(jh)%u) )
             END DO
          END DO
Index: NEMO/branches/2019/dev_r10742_ENHANCE-12_SimonM-Tides/src/OCE/SBC/sbctide.F90
===================================================================
--- NEMO/branches/2019/dev_r10742_ENHANCE-12_SimonM-Tides/src/OCE/SBC/sbctide.F90	(revision 10811)
+++ NEMO/branches/2019/dev_r10742_ENHANCE-12_SimonM-Tides/src/OCE/SBC/sbctide.F90	(revision 10822)
@@ -61,5 +61,5 @@
             kt_tide = kt 
          ENDIF
-         CALL tide_harmo( omega_tide, v0tide, utide, ftide, nb_harmo )
+         CALL tide_harmo(tide_components, tide_harmonics) ! Update oscillation parameters of tidal components
          !
          !
@@ -69,5 +69,6 @@
             WRITE(numout,*) '~~~~~~~~ '
             DO jk = 1, nb_harmo
-               WRITE(numout,*) tide_components(jk)%cname_tide, utide(jk), ftide(jk), v0tide(jk), omega_tide(jk)
+               WRITE(numout,*) tide_harmonics(jk)%cname_tide, tide_harmonics(jk)%u, &
+                  &            tide_harmonics(jk)%f,tide_harmonics(jk)%v0, tide_harmonics(jk)%omega
             END DO
          ENDIF
Index: NEMO/branches/2019/dev_r10742_ENHANCE-12_SimonM-Tides/src/OCE/TDE/tide_mod.F90
===================================================================
--- NEMO/branches/2019/dev_r10742_ENHANCE-12_SimonM-Tides/src/OCE/TDE/tide_mod.F90	(revision 10811)
+++ NEMO/branches/2019/dev_r10742_ENHANCE-12_SimonM-Tides/src/OCE/TDE/tide_mod.F90	(revision 10822)
@@ -22,4 +22,5 @@
    PUBLIC   tide_harmo       ! called by tideini and diaharm modules
    PUBLIC   tide_init_components ! called internally and by module diaharm
+   PUBLIC   tide_init_harmonics  ! called internally and by module diaharm
    PUBLIC   tide_init_load
    PUBLIC   tide_init_potential
@@ -39,8 +40,14 @@
    TYPE(tide), PUBLIC, DIMENSION(:), POINTER ::   tide_components !: Array of selected tidal component parameters
 
-   REAL(wp), PUBLIC, ALLOCATABLE, DIMENSION(:) ::   omega_tide   !:
-   REAL(wp), PUBLIC, ALLOCATABLE, DIMENSION(:) ::   v0tide       !:
-   REAL(wp), PUBLIC, ALLOCATABLE, DIMENSION(:) ::   utide        !:
-   REAL(wp), PUBLIC, ALLOCATABLE, DIMENSION(:) ::   ftide        !:
+   TYPE, PUBLIC ::   tide_harmonic       !:   Oscillation parameters of harmonic tidal components
+      CHARACTER(LEN=4) ::   cname_tide   !    Name of component
+      REAL(wp)         ::   equitide     !    Amplitude of equilibrium tide
+      REAL(wp)         ::   f            !    Node factor
+      REAL(wp)         ::   omega        !    Angular velocity
+      REAL(wp)         ::   v0           !    Initial phase at prime meridian
+      REAL(wp)         ::   u            !    Phase correction
+   END type tide_harmonic
+
+   TYPE(tide_harmonic), PUBLIC, DIMENSION(:), POINTER ::   tide_harmonics !: Oscillation parameters of selected tidal components
 
    LOGICAL , PUBLIC ::   ln_tide         !:
@@ -140,6 +147,9 @@
          &   CALL ctl_stop('rn_tide_ramp_dt must be positive')
       !
-      ALLOCATE( omega_tide(nb_harmo), v0tide    (nb_harmo),   &
-         &      utide     (nb_harmo), ftide     (nb_harmo)  )
+      ! Initialise array used to store tidal oscillation parameters (frequency,
+      ! amplitude, phase)
+      CALL tide_init_harmonics(tide_components, tide_harmonics)
+      !
+      ! Reference time step for time-dependent tidal parameters
       kt_tide = nit000
       !
@@ -209,4 +219,24 @@
 
 
+   SUBROUTINE tide_init_harmonics(ptide_comp, ptide_harmo)
+      !!----------------------------------------------------------------------
+      !!                 ***  ROUTINE tide_init_harmonics  ***
+      !!
+      !! Returns pointer to array of variables of type 'tide_harmonics' that
+      !! contain oscillation parameters of the selected harmonic tidal
+      !! components
+      !! ----------------------------------------------------------------------
+      TYPE(tide),          POINTER,     DIMENSION(:) ::   ptide_comp      ! Selected components
+      TYPE(tide_harmonic), POINTER,     DIMENSION(:) ::   ptide_harmo     ! Oscillation parameters of selected components
+
+      ! Allocate and populate array of oscillation parameters
+      ALLOCATE(ptide_harmo(size(ptide_comp)))
+      ptide_harmo(:)%cname_tide = ptide_comp(:)%cname_tide
+      ptide_harmo(:)%equitide = ptide_comp(:)%equitide
+      CALL tide_harmo(ptide_comp, ptide_harmo)
+
+   END SUBROUTINE tide_init_harmonics
+
+
    SUBROUTINE tide_init_potential
       !!----------------------------------------------------------------------
@@ -218,12 +248,14 @@
 
       DO jk = 1, nb_harmo
-         zcons = rn_tide_gamma * tide_components(jk)%equitide * ftide(jk)
+         zcons = rn_tide_gamma * tide_components(jk)%equitide * tide_harmonics(jk)%f
          DO ji = 1, jpi
             DO jj = 1, jpj
-               ztmp1 =  ftide(jk) * amp_pot(ji,jj,jk) * COS( phi_pot(ji,jj,jk) + v0tide(jk) + utide(jk) )
-               ztmp2 = -ftide(jk) * amp_pot(ji,jj,jk) * SIN( phi_pot(ji,jj,jk) + v0tide(jk) + utide(jk) )
+               ztmp1 =  tide_harmonics(jk)%f * amp_pot(ji,jj,jk) * COS( phi_pot(ji,jj,jk) &
+                  &                                                   + tide_harmonics(jk)%v0 + tide_harmonics(jk)%u )
+               ztmp2 = -tide_harmonics(jk)%f * amp_pot(ji,jj,jk) * SIN( phi_pot(ji,jj,jk) &
+                  &                                                   + tide_harmonics(jk)%v0 + tide_harmonics(jk)%u )
                zlat = gphit(ji,jj)*rad !! latitude en radian
                zlon = glamt(ji,jj)*rad !! longitude en radian
-               ztmp = v0tide(jk) + utide(jk) + tide_components(jk)%nutide * zlon
+               ztmp = tide_harmonics(jk)%v0 + tide_harmonics(jk)%u + tide_components(jk)%nutide * zlon
                ! le potentiel est composé des effets des astres:
                IF    ( tide_components(jk)%nutide == 1 )  THEN  ;  zcs = zcons * SIN( 2._wp*zlat )
@@ -277,15 +309,12 @@
 
 
-   SUBROUTINE tide_harmo( pomega, pvt, put , pcor, kc)
-      !!----------------------------------------------------------------------
-      !!----------------------------------------------------------------------
-      INTEGER                , INTENT(in ) ::   kc               ! Total number of tidal constituents
-      REAL(wp), DIMENSION(kc), INTENT(out) ::   pomega           ! pulsation in radians/s
-      REAL(wp), DIMENSION(kc), INTENT(out) ::   pvt, put, pcor   !
-      !!----------------------------------------------------------------------
+   SUBROUTINE tide_harmo( ptide_comp, ptide_harmo )
+      !
+      TYPE(tide),          DIMENSION(:), POINTER ::   ptide_comp   ! Array of selected tidal component parameters
+      TYPE(tide_harmonic), DIMENSION(:), POINTER ::   ptide_harmo  ! Oscillation parameters of selected tidal components
       !
       CALL astronomic_angle
-      CALL tide_pulse( pomega, kc )
-      CALL tide_vuf  ( pvt, put, pcor, kc )
+      CALL tide_pulse( ptide_comp, ptide_harmo )
+      CALL tide_vuf(   ptide_comp, ptide_harmo )
       !
    END SUBROUTINE tide_harmo
@@ -383,5 +412,5 @@
 
 
-   SUBROUTINE tide_pulse( pomega, kc )
+   SUBROUTINE tide_pulse( ptide_comp, ptide_harmo )
       !!----------------------------------------------------------------------
       !!                     ***  ROUTINE tide_pulse  ***
@@ -389,6 +418,6 @@
       !! ** Purpose : Compute tidal frequencies
       !!----------------------------------------------------------------------
-      INTEGER                , INTENT(in ) ::   kc       ! Total number of tidal constituents
-      REAL(wp), DIMENSION(kc), INTENT(out) ::   pomega   ! pulsation in radians/s
+      TYPE(tide),          DIMENSION(:), POINTER ::   ptide_comp   ! Array of selected tidal component parameters
+      TYPE(tide_harmonic), DIMENSION(:), POINTER ::   ptide_harmo  ! Oscillation parameters of selected tidal components
       !
       INTEGER  ::   jh
@@ -404,10 +433,10 @@
       zscale =  rad / ( 36525._wp * 86400._wp ) 
       !
-      DO jh = 1, kc
-         pomega(jh) = (  zomega_T * tide_components( jh )%nT   &
-            &          + zomega_s * tide_components( jh )%ns   &
-            &          + zomega_h * tide_components( jh )%nh   &
-            &          + zomega_p * tide_components( jh )%np   &
-            &          + zomega_p1* tide_components( jh )%np1  ) * zscale
+      DO jh = 1, nb_harmo
+         ptide_harmo(jh)%omega = (  zomega_T * ptide_comp( jh )%nT   &
+            &                         + zomega_s * ptide_comp( jh )%ns   &
+            &                         + zomega_h * ptide_comp( jh )%nh   &
+            &                         + zomega_p * ptide_comp( jh )%np   &
+            &                         + zomega_p1* ptide_comp( jh )%np1  ) * zscale
       END DO
       !
@@ -415,5 +444,5 @@
 
 
-   SUBROUTINE tide_vuf( pvt, put, pcor, kc )
+   SUBROUTINE tide_vuf( ptide_comp, ptide_harmo )
       !!----------------------------------------------------------------------
       !!                     ***  ROUTINE tide_vuf  ***
@@ -425,29 +454,29 @@
       !!              ft: Nodal correction factor
       !!----------------------------------------------------------------------
-      INTEGER                , INTENT(in ) ::   kc               ! Total number of tidal constituents
-      REAL(wp), DIMENSION(kc), INTENT(out) ::   pvt, put, pcor   !
+      TYPE(tide),          DIMENSION(:), POINTER ::   ptide_comp   ! Array of selected tidal component parameters
+      TYPE(tide_harmonic), DIMENSION(:), POINTER ::   ptide_harmo  ! Oscillation parameters of selected tidal components
       !
       INTEGER ::   jh   ! dummy loop index
       !!----------------------------------------------------------------------
       !
-      DO jh = 1, kc
+      DO jh = 1, nb_harmo
          !  Phase of the tidal potential relative to the Greenwhich 
          !  meridian (e.g. the position of the fictuous celestial body). Units are radian:
-         pvt(jh) = sh_T * tide_components( jh )%nT    &
-            &    + sh_s * tide_components( jh )%ns    &
-            &    + sh_h * tide_components( jh )%nh    &
-            &    + sh_p * tide_components( jh )%np    &
-            &    + sh_p1* tide_components( jh )%np1   &
-            &    +        tide_components( jh )%shift * rad
+         ptide_harmo(jh)%v0 = sh_T * ptide_comp( jh )%nT    &
+            &                   + sh_s * ptide_comp( jh )%ns    &
+            &                   + sh_h * ptide_comp( jh )%nh    &
+            &                   + sh_p * ptide_comp( jh )%np    &
+            &                   + sh_p1* ptide_comp( jh )%np1   &
+            &                   +        ptide_comp( jh )%shift * rad
          !
          !  Phase correction u due to nodal motion. Units are radian:
-         put(jh) = sh_xi     * tide_components( jh )%nksi   &
-            &    + sh_nu     * tide_components( jh )%nnu0   &
-            &    + sh_nuprim * tide_components( jh )%nnu1   &
-            &    + sh_nusec  * tide_components( jh )%nnu2   &
-            &    + sh_R      * tide_components( jh )%R
+         ptide_harmo(jh)%u = sh_xi     * ptide_comp( jh )%nksi   &
+            &                  + sh_nu     * ptide_comp( jh )%nnu0   &
+            &                  + sh_nuprim * ptide_comp( jh )%nnu1   &
+            &                  + sh_nusec  * ptide_comp( jh )%nnu2   &
+            &                  + sh_R      * ptide_comp( jh )%R
 
          !  Nodal correction factor:
-         pcor(jh) = nodal_factort( tide_components( jh )%nformula )
+         ptide_harmo(jh)%f = nodal_factort( ptide_comp( jh )%nformula )
       END DO
       !
@@ -672,5 +701,5 @@
       ENDIF
       !
-      zwt(:) = omega_tide(:) * zt
+      zwt(:) = tide_harmonics(:)%omega * zt
 
       pot_astro(:,:) = 0._wp          ! update tidal potential (sum of all harmonics)
