
\section{The Qualifier Project}


\begin{frame}\frametitle{Section Overview}
\vspace{0.3cm}

\begin{itemize}
\item Project goals
\vspace{0.15cm}
\item Brief description of the code
\vspace{0.15cm}
\item Brief description of the simulations
\vspace{0.15cm}
\item Summary of results

\end{itemize}

\end{frame}

%----------------------

\begin{frame}\frametitle{Project Goals}

\begin{itemize}
 \item To examine the \textbf{evolution} of \sig\ with time during dissipationless mergers.\pause
 \item To examine the \textbf{directional dependence} of \sig\ during and after dissipationless mergers.\pause
 \item To study how an attenuating medium might influence flux-weighted \sig\ measurements.\pause
 \item To become more fluent in C/C++.
 \item To gain the experience of writing an N-body simulation code.
\end{itemize}

\end{frame}

%----------------------

\subsection*{Code Description}


\begin{frame}\frametitle{Code Summary}

\textbf{Steps: }

\begin{enumerate}
  \item Input the size scale, $D$, number of star particles, $N$, and the number of stars per particle, $n$.\pause
  \item Build stellar populations.
 \begin{enumerate}[i)]
  \item Make an array of stellar masses $\mathcal{M}_j$ where the number of particles in each mass range is chosen in accordance with Kroupa IMF.\pause
  \item Build star particles by randomly choosing entries in $\mathcal{M}_j$.\pause
  \item Restrict the maximum mass accepted (in order to age the stellar populations).\pause
  \item Compute star particle luminosities, $L_i$, and masses, $m_i$,  
\[L_i= \sum_j^n L_{ij}(M_{ij})\qquad\qquad m_i= \sum_j^n M_{ij}\]
 \end{enumerate}

\end{enumerate}

\end{frame}

%----------------------

\begin{frame}\frametitle{Code Summary}

\begin{enumerate}
 \setcounter{enumi}{2}
 \item Compute the total mass of the system. \[M = \sum_i^N m_i\]\pause
 \vspace{-0.2cm}
 \item Construct a spheroidal stellar system.
 \begin{enumerate}[i)]

  %\item Input the total mass, size scale, and number star particles.
  \item Randomly sample the Hernquist density profile.\[\rho(r)=\frac{M}{2\pi}\frac{D}{r}\frac{1}{(r+D)^3}\]\pause
  \vspace{-0.2cm}
  \item Select speeds based on an approximation to the Virial theorem and use a uniform angular distribution for initial directions (Rather than using the Jeans equation) \pause
  \item Enforce $\mathbf{r}_{cm}=(0,0,0)$, $\mathbf{p}_{cm}=(0,0,0)$.\pause
 \end{enumerate}
 \item Advance the particles forward in time for $\sim2.5 t_{dyn}$ to allow the system to reach a steady, virialized state.

\end{enumerate}

\end{frame}


%----------------------

\begin{frame}\frametitle{Animation: Collapse / Virialization}
A 15.5K particle collapse simulation: 

\begin{center}
 \href{/images/virial.avi}{\includegraphics[width=8.5cm]{./images/virial.jpg}}
 % virial.jpg: 1455x479 pixel, 72dpi, 51.33x16.90 cm, bb=0 0 1455 479
\end{center}

\end{frame}


%-----------------------

\begin{frame}\frametitle{Code Summary}

\begin{enumerate}
 \setcounter{enumi}{5}
 \item Collide two duplicate stellar systems.
  \begin{enumerate}[i)]
    \item Clone the virialized system.\pause
    \item Use relative velocity and relative position vectors, $\mathbf{v}_{rel}$, $\mathbf{r}_{rel}$ to initialize the systems.\pause
    \item Evolve system forward in time. \pause
  \end{enumerate}

  \item Run analysis routines at specified time interval.

  \begin{enumerate}[i)]
    \item Assuming a gaussian PSF, create images of the system from +$x$, +$y$, +$z$, and specified arbitrary direction.\pause
    \item Compute mass-weighted and flux-weighted \sig\ from 150 random directions as well as the x,y,z directions.\pause
    \begin{enumerate}[a)]
      \item Choose 150 random $(\theta,\phi)$ uniformly distributed over sphere.\pause
      \item Rotate the system so that the viewing direction coincides with the z-axis\ldots
    \end{enumerate}
  \end{enumerate}
