Reorganize doc

This commit is contained in:
Ian Jauslin 2024-12-15 14:20:56 -05:00
parent 9ec233fed5
commit 9d48b044ac

View File

@ -103,9 +103,85 @@ We truncate the Fourier modes and assume that $\hat u_k=0$ if $|k_1|>K_1$ or $|k
\mathcal K:=\{(k_1,k_2),\ |k_1|\leqslant K_1,\ |k_2|\leqslant K_2\} \mathcal K:=\{(k_1,k_2),\ |k_1|\leqslant K_1,\ |k_2|\leqslant K_2\}
. .
\end{equation} \end{equation}
\bigskip
\subsubsection{Runge-Kutta methods}. {\bf Remark}:
To solve the equation numerically, we will use Runge-Kutta methods, which compute an approximate value $\hat u_k^{(n)}$ for $\hat u_k(t_n)$. Since $U$ is real, $\hat U_{-k}=\hat U_k^*$, and so
\begin{equation}
\hat u_{-k}=\hat u_k^*
.
\label{realu}
\end{equation}
Similarly,
\begin{equation}
\hat g_{-k}=\hat g_k^*
.
\label{realg}
\end{equation}
Thus,
\begin{equation}
T(\hat u,-k)
=
T(\hat u,k)^*
.
\label{realT}
\end{equation}
In order to keep the computation as quick as possible, we only compute and store the values for $k_1\geqslant 0$.
(In fact, if we do not enforce the reality conditions, the computation has been found to be unstable.)
\subsection{Reversible equation}
\indent The reversible equation is similar to\-~(\ref{ins}) but instead of fixing the viscosity, we fix the enstrophy\-~\cite{Ga22}.
It is defined directly in Fourier space:
\begin{equation}
\partial_t\hat U_k=
-\frac{4\pi^2}{L^2}\alpha(\hat U) k^2\hat U_k+\hat G_k
-i\frac{2\pi}L\sum_{\displaystyle\mathop{\scriptstyle p,q\in\mathbb Z^2}_{p+q=k}}
(q\cdot\hat U_p)\hat U_q
,\quad
k\cdot\hat U_k=0
\end{equation}
where $\alpha$ is chosen such that the enstrophy is constant.
In terms of $\hat u$\-~(\ref{udef}), (\ref{gdef}), (\ref{T}):
\begin{equation}
\partial_t\hat u_k=
-\frac{4\pi^2}{L^2}\alpha(\hat u) k^2\hat u_k
+\hat g_k
+\frac{4\pi^2}{L^2|k|}T(\hat u,k)
.
\label{rns_k}
\end{equation}
To compute $\alpha$, we use the constancy of the enstrophy:
\begin{equation}
\sum_{k\in\mathbb Z^2}k^2\hat U_k\cdot\partial_t\hat U_k
=0
\end{equation}
which, in terms of $\hat u$ is
\begin{equation}
\sum_{k\in\mathbb Z^2}k^2\hat u_k^*\partial_t\hat u_k
=0
\end{equation}
that is
\begin{equation}
\frac{4\pi^2}{L^2}\alpha(\hat u)\sum_{k\in\mathbb Z^2}k^4|\hat u_k|^2
=
\sum_{k\in\mathbb Z^2}k^2\hat u_k^*\hat g_k
+\frac{4\pi^2}{L^2}\sum_{k\in\mathbb Z^2}|k|\hat u_k^*T(\hat u,k)
\end{equation}
and so
\begin{equation}
\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}
\alpha(\hat u)\in\mathbb R
.
\end{equation}
\subsection{Runge-Kutta methods}.
To solve these equations numerically, we will use Runge-Kutta methods, which compute an approximate value $\hat u_k^{(n)}$ for $\hat u_k(t_n)$.
{\tt nstrophy} supports the 4th order Runge-Kutta ({\tt RK4}) and 2nd order Runge-Kutta ({\tt RK2}) algorithms. {\tt nstrophy} supports the 4th order Runge-Kutta ({\tt RK4}) and 2nd order Runge-Kutta ({\tt RK2}) algorithms.
In addition, several variable step methods are implemented: In addition, several variable step methods are implemented:
\begin{itemize} \begin{itemize}
@ -190,30 +266,8 @@ It can be made by specifying the parameter {\tt adaptive\_cost}.
These cost functions are selected by choosing {\tt adaptive\_cost=k3} and {\tt adaptive\_cost=k32} respectively. These cost functions are selected by choosing {\tt adaptive\_cost=k3} and {\tt adaptive\_cost=k32} respectively.
\end{itemize} \end{itemize}
\subsubsection{Reality}.
Since $U$ is real, $\hat U_{-k}=\hat U_k^*$, and so
\begin{equation}
\hat u_{-k}=\hat u_k^*
.
\label{realu}
\end{equation}
Similarly,
\begin{equation}
\hat g_{-k}=\hat g_k^*
.
\label{realg}
\end{equation}
Thus,
\begin{equation}
T(\hat u,-k)
=
T(\hat u,k)^*
.
\label{realT}
\end{equation}
In order to keep the computation as quick as possible, we only compute and store the values for $k_1\geqslant 0$.
\subsubsection{FFT}. We compute T using a fast Fourier transform, defined as \subsection{Computation of $T$: FFT}. We compute T using a fast Fourier transform, defined as
\begin{equation} \begin{equation}
\mathcal F(f)(n):=\sum_{m\in\mathcal N}e^{-\frac{2i\pi}{N_1}m_1n_1-\frac{2i\pi}{N_2}m_2n_2}f(m_1,m_2) \mathcal F(f)(n):=\sum_{m\in\mathcal N}e^{-\frac{2i\pi}{N_1}m_1n_1-\frac{2i\pi}{N_2}m_2n_2}f(m_1,m_2)
\end{equation} \end{equation}
@ -257,6 +311,11 @@ Therefore,
\right)(k) \right)(k)
\end{equation} \end{equation}
\subsection{Observables}
\indent
We define the following observables.
\bigskip
\subsubsection{Energy}. \subsubsection{Energy}.
We define the energy as We define the energy as
\begin{equation} \begin{equation}
@ -367,7 +426,7 @@ The enstrophy is defined as
. .
\end{equation} \end{equation}
\subsubsection{Lyapunov exponents} \subsection{Lyapunov exponents}
\indent \indent
To compute the Lyapunov exponents, we must first compute the Jacobian of $\hat u^{(n)}\mapsto\hat u^{(n+1)}$. To compute the Lyapunov exponents, we must first compute the Jacobian of $\hat u^{(n)}\mapsto\hat u^{(n+1)}$.
This map is always of Runge-Kutta type, that is, This map is always of Runge-Kutta type, that is,
@ -453,62 +512,6 @@ The Lyapunov exponents at time $\alpha\mathfrak L_r$ are then
. .
\end{equation} \end{equation}
\subsubsection{Numerical instability}.
In order to prevent the algorithm from blowing up, it is necessary to impose the reality of $u(x)$ by hand, otherwise, truncation errors build up, and lead to divergences.
It is sufficient to ensure that the convolution term $T(\hat u,k)$ satisfies $T(\hat u,-k)=T(\hat u,k)^*$.
After imposing this condition, the algorithm no longer blows up, but it is still unstable (for instance, increasing $K_1$ or $K_2$ leads to very different results).
\subsection{Reversible equation}
\indent The reversible equation is similar to\-~(\ref{ins}) but instead of fixing the viscosity, we fix the enstrophy\-~\cite{Ga22}.
It is defined directly in Fourier space:
\begin{equation}
\partial_t\hat U_k=
-\frac{4\pi^2}{L^2}\alpha(\hat U) k^2\hat U_k+\hat G_k
-i\frac{2\pi}L\sum_{\displaystyle\mathop{\scriptstyle p,q\in\mathbb Z^2}_{p+q=k}}
(q\cdot\hat U_p)\hat U_q
,\quad
k\cdot\hat U_k=0
\end{equation}
where $\alpha$ is chosen such that the enstrophy is constant.
In terms of $\hat u$\-~(\ref{udef}), (\ref{gdef}), (\ref{T}):
\begin{equation}
\partial_t\hat u_k=
-\frac{4\pi^2}{L^2}\alpha(\hat u) k^2\hat u_k
+\hat g_k
+\frac{4\pi^2}{L^2|k|}T(\hat u,k)
.
\label{rns_k}
\end{equation}
To compute $\alpha$, we use the constancy of the enstrophy:
\begin{equation}
\sum_{k\in\mathbb Z^2}k^2\hat U_k\cdot\partial_t\hat U_k
=0
\end{equation}
which, in terms of $\hat u$ is
\begin{equation}
\sum_{k\in\mathbb Z^2}k^2\hat u_k^*\partial_t\hat u_k
=0
\end{equation}
that is
\begin{equation}
\frac{4\pi^2}{L^2}\alpha(\hat u)\sum_{k\in\mathbb Z^2}k^4|\hat u_k|^2
=
\sum_{k\in\mathbb Z^2}k^2\hat u_k^*\hat g_k
+\frac{4\pi^2}{L^2}\sum_{k\in\mathbb Z^2}|k|\hat u_k^*T(\hat u,k)
\end{equation}
and so
\begin{equation}
\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}
\alpha(\hat u)\in\mathbb R
.
\end{equation}
\vfill \vfill