\section{Control Panel} \label{sec:cp}
Before we dive in an start modelling the planet, let us first set up a control panel that will influence how the model will behave and effectively decides what type of planet we model.

\subsection{The Beginning}
In the beginning there was nothing, and then there was "Hello World!" Or at least that is how many projects start. Why? you might ask, which is a perfectly valid question. In Computer Science, 
"Hello World!" is very simple code that we use to test whether all the tools we need to get coding works. This checks whether the computer compiles the code and is able to execute it and whether 
the code editor (IDE, Integrated Development Environment) starts the right processes to get the code compiled and executed. Oh right we were talking about CLAuDE, ahem.

Every project must have its beginning. And with CLAuDE I made the decision to start explaining the Control Panel first. This is to get you familiar with notation and to lay down some basics. To 
do that we start with the fixed part of the Control Panel, the physical constants. Many things vary from planet to planet, how much radiation they receive from their star, how strong their 
gravity is, how fast they spin around their axis and many many more. What does not change are the physical constants, well because they are constant. The Stefan-Boltzmann constant for instance
does not change. Whether you are on Earth, in space or on Jupiter, the value of the Stefan-Boltzmann constant will remain the same. 

The Stefan-Boltzmann constant is denoted by $\sigma$ and has a value of $5.670373 \cdot 10^-8$ (\si{Wm^{-2}K^{-4}}) \cite{stefan-boltzmann}. The $\sigma$ is a greek letter called sigma. Greek 
letters are often used in mathematics, as well as in physics or any other discipline that relies on maths (spoiler alert, quite a lot). Treat it like a normal letter in maths, representing a 
number that you either do not know yet or is too long or cumbersome to write down every time. The Stefan-Boltzmann constant is denoted in scientific notation, a number followed by the order of 
magnitude. It is denoted as a multiplication, because that is what you have to do to get the real number. An example: $4.3 \cdot 10^2 = 430$ and $4.3 \cdot 10^{-2} = 0.043$. The
letters behind the numbers are units, how we give meaning to the numbers. If I say that I am $1.67$ does not mean anything. Do I mean inches, centimeters, meters, miles? That is why we need units
as they give meaning to the number. they tell us whether the number is talking about speed, distance, time, energy and many other things. In this manual we will use SI units. Behind all the
letters you will find the following: [number]. This is a citation, a reference to an external source where you can check whether I can still read. If I pull a value out somewhere I will insert a 
citation to show that I am not making these numbers up. This is what scientists use to back up their claims if they do not want to redo the work that others have done. I mean what is the point 
of re-inventing the wheel if there is a tyre company next door? That is why scientists citate.

So with that out of the way, let us write down some constants. Why do I do this here? Because a lot of constants are used everywhere and I am too lazy to replicate them every time. If you see a 
letter or symbol that is not explicitly explained, then it is most likely a constant that we discuss here in the control panel. 

\subsection{Physical Constants}
As mentioned before, physical constants do not change based on where you are in the universe. Below you will find an overview of all the relevant constants together with their units. And a short
explanation where they are used or what they represent. To see them in action, consult the other sections of this manual, you will find them in equations all throughout this document.

\subsubsection{The Gas Constant} \label{sec:gas constant}
The Gas constant, $R = 8.3144621$ (\si{JK^{-1}mol^{-1}}) \cite{idealGas} is the constant used to relate the temperature of the gas to the pressure and the volume. One would expect this constant to be 
different per gas, but under high enough temperatures and low enough pressure the gas constant is the same for all gases. 

\subsubsection{The Specific Heat Capacity}
The specific heat capacity $c$ depicts how much energy is required to heat the object by one degree Kelvin per unit mass (\si{Jkg^{-1}K^{-1}}) \cite{specificHeat}. This varies per material 
and is usually indicated by a subscript. The specific heat capacity for water for instance is $c_w = 4190$ \si{Jkg^{-1}K^{-1}}. Specific heat capacities also exist in the form of 
\si{Jkg^{-1}K^{-1}}, \si{Jmol^{-1}K^{-1}} and \si{Jcm^{-3}K^{-1}} which you can use in various circumstances, depending on what information you have.

\subsubsection{Mole}
Mole is the amount of particles ($6.02214076 \cdot 10^{23}$) in a substance, where the average weight of one mole of particles in grams is about the same as the weight of one particle in atomic 
mass units (\si{u})\cite{mole}. This is not a physical constant perse, but more like a unit (\si{mol}). Though it is still important enough to be added here for future reference. All other units are 
way more intuitive and are assumed to be known.

\subsubsection{The Stefan-Boltzmann Constant}
The Stefan-Boltzmann constant, $\sigma = 5.670373 \cdot 10^-8$ \si{Wm^{-2}K^{-4})} \cite{stefan-boltzmann} is used in the Stefan-Boltzmann law (more on that in \autoref{sec:first thermolaw}). 

\subsection{Planet Specific Variables}
The following set of variables vary per planet, that's why we call them variables since they vary. Makes sense right? We add them here as we will use them throughout the manual. The advantage
of that is quite significant. If you want to test things for a different planet, you only need to change the values in one place, instead of all places where you use it. If there is one thing 
that we computer scientists hate is doing work, we like being lazy and defining things in one place means that we can be lazy if we need to change it. So we put in the extra work now, so we do 
not have to do the extra work in the future. That's actually a quite accurate description of computer scientists, doing hard work so that they can be lazy in the future.

