sim_param['frequency']) if (model.Kx != 0 or model.Ky != 0): print "Warning: frequency-domain solver may be broken for nonperpendicular incidence" ## Frequency-domain simulation does not support dispersive materials yet. We must define each material by ## using the nondispersive permittivity and the nondispersive conductivity ## (both calculated from polarizabilities at given frequency) ## Define the frequency-independent epsilon for all materials (has to be done _before_ defining s, or unstable) my_eps = meep_utils.MyHiFreqPermittivity(model, sim_param['frequency']) meep.set_EPS_Callback(my_eps.__disown__()) s = meep.structure(vol, meep.EPS, perfectly_matched_layers, meep.identity()) ## Create callback to set nondispersive conductivity (depends on material polarizabilities and frequency) mc = meep_utils.MyConductivity(model, sim_param['frequency']) meep.set_COND_Callback(mc.__disown__()) s.set_conductivity(meep.E_stuff, meep.COND) ## only "E_stuff" worked here for me srctype = meep.continuous_src_time(sim_param['frequency'] / c) ## Create fields with Bloch-periodic boundaries (any nonzero transversal component of k-vector is possible) f = meep.fields(s) f.use_bloch(meep.X, -model.Kx / (2 * np.pi)) f.use_bloch(meep.Y, -model.Ky / (2 * np.pi)) ## Add a source of a plane wave (with possibly oblique incidence) ## Todo implement in MEEP: we should define an AmplitudeVolume() object and reuse it for monitors later srcvolume = meep.volume( meep.vec(-model.size_x / 2, -model.size_y / 2, -model.size_z / 2 + model.pml_thickness), ## TODO try from -inf to +inf meep.vec(model.size_x / 2, model.size_y / 2,
else: meep.master_printf("== Frequency domain structure setup (for frequency of %g Hz) ==\n" % sim_param['frequency']) if (model.Kx!=0 or model.Ky!=0): print "Warning: frequency-domain solver may be broken for nonperpendicular incidence" ## Frequency-domain simulation does not support dispersive materials yet. We must define each material by ## using the nondispersive permittivity and the nondispersive conductivity ## (both calculated from polarizabilities at given frequency) ## Define the frequency-independent epsilon for all materials (has to be done _before_ defining s, or unstable) my_eps = meep_utils.MyHiFreqPermittivity(model, sim_param['frequency']) meep.set_EPS_Callback(my_eps.__disown__()) s = meep.structure(vol, meep.EPS, perfectly_matched_layers, meep.identity()) ## Create callback to set nondispersive conductivity (depends on material polarizabilities and frequency) mc = meep_utils.MyConductivity(model, sim_param['frequency']) meep.set_COND_Callback(mc.__disown__()) s.set_conductivity(meep.E_stuff, meep.COND) ## only "E_stuff" worked here for me srctype = meep.continuous_src_time(sim_param['frequency']/c) ## Create fields with Bloch-periodic boundaries (any nonzero transversal component of k-vector is possible) f = meep.fields(s) f.use_bloch(meep.X, -model.Kx/(2*np.pi)) f.use_bloch(meep.Y, -model.Ky/(2*np.pi)) ## Add a source of a plane wave (with possibly oblique incidence) ## Todo implement in MEEP: we should define an AmplitudeVolume() object and reuse it for monitors later srcvolume = meep.volume( meep.vec(-model.size_x/2, -model.size_y/2, -model.size_z/2+model.pml_thickness), ## TODO try from -inf to +inf meep.vec(model.size_x/2, model.size_y/2, -model.size_z/2+model.pml_thickness)) ## TODO move whole amplitude factor to meep_utils, exp(-1j*(a*x+b*y) - ((c*x)**2 + (d*y)**2))