facebookresearch / fmmax

Fourier modal method with Jax
MIT License
97 stars 10 forks source link

Discretization techniques in z #84

Open smartalecH opened 9 months ago

smartalecH commented 9 months ago

There's a lot of nuance behind how one decides to discretize in z. For example, in the microlens array example, the structure is sliced such that the upper corner of each slice lies right on the ideal curve. Alternatively, one could have sliced along the lower corner, or better yet, performed a "midpoint rule."

It would be interesting to explore the different schemes here, and how one could borrow tricks from other domains (e.g. finite-differences and quadrature) to minimize the error here.

Specifically, for simple structures (like angled sidewalls consisting of linear slants) there may be some analytic solutions that describe the optimal slicing for a given number of slices.

Luochenghuang commented 8 months ago

I believe the "midpoint rule" should be adopted here as it's shown produce less error [1]. I like the idea of softening the boundaries to mimic the sloped permittivity. We can also trying adaptive z height (thinner z section as slope increases). It would be good to have a convergence study to compare these methods.

[1] https://pubs.acs.org/doi/full/10.1021/acsphotonics.2c00662

mfschubert commented 8 months ago

It would be pretty useful here to have a general 3D -> (stack of 2D slices, slice heights) function, where the slice heights and values in each slice are optimized so that the resulting simulation is most accurate.

We likely wouldn't need the entire calculation to be differentiable, and I could imagine that the implementation involve solving an optimization problem.