1 | MODULE updtide |
---|
2 | !!================================================================================= |
---|
3 | !! *** MODULE updtide *** |
---|
4 | !! Initialization of tidal forcing |
---|
5 | !! History : 9.0 ! 07 (O. Le Galloudec) Original code |
---|
6 | !! 3.5 ! 2013-07 (J. Chanut) Compliant with time splitting changes |
---|
7 | !!================================================================================= |
---|
8 | #if defined key_tide |
---|
9 | !! * Modules used |
---|
10 | USE oce ! ocean dynamics and tracers variables |
---|
11 | USE dom_oce ! ocean space and time domain |
---|
12 | USE in_out_manager ! I/O units |
---|
13 | USE phycst |
---|
14 | USE sbctide |
---|
15 | USE dynspg_oce |
---|
16 | USE tideini, ONLY: ln_tide_ramp, rdttideramp |
---|
17 | |
---|
18 | IMPLICIT NONE |
---|
19 | PUBLIC |
---|
20 | |
---|
21 | !! * Routine accessibility |
---|
22 | PUBLIC upd_tide |
---|
23 | !!--------------------------------------------------------------------------------- |
---|
24 | !! OPA 9.0 , LODYC-IPSL (2003) |
---|
25 | !!--------------------------------------------------------------------------------- |
---|
26 | |
---|
27 | CONTAINS |
---|
28 | |
---|
29 | SUBROUTINE upd_tide (kt, kit, time_offset) |
---|
30 | !!---------------------------------------------------------------------- |
---|
31 | !! *** ROUTINE upd_tide *** |
---|
32 | !!---------------------------------------------------------------------- |
---|
33 | !! * Local declarations |
---|
34 | |
---|
35 | INTEGER, INTENT( in ) :: kt ! ocean time-step index |
---|
36 | INTEGER, INTENT( in ), OPTIONAL :: kit ! Barotropic timestep counter (ts option) |
---|
37 | INTEGER, INTENT( in ), OPTIONAL :: time_offset ! time offset in units of timesteps |
---|
38 | INTEGER :: time_add ! time offset in units of timesteps |
---|
39 | INTEGER :: ji, jj, jk |
---|
40 | REAL (wp) :: zramp, z_arg, z_t |
---|
41 | !............................................................................... |
---|
42 | |
---|
43 | pot_astro(:,:)=0.e0 |
---|
44 | zramp = 1.e0 |
---|
45 | time_add = 0 |
---|
46 | |
---|
47 | IF( PRESENT(time_offset) ) THEN |
---|
48 | time_add = time_offset |
---|
49 | ENDIF |
---|
50 | |
---|
51 | IF( PRESENT(kit) ) THEN |
---|
52 | z_arg = ((kt-kt_tide) * rdt + (kit+0.5*(time_add-1)) * rdt / REAL(nn_baro,wp) ) |
---|
53 | ELSE |
---|
54 | z_arg = ((kt-kt_tide)+time_add) * rdt |
---|
55 | ENDIF |
---|
56 | |
---|
57 | IF (ln_tide_ramp) zramp = MIN(MAX( (z_arg + (kt_tide-nit000)*rdt)/(rdttideramp*rday),0.),1.) |
---|
58 | |
---|
59 | DO jk=1,nb_harmo |
---|
60 | z_t = z_arg * omega_tide(jk) |
---|
61 | DO ji=1,jpi |
---|
62 | DO jj=1,jpj |
---|
63 | pot_astro(ji,jj)=pot_astro(ji,jj) + zramp * amp_pot(ji,jj,jk)*COS(z_t + phi_pot(ji,jj,jk)) |
---|
64 | END DO |
---|
65 | END DO |
---|
66 | END DO |
---|
67 | |
---|
68 | END SUBROUTINE upd_tide |
---|
69 | |
---|
70 | #else |
---|
71 | !!---------------------------------------------------------------------- |
---|
72 | !! Dummy module : NO TIDE |
---|
73 | !!---------------------------------------------------------------------- |
---|
74 | CONTAINS |
---|
75 | SUBROUTINE upd_tide( kt) ! Empty routine |
---|
76 | INTEGER,INTENT (IN) :: kt |
---|
77 | WRITE(*,*) 'upd_tide: You should not have seen this print! error?', kt |
---|
78 | END SUBROUTINE upd_tide |
---|
79 | |
---|
80 | #endif |
---|
81 | |
---|
82 | !!====================================================================== |
---|
83 | |
---|
84 | END MODULE updtide |
---|
85 | |
---|