python-meep-utils icon indicating copy to clipboard operation
python-meep-utils copied to clipboard

Missing model_simple_structures

Open jonpry opened this issue 9 years ago • 3 comments

I am trying to run TM_Wedge2d example but this source file is missing.

jonpry avatar Aug 30 '15 21:08 jonpry

Dear Jonpry, this is a result of some older changes in the codes. Thanks, I will try to fix that.

FilipDominec avatar Sep 14 '15 08:09 FilipDominec

The script below might be helpful, I archived it from the old repo.

class Wedge_model(meep_utils.AbstractMeepModel): #{{{
    """  Array of circular metallic wires along electric field
    FD 2013-07-13
    """
    def cell_centers(self):
        """ Helper function for stacked multilayered metamaterials """
        return np.arange(-self.monzd*(self.cells-1)/2, self.monzd*(self.cells-1)/2+1e-12, self.monzd)
        ## alternatively: add surrounding two cells to compare the propagation _inside_ a metamaterial
        #return np.arange(-self.monzd*(self.cells+1)/2, self.monzd*(self.cells+1)/2+1e-12, self.monzd)
    def __init__(self, comment="TiO2", simtime=10e-12, resolution=3e-6, cells=1, monzc=0e-6, Kx=0, Ky=0, padding=50e-6,
            radius=10e-6, yspacing=100e-6, zspacing=100e-6, monzd=200e-6, epsilon=100):
        meep_utils.AbstractMeepModel.__init__(self)        ## Base class initialisation
        self.simulation_name = "Wedge"    ## 
        self.register_locals(locals())          ## Remember the parameters

        ## Initialization of materials used
        if 'TiO2' in comment:
            self.materials = [meep_materials.material_TiO2_THz(where = self.where_wire)]
        elif 'STO' in comment:
            self.materials = [meep_materials.material_STO_THz(where = self.where_wire)]
        elif 'DielLossless' in comment:
            self.materials = [meep_materials.material_dielectric(where = self.where_wire, eps=epsilon, loss=0.0)]
        elif 'DielLoLoss' in comment:
            self.materials = [meep_materials.material_dielectric(where = self.where_wire, eps=epsilon, loss=0.005)]
        elif 'Diel' in comment:
            self.materials = [meep_materials.material_dielectric(where = self.where_wire, eps=epsilon, loss=0.05)]
        else:
            self.materials = [meep_materials.material_Metal_THz(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 = 20e-6
        self.size_x = resolution/1.8
        self.size_y = 2200e-6
        self.size_z = 2000e-6+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 = 3000e9     
        self.srcFreq = 4e9 + self.srcWidth/2 + (Ky**2+Kx**2)**.5 / (2*np.pi/3e8)  ## cutoff for oblique incidence
        self.interesting_frequencies = (0., 2000e9) 

        #meep_utils.plot_eps(self.materials, freq_range=(1e10, 1e14), plot_conductivity=True)
        self.TestMaterials() ## catches (most) errors in structure syntax, before they crash the callback

    def where_wire(self, r):
        y,z = r.y(), r.z()
        if z < self.size_z*(-.3) or z+y/2>0: 
            return 0
        yy,zz = np.arccos(np.cos(y/self.yspacing*np.pi*2))*self.yspacing/(np.pi*2), np.arccos(np.cos(z/self.zspacing*np.pi*2))*self.zspacing/(np.pi*2)
        if (yy**2+zz**2)**.5 < self.radius:
            return self.return_value
        return 0

doanguyen avatar Sep 17 '15 09:09 doanguyen

In fact, you can retrieve any form of the script from the project history by browsing my old commits and using git checkout.

The purpose of removing it is not to conceal anything from you, but to maintain some minimum standard of quality of published software. If I recall correctly, the script did not work as I expected. It is on my to-do list to fix it.

FilipDominec avatar Sep 17 '15 20:09 FilipDominec