\end{enumerate}

\end{frame}

%-----------------------


\begin{frame}\frametitle{Code Summary (analysis continued\ldots)}
  

{\small{
    \begin{enumerate}[a)]
      \setcounter{enumi}{2}
      \item Identify which star particles appear in the diffraction slit.\pause
      \item Compute path lengths, $d_i$, through cylindrical attenuating slab of extinction coefficient, $\varepsilon$.\pause
      \item Compute flux contributions. \[f_i=L_i e^{-\varepsilon d_i}\qquad\mbox{(no summation)}.\]\pause
      \item For each viewing direction, compute flux-weighted \sig. \[f\sigma_* = \sqrt{f_i v_i^2 /F - ( f_i v_i /F)^2}\qquad\mbox{where}\qquad F=\sum_if_i\]
    \end{enumerate}
}}


\end{frame}

%---------------------------

\begin{frame}\frametitle{Code Summary (analysis continued\ldots)}


{\small{
\begin{enumerate}[a)]
\setcounter{enumi}{6}
\item Compute mass-weighted \sig\ for each viewing direction.\[m\sigma_* = \sqrt{m_i v_i^2 /\mathcal{M} - ( m_i v_i /\mathcal{M})^2}\qquad\mbox{where}\qquad \mathcal{M}=\sum_im_i\]
\[m\sigma_*\approx \sqrt{\left\langle v^2 \right\rangle - \left\langle v \right\rangle^2}\]\pause
\item Compute directional max, min, mean, and std dev for $m\sigma_*$ and $f\sigma_*$.\pause
  \end{enumerate}
}}


\begin{enumerate}
\setcounter{enumi}{7}
\item Save statistics to text file.
\item Save images.
\item Return to step 6.iii (advance forward) 
\end{enumerate}

\end{frame}


%---------------------------

\begin{frame}\frametitle{Implementation}


\begin{itemize}
\item Written in C++
\item Parallelized with OpenMP
\item Approx 1300 lines of code
\item Libraries used:
\begin{itemize}
 \item Boost (ublas)
\item ImageMagick (Magick++)
\item OpenMP
\end{itemize}

\item Post-processing of statistics: Python (numPy)
\item Plotting: Python (matplotlib + {\rmfamily{\TeX}})
\item Movies: FFmpeg automated with shell script

\end{itemize}

\end{frame}

%--------------------------

\subsection{Low-resolution, dissipationless simulations}

\begin{frame}\frametitle{Collapse Analysis}

\textbf{Initial} \sig: $2.10\pm0.03$ km/s$\qquad\qquad$\textbf{Final} \sig:  $5.11\pm0.09$ km/s

\begin{center}
 \includegraphics[width=10.8cm]{./images/virial/slit_dispersions.pdf}
 % slit_dispersions.pdf: 720x396 pixel, 72dpi, 25.40x13.97 cm, bb=0 0 720 396
\end{center}


\end{frame}

%--------------------------

\begin{frame}\frametitle{Collapse / Virialization Analysis}

\begin{center}
 \includegraphics[width=10.8cm]{./images/virial/number_density.pdf}
 % number_density.pdf: 720x396 pixel, 72dpi, 25.40x13.97 cm, bb=0 0 720 396
\end{center}



\end{frame}

%--------------------------

\begin{frame}\frametitle{Initial Configurations}

\begin{center}
 \includegraphics[width=8.2cm]{./images/initial_configurations.pdf}
 % initial_configurations.pdf: 819x614 pixel, 72dpi, 28.89x21.66 cm, bb=0 0 819 614
