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 12056 for NEMO – NEMO

Changeset 12056 for NEMO


Ignore:
Timestamp:
2019-12-04T18:55:02+01:00 (4 years ago)
Author:
smueller
Message:

Further modifications related to coding style and conventions, addition of citations of equations, and further reduction of the number of real-valued literals used in module tide_mod (ticket #2194)
This changeset affects results produced by the AMM12 and SPITZ12 reference model configurations.

File:
1 edited

Legend:

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

    r12047 r12056  
    55   !!====================================================================== 
    66   !! History :  1.0  !  2007  (O. Le Galloudec)  Original code 
     7   !!                 !  2019  (S. Mueller) 
    78   !!---------------------------------------------------------------------- 
     9   !! 
     10   !! ** Reference : 
     11   !!       S58) Schureman, P. (1958): Manual of Harmonic Analysis and 
     12   !!            Prediction of Tides (Revised (1940) Edition (Reprinted 1958 
     13   !!            with corrections). Reprinted June 2001). U.S. Department of 
     14   !!            Commerce, Coast and Geodetic Survey Special Publication 
     15   !!            No. 98. Washington DC, United States Government Printing 
     16   !!            Office. 317 pp. DOI: 10.25607/OBP-155. 
     17   !!---------------------------------------------------------------------- 
     18 
    819   USE oce, ONLY : sshn       ! sea-surface height 
    920   USE par_oce                ! ocean parameters 
     
    1728 
    1829   PUBLIC   tide_init 
    19    PUBLIC   tide_update          ! called by stp 
    20    PUBLIC   tide_init_harmonics  ! called internally and by module diaharm 
    21    PUBLIC   upd_tide         ! called in dynspg_... modules 
     30   PUBLIC   tide_update           ! called by stp 
     31   PUBLIC   tide_init_harmonics   ! called internally and by module diaharm 
     32   PUBLIC   upd_tide              ! called in dynspg_... modules 
    2233 
    2334   INTEGER, PUBLIC, PARAMETER ::   jpmax_harmo = 64   !: maximum number of harmonic components 
     
    3142   END TYPE tide 
    3243 
    33    TYPE(tide), DIMENSION(:), POINTER ::   tide_components !: Array of selected tidal component parameters 
     44   TYPE(tide), DIMENSION(:), POINTER ::   tide_components   !: Array of selected tidal component parameters 
    3445 
    3546   TYPE, PUBLIC ::   tide_harmonic       !:   Oscillation parameters of harmonic tidal components 
     
    4253   END type tide_harmonic 
    4354 
    44    TYPE(tide_harmonic), PUBLIC, DIMENSION(:), POINTER ::   tide_harmonics !: Oscillation parameters of selected tidal components 
    45  
    46    LOGICAL , PUBLIC ::   ln_tide         !: 
    47    LOGICAL , PUBLIC ::   ln_tide_pot     !: 
    48    INTEGER          ::   nn_tide_var     !  Variant of tidal parameter set and tide-potential computation 
    49    LOGICAL          ::   ln_tide_dia     !  Enable tidal diagnostic output 
    50    LOGICAL          ::   ln_read_load    !: 
    51    LOGICAL , PUBLIC ::   ln_scal_load    !: 
    52    LOGICAL , PUBLIC ::   ln_tide_ramp    !: 
    53    INTEGER , PUBLIC ::   nb_harmo        !: Number of active tidal components 
     55   TYPE(tide_harmonic), PUBLIC, DIMENSION(:), POINTER ::   tide_harmonics   !: Oscillation parameters of selected tidal components 
     56 
     57   LOGICAL , PUBLIC ::   ln_tide             !: 
     58   LOGICAL , PUBLIC ::   ln_tide_pot         !: 
     59   INTEGER          ::   nn_tide_var         !  Variant of tidal parameter set and tide-potential computation 
     60   LOGICAL          ::   ln_tide_dia         !  Enable tidal diagnostic output 
     61   LOGICAL          ::   ln_read_load        !: 
     62   LOGICAL , PUBLIC ::   ln_scal_load        !: 
     63   LOGICAL , PUBLIC ::   ln_tide_ramp        !: 
     64   INTEGER , PUBLIC ::   nb_harmo            !: Number of active tidal components 
    5465   REAL(wp), PUBLIC ::   rn_tide_ramp_dt     !: 
    55    REAL(wp), PUBLIC ::   rn_scal_load    !: 
     66   REAL(wp), PUBLIC ::   rn_scal_load        !: 
    5667   CHARACTER(lc), PUBLIC ::   cn_tide_load   !:  
    57    REAL(wp)         ::   rn_tide_gamma   ! Tidal tilt factor 
    58  
    59    REAL(wp), PUBLIC, ALLOCATABLE, DIMENSION(:,:)   ::   pot_astro !: tidal potential 
    60    REAL(wp),         ALLOCATABLE, DIMENSION(:,:)   ::   pot_astro_comp   !  tidal-potential component 
     68   REAL(wp)         ::   rn_tide_gamma       ! Tidal tilt factor 
     69 
     70   REAL(wp), PUBLIC, ALLOCATABLE, DIMENSION(:,:)   ::   pot_astro            !: tidal potential 
     71   REAL(wp),         ALLOCATABLE, DIMENSION(:,:)   ::   pot_astro_comp       !  tidal-potential component 
    6172   REAL(wp),         ALLOCATABLE, DIMENSION(:,:,:) ::   amp_pot, phi_pot 
    6273   REAL(wp),         ALLOCATABLE, DIMENSION(:,:,:) ::   amp_load, phi_load 
    6374 
    64    REAL(wp) ::   rn_tide_ramp_t !   Elapsed time in seconds 
     75   REAL(wp) ::   rn_tide_ramp_t   !   Elapsed time in seconds 
    6576 
    6677   REAL(wp) ::   sh_T, sh_s, sh_h, sh_p, sh_p1             ! astronomic angles 
     
    7182   ! deg/h, respectively. The values of these module variables have been copied 
    7283   ! from subroutine astronomic_angle of the version of this module used in 
    73    ! version 4.0 of NEMO 
     84   ! release version 4.0 of NEMO. 
    7485   REAL(wp) ::   rlon00_N  =  259.1560564_wp               ! Longitude of ascending lunar node 
    7586   REAL(wp) ::   romega_N  = -.0022064139_wp 
     
    8495   REAL(wp) ::   rlon00_p  =  334.3837214_wp               ! Longitude of lunar perigee 
    8596   REAL(wp) ::   romega_p  =  .004641834_wp 
     97   ! Values of cos(i)*cos(epsilon), rcice, and sin(incl)*sin(epsilon), rsise, 
     98   ! where i is the inclination of the orbit of the Moon w.r.t. the ecliptic and 
     99   ! epsilon the obliquity of the ecliptic on 1 January 1900, 00h. The values of 
     100   ! these module variables have been copied from subroutine astronomic_angle 
     101   ! (computation of the cosine of inclination of orbit of Moon to the celestial 
     102   ! equator) of the version of this module used in release version 4.0 of NEMO. 
     103   REAL(wp) ::   rcice    = 0.913694997_wp 
     104   REAL(wp) ::   rsise    = 0.035692561_wp 
     105   ! Coefficients used to compute sh_xi and sh_nu in subroutine astronomic_angle 
     106   ! according to two equations given in the explanation of Table 6 of S58 
     107   REAL(wp) ::   rxinu1, rxinu2 
    86108 
    87109   !!---------------------------------------------------------------------- 
     
    155177      IF( ln_tide_ramp.AND.(rn_tide_ramp_dt<0.) ) & 
    156178         &   CALL ctl_stop('rn_tide_ramp_dt must be positive') 
     179      ! 
     180      ! Compute coefficients which are used in subroutine astronomic_angle to 
     181      ! compute sh_xi and sh_nu according to two equations given in the 
     182      ! explanation of Table 6 of S58 
     183      rxinu1 = COS( 0.5_wp * ( ABS( ACOS( rcice + rsise ) ) ) ) / COS( 0.5_wp * ( ACOS( rcice - rsise ) ) ) 
     184      rxinu2 = SIN( 0.5_wp * ( ABS( ACOS( rcice + rsise ) ) ) ) / SIN( 0.5_wp * ( ACOS( rcice - rsise ) ) ) 
     185      rxinu1 = 1.01883_wp 
     186      rxinu2 = 0.64412_wp 
    157187      ! 
    158188      ! Initialise array used to store tidal oscillation parameters (frequency, 
     
    302332      !!                 ***  ROUTINE tide_init_potential  *** 
    303333      !! 
    304       !! *** Reference: 
     334      !! ** Reference : 
    305335      !!      CT71) Cartwright, D. E. and Tayler, R. J. (1971): New computations of 
    306336      !!            the Tide-generating Potential. Geophys. J. R. astr. Soc. 23, 
     
    445475      !!---------------------------------------------------------------------- 
    446476      INTEGER  ::   psec_day !   Number of seconds from midnight 
    447       REAL(wp) ::   cosI, p, q, t2, t4, sin2I, s2, tgI2, P1, sh_tgn2, at1, at2 
     477      REAL(wp) ::   zp, zq, zt2, zs2, ztgI2, zP1, ztgn2, zat1, zat2 
    448478      REAL(wp) ::   zqy , zsy, zday, zdj, zhfrac, zt 
    449479      !!---------------------------------------------------------------------- 
     
    477507      sh_p  = ( rlon00_p  + romega_p  * zt    ) * rad 
    478508      sh_p = MOD( sh_p,  2*rpi ) 
    479  
    480       cosI = 0.913694997_wp - 0.035692561_wp * COS( sh_N ) 
    481  
    482       sh_I = ACOS( cosI ) 
    483  
    484       sin2I   = sin(sh_I) 
    485       sh_tgn2 = tan(sh_N/2.0) 
    486  
    487       at1 = ATAN( 1.01883_wp * sh_tgn2 ) 
    488       at2 = ATAN( 0.64412_wp * sh_tgn2 ) 
    489  
    490       sh_xi = sh_N - at1 - at2 
    491  
     509      ! 
     510      ! Inclination of the orbit of the moon w.r.t. the celestial equator, see 
     511      ! explanation of Table 6 of S58 
     512      sh_I = ACOS( rcice - rsise * COS( sh_N ) ) 
     513      ! 
     514      ! Computation of sh_xi and sh_nu, see explanation of Table 6 of S58 
     515      ztgn2 = TAN( sh_N / 2.0_wp ) 
     516      zat1 = ATAN( rxinu1 * ztgn2 ) 
     517      zat2 = ATAN( rxinu2 * ztgn2 ) 
     518      sh_xi = sh_N - zat1 - zat2 
    492519      IF( sh_N > rpi ) sh_xi = sh_xi - 2.0_wp * rpi 
    493  
    494       sh_nu = at1 - at2 
    495  
    496       ! For computation of tidal constituents L2 K1 K2 
    497       tgI2 = tan( sh_I / 2.0_wp ) 
    498       P1   = sh_p - sh_xi 
    499       ! 
    500       t2   = tgI2 * tgI2 
    501       t4   = t2 * t2 
    502       sh_x1ra = SQRT( 1.0 - 12.0 * t2 * COS( 2.0 * P1 ) + 36.0_wp * t4 ) 
    503       ! 
    504       p = SIN( 2.0_wp * P1 ) 
    505       q = 1.0_wp / ( 6.0_wp * t2 ) - COS( 2.0_wp * P1 ) 
    506       sh_R = ATAN( p / q ) 
    507       ! 
    508       p = SIN( 2.0_wp * sh_I ) * SIN( sh_nu ) 
    509       q = SIN( 2.0_wp * sh_I ) * COS( sh_nu ) + 0.3347_wp 
    510       sh_nuprim = ATAN( p / q ) 
    511       ! 
    512       s2 = SIN( sh_I ) * SIN( sh_I ) 
    513       p  = s2 * SIN( 2.0_wp * sh_nu ) 
    514       q  = s2 * COS( 2.0_wp * sh_nu ) + 0.0727_wp 
    515       sh_nusec = 0.5_wp * ATAN( p / q ) 
     520      sh_nu = zat1 - zat2 
     521      ! 
     522      ! Computation of sh_x1ra, sh_R, sh_nuprim, and sh_nusec used for tidal 
     523      ! constituents L2, K1, and K2 
     524      ! 
     525      ! Computation of sh_x1ra and sh_R (Equations 204, 213, and 214 of S58) 
     526      ztgI2 = tan( sh_I / 2.0_wp ) 
     527      zP1   = sh_p - sh_xi 
     528      zt2   = ztgI2 * ztgI2 
     529      sh_x1ra = SQRT( 1.0 - 12.0 * zt2 * COS( 2.0_wp * zP1 ) + 36.0_wp * zt2 * zt2 ) 
     530      zp = SIN( 2.0_wp * zP1 ) 
     531      zq = 1.0_wp / ( 6.0_wp * zt2 ) - COS( 2.0_wp * zP1 ) 
     532      sh_R = ATAN( zp / zq ) 
     533      ! 
     534      ! Computation of sh_nuprim (Equation 224 of S58) 
     535      zp = SIN( 2.0_wp * sh_I ) * SIN( sh_nu ) 
     536      zq = SIN( 2.0_wp * sh_I ) * COS( sh_nu ) + 0.3347_wp 
     537      sh_nuprim = ATAN( zp / zq ) 
     538      ! 
     539      ! Computation of sh_nusec  (Equation 232 of S58) 
     540      zs2 = SIN( sh_I ) * SIN( sh_I ) 
     541      zp  = zs2 * SIN( 2.0_wp * sh_nu ) 
     542      zq  = zs2 * COS( 2.0_wp * sh_nu ) + 0.0727_wp 
     543      sh_nusec = 0.5_wp * ATAN( zp / zq ) 
    516544      ! 
    517545   END SUBROUTINE astronomic_angle 
     
    589617      !! 
    590618      !! ** Purpose : Compute amplitude correction factors due to nodal motion 
    591       !! 
    592       !! ** Reference : 
    593       !!       S58) Schureman, P. (1958): Manual of Harmonic Analysis and 
    594       !!            Prediction of Tides (Revised (1940) Edition (Reprinted 1958 
    595       !!            with corrections). Reprinted June 2001). U.S. Department of 
    596       !!            Commerce, Coast and Geodetic Survey Special Publication 
    597       !!            No. 98. Washington DC, United States Government Printing 
    598       !!            Office. 317 pp. DOI: 10.25607/OBP-155. 
    599619      !!---------------------------------------------------------------------- 
    600620      INTEGER, INTENT(in) ::   kformula 
Note: See TracChangeset for help on using the changeset viewer.