Tides result from the gravitational forces between the Earth, Moon, and Sun. Those gravitational forces change in a predictable, cyclical pattern that is influenced by Earth’s rotation and the the Moon’s revolution around the Earth, among others. In fact, there are hundreds of periodic motions among these three celestial bodies.
Each of these motions or “constituents” in a set of harmonic constants is a mathematical value describing the effect that cyclical motion has on the tides. There are 37 values that have the greatest effect on tides and are used as the tidal harmonic constituents to predict tidal conditions for a location. Furthermore, the dominant tidal constituents are
The diurnal constituents
K1 23.93 h (Lunar-solar declinational, once daily)
O1 25.82 h (Principal lunar, once daily)
The semidiurnal constituents
M2 12.42 h (Principal lunar, twice daily)
S2 12.00 h (Principal solar, twice daily)
NOAA, Tides and Currents: Harmonic Constituets
Parker, BP (2007) Tidal Analysis and Prediction, NOAA Special Publication NOS CO-OPS 3
The NOAA Tides and Currents portal includes links to water level, tide and current predictions, and other oceanographic and meteorological conditions for various locations across the United States and US Territories. Each station has a list of the harmonic constituents for that location.
A tidal pattern can be created in R by summing sinusoidal waves for each of the four harmonic constituents based on their respective periods. Each constituent will have an amplitude and phase (which you can specify or assume as initial values). Here’s how:
Define the parameters:
Amplitude (𝐴) and phase (𝜙) for each constituent.
Period (𝑇) of each constituent.
Time vector (𝑡) over which the tidal pattern will be generated.
Create the sinusoidal wave for each constituent using the formula for a sinusoidal wave: 𝑦(𝑡)=𝐴⋅sin((2𝜋𝑡/𝑇)+𝜙)
Add the sinusoidal contributions from all constituents to create the overall tidal pattern.
The R code to generate a tidal pattern is included below. It can be copy/pasted into an R Script and modified to fit the parameters of the location of interest.
The amplitudes and phases of each constituent depend on the location. They should be adjusted based on specific tidal data for the location. The time vector represents the duration over which you want to observe the tidal pattern. The periods (𝑇) are the provided harmonic constituent periods in hours. This script will generate a tidal pattern over 48 hours, but that can also be modified.
# Define parameters
time <- seq(0, 48, by = 1) # Time in hours (0 to 48 hours, step 1 hour)
# Amplitudes for the constituents at the location
A_K1 <- 0.5 # Example amplitude for K1
A_O1 <- 0.3 # Example amplitude for O1
A_M2 <- 0.7 # Example amplitude for M2
A_S2 <- 0.4 # Example amplitude for S2
# Phases for the constituents (in radians) at the location
phi_K1 <- 0
phi_O1 <- pi / 4
phi_M2 <- pi / 2
phi_S2 <- 0
# Periods in hours, which are constant for all locations
T_K1 <- 23.93
T_O1 <- 25.82
T_M2 <- 12.42
T_S2 <- 12.00
# Generate the sinusoidal waves
wave_K1 <- A_K1 * sin(2 * pi * time / T_K1 + phi_K1)
wave_O1 <- A_O1 * sin(2 * pi * time / T_O1 + phi_O1)
wave_M2 <- A_M2 * sin(2 * pi * time / T_M2 + phi_M2)
wave_S2 <- A_S2 * sin(2 * pi * time / T_S2 + phi_S2)
# Combine the waves to get the tidal pattern
tidal_pattern <- wave_K1 + wave_O1 + wave_M2 + wave_S2
# Plot the tidal pattern
plot(time, tidal_pattern, type = "l", col = "blue", lwd = 2,
xlab = "Time (hours)", ylab = "Tidal Height", main = "Tidal Pattern")
legend("topright", legend = c("Combined Tidal Pattern"), col = c("blue"), lty = 1, lwd = 2)