Rewrite cost function for adaptive step
This commit is contained in:
@ -115,18 +115,18 @@ In addition, several variable step methods are implemented:
|
||||
\end{itemize}
|
||||
In these adaptive step methods, two steps are computed at different orders: $\hat u_k^{(n)}$ and $\hat U_k^{(n)}$, the step size is adjusted at every step in such a way that the error is small enough:
|
||||
\begin{equation}
|
||||
\|\hat u^{(n)}-\hat U^{(n)}\|
|
||||
D(\hat u^{(n)},\hat U^{(n)})
|
||||
<\epsilon_{\mathrm{target}}
|
||||
\end{equation}
|
||||
for some given $\epsilon_{\mathrm{target}}$, set using the {\tt adaptive\_tolerance} parameter.
|
||||
The choice of the norm matters, and will be discussed below.
|
||||
for some given {\it cost function} $D$, and $\epsilon_{\mathrm{target}}$, set using the {\tt adaptive\_tolerance} parameter.
|
||||
The choice of the cost function matters, and will be discussed below.
|
||||
If the error is larger than the target, then the step size is decreased.
|
||||
How this is done depends on the order of algorithm.
|
||||
If the order is $q$ (here we mean the smaller of the two orders, so 4 for {\tt RKDP54} and {\tt RKF45} and 2 for {\tt RKBS32}), then we expect
|
||||
If the order is $q$ (here we mean the smaller of the two orders, so 4 for {\tt RKDP54} and {\tt RKF45} and 2 for {\tt RKBS32}), then we expect (as long as the cost function is such that $D(\hat u,\hat u+\varphi)\sim\|\varphi\|$ in some norm)
|
||||
\begin{equation}
|
||||
\|\hat u^{(n)}-\hat U^{(n)}\|=\delta_n^qC_n
|
||||
.
|
||||
D(\hat u^{(n)},\hat U^{(n)})=\delta_n^qC_n
|
||||
\end{equation}
|
||||
for some number $C_n$.
|
||||
We wish to set $\delta_{n+1}$ so that
|
||||
\begin{equation}
|
||||
\delta_{n+1}^qC_n=\epsilon_{\mathrm{target}}
|
||||
@ -135,7 +135,7 @@ so
|
||||
\begin{equation}
|
||||
\delta_{n+1}
|
||||
=\left(\frac{\epsilon_{\mathrm{target}}}{C_n}\right)^{\frac1q}
|
||||
=\delta_n\left(\frac{\epsilon_{\mathrm{target}}}{\|\hat u^{(n)}-\hat U^{(n)}\|}\right)^{\frac1q}
|
||||
=\delta_n\left(\frac{\epsilon_{\mathrm{target}}}{D(\hat u^{(n)},\hat U^{(n)})}\right)^{\frac1q}
|
||||
.
|
||||
\label{adaptive_delta}
|
||||
\end{equation}
|
||||
@ -145,59 +145,49 @@ To be safe, we also set a maximal value for $\delta$ via the {\tt max\_delta} pa
|
||||
\bigskip
|
||||
|
||||
\indent
|
||||
The choice of the norm $\|\cdot\|$ matters.
|
||||
It can be made by specifying the parameter {\tt adaptive\_norm}.
|
||||
The choice of the cost function $D$ matters.
|
||||
It can be made by specifying the parameter {\tt adaptive\_cost}.
|
||||
\begin{itemize}
|
||||
\item A naive choice is to take $\|\cdot\|$ to be the normalized $L_1$ norm:
|
||||
\item
|
||||
For computations where the main focus is the enstrophy\-~(\ref{enstrophy}), one may want to set the cost function to the relative difference of the enstrophies:
|
||||
\begin{equation}
|
||||
\|f\|:=
|
||||
\frac1{\mathcal N}\sum_k|f_k|
|
||||
,\quad
|
||||
\mathcal N:=\sum_k|\hat u_k^{(n)}-\hat u_k^{(n-1)}|
|
||||
D(\hat u,\hat U):=\frac{|\mathcal En(\hat u)-\mathcal En(\hat U)|}{\mathcal En(\hat u)}
|
||||
.
|
||||
\end{equation}
|
||||
This norm is selected by choosing {\tt adaptive\_norm=L1}.
|
||||
This cost function is selected by choosing {\tt adaptive\_cost=enstrophy}.
|
||||
|
||||
\item Empirically, we have found that $|\hat u-\hat U|$ behaves like $k^{-3}$ for {\tt RKDP54} and {\tt RKF45}, and like $k^{-\frac32}$ for {\tt RKBS32}, so a norm of the form
|
||||
\item
|
||||
For computations where the main focus is the value of $\alpha$\-~(\ref{alpha}), one may want to set the cost function to the relative difference of $\alpha$:
|
||||
\begin{equation}
|
||||
\|f\|:=\frac1{\mathcal N}\sum_k|f_k|k^{-3}
|
||||
D(\hat u,\hat U):=\frac{|\alpha(\hat u)-\alpha(\hat U)|}{|\alpha(\hat u)|}
|
||||
.
|
||||
\end{equation}
|
||||
This cost function is selected by choosing {\tt adaptive\_cost=alpha}.
|
||||
|
||||
\item Alternatively, one my take $D$ to be the normalized $L_1$ norm:
|
||||
\begin{equation}
|
||||
D(\hat u,\hat U):=
|
||||
\frac1{\mathcal N}\sum_k|\hat u_k-\hat U_k|
|
||||
,\quad
|
||||
\mathcal N:=\sum_k|\hat u_k^{(n)}-\hat u_k^{(n-1)}|k^{-3}
|
||||
\mathcal N:=\sum_k|\hat u_k|
|
||||
.
|
||||
\end{equation}
|
||||
This function is selected by choosing {\tt adaptive\_cost=L1}.
|
||||
|
||||
\item Empirically, we have found that $|\hat u-\hat U|$ behaves like $k^{-3}$ for {\tt RKDP54} and {\tt RKF45}, and like $k^{-\frac32}$ for {\tt RKBS32}, so a cost function of the form
|
||||
\begin{equation}
|
||||
D(\hat u,\hat U):=\frac1{\mathcal N}\sum_k|\hat u_k-\hat U_k|k^{-3}
|
||||
,\quad
|
||||
\mathcal N:=\sum_k|\hat u_k|k^{-3}
|
||||
\end{equation}
|
||||
or
|
||||
\begin{equation}
|
||||
\|f\|:=\frac1{\mathcal N}\sum_k|f_k|k^{-\frac32}
|
||||
D(\hat u,\hat U):=\frac1{\mathcal N}\sum_k|\hat u_k-\hat U_k|k^{-\frac32}
|
||||
,\quad
|
||||
\mathcal N:=\sum_k|\hat u_k^{(n)}-\hat u_k^{(n-1)}|k^{-\frac32}
|
||||
\mathcal N:=\sum_k|\hat u_k|k^{-\frac32}
|
||||
\end{equation}
|
||||
are sensible choices.
|
||||
These norms are selected by choosing {\tt adaptive\_norm=k3} and {\tt adaptive\_norm=k32} respectively.
|
||||
|
||||
\item
|
||||
Another option is to define a norm based on the expression of the enstrophy\-~(\ref{enstrophy}):
|
||||
\begin{equation}
|
||||
\|f\|:=\frac1{\mathcal N}\sqrt{\sum_k k^2|f_k|^2}
|
||||
,\quad
|
||||
\mathcal N:=\frac{\sqrt{\sum_k k^2|\hat u_k^{(n)}|^2}+\sqrt{\sum_k k^2|\hat U_k^{(n)}|^2}}{\sum_k k^2|\hat u_k^{(n)}|^2}
|
||||
.
|
||||
\end{equation}
|
||||
Doing so controls the error of the enstrophy through
|
||||
\begin{equation}
|
||||
\frac1{\mathcal N^2}|\mathcal En(\hat u)-\mathcal En(\hat U)|\equiv|\|\hat u\|^2-\|\hat U\|^2|\leqslant \|\hat u-\hat U\|(\|\hat u\|+\|\hat U\|)
|
||||
\end{equation}
|
||||
so
|
||||
\begin{equation}
|
||||
\frac1{\mathcal N^2}
|
||||
|\mathcal En(\hat u)-\mathcal En(\hat U)|\leqslant
|
||||
\|\hat u-\hat U\|\frac1{\mathcal N}\left(\sqrt{\sum_k k^2|\hat u_k|^2}+\sqrt{\sum_k k^2|\hat U_k|^2}\right)
|
||||
\end{equation}
|
||||
and thus
|
||||
\begin{equation}
|
||||
\frac{|\mathcal En(\hat u)-\mathcal En(\hat U)|}{\mathcal En(\hat u)}\leqslant
|
||||
\|\hat u-\hat U\|
|
||||
.
|
||||
\end{equation}
|
||||
This norm is selected by choosing {\tt adaptive\_norm=enstrophy}.
|
||||
These cost functions are selected by choosing {\tt adaptive\_cost=k3} and {\tt adaptive\_cost=k32} respectively.
|
||||
\end{itemize}
|
||||
|
||||
\subsubsection{Reality}.
|
||||
@ -511,6 +501,7 @@ and so
|
||||
\alpha(\hat u)
|
||||
=\frac{\frac{L^2}{4\pi^2}\sum_k k^2\hat u_k^*\hat g_k+\sum_k|k|\hat u_k^*T(\hat u,k)}{\sum_kk^4|\hat u_k|^2}
|
||||
.
|
||||
\label{alpha}
|
||||
\end{equation}
|
||||
Note that, by\-~(\ref{realu})-(\ref{realT}),
|
||||
\begin{equation}
|
||||
|
Reference in New Issue
Block a user