Updated the manual to include the stream from 19-08-2020

This commit is contained in:
TechWizzart 2020-08-21 12:39:38 +02:00
parent fa3e8bbd3a
commit aa01ea5b4c
No known key found for this signature in database
GPG Key ID: 151E66B6CEF55F2E
6 changed files with 136 additions and 6 deletions

Binary file not shown.

View File

@ -47,6 +47,12 @@ One important thing to note, the layout may change significantly when new sectio
a pain to fix and if something later on changes the whole layout may be messed up again and is a pain to fix again. Hence I opt to let \LaTeX (the software/typeset language used to create this a pain to fix and if something later on changes the whole layout may be messed up again and is a pain to fix again. Hence I opt to let \LaTeX (the software/typeset language used to create this
manual) figure out the placement of the algorithm blocks, which may or may not be in the right places. manual) figure out the placement of the algorithm blocks, which may or may not be in the right places.
Lastly, the manual is now up on the Planet Factory GitHub repository\cite{claudeGit}, together with all the source code. There is also a fork \cite{nomGit} that also contains the source code.
The fork will usually be more up to date than the version on the Planet Factory repository as Simon needs to merge pull requests into the repository. However I can update the fork freely so if a
particular stream is missing in the version on the Planet Factory repository, check the fork/Discord whether there is a newer version. If that is not the case, you just have to be a bit more
patient, or you can start writing a part of the manual yourself! Don't forget to ping me in the Discord to notify me of any additions (GitHub refuses to send me emails so I have no other way of
knowing).
\input{streams/Stream1.tex} \input{streams/Stream1.tex}
\input{streams/Stream2.tex} \input{streams/Stream2.tex}
@ -63,6 +69,8 @@ manual) figure out the placement of the algorithm blocks, which may or may not b
\input{streams/Stream8.tex} \input{streams/Stream8.tex}
\input{streams/Stream9.tex}
\newpage \newpage
\input{streams/TTNMETAF.tex} \input{streams/TTNMETAF.tex}

View File

@ -15,6 +15,14 @@ editor={Reed, CaptainEditor}
author={Clark, Simon} author={Clark, Simon}
} }
@misc{polarPlane,
howpublished="\url{https://www.twitch.tv/videos/715183053}",
author={Clark, Simon},
journal={Twitch},
year={2020},
month={Aug}
}
@misc{SI, @misc{SI,
title={SI Units}, title={SI Units},
howpublished="\url{https://www.nist.gov/pml/weights-and-measures/metric-si/si-units}", howpublished="\url{https://www.nist.gov/pml/weights-and-measures/metric-si/si-units}",
@ -307,3 +315,29 @@ author={Frierson, Dargan M. W. and Held, Isaac M. and Zurita-Gotor, Pablo},
year={2006}, year={2006},
pages={25482566} pages={25482566}
} }
@misc{claudeGit,
title={Planet-Factory/claude},
howpublished="\url{https://github.com/Planet-Factory/claude}",
journal={GitHub},
author={Clark, Simon},
editor={Reid, Peter and Marsden, Aren},
translator={Baggen, Sam}
}
@misc{nomGit,
title={TechWizzart/claude},
howpublished="\url{https://github.com/TechWizzart/claude}",
journal={GitHub},
author={Baggen, Sam}
}
@misc{pythagoras,
title={Pythagorean theorem},
howpublished="\url{https://en.wikipedia.org/wiki/Pythagorean_theorem}",
journal={Wikipedia},
publisher={Wikimedia Foundation},
author={Boldt, Axel},
year={2020},
month={Aug}
}

View File

@ -12,7 +12,8 @@ the total advection (and because it was at this time broken). %The Laplacian has
Another thing that we found out was broken is the vertical momentum. We tried to add it, ran into problems and just set it to 0 to fix the other problems that occured. One of those problems was Another thing that we found out was broken is the vertical momentum. We tried to add it, ran into problems and just set it to 0 to fix the other problems that occured. One of those problems was
a wrong initialisation of the density. We basically told the model that the density is the same on every layer of the atmosphere, which is obviously not true. Hence we need to adjust that. The a wrong initialisation of the density. We basically told the model that the density is the same on every layer of the atmosphere, which is obviously not true. Hence we need to adjust that. The
new initialisation is described in \autoref{alg:density}. Note that the $\rho[:,: i]$ notation means that for every index in the first and second dimension, only change the value for the index $i$ new initialisation is described in \autoref{alg:density}. Note that the $\rho[:,: i]$ notation means that for every index in the first and second dimension, only change the value for the index $i$
in the third dimension. in the third dimension. As soon as the vertical momentum has been fixed it will be fixed in the correct spot. If a lot of the code changes then it will probably be in another section and I will
insert a reference to that section.
\begin{algorithm} \begin{algorithm}
$\rho[:, :, 0] \leftarrow 1.3$ \; $\rho[:, :, 0] \leftarrow 1.3$ \;

