Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional features for working with modes #6

Open
2 of 4 tasks
jan-david-fischbach opened this issue Jan 22, 2023 · 7 comments
Open
2 of 4 tasks

Additional features for working with modes #6

jan-david-fischbach opened this issue Jan 22, 2023 · 7 comments

Comments

@jan-david-fischbach
Copy link
Collaborator

jan-david-fischbach commented Jan 22, 2023

Hey @flaport,
I am a big fan of meow. Besides its EME capabilities, I think it makes quite a lot of sense to use it as an abstraction layer over different FDE algorithms, as switching between "simulation backends" can otherwise necessitate significant code rework (for the structure definition alone). Maybe even interesting for gdsfactory (@joamatab) (We could also build a femwell backend for meow). With that in mind, there is a couple of things I'd like to add:

  • Poynting flux: auxiliary properties to calculate the poynting flux in x,y and z.

$$ \vec{P} = \vec{E} \times \vec{H} $$

An implementation using np.cross is probably most sensible. Addressed in #7.

  • Effective mode area: another auxiliary measure I tend to use relatively frequently. It is not that well defined/ agreed on in literature but I would use the definition as in lumerical's implementation:

$$ A_{eff} = \frac{\left(\int|\vec{E}|^2dA\right)^2}{\int|\vec{E}|^4dA} $$

  • Implementation of the field energies for irregular meshes: At this moment the modal energies are computed by summing over the energy densities, which for equidistant meshes leads to a value proportional to the actual modal energy.:
def electric_energy(mode: Mode) -> float:
    """get the electric energy contained in a `Mode`"""
    return electric_energy_density(mode).sum()

The proportionality constant can be eliminated by normalization, as it is not dependent on the field distribution. This does however not hold for non-equidistant meshes, as finely meshed regions are over-emphasized compared to the more coarsely meshed regions. I would therefore suggest dividing by the mesh step in x and y before summing or even better do a proper integration over the energy densities e.g. using nested np.trapz evaluations.

  • I would love to be able to also easily get the group index. That would however require multiple frequency points to do a finite difference differentiation on the effective index with frequency/wavelength, right?
@flaport
Copy link
Owner

flaport commented Jan 22, 2023

Hey @Jan-David-Black ,

Glad you like the library!

A few commonts on each of your points:

  • I accepted PR Include Poynting Vector calculation #7 .
  • Sticking to the Lumerical definition is the smart choice. It still is a leading standard on its own.
  • I agree that generalizing some of the formulas for non-cartesian or non-uniform meshes is a good idea.
  • We could add a group index function to the mode object which runs another mode simulation with exactly the same settings but a slightly perturbed wavelength. If we document this behavior (i.e. that this calculation is not instant) it might be a good solution.

@jan-david-fischbach
Copy link
Collaborator Author

Tidy3D doesn't yet seem to support non-equidistant meshes: flexcompute/tidy3d#652
Lumerical does however.

We could add a group index function to the mode object which runs another mode simulation with exactly the same settings but a slightly perturbed wavelength. If we document this behavior (i.e. that this calculation is not instant) it might be a good solution.

Interesting idea. We already have the cell available, so it should be relatively easy to do. Lumerical directly returns the group index. So in that case we can just cache it and avoid the second calculation. When I have time I'll open a PR

@simbilod
Copy link

@Jan-David-Black we have all these things in femwell, and started trying to combine it with MEOW to do EME (https://github.com/HelgeGehring/femwell/blob/main/femwell/eme.py). Not quite there yet, however

@smartalecH
Copy link

I would love to be able to also easily get the group index. That would however require multiple frequency points to do a finite difference differentiation on the effective index with frequency/wavelength, right?

You can actually compute the group index from the fields directly (a simple integral from Snyder and Love, or you can rederive it using the Hellmann-Feynman theorem). No need to do any extra simulations by perturbing the wavelength etc.

@flaport
Copy link
Owner

flaport commented Mar 27, 2023

Thanks @smartalecH , I'll try that once I find some time :)

@jan-david-fischbach
Copy link
Collaborator Author

@smartalecH, you are talking about this formula, right?

$$
\tilde{v}{\mathrm{g}}=-2 \frac{\tilde{\beta}}{k} \frac{c}{\lambda^3} \int{A_x} \Psi^2 \mathrm{~d} A / \int_{A_x} \Psi^2 \frac{\mathrm{d}}{\mathrm{d} \lambda}\left(\frac{n^2}{\lambda^2}\right) \mathrm{d} A .
$$

Which is equation 33-16 of Snyder and Love.

@smartalecH
Copy link

you are talking about this formula, right?

Yep that's right. There's lots of ways you can massage it into various forms depending on what the problem looks like and what you are after.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants