NanoComp / meep

free finite-difference time-domain (FDTD) software for electromagnetic simulations
GNU General Public License v2.0
1.23k stars 624 forks source link

source shape as geometric object #612

Open oskooi opened 5 years ago

oskooi commented 5 years ago

Currently, the shape of a Source can only be a rectangular prism defined by its size property. Although the amplitude function property (amp_func) does enable arbitrary shapes, this is cumbersome to set up for simple geometries. It would be useful if the source shape could also be defined by a GeometricObject (e.g., Sphere, Cylinder, Prism, etc.).

soamaven commented 5 years ago

This is really interesting. I am curious, what situations would this be useful in, specifically a homogeneous volumetric source? LEDs, gain systems? I've only seen volumetric sources utilized in situations when a known field profile is to be injected, which as you said, is provided by amp_func.

oskooi commented 5 years ago

One application would be for designing grating in-couplers for silicon photonics where a cleaved fiber is used as the input source and placed in the near-field of the grating. See e.g., Optics Express, Vol. 18, pp. 18278-83, 2010. Another application would be to model a VCSEL source, which also tend to have cylindrical cross sections, for use in e.g., next-generation displays such as AR/MR smart glasses.

Once this feature is ready, we will then need to modify the eigenmode source such that even though it is computed from a given volume/cross-section it can be placed anywhere in the cell.

stevengj commented 5 years ago

@oskooi, I don't think we actually need a geometric-object source for that application:

oskooi commented 5 years ago

The following schematic demonstrates the functionality that we are trying to enable. An eigenmode source is defined for a Cartesian x/y/z slice of an oblique waveguide which generates a unidirectional propagating mode. Telling MPB that the mode's wavevector is not orthogonal to the slice is not enough; we would also like to be able to specify its eig_parity somehow just as we would if the waveguide is oriented along the x axis and we could specify either EVEN_Y or ODD_Y.

eigenmode_source_oblique

stevengj commented 5 years ago

It looks like #675 addresses the oblique-waveguide source motivation of this issue.

However, we might as well leave this open. There are occasionally circumstances where you want a finite-volume source instead of a point source, and it would be nice to support a spherical source volume etcetera with subpixel averaging. Implementing subpixel averaging of the edges is something that requires a low-level C++ implementation, where it is straightforward as I commented in #635, and cannot easily be done in user-level Python code.

But it doesn't seem like a high-priority feature.