Difference between revisions of "LSF Tides"

From WikiROMS
Jump to navigationJump to search
(New page: <div class="title">Least Squares Fit for ROMS Tides</div> <math>\phi(t) = \bar\phi + \sum_{k=1}^N A_k \sin\omega_k t + \sum_{k=1}^N B_k \cos\omega_k t</math> :<math>\,\!\phi</math>: state...)   (change visibility)
 
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
<div class="title">Least Squares Fit for ROMS Tides</div>
<div class="title">Least Squares Fit for ROMS Tides</div>


<math>\phi(t) = \bar\phi + \sum_{k=1}^N A_k \sin\omega_k t + \sum_{k=1}^N B_k \cos\omega_k t</math>
A ROMS state variable, <math>\phi</math>, can be represented in terms of its time mean, <math>\bar\phi</math>, plus a set of <math>N</math>-tidal harmonics of frequency, <math>\omega_k</math>.
:<math>\,\!\phi</math>: state variables
:<math>\,\!\omega_k</math>: tidal frequency
:<math>\,\!A_k, B_k</math>: amplitude
:<math>\,\!N</math>: number of harmonics


To minimize cost function <math>\varepsilon^2</math>
<math display="block">
:<math>\varepsilon^2 = \frac{1}{T} \int_{t_1}^{t_2} \left[\phi - \left(\bar\phi + \sum_{k=1}^N (A_k \sin\omega_k t) + \sum_{k=1}^N (B_k \cos\omega_k t)\right)\right]^2dt</math>
  \phi(t) = \bar\phi + \sum_{k=1}^N A_k \sin\omega_k t + \sum_{k=1}^N B_k \cos\omega_k t
:<math>\,\!\phi,  A_k,  B_k</math> are unknowns
</math>


In discrete space:
The unknown tidal amplitude <math>A_k</math>, and <math>B_k</math> and unknown state <math>\phi</math> coefficients are evaluated by minimizing the least-squares error function defined by:
:<math>\varepsilon^2 = \frac{1}{M} \sum_{i=1}^M \left[\phi_i - \left(\bar\phi + \sum_{k=1}^N (A_k \sin\omega_k t_i) + \sum_{k=1}^N (B_k \cos\omega_k t_i)\right)\right]^2</math>


at the minimum
<math display="block">
:<math>\frac{\partial \varepsilon^2}{\partial \bar\phi} = 0</math>
  \varepsilon^2 = \frac{1}{T} \int_{t_1}^{t_2} \left[\phi - \left(\bar\phi
                  + \sum_{k=1}^N (A_k \sin\omega_k t)
                  + \sum_{k=1}^N (B_k \cos\omega_k t)\right)\right]^2dt
</math>


:<math>\frac{\partial \varepsilon^2}{\partial A_k} = 0\;\;\;\;\;\;k = 1, ..., N</math>
In discrete space:
 
:<math>\frac{\partial \varepsilon^2}{\partial B_k} = 0</math>
 
 
:<math>\frac{\partial \varepsilon^2}{\partial \bar\phi} = 0</math>
::<math>\sum_{i=1}^M \left[-2\phi_i + 2\bar\phi + 2 \sum_{k=1}^N (A_k \sin\omega_k t_i) + 2 \sum_{k=1}^N (B_k \sin\omega_k t_i)\right] = 0</math>


<math display="block">
  \varepsilon^2 = \frac{1}{M} \sum_{i=1}^M \left[\phi_i - \left(\bar\phi
                  + \sum_{k=1}^N (A_k \sin\omega_k t_i)
                  + \sum_{k=1}^N (B_k \cos\omega_k t_i)\right)\right]^2
</math>


:<math>\frac{\partial \varepsilon^2}{\partial A_k} = 0</math>
Minimization subject to the additional constraints <math>\frac{\partial \varepsilon^2}{\partial \bar\phi} = 0</math>, <math>\frac{\partial \varepsilon^2}{\partial A_k} = 0</math>, <math>\frac{\partial \varepsilon^2}{\partial B_k} = 0</math> result in a linear set of equations:
::<math>\begin{align}\sum_{i=1}^M \Bigg[ &-2 \phi_i \sin\omega_k t_i + 2 \bar\phi \sin\omega_k t_i + 2\sum_{p=1}^N (A_p \sin\omega_p t_i \sin\omega_k t_i) \\ &+ 2\sum_{p=1}^N (B_p\cos\omega_p t_i \sin\omega_k t_i)\Bigg] = 0\end{align}</math>


