def __init__(self, comment="", simtime=100e-15, resolution=5e-9, cellnumber=1, padding=2e-6, cellsize = 200e-9, epsilon=33.97, blend=0, **other_args): """ This structure demonstrates that scatter.py can also compute the reflectance and transmittance of samples on a substrate. The substrate is though to have effectively infinite thickness, since its back interface is not included in the simulation volume. It is assumed that with thick enough substrate there will be no Fabry-Perot interferences arising from the reflection from its back side, so this kind of simulation can not predict them. The monitor planes can also be placed inside a dielectric, to enable the transmitted wave amplitude to be sensed in the substrate medium. In this case the measured waveforms are rescaled so that the transmitted energy is returned the same as if measured after reflection-less transition to vacuum. This way, reflectance*2+transmittance*+losses still sum up to one. This example also demonstrates that on a steep interface with air the transmitted and reflected waves have exactly the same energy with the choice of permittivity: ((1+.5**.5)/(1-.5**.5))**2, that is roughly 33.97. """ meep_utils.AbstractMeepModel.__init__(self) ## Base class initialisation ## Constant parameters for the simulation self.simulation_name = "HalfSpace" self.src_freq, self.src_width = 500e12, 1000e12 # [Hz] (note: gaussian source ends at t=10/src_width) self.interesting_frequencies = (10e12, 1000e12) # Which frequencies will be saved to disk self.pml_thickness = 500e-9 self.size_z = blend + 4*padding + 2*self.pml_thickness + 6*resolution self.size_x = resolution*1.8 if other_args.get('Kx',0)==0 else resolution*5 ## allow some space along x if oblique incidence is set self.size_y = resolution*1.8 if other_args.get('Ky',0)==0 else resolution*5 ## dtto print 'self.size_x, self.size_y', self.size_x, self.size_y self.monitor_z1, self.monitor_z2 = (-padding-blend/2, padding+blend/2) self.register_locals(locals(), other_args) ## Remember the parameters self.mon2eps = epsilon ## store what dielectric is the second monitor embedded in ## Define materials self.materials = [] if 'Au' in comment: self.materials += [meep_materials.material_Au(where=self.where_m)] elif 'Ag' in comment: self.materials += [meep_materials.material_Ag(where=self.where_m)] elif 'metal' in comment.lower(): self.materials += [meep_materials.material_Au(where=self.where_m)] self.materials[-1].pol[1:] = [] self.materials[-1].pol[0]['gamma'] = 0 else: self.materials += [meep_materials.material_dielectric(where=self.where_m, eps=self.epsilon)] for m in self.materials: self.fix_material_stability(m, f_c=3e15) ## rm all osc above the first one, to optimize for speed ## Test the validity of the model meep_utils.plot_eps(self.materials, plot_conductivity=True, draw_instability_area=(self.f_c(), 3*meep.use_Courant()**2), mark_freq={self.f_c():'$f_c$'}) self.test_materials()
def __init__(self, comment="", simtime=100e-15, resolution=5e-9, cellnumber=1, padding=2e-6, cellsize = 200e-9, epsilon=33.97, blend=0, **other_args): """ This structure demonstrates that scatter.py can also compute the reflectance and transmittance of samples on a substrate. The substrate can have an infinite thickness, since its back interface is not included in the simulation volume. It is assumed that with thick enough substrate there will be no Fabry-Perot interferences due to reflection from its back side; this kind simulation can not predict them. The monitor planes can also be placed inside a dielectric. In this case the measured waveforms are rescaled so that the transmitted energy is returned the same as if measured after reflection-less transition to vacuum. This way, reflectance*2+transmittance*+losses still sum up to one. This example also demonstrates that on a steep interface with air the transmitted and reflected waves have exactly the same energy with the choice of permittivity: ((1+.5**.5)/(1-.5**.5))**2, that is roughly 33.97. """ meep_utils.AbstractMeepModel.__init__(self) ## Base class initialisation ## Constant parameters for the simulation self.simulation_name = "HalfSpace" self.src_freq, self.src_width = 500e12, 1000e12 # [Hz] (note: gaussian source ends at t=10/src_width) self.interesting_frequencies = (10e12, 1000e12) # Which frequencies will be saved to disk self.pml_thickness = 500e-9 self.size_z = blend + 4*padding + 2*self.pml_thickness + 6*resolution self.size_x = resolution*1.8 if other_args.get('Kx',0)==0 else resolution*5 ## allow some space along x if oblique incidence is set self.size_y = resolution*1.8 if other_args.get('Ky',0)==0 else resolution*5 ## dtto print 'self.size_x, self.size_y', self.size_x, self.size_y self.monitor_z1, self.monitor_z2 = (-padding-blend/2, padding+blend/2) self.register_locals(locals(), other_args) ## Remember the parameters self.mon2eps = epsilon ## store what dielectric is the second monitor embedded in ## Define materials self.materials = [] if 'Au' in comment: self.materials += [meep_materials.material_Au(where=self.where_m)] elif 'Ag' in comment: self.materials += [meep_materials.material_Ag(where=self.where_m)] elif 'metal' in comment.lower(): self.materials += [meep_materials.material_Au(where=self.where_m)] self.materials[-1].pol[1:] = [] self.materials[-1].pol[0]['gamma'] = 0 else: self.materials += [meep_materials.material_dielectric(where=self.where_m, eps=self.epsilon)] for m in self.materials: self.fix_material_stability(m, f_c=3e15) ## rm all osc above the first one, to optimize for speed ## Test the validity of the model meep_utils.plot_eps(self.materials, plot_conductivity=True, draw_instability_area=(self.f_c(), 3*meep.use_Courant()**2), mark_freq={self.f_c():'$f_c$'}) self.test_materials()
def __init__(self, comment="", simtime=150e-12, resolution=6e-6, cellsize=100e-6, cellsizexy=100e-6, cellnumber=1, padding=100e-6, cornerradius=0e-6, xholesize=80e-6, yholesize=80e-6, slabthick=12e-6, slabcdist=0, **other_args): meep_utils.AbstractMeepModel.__init__(self) ## Base class initialisation ## Constant parameters for the simulation self.simulation_name = "Fishnet" self.src_freq, self.src_width = 1000e9, 4000e9 # [Hz] (note: gaussian source ends at t=10/src_width) self.interesting_frequencies = (1e9, 2*c/cellsize) # Which frequencies will be saved to disk self.pml_thickness = .1*c/self.src_freq self.size_x = cellsizexy if yholesize == "inf" or yholesize == np.inf: self.size_y = resolution/1.8 yholesize = np.inf else: self.size_y = cellsizexy self.size_z = cellnumber*cellsize + 4*padding + 2*self.pml_thickness self.monitor_z1, self.monitor_z2 = (-(cellsize*cellnumber/2)-padding, (cellsize*cellnumber/2)+padding) self.cellcenters = np.arange((1-cellnumber)*cellsize/2, cellnumber*cellsize/2, cellsize) self.register_locals(locals(), other_args) ## Remember the parameters ## Define materials (with manual Lorentzian clipping) au = meep_materials.material_Au(where=self.where_fishnet) #au.pol[0]['sigma'] /= 1000 # adjust losses #au.pol[0]['gamma'] *= 3000 self.fix_material_stability(au, verbose=0) self.materials = [au] ## Test the validity of the model meep_utils.plot_eps(self.materials, plot_conductivity=True, draw_instability_area=(self.f_c(), 3*meep.use_Courant()**2), mark_freq={self.f_c():'$f_c$'}) self.test_materials()
def __init__(self, comment="", simtime=50e-12, resolution=4e-6, cellsize=100e-6, cellnumber=1, padding=20e-6, radius=40e-6, wirethick=6e-6, srrthick=6e-6, splitting=26e-6, splitting2=0e-6, capacitorr=10e-6, cbarthick=0e-6, insplitting=100e-6, incapacitorr=0e-6, **other_args): meep_utils.AbstractMeepModel.__init__(self) ## Base class initialisation ## Constant parameters for the simulation self.simulation_name = "SRRArray" self.src_freq, self.src_width = 1000e9, 4000e9 # [Hz] (note: gaussian source ends at t=10/src_width) self.interesting_frequencies = (10e9, 2000e9) # Which frequencies will be saved to disk self.pml_thickness = 20e-6 self.size_x = cellsize self.size_y = cellsize self.size_z = cellnumber*cellsize + 4*padding + 2*self.pml_thickness self.monitor_z1, self.monitor_z2 = (-(cellsize*cellnumber/2)-padding, (cellsize*cellnumber/2)+padding) self.cellcenters = np.arange((1-cellnumber)*cellsize/2, cellnumber*cellsize/2, cellsize) self.register_locals(locals(), other_args) ## Remember the parameters ## Define materials self.materials = [] au = meep_materials.material_Au(where=self.where_wire) self.fix_material_stability(au, verbose=0) self.materials.append(au) ## Test the validity of the model meep_utils.plot_eps(self.materials, plot_conductivity=True, draw_instability_area=(self.f_c(), 3*meep.use_Courant()**2), mark_freq={self.f_c():'$f_c$'}) self.test_materials()
def __init__(self, comment="", simtime=100e-12, resolution=2e-6, cellnumber=1, cellsize=100e-6, padding=50e-6, fillfraction=0.5, epsilon=2, **other_args): meep_utils.AbstractMeepModel.__init__(self) ## Base class initialisation ## Constant parameters for the simulation self.simulation_name = "Slab" self.src_freq, self.src_width = 1000e9, 4000e9 # [Hz] (note: gaussian source ends at t=10/src_width) self.interesting_frequencies = (10e9, 2000e9) # Which frequencies will be saved to disk self.pml_thickness = 0.1*c/self.src_freq self.size_x = resolution*2 self.size_y = resolution self.size_z = cellnumber*cellsize + 4*padding + 2*self.pml_thickness self.monitor_z1, self.monitor_z2 = (-(cellsize*cellnumber/2)-padding, (cellsize*cellnumber/2)+padding) self.cellcenters = np.arange((1-cellnumber)*cellsize/2, cellnumber*cellsize/2, cellsize) self.register_locals(locals(), other_args) ## Remember the parameters ## Define materials # note: for optical range, it was good to supply f_c=5e15 to fix_material_stability if 'Au' in comment: m = meep_materials.material_Au(where=self.where_slab) self.fix_material_stability(m, verbose=0) ## rm all osc above the first one, to optimize for speed elif 'Ag' in comment: m = meep_materials.material_Ag(where=self.where_slab) self.fix_material_stability(m, verbose=0) ## rm all osc above the first one, to optimize for speed else: m = meep_materials.material_dielectric(where=self.where_slab, loss=0.001, eps=epsilon) self.materials = [m]
def __init__(self, comment="", simtime=200e-15, resolution=20e-9, cellnumber=1, padding=50e-6, tdist=50e-6, ldist=100e-6, rcore1=6e-6, rclad1=0, rcore2=6e-6, tshift=0, **other_args): """ I have a red laser (spot size : 2mm of diameter) that goes through 2 grids placed a 50cm (see pictures below) but 100um apart from each other. A photomultiplier is placed behind the grids at 1m. During the experiment the second grid moves transversally and alternatively block the light and let the light reaching the photomultiplier. The grids induce a diffraction pattern, of which we only collect the central bright spot with the photomultiplier (a pinhole is placed in front of it with a 2mm diameter hole). What I would like to do is to simulate the profile of intensity of the light collected at the photomultiplier while the second grid moves. That's a first thing. Secondly, I would like to simulate how the profile changes while some material is deposit on the bars of the first grids and obstruct slowly the light to go through. So what matters to me is to recorded "how much light" of the initial light reach my PM while the second grid moves for various thicknesses of material deposited on the first one. """ meep_utils.AbstractMeepModel.__init__(self) ## Base class initialisation ## Constant parameters for the simulation self.simulation_name = "TMathieu_Grating" self.src_freq, self.src_width = 500e12, 2000e12 # [Hz] (note: gaussian source ends at t=10/src_width) self.interesting_frequencies = (380e12, 730e12) # Which frequencies will be saved to disk self.pml_thickness = 500e-9 self.size_x = resolution*1.8 self.size_y = tdist self.size_z = ldist + 2*padding + 2*self.pml_thickness self.monitor_z1, self.monitor_z2 = (-(ldist/2)-padding, (ldist/2)+padding) cellsize = ldist+2*padding self.register_locals(locals(), other_args) ## Remember the parameters ## Define materials (with manual Lorentzian clipping) self.materials = [] au = meep_materials.material_Au(where=self.where_wire) self.fix_material_stability(au, verbose=0) self.materials.append(au) ## Test the validity of the model meep_utils.plot_eps(self.materials, plot_conductivity=True, draw_instability_area=(self.f_c(), 3*meep.use_Courant()**2), mark_freq={self.f_c():'$f_c$'}) self.test_materials()
def __init__(self, comment="", simtime=100e-12, resolution=3e-6, Kx=0, Ky=0, spacing=75e-6, monzd=80e-6, # lateral simulation size, and the z-length left for whole structure apertured=5e-6, apertureth=5e-6, gaasth=2e-6, # metal aperture (square hole size, metal thickness, gallium arsenide layer thickness) radius=10e-6, epsloss=0.01, spherey=0e-6, spherez=-14e-6, # dielectric sphere (radius and dielectric losses) wireth=4e-6, wirey=14e-6, wirez=-14e-6 # metallic wire along x (diameter, lateral position) ): meep_utils.AbstractMeepModel.__init__(self) ## Base class initialisation self.simulation_name = "ApertureSphere" self.register_locals(locals()) ## Remember the parameters ## Constants for the simulation self.pml_thickness = 20e-6 self.monitor_z1, self.monitor_z2 = -monzd/2, self.apertureth+self.gaasth print "self.monitor_z1, self.monitor_z2", self.monitor_z1, self.monitor_z2 self.simtime = simtime # [s] self.src_freq, self.src_width = 2000e9, 4000e9 # [Hz] (note: gaussian source ends at t=10/src_width) self.interesting_frequencies = (0e9, 4000e9) # Which frequencies will be saved to disk self.size_x = spacing self.size_y = spacing self.size_z = monzd*2 + 2*self.pml_thickness ## Define materials #self.materials = [meep_materials.material_dielectric(where = self.where_GaAs, eps=10)] #self.materials += [meep_materials.material_TiO2_THz(where = self.where_TiO2)] self.materials = [] if self.radius > 0: self.materials += [meep_materials.material_dielectric(where = self.where_TiO2, eps=94., loss=epsloss)] #if not 'NoGaAs' in comment: self.materials += [meep_materials.material_dielectric(where = self.where_gaas, eps=12) ] %TODO test GaAs where-func self.materials += [meep_materials.material_Au(where = self.where_metal) ] for m in self.materials: self.fix_material_stability(m) ## Test the validity of the model meep_utils.plot_eps(self.materials, plot_conductivity=True, draw_instability_area=(self.f_c(), 3*meep.use_Courant()**2), mark_freq={self.f_c():'$f_c$'}) self.test_materials()
def __init__(self, comment="", simtime=100e-15, resolution=100e-9, size_x=16e-6, size_y=5e-6, size_z=5e-6, metalthick=.5e-6, apdisty=0e-6, apdistx=14e-6, aprad=.1e-6, monzd=123.456e-6): meep_utils.AbstractMeepModel.__init__(self) ## Base class initialisation ## Constant parameters for the simulation self.simulation_name = "PlasmonsFilm" self.src_freq = 400e12 # [Hz] (note: srcwidth irrelevant for continuous_source) #self.interesting_frequencies = (0e9, 2000e9) # Which frequencies will be saved to disk (irrelevant here) XXX self.pml_thickness = 1e-6 self.size_x = size_x self.size_y = size_y self.size_z = size_z substrate_z = size_x / 3 self.simtime = simtime # [s] self.Kx = 0; self.Ky = 0; self.padding=0 self.register_locals(locals()) ## Remember the parameters ## Define materials f_c = c / np.pi/self.resolution/meep_utils.meep.use_Courant() self.materials = [meep_materials.material_Au(where=self.where_metal)] self.materials[0].pol[0]['sigma'] /= 2. ## effective thin layer TODO test+tune+comment self.materials[0].pol[1:] = [] ## rm other osc #self.materials = [meep_materials.material_DrudeMetal(lfconductivity=1e8, f_c=.2*f_c, where = self.where_metal)] #self.materials += [meep_materials.material_dielectric(where=self.where_diel, eps=2.)] #self.TestMaterials() #self.materials += [meep_materials.material_Au(where=None)] meep_utils.plot_eps(self.materials, mark_freq=[f_c]) ## Test the validity of the model for material in self.materials: self.fix_material_stability(material, f_c=2e15, verbose=1) meep_utils.plot_eps(self.materials, plot_conductivity=True, draw_instability_area=(self.f_c(), 3*meep.use_Courant()**2), mark_freq={self.f_c():'$f_c$'}) self.test_materials()
def __init__(self, comment="", simtime=25e-15, resolution=.5e-9, cellsize=5e-9, cellsizex=10e-9, cellsizey=0, cellnumber=1, padding=1e-9, radius=3.1e-9, gap=0, **other_args): meep_utils.AbstractMeepModel.__init__( self) ## Base class initialisation ## Constant parameters for the simulation self.simulation_name = "PlasmonicDimers" self.src_freq, self.src_width = 1000e12, 4000e12 # Hz] (note: gaussian source ends at t=10/src_width) self.interesting_frequencies = ( 1e12, 1.5e15) # Which frequencies will be saved to disk self.pml_thickness = .01 * c / self.src_freq ## changing from 10x larger value caused less than 1e-4 change in transmittance print("self.pml_thickness", self.pml_thickness) self.size_x = cellsizex self.size_y = cellsizey if cellsizey else resolution / 1.8 ## if zero thickness in y, simulate cylinders self.size_z = cellnumber * cellsize + 4 * padding + 2 * self.pml_thickness self.monitor_z1, self.monitor_z2 = (-(cellsize * cellnumber / 2) - padding, (cellsize * cellnumber / 2) + padding) self.cellcenters = np.arange((1 - cellnumber) * cellsize / 2, cellnumber * cellsize / 2, cellsize) self.register_locals(locals(), other_args) ## Remember the parameters self.gap = gap if gap else resolution / 1.8 ## adjust the gap to be single voxel TODO self.singlesphere = ('singlesphere' in self.comment) ## Define materials (with manual Lorentzian clipping) au = meep_materials.material_Au(where=self.where_metal) #au.pol[0]['sigma'] /= 1000 # adjust losses #au.pol[0]['gamma'] *= .1 if 'nolorentz' in comment.lower(): au.pol = au.pol[: 1] ## optionally, remove all Lorentzian oscillators au.pol = au.pol[: 5] ## remove the last oscillator - maximum number is 5 as given by python-meep self.fix_material_stability(au, verbose=0) self.materials = [au] ## Test the validity of the model meep_utils.plot_eps(self.materials, plot_conductivity=True, draw_instability_area=(self.f_c(), 3 * meep.use_Courant()**2), mark_freq={self.f_c(): '$f_c$'}) self.test_materials()
def __init__(self, comment="", simtime=30e-9, resolution=5e-3, cellnumber=1, padding=9e-3, radius=33.774e-3, height=122.36e-3 , Kx=0, Ky=0): ## XXXheight=122.3642686e-3 meep_utils.AbstractMeepModel.__init__(self) ## Base class initialisation self.simulation_name = "HollowCyl" self.register_locals(locals()) ## Remember the parameters ## Obligatory parameters (used in the simulation) self.pml_thickness = padding/2 self.simtime = simtime # [s]HollowCyl_simtime=3.000e-08_height=3.000e-02 self.src_freq, self.src_width = 3e9, 10e9 # [Hz] (note: gaussian source ends at t=10/src_width) self.interesting_frequencies = (.1e9, 8e9) # Which frequencies will be saved to disk self.size_x = 2*radius+padding*2 self.size_y = 2*radius+padding*2 self.size_z = height+padding*2 ## Define materials f_c = c / np.pi/self.resolution/meep_utils.meep.use_Courant() self.materials = [] au = meep_materials.material_Au(where=self.where_metal) self.fix_material_stability(au, verbose=0) self.materials.append(au) #self.materials += [meep_materials.material_DrudeMetal(lfconductivity=1e4, f_c=f_c, gamma_factor=.5, epsplus=0, where=self.where_metal)] meep_utils.plot_eps(self.materials, plot_conductivity=True, draw_instability_area=(self.f_c(), 3*meep.use_Courant()**2), mark_freq={self.f_c():'$f_c$'}) self.test_materials()
def __init__( self, comment="", simtime=100e-12, resolution=3e-6, Kx=0, Ky=0, spacing=75e-6, monzd=80e-6, # lateral simulation size, and the z-length left for whole structure apertured=5e-6, apertureth=5e-6, gaasth=2e-6, # metal aperture (square hole size, metal thickness, gallium arsenide layer thickness) radius=10e-6, epsloss=0.01, spherey=0e-6, spherez=-14e-6, # dielectric sphere (radius and dielectric losses) wireth=4e-6, wirey=14e-6, wirez=-14e-6 # metallic wire along x (diameter, lateral position) ): meep_utils.AbstractMeepModel.__init__( self) ## Base class initialisation self.simulation_name = "ApertureSphere" self.register_locals(locals()) ## Remember the parameters ## Constants for the simulation self.pml_thickness = 20e-6 self.monitor_z1, self.monitor_z2 = -monzd / 2, self.apertureth + self.gaasth print "self.monitor_z1, self.monitor_z2", self.monitor_z1, self.monitor_z2 self.simtime = simtime # [s] self.src_freq, self.src_width = 2000e9, 4000e9 # [Hz] (note: gaussian source ends at t=10/src_width) self.interesting_frequencies = ( 0e9, 4000e9) # Which frequencies will be saved to disk self.size_x = spacing self.size_y = spacing self.size_z = monzd * 2 + 2 * self.pml_thickness ## Define materials #self.materials = [meep_materials.material_dielectric(where = self.where_GaAs, eps=10)] #self.materials += [meep_materials.material_TiO2_THz(where = self.where_TiO2)] self.materials = [] if self.radius > 0: self.materials += [ meep_materials.material_dielectric(where=self.where_TiO2, eps=94., loss=epsloss) ] #if not 'NoGaAs' in comment: self.materials += [meep_materials.material_dielectric(where = self.where_gaas, eps=12) ] %TODO test GaAs where-func self.materials += [meep_materials.material_Au(where=self.where_metal)] for m in self.materials: self.fix_material_stability(m) ## Test the validity of the model meep_utils.plot_eps(self.materials, plot_conductivity=True, draw_instability_area=(self.f_c(), 3 * meep.use_Courant()**2), mark_freq={self.f_c(): '$f_c$'}) self.test_materials()
def __init__(self, comment="", simtime=150e-12, resolution=4e-6, cellsize=100e-6, cellnumber=1, padding=100e-6, cornerradius=30e-6, xholesize=80e-6, yholesize=80e-6, slabthick=12e-6, slabcdist=0, **other_args): meep_utils.AbstractMeepModel.__init__(self) ## Base class initialisation ## Constant parameters for the simulation self.simulation_name = "Fishnet" self.src_freq, self.src_width = 1000e9, 4000e9 # [Hz] (note: gaussian source ends at t=10/src_width) self.interesting_frequencies = (10e9, 4000e9) # Which frequencies will be saved to disk self.pml_thickness = .1*c/self.src_freq self.size_x = cellsize if yholesize == "inf" or yholesize == np.inf: self.size_y = resolution/1.8 yholesize = np.inf else: self.size_y = cellsize self.size_z = cellnumber*cellsize + 4*padding + 2*self.pml_thickness self.monitor_z1, self.monitor_z2 = (-(cellsize*cellnumber/2)-padding, (cellsize*cellnumber/2)+padding) self.cellcenters = np.arange((1-cellnumber)*cellsize/2, cellnumber*cellsize/2, cellsize) self.register_locals(locals(), other_args) ## Remember the parameters ## Define materials (with manual Lorentzian clipping) au = meep_materials.material_Au(where=self.where_fishnet) au.pol[0]['sigma'] /= 10 # adjust losses au.pol[0]['gamma'] *= 10 self.fix_material_stability(au, verbose=0) self.materials = [au] ## Test the validity of the model meep_utils.plot_eps(self.materials, plot_conductivity=True, draw_instability_area=(self.f_c(), 3*meep.use_Courant()**2), mark_freq={self.f_c():'$f_c$'}) self.test_materials()
def __init__(self, comment="", simtime=100e-15, resolution=10e-9, cellnumber=1, padding=200e-9, cellsize = 200e-9, epsilon=33.97, blend=0, **other_args): """ This structure demonstrates that scatter.py can also be used for samples on a substrate with an infinite thickness. The back side of the substrate is not simulated, and it is assumed there will be no Fabry-Perot interferences between its sides. The monitor planes are enabled to be placed also inside a dielectric. In which case the wave amplitude is adjusted so that the light intensity is maintained. The field amplitudes and phases have physical meaning only when both monitor planes are in the same medium, though. Besides, the example demonstrates that on a steep interface with air the transmitted and reflected waves have exactly the same energy with the choice of permittivity: ((1+.5**.5)/(1-.5**.5))**2, that is roughly 33.97. """ meep_utils.AbstractMeepModel.__init__(self) ## Base class initialisation ## Constant parameters for the simulation self.simulation_name = "HalfSpace" self.src_freq, self.src_width = 500e12, 100e12 # [Hz] (note: gaussian source ends at t=10/src_width) self.interesting_frequencies = (10e12, 1000e12) # Which frequencies will be saved to disk self.pml_thickness = 500e-9 self.size_x = resolution*1.8 self.size_y = resolution*1.8 self.size_z = blend + 2*padding + 2*self.pml_thickness + 6*resolution self.monitor_z1, self.monitor_z2 = (-padding, padding) self.register_locals(locals(), other_args) ## Remember the parameters self.mon2eps = epsilon ## store what dielectric is the second monitor embedded in ## Define materials self.materials = [] if 'Au' in comment: self.materials += [meep_materials.material_Au(where=self.where_m)] elif 'Ag' in comment: self.materials += [meep_materials.material_Ag(where=self.where_m)] elif 'metal' in comment: self.materials += [meep_materials.material_Au(where=self.where_m)] self.materials[-1].pol[1:] = [] self.materials[-1].pol[0]['gamma'] = 0 else: self.materials += [meep_materials.material_dielectric(where=self.where_m, eps=self.epsilon)] for m in self.materials: self.fix_material_stability(m, f_c=3e15) ## rm all osc above the first one, to optimize for speed ## Test the validity of the model meep_utils.plot_eps(self.materials, plot_conductivity=True, draw_instability_area=(self.f_c(), 3*meep.use_Courant()**2), mark_freq={self.f_c():'$f_c$'}) self.test_materials()
def __init__( self, simtime=3.5e-13, resolution=4e-9, size_x=2.25e-6, size_y=0.1e-6, size_z=8e-7, thickness_Au=1.5e-7, depthx=5e-8, depthz=1e-7, thickness_sapphire=2e-7, #1.6e-7, period=7.5e-7, Nslits=3, **other_args): meep_utils.AbstractMeepModel.__init__( self) #Inizialitation of the class # Sapphire substrate thickness taken from Kim D S, Hohng S C, Malyarchuk V, Yoon #Y C, Ahn Y H, Yee K J, Park J W, Kim J, Park Q H and Lienau C 2003 Phys. Rev. Lett. 91 143901 self.simulation_name = "SlabSubsCont3GaussSapphire" self.src_freq = 375e12 # [Hz] (note: srcwidth irrelevant for continuous_source) self.src_width = 160e12 self.interesting_frequencies = (250e12, 500e12) self.pml_thickness = 2.5e-8 self.Nslits = int(Nslits) self.size_x = size_x self.size_y = size_y self.size_z = size_z self.simtime = simtime # [s] self.monitor_z1 = (-thickness_Au - 1e-7) self.monitor_z2 = 3.9e-7 self.monitor_z3 = 1e-8 self.Kx = 0 #(2*np.pi*self.src_freq/c)*np.sin(np.pi/6)#6.8017e6 # 30 degrees self.Ky = 0 self.padding = 0 self.register_locals(locals(), other_args) ## Remember the parameters ## Define materials f_c = c / np.pi / self.resolution / meep_utils.meep.use_Courant() #self.materials = [] self.materials = [meep_materials.material_Au(where=self.where_AuGauss)] #self.materials[0].pol[1:3]=[] self.materials += [ meep_materials.material_dielectric(eps=3.133, where=self.where_sapphire) ] #self.materials += [meep_materials.material_Sapphire(where=self.where_sapphire)] for material in self.materials: self.fix_material_stability(material, f_c=2e15, verbose=1) meep_utils.plot_eps(self.materials, plot_conductivity=True, draw_instability_area=(self.f_c(), 3 * meep.use_Courant()**2), mark_freq={self.f_c(): '$f_c$'}) self.test_materials()
def __init__(self, comment="", simtime=100e-15, resolution=100e-9, size_x=16e-6, size_y=5e-6, size_z=5e-6, metalthick=.5e-6, apdisty=0e-6, apdistx=14e-6, aprad=.1e-6, monzd=123.456e-6, electronmass=1, **other_args): meep_utils.AbstractMeepModel.__init__( self) ## Base class initialisation ## Constant parameters for the simulation self.simulation_name = "PlasmonsFilm" self.src_freq = 400e12 # [Hz] (note: srcwidth irrelevant for continuous_source) #self.interesting_frequencies = (0e9, 2000e9) # Which frequencies will be saved to disk (irrelevant here) XXX self.pml_thickness = 1e-6 self.size_x = size_x self.size_y = size_y self.size_z = size_z substrate_z = size_x / 3 self.simtime = simtime # [s] self.Kx = 0 self.Ky = 0 self.padding = 0 self.register_locals(locals(), other_args) ## Remember the parameters ## Define materials f_c = c / np.pi / self.resolution / meep_utils.meep.use_Courant() self.materials = [meep_materials.material_Au(where=self.where_metal)] self.materials[0].pol[0][ 'sigma'] /= electronmass ## effective thin layer TODO test+tune+comment self.materials[0].pol[1:] = [] ## rm other osc #self.materials = [meep_materials.material_DrudeMetal(lfconductivity=1e8, f_c=.2*f_c, where = self.where_metal)] #self.materials += [meep_materials.material_dielectric(where=self.where_diel, eps=2.)] #self.TestMaterials() #self.materials += [meep_materials.material_Au(where=None)] meep_utils.plot_eps(self.materials, mark_freq=[f_c]) ## Test the validity of the model for material in self.materials: self.fix_material_stability(material, f_c=2e15, verbose=1) meep_utils.plot_eps(self.materials, plot_conductivity=True, draw_instability_area=(self.f_c(), 3 * meep.use_Courant()**2), mark_freq={self.f_c(): '$f_c$'}) self.test_materials()
def __init__(self, comment="", simtime=50e-15, resolution=3e-9, cells=1, monzc=0e-9, Kx=0, Ky=0, padding=25e-9, thick=4e-9, width=4e-9, xspacing=50e-9, monzd=100e-9): meep_utils.AbstractMeepModel.__init__( self) ## Base class initialisation self.simulation_name = "XCylWire" ## self.register_locals(locals()) ## Remember the parameters ## Initialization of materials used if 'Diel' in comment: self.materials = [ meep_materials.material_dielectric(where=self.where_wire, eps=20, loss=0.001) ] else: self.materials = [ meep_materials.material_Au(where=self.where_wire) ] ## Dimension constants for the simulation #self.size_x, self.size_y, self.size_z = xyspacing, xyspacing, 400e-6+cells*self.monzd self.pml_thickness = 10e-9 self.size_x = xspacing self.size_y = resolution / 1.8 self.size_z = 100e-9 + cells * self.monzd + 2 * self.padding + 2 * self.pml_thickness ## constants for the simulation (self.monitor_z1, self.monitor_z2) = (-(monzd * cells) / 2 + monzc - padding, (monzd * cells) / 2 + monzc + padding) self.simtime = simtime # [s] self.srcWidth = 3000e12 self.srcFreq = 4e12 + self.srcWidth / 2 + (Ky**2 + Kx**2)**.5 / ( 2 * np.pi / 3e8) ## cutoff for oblique incidence self.interesting_frequencies = (0., 1000e12) #meep_utils.plot_eps(self.materials) self.TestMaterials( ) ## catches (most) errors in structure syntax, before they crash the callback
def __init__(self, comment="", simtime=30e-12, resolution=4e-6, cellsize=100e-6, cellnumber=1, padding=50e-6, radius=30e-6, wirethick=0, wirecut=0, loss=1, epsilon="TiO2", diel=1, **other_args): meep_utils.AbstractMeepModel.__init__(self) ## Base class initialisation ## Constant parameters for the simulation self.simulation_name = "SphereWire" self.src_freq, self.src_width = 1000e9, 4000e9 # [Hz] (note: gaussian source ends at t=10/src_width) self.interesting_frequencies = (10e9, 3000e9) # Which frequencies will be saved to disk self.pml_thickness = .1*c/self.src_freq self.size_x = cellsize if (radius>0 or wirecut>0) else resolution/1.8 self.size_y = cellsize self.size_z = cellnumber*cellsize + 4*padding + 2*self.pml_thickness self.monitor_z1, self.monitor_z2 = (-(cellsize*cellnumber/2)-padding, (cellsize*cellnumber/2)+padding) self.cellcenters = np.arange((1-cellnumber)*cellsize/2, cellnumber*cellsize/2, cellsize) self.register_locals(locals(), other_args) ## Remember the parameters ## Define materials (with manual Lorentzian clipping) self.materials = [] if radius > 0: if epsilon=="TiO2": ## use titanium dioxide if permittivity not specified... tio2 = meep_materials.material_TiO2(where=self.where_sphere) if loss != 1: tio2.pol[0]['gamma'] *= loss ## optionally modify the first TiO2 optical phonon to have lower damping else: ## ...or define a custom dielectric if permittivity not specified tio2 = meep_materials.material_dielectric(where=self.where_sphere, eps=float(self.epsilon)) self.fix_material_stability(tio2, verbose=0) ##f_c=2e13, rm all osc above the first one, to optimize for speed self.materials.append(tio2) self.materials.append(meep_materials.material_dielectric(where=self.where_diel, eps=self.diel)) if wirethick > 0: au = meep_materials.material_Au(where=self.where_wire) #au.pol[0]['sigma'] /= 100 #au.pol[0]['gamma'] *= 10000 self.fix_material_stability(au, verbose=0) self.materials.append(au) ## Test the validity of the model meep_utils.plot_eps(self.materials, plot_conductivity=True, draw_instability_area=(self.f_c(), 3*meep.use_Courant()**2), mark_freq={self.f_c():'$f_c$'}) self.test_materials()
def __init__(self, comment="", simtime=30e-12, resolution=4e-6, cellsize=50e-6, cellsizey=30e-6, cellnumber=1, padding=50e-6, wirewidth=6.5e-6, wirelength=29e-6, loss=1, epsilon="Si", **other_args): meep_utils.AbstractMeepModel.__init__(self) ## Base class initialisation ## Constant parameters for the simulation self.simulation_name = "WiresOnSiWire" self.src_freq, self.src_width = 1000e9, 4000e9 # [Hz] (note: gaussian source ends at t=10/src_width) self.interesting_frequencies = (10e9, 3000e9) # Which frequencies will be saved to disk self.pml_thickness = .3*c/self.src_freq self.size_x = cellsize self.size_y = cellsizey self.size_z = cellsize + 4*padding + 2*self.pml_thickness self.monitor_z1, self.monitor_z2 = (-(cellsize*cellnumber/2)-padding, (cellsize*cellnumber/2)+padding) self.register_locals(locals(), other_args) ## Remember the parameters ## Define materials (with manual Lorentzian clipping) self.materials = [] if epsilon=="Si": ## use silicon if permittivity not specified... si = meep_materials.material_Si_MIR(where=self.where_substr) if loss != 1: si.pol[0]['gamma'] *= loss ## optionally modify the first TiO2 optical phonon to have lower damping else: ## ...or define a custom dielectric if permittivity not specified si = meep_materials.material_dielectric(where=self.where_substr, eps=float(self.epsilon)) self.fix_material_stability(si, verbose=0) ## rm all osc above the first one, to optimize for speed self.mon2eps = meep_utils.analytic_eps(mat=si, freq=1e12) ## store what dielectric is the second monitor embedded in print '>>>>>>>>>>>>>>>>>>>>>>>>> self.mon2eps',self.mon2eps #self.mon2eps = 12 ## store what dielectric is the second monitor embedded in self.materials.append(si) au = meep_materials.material_Au(where=self.where_wire) #au.pol[0]['sigma'] /= 100 #au.pol[0]['gamma'] *= 10000 self.fix_material_stability(au, verbose=0) self.materials.append(au) ## Test the validity of the model meep_utils.plot_eps(self.materials, plot_conductivity=True, draw_instability_area=(self.f_c(), 3*meep.use_Courant()**2), mark_freq={self.f_c():'$f_c$'}) self.test_materials()
def __init__(self, comment="", simtime=30e-9, resolution=5e-3, cellnumber=1, padding=9e-3, radius=33.774e-3, height=122.36e-3, Kx=0, Ky=0, **other_args): meep_utils.AbstractMeepModel.__init__( self) ## Base class initialisation self.simulation_name = "HollowCyl" self.register_locals(locals(), other_args) ## Remember the parameters ## Obligatory parameters (used in the simulation) self.pml_thickness = padding / 2 self.simtime = simtime # [s]HollowCyl_simtime=3.000e-08_height=3.000e-02 self.src_freq, self.src_width = 3e9, 10e9 # [Hz] (note: gaussian source ends at t=10/src_width) self.interesting_frequencies = ( .1e9, 8e9) # Which frequencies will be saved to disk self.size_x = 2 * radius + padding * 2 self.size_y = 2 * radius + padding * 2 self.size_z = height + padding * 2 ## Define materials f_c = c / np.pi / self.resolution / meep_utils.meep.use_Courant() self.materials = [] au = meep_materials.material_Au(where=self.where_metal) self.fix_material_stability(au, verbose=0) self.materials.append(au) #self.materials += [meep_materials.material_DrudeMetal(lfconductivity=1e4, f_c=f_c, gamma_factor=.5, epsplus=0, where=self.where_metal)] meep_utils.plot_eps(self.materials, plot_conductivity=True, draw_instability_area=(self.f_c(), 3 * meep.use_Courant()**2), mark_freq={self.f_c(): '$f_c$'}) self.test_materials()
def __init__(self, simtime=3.5e-13, resolution =4e-9,size_x = 2.25e-6, size_y = 0.1e-6, size_z = 8e-7, thickness_Au = 1.5e-7,depthx = 5e-8, depthz = 1e-7, thickness_sapphire = 2e-7, #1.6e-7, period =7.5e-7, Nslits =3, **other_args): meep_utils.AbstractMeepModel.__init__(self) #Inizialitation of the class # Sapphire substrate thickness taken from Kim D S, Hohng S C, Malyarchuk V, Yoon #Y C, Ahn Y H, Yee K J, Park J W, Kim J, Park Q H and Lienau C 2003 Phys. Rev. Lett. 91 143901 self.simulation_name = "SlabAuSubsCont3Gauss" self.src_freq = 375e12 # [Hz] (note: srcwidth irrelevant for continuous_source) self.src_width= 160e12 self.interesting_frequencies=(250e12,500e12) self.pml_thickness = 2.5e-8 self.Nslits = int(Nslits) self.size_x = size_x self.size_y = size_y self.size_z = size_z self.simtime = simtime # [s] self.monitor_z1 = (-thickness_Au - 1e-7) self.monitor_z2 =3.9e-7 self.monitor_z3 = 1e-8 self.Kx = 0#(2*np.pi*self.src_freq/c)*np.sin(np.pi/6)#6.8017e6 # 30 degrees self.Ky = 0 self.padding=0 self.register_locals(locals(), other_args) ## Remember the parameters ## Define materials f_c = c / np.pi/self.resolution/meep_utils.meep.use_Courant() #self.materials = [] self.materials = [meep_materials.material_Au(where=self.where_AuGauss)] #self.materials[0].pol[1:3]=[] #self.materials += [meep_materials.material_dielectric(eps=4.0, where=self.where_sapphire)]#(eps=3.133,where=self.where_sapphire)] #self.materials += [meep_materials.material_Sapphire(where=self.where_sapphire)] for material in self.materials: self.fix_material_stability(material, f_c=2e15, verbose=1) meep_utils.plot_eps(self.materials, plot_conductivity=True, draw_instability_area=(self.f_c(), 3*meep.use_Courant()**2), mark_freq={self.f_c():'$f_c$'}) self.test_materials()
def __init__(self, comment="", simtime=25e-15, resolution=.5e-9, cellsize=5e-9, cellsizex=10e-9, cellsizey=0, cellnumber=1, padding=1e-9, radius=3.1e-9, gap=0, **other_args): meep_utils.AbstractMeepModel.__init__(self) ## Base class initialisation ## Constant parameters for the simulation self.simulation_name = "PlasmonicDimers" self.src_freq, self.src_width = 1000e12, 4000e12 # Hz] (note: gaussian source ends at t=10/src_width) self.interesting_frequencies = (1e12, 1.5e15) # Which frequencies will be saved to disk self.pml_thickness = .01*c/self.src_freq ## changing from 10x larger value caused less than 1e-4 change in transmittance print("self.pml_thickness", self.pml_thickness) self.size_x = cellsizex self.size_y = cellsizey if cellsizey else resolution/1.8 ## if zero thickness in y, simulate cylinders self.size_z = cellnumber*cellsize + 4*padding + 2*self.pml_thickness self.monitor_z1, self.monitor_z2 = (-(cellsize*cellnumber/2)-padding, (cellsize*cellnumber/2)+padding) self.cellcenters = np.arange((1-cellnumber)*cellsize/2, cellnumber*cellsize/2, cellsize) self.register_locals(locals(), other_args) ## Remember the parameters self.gap = gap if gap else resolution/1.8 ## adjust the gap to be single voxel TODO self.singlesphere = ('singlesphere' in self.comment) ## Define materials (with manual Lorentzian clipping) au = meep_materials.material_Au(where=self.where_metal) #au.pol[0]['sigma'] /= 1000 # adjust losses #au.pol[0]['gamma'] *= .1 if 'nolorentz' in comment.lower(): au.pol = au.pol[:1] ## optionally, remove all Lorentzian oscillators au.pol = au.pol[:5] ## remove the last oscillator - maximum number is 5 as given by python-meep self.fix_material_stability(au, verbose=0) self.materials = [au] ## Test the validity of the model meep_utils.plot_eps(self.materials, plot_conductivity=True, draw_instability_area=(self.f_c(), 3*meep.use_Courant()**2), mark_freq={self.f_c():'$f_c$'}) self.test_materials()
def __init__(self, comment="", simtime=100e-15, resolution=10e-9, cellnumber=1, padding=200e-9, cellsize=200e-9, epsilon=33.97, blend=0, **other_args): """ This structure demonstrates that scatter.py can also be used for samples on a substrate with an infinite thickness. The back side of the substrate is not simulated, and it is assumed there will be no Fabry-Perot interferences between its sides. The monitor planes are enabled to be placed also inside a dielectric. In which case the wave amplitude is adjusted so that the light intensity is maintained. The field amplitudes and phases have physical meaning only when both monitor planes are in the same medium, though. Besides, the example demonstrates that on a steep interface with air the transmitted and reflected waves have exactly the same energy with the choice of permittivity: ((1+.5**.5)/(1-.5**.5))**2, that is roughly 33.97. """ meep_utils.AbstractMeepModel.__init__( self) ## Base class initialisation ## Constant parameters for the simulation self.simulation_name = "HalfSpace" self.src_freq, self.src_width = 500e12, 100e12 # [Hz] (note: gaussian source ends at t=10/src_width) self.interesting_frequencies = ( 10e12, 1000e12) # Which frequencies will be saved to disk self.pml_thickness = 500e-9 self.size_x = resolution * 1.8 self.size_y = resolution * 1.8 self.size_z = blend + 2 * padding + 2 * self.pml_thickness + 6 * resolution self.monitor_z1, self.monitor_z2 = (-padding, padding) self.register_locals(locals(), other_args) ## Remember the parameters self.mon2eps = epsilon ## store what dielectric is the second monitor embedded in ## Define materials self.materials = [] if 'Au' in comment: self.materials += [meep_materials.material_Au(where=self.where_m)] elif 'Ag' in comment: self.materials += [meep_materials.material_Ag(where=self.where_m)] elif 'metal' in comment: self.materials += [meep_materials.material_Au(where=self.where_m)] self.materials[-1].pol[1:] = [] self.materials[-1].pol[0]['gamma'] = 0 else: self.materials += [ meep_materials.material_dielectric(where=self.where_m, eps=self.epsilon) ] for m in self.materials: self.fix_material_stability( m, f_c=3e15 ) ## rm all osc above the first one, to optimize for speed ## Test the validity of the model meep_utils.plot_eps(self.materials, plot_conductivity=True, draw_instability_area=(self.f_c(), 3 * meep.use_Courant()**2), mark_freq={self.f_c(): '$f_c$'}) self.test_materials()