edmundsj / rcwa

Rigorous Coupled Wave Analysis for the calculation of Photonic Crystal R/T spectra
MIT License
97 stars 30 forks source link

Implement Mode and Field Visualization inside + outside layers #39

Open edmundsj opened 2 years ago

edmundsj commented 2 years ago

Feature Description


Sometimes it is important to know not only the reflected modes and transmitted S-parameters, but also what the fields inside a grating look like. This would be very useful and pretty straightforward to implement.

Proposed Implementation

For extracting the fields:

solver.fields(component='E', x=0,y=0, z=0, layer=None)

x, y, and z can either be single points or lists of individual coordinates. The points will be generated with a Cartesian product. This implementation is simple, and allows for easy specification of single points, lines, planes, and volumes, and allows non-uniform points lists to be used (if you want higher resolution near an edge, for example). If layer is None, the z-coordinate will be assumed absolute relative to those specified in the documentation. If layer specifies a specific layer, the z-coordinate will be relative to the top of that layer. By default, a single point is returned. If the layer in question is a 1D or 2D photonic crystal, there should be a special way to indicate the volume be a single period of the device. A reasonable default behavior, rather than returning a single point, would also be to display a single period, and an array of fields is returned.

For directly plotting:

results.plot(x='x', y='y', field='Ez', layer=my_layer)

This would plot the z-component of the electric field in the x-y plane projected along the x/y axes. It might actually be better to have a separate method than plot() for this. Perhaps an imshow method, which calls plot but defaults to the x-y plane, so only two arguments are needed. Alternatively, it might be a better idea to calculate the fields from a specified set of x, y, and z. coordinates.

edmundsj commented 2 years ago

This is currently being worked on using the fields branch.

ward-newman commented 2 years ago

Hi Jordan. Indeed, the optical field patterns inside nano- and micro-structures is of major interest to the sensing community. Highly localized fields in gratings or similar 3D structures can point to regions of high-densities of optical states. This in turn can affect spontaneous emission, FRET, and other quantum phenomena in those regions. This may be of further interest to microfluidics community where localized optical fields can trigger more sensitive detection of nearby capillaries.

In your code the ability to extract the individual harmonic amplitudes inside the structure (most general) would be beneficial; but perhaps the most useful and user friendly would be the ability to specify a region-of-interest (x,y,z volume or plane) and the code outputs the fields (Ex,Ey,Ez) in that region.