コード例 #1
0
    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]
コード例 #2
0
    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]
コード例 #3
0
    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()
コード例 #4
0
    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()
コード例 #5
0
    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()
コード例 #6
0
    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()