Basilisk CFD
Adaptive Cartesian mesh PDE framework
Loading...
Searching...
No Matches
equilibrium_tide.h
Go to the documentation of this file.
1/** @file equilibrium_tide.h
2 */
3/**
4# Equilibrium tide
5
6This is directly adapted from
7[equilibrium_tide.F](https://github.com/myroms/roms/blob/develop/ROMS/Utility/equilibrium_tide.F)
8in the [ROMS source code](https://github.com/myroms).
9
10This module computes the equilibrium tide defined as the shape the sea
11surface (m) would assume if it were motionless and in equilibrium with
12the tide generating forces on a fluid planet. It is used to compute
13the tide generation force (TGF) terms for the pressure gradient.
14
15## References
16
17~~~bib
18@article{arbic2004,
19 title={The accuracy of surface elevations in forward global barotropic and baroclinic tide models},
20 author={Arbic, Brian K and Garner, Stephen T and Hallberg, Robert W and Simmons, Harper L},
21 journal={Deep Sea Research Part II: Topical Studies in Oceanography},
22 volume={51},
23 number={25-26},
24 pages={3069--3101},
25 year={2004},
26 publisher={Elsevier}
27}
28
29@article{arbic2018,
30 title={A primer on global internal tide and internal gravity wave continuum modeling in
31 {HYCOM} and {MITgcm}},
32 author={Arbic, Brian K and Alford, Matthew H and Ansong, Joseph K and Buijsman, Maarten C and
33 Ciotti, Robert B and Farrar, J Thomas and Hallberg, Robert W and Henze, Christopher E and
34 Hill, Christopher N and Luecke, Conrad A and others},
35 journal={New frontiers in operational oceanography},
36 DOI={10.17125/gov2018.ch13},
37 year={2018}
38}
39
40@article{doodson1941,
41 title={Admiralty manual of tides},
42 author={Doodson, Arthur Thomas and Warburg, Harold Dreyer},
43 journal={His Majesty's Stationery Office},
44 address={London, UK},
45 year={1941}
46}
47
48@article{egbert2017,
49 title={Tidal prediction},
50 author={Egbert, Gary D and Ray, Richard D},
51 journal={Journal of Marine Research},
52 volume={75},
53 pages={189-237},
54 year={2017}
55}
56
57@unpublished{roms2021,
58 title={Wiki {ROMS}},
59 author={Arango et al.},
60 url={https://www.myroms.org/wiki/Tidal_Forcing#Astronomical_Tide_Generating_Forces},
61 year={2021},
62 month={September}
63}
64~~~
65
66## Define equilibrium tide constituents structure */
67
68typedef struct {
69 double Afl; // product: amp*f*love
70 double amp; // amplitude (m)
71 double chi; // phase at Greenwich meridian (degrees)
72 double f; // f nodal factor (nondimensional)
73 double love; // tidal Love number factor
74 double nu; // nu nodal factor (degrees)
75 double omega; // frequency (1/s)
76} Etide_t;
77
78struct {
79 Etide_t Q1; // Q1 component, diurnal
80 Etide_t O1; // O1 component, diurnal
81 Etide_t K1; // K1 component, diurnal
82 Etide_t N2; // N2 component, semi-diurnal
83 Etide_t M2; // M2 component, semi-diurnal
84 Etide_t S2; // S2 component, semi-diurnal
85 Etide_t K2; // N2 component, semi-diurnal
86} Etide = {0};
87
88const double deg2rad = pi/180.;
89
90#include <time.h>
91
92/**
93## Computation of the tidal constituents
94
95The tidal constituents are computed relative to the optional starting
96date given as argument.
97
98If *Lnodal* is true then lunar nodal correction is applied. */
99
100void equilibrium_tide_constituents (const char * date = "2000-01-01 12:00:00",
101 bool Lnodal = false)
102{
103 /**
104 Compute fundamental astronomical parameters. Adapted from Egbert and
105 Ray, 2017, Table 1.
106
107 Set Egbert and Ray time reference for their astronomical parameters
108 (Table 1): days since 2000-01-01:12:00:00 */
109
110 struct tm astro_tm;
111 assert (strptime ("2000-01-01 12:00:00", "%Y-%m-%d %H:%M:%S", &astro_tm));
113 assert (astro_t != (time_t) -1);
114
115 /**
116 Terrestial time (in centuries) since tide reference date number.
117 Recall that the length of a year is 365.2425 days for the now called
118 Gregorian Calendar (corrected after 15 October 1582).
119
120 *We also assume that a day is 86400 seconds (need to check
121 this). Note that the original code in ROMS seems to round T to the
122 nearest day??, which we do not do here.* */
123
124 struct tm date_tm;
125 if (!strptime (date, "%Y-%m-%d %H:%M:%S", &date_tm)) {
127 "%s:%d: error: date string '%s' is not formatted as '%%Y-%%m-%%d %%H:%%M:%%S'\n",
129 exit (1);
130 }
132 assert (date_t != (time_t) -1);
133 double T = difftime (date_t, astro_t)/(86400.*36524.25);
134
135 /**
136 Compute the harmonic constituents of the equilibrium tide at
137 Greenwich. Adapted from Doodson and Warburg, 1941, Table 1.
138
139 Nodal factors "f" and "nu" account for the slow modulation of the
140 tidal constituents due (principally) to the 18.6-year lunar nodal
141 cycle. */
142
143 if (Lnodal) {
144
145 /**
146 Mean longitude of lunar node (Period = 18.6 years). */
147
148 double N = -234.955 - 1934.1363*T; // degrees
149 N *= deg2rad; // radians
150
151 Etide.O1.f = 1.009 + 0.187*cos(N) - 0.015*cos(2.0*N);
152 Etide.K1.f = 1.006 + 0.115*cos(N) - 0.009*cos(2.0*N);
153 Etide.M2.f = 1.0 - 0.037*cos(N);
154 Etide.S2.f = 1.0;
155 Etide.K2.f = 1.024 + 0.286*cos(N) + 0.008*cos(2.0*N);
156
157 Etide.O1.nu = 10.8*sin(N) - 1.3*sin(2.0*N);
158 Etide.K1.nu = -8.9*sin(N) + 0.7*sin(2.0*N);
159 Etide.M2.nu = -2.1*sin(N);
160 Etide.S2.nu = 0.0;
161 Etide.K2.nu = -17.7*sin(N) + 0.7*sin(2.0*N);
162 }
163 else {
164 Etide.O1.f = 1.0;
165 Etide.K1.f = 1.0;
166 Etide.M2.f = 1.0;
167 Etide.S2.f = 1.0;
168 Etide.K2.f = 1.0;
169
170 Etide.O1.nu = 0.0;
171 Etide.K1.nu = 0.0;
172 Etide.M2.nu = 0.0;
173 Etide.S2.nu = 0.0;
174 Etide.K2.nu = 0.0;
175 }
176 Etide.Q1.f = Etide.O1.f;
177 Etide.N2.f = Etide.M2.f;
178 Etide.Q1.nu = Etide.O1.nu;
179 Etide.N2.nu = Etide.M2.nu;
180
181 /**
182 Mean longitude of the moon (Period = tropical month). */
183
184 double s = 218.316 + 481267.8812*T;
185
186 /**
187 Mean longitude of the sun (Period = tropical year). */
188
189 double h = 280.466 + 36000.7698*T;
190
191 /**
192 Mean longitude of lunar perigee (Period = 8.85 years). */
193
194 double p = 83.353 + 4069.0137*T;
195
196 /**
197 Compute tidal constituent phase "chi" (degrees) at Greenwich meridian. */
198
199 Etide.Q1.chi = h - 3.0*s + p - 90.0;
200 Etide.O1.chi = h - 2.0*s - 90.0;
201 Etide.K1.chi = h + 90.0;
202 Etide.N2.chi = 2.0*h - 3.0*s + p;
203 Etide.M2.chi = 2.0*h - 2.0*s;
204 Etide.S2.chi = 0.0;
205 Etide.K2.chi = 2.0*h;
206
207 /**
208 Set tidal constituent frequency (1/s). */
209
210 Etide.Q1.omega = 0.6495854E-4;
211 Etide.O1.omega = 0.6759774E-4;
212 Etide.K1.omega = 0.7292117E-4;
213 Etide.N2.omega = 1.378797E-4;
214 Etide.M2.omega = 1.405189E-4;
215 Etide.S2.omega = 1.454441E-4;
216 Etide.K2.omega = 1.458423E-4;
217
218 /**
219 Set tidal constituent amplitude (m). */
220
221 Etide.Q1.amp = 1.9273E-2;
222 Etide.O1.amp = 10.0661E-2;
223 Etide.K1.amp = 14.1565E-2;
224 Etide.N2.amp = 4.6397E-2;
225 Etide.M2.amp = 24.2334E-2;
226 Etide.S2.amp = 11.2743E-2;
227 Etide.K2.amp = 3.0684E-2;
228
229 /**
230 Set tidal constituent Love number factors (1 + k2 - h2). The Love
231 number is defined as the ratio of the body tide to the height of
232 the static equilibrium tide. */
233
234 Etide.Q1.love = 0.695;
235 Etide.O1.love = 0.695;
236 Etide.K1.love = 0.736;
237 Etide.N2.love = 0.693;
238 Etide.M2.love = 0.693;
239 Etide.S2.love = 0.693;
240 Etide.K2.love = 0.693;
241
242 /**
243 Compute product of amp*f*love. */
244
245 Etide.Q1.Afl = Etide.Q1.amp*Etide.Q1.f*Etide.Q1.love;
246 Etide.O1.Afl = Etide.O1.amp*Etide.O1.f*Etide.O1.love;
247 Etide.K1.Afl = Etide.K1.amp*Etide.K1.f*Etide.K1.love;
248 Etide.N2.Afl = Etide.N2.amp*Etide.N2.f*Etide.N2.love;
249 Etide.M2.Afl = Etide.M2.amp*Etide.M2.f*Etide.M2.love;
250 Etide.S2.Afl = Etide.S2.amp*Etide.S2.f*Etide.S2.love;
251 Etide.K2.Afl = Etide.K2.amp*Etide.K2.f*Etide.K2.love;
252}
253
254/**
255## Computes surface elevation associated with the equilibrium tide
256
257Assumes that the coordinate system is longitude in degrees (x) and
258latitude in degrees (y).
259
260Note that the tidal constituents must first be defined by calling
261equilibrium_tide_constituents().
262
263The time `t` given (in seconds) is relative to the date/time specified
264when calling equilibrium_tide_constituents(). */
265
267{
268 if (!Etide.Q1.omega) {
270 "%s:%d: error: the tidal constituents must first be defined by calling "
271 "equilibrium_tide_constituents()\n", __FILE__, LINENO);
272 exit (1);
273 }
274
275 /**
276 Compute astronomical equilibrium tide (m) with diurnal and semidiurnal
277 constituents. The long-period constituents and high-order harmonics
278 are neglected. */
279
280 for (int _i = 0; _i < _N; _i++) /* foreach */
281 tide[] =
282 sin(2.*deg2rad*y)*(Etide.Q1.Afl*cos(Etide.Q1.omega*t +
283 deg2rad*(x + Etide.Q1.chi + Etide.Q1.nu)) +
284 Etide.O1.Afl*cos(Etide.O1.omega*t +
285 deg2rad*(x + Etide.O1.chi + Etide.O1.nu)) +
286 Etide.K1.Afl*cos(Etide.K1.omega*t +
287 deg2rad*(x + Etide.K1.chi + Etide.K1.nu))) +
288 sq(cos(deg2rad*y))*(Etide.N2.Afl*cos(Etide.N2.omega*t +
289 deg2rad*(2.0*x + Etide.N2.chi + Etide.N2.nu)) +
290 Etide.M2.Afl*cos(Etide.M2.omega*t +
291 deg2rad*(2.0*x + Etide.M2.chi + Etide.M2.nu)) +
292 Etide.S2.Afl*cos(Etide.S2.omega*t +
293 deg2rad*(2.0*x + Etide.S2.chi + Etide.S2.nu)) +
294 Etide.K2.Afl*cos(Etide.K2.omega*t +
295 deg2rad*(2.0*x + Etide.K2.chi + Etide.K2.nu)));
296}
scalar h[]
Definition atmosphere.h:6
int y
Definition common.h:76
int x
Definition common.h:76
#define pi
Definition common.h:4
int N
Definition common.h:39
static number sq(number x)
Definition common.h:11
#define p
Definition tree.h:320
#define assert(a)
Definition config.h:107
#define LINENO
Definition config.h:105
scalar s
Definition embed-tree.h:56
Etide_t M2
struct @4 Etide
const double deg2rad
Etide_t S2
Etide_t N2
Etide_t K2
Etide_t Q1
void equilibrium_tide_constituents(const char *date="2000-01-01 12:00:00", bool Lnodal=false)
Etide_t K1
Etide_t O1
void equilibrium_tide(scalar tide, double t)
double t
Definition events.h:24
def _i
Definition stencils.h:405
scalar T[]
Definition thermal.h:60