mirror of https://github.com/Askill/claude.git
Finished the stream of 09-09-2020. Still need to do multidimensional FFTs though...
This commit is contained in:
parent
b9c5f4cbfb
commit
ed45734d26
|
|
@ -51,4 +51,8 @@ only applies to variables in code, every symbol in equations are explained at th
|
|||
\item $p_0$: The pressure of a latitude, longitude, atmospheric layer gridcell from the previous calculation round.
|
||||
\item $\alpha_a$: The thermal diffusivity constant for air.
|
||||
\item $\alpha_p$: The thermal diffusivity constant for the planet surface.
|
||||
\item $smooth_t$: The smoothing parameter for the temperature.
|
||||
\item $smooth_u$: The smoothing parameter for the $u$ component of the velocity.
|
||||
\item $smooth_v$: The smoothing parameter for the $v$ component of the velocity.
|
||||
\item $smooth_w$: The smoothing parameter for the $w$ component of the velocity.
|
||||
\end{itemize}
|
||||
|
|
@ -106,7 +106,10 @@ definitions can be found in \autoref{alg:model constants}. What the $adv$ boolea
|
|||
$\delta y \leftarrow \frac{2\pi r}{nlat}$ \Comment*[l]{How far apart the gridpoints in the y direction are (degrees latitude)}
|
||||
$\alpha_a \leftarrow 2 \cdot 10^{-5}$ \Comment*[l]{The diffusivity constant for the atmosphere}
|
||||
$\alpha_p \leftarrow 1.5 \cdot 10^{-6}$ \Comment*[l]{The diffusivity constant for the planet surface}
|
||||
|
||||
$smooth_t \leftarrow 0.9$ \Comment*[l]{the smoothing parameter for the temperature}
|
||||
$smooth_u \leftarrow 0.8$ \Comment*[l]{The smoothing parameter for the $u$ component of the velocity}
|
||||
$smooth_v \leftarrow 0.8$ \Comment*[l]{The smoothing parameter for the $v$ component of the velocity}
|
||||
$smooth_w \leftarrow 0.3$ \Comment*[l]{The smoothing parameter for the $w$ component of the velocity}
|
||||
$count \leftarrow 0$ \;
|
||||
\For{$j \in [0, top]$}{
|
||||
$heights[j] \leftarrow count$ \Comment*[l]{The height of a layer}
|
||||
|
|
|
|||
|
|
@ -134,3 +134,23 @@ the first valid index to $bla$.
|
|||
\label{alg:velocity clamped}
|
||||
\end{algorithm}
|
||||
|
||||
\subsection{Smoothing all the things}
|
||||
On a planet wide scale, you have a lot of variety in the data. To counteract that we filter out the high frequency data. Which means that we filter out the data that occurs sporadically. So we
|
||||
do not consider the data that occurs so infrequently that it means nothing. We do this for the radiation (temperature) and the velocity which is shown in \autoref{alg:smootht} and
|
||||
\autoref{alg:smoothv} respectively. It is worth mentioning that \autoref{alg:smootht} is executed after we do the calculations for $T_a$ (shown in \autoref{alg:optical depth}).
|
||||
\autoref{alg:smoothv} is done after \autoref{alg:velocity} but before \autoref{alg:velocity clamped}.
|
||||
|
||||
|
||||
\begin{algorithm}
|
||||
$T_a \leftarrow \texttt{Smooth}(T_a, smooth_t)$ \;
|
||||
\caption{Smoothing the atmospheric temperature}
|
||||
\label{alg:smootht}
|
||||
\end{algorithm}
|
||||
|
||||
\begin{algorithm}
|
||||
$u \leftarrow \texttt{Smooth}(u, smooth_u)$ \;
|
||||
$v \leftarrow \texttt{Smooth}(v, smooth_v)$ \;
|
||||
$w \leftarrow \texttt{Smooth}(w, smooth_w)$ \;
|
||||
\caption{Smoothing the velocity}
|
||||
\label{alg:smoothv}
|
||||
\end{algorithm}
|
||||
|
|
@ -282,6 +282,7 @@ This symmetry as it is called can be exploited to produce a divide and conquer a
|
|||
}
|
||||
}
|
||||
\Return{B}
|
||||
\caption{One dimensional Fast Fourier Transformation}
|
||||
\label{alg:FFT}
|
||||
\end{algorithm}
|
||||
|
||||
|
|
@ -297,3 +298,24 @@ second dimension. This can of course be extended in the same way for a $p$-dimen
|
|||
It is at this point that the algorithm becomes very complicated. Therefore I would like to invite you to use a library for these kinds of calculations, like Numpy \cite{numpy} for Python. If you
|
||||
really want to use your own made version, you need to wait for a bit as I try to decode the literature on the algorithm for it. It is one heck of a thing to decode, so I decided to treat that at
|
||||
a later point in the future. It will then be found here, so you will have to stay tuned. Sorry about that, it's quite complex...
|
||||
|
||||
With that out of the way (or rather on the TODO list), we need to create a smoothing operation out of it. We do this in \autoref{alg:smooth}. Keep in mind that \texttt{FFT} the call is to the
|
||||
multidimensional Fast Fourier Transform algorithm, \texttt{IFFT} the call to the inverse of the multidimensional Fast Fourier Transform algorithm (also on the TODO list) and that the $int()$
|
||||
function ensures that the number in brackets is an integer. Also note that the inverse of the FFT might give complex answers, and we only want real answers which the $.real$ ensures. We only
|
||||
take the real part and return that.
|
||||
|
||||
\begin{algorithm}
|
||||
\SetKwInOut{Input}{Input}
|
||||
\SetKwInOut{Output}{Output}
|
||||
\Input{Array $a$, smoothing factor $s$}
|
||||
\Output{Array $A$ with less variation}
|
||||
$nlat \leftarrow a.length$ \;
|
||||
$nlon \leftarrow a[0].length$ \;
|
||||
$nlevels \leftarrow a[0][0].length$ \;
|
||||
$temp \leftarrow \texttt{FFT}(a)$ \;
|
||||
$temp[int(nlat s):int(nlat(1 - s)),:,:] \leftarrow 0$ \;
|
||||
$temp[:,int(nlon s):int(nlon(1 - s)),:] \leftarrow 0$ \;
|
||||
\Return $\texttt{IFFT}(temp).real$ \;
|
||||
\caption{Smoothing function}
|
||||
\label{alg:smooth}
|
||||
\end{algorithm}
|
||||
Loading…
Reference in New Issue