View File

@ -74,7 +74,7 @@ replaces the temperature calculations we have done in \autoref{alg:temperature l
and is located near all the other constants in the code, henceforth we will refer to this section in the code as the control panel, since most if not all of the constants can be tweaked here. and is located near all the other constants in the code, henceforth we will refer to this section in the code as the control panel, since most if not all of the constants can be tweaked here.
$\tau_0$ is a function that gives the surface optical depth for a given latitude. The corresponding equation can be found in \autoref{eq:optical depth surface} \cite{simon}. Translating this $\tau_0$ is a function that gives the surface optical depth for a given latitude. The corresponding equation can be found in \autoref{eq:optical depth surface} \cite{simon}. Translating this
into code is left as an exercise to the reader. $U[0]$ is the boundary condition discussed before (being the same as \autoref{eq:stefan-boltzmann}), just as $D[nlevels]$ is the boundary condition. into code is left as an exercise to the reader. $U[0]$ is the boundary condition discussed before (being the same as \autoref{eq:stefan-boltzmann}), just as $D[nlevels]$ is the boundary condition.
$S_z$ represents the call to \autoref{alg:gradient z layer}. $S_z$ represents the call to \autoref{alg:gradient z layer}. \texttt{solar} represents the call to \autoref{alg:solar}.
\begin{algorithm} \begin{algorithm}
\For{$lat \in [-nlat, nlat]$}{ \For{$lat \in [-nlat, nlat]$}{
@ -87,10 +87,14 @@ $S_z$ represents the call to \autoref{alg:gradient z layer}.
$U[level] \leftarrow U[level - 1] + (\tau[level] - \tau[level - 1])(U[level - 1] - \sigma \cdot (mean(T_a[:, :, level]))^4)$ \; $U[level] \leftarrow U[level - 1] + (\tau[level] - \tau[level - 1])(U[level - 1] - \sigma \cdot (mean(T_a[:, :, level]))^4)$ \;
} }
$D[nlevels] \leftarrow 0$ \; $D[nlevels - 1] \leftarrow 0$ \;
\For{$level \in [nlevels - 1, 0]$}{ \For{$level \in [nlevels - 1, 0]$}{
$D[level] \leftarrow (\tau[level] - \tau[level - 1])(\sigma \cdot (mean(T_a[:, :, level]))^4) - D[level + 1]$ \; \uIf{$level == 0$}{
$D[level] \leftarrow D[level + 1] + (\tau[level + 1] - \tau[level])(\sigma \cdot (T_a[lat, lon, level])^4) - D[level + 1]$ \;
}\uElse{
$D[level] \leftarrow D[level + 1] + (\tau[level] - \tau[level - 1])(\sigma \cdot (T_a[lat, lon, level])^4) - D[level + 1]$ \;
}
} }
\For{$level \in [0, nlevels]$}{ \For{$level \in [0, nlevels]$}{
@ -98,6 +102,10 @@ $S_z$ represents the call to \autoref{alg:gradient z layer}.
} }
$T_a[lat, lon, :] \leftarrow T_a[lat, lon, :] + Q$ \; $T_a[lat, lon, :] \leftarrow T_a[lat, lon, :] + Q$ \;
$S \leftarrow \texttt{solar}(I, lat, lon, t)$ \;
$T_p[lat, lon] \leftarrow T_p[lat, lon] \frac{\delta t((1 - a[lat, lon]) S + S_z(D, 0, 0, 0) - \sigma T_p[lat, lon]^4)}{C_p[lat ,lon]}$ \;
} }
} }
\caption{Adding in radiation} \caption{Adding in radiation}
@ -109,5 +117,5 @@ $S_z$ represents the call to \autoref{alg:gradient z layer}.
\label{eq:optical depth surface} \label{eq:optical depth surface}
\end{equation} \end{equation}
Note that in this form, it did not work on stream yet. This may be due to a coding error or to a missing equation, constant or something similar. If it turns out to be a simple fix, then it will %Note that in this form, it did not work on stream yet. This may be due to a coding error or to a missing equation, constant or something similar. If it turns out to be a simple fix, then it will
be fixed in this section. If a lot of other things change in order for the fix to work, then it will probably be a seperate section with a reference to that section here. %be fixed in this section. If a lot of other things change in order for the fix to work, then it will probably be a seperate section with a reference to that section here.

View File

