Changeset 10856


Ignore:
Timestamp:
2019-04-09T17:46:52+02:00 (16 months ago)
Author:
smueller
Message:

Replacement of the temporary modification of a global variable in subroutine tide_update (module tide_mod) by an alternative, local mechanism (ticket #2194)

File:
1 edited

Legend:

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

    r10855 r10856  
    335335      INTEGER, INTENT( in ) ::   kt     ! ocean time-step 
    336336      INTEGER               ::   jk     ! dummy loop index 
    337       INTEGER               ::   nsec_day_orig     ! Temporary variable 
    338337      !!---------------------------------------------------------------------- 
    339338       
     
    342341         ! If the run does not start from midnight then need to initialise tides 
    343342         ! at the start of the current day (only occurs when kt==nit000) 
    344          ! Temporarily set nsec_day to beginning of day. 
    345          nsec_day_orig = nsec_day 
    346343         IF ( nsec_day /= NINT(0.5_wp * rdt) ) THEN  
    347344            kt_tide = kt - (nsec_day - 0.5_wp * rdt)/rdt 
    348             nsec_day = NINT(0.5_wp * rdt) 
    349345         ELSE 
    350346            kt_tide = kt  
    351347         ENDIF 
    352          CALL tide_harmo(tide_components, tide_harmonics) ! Update oscillation parameters of tidal components 
     348         CALL tide_harmo(tide_components, tide_harmonics, ndt05) ! Update oscillation parameters of tidal components for start of current day 
    353349         ! 
    354350         ! 
     
    365361         IF( ln_tide_pot )   CALL tide_init_potential 
    366362         ! 
    367          ! Reset nsec_day 
    368          nsec_day = nsec_day_orig  
    369363      ENDIF 
    370364      ! 
     
    372366 
    373367 
    374    SUBROUTINE tide_harmo( ptide_comp, ptide_harmo ) 
     368   SUBROUTINE tide_harmo( ptide_comp, ptide_harmo, psec_day ) 
    375369      ! 
    376370      TYPE(tide),          DIMENSION(:), POINTER ::   ptide_comp   ! Array of selected tidal component parameters 
    377371      TYPE(tide_harmonic), DIMENSION(:), POINTER ::   ptide_harmo  ! Oscillation parameters of selected tidal components 
    378       ! 
    379       CALL astronomic_angle 
     372      INTEGER, OPTIONAL ::   psec_day                              ! Number of seconds since the start of the current day 
     373      ! 
     374      IF (PRESENT(psec_day)) THEN  
     375         CALL astronomic_angle(psec_day) 
     376      ELSE 
     377         CALL astronomic_angle(nsec_day) 
     378      END IF 
    380379      CALL tide_pulse( ptide_comp, ptide_harmo ) 
    381380      CALL tide_vuf(   ptide_comp, ptide_harmo ) 
     
    384383 
    385384 
    386    SUBROUTINE astronomic_angle 
     385   SUBROUTINE astronomic_angle(psec_day) 
    387386      !!---------------------------------------------------------------------- 
    388387      !!  tj is time elapsed since 1st January 1900, 0 hour, counted in julian 
    389388      !!  century (e.g. time in days divide by 36525) 
    390389      !!---------------------------------------------------------------------- 
     390      INTEGER  ::   psec_day !   Number of seconds from midnight 
    391391      REAL(wp) ::   cosI, p, q, t2, t4, sin2I, s2, tgI2, P1, sh_tgn2, at1, at2 
    392392      REAL(wp) ::   zqy , zsy, zday, zdj, zhfrac 
     
    399399      zday = zdj + zqy - 1. 
    400400      ! 
    401       zhfrac = nsec_day / 3600. 
     401      zhfrac = psec_day / 3600. 
    402402      ! 
    403403      !---------------------------------------------------------------------- 
Note: See TracChangeset for help on using the changeset viewer.