Hi!

I am investigating the resonance modes of a few cavity resonators and noticed 
that the resonant frequency converges only linearly (and prohibitively slowly) 
in resolution. Moreover, metallic blocks (as opposed to a metallic boundary of 
the computational cell) increase the error by a couple of orders of magnitude.

I was able to reproduce the effect for a simple coaxial cavity; the first 
simulation uses the metallic boundary of the computational cell, while the 
second simulation has a larger computational cell, with the padding filled in 
with metal. Both cavities are identical and both are bounded by a perfect 
electric conductor, so I would expect the simulations to perform similarly.

While the first simulation yields a very great 0.0005% error at resolution 10, 
the second simulation gives about 2% relative error at the same resolution, a 
thousand-fold increase. Since the error reduces only linearly, a huge 
resolution is needed for moderately complex cavities.

Am I doing something wrong?

I inspected the fields – the excited TEM mode should have one wavelength in Er 
and zero in Ez. Up to small errors, that’s true for the unpadded version. 
However, the padded version gives unphysical fields (Ez is rather smooth, but 
not normal to the metal).

I attached the code I am using below.

Thank you!
Alan

—

import meep as mp
import argparse

parser = argparse.ArgumentParser()
parser.add_argument('-m', type=int, default=0, help='m')
parser.add_argument('-p', type=float, default=0, help='padding')
parser.add_argument('-r', type=float, default=1, help='resolution')
args = parser.parse_args()

m = args.m
padding = args.p
resolution = args.r

# set geometry
dimensions = mp.CYLINDRICAL

height = 50
r1 = 2
r2 = 4

cell = mp.Vector3(r2 + padding, 0, height + 2 * padding)

geometry = [
  mp.Block(center = mp.Vector3(0, 0, 0),
           size = mp.Vector3(2 * (r2 + padding), mp.inf, height + 2 * padding),
           material = mp.metal),
  mp.Block(center = mp.Vector3(0, 0, 0),
           size = mp.Vector3(2 * r2, mp.inf, height),
           material = mp.air),
  mp.Block(center = mp.Vector3(0, 0, 0),
           size = mp.Vector3(2 * r1, mp.inf, height),
           material = mp.metal)
  ]

# set Gaussian pulse
r_source = 3
z_source = height / 4

fcen = 1 / height
df = 0.005

source = mp.Source(src = mp.GaussianSource(fcen, fwidth=df),
                   component = mp.Er,
                   center = mp.Vector3(r_source, 0, z_source))

# run simulation
h = mp.Harminv(mp.Er, mp.Vector3(r_source, 0, z_source), fcen, df)
sim = mp.Simulation(cell_size = cell,
                    dimensions = dimensions,
                    geometry = geometry,
                    m = m,
                    resolution = resolution,
                    sources = [source])
sim.run(mp.at_beginning(mp.output_epsilon),
        mp.after_sources(mp.to_appended("ez", mp.at_every(0.6, 
mp.output_efield_z))),
        mp.after_sources(mp.to_appended("er", mp.at_every(0.6, 
mp.output_efield_r))),
        mp.after_sources(h), until_after_sources = 300)

for i in range(0, len(h.modes)):
    freq = h.modes[i].freq.real
    err = (freq - fcen) / freq * 100
    print("\nrelative error: %+f%%" % (err))

––

Running with “-p 0 -r 10” and “-p X -r 10” gives the relative errors I am 
seeing.
_______________________________________________
meep-discuss mailing list
meep-discuss@ab-initio.mit.edu
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss

Reply via email to