Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
246 lines (217 sloc) 6.46 KB
\documentclass[mathserif]{beamer}
\usetheme[secheader]{Madrid}
\setbeamercovered{transparent=50}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{url}
\usepackage{pygments}
\usepackage{graphicx}
\providecommand{\code}[1]{{\texttt{\scriptsize{#1}}}}
\title[OO Physical Modeling]{Modeling Physical Systems\\with Modern Object Oriented Perl\\YAPC::NA 2012}
\author{Joel Berger}
\institute[UIC]{University of Illinois at Chicago}
\date{June 15, 2012}
\begin{document}
\begin{frame}
\maketitle
\end{frame}
\section{The Problems}
\begin{frame}{Physical Simulations}
\begin{block}{Differential Equations}
A set of rules that define how variables change with some parameter
\begin{equation*}
x(t_2) = x(t_1) + dt*\frac{dx}{dt}\visible<2->{(x,f(t1,t2))}
\end{equation*}
\end{block}
\vfill
\begin{block}<3->{Example: Exponential Growth}
\begin{equation*}
\frac{dM}{dt} = r M \quad\implies\quad M(t) = P \exp(r t)
\end{equation*}
\end{block}
\end{frame}
\begin{frame}{My Research: Ultrafast Electron Microscopy}
\input{hardware}
\end{frame}
\begin{frame}{The Challenge: A Flexible Interface to a Complex Model}
\input{schematic}
\begin{itemize}
\item<2-> Need: Compute dynamics of electron pulse ($w(t)$, $l(t)$)
\item<3-> Note: Generation and optical elements add terms to DE
\item<4-> Want: Representitive OO user-level interface
\end{itemize}
\end{frame}
\begin{frame}{The ``State of the Art''}
Old codes are
\begin{itemize}
\item lacking full 6D dynamics
\item optimized for performance vs usablilty
\item hard to customize
\item near impossible to comprehend
\end{itemize}
\begin{block}<2->{\url{http://laacg.lanl.gov/laacg/services/download_sf.phtml}}
\textbf{Getting Started with Poisson Superfish}\\
\ldots We do not recommend trying to build an input file ``from scratch.'' Instead, find an example file that is similar to the problem you are trying to solve. Make a copy of the file and then make any necessary modifications to the geometry and options.
\end{block}
\end{frame}
\begin{frame}{Other Attempts}
\begin{columns}
\begin{column}{0.49\linewidth}
Mathematica:\\
Pros:
\uncover<2->{
\begin{itemize}
\item Can solve dynamics
\item Pretty-printing of math for readability
\end{itemize}
}
Cons:
\uncover<3->{
\begin{itemize}
\item Closed-source and expensive!
\item No OO and no key-value datatypes
\item Still rather slow $\sim$2mins$/$sim
\end{itemize}
}
\end{column}
\begin{column}{0.49\linewidth}
Modelica:\\
Pros:
\uncover<4->{
\begin{itemize}
\item Open-source, but behind close-source variants
\item Unique OO language for physical simulation
\item Classes have DEs as properties
\end{itemize}
}
Cons:
\uncover<5->{
\begin{itemize}
\item Lacks ``has-a'' relationship
\item Composing DEs not trivial
\item User-facing object instantiation not trivial
\item Some numerical problems (?)
\end{itemize}
}
\end{column}
\end{columns}
\end{frame}
\section{Perl Solution}
\begin{frame}{\ldots But First, Some Bookkeeping}
If an object knows where it is, can it remember where it came from?
\begin{columns}
\begin{column}{0.49\linewidth}
\begin{block}{}
\scriptsize
\input{code/remember}
\end{block}
\end{column}
\begin{column}{0.49\linewidth}
\begin{itemize}
\item<2-> use objects as data storage
\begin{itemize}
\item<3-> current data during simulation
\item<4-> all data afterwards
\end{itemize}
\item<5-> works for fixed width solvers
\item<6-> adaptive solvers call functions repeatedly (i.e. \code{PerlGSL::DiffEq})
\end{itemize}
\end{column}
\end{columns}
\end{frame}
\subsection{A Simple OO-DE Example}
\begin{frame}{Physical Classes}
\begin{block}{}
\scriptsize
\input{code/class0}
\end{block}
\end{frame}
\begin{frame}{The Solver: Attributes}
\begin{block}{}
\scriptsize
\input{code/class1}
\end{block}
\end{frame}
\begin{frame}{The Solver: Methods}
\begin{block}{}
\scriptsize
\input{code/class2}
\end{block}
\end{frame}
\begin{frame}{The Script}
\begin{columns}
\begin{column}{0.49\linewidth}
\begin{block}{}
\scriptsize
\input{code/example1}
\end{block}
\end{column}
\begin{column}{0.49\linewidth}
\begin{block}{}
\scriptsize
\input{code/example2}
\end{block}
\vspace{4mm}
\centering
\visible<2->{
\includegraphics[width=0.8\linewidth]{example.png}
}
\end{column}
\end{columns}
\end{frame}
\section{Units Handling}
\begin{frame}{Unit Handling (The Implied Covenant)}
\begin{block}{Mars Surveyor '98 Orbiter \visible<2->{(Sorry Larry!)}}
\begin{itemize}
\item Software used force in Newtons
\item Users entered force in Foot-Pounds
\end{itemize}
\end{block}
\vfill
The Covenant:
\begin{itemize}
\item<3-> Between programmer and user
\item<4-> ``Use the same units!''
\item<5-> Unexpected and possibly undocumented action at a distance
\item<6-> With Perl and Moose we can do better \ldots
\end{itemize}
\end{frame}
\begin{frame}{\texttt{MooseX::Types::NumUnit}}
\begin{itemize}
\item \code{Str} to \code{Num} coercions
\item convert unit if needed
\end{itemize}
\begin{block}{}
\scriptsize
\input{code/numunit}
\end{block}
\end{frame}
\section{Real World Example}
\begin{frame}{Example of \texttt{Physics::UEMColumn}}
Back to Electron Column Modeling
\input{schematic}
\begin{itemize}
\item As yet unreleased \code{Physics::UEMColumn}
\begin{itemize}
\item \url{https://github.com/jberger/Physics-UEMColumn}
\end{itemize}
\item Uses: \code{PerlGSL::DiffEq} on CPAN
\begin{itemize}
\item C-level solver of Perl-level DE closures
\end{itemize}
\end{itemize}
\end{frame}
\section{Finally}
\begin{frame}{Acknowledgements}
\includegraphics[width=0.7\linewidth]{uic}
\begin{itemize}
\item Graduate College Dean's Fellowship (Major Student Funding)
\item LAS Ph.D. Travel Award (Conference Funding)
\end{itemize}
\includegraphics[width=0.15\linewidth]{doe}
\begin{itemize}
\item Department of Energy \#DE-FG52-09NA29451\\(UEM Research Grant)
\end{itemize}
\url{https://github.com/jberger/YAPCNA2012}
\end{frame}
\end{document}