Comments (3)
I see, thanks for doing that comparison, I agree that it looks like there's a bug in the field getting or plotting in legume. I'll let you know when I find some time to look into it if I discover what it is or manage to fix it.
from legume.
I think this may be a numerical artifact when using a mode expansion method (here plane waves). If you want to investigate further, maybe try plotting a 1D cross section, with higher spatial resolution, and zoomed in around the boundary. I wonder if what we're seeing here is related to the Gibbs phenomenon (you're basically doing with Fourier transforms here too). I'm not sure though, because you're using quite high gmax so I would have thought that it should not be so pronounced. Maybe there is a bug in the plotting - if so, I am not sure when I'll find time to investigate in more detail though.
By the way note that legume has a dedicated function to compute (multi-layer) slab modes: https://github.com/fancompute/legume/blob/master/legume/gme/slab_modes.py, which are the basis for the guided-mode expansion. Just in case it is useful for what you are doing (these should be the exact analytical solutions).
from legume.
The problem is not a numerical artifact. Due to plane wave expansion, there is always Gibbs phenomenon, but it doesn't cause the discontinuity of Ez. In fact, Ez shouldn't have Gibbs phenomena in the first place because it shouldn't have a discontinuity.
I solved exactly the same problem with MPB and it's outputting the correct fields, with Ez being continuous and Dz discontinuous, so I think it's a legume bug.
MPB and legume frequencies are the same, so the problem isn't there, it's only the fields.
from legume.
Related Issues (20)
- Inconsistency among autograd and finite-difference gradients HOT 6
- can legume support complex eps? HOT 1
- how to export the field data to a txt file? HOT 4
- MatplotlibDeprecationWarning: Passing parameters norm and vmin/vmax simultaneously is deprecated since 3.3 and will become an error two minor releases later. Please pass vmin/vmax directly to the norm when creating it. linewidth=markeredgewidth) HOT 1
- install, "requirements.txt" seems to be missing HOT 1
- Issue defining a figure and gridspec with eps_ft in vis.py HOT 1
- mode index of the quai-TE/TM modes of photonic crystal slabs HOT 3
- ValueError: operands could not be broadcast together with shapes (50,) (200,) HOT 7
- no callable exp method HOT 3
- "eps_eff" not gmode_eps
- Calculation of E/D Fields via Curl of H Field HOT 2
- FourierShape x_cent and y_cent parameters do not make any difference HOT 1
- Visualize the field component HOT 4
- Question autograd eigsh HOT 1
- Is posible to add a mirror/boundary condition on one side? HOT 2
- Comparison of quality factor obtained via Legume and an FDTD solver HOT 1
- Failed to calculate a BIC mode in 1D grating HOT 2
- Bands of a 1D photonic crystal slab HOT 1
- questions about the dielectric constant setup HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from legume.