@ -0,0 +1,79 @@
\section{Starting to Deal With the Poles}
It is time to deal with the pole situation. The north and south poles that is, not the lovely people over in Poland. We run into problems because the latitude longitude grid cells become to small
near the poles. Therefore, the magnitudes no longer fit into one cell and overflow into other cells which makes everything kind of funky. So we need to fix that, and we do that by a planar
approximation.
\subsection{The Theory Behind the Planar Approximation}
As said earlier, the grid cells on the latitude longitude grid get closer together the closer you get to the poles which poses problems. To fix this, we will be using a planar approximation of
the poles. What this means is that we will map the 3D grid near the poles onto a 2D plane parallel to the poles, as if we put a giant flat plane in the exact center of the poles and draw lines
from the grid directly upwards to the plane. For a visual representation, please consult the stream with timestamp 1:38:25 \cite{polarPlane}, which includes some explanation. In the streamm we
use $r$ to indicate the radius of the planet (which we assume is a sphere), $\theta$ for the longitude and $\lambda$ for the latitude. So we have spherical coordinates, which we need to transform
into $x$ and $y$ coordinates on the plane. We also need the distance between the center point (the point where the plane touches the planet which is the center of the pole) and the projected
point on the plane from the grid (the location on the plane where a line from the gird upwards to the plane hits it). This distance is denoted by $a$ (Simon chose this one, not me). We then get
the following equations as shown in \autoref{eq:polar distance}, \autoref{eq:polar x} and \autoref{polar y}.
\begin{subequations}
\begin{equation}
a = r \cos(\theta)
\label{eq:polar distance}
\end{equation}
\begin{equation}
x = a \sin(\lambda)
\label{eq:polar x}
\end{equation}
\begin{equation}
y = a \cos(\lambda)
\label{eq:polar y}
\end{equation}
\end{subequations}
But what if we know $x$ and $y$ and want to know $\theta$ and $\lambda$? Pythagoras' Theorem then comes into play \cite{pythagoras}. We know that (due to Pythagoras) \autoref{eq:pythagoras} must
always be true. Then if we substitue $a$ by $\sqrt{x^2 + y^2}$ in \autoref{eq:polar distance} we get \autoref{eq:polar theta1}. Then we transform that equation such that we only have $\theta$ on
one side and the rest on the other side (since we want to know $\theta$) and we get \autoref{eq:polar theta3}.
\begin{equation}
x^2 + y^2 = a^2
\label{eq:pythagoras}
\end{equation}
\begin{subequations}
\begin{equation}
\sqrt{x^2 + y^2} = r\cos(\theta)
\label{eq:polar theta1}
\end{equation}
\begin{equation}
\frac{\sqrt{x^2 + y^2}}{r} = \cos(\theta)
\label{eq:polar theta2}
\end{equation}
\begin{equation}
\cos^{-1}(\frac{\sqrt{x^2 + y^2}}{r}) = \theta
\label{eq:polar theta3}
\end{equation}
\end{subequations}
For $\lambda$ we need another trigonometric function which is the tangent ($\tan$). The tangent is defined in \autoref{eq:tan}. If we then take a look at \autoref{eq:polar x} and
\autoref{eq:polar y}, we see that $\lambda$ is present in both equations. So we need to use both to get $\lambda$ \footnote{Yes you could only use one but since we both know $x$ and $y$ it is a
bit easier to use both than to only use one as you need to know $\theta$ at that point as well which may or may not be the case.}. So let's combine \autoref{eq:polar x} and \autoref{eq:polar y}
in \autoref{eq:polar lambda1}, transform it such that we end up with only $\lambda$ on one side and the rest on the other side and we end up with \autoref{eq:polar lambda3}.
\begin{equation}
\tan(\alpha) = \frac{\sin(\alpha)}{\cos(\alpha)}
\label{eq:tan}
\end{equation}
\begin{subequations}
\begin{equation}
\frac{x}{y} = \frac{a\sin(\lambda)}{a\cos(\lambda)} = \frac{\sin(\lambda)}{\cos(\lambda)}
\label{eq:polar lambda1}
\end{equation}
\begin{equation}
\frac{x}{y} = \tan(\lambda)
\label{eq:polar lambda2}
\end{equation}
\begin{equation}
\lambda = \tan^{-1}(\frac{x}{y})
\label{eq:polar lambda3}
\end{equation}
\end{subequations}
With this math we can fix a lot of stuff in the model. With this we can resample (mapping from sphere to plane) the pressure, density, temperarature and advection to the plane and ensure that
there are no more overflows and funky business. The implementation (code) for this will be done in a follow up stream, so stay tuned!