<math display="block">
  \sum_{i=1}^M \left[-2\phi_i + 2\bar\phi + 2 \sum_{k=1}^N (A_k \sin\omega_k t_i)
                + 2 \sum_{k=1}^N (B_k \sin\omega_k t_i)\right] = 0
</math>


:<math>\frac{\partial \varepsilon^2}{\partial B_k} = 0</math>
<math display="block">
::<math>\begin{align}\sum_{i=1}^M \Bigg[ &-2 \phi_i \cos\omega_k t_i + 2 \bar\phi \cos\omega_k t_i + 2\sum_{p=1}^N (A_p \sin\omega_p t_i \cos\omega_k t_i) \\
  \sum_{i=1}^M \Bigg[ -2 \phi_i \sin\omega_k t_i + 2 \bar\phi \sin\omega_k t_i
&+ 2\sum_{p=1}^N (B_p\cos\omega_p t_i \cos\omega_k t_i) \Bigg] = 0\end{align}</math>
                + 2\sum_{p=1}^N (A_p \sin\omega_p t_i \sin\omega_k t_i)
                + 2\sum_{p=1}^N (B_p\cos\omega_p t_i \sin\omega_k t_i)\Bigg] = 0
</math>


<math display="block">
  \sum_{i=1}^M \Bigg[ -2 \phi_i \cos\omega_k t_i + 2 \bar\phi \cos\omega_k t_i
                + 2\sum_{p=1}^N (A_p \sin\omega_p t_i \cos\omega_k t_i)
                + 2\sum_{p=1}^N (B_p\cos\omega_p t_i \cos\omega_k t_i) \Bigg] = 0
</math>


in matrix form (7 harmonics). '''Note:''' all instances of <math>\sum</math> are actually <math>\sum_{i=1}^M</math>
in matrix form (<math>N</math> harmonics). Note: all instances of <math>\sum</math> are actually <math>\sum_{i=1}^M</math> where <math>M</math> is the number of time-steps in the time-averaging window.


