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

plot2D missing block on multi-matrial system #1104

Closed
YiChunHung opened this issue Jan 24, 2020 · 6 comments
Closed

plot2D missing block on multi-matrial system #1104

YiChunHung opened this issue Jan 24, 2020 · 6 comments

Comments

@YiChunHung
Copy link

Hi all,

Currently, I am trying to simulate the grating structure with multiple materials (Au and GaAs).
After building the geometry, I visualized the geometry for checking.
However, the visualized result seems not to show the second block (gAu).
geometry_GaAs

The following is my code. I hope someone could help me. Thanks.

import meep as mp
import numpy as np
import math
import matplotlib.pyplot as plt
from meep.materials import GaAs, Au, Au_JC_visible
from matplotlib import cm
tri_cmap = cm.get_cmap('gray_r',3)
nm = 0.001 #um
 
resolution = 200        # pixels/μm
 
dpml = 1.0             # PML thickness
dsub = 3000*nm          # substrate thickness
dpad = 3.0             # padding between grating and PML
gp = 10000*nm            # grating period
gh = 500*nm             # grating height
gdc = 0.5              # grating duty cycle
 
sx = dpml+dsub+gh+dpad+dpml
sy = gp
 
cell_size = mp.Vector3(sx,sy,0)
pml_layers = [mp.PML(thickness=dpml,direction=mp.X)]
 
 
wvl_min = 1           # min wavelength
wvl_max = 1.2           # max wavelength
fmin = 1/wvl_max        # min frequency
fmax = 1/wvl_min        # max frequency
fcen = 0.5*(fmin+fmax)  # center frequency
df = fmax-fmin          # frequency width
 
src_pt = mp.Vector3(-0.5*sx+dpml+0.5*dsub)
sources = [mp.Source(mp.GaussianSource(fcen, fwidth=df), component=mp.Ez, center=src_pt, size=mp.Vector3(y=sy))]
 
k_point = mp.Vector3(0,0,0)
symmetries=[mp.Mirror(mp.Y)]
 
geometries = []
gGaAs = mp.Block(material=GaAs, size=mp.Vector3(dpml+dsub,mp.inf,mp.inf), center=mp.Vector3(-0.5*sx+0.5*(dpml+dsub)))
gAu = mp.Block(material=Au, size=mp.Vector3(gh,gdc*gp,mp.inf), center=mp.Vector3(-0.5*sx+dpml+dsub+0.5*gh))
 
sim = mp.Simulation(resolution=resolution,
                    cell_size=cell_size,
                    boundary_layers=pml_layers,
                    k_point=k_point,
                    geometry=[gGaAs, gAu],
                    sources=sources,
                    symmetries=symmetries)
 
f2 = plt.figure(dpi=120)
sim.plot2D(ax=f2.gca(), labels=False, eps_parameters={'cmap':tri_cmap})
plt.savefig("geometry_GaAs.png")
@stevengj
Copy link
Collaborator

stevengj commented Jan 24, 2020

The epsilon output doesn't currently include frequency-dependent materials, and Au consists entirely of vacuum + frequency-dependent terms. Effectively, you are seeing the materials at ω=∞.

@oskooi, we discussed this in #415, but didn't we have a separate issue for supporting dispersive materials in get_epsilon and output_epsilon etcetera.

@YiChunHung
Copy link
Author

@stevengj Thanks for your reply. So, if the material has the frequency-dependent term, the plot of geometry would be failed. What about the simulation result? Is it still be accurate?

@oskooi
Copy link
Collaborator

oskooi commented Jan 24, 2020

There is an FAQ on this exact topic but no issue.

(#628 is somewhat related but for the anisotropic permittivity/permeability tensor at ω=∞.)

@smartalecH
Copy link
Collaborator

Actually, I modified the routines awhile back to output epsilon at a frequency if the user provides an omega or if the user supplies a source (which you do). I've tested this pretty thoroughly so I'm surprised you are seeing this...

I can briefly look into it.

@smartalecH
Copy link
Collaborator

Aha! There's just too much dynamic range between your GaAs index and the Au index. I log-transformed the epsilon data and got the following:

geometry_GaAs

It might be good to add a user passable function into the epsilon arguments so we can easily transform the data, similar to what we do with the fields. Obviously we need to update the docs with the "hidden" frequency evaluation feature.

Note: when evaluating epsilon at a particular frequency, it only returns the real part. The original purpose of the feature was to enable dispersive eigenmode coefficient calculations. MPB obviously only supports purely real materials (for now). Since it uses the same routines, you only get the real part (which is pretty small for these metals).

@YiChunHung
Copy link
Author

YiChunHung commented Jan 24, 2020

@smartalecH Thanks for your kindly support! Since the problem has been detected and solved, I am gonna close the issue.

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