facebookresearch / fmmax

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

Proper vector fields for odd-shaped unit cells #55

Closed mfschubert closed 9 months ago

mfschubert commented 12 months ago

Currently, the vector field calculations are correct only when the basis vectors are orthogonal, and the resolution of the grid along each of the basis directions is equal.

For example, the following would be problematic, for any choice of resolution:

primitive_lattice_vectors = basis.LatticeVectors(
    u=jnp.asarray([1.0, 0.1]), v=jnp.asarray([0.1, 1.0])
)

Another problematic case is,

primitive_lattice_vectors = basis.LatticeVectors(u=basis.X, v=basis.Y)
permittivity = ... # Permittivity with non-square shape, e.g. (200, 100)
mfschubert commented 9 months ago

Old vector formulations have been removed; vector fields are now correct for arbitrary unit cells.