# HG changeset patch
# User paugier <pierre.augier@univ-grenoble-alpes.fr>
# Date 1698139210 -7200
#      Tue Oct 24 11:20:10 2023 +0200
# Node ID 3113319e44c138cc5bf53dd5783f2094e0795e18
# Parent  2f41535b33658b55690c6bc6306099870d7caa35
2022strat_polo_proj: improve forcing description.

diff --git a/2022strat_polo_proj/input/main.tex b/2022strat_polo_proj/input/main.tex
--- a/2022strat_polo_proj/input/main.tex
+++ b/2022strat_polo_proj/input/main.tex
@@ -597,16 +597,18 @@
 use an anisotropic, poloidal velocity forcing $\hatff = \hatf \, \eep$. The flow is
 forced at large spatial scales $ \left\{\kk ~ | ~ 5 \leq k/\Delta k_h \leq 20 \right\}$
 and small angle $\left\{\kk ~ | ~ |\ok /N - \sin \theta_f| \leq 0.05 \right\}$ where
-$\sin \theta_f = 0.3$, meaning that relatively slow internal waves are forced. \Remove{The
-correlation time of the forcing is equal to the period of the forced waves $T_c = 2\pi
-/(N \sin \theta_f)$.} The forcing scheme is described in Appendix~\ref{appendix:forcing}. \Add{It is not harmonic, and not given by a stochastic differential equation either. Instead, the phase and
-the amplitude of the forced wave numbers are randomly changed every renewal time $T_c$ equal to the period of the forced waves $2\pi
-/(N \sin \theta_f)$.} \Add{Forcing slow waves is
-motivated by oceanic applications, where waves are generated, among other processes, by
-slow tides \cite{mackinnon_climate_2017, nikurashin_legg_mechanism_2011}. Low frequency
-forcing is also used in order to have a scale separation between forced frequencies and
-the \bv frequency so that one can potentially reproduce features of the oceanic
-temporal spectra close to $N$.}
+$\sin \theta_f = 0.3$, meaning that relatively slow internal waves are forced. The
+forcing scheme is described in Appendix~\ref{appendix:forcing}. \Add{It is neither
+harmonic nor given by a stochastic differential equation. Instead, a time correlated
+forcing is computed via generations of pseudo random numbers and time interpolations.}
+Its correlation time is equal to the period of the forced waves $T_c = 2\pi /(N \sin
+\theta_f)$. \Add{The forcing is normalized such that the kinetic injection rate $P_K$
+is always equal to 1.} \Add{Forcing slow waves is motivated by oceanic applications,
+where waves are generated, among other processes, by slow tides
+\cite{mackinnon_climate_2017, nikurashin_legg_mechanism_2011}. Low frequency forcing is
+also used in order to have a scale separation between forced frequencies and the \bv
+frequency so that one can potentially reproduce features of the oceanic temporal
+spectra close to $N$.}
 
 The time advancement is performed using the $4^{th}$ order Runge-Kutta scheme. All
 modes with wave-number modulus larger than $\kmax = 0.8 (n_h/2) \Delta k_h$ are
@@ -969,11 +971,12 @@
 without vortical modes has no energy in the toroidal velocity. \Add{When vortical modes
 are present, an important part of the energy is contained in one vortical mode with
 $(k_h,k_z) = (\Delta k_h, 2 \Delta k_z)$, corresponding to large, nearly vertical
-stacked shear layers (Figure~\ref{fig:spectra_khkz}$\rm (a)$). Energy then tends to be accumulated at the smallest horizontal wave vectors, close to shear modes.} When vortical modes are
-removed, energy is sill concentrated in the same wave-vectors, but in the form of
-poloidal an potential energy (Figure~\ref{fig:spectra_khkz}$\rm (d)$-$\rm (f)$). Except
-for this qualitative difference, the toroidal, poloidal, and potential energy spectra
-show the same trends. 
+stacked shear layers (Figure~\ref{fig:spectra_khkz}$\rm (a)$). Energy then tends to be
+accumulated at the smallest horizontal wave vectors, close to shear modes.} When
+vortical modes are removed, energy is sill concentrated in the same wave-vectors, but
+in the form of poloidal an potential energy (Figure~\ref{fig:spectra_khkz}$\rm
+(d)$-$\rm (f)$). Except for this qualitative difference, the toroidal, poloidal, and
+potential energy spectra show the same trends.
 
 \begin{figure}
 \includegraphics[width=1.0\textwidth]{figure8}
