-
Notifications
You must be signed in to change notification settings - Fork 65
Description
Is your feature request related to a problem? Please describe.
Sometimes it is of interest to obtain the waveguide mode field profiles and/or propagation constants at a large number of frequency points. Given that waveguide modes often exhibit smooth frequency dependence, it could be much faster and still accurate to solve for waveguide modes only at a smaller number of selected frequencies and then interpolate found solutions onto frequency points in-between, as opposed to directly solving mode equations at each frequency point.
Describe the solution you'd like
Various types of interpolations such as piecewise linear, quadratic, spline, etc can be considered. In the first version of such a feature it probably makes most sense to use Chebyshev interpolation given its high accuracy. One approach to implement this consists in adding a field sweep_spec in the ModeSolver class, that could take values of ModeSweepSpecType = Union[DirectSolveSpec, ChebyshevInterpSpec] (default: DirectSolveSpec()). Internally, ModeSolver should wrap this part of code https://github.com/flexcompute/tidy3d/blob/develop/tidy3d/components/mode/mode_solver.py#L463-L464 such that if sweep_spec is an instance of class ChebyshevInterpSpec:
- it detects the range of frequency sample points where the mode solutions are requested
- create an auxiliary
ModeSolverinstance that differs from the original one only by value of fieldfreqs, which now would be chebyshev nodes in the detected frequency range (the number of chebyshev nodes to use should be a field inChebyshevInterpSpecclass) - retrieves
ModeSolverDatafrom this auxiliaryModeSolver - applies mode tracking to
ModeSolverDatato facilitate correct interpolation - interpolates all quantities (propagation index, fields, grid correction factors, etc) onto the original frequency sample points and constructs a new
ModeSolverDatabased on these interpolated values.
Additional context