\end{center}

\end{frame}

%--------------------------


\begin{frame}\frametitle{Head-on Collision}
\vspace{-0.2cm}
\begin{center}

\href{/images/direct_impact.avi}{ \includegraphics[width=10.5cm]{./images/head_on.jpg}}
 % head_on.jpg: 1942x967 pixel, 72dpi, 68.51x34.11 cm, bb=0 0 1942 967
\end{center}

\end{frame}

%---------------------------

\begin{frame}\frametitle{Head-on Collision Analysis}

\begin{center}
 \includegraphics[width=10.8cm]{./images/head_on/slit_dispersions.pdf}
 % slit_dispersions.pdf: 720x396 pixel, 72dpi, 25.40x13.97 cm, bb=0 0 720 396
\end{center}


\end{frame}



%---------------------------

\begin{frame}\frametitle{Head-on Collision Analysis}

\begin{center}
 \includegraphics[width=10.8cm]{./images/head_on/flux_slit_dispersions150.pdf}
 % slit_dispersions.pdf: 720x396 pixel, 72dpi, 25.40x13.97 cm, bb=0 0 720 396
\end{center}


\end{frame}


\begin{frame}\frametitle{Head-on Collision Analysis}

\begin{center}
 \includegraphics[width=10.8cm]{./images/head_on/flux_slit_dispersions1000.pdf}
 % slit_dispersions.pdf: 720x396 pixel, 72dpi, 25.40x13.97 cm, bb=0 0 720 396
\end{center}


\end{frame}

%---------------------------

\begin{frame}\frametitle{Head-on Collision Analysis}

\begin{center}
 \includegraphics[width=10.8cm]{./images/head_on/std_dev.pdf}
 % slit_dispersions.pdf: 720x396 pixel, 72dpi, 25.40x13.97 cm, bb=0 0 720 396
\end{center}


\end{frame}

%---------------------------

\begin{frame}\frametitle{Head-on Collision Analysis}

\begin{center}
 \includegraphics[width=10.8cm]{./images/head_on/flux_std_dev150.pdf}
 % slit_dispersions.pdf: 720x396 pixel, 72dpi, 25.40x13.97 cm, bb=0 0 720 396
\end{center}


\end{frame}

%---------------------------

\begin{frame}\frametitle{Head-on Collision Analysis}

\begin{center}
 \includegraphics[width=10.8cm]{./images/head_on/flux_std_dev1000.pdf}
 % slit_dispersions.pdf: 720x396 pixel, 72dpi, 25.40x13.97 cm, bb=0 0 720 396
\end{center}


\end{frame}

%---------------------------

\begin{frame}\frametitle{Head-on Collision Analysis}

\begin{center}
 \includegraphics[width=10.8cm]{./images/head_on/number_density.pdf}
 % slit_dispersions.pdf: 720x396 pixel, 72dpi, 25.40x13.97 cm, bb=0 0 720 396
\end{center}


\end{frame}

%---------------------------

\begin{frame}\frametitle{Head-on Collision Analysis}

\begin{center}
 \includegraphics[width=10.8cm]{./images/head_on/xyz_slit_dispersion.pdf}
\end{center}

\end{frame}


%----------------------------

\begin{frame}\frametitle{Orbit Decay}
\vspace{-0.2cm}
\begin{center}
\href{/images/decay.avi}{ \includegraphics[width=10.5cm]{./images/decay.jpg}}
\end{center}

\end{frame}

%----------------------------

\begin{frame}\frametitle{Orbit Decay Analysis}

\begin{center}
 \includegraphics[width=10.8cm]{./images/decay/slit_dispersions.pdf}
\end{center}

\end{frame}

%----------------------------

\begin{frame}\frametitle{Orbit Decay Analysis}

\begin{center}
 \includegraphics[width=10.8cm]{./images/decay/flux_slit_dispersions.pdf}
\end{center}

\end{frame}


%----------------------------


