The Puerto Rico Photonics Institute (PRPI) is a new initiative of the School of Environmental Affairs at the Universidad Metropolitana (UMET) in Puerto Rico. Since its creation in 2012, PRPI has been able to garner financial and in-kind support from government and government-supported agencies, particularly the Puerto Rico Industrial Development Company (PRIDCO) and the Puerto Rico Science, Technology and Research Trust. Part of this support has been used to tap into the educational strength of Puerto Rican universities and involve undergraduate students in research projects related to optics and photonics. To this end, we have mentored: 1) two senior students from the School of Engineering at Universidad del Turabo in their Capstone project to create a laser pattern generator; 2) three students from Information Science and from the School of Communication at Universidad Metropolitana to create a video on light, optics, and photonics for the International Year of Light; and 3) an engineering student from Universidad de Puerto Rico (Arecibo campus) on a magneto-optical cooling system as part of our research on inertial sensors. In this paper we focus on the progress done by another group of students from the Computer Science program at Universidad Metropolitana in the creation of two software tools to show the geometric and wave behavior of light.
The work by these students started in fall 2013, with A. Hernandez and J. de Jesus (who graduated in June 2014), and was continued by S. Luciano (graduated in June 2015), and by N. Molina, S. Martinez, and J. G. Ramos (currently working on the project). With their work, they have developed two applications that we will use in our courses to teach the different aspects of the behavior of light at certificate, undergraduate, and graduate levels. We also expect to find these programs useful in actual research and development efforts of the Puerto Rico Photonics Institute. Below, we give a description of these two projects, as well as a description of future development.
RAY TRACING APPLICATION
The first application is a tray tracing program in which the path of a beam of light is calculated as it travels through different optical elements. This application is useful in teaching optics concepts such as Snell’s Law, refraction, focal length, critical angle, and refractive indices by enabling experimentation and manipulation of system parameters and components in a virtual setting. It is also useful in analyzing optical systems, determine image formation, and to show optical dispersion (such as the splitting of white light into a rainbow though multiple internal reflections in a water droplet). As an educational tool, we wanted a program that would not be limited by approximations such as the paraxial approximation (in which the only rays considered are those forming a small angle with the optical axis of the system), the thin lens approximation (ignoring the optical effects due to the thickness of the lens), or a system with a single optical axis for that matter. In this way, users do not have to worry about applicability or program limitations and can focus on the physical phenomena.
The initial approach was to develop two different versions of the program: a mobile app version that would run natively on phones with Android and Windows operating systems; and a web application version that would allow the program to run in personal computers and in phones and tablets with the Firefox operating system.
Students of the Computer Science program at Universidad Metropolitana started developing this application in the fall of 2013 to create a versatile and user friendly ray tracing application, with the goal of having a phone-based application that would aid in the teaching of geometric optics and the design of optical systems by showing the refraction of a ray as it interacted with planar and quadratic surfaces. The first version of this program was developed in C# with XNA Game Studio for graphics for the Windows Phone environment. It consisted of an event-based application, where the intersection between the beam and the surface was calculated graphically using the tools provided by the XNA modules.
Though this application provided a reasonable approximation of ray behavior in most cases, the graphical calculation of the point of intersection and of the angle of incidence meant we were limited by the screen resolution. This introduced a cumulative error that could generate, under certain circumstances, a wrong answer. Because of these limitations, the second version of the program, currently under development, consists of an exact, first-principles approach in which light rays and surfaces are treated mathematically. We also chose the Unity game engine (unity3d.com) in order to be able to use the mathematical, physical, and graphical libraries in existence. The current development is being done for a 2D version, but Unity also allows a 3D canvas representation. The programming language was changed to C# (used for the Unity environment). The Unity Platform also features a royalty-free personal edition version, ideal for use by individual students and faculty. This second version is web-based, with the advantage that Unity allows cross-platform deployment for iOS, Android, Windows Phone 8, Windows and Mac executable files, Linux, and web browsers such as Chrome, Internet Explorer, Firefox, and Safari. This will allow us to easily compile code for different mobile (and other) environments.
Development of the application from first principles entailed the following steps:
1. GUI for parameter input: allows the user to choose the origin and direction of the incident ray of light, and to choose the interface surface. Definition of the beam direction is done by specifying the point of origin and point of intersection with the first surface (a point is dragged with the mouse). In 2D, this surface may be as simple as an infinite straight line, or it can also be a quadratic curve. In the latter case, the user can choose between the different quadratic curves: circle, ellipse, parabola, and hyperbola. For closed curves (circle and ellipse), the option is given to choose between the complete curve (to study, for example, ray behavior incident on a drop of water), or half a circle or ellipse to create more complicated lenses. For hyperbolas and parabolas, the user also chooses which branch to consider as the surface interface.
2. Calculation of the point of intersection between the ray and the surface (if it exists), and of the equation (slope and y-intercept) of the tangent and normal lines to the surface at this point.
3. Calculation of the refracted beam direction using Snell’s Law at the point of intersection.
Testing of the mathematical functions and objects was done through the console application of Visual Studio before incorporating the code into the Unity platform. Version control is being done through Bitbucket (bitbucket.org), which allows code collaboration, version control, and the ability to assess team progress.
By the time of this presentation, we expect to have finished the beta version, and to have the first public version available for free at our website (http://prpi.suagm.edu/). We also have plans to develop a paid version, with additional features which include multi-beam and multi-surface support, and eventually a 3D canvas (based on Unity’s 3D UI) that would allow the generation and placement of tridimensional objects in space with the capability of showing the interaction of rays of light with these objects in 3D.
WAVE PROPAGATION APPLICATION
The second tool is web-based and analytically and graphically studies the behavior of electromagnetic waves as they propagate through space and through an interface between two different media. It came about from the lack of web-based simulations that would show both the spatial and time evolution of waves in order to study how physical wave parameters such as amplitude, wavelength, frequency, direction of propagation, intensity, phase velocity, and p- and s-components vary (or not) at an interface between two dielectrics. In this case, computer simulation is an ideal tool to develop a visual representation of physical concepts that are described by, many times, relatively complex mathematical equations.
Each medium is homogeneous and isotropic, described by a scalar permittivity and permeability (i.e., a real refractive index), where the second medium can also exhibit absorption or amplification as described by a β absorption coefficient. The user can choose the medium from predefined materials (air, water, crown glass, etc.), or specify the refractive index (or relative permittivity and permeability). The wave is assumed to impinge on the interface from the left, at a certain angle (0 – 90 degrees) to the normal to the interface.
From the input parameters, the program calculates the Fresnel coefficients, as well as the transmitted and reflected wave parameters. To simplify the view, the program shows both the incident, reflected, and transmitted waves in 2D (even though the corresponding wave-vectors are not parallel to each other).
The animated simulation allows users to play with the model parameters and acquire an intuitive understanding of how electromagnetic p- and s-waves propagate and how they are modified as they are refracted and reflected at the material interface. To verify continuity at the interface for impinging s-waves, the program gives the option of drawing the superposition of the incident and reflected wave. Since the waves are shown in a 2D canvas, the superposition wave (in red in Figure 2) is the scalar (not vector) sum of the incident and reflected wave, but given that the alternative of showing the actual superposition requires a more complex 3D rendering (limited by an imperfect projection onto a 2D computer screen), this is considered to be an acceptable trade-off. Alternately, the superposition of the incident and reflected waves along the normal axis will be the wave shown in red scaled by the cosine of the angle of incidence.
Some interesting particular cases that can be modelled are: normal incidence, total internal reflection, critical angle, absorptive media (negative β), and amplifying media (positive β).
A mobile-based version of this program has also been developed for the Android operating system. Due to the nature of the program, the simulation is computationally-intensive, so the performance will depend on phone CPU speed and memory.
Version 2.0 of this program is currently under development. Once finished, this program will be available for a small fee and will allow the user to specify a complex permittivity and permeability (or a complex refractive index) for each medium, and will also allow the user to specify sub-unity, near-zero, and negative real-part refractive indices (to simulate the wave behavior in double-negative metamaterials). We also want to add the possibility of simulating the propagation of a wave packet through the interface, to graphically show the difference between group and phase velocity whenever dispersion is present (in this case, a wavelength dependent refractive index would be part of the input, or would be chosen from the drop-down medium menu).
The collaboration between the Puerto Rico Photonics Institute and students in the Computer Science undergraduate program at Universidad Metropolitana has allowed the development of two educational tools that provide a better understanding of the propagation of light through homogeneous media and through a media interface. These simulation software programs address the gap of inadequate or overly costly software in these areas, as well as the need to visualize physical phenomena that is usually only considered from a mathematical viewpoint. Some of the challenges we have faced in the development of these software tools are:
· Preparation of students with the necessary physics and optics background: this has been done through individual and group mentoring, as well as course sponsored by Honeywell which one of our faculty (Dr. Diaz) offered to students working with PRPI in the Spring of 2014. To further ease the development of the software, templates with the basic calculations have been prepared by the faculty in Excel. Students working on Java Script or C# can then verify intermediate and final calculations as they program.
· The myriad of technologies, programming languages, and engines that can be used to develop web-based and mobile-based applications. The specific choices used came from the individual expertise of the students working in the project, as well the advantages offered by particular technologies (multi-platform, free, etc.). For example, the availability of the free version of Unity 5.0 on March 3, 2015 allowed us to change the engine in which the ray-tracing application was being developed into one with 2D and 3D canvas options, math and physics modules, and cross-platform deployment.
As mentioned in sections 2 and 3, future plans include the release of improved versions of the ray tracing and wave propagation software with added functionality for a small fee. This will also allow us to continue with the development of these and similar projects. Our plans also include the development of “e-book” versions that will allow us to combine the interactivity of these applications with a text in a package that allows self-paced interactive learning with theory and practice problems.
The authors are thankful for the support of the Puerto Rico Industrial Development Company (PRIDCO) and of Honeywell. Their grants have allowed the Puerto Rico Photonics Institute to collaborate with Computer Science students at Universidad Metropolitana in the development of these software applications.