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 10860 – NEMO

Changeset 10860


Ignore:
Timestamp:
2019-04-11T11:35:27+02:00 (5 years ago)
Author:
smueller
Message:

Relocation of the time-of-day computation in subroutine upd_tide (module tide_mod) to its callers (ticket #2194)

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

Legend:

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

    r10822 r10860  
    4444!$AGRIF_END_DO_NOT_TREAT 
    4545   TYPE(OBC_DATA)  , PUBLIC, DIMENSION(jp_bdy) :: dta_bdy_s  !: bdy external data (slow component) 
     46 
     47   INTEGER ::   kt_tide 
    4648 
    4749   !!---------------------------------------------------------------------- 
  • NEMO/branches/2019/dev_r10742_ENHANCE-12_SimonM-Tides/src/OCE/DYN/dynspg.F90

    r10852 r10860  
    4242   INTEGER, PARAMETER ::   np_EXP = 0   !       explicit time stepping 
    4343   INTEGER, PARAMETER ::   np_NO  =-1   ! no surface pressure gradient, no scheme 
     44   ! 
     45   REAL(wp) ::   zt0step !   Time of day at the beginning of the time step 
    4446 
    4547   !! * Substitutions 
     
    112114         IF( .NOT.ln_dynspg_ts .AND. ( ln_tide_pot .AND. ln_tide )  ) THEN   ! N.B. added directly at sub-time-step in ts-case 
    113115            ! 
    114             CALL upd_tide( kt )                      ! update tide potential 
     116            ! Update tide potential at the beginning of current time step 
     117            zt0step = REAL(nsec_day, wp)-0.5_wp*rdt 
     118            CALL upd_tide(zt0step) 
    115119            ! 
    116120            DO jj = 2, jpjm1                         ! add tide potential forcing 
  • NEMO/branches/2019/dev_r10742_ENHANCE-12_SimonM-Tides/src/OCE/DYN/dynspg_ts.F90

    r10852 r10860  
    171171      REAL(wp), ALLOCATABLE, DIMENSION(:,:) :: ztwdmask, zuwdmask, zvwdmask ! ROMS wetting and drying masks at t,u,v points 
    172172      REAL(wp), ALLOCATABLE, DIMENSION(:,:) :: zuwdav2, zvwdav2    ! averages over the sub-steps of zuwdmask and zvwdmask 
     173      REAL(wp) ::   zt0substep !   Time of day at the beginning of the time substep 
    173174      !!---------------------------------------------------------------------- 
    174175      ! 
     
    718719         ! Update only tidal forcing at open boundaries 
    719720         IF( ln_bdy      .AND. ln_tide )   CALL bdy_dta_tides( kt, kit=jn, time_offset= noffset+1 ) 
    720          IF( ln_tide_pot .AND. ln_tide )   CALL upd_tide     ( kt, kit=jn, time_offset= noffset   ) 
     721         ! Update tide potential at the beginning of current time substep 
     722         IF( ln_tide_pot .AND. ln_tide ) THEN 
     723            zt0substep = REAL(nsec_day, wp) - 0.5_wp*rdt + (jn + noffset - 1) * rdt / REAL(nn_baro, wp) 
     724            CALL upd_tide(zt0substep) 
     725         END IF 
    721726         ! 
    722727         ! Set extrapolation coefficients for predictor step: 
  • NEMO/branches/2019/dev_r10742_ENHANCE-12_SimonM-Tides/src/OCE/TDE/tide_mod.F90

    r10856 r10860  
    5454   LOGICAL , PUBLIC ::   ln_tide_ramp    !: 
    5555   INTEGER , PUBLIC ::   nb_harmo        !: Number of active tidal components 
    56    INTEGER , PUBLIC ::   kt_tide         !: 
    5756   REAL(wp), PUBLIC ::   rn_tide_ramp_dt     !: 
    5857   REAL(wp), PUBLIC ::   rn_scal_load    !: 
     
    6463   REAL(wp),         ALLOCATABLE, DIMENSION(:,:,:) ::   amp_load, phi_load 
    6564 
     65   REAL(wp) ::   rn_tide_ramp_t !   Elapsed time in seconds 
    6666 
    6767   REAL(wp) ::   sh_T, sh_s, sh_h, sh_p, sh_p1             ! astronomic angles 
     
    146146      ! Ensure that tidal components have been set in namelist_cfg 
    147147      IF( nb_harmo == 0 )   CALL ctl_stop( 'tide_init : No tidal components set in nam_tide' ) 
    148       ! 
    149       ! Reference time step for time-dependent tidal parameters 
    150       kt_tide = nit000 
    151148      ! 
    152149      IF (.NOT.ln_scal_load ) rn_scal_load = 0._wp 
     
    339336      IF( nsec_day == NINT(0.5_wp * rdt) .OR. kt == nit000 ) THEN      ! start a new day 
    340337         ! 
    341          ! If the run does not start from midnight then need to initialise tides 
    342          ! at the start of the current day (only occurs when kt==nit000) 
    343          IF ( nsec_day /= NINT(0.5_wp * rdt) ) THEN  
    344             kt_tide = kt - (nsec_day - 0.5_wp * rdt)/rdt 
    345          ELSE 
    346             kt_tide = kt  
    347          ENDIF 
    348338         CALL tide_harmo(tide_components, tide_harmonics, ndt05) ! Update oscillation parameters of tidal components for start of current day 
    349339         ! 
     
    361351         IF( ln_tide_pot )   CALL tide_init_potential 
    362352         ! 
     353         rn_tide_ramp_t = (kt - nit000)*rdt !   Elapsed time in seconds 
    363354      ENDIF 
    364355      ! 
     
    730721 
    731722 
    732    SUBROUTINE upd_tide( kt, kit, time_offset ) 
     723   SUBROUTINE upd_tide(pdelta) 
    733724      !!---------------------------------------------------------------------- 
    734725      !!                 ***  ROUTINE upd_tide  *** 
     
    740731      !! ** Action  :   pot_astro   actronomical potential 
    741732      !!----------------------------------------------------------------------       
    742       INTEGER, INTENT(in)           ::   kt      ! ocean time-step index 
    743       INTEGER, INTENT(in), OPTIONAL ::   kit     ! external mode sub-time-step index (lk_dynspg_ts=T) 
    744       INTEGER, INTENT(in), OPTIONAL ::   time_offset ! time offset in number  
    745                                                      ! of internal steps             (lk_dynspg_ts=F) 
    746                                                      ! of external steps             (lk_dynspg_ts=T) 
    747       ! 
    748       INTEGER  ::   joffset      ! local integer 
    749       INTEGER  ::   ji, jj, jk   ! dummy loop indices 
    750       REAL(wp) ::   zt, zramp    ! local scalar 
    751       REAL(wp), DIMENSION(nb_harmo) ::   zwt  
     733      REAL, INTENT(in)              ::   pdelta      ! Temporal offset in seconds 
     734      INTEGER                       ::   jk          ! Dummy loop index 
     735      REAL(wp)                      ::   zt, zramp   ! Local scalars 
     736      REAL(wp), DIMENSION(nb_harmo) ::   zwt         ! Temporary array 
    752737      !!----------------------------------------------------------------------       
    753738      ! 
    754       !                               ! tide pulsation at model time step (or sub-time-step) 
    755       zt = ( kt - kt_tide ) * rdt 
    756       ! 
    757       joffset = 0 
    758       IF( PRESENT( time_offset ) )   joffset = time_offset 
    759       ! 
    760       IF( PRESENT( kit ) )   THEN 
    761          zt = zt + ( kit +  joffset - 1 ) * rdt / REAL( nn_baro, wp ) 
    762       ELSE 
    763          zt = zt + joffset * rdt 
    764       ENDIF 
    765       ! 
    766       zwt(:) = tide_harmonics(:)%omega * zt 
    767  
     739      zwt(:) = tide_harmonics(:)%omega * pdelta 
     740      ! 
    768741      pot_astro(:,:) = 0._wp          ! update tidal potential (sum of all harmonics) 
    769742      DO jk = 1, nb_harmo    
     
    772745      ! 
    773746      IF( ln_tide_ramp ) THEN         ! linear increase if asked 
    774          zt = ( kt - nit000 ) * rdt 
    775          IF( PRESENT( kit ) )   zt = zt + ( kit + joffset -1) * rdt / REAL( nn_baro, wp ) 
     747         zt = rn_tide_ramp_t + pdelta 
    776748         zramp = MIN(  MAX( zt / (rn_tide_ramp_dt*rday) , 0._wp ) , 1._wp  ) 
    777749         pot_astro(:,:) = zramp * pot_astro(:,:) 
Note: See TracChangeset for help on using the changeset viewer.