mirror of
https://github.com/Findus23/BachelorsThesis.git
synced 20240728 19:42:36 +02:00
check whole text
This commit is contained in:
parent
97a646615d
commit
74137645cf
17 changed files with 1272 additions and 1269 deletions

@ 1,5 +1,13 @@


% !TeX spellcheck = en_US


\chapter{Introduction}\label{introduction}




\addchap{Abstract}






Quos est voluptatem officiis animi et aliquid natus deserunt ad omnis perspiciatis voluptatum quas non natus sint molestiae minima officiis porro dolorem temporibus est non porro aut velit corrupti nostrum numquam facilis cupiditate esse sit quibusdam autem eum non dolores eum at in necessitatibus aliquid rerum voluptatum necessitatibus aut officia voluptates consequatur voluptatem nobis corporis quod nostrum et tempore placeat minima corrupti.




Autem animi consequatur delectus mollitia. Earum nesciunt distinctio et quam nam libero. Illum deserunt non voluptatem. Dolores quas qui aspernatur maxime reprehenderit repellat porro aliquam.%




{\let\clearpage\relax \chapter{Introduction}\label{introduction}}




One important question for planet formation is, how water got to the earth. The part of the protoplanetary disk closest to the sun was too hot to make it possible that water can condense on Earth during formation. And while there are theories that the region where ice is possible inside the snowline moved during Earth's formation\footcite{snowline}, the most popular theory is that water moved inwards in the solar system through collisions of waterrich protoplanets.%


\todo{citation needed}





@ 3,11 +3,11 @@


\label{chapter:simulations}


\section{Model}




For a realistic model of two gravitationally colliding bodies the SPH (\textit{smooth particle hydrodynamics}) code \texttt{miluphCUDA} as explained in \cite{Schaefer2016} is used. It is able to simulate brittle failure and the interaction between multiple materials.


For a realistic model of two gravitationally colliding bodies the smooth particle hydrodynamics (\texttt{SPH}) code \texttt{miluphCUDA} as explained in \cite{Schaefer2016} is used. It is able to simulate brittle failure and the interaction between multiple materials.




In the simulation two celestial bodies are placed far enough apart so that tidal forces can affect the collision (5 times the sum of the radii). Both objects consist of a core with the physical properties of basalt rocks and an outer mantle made of water ice. These twobodycollisions are similar to those that happen between protoplanets or the collision that created the Earth's Moon.\footcite{dvorakMoon}




To keep the simulation time short and make it possible to do many simulations with varying parameters, 20k SPH particles are used and each simulation is run for 12 hours and every 144 seconds the current state is saved.


To keep the simulation time short and make it possible to do many simulations with varying parameters, 20k SPH particles are used and each simulation is run for 12 hours in which every 144~seconds the current state is saved.




\section{Parameters}


\label{sec:parameters}



@ 18,7 +18,7 @@ Six parameters have been identified that have a major influence on the result of




The collision velocity $v_0$ is defined in units of the mutual escape velocity $v_{esc}$ of the projectile and the target.\footcite{MaindlSummary} Simulations have been made from $v_0=1$ to $v_0=5$. As one expects, a higher velocity results in a stronger collision and more and smaller fragments.


\begin{equation}


v_{esc}=\sqrt{2G/(M_p+M_t)/(r_p+r_t)}


v_{esc}=\sqrt{\frac{2G(M_p+M_t)}{r_p+r_t}}


\end{equation}




\subsection{impact angle}



