New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Changeset 10840 for NEMO/branches/2019/dev_r10742_ENHANCE-12_SimonM-Tides – NEMO

Ignore:
Timestamp:
2019-04-04T19:09:12+02:00 (5 years ago)
Author:
smueller
Message:

Simplification of initialisation of tidal-constituent parameters (module tide_mod) (ticket #2194)

Location:
NEMO/branches/2019/dev_r10742_ENHANCE-12_SimonM-Tides/src/OCE
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/2019/dev_r10742_ENHANCE-12_SimonM-Tides/src/OCE/DIA/diaharm.F90

    r10836 r10840  
    7171      INTEGER :: jh, nhan, jk, ji 
    7272      INTEGER ::   ios                 ! Local integer output status for namelist read 
    73       TYPE(tide),          DIMENSION(:), POINTER ::   tide_components ! Selected tidal components 
    7473      TYPE(tide_harmonic), DIMENSION(:), POINTER ::   tide_harmonics  ! Oscillation parameters of selected tidal components 
    7574 
     
    109108         &                        CALL ctl_stop( 'dia_harm_init : analysis time span must be a multiple of nstep_han' ) 
    110109 
    111       ! Request parameters for tidal components that have been selected for 
    112       ! harmonic analysis 
    113       CALL tide_init_components(tname, tide_components) 
     110      ! Initialize oscillation parameters for tidal components that have been 
     111      ! selected for harmonic analysis 
     112      ! --------------------------------------------------------------------- 
     113      CALL tide_init_harmonics(tname, tide_harmonics) 
    114114      ! Number of tidal components selected for harmonic analysis 
    115       nb_ana = size(tide_components) 
     115      nb_ana = size(tide_harmonics) 
    116116      ! 
    117117      IF(lwp) THEN 
     
    126126         CALL ctl_stop( 'dia_harm_init', ctmp1, ctmp2 ) 
    127127      ENDIF 
    128  
    129       ! Initialize oscillation parameters of selected tidal components 
    130       ! -------------------------------------------------------------- 
    131       CALL tide_init_harmonics( tide_components, tide_harmonics) 
    132128 
    133129      IF(lwp) WRITE(numout,*) 'Analysed frequency  : ',nb_ana ,'Frequency ' 
  • NEMO/branches/2019/dev_r10742_ENHANCE-12_SimonM-Tides/src/OCE/TDE/tide_mod.F90

    r10839 r10840  
    2020 
    2121   PUBLIC   tide_init 
    22    PUBLIC   tide_harmo       ! called by tideini and diaharm modules 
    23    PUBLIC   tide_init_components ! called internally and by module diaharm 
     22   PUBLIC   tide_harmo           ! called internally and by module sbdtide 
    2423   PUBLIC   tide_init_harmonics  ! called internally and by module diaharm 
    2524   PUBLIC   tide_init_load 
     
    128127      ENDIF 
    129128      ! 
    130       ! Initialise array of selected tidal components 
    131       CALL tide_init_components(sn_tide_cnames, tide_components) 
    132       ! Number of active tidal components 
    133       nb_harmo = size(tide_components) 
    134       !        
    135       ! Ensure that tidal components have been set in namelist_cfg 
    136       IF( nb_harmo == 0 )   CALL ctl_stop( 'tide_init : No tidal components set in nam_tide' ) 
    137       ! 
    138129      IF( ln_read_load.AND.(.NOT.ln_tide_pot) ) & 
    139130          &   CALL ctl_stop('ln_read_load requires ln_tide_pot') 
     
    148139      ! 
    149140      ! Initialise array used to store tidal oscillation parameters (frequency, 
    150       ! amplitude, phase) 
    151       CALL tide_init_harmonics(tide_components, tide_harmonics) 
     141      ! amplitude, phase); also retrieve and store array of information about 
     142      ! selected tidal components 
     143      CALL tide_init_harmonics(sn_tide_cnames, tide_harmonics, tide_components) 
     144      ! 
     145      ! Number of active tidal components 
     146      nb_harmo = size(tide_components) 
     147      !        
     148      ! Ensure that tidal components have been set in namelist_cfg 
     149      IF( nb_harmo == 0 )   CALL ctl_stop( 'tide_init : No tidal components set in nam_tide' ) 
    152150      ! 
    153151      ! Reference time step for time-dependent tidal parameters 
     
    219217 
    220218 
    221    SUBROUTINE tide_init_harmonics(ptide_comp, ptide_harmo) 
     219   SUBROUTINE tide_init_harmonics(pcnames, ptide_harmo, ptide_comp) 
    222220      !!---------------------------------------------------------------------- 
    223221      !!                 ***  ROUTINE tide_init_harmonics  *** 
     
    227225      !! components 
    228226      !! ---------------------------------------------------------------------- 
    229       TYPE(tide),          POINTER,     DIMENSION(:) ::   ptide_comp      ! Selected components 
    230       TYPE(tide_harmonic), POINTER,     DIMENSION(:) ::   ptide_harmo     ! Oscillation parameters of selected components 
     227      CHARACTER(LEN=4),             DIMENSION(jpmax_harmo), INTENT(in) ::   pcnames     ! Names of selected components 
     228      TYPE(tide_harmonic), POINTER, DIMENSION(:)                       ::   ptide_harmo ! Oscillation parameters of tidal components 
     229      TYPE(tide),          POINTER, DIMENSION(:), OPTIONAL             ::   ptide_comp  ! Selected components 
     230      TYPE(tide),          POINTER, DIMENSION(:)                       ::   ztcomp      ! Selected components 
     231 
     232      ! Retrieve information about selected tidal components 
     233      ! If requested, prepare tidal component array for returning 
     234      IF (PRESENT(ptide_comp)) THEN 
     235         CALL tide_init_components(pcnames, ptide_comp) 
     236         ztcomp => ptide_comp 
     237      ELSE 
     238         CALL tide_init_components(pcnames, ztcomp) 
     239      END IF 
    231240 
    232241      ! Allocate and populate array of oscillation parameters 
    233       ALLOCATE(ptide_harmo(size(ptide_comp))) 
    234       ptide_harmo(:)%cname_tide = ptide_comp(:)%cname_tide 
    235       ptide_harmo(:)%equitide = ptide_comp(:)%equitide 
    236       CALL tide_harmo(ptide_comp, ptide_harmo) 
     242      ALLOCATE(ptide_harmo(size(ztcomp))) 
     243      ptide_harmo(:)%cname_tide = ztcomp(:)%cname_tide 
     244      ptide_harmo(:)%equitide = ztcomp(:)%equitide 
     245      CALL tide_harmo(ztcomp, ptide_harmo) 
    237246 
    238247   END SUBROUTINE tide_init_harmonics 
Note: See TracChangeset for help on using the changeset viewer.