\subsubsection{The Passage of Time}
On Earth we have various indications of how much time has passed. While most of them remain the same throughout the universe, like seconds, minutes and hours, others vary throughout the universe,
like days, months and years. Here we specify how long the variable quantities of time are for the planet we want to consider as they are used in the code. This can be seen in 
\autoref{alg:time constants}. Here a $\leftarrow$ indicates that we assign a value to the variable name before it, so that we can use the variable name in the code instead of the value, which 
has the advantage I indicated before. // means that we start a comment, which is text that the code ignores and does not tell the cpu about. Not that the cpu would understand it, but that just 
means less work for the computer. Yes computers are lazy too.

\begin{algorithm*}
    \caption{Definition of how much time it takes for a day and a year on a planet and how much time on the planet passes before we start another calculation run}
    \label{alg:time constants}
    \SetKwComment{Comment}{//}{}
    $day \leftarrow 60*60*24$ \Comment*[l]{Length of one day in seconds (\si{s})}
    $year \leftarrow 365*day$ \Comment*[l]{Length of one year in seconds (\si{s})}
    $\delta t \leftarrow 60 * 9$ \Comment*[l]{How much time is between each calculation run in seconds (\si{s})}
\end{algorithm*}

\subsubsection{The Planet Passport}
Each planet is different, so why should they all have the same gravity? Oh wait, they don't. Just as they are not all the same size, tilted as much and their atmospheres differ. So here we define
all the relevant variables that are unique to a planet, or well not necessarily unique but you get the idea. This can all be found in \autoref{alg:planet constants}.

\begin{algorithm}
    \caption{Defining the constants that are specific to a planet}
    \label{alg:planet constants}
    \SetKwComment{Comment}{//}{}
    $g \leftarrow 9.81$ \Comment*[l]{Magnitude of gravity on the planet in \si{ms^{-2}}}
    $\alpha \leftarrow -23.5$ \Comment*[l]{By how many degrees the planet is tilted with respect to the star's plane}
    $top \leftarrow 50*10^3$ \Comment*[l]{How high the top of the atmosphere is with respect to the planet surface in meters (\si{m})}
    $ins \leftarrow 1370$ \Comment*[l]{Amount of energy from the star that reaches the planet per unit area (\si{Jm^{-2}})}
    $\epsilon \leftarrow 0.75$ \Comment*[l]{Absorbtivity of the atmosphere, fraction of how much of the total energy is absorbed (unitless)}
    $r \leftarrow 6.4*10^6$ \Comment*[l]{The radius of the planet in meters (\si{m})}
\end{algorithm}

\subsubsection{Model Specific Parameters}
These parameters cannot be found out in the wild, they only exist within our model. They control things like the size of a cell on the latitude longitude grid (more on that in later sections),
how much time the model gets to spin up. We need the model to spin up in order to avoid numerical instability. Numerical instability occurs when you first run the model. This is due to the nature of the equations. Nearly all equations are continuous, which means that they are always at work. However 
when you start the model, the equations were not at work yet. It is as if you suddenly give a random meteor an atmosphere, place it in orbit around a star and don't touch it for a bit. You will 
see that the whole system oscilates wildly as it adjusts to the sudden changes and eventually it will stabilise. We define the amount of time it needs to stabilise as the spin up time. All 
definitions can be found in \autoref{alg:model constants}. What the $adv$ boolean does is enabling or disabling advection, a process described in <section> which does not work yet.

\begin{algorithm}
    \caption{Defining the paramters that only apply to the model}
    \label{alg:model constants}
    \SetKwComment{Comment}{//}{}
    $resolution \leftarrow 3$ \Comment*[l]{The amount of degrees on the latitude longitude grid that each cell has, with this setting each cell is 3 degrees latitude high and 3 degrees 
    longitude wide}
    $nlevels \leftarrow 10$ \Comment*[l]{The amount of layers in the atmosphere}
    $\delta t_s \leftarrow 60*137$ \Comment*[l]{The time between calculation rounds during the spin up period in seconds (\si{s})}
    $t_s \leftarrow 5*day$ \Comment*[l]{How long we let the planet spin up in seconds (\si{s})}
    $adv \leftarrow \texttt{FALSE}$ \Comment*[l]{Whether we want to enable advection or not}
    $adv\_boun \leftarrow 8$ \Comment*[l]{How many cells away from the poles where we want to stop calculating the effects of advection}
    $C_a \leftarrow 287$ \Comment*[l]{Heat capacity of the atmosphere in \si{Jkg^{-1}K^{-1}}}
    $C_p \leftarrow 1 \cdot 10^6$ \Comment*[l]{Heat capacity of the planet in \si{Jkg^{-1}K^{-1}}}
    $\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 (\si{m})}
        $count \leftarrow count + \frac{top}{nlevels}$ \;
    }

    \For{$i \in [0, nlat]$}{
        $\delta x[i] \leftarrow \delta y\cos(lat[i]\frac{\pi}{180})$ \Comment*[l]{How far apart the gridpoints in the x direction are (degrees longitude)}
    }

    \For{$k \in [0, nlevels - 1]$}{
        $\delta z[k] \leftarrow heights[k + 1] - heights$ \Comment*[l]{How far apart the gridpoints in the z direction are (\si{m})}
    }
\end{algorithm}