MESTI (Maxwell's Equations Solver with Thousands of Inputs) is an open-source software for full-wave electromagnetic simulations in frequency domain using finite-difference discretization on the Yee lattice.
MESTI implements the augmented partial factorization (APF) method described in this paper. While conventional methods solve Maxwell's equations on every element of the discretization basis set (which contains much more information than is typically needed), APF bypasses such intermediate solution step and directly computes the information of interest: a generalized scattering matrix given any list of input source profiles and any list of output projection profiles. It can jointly handle thousands of inputs without a loop over them, using fewer computing resources than what a conventional direct method uses to handle a single input. It is exact with no approximation beyond discretization.
Compared to MESTI.m which is a 2D MATLAB version of MESTI, MESTI.jl here uses Julia with single-precision or double-precision arithmetic and considers either full 3D systems
or 2D systems in transverse-magnetic (TM) polarization (Ex, Hy, Hz) with
where (b(r) or b(y,z)) is the source profile.
Note that the coordinate notation switches between MESTI.m and MESTI.jl: (x, y, z) in MESTI.jl corresponding to (z, y, x) in MESTI.m.
MESTI.jl is a general-purpose solver with its interface written to provide maximal flexibility. It supports
- Full 3D system supporting both s and p polarizations.
- TM polarization for 2D system.
- Any relative permittivity profile
$\bar{\bar{\varepsilon}}(\bf r)$ (or εxx(y,z)), real-valued or complex-valued. Users can optionally also average the interface pixels for subpixel smoothing through mesti_subpixel_smoothing(). - Infinite open spaces can be described with a perfectly matched layer (PML) placed on any side(s), which also allows for infinite substrates, waveguides, photonic crystals, etc. The PML implemented in MESTI includes both imaginary-coordinate and real-coordinate stretching, so it can accelerate the attenuation of evanescent waves in addition to attenuating the propagating waves.
- Any material dispersion
$\bar{\bar{\varepsilon}}$ (ω) can be used since this is in frequency domain. - Any list of input source profiles (user-specified or automatically built).
- Any list of output projection profiles (or no projection, in which case the complete field profiles are returned).
- Periodic, Bloch periodic, perfect electrical conductor (PEC), and/or perfect magnetic conductor (PMC) boundary conditions.
- Real-valued or complex-valued frequency ω.
- Automatic or manual choice between APF, conventional direct solver (e.g., to compute the full field profile) as the solution method.
- Linear solver using MUMPS (requires installation) or the built-in routines in Julia (which uses UMFPACK).
- Shared memory parallelism (with multithreaded BLAS and with OpenMP in MUMPS) and distributed memory parallelism (with MPI in MUMPS).
- Single-precision and double-precision arithmetic.
MESTI.jl can perform most linear-response computations for arbitrary structures, such as
- Scattering problems: transmission, reflection transport through complex media, waveguide bent, grating coupler, radar cross-section, controlled-source electromagnetic surveys, etc.
- Thermal emission.
- Local density of states.
- Inverse design based on the above quantities.
Since MESTI.jl can use the APF method to handle a large number of input states simultaneously, the computational advantage of MESTI.jl is the most pronounced in multi-input systems.
There are use cases that MESTI.jl can handle but is not necessarily the most efficient, such as
- Broadband response problems involving many frequencies but only a few input states. Time-domain methods like FDTD may be preferred as they can compute a broadband response without looping over frequencies.
- Problems like plasmonics that require more than an order of magnitude difference in the discretization grid size at different regions of the structure. Finite-element methods may be preferred as they can handle varying spatial resolutions. (Finite-element methods can also adopt APF, but MESTI.jl uses finite difference with a fixed grid size.)
- Homogeneous structures with a small surface-to-volume ratio. Boundary element methods may be preferred as they only discretize the surface.
Problems that MESTI.jl currently does not handle:
- Nonlinear systems (e.g., χ(2), χ(3), gain media).
- Magnetic systems (e.g., spatially varying permeability μ)
For eigenmode computation, such as waveguide mode solver and photonic band structure computation, one can use mesti_build_fdfd_matrix.jl
to build the matrix and then compute its eigenmodes. However, we don't currently provide a dedicated function to do so.
To use the APF method, before installing MESTI.jl, the user needs to install the parallel version of MUMPS. Without MUMPS, MESTI.jl will still run but will only use other methods, which generally take longer and use more memory. So, MUMPS installation is strongly recommended for large-scale multi-input simulations or whenever efficiency is important. See this MUMPS installation page for steps to install MUMPS.
To install MESTI.jl, open Julia REPL and type:
import Pkg; Pkg.add("MESTI")
After installing MESTI.jl, you may also install other necessary packages which you will utilize in tests/examples by running install_packages.jl
The function mesti(syst, B, C, D)
provides the most flexibility. Structure syst
specifies the polarization to use, permittivity profile, boundary conditions in x y, and z, which side(s) to put PML with what parameters, the wavelength, and the discretization grid size. Any list of input source profiles can be specified with matrix B
, each column of which specifies one source profile b(r). Any list of output projection profiles can be specified with matrix C
. Matrix D
is optional (treated as zero when not specified) and subtracts the baseline contribution; see this paper for details.
The function mesti2s(syst, in, out)
deals specifically with scattering problems in two-sided or one-sided geometries where in
and out
. The function mesti2s()
automatically builds the source matrix B
, projection matrix C
, baseline matrix D
, and calls mesti()
for the computation. Flux normalization in z is applied automatically and exactly, so the full scattering matrix is always unitary when
To compute the complete field profiles, simply omit the argument C
or out
.
The solution method, the linear solver to use, and other options can be specified with a structure opts
as an optional input argument to mesti()
or mesti2s()
; see documentation for details. They are chosen automatically when not explicitly specified.
The function mesti_build_channels()
can be used to build the input and/or output matrices when using mesti()
, or to determine which channels are of interest when using mesti2s()
.
The function mesti_subpixel_smoothing()
can be used to build the permittivity profile with subpixel smoothing.
Detailed documentation is given in comments at the beginning of the function files:
mesti_main.jl
formesti()
mesti2s.jl
formesti2s()
mesti_build_channels.jl
formesti_build_channels()
mesti_subpixel_smoothing
formesti_subpixel_smoothing()
For example, typing ? mesti2s
in Julia brings up the documentation for mesti2s()
.
Examples in the examples folder illustrate the usage and the main functionalities of MESTI. Each example has its own folder, with its .jl
and .ipynb
script, auxiliary files specific to that example, and a README.md
page that shows the example script with its outputs:
- Open channel in a disordered system: 2D, using
mesti2s()
, transmission matrix & field profile with customized wavefronts. - Phase-conjugated focusing in disordered system: 2D, using
mesti()
andmesti2s()
, customized source & field profile with customized wavefronts. - Reflection matrix in Gaussian-beam basis: 2D, using
mesti()
, reflection matrix in customized basis for a fully open system.
Here are some animations from the examples above:
- Open channel propagating through disorder
- Focusing phase-conjugated light through disorder
- Reflection matrix of a scatterer in Gaussian-beam basis:
We thank William Sweeney for granting us permission to integrate his MUMPS-julia interface, MUMPS3.jl, into this package. The files bearing the mumps3 prefix in the src directory have been adopted from the MUMPS3.jl.
For more information on the theory, capability, and benchmarks (e.g., scaling of computing time, memory usage, and accuracy), please see:
- Ho-Chun Lin, Zeyu Wang, and Chia Wei Hsu. Fast multi-source nanophotonic simulations using augmented partial factorization. Nature Computational Science 2, 815–822 (2022).
@article{2022_Lin_NCS,
title = {Fast multi-source nanophotonic simulations using augmented partial factorization},
author = {Lin, Ho-Chun and Wang, Zeyu and Hsu, Chia Wei},
journal = {Nat. Comput. Sci.},
volume = {2},
issue = {12},
pages = {815--822},
year = {2022},
month = {Dec},
doi = {10.1038/s43588-022-00370-6}
}
Please cite this paper when you use MESTI.