\begin{frame}\frametitle{Orbit Decay Analysis}

\begin{center}
 \includegraphics[width=10.8cm]{./images/decay/std_dev.pdf}
\end{center}

\end{frame}

%----------------------------

\begin{frame}\frametitle{Orbit Decay Analysis}

\begin{center}
 \includegraphics[width=10.8cm]{./images/decay/flux_std_dev.pdf}
\end{center}

\end{frame}

%----------------------------


\begin{frame}\frametitle{Orbit Decay Analysis}

\begin{center}
 \includegraphics[width=10.8cm]{./images/decay/number_density.pdf}
\end{center}

\end{frame}

%----------------------------

\begin{frame}\frametitle{Orbit Decay Analysis}

Rotation or dispersion?
\begin{center}
 \includegraphics[width=10.8cm]{./images/decay/xyz_slit_dispersion.pdf}
\end{center}

\end{frame}

%----------------------------


\begin{frame}\frametitle{Shear}
\vspace{-0.2cm}
\begin{center}

\href{/images/shear2.avi}{ \includegraphics[width=10.5cm]{./images/shear2.jpg}}
\end{center}

\end{frame}

%----------------------------

\begin{frame}\frametitle{Shear Analysis}

\begin{center}
 \includegraphics[width=10.8cm]{./images/shear/slit_dispersions.pdf}
\end{center}

\end{frame}


%----------------------------


\begin{frame}\frametitle{Shear Analysis}

\begin{center}
 \includegraphics[width=10.8cm]{./images/shear/std_dev.pdf}
\end{center}

\end{frame}



%----------------------------


\begin{frame}\frametitle{Shear Analysis}

\begin{center}
 \includegraphics[width=10.8cm]{./images/shear/flux_std_dev.pdf}
\end{center}

\end{frame}



%----------------------------

\begin{frame}\frametitle{Shear Analysis}

\begin{center}
 \includegraphics[width=10.8cm]{./images/shear/number_density.pdf}
\end{center}

\end{frame}


%----------------------------

\begin{frame}\frametitle{Summary}

\begin{itemize}
 \item More attenuation (larger slab or higher $\varepsilon$) reduces the measured \sig\ and increases the scatter $\sigma(\sigma_*)$\pause
 \item Measuring more lines of sight reduces the noise in the measurement of \sig.\pause
 \item \sig\ increases sharply during collisions, then undergoes damped oscillations until system reaches equilibrium.\pause
 \item $\sigma/\sigma_*$ increases during collisions, then sharply decreases, and slowly decays long after the collision.\pause
 \item \sig\ increases most dramatically in the direction of the collision.\pause
 \item Separating rotation and \sig\ isn't straightforward when using aperture-based measurements of \sig.
\end{itemize}


\end{frame}

\subsection*{Spectra / Doppler Broadening}

%----------------------------

\begin{frame}\frametitle{Synthesized Spectrum}

Combined spectrum (shifted spectra of 9 stellar templates)

\begin{center}
 \includegraphics[width=10.5cm]{./images/combined_spectrum.pdf}
\end{center}

\end{frame}

%----------------------------


\begin{frame}\frametitle{Doppler Broadening Demo}

Thin absorption line, \sig$=2.1$ km/s 

\begin{center}
 \includegraphics[width=10.8cm]{./images/shifted_slit_spectrum_unvirialized.jpg}
\end{center}

\end{frame}

%----------------------------

\begin{frame}\frametitle{Doppler Broadening Demo}

Thin absorption line, \sig$=5.5$ km/s 

\begin{center}
 \includegraphics[width=10.8cm]{./images/shifted_slit_spectrum.jpg}
\end{center}

\end{frame}

%----------------------------


% \begin{frame}\frametitle{Animation: Collapse / Virialization}
% A 15K particle collapse simulation: 
% 
% \begin{center}
% \includemovie{5cm}{5cm}{./images/virial.avi}
% \end{center}
% 
% \end{frame}