@@ -1470,32 +1473,31 @@
 \section{Forcing scheme}
 \label{appendix:forcing}
 
-\Add{Our forcing is designed to excite waves. Phase and amplitude of the forced wave numbers are randomly changed in time every $T_c$ such that the input kinetic energy is equal to unity. Namely, we use the following algorithm:}
+\Add{Our forcing is designed to excite waves and computed via generation of pseudo
+random numbers with uniform distribution and time interpolation. Namely, we use the
+following algorithm:}
 
 \begin{algorithm}[H]
-$t=0$: generate two random numbers $f_{0\kk}, f_{1\kk} \sim \mathcal{P}$ $\forall \kk$ in the forcing region; $t_0 = 0$; \\
+$t = 0$; $t_0 = 0$; \\
+Generate two complex random fields $\hat f_0(\kk)$ and $\hat f_1(\kk)$; \\
+$\hatff = \hat f_0 \, \eep$;\\
+Normalize $\hatff$ to ensure
+\Add{$P_K(t) = \sum\limits_{\kk} ~ \Re \left[ \hatff \cdot \hatvv^* + \frac{\Delta t}{2} |\hatff|^2 \right] =  1$};\\
 \While{$t \leq T$}{
-	$t \rightarrow t + \Delta t$; \\
+	$t = t + \Delta t$; \\
 	\If{$t - t_0 \geq T_c$}{
-		$t_0 \rightarrow t$; \\
-		$f_{0 \kk} \rightarrow f_{1 \kk}$; \\
-		genererate $f_{1\kk} \sim \mathcal{P}$
+		$t_0 = t$; \\
+		$\hat f_0 = \hat f_1$; \\
+		Generate $\hat f_1$;
 	}{}
-	$\hatff = \left\{f_{0\kk} - \dfrac{(f_{1\kk} - f_{0\kk})}{2} \left[\cos\left(\dfrac{\pi(t-t_0)}{T_c} \right)+ 1 \right]\right\}~ \eep$ \\
-	$\hatff$ are normalized to ensure \Add{$P_K(t) = \sum\limits_{\kk} ~ \Re \left[ \hatff \cdot \hatvv^* \right] =  1$}
+	$\hatff = \left\{ \hat f_0 - \dfrac{(\hat f_1 - \hat f_0)}{2} \left[\cos\left(\dfrac{\pi(t-t_0)}{T_c} \right)+ 1 \right]\right\}\, \eep$; \\
+	Normalize $\hatff$;
 }
 %\caption{}
 \end{algorithm}
-
-where $\mathcal{P}$ is the probability law which has for distribution
-\begin{equation}
-p_X(x) = \begin{cases}
-\frac{1}{4} ~~ \text{if} ~ \Add{\Re(x)} \in[-1:1]  ~ \text{and} ~ \Add{\Im(x)} \in[-1:1] \\
-0 ~~ \text{otherwise}
-\end{cases}
-\end{equation}
-\Remove{and} $\Delta t$ is the time increment at each time step \Add{ and $T$ is the final time of the simulation}.
-
+where $\Delta t$ is the time increment at each time step \Add{and $T$ is the final time
+of the simulation}. \Add{The random complex fields are built such that their inverse
+Fourier transform is real and they are null for unforced wavenumbers.}
 
 \section{List of simulations}