NanoComp / meep

free finite-difference time-domain (FDTD) software for electromagnetic simulations
GNU General Public License v2.0
1.23k stars 622 forks source link

Fields blows up during calculation of transmission of the cavity #1486

Open TadeasManka opened 3 years ago

TadeasManka commented 3 years ago

Hello, I am trying to simulate a nanobeam cavity exactly the same as simpetus nanobeam (http://www.simpetus.com/projects.html#meep_cavity). The calculation of Q works properly, but problems occurs, when i am trying to calculate transmission spectra. The simulation is firstly run with empty waveguide and then with the structure. Problem occurs with the run with structure. I set the eigenmode source at the begining of wvg and leave only Mirror symmetry in Y with height -1 and wait until the fields Ey at the end of wvg decay by 1e-6. But after the normalization run, the fields doesnt go to zero, instead, it blows up. After time more than 10 000 i still get numbers in console like fields decay by 1e19/1e19 = 1 and it goes up until it crash. I am using the resolution 40 as in tutorial but increasing it to 64 doesnt solve the problem. See attached script. Any suggestions for solving the problem? cavity.txt

mariusCZ commented 3 years ago

From a quick glance at your script, you are using PML boundaries. If the holes extend in to the PML or are too close to the PML, the simulation diverges due to PML not working nicely with photonic crystals or oblique waveguides. Change the boundary to absorber and make it thicker. This is all assuming you actually modified the provided script, if you have not, that makes it harder to pinpoint the problem.

If you could attach how your simulation domain looks, I could try pointing out more accurately.

TadeasManka commented 3 years ago

From a quick glance at your script, you are using PML boundaries. If the holes extend in to the PML or are too close to the PML, the simulation diverges due to PML not working nicely with photonic crystals or oblique waveguides. Change the boundary to absorber and make it thicker. This is all assuming you actually modified the provided script, if you have not, that makes it harder to pinpoint the problem.

If you could attach how your simulation domain looks, I could try pointing out more accurately.

I added additional padding in variable 'pad' of 2um at both sides of wvg, see attached cavity.txt, so the holes are not in the pml region

the domain look like this:

resolution = 40                       # pixels/um

    a_start = args.a_start                # starting periodicity
    a_end = args.a_end                    # ending periodicity
    s_cav = args.s_cav                    # cavity length
    r = args.r                            # hole radius  (units of a)
    h = args.hh                           # waveguide height
    w = args.w                            # waveguide width

    dair = 1.00                           # air padding
    dpml = 1.00                           # PML thickness
    pad = 2.00                            # padding

    Ndef = args.Ndef                      # number of defect periods
    a_taper = mp.interpolate(Ndef, [a_start,a_end])
    dgap = a_end-2*r*a_end

    Nwvg = args.Nwvg                      # number of waveguide periods
    sx = 2*(Nwvg*a_start+sum(a_taper))-dgap+s_cav+2*pad
    sy = dpml+dair+w+dair+dpml
    sz = dpml+dair+h+dair+dpml

    cell_size = mp.Vector3(sx,sy,sz)
    boundary_layers = [mp.PML(dpml)]

I dont understand what you mean by absorber boundary...pml is absorber

mariusCZ commented 3 years ago

Sorry for not being so clear, by simulation domain I mean a picture of the simulation domain. I would do this myself, but have no access currently to a meep install with a Python interface. Use the tutorial here to produce the simulation domain.

PML is a type of boundary, absorber is another type of boundary, specifically a boundary that implements gradual scalar electric and magnetic conductivity. You can read more about it here, which is part of meep documentation.

TadeasManka commented 3 years ago

Sorry for not being so clear, by simulation domain I mean a picture of the simulation domain. I would do this myself, but have no access currently to a meep install with a Python interface. Use the tutorial here to produce the simulation domain.

PML is a type of boundary, absorber is another type of boundary, specifically a boundary that implements gradual scalar electric and magnetic conductivity. You can read more about it here, which is part of meep documentation.

ok, domain looks like this: sim-domain

i transferred it into 2D, I will try the absorber at boundaries and let you know

mariusCZ commented 3 years ago

The structure looks fine, the PML boundary should technically work in this case. Here are two more things you could try out:

  1. Reduce the eigenmode source width, only needs to be about twice the width of the waveguide.
  2. Try simulating without symmetry. I presume you took example code from the documentation, in their case they are using a simple Gaussian source and while the field component is the same, it is still worth a shot.

Have you taken a look at your field profiles? When I was facing divergence problem I saw quickly where there was an error with the field profiles once the simulation started diverging.