OpticSim.jl
OpticSim.jl copied to clipboard
Contributions welcome :)?
Would rigorous methods for diffraction grating simulation, or thin planar materials be welcomed? Or more optical material properties (permitivities, etc)? Would you all prefer 2-D optical simulation methods reside elsewhere? How about Jones calculus or Stokes matrices?
Hi Casey :)
We're still at early stages with this package so we're mostly focusing on tools which could help our in-house teams for now. But we would like to work towards a more generic product in the long run, so anything that takes us in this direction is of interest!
Regarding contributions, I'm pretty new here so I'll leave that to @BrianGun.
I have a few semi large, not completely refined chunks of code hanging around on my hard drive somewhere, been looking for places to give it a useful home. Would like to add this is very nice work, and after speaking with some people could become an integral part of the julia CEM ecosystem!
Casey,
Thank you for the kind words. All of the features you mention would be interesting and useful to add. That's why we open sourced the project, so it could grow into a broadly useful optical simulation/optimization package.
We're fairly new to Julia. This may be a dumb question but what is the CEM ecosystem?
Could the rigorous diffraction grating simulation be massaged to conform to our OpticalInterface abstract type (defined in OpticalInterface.jl)? If the answer is yes then integration should be easy, otherwise we'll have to work with you to figure out what changes might be required.
Jones calculus or Stokes matrices might take more work since this would require a change to the OpticalRay type (defined in OpticalRay.jl) to carry polarization information along with the ray, and to the interface that goes along with the abstract OpticalInterface type to add required or optional functions that define how surfaces affect light polarization.
If you take a stab at defining the necessary new types and functions needed for polarization that would help us understand how big a job it might be.
We've wanted to add thin film simulation for a long time so we could more accurately model anti-reflection coatings and the like. Ideally we'd extend OpticalInterface to allow stacking an arbitrary number of interfaces. Then, for example, you could easily create a partially reflective metallic coating on top of a fresnel interface (this is something we currently model in an ad hoc way), without having to define a new class for every possible combination of interfaces.
This would take some thought to get right. I don't pretend to be an expert in modeling stacks of interfaces so that might make the going a bit slow. But it's been on my list of things to learn.
As for 2D simulation methods it's not entirely clear what you are asking for. Some of the surface types (Bezier and NURBS are examples) are parameterized by dimension so you can easily create 2D instead of 3D surfaces. Is this what you mean or are you referring to something else? Could you give an example of the type of optical system this would be used for?
Really exciting to hear you're interested in contributing @caseykneale!
Regarding 'diffraction grating simulation, or thin planar materials', I wrote some very basic and certainly not rigorous code for thin diffraction gratings, but from what I remember efficiency for each order had to be defined by the user. I also had some code implementing Kogelnik for planar HOEs where efficiency was assuming some thickness but the HOE was assumed to be geometrically thin because of our OpticalInterface abstraction that Brian mentioned above. There is certainly some complexity in introducing simulation of these types of components, but it isn't impossible. PS I'm pretty sure there were errors in the Kogelnik code, or at least it didn't handle any/many edge cases correctly... visual results looked plausible though
There is also added complexity because we (so far) don't support ray splitting or true per-ray energy, so energy accumulation on any detector converges on the correct solution through monte-carlo integration of individual rays with uniform energy. This can be a real pain when trying to deal with diffraction efficiency but again, not impossible!
Julia is pretty awesome for this kind of work as I'm sure you're all realizing :D. "Julia CEM" = "Julia Computational ElectroMagnetics" :).
Never heard of Kogelnik, I have the Chandezon method(an easy-impl. is here: https://www.osapublishing.org/ao/abstract.cfm?uri=ao-38-2-304) 1-D coded up and also accepting multilayer media in p/s polarization. Getting the conical mount and supporting 2D gratings would be nice, but the code I had for that took a long time to square away and is not owned by me anymore - so I'd have to do it again. The Chandezon method is quite nice for performance, especially on comparison to things like RCWA, FEM, for continuous surface geometries. The diffraction and transmission efficiencies, in my experience, tend to be <1% of experimental error for simple geometries.
Think I also have the Fresnel equations (forget the name of the author who made them computationally pliable - maybe Azzam - it's been years forgive me) for planar optically thin and thick materials. Pretty sure I have a sneaky way to handle very very thick, thin, and many material layers as well.
I used to do work on simulations of thin films for surface plasmon resonance sensor development/optimization. That's why I have piles of this code around.
Depending on if you want near/far field simulations I can likely recommend good test cases for gratings.
As for representing polarization - it's tricky. I don't know if anyone has a good way of doing that beyond field equations. The Jones/Mueller matrices are a little niche but they can be broadened out to handle other systems. At one point I was eyeing up adding polarization to local plane interface approximation (LPIA) for a system somewhat similar in spirit to what you all are working on. Just ran out of time. Well - I can do a code dump at some point soon and you all can decide if any of it meshes with your interests or not.