:<math>\begin{array}{cccc}
<math display="block">\begin{matrix}
\left[ \begin{array} {cccccc}
\begin{bmatrix}
\\
\\
M & {\color{Blue}\sum \sin\omega_1 t_i} & {\color{Blue}\sum \sin\omega_2 t_i}
M & \sum \sin\omega_1 t_i & \sum \sin\omega_2 t_i
& \cdots & \sum \cos\omega_1 t_i & \cdots \\
& \cdots & \sum \cos\omega_1 t_i & \cdots \\
\\
\\
{\color{Blue}\sum \sin\omega_1 t_i} & {\color{Blue}\sum \sin^2 \omega_1 t_i} & \sum \sin\omega_2 t_i \sin\omega_1 t_i
\sum \sin\omega_1 t_i & \sum \sin^2 \omega_1 t_i & \sum \sin\omega_2 t_i \sin\omega_1 t_i
& \cdots & \sum \cos\omega_1 t_i \sin\omega_1 t_i & \cdots \\
& \cdots & \sum \cos\omega_1 t_i \sin\omega_1 t_i & \cdots \\
\\
\\
{\color{Blue}\sum \sin\omega_2 t_i} & {\color{Blue}\sum \sin\omega_1 t_i \sin\omega_2 t_i} & {\color{Blue}\sum \sin^2 \omega_2 t_i}
\sum \sin\omega_2 t_i & \sum \sin\omega_1 t_i \sin\omega_2 t_i & \sum \sin^2 \omega_2 t_i
& \cdots & \sum \cos\omega_1 t_i \sin\omega_2 t_i & \cdots \\
& \cdots & \sum \cos\omega_1 t_i \sin\omega_2 t_i & \cdots \\
\\
\\
{\color{Blue}\vdots} & {\color{Blue}\vdots} & \cdots & \cdots & \cdots & \cdots \\
\vdots & \vdots & \cdots & \cdots & \cdots & \cdots \\
\\
\\
{\color{Blue}\sum \sin\omega_7 t_i} & {\color{Blue}\sum \sin\omega_1 t_i \sin\omega_7 t_i} & {\color{Blue}\sum \sin\omega_2 t_i \sin\omega_7 t_i}
\sum \sin\omega_7 t_i & \sum \sin\omega_1 t_i \sin\omega_7 t_i & \sum \sin\omega_2 t_i \sin\omega_7 t_i
& \cdots & \sum \cos\omega_1 t_i \sin\omega_7 t_i & \cdots \\
& \cdots & \sum \cos\omega_1 t_i \sin\omega_7 t_i & \cdots \\
\\
\\
{\color{Blue}\sum \sin\omega_1 t_i} & {\color{Blue}\sum \sin\omega_1 t_i \cos\omega_1 t_i} & {\color{Blue}\sum \sin\omega_2 t_i \cos\omega_1 t_i}
\sum \sin\omega_1 t_i & \sum \sin\omega_1 t_i \cos\omega_1 t_i & \sum \sin\omega_2 t_i \cos\omega_1 t_i
& \cdots & \sum \cos^2 \omega_1 t_i & \cdots \\
& \cdots & \sum \cos^2 \omega_1 t_i & \cdots \\
\\
\\
{\color{Blue}\sum \cos\omega_2 t_i} & {\color{Blue}\sum \sin\omega_1 t_i \cos\omega_2 t_i} & {\color{Blue}\sum} \sin\omega_2 t_i \cos\omega_2 t_i
\sum \cos\omega_2 t_i & \sum \sin\omega_1 t_i \cos\omega_2 t_i & \sum \sin\omega_2 t_i \cos\omega_2 t_i
& \cdots & \sum \cos\omega_1 t_i \cos\omega_2 t_i & \cdots \\
& \cdots & \sum \cos\omega_1 t_i \cos\omega_2 t_i & \cdots \\
\\
\\
{\color{Blue}\vdots} & {\color{Blue}\vdots} & \vdots & \vdots & \vdots & \vdots \\
\vdots & \vdots & \vdots & \vdots & \vdots & \vdots \\
\\
\\
{\color{Blue}\sum \cos\omega_7 t_i} & {\color{Blue}\sum \sin\omega_1 t_i \cos\omega_7 t_i} & \sum \sin\omega_2 t_2 \cos\omega_7 t_i
\sum \cos\omega_7 t_i & \sum \sin\omega_1 t_i \cos\omega_7 t_i & \sum \sin\omega_2 t_2 \cos\omega_7 t_i
& \cdots & \sum \cos\omega_1 t_i \cos\omega_7 t_i & \cdots \\ \\
& \cdots & \sum \cos\omega_1 t_i \cos\omega_7 t_i & \cdots \\ \\ \end{bmatrix}
\end{array} \right] &
\;\;&
\left[ \begin{array} {c}
\begin{bmatrix}
\\
\\
\bar\phi \\ \\ A_1 \\ \\ A_2 \\ \\ \vdots \\ \\ A_7 \\ \\ B_1 \\ \\ B_2 \\ \\ \vdots \\ \\ B_7 \\ \\
\bar\phi \\ \\ A_1 \\ \\ A_2 \\ \\ \vdots \\ \\ A_7 \\ \\ B_1 \\ \\ B_2 \\ \\ \vdots \\ \\ B_7 \\ \\
\end{array} \right] &
\end{bmatrix}
= &
& = &
\left[ \begin{array} {l}
\begin{bmatrix}
\\
\\
\sum\phi_i \\ \\
\sum\phi_i \\ \\
Line 81: Line 88:
\vdots \\ \\
\vdots \\ \\
\sum\phi_i \cos\omega_7 ti \\ \\
\sum\phi_i \cos\omega_7 ti \\ \\
\end{array} \right]
\end{bmatrix}
\\
\\
A & x & & b
A & x & & b
\end{array}</math>
\end{matrix}</math>

Latest revision as of 17:22, 5 August 2015

Least Squares Fit for ROMS Tides

A ROMS state variable, , can be represented in terms of its time mean, , plus a set of -tidal harmonics of frequency, .

The unknown tidal amplitude , and and unknown state coefficients are evaluated by minimizing the least-squares error function defined by:

In discrete space:

Minimization subject to the additional constraints , , result in a linear set of equations:

in matrix form ( harmonics). Note: all instances of are actually where is the number of time-steps in the time-averaging window.