diff --git a/tex-docs/appendices/vars.tex b/tex-docs/appendices/vars.tex index 9b1f3e7..7af2e47 100644 --- a/tex-docs/appendices/vars.tex +++ b/tex-docs/appendices/vars.tex @@ -55,4 +55,5 @@ only applies to variables in code, every symbol in equations are explained at th \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. + \item $smooth_{vert}$: The smoothing parameter for the vertical part of the velocities. \end{itemize} \ No newline at end of file diff --git a/tex-docs/topics/advection.tex b/tex-docs/topics/advection.tex index 5caf015..2eb659d 100644 --- a/tex-docs/topics/advection.tex +++ b/tex-docs/topics/advection.tex @@ -162,7 +162,8 @@ potential temperature and vice versa. The whole process of moving temperature ar \autoref{eq:thermal potential} and \autoref{eq:potential temp} into code and create an overarching function that calls the previously mentioned equations. Let us start with \autoref{eq:thermal potential} which is described in \autoref{alg:temp to pot}. Note that $\frac{R}{C_a}$ does not change as they are constants, therefore we can precompute them which saves quite a bit of time (namely $O(n^3)$ divisions, where $n$ is the length of each dimension of $T_a$). Also note that we can inverse the process by inserting a minus in the exponent and swapping $T_a$ -and $\theta$, which can easily be done in the call to \autoref{alg:temp to pot}. +and $\theta$, which can easily be done in the call to \autoref{alg:temp to pot}. To avoid confusion we rename $p_0$ to $p_r$ as we talk about a reference pressure, instead of the already defined +pressure from a previous calculation round. \begin{algorithm} \SetKwInOut{Input}{Input} @@ -176,9 +177,9 @@ and $\theta$, which can easily be done in the call to \autoref{alg:temp to pot}. } \For{$i \leftarrow 0$ \KwTo $T_a.length$}{ \For{$j \leftarrow 0$ \KwTo $T_a[i].length$}{ - $p_0 \leftarrow p[i, j 0]$ \; + $p_r \leftarrow p[i, j 0]$ \; \For{$k \leftarrow 0$ \KwTo $T_a[i, j].length$}{ - $\theta[i, j, k] \leftarrow T_a[i, j, k] (\frac{p[i, j, k]}{p_0})^{\kappa}$ + $\theta[i, j, k] \leftarrow T_a[i, j, k] (\frac{p[i, j, k]}{p_r})^{\kappa}$ } } } diff --git a/tex-docs/topics/control_panel.tex b/tex-docs/topics/control_panel.tex index 2746f9a..4df1fb6 100644 --- a/tex-docs/topics/control_panel.tex +++ b/tex-docs/topics/control_panel.tex @@ -110,6 +110,7 @@ definitions can be found in \autoref{alg:model constants}. What the $adv$ boolea $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} + $smooth_{vert} \leftarrow 0.3$ \Comment*[l]{The smoothing parameter for the vertical part of the velocities} $count \leftarrow 0$ \; \For{$j \in [0, top]$}{ $heights[j] \leftarrow count$ \Comment*[l]{The height of a layer (\si{m})} diff --git a/tex-docs/topics/master.tex b/tex-docs/topics/master.tex index fcb9f04..4e62f39 100644 --- a/tex-docs/topics/master.tex +++ b/tex-docs/topics/master.tex @@ -150,7 +150,7 @@ do not consider the data that occurs so infrequently that it means nothing. We d \begin{algorithm} $u \leftarrow \texttt{Smooth}(u, smooth_u)$ \; $v \leftarrow \texttt{Smooth}(v, smooth_v)$ \; - $w \leftarrow \texttt{Smooth}(w, smooth_w)$ \; + $w \leftarrow \texttt{Smooth}(w, smooth_w, smooth_{vert})$ \; \caption{Smoothing the velocity} \label{alg:smoothv} \end{algorithm} \ No newline at end of file diff --git a/tex-docs/topics/util_funcs.tex b/tex-docs/topics/util_funcs.tex index f04fd62..bf845f9 100644 --- a/tex-docs/topics/util_funcs.tex +++ b/tex-docs/topics/util_funcs.tex @@ -302,19 +302,20 @@ a later point in the future. It will then be found here, so you will have to sta 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. +take the real part and return that. $v$ is an optional parameter with default value $0.5$ which does absolutely nothing in this algorithm. \begin{algorithm} \SetKwInOut{Input}{Input} \SetKwInOut{Output}{Output} - \Input{Array $a$, smoothing factor $s$} + \Input{Array $a$, smoothing factor $s$, vertical smoothing factor $v \leftarrow 0.5$} \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$ \; + $temp[:,int(nlon s):int(nlon(1 - s)),:] \leftarrow 0$ \; + $temp[:,:,int(nlevels v):int(nlevels(1 - v))] \leftarrow 0$ \; \Return $\texttt{IFFT}(temp).real$ \; \caption{Smoothing function} \label{alg:smooth}