jberger/Thesis

Switch branches/tags
Nothing to show
Fetching contributors…
Cannot retrieve contributors at this time
42 lines (31 sloc) 4.14 KB
 \section{Implementation} %The model presented in this chapter is deceptively hard to implement. %As noted by Michalik and Sipe in their original paper~\cite{michalik_analytic_2006}, in the absence of space-charge, the solution of the system of equations in \ref{eq:ag_original} may be solved analytically and result in the standard equations of Gaussian optics. %With the inclusion of space-charge (that is the inclusion of electron-electron repulsion) the system must be solved by numerical methods. %The scaling of the terms requires special consideration of error-handling. %This problem is exacerbated when including the external forces. %The necessity of limiting the region of influence of electron-optical elements (\ref{eq:reg_of_influence}) adds terms with Gaussian envelopes The model presented in this chapter was initially implemented in Wolfram's Mathematica. While this implementation provided the results needed, it was inflexible and overly confusing. The limitations of the Mathematica language precluded abstracting the model sufficiently to cover all common use cases. Recently the model was rewritten in Perl, and is called \verb!Physics::UEMColumn!. Perl is a dynamic scripting language known for its versatility and flexibility. In this implementation, the model is implemented as a decoupled set of high-level object-oriented classes. \verb!Physics::UEMColumn! has been released as open source software under the terms of the Artistic License (a derivative of the GNU General Public License), which allows for free use of the software. The current state of development of the simulation toolkit is publicly available at \url{https://github.com/jberger/Physics-UEMColumn}. Releases of the toolkit are available via the Comprehensive Perl Archive Network (CPAN), which is a central repository of software developed for Perl, a standard tool for the language. The CPAN has several tracker sites, see for example \url{https://metacpan.org/module/Physics::UEMColumn}. A simulation script is composed of creating instances of the classes that represent the column, the pulse, electron-optical elements like magnetic lenses and RF cavities. These objects act as containers for the information about the physical object that they represent. Further they manage programmatic tasks related to those objects. For example, electron-optical element objects manage the Gaussian region-of-influence (\ref{eq:reg_of_influence}) and calculate the force that their fields apply to the pulse. While the pulse object may be created manually, the toolkit contains the class \verb!Physics::UEMColumn::Photocathode! which implements the simple initial conditions described in Section \ref{sec:initial_conditions}. These objects are managed by a central simulation'' class (called \verb!Physics::UEMColumn!) which handles the time evolution of the system. This arrangement allows for clean, manageable and extensible code. Many scripts which use \verb!Physics::UEMColumn! were needed to generate data and figures used for the preparation of this thesis. I have included most of them in the source repository which is available at \url{https://github.com/jberger/Thesis}. In Appendix \ref{sec:script}, I present the simulation scripts used to create \ref{fig:spacecharge_noacc}, \ref{fig:spacecharge_acc} and \ref{fig:compound}, as examples of this implementation. Additionally, a development version of the bin model presented in Section \ref{sec:bin_model} is available at \url{https://github.com/jberger/Physics-Photoemission}. Once I am sufficiently confident in its implementation, and more importantly its veracity, I intend to release it to the CPAN as well, most likely under the name \verb!Physics::Photoemission!. This module depends on the much larger Perl project PDL (\url{http://pdl.perl.org}), a matrix-oriented numerical library, making it slightly more difficult to install, however the speed and implementational simplicity benefit added by that dependency is marked. Of particular interest to users of \verb!Physics::UEMColumn!, \verb!Physics::Photoemission! also includes a subclass of \verb!Physics::UEMColumn::Photocathode! which uses this binning model to generate the pulse's $z$ direction initial conditions.