@ 56,7 +56,7 @@ In the first simulation run for every parameter combination from Table \ref{tab:


miluphcuda N 20000 I rk2_adaptive Q 1e4 n 300 a 0.5 H t 144.0 f impact.0000 m material.cfg s g


\end{lstlisting}




This simulation run ran on the \texttt{amanki} server using a \texttt{Nvidia GTX 1080} taking about \SI{30}{\minute} per simulation as the \texttt{Nvidia GTX 1080} is the fastest consumer GPU for this simulation set in a comparison of 13 tested GPUs.\footcite{Dorninger} Of the 960 simulations, 822 succeed and were used in the analysis.


This simulation ran on the \texttt{amanki} server using a \texttt{Nvidia GTX 1080} taking about \SI{30}{\minute} per simulation as the \texttt{Nvidia GTX 1080} is the fastest consumer GPU for this simulation set in a comparison of 13 tested GPUs.\footcite{Dorninger} Of these 960 simulations, 822 succeed and were used in the analysis.






\section{PostProcessing}



@ 71,7 +71,9 @@ After the simulation the properties of the SPH particles needs to be analyzed. T




To increase the amount of available data and especially reduce the errors caused by the gridbased parameter choices (Table \ref{tab:first_simulation_parameters}), a second simulation run has been started. All source code and initial parameters have been left the same apart from the six main input parameters described above. These are set to a random value in the range listed in Table \ref{tab:resimulationparameters} apart from the initial water fractions. As they seem to have little impact on the outcome (see Section \ref{sec:cov}), they are set to \SI{15}{\percent} to simplify the parameter space.




\begin{table}


This way, an additional \num{553} simulations have been calculated on \texttt{Nvidia Tesla P100} graphics cards on \texttt{Google Cloud}. (Of which 100 simulations are only used for comparison in Section \ref{sec:comparison})




\begin{table}[hb]


\centering


\begin{tabular}{rSS}


& min&max\\\hline



@ 82,8 +84,6 @@ To increase the amount of available data and especially reduce the errors caused


water fraction target & \SI{15}{\percent} & \SI{15}{\percent} \\


water fraction projectile & \SI{15}{\percent} & \SI{15}{\percent} \\


\end{tabular}


\caption{parameter ranges for the resimulation}


\label{tab:resimulationparameters}


\end{table}




This way, an additional \num{553} simulations have been calculated on \texttt{Nvidia Tesla P100} graphics cards on \texttt{Google Cloud}. (Of which 100 simulations are only used for comparison in Section \ref{sec:comparison})


\caption{parameter ranges for the resimulation}


\label{tab:resimulationparameters}


\end{table}


@ 2,17 +2,17 @@


\chapter{Results}


\label{chapter:results}




For the large set of simulations, we can now extract the needed values. The output of the relaxation program (\texttt{spheres\_ini\_log}) gives us the precise values for impact angle and velocity and the exact masses of all bodies. As these values differ slightly from the parameters explained in Section \ref{sec:parameters} due to the setup of the simulation, in the following steps only the precise values are considered. From the \texttt{aggregates.txt} explained in Section \ref{sec:postprocessing} the final masses and water fractions of the two largest fragments are extracted. From these, the main output considered in this analysis, the water retention of the two fragments, can be calculated.


For the large set of simulations, we can now extract the needed values. The output of the relaxation program (\texttt{spheres\_ini\_log}) gives us the precise values for impact angle and velocity and the exact masses of all bodies. As these values differ slightly from the parameters explained in Section \ref{sec:parameters} due to the setup of the simulation, in the following steps only the precise values from \texttt{spheres\_ini\_log} are considered. From the \texttt{aggregates.txt} explained in Section \ref{sec:postprocessing} the final masses and water fractions of the two largest fragments are extracted. From these, the main output considered in this analysis, the water retention of the two fragments, can be calculated.




\section{Correlations}


\label{sec:cov}


One very easy, but sometimes flawed%


\footnote{Pearson correlation coefficient only measures linear correlations. With a value close to zero can still be a nonlinear correlation between the two dimensions. In addition the coefficient gives no information about the steepness of the correlation, only about which fraction of the values conform to it.}


\footnote{The Pearson correlation coefficient only measures linear correlations. With a value close to zero there can still be a nonlinear correlation between the two dimensions. In addition the coefficient gives no information about the steepness of the correlation, only about which fraction of the values conform to it.}


way to look at the whole dataset at once is calculating the \textit{Pearson correlation coefficient} between the input parameters and the output water fraction (Figure \ref{fig:cov}). This shows the expected result that a higher collision angle (so a more hitandrun like collision) has a higher water retention and a higher collision speed results in less water left on the two largest remaining fragments. In addition, higher masses seem to result in less water retention. The initial water fractions of the two bodies does seem to have very little influence on the result of the simulations.




\begin{figure}


\begin{figure}[h]


\centering


\includegraphics[width=0.8\linewidth]{images/cov.pdf}


\includegraphics[width=0.6\linewidth]{images/cov.pdf}


\caption{TODO}


\label{fig:cov}


\end{figure}


@ 5,46 +5,44 @@




One of the easiest ways to interpolate a new value between two known values is linear interpolation. It takes the closest values and creates a linear function between them.




In one dimension, linear interpolation is pretty trivial. For example, let's assume that we have 20 random points $P$ between 0 and 1 (\textcolor{Red}{\textbullet} and \textcolor{Blue}{\textbullet} in Figure \ref{fig:onediminterpolation}) and have a new point $I$ (\textcolor{Green}{\textbullet}) at $0.4$ for which we want to interpolate. Finding the two closest points \textcolor{Red}{\textbullet} above and below is trivial as there is only one dimension to compare. Now, if we have measured a value $f(P)$ for each of these points, a straight line (\textcolor{LightGreen}{\textbf{}}) between the two closest values can be drawn and an interpolated value for $f(I)$ can be found.


In one dimension, linear interpolation is pretty trivial. For example, let's assume that we have 20 random points $P$ between 0 and 1 (\textcolor{Red}{\textbullet} and \textcolor{Blue}{\textbullet} in Figure \ref{fig:onediminterpolation}) and have a new point $I$ (\textcolor{Green}{\textbullet}) at $0.4$ for which we want to interpolate. Finding the two closest points (\textcolor{Red}{\textbullet}) above and below is trivial as there is only one dimension to compare. Now, if we have measured a value $f(P)$ for each of these points, a straight line (\textcolor{LightGreen}{\textbf{}}) between the two closest values can be drawn and an interpolated value for $f(I)$ can be found.








\begin{figure}[h] % also temporary


\begin{figure}[] % also temporary


\centering


\begin{subfigure}[t]{0.5\textwidth}


\centering


\includegraphics[width=\linewidth]{images/vis1d.pdf}


\caption{onedimensional example of linear interpolation}


\caption{A onedimensional example of linear interpolation}


\label{fig:onediminterpolation}


\end{subfigure}%


~


\begin{subfigure}[t]{0.5\textwidth}


\centering


\includegraphics[width=\linewidth]{images/vis2d1.pdf}


\caption{Lorem ipsum, lorem ipsum,Lorem ipsum, lorem ipsum,Lorem ipsum}


\caption{A set of twodimensional datapoints}


\label{fig:3dinterpolate1}


\end{subfigure}


\caption{}




\end{figure}




In two dimensions things get more complicated as we now have a set of points with $X$ and $Y$ coordinates (Figure \ref{fig:3dinterpolate1}). One fast way to find the closest points to the point that should be interpolated is using Delaunay triangulation. This separates the space between the points into triangles while trying to maximize their smallest angle. Afterwards, the closest three points can be found very quickly by checking the nodes of the surrounding triangle (Figure \ref{fig:3dinterpolate2}). If we now again have a function $f(X,Y)$ similar to the onedimensional example (Figure \ref{fig:3dinterpolate3}), we can create a unique plain through the three points and get the interpolated value for any $X$ and $Y$ on this layer.


In two dimensions things get more complicated as we now have a set of points with $X$ and $Y$ coordinates (Figure \ref{fig:3dinterpolate1}). One fast way to find the closest points to the point that should be interpolated is using Delaunay triangulation. This separates the space between the points into triangles while trying to maximize their smallest angle. Afterwards, the closest three points can be found very quickly by checking the nodes of the surrounding triangle (Figure \ref{fig:3dinterpolate2}). If we now again have a function $f(X,Y)$ similar to the onedimensional example, we can create a unique plain through the three points and get the interpolated value for any pair of $X$ and $Y$ on this layer. (Figure \ref{fig:3dinterpolate3})






\begin{figure}[h] % also temporary


\begin{figure}[] % also temporary


\centering


\begin{subfigure}[t]{0.5\textwidth}


\begin{subfigure}[t]{0.48\textwidth}


\centering


\includegraphics[width=\linewidth]{images/vis2d2.pdf}


\caption{Lorem ipsum}


\label{fig:3dinterpolate3}


\caption{A Delaunay triangulation of the points from Figure~\ref{fig:3dinterpolate1}}


\label{fig:3dinterpolate2}


\end{subfigure}%


~


\begin{subfigure}[t]{0.5\textwidth}


\begin{subfigure}[t]{0.48\textwidth}


\centering


\includegraphics[width=\linewidth]{images/vis2d3.pdf}


\caption{Lorem ipsum, lorem ipsum,Lorem ipsum, lorem ipsum,Lorem ipsum}


\label{fig:3dinterpolate2}


\caption{A $f(X,Y)$ interpolated via the green plane}


\label{fig:3dinterpolate3}


\end{subfigure}


\caption{}





@ 60,6 +58,8 @@ For doing the actual interpolations, the \texttt{scipy.interpolate.griddata} fun




\subsection{Results}




Figure \ref{fig:griddataresults}\todo{text}




\begin{figure}[h!] % also temporary


\centering


\begin{subfigure}[t]{0.5\textwidth}





@ 49,7 +49,7 @@ or simply




with $\Phi$ being a symmetric $n \times n $ matrix as $\left\x_jx_i\right\=\left\x_ix_j\right\$. There are many possibilities for the radial basis function $\phi(r)$. It can be for example linear ($r$), gaussian ($e^{r^2}$) or multiquadric ($\sqrt{\left(\frac{r}{\epsilon}\right)^2 + 1}$) with $\epsilon$ being a constant that defaults to the approximate average distance between nodes.




As an example, consider the three points $x_1=0$, $x_1=3$ and $x_1=5$ with $p(x_1)=0.2$, $p(x_2)=0.8$ and $p(x_3)=0.1$ and choose a gaussian function for $\phi$ we get the following:


As an example, consider the three points $x_1=0$, $x_1=3$ and $x_1=5$ with $p(x_1)=0.2$, $p(x_2)=0.8$ and $p(x_3)=0.1$ and choose a gaussian function for $\phi$ to get the following:


\begin{align}


\begin{bmatrix}


\phi(0) & \phi(3) & \phi(5) \\



@ 117,6 +117,8 @@ The scipy function \texttt{scipy.interpolate.Rbf} allows directly interpolating




\subsection{Results}




Figure \ref{fig:rbfresults} \todo{text}




\begin{figure}[h!] % also temporary


\centering


\begin{subfigure}[t]{0.5\textwidth}




14
43_nn.tex
14
43_nn.tex

@ 4,21 +4,21 @@


\begin{subfigure}[t]{0.5\textwidth}


\centering


\includegraphics[width=\linewidth]{images/graphviz/general.pdf}


\caption{an example for a neural network}


\caption{An example for a neural network}


\label{fig:neuralnetworkgeneral}


\end{subfigure}%


~


\begin{subfigure}[t]{0.5\textwidth}


\centering


\includegraphics[width=\linewidth]{images/graphviz/graph.pdf}


\caption{the network used for interpolation}


\caption{The network used for interpolation}


\label{fig:neuralnetworkgraph}


\end{subfigure}


\caption{}




\end{figure}




\section{Neural Networks}


\section{Artificial Neural Networks}




Another method that is good at taking pairs of input and output values and then able to predict output values for arbitrary input sets is using \textit{Artificial neural networks} (\texttt{ANNs}).





@ 36,7 +36,7 @@ If we first only consider a single neuron, then on every iteration it calculates




The nonlinear activation function allows the network to be able to approximate all types of functions instead of being just a linear function itself. Popular activation functions are the sigmoid function $\sigma(x)={\frac {1}{1+e^{x}}}$ and the ReLU function (\textit{rectified linear unit}, $f(x)=\max(0,x)$).\footcite{NNmath}




After this first step (the \textit{feedforward}) is done, the weights can be modified by comparing the prediction with the real output (the \textit{backpropagation}). The function that describes the error between them is called the Loss function and on possible form is the mean squared error function:


After this first step (the \textit{feedforward}) is done, the weights can be modified by comparing the prediction with the real output (the \textit{backpropagation}). The function that describes the error between them is called the Loss function and one possible form is the mean squared error function:




\begin{equation}


L(\hat{y},y)=\sum_{i}(\hat{y}_iy_i)^2



@ 50,7 +50,7 @@ As building a neural network from scratch gets complex very quickly, it is easie




The network needs six nodes in the input layer for the input parameters and one node in the output layer for the prediction. In between, are two layers with decreasing numbers of nodes as this seems to give the best results. (Figure \ref{fig:neuralnetworkgraph})




\begin{lstlisting}[language=Python,caption=the used model as Keras code,label=lst:model]


\begin{lstlisting}[language=Python,caption=The used model as Keras code,label=lst:model]


from keras import Sequential


from keras.layers import Dense





@ 90,11 +90,13 @@ To find the ideal parameters to use, the simulation data (excluding the data fro




\end{figure}




After the training, the resulting model can be saved in a small \texttt{HDF5} file which can be used to evaluate the model very quickly (about \SI{100}{\milli\second} for \num{10000} interpolations).


After the training, the resulting model is saved in a small \texttt{HDF5} file which can be used to evaluate the model very quickly (about \SI{100}{\milli\second} for \num{10000} interpolations).






\subsection{Results}




Figure \ref{fig:nnresults} \todo{text}




\begin{figure}[h!] % also temporary


\centering


\begin{subfigure}[t]{0.5\textwidth}





@ 9,7 +9,7 @@ Of the three methods, the trained neural network has the highest mean squared er




Another important aspect to compare is the interpolation speed. The neural network is able to give the 100 results in about \SI{4}{\milli\second} (after loading the trained model). RBF interpolation is still reasonably fast, taking about \SI{8.5}{\second} (\SI{85}{\milli\second} per interpolation). But as \texttt{griddata} expects a gridbased parameter space, it becomes really slow when adding the resimulation data with random parameters. A single interpolation takes about \SI{35}{\second} totaling to around an hour for all 99 test cases. Using only the original dataset brings the runtime down to around \SI{10}{\second}, but causes the results to be less accurate than all other methods. (first row in Table \ref{tab:comparison})




\begin{table}


\begin{table}[h]


\centering


\begin{tabular}{rcc}


& {mean squared error} & {mean error} \\





@ 1,7 +1,7 @@


% !TeX spellcheck = en_US


\chapter{Core mass retention}




While this thesis focuses on the water retention after the collisions, the same methods can be applied to the fraction of basalt from the core of the two bodies that remains after the collision. Using the same parameters for interpolation and a seperatly trained model with the same parameters results in similar results as for water retention. When plotted just like before in Figure \ref{fig:mass_results} one can see that the results are quite similar. The main difference is that on average there is a slightly higher core mass retention, which can be explained by the fact that weaker collisions might be strong enough to throw the outer water layer into space, but keep the core intact. In addition it seems like the border between high and low core mass retention is smaller.\todo{better phrase}


While this thesis focuses on the water retention after the collisions, the same methods can be applied to the fraction of basalt from the core of the two bodies that remains after the collision. Using the same parameters for interpolation and a separately trained model with the same parameters results in similar results as for water retention. When plotted just like before in Figure \ref{fig:mass_results}, one can see that the results are quite similar. The main difference is that on average there is a slightly higher core mass retention, which can be explained by the fact that weaker collisions might be strong enough to throw the outer water layer into space, but keep the core intact. In addition, it seems like the border between high and low core mass retention is smaller.\todo{better phrase}




When applying the same comparison as described in Section \ref{sec:comparison} the interpolations seem to have a lower accuracy, but still RBF interpolation gives the best results considering slow speed of griddata.






BIN
images/loss.pdf
BIN
images/loss.pdf
Binary file not shown.
1211
images/loss.svg
1211
images/loss.svg
File diff suppressed because it is too large
Load diff
Before Width:  Height:  Size: 28 KiB After Width:  Height:  Size: 26 KiB 
Binary file not shown.
1229
images/val_loss.svg
1229
images/val_loss.svg
File diff suppressed because it is too large
Load diff
Before Width:  Height:  Size: 26 KiB After Width:  Height:  Size: 28 KiB 
BIN
images/vis1d.pdf
BIN
images/vis1d.pdf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
13
main.tex
13
main.tex

@ 15,32 +15,23 @@






\begin{titlepage}


\vspace{4cm}


\centering




{\huge\sffamily\bfseries Interpolated water retention after twobody collisions using Neural Networks and linear interpolation methods\par}


{\sffamily\bfseries Bachelor's Thesis\par}


% \includegraphics[width=0.15\textwidth]{exampleimage1x1}\par\vspace{1cm}


% {\scshape\LARGE Columbidae University \par}


% \vspace{1cm}


% {\scshape\Large Final year project\par}


% \vspace{1.5cm}


% {\huge\bfseries Pigeons love doves\par}


\vspace{2cm}


{\Large Lukas Winkler\par}


\vfill


\textsf{supervised by}\par


{\large Mag.~Dr.~Thomas Maindl\par}




\vfill




% Bottom of the page


{\large 1. September 2019 \hfill\texttt{a01505981@unet.univie.ac.at}\par}


\end{titlepage}




%\maketitle


\tableofcontents




\addchap{addchap}




\include{10_introduction}




\include{20_simulations}




Loading…
Reference in a new issue