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.
sbctide.F90 in branches/2017/dev_r8126_ROBUST08_no_ghost/NEMOGCM/NEMO/OPA_SRC/SBC – NEMO

source: branches/2017/dev_r8126_ROBUST08_no_ghost/NEMOGCM/NEMO/OPA_SRC/SBC/sbctide.F90 @ 8186

Last change on this file since 8186 was 7646, checked in by timgraham, 7 years ago

Merge of dev_merge_2016 into trunk. UPDATE TO ARCHFILES NEEDED for XIOS2.
LIM_SRC_s/limrhg.F90 to follow in next commit due to change of kind (I'm unable to do it in this commit).
Merged using the following steps:

1) svn merge --reintegrate svn+ssh://forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/trunk .
2) Resolve minor conflicts in sette.sh and namelist_cfg for ORCA2LIM3 (due to a change in trunk after branch was created)
3) svn commit
4) svn switch svn+ssh://forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/trunk
5) svn merge svn+ssh://forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/branches/2016/dev_merge_2016 .
6) At this stage I checked out a clean copy of the branch to compare against what is about to be committed to the trunk.
6) svn commit #Commit code to the trunk

In this commit I have also reverted a change to Fcheck_archfile.sh which was causing problems on the Paris machine.

  • Property svn:keywords set to Id
File size: 5.3 KB
Line 
1MODULE sbctide
2   !!======================================================================
3   !!                       ***  MODULE  sbctide  ***
4   !! Initialization of tidal forcing
5   !!======================================================================
6   !! History :  9.0  !  2007  (O. Le Galloudec)  Original code
7   !!----------------------------------------------------------------------
8   USE oce            ! ocean dynamics and tracers variables
9   USE dom_oce        ! ocean space and time domain
10   USE phycst         ! physical constant
11   USE daymod         ! calandar
12   USE tideini        !
13   !
14   USE in_out_manager ! I/O units
15   USE iom            ! xIOs server
16   USE ioipsl         ! NetCDF IPSL library
17   USE lbclnk         ! ocean lateral boundary conditions (or mpp link)
18
19   IMPLICIT NONE
20   PUBLIC
21
22   REAL(wp), PUBLIC, ALLOCATABLE, DIMENSION(:,:) ::   pot_astro   !
23
24   !!----------------------------------------------------------------------
25   !!   tidal potential
26   !!----------------------------------------------------------------------
27   !!   sbc_tide            :
28   !!   tide_init_potential :
29   !!----------------------------------------------------------------------
30
31   REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) ::   amp_pot, phi_pot
32
33   !!----------------------------------------------------------------------
34   !! NEMO/OPA 3.5 , NEMO Consortium (2013)
35   !! $Id$
36   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
37   !!----------------------------------------------------------------------
38CONTAINS
39
40   SUBROUTINE sbc_tide( kt )
41      !!----------------------------------------------------------------------
42      !!                 ***  ROUTINE sbc_tide  ***
43      !!----------------------------------------------------------------------     
44      INTEGER, INTENT( in ) ::   kt     ! ocean time-step
45      INTEGER               ::   jk     ! dummy loop index
46      INTEGER               ::   nsec_day_orig     ! Temporary variable
47      !!----------------------------------------------------------------------
48     
49      IF( nsec_day == NINT(0.5_wp * rdt) .OR. kt == nit000 ) THEN      ! start a new day
50         !
51         IF( kt == nit000 ) THEN
52            ALLOCATE( amp_pot(jpi,jpj,nb_harmo),                      &
53               &      phi_pot(jpi,jpj,nb_harmo), pot_astro(jpi,jpj)   )
54         ENDIF
55         !
56         amp_pot(:,:,:) = 0._wp
57         phi_pot(:,:,:) = 0._wp
58         pot_astro(:,:) = 0._wp
59         !
60         ! If the run does not start from midnight then need to initialise tides
61         ! at the start of the current day (only occurs when kt==nit000)
62         ! Temporarily set nsec_day to beginning of day.
63         nsec_day_orig = nsec_day
64         IF ( nsec_day /= NINT(0.5_wp * rdt) ) THEN
65            kt_tide = kt - (nsec_day - 0.5_wp * rdt)/rdt
66            nsec_day = NINT(0.5_wp * rdt)
67         ELSE
68            kt_tide = kt 
69         ENDIF
70         CALL tide_harmo( omega_tide, v0tide, utide, ftide, ntide, nb_harmo )
71         !
72         !
73         IF(lwp) THEN
74            WRITE(numout,*)
75            WRITE(numout,*) 'sbc_tide : Update of the components and (re)Init. the potential at kt=', kt
76            WRITE(numout,*) '~~~~~~~~ '
77            DO jk = 1, nb_harmo
78               WRITE(numout,*) Wave(ntide(jk))%cname_tide, utide(jk), ftide(jk), v0tide(jk), omega_tide(jk)
79            END DO
80         ENDIF
81         !
82         IF( ln_tide_pot )   CALL tide_init_potential
83         !
84         ! Reset nsec_day
85         nsec_day = nsec_day_orig 
86      ENDIF
87      !
88   END SUBROUTINE sbc_tide
89
90
91   SUBROUTINE tide_init_potential
92      !!----------------------------------------------------------------------
93      !!                 ***  ROUTINE tide_init_potential  ***
94      !!----------------------------------------------------------------------
95      INTEGER  ::   ji, jj, jk   ! dummy loop indices
96      REAL(wp) ::   zcons, ztmp1, ztmp2, zlat, zlon, ztmp, zamp, zcs   ! local scalar
97      !!----------------------------------------------------------------------
98
99      DO jk = 1, nb_harmo
100         zcons = 0.7_wp * Wave(ntide(jk))%equitide * ftide(jk)
101         DO ji = 1, jpi
102            DO jj = 1, jpj
103               ztmp1 =  amp_pot(ji,jj,jk) * COS( phi_pot(ji,jj,jk) )
104               ztmp2 = -amp_pot(ji,jj,jk) * SIN( phi_pot(ji,jj,jk) )
105               zlat = gphit(ji,jj)*rad !! latitude en radian
106               zlon = glamt(ji,jj)*rad !! longitude en radian
107               ztmp = v0tide(jk) + utide(jk) + Wave(ntide(jk))%nutide * zlon
108               ! le potentiel est composé des effets des astres:
109               IF    ( Wave(ntide(jk))%nutide == 1 )  THEN  ;  zcs = zcons * SIN( 2._wp*zlat )
110               ELSEIF( Wave(ntide(jk))%nutide == 2 )  THEN  ;  zcs = zcons * COS( zlat )**2
111               ELSE                                         ;  zcs = 0._wp
112               ENDIF
113               ztmp1 = ztmp1 + zcs * COS( ztmp )
114               ztmp2 = ztmp2 - zcs * SIN( ztmp )
115               zamp = SQRT( ztmp1*ztmp1 + ztmp2*ztmp2 )
116               amp_pot(ji,jj,jk) = zamp
117               phi_pot(ji,jj,jk) = ATAN2( -ztmp2 / MAX( 1.e-10_wp , zamp ) ,   &
118                  &                        ztmp1 / MAX( 1.e-10_wp,  zamp )   )
119            END DO
120         END DO
121      END DO
122      !
123   END SUBROUTINE tide_init_potential
124
125  !!======================================================================
126END MODULE sbctide
Note: See TracBrowser for help on using the repository browser.