1
0
Fork 0
mirror of https://github.com/Findus23/Bachelors-Thesis.git synced 2024-08-27 19:52:12 +02:00

many text improvements

This commit is contained in:
Lukas Winkler 2019-07-17 15:17:10 +02:00
parent f2030ab87c
commit 47776412cb
Signed by: lukas
GPG key ID: 54DE4D798D244853

View file

@ -39,20 +39,20 @@ To understand how the water transport works exactly one has to find an estimatio
\section{Model}
For a realistic model of two gravitationally colliding bodies the SPH (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 and
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.
In the simulation two celestial bodies are placed far enough apart so that tidal forces can affect the collision. Both objects consist of a core with the physical properties of basalt rocks and a outer mantle made of water ice.
In the simulation two celestial bodies are placed far enough apart so that tidal forces can affect the collision. Both objects consist of a core with the physical properties of basalt rocks and an outer mantle made of water ice.
To keep the simulation time short and make it possible to do many simulations with varying parameters 20k SPH particles are used\todo{Why 20k?} and each simulation is ran for 300 timesteps of each \SI{144}{\second} so that a whole day of collision is simulated.
\section{Parameters}
Six parameters have been identified that have an influence on the result of the simulation.
Six parameters have been identified that have an influence on the result of the simulation:
\subsection{impact velocity}
The collision velocity $v_0$ is defined in units of the mutual escape velocity of the projectile and the target. 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.
The collision velocity $v_0$ is defined in units of the mutual escape velocity of the projectile and the target. 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.
\subsection{impact angle}
@ -70,7 +70,7 @@ The last two parameters are the mass fraction of the ice to the total mass of ea
\begin{table}
\centering
\begin{tabular}{r|rrrrr}
\begin{tabular}{r|SSSSS}
$v_0$ & 1 & 1.5 & 2&3 & 5 \\
$\alpha$ & \ang{0} & \ang{20} & \ang{40} & \ang{60} &\\
$m$ &\SI{e21}{\kilogram} & \SI{e23}{\kilogram} & \SI{e24}{\kilogram} & \SI{e25}{\kilogram} &\\
@ -84,7 +84,7 @@ The last two parameters are the mass fraction of the ice to the total mass of ea
\section{Execution}\todo{think of a better title}
In the first simulation run for every parameter combination from Table \ref{tab:first_simulation_parameters} a separate simulation has been started. First the parameter set and other configuration options are written in a \texttt{simulation.input} text file. Afterwards the relaxation program described in \cite[24\psqq]{Burger2018} generates relaxed initial conditions for all 20k particles and saves their state to \texttt{impact.0000}. Afterwards \texttt{miluphcuda} can be executed with the following arguments to simulate starting from this initial condition for 300 timesteps which each will be saved in a \texttt{impact.XXXX} file.
In the first simulation run for every parameter combination from Table \ref{tab:first_simulation_parameters} a separate simulation has been started. First the parameters and other configuration options are written in a \mbox{\texttt{simulation.input}} text file. Afterwards the relaxation program described in \cite[24\psqq]{Burger2018} generates relaxed initial conditions for all 20k particles and saves their state to \texttt{impact.0000}. Finally \texttt{miluphcuda} can be executed with the following arguments to simulate starting from this initial condition for 300 timesteps which each will be saved in a \texttt{impact.XXXX} file.
\todo{spacing is ugly}
@ -92,25 +92,45 @@ In the first simulation run for every parameter combination from Table \ref{tab:
miluphcuda -N 20000 -I rk2_adaptive -Q 1e-4 -n 300 -a 0.5 -H -t 144.0 -f impact.0000 -m material.cfg -s -g
\end{lstlisting}
This ran on the \texttt{amanki} server using a \texttt{Nvidia GTX 1080} taking about \SI{30}{\minute} per simulation.
This simulation run ran on the \texttt{amanki} server using a \texttt{Nvidia GTX 1080} taking about \SI{30}{\minute} per simulation.
\section{Post-Processing}
After the simulation the properties of the SPH particles needs to be analyzed. For this the \texttt{identify\_fragments} C program by Christoph Burger\todo{better citation} uses a friends-of-friends algorithm to group the particles into fragments. Afterwards \texttt{calc\_aggregates} calculates the mass of the two largest fragments together with their gravitationally bound fragments and it's output is written into a simple text file (\texttt{aggregates.txt}). This way the mass retention (total mass of the two largest fragments compared to total mass of projectile and target) and the water retention can be determined for every simulation result.
After the simulation the properties of the SPH particles needs to be analyzed. To do this the \texttt{identify\_fragments} C program by Christoph Burger\todo{better citation} uses a friends-of-friends algorithm to group the final particles into fragments. Afterwards \texttt{calc\_aggregates} calculates the mass of the two largest fragments together with their gravitationally bound fragments and its output is written into a simple text file (\texttt{aggregates.txt}). This way the mass retention (total mass of the two largest fragments compared to total mass of projectile and target) and the water retention can be determined for every simulation result.
\section{Resimulation}
To increase the amount of available data and especially reduce the errors caused by the grid-based parameter choices (Table \ref{tab:first_simulation_parameters}) a second simulation run has been started has been started. All source code and initial parameters have been left the same apart from the six main input parameters described above. These will be set to a random value in the range listed in Table \ref{tab:resimulation-parameters} apart from the the initial water fractions. As they seem to have little impact on the outcome they are set fixed to \SI{15}{\percent} to simplify the parameter space.
\begin{table}
\centering
\begin{tabular}{r|SS}
& min&max\\\hline
$v_0$ & 1 & 5 \\
$\alpha$ & \ang{0} & \ang{60} \\
$m$ &\SI{1.88e+21}{\kilogram} & \SI{1.19e+25}{\kilogram}\\
$\gamma$ & 0.1& 1 \\
water fraction target & \SI{15}{\percent} & \SI{15}{\percent} \\
water fraction projectile & \SI{15}{\percent} & \SI{15}{\percent} \\
\end{tabular}
\caption{text}
\label{tab:resimulation-parameters}
\end{table}
This way an addition \num{427}\todo{correct number} simulations have been calculated on \texttt{Nvidia Tesla P100} graphics cards on Google Cloud.
\chapter{Results}
\chapter{Interpolations}
\section{Linear interpolation}
\section{Multidimensional Linear Interpolation}
\subsection{Theory}
One of the easiest ways to interpolate a new value between two known values is linear interpolation. \todo{some more text about linear interpolation}
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 if we assume that we have 20 random points $P$ between 0 and 1 (\textcolor{Red}{\textbullet} and \textcolor{Blue}{\textbullet} in \ref{fig:one-dim-interpolation}) 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 for every of these points we have measured a value $f(P)$, a straight line \textcolor{LightGreen}{|} between the two closest values can be drawn and a interpolated value for $f(I)$ can be found.
In one dimension linear interpolation is pretty trivial. For example if we assume that we have 20 random points $P$ between 0 and 1 (\textcolor{Red}{\textbullet} and \textcolor{Blue}{\textbullet} in Figure \ref{fig:one-dim-interpolation}) 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] % TODO: h is temporary
\centering
@ -153,7 +173,7 @@ This approach has the advantage that it can be extended in more than two dimensi
\subsection{Implementation}
\label{sec:griddata-implementation}
For doing the actual interpolations the \texttt{scipy.interpolate.griddata} function is used with the \texttt{method="linear"} argument that itself uses \texttt{scipy.interpolate.LinearNDInterpolator} which does the interpolation as described above. The function is given a $6\times n$ matrix of the six parameters and a $n$ list of the water retention fraction for those $n$ simulations. In addition \texttt{griddata} supports not only calculating interpolations for one set of parameters, but also lists of parameters which allows to quickly generate 2d diagrams as seen in \ref{the_chapter_where_I_show_the_v_alpha_plots}.
For doing the actual interpolations the \texttt{scipy.interpolate.griddata} function is used with the \texttt{method="linear"} argument which itself uses \texttt{scipy.interpolate.LinearNDInterpolator} to do the interpolation as described above. The function is given a $6\times n$ matrix of the six parameters and a $n$ list of the water retention fraction for those $n$ simulations. In addition \texttt{griddata} supports not only calculating interpolations for one set of parameters, but also lists of parameters which allows to quickly generate 2d diagrams as seen in \ref{the_chapter_where_I_show_the_v_alpha_plots}.
\subsection{Results}
@ -283,19 +303,19 @@ Another method that is good at taking pairs of input and output values and then
\subsection{Theory}
The idea behind artificial neural networks is trying to emulate the functionality of neurons by having nodes that are connected to each others. The weights of theses connections are modified during the training to represent the training data and can then be used to predict new results for input values not seen in the training data.
The idea behind artificial neural networks is trying to emulate the functionality of neurons by having nodes that are connected to each others. The weights of these connections are modified during the training to represent the training data and can then be used to predict new results for input values not seen in the training data.
Every neural network needs an input layer with as many nodes as input parameters and an output layer with a node for every output value. In between there can be multiple hidden layers with an arbitrary amount of nodes. (Figure \ref{fig:neuralnetwork-general})
If we first only consider a single neuron then on iteration it calculates the sum over all input values multiplied with their weight $w$. Afterwards an activation function $g$ is applied to the sum $z$ to get the prediction $\hat{y}$.
If we first only consider a single neuron, then on every iteration it calculates the sum over all input values multiplied with their weight $w$. Afterwards an activation function $g$ is applied to the sum $z$ to get the prediction $\hat{y}$.
\begin{equation}
z=\sum_{i}w_ix_i \qquad \hat{y}=g(z)
\end{equation}
The non-linear activation function allows the network to be able to approximate all 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{NN-math}
The non-linear 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{NN-math}
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 those is called the Loss function and one of them 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 of them is the mean squared error function:
\begin{equation}
L(\hat{y},y)=\sum_{i}(\hat{y}_i-y_i)^2
@ -321,6 +341,11 @@ model.fit(X, Y, epochs=200)
\end{lstlisting}\todo{just a placeholder}
\todo{more text on how exactly the data is split up once it is decided}
After the training the resulting model can be saved in a small \texttt{HDF5} file which can be used to very quickly evaluate the model (about \SI{100}{\milli\second} for \num{10000} interpolations)
\subsection{Results}
\subsection{Issues}
@ -328,7 +353,7 @@ model.fit(X, Y, epochs=200)
\appendix
\chapter{Placeholder}
\lipsum[1]\footcite{Schaefer2016}\footcite{dvorakMoon}\footcite{MaindlSummary}\footcite{Burger2018}\footcite{Dorninger}\footcite{CollisionParameters}\footcite{CollisionTypes}\footcite{RBF}
\lipsum[1]\footcite{Schaefer2016}\footcite{dvorakMoon}\footcite{MaindlSummary,CollisionParameters}\footcite{Burger2018}\footcite{Dorninger}\footcite{CollisionParameters}\footcite{CollisionTypes}\footcite{RBF}
\nocite{*}
\printbibliography