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 10839)
+++ /NEMO/branches/2019/dev_r10742_ENHANCE-12_SimonM-Tides/src/OCE/DIA/diaharm.F90	(revision 10840)
@@ -71,5 +71,4 @@
       INTEGER :: jh, nhan, jk, ji
       INTEGER ::   ios                 ! Local integer output status for namelist read
-      TYPE(tide),          DIMENSION(:), POINTER ::   tide_components ! Selected tidal components
       TYPE(tide_harmonic), DIMENSION(:), POINTER ::   tide_harmonics  ! Oscillation parameters of selected tidal components
 
@@ -109,9 +108,10 @@
          &                        CALL ctl_stop( 'dia_harm_init : analysis time span must be a multiple of nstep_han' )
 
-      ! Request parameters for tidal components that have been selected for
-      ! harmonic analysis
-      CALL tide_init_components(tname, tide_components)
+      ! Initialize oscillation parameters for tidal components that have been
+      ! selected for harmonic analysis
+      ! ---------------------------------------------------------------------
+      CALL tide_init_harmonics(tname, tide_harmonics)
       ! Number of tidal components selected for harmonic analysis
-      nb_ana = size(tide_components)
+      nb_ana = size(tide_harmonics)
       !
       IF(lwp) THEN
@@ -126,8 +126,4 @@
          CALL ctl_stop( 'dia_harm_init', ctmp1, ctmp2 )
       ENDIF
-
-      ! Initialize oscillation parameters of selected tidal components
-      ! --------------------------------------------------------------
-      CALL tide_init_harmonics( tide_components, tide_harmonics)
 
       IF(lwp) WRITE(numout,*) 'Analysed frequency  : ',nb_ana ,'Frequency '
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 10839)
+++ /NEMO/branches/2019/dev_r10742_ENHANCE-12_SimonM-Tides/src/OCE/TDE/tide_mod.F90	(revision 10840)
@@ -20,6 +20,5 @@
 
    PUBLIC   tide_init
-   PUBLIC   tide_harmo       ! called by tideini and diaharm modules
-   PUBLIC   tide_init_components ! called internally and by module diaharm
+   PUBLIC   tide_harmo           ! called internally and by module sbdtide
    PUBLIC   tide_init_harmonics  ! called internally and by module diaharm
    PUBLIC   tide_init_load
@@ -128,12 +127,4 @@
       ENDIF
       !
-      ! Initialise array of selected tidal components
-      CALL tide_init_components(sn_tide_cnames, tide_components)
-      ! Number of active tidal components
-      nb_harmo = size(tide_components)
-      !       
-      ! Ensure that tidal components have been set in namelist_cfg
-      IF( nb_harmo == 0 )   CALL ctl_stop( 'tide_init : No tidal components set in nam_tide' )
-      !
       IF( ln_read_load.AND.(.NOT.ln_tide_pot) ) &
           &   CALL ctl_stop('ln_read_load requires ln_tide_pot')
@@ -148,6 +139,13 @@
       !
       ! Initialise array used to store tidal oscillation parameters (frequency,
-      ! amplitude, phase)
-      CALL tide_init_harmonics(tide_components, tide_harmonics)
+      ! amplitude, phase); also retrieve and store array of information about
+      ! selected tidal components
+      CALL tide_init_harmonics(sn_tide_cnames, tide_harmonics, tide_components)
+      !
+      ! Number of active tidal components
+      nb_harmo = size(tide_components)
+      !       
+      ! Ensure that tidal components have been set in namelist_cfg
+      IF( nb_harmo == 0 )   CALL ctl_stop( 'tide_init : No tidal components set in nam_tide' )
       !
       ! Reference time step for time-dependent tidal parameters
@@ -219,5 +217,5 @@
 
 
-   SUBROUTINE tide_init_harmonics(ptide_comp, ptide_harmo)
+   SUBROUTINE tide_init_harmonics(pcnames, ptide_harmo, ptide_comp)
       !!----------------------------------------------------------------------
       !!                 ***  ROUTINE tide_init_harmonics  ***
@@ -227,12 +225,23 @@
       !! components
       !! ----------------------------------------------------------------------
-      TYPE(tide),          POINTER,     DIMENSION(:) ::   ptide_comp      ! Selected components
-      TYPE(tide_harmonic), POINTER,     DIMENSION(:) ::   ptide_harmo     ! Oscillation parameters of selected components
+      CHARACTER(LEN=4),             DIMENSION(jpmax_harmo), INTENT(in) ::   pcnames     ! Names of selected components
+      TYPE(tide_harmonic), POINTER, DIMENSION(:)                       ::   ptide_harmo ! Oscillation parameters of tidal components
+      TYPE(tide),          POINTER, DIMENSION(:), OPTIONAL             ::   ptide_comp  ! Selected components
+      TYPE(tide),          POINTER, DIMENSION(:)                       ::   ztcomp      ! Selected components
+
+      ! Retrieve information about selected tidal components
+      ! If requested, prepare tidal component array for returning
+      IF (PRESENT(ptide_comp)) THEN
+         CALL tide_init_components(pcnames, ptide_comp)
+         ztcomp => ptide_comp
+      ELSE
+         CALL tide_init_components(pcnames, ztcomp)
+      END IF
 
       ! 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)
+      ALLOCATE(ptide_harmo(size(ztcomp)))
+      ptide_harmo(:)%cname_tide = ztcomp(:)%cname_tide
+      ptide_harmo(:)%equitide = ztcomp(:)%equitide
+      CALL tide_harmo(ztcomp, ptide_harmo)
 
    END SUBROUTINE tide_init_harmonics
