def simple_mesh(meshname='default_mesh', region='default_region', material='Si', top='top', bottom='bottom', thickness=10, spacing=0.1): """ Creates a simple 1D mesh made of Si with metal contacts :param meshname: :param region: :param material: :param top: :param bottom: :param thickness: in nm, specify the thickness of the resistor :param spacing: :return: """ thickness = thickness * 1E-4 spacing = spacing * 1E-4 # convert nm to cm ds.create_1d_mesh(mesh=meshname) ds.add_1d_mesh_line(mesh=meshname, pos=0, ps=spacing, tag=top) ds.add_1d_mesh_line(mesh=meshname, pos=thickness, ps=spacing, tag=bottom) ds.add_1d_region(mesh=meshname, tag1=top, tag2=bottom, region=region, material=material) ds.add_1d_contact(material='metal', mesh=meshname, name=f"{top}_contact", tag=top) ds.add_1d_contact(material='metal', mesh=meshname, name=f"{bottom}_contact", tag=bottom) ds.finalize_mesh(mesh=meshname) return meshname, region, top, bottom
def add_contact(self, name, tag, material): """ Add a contact to this mesh name: a name for this contact tag: a tag for ...? material: The material for the contact ...??? """ add_1d_contact(mesh=self.name, name=name, tag=tag, material=str(material)) self.contacts.append(name)
def CreateMesh2(device, region): create_1d_mesh(mesh="dio") add_1d_mesh_line(mesh="dio", pos=0, ps=1e-7, tag="top") add_1d_mesh_line(mesh="dio", pos=0.5e-5, ps=1e-8, tag="mid") add_1d_mesh_line(mesh="dio", pos=1e-5, ps=1e-7, tag="bot") add_1d_contact(mesh="dio", name="top", tag="top", material="metal") add_1d_contact(mesh="dio", name="bot", tag="bot", material="metal") add_1d_region(mesh="dio", material="Si", region=region, tag1="top", tag2="bot") finalize_mesh(mesh="dio") create_device(mesh="dio", device=device)
def p_n_junction(meshname='default_mesh', region1='p_region', region2='n_region', material1='CdS', material2='CdTe', thickness1=0.2, thickness2=2, spacing=0.05, top='top', interface='interface', bottom='bottom'): thickness1 = thickness1 * 1E-4 thickness2 = thickness2 * 1E-4 spacing = spacing * 1E-4 # convert nm to cm ds.create_1d_mesh(mesh=meshname) ds.add_1d_mesh_line(mesh=meshname, pos=0, ps=spacing/10, tag=top) ds.add_1d_mesh_line(mesh=meshname, pos=thickness1, ps=spacing/50, tag=interface) ds.add_1d_region(mesh=meshname, tag1=top, tag2=interface, region=region1, material='Si') ds.add_1d_mesh_line(mesh=meshname, pos=thickness1+thickness2, ps=spacing, tag=bottom) ds.add_1d_region(mesh=meshname, tag1=interface, tag2=bottom, region=region2, material='InAs') ds.add_1d_contact(material='metal', mesh=meshname, name=f"{top}_contact", tag=top) ds.add_1d_contact(material='metal', mesh=meshname, name=f"{bottom}_contact", tag=bottom) ds.add_1d_interface(mesh=meshname, tag=interface, name=interface) ds.finalize_mesh(mesh=meshname) return meshname
def CreateMesh(device, region, meshname='diode'): ''' Meshing ''' create_1d_mesh(mesh=meshname) add_1d_mesh_line(mesh=meshname, pos=0, ps=1e-7, tag="top") add_1d_mesh_line(mesh=meshname, pos=0.5e-5, ps=1e-9, tag="mid") add_1d_mesh_line(mesh=meshname, pos=1e-5, ps=1e-7, tag="bot") add_1d_contact(mesh=meshname, name="top", tag="top", material="metal") add_1d_contact(mesh=meshname, name="bot", tag="bot", material="metal") add_1d_region(mesh=meshname, material="Si", region=region, tag1="top", tag2="bot") finalize_mesh(mesh=meshname) create_device(mesh=meshname, device=device)
# n1 top_tag = f"top_{CdS_region}" interface_tag = f"bot_{CdS_region}" bottom_tag = f"bot_{CdTe_region}" ds.add_1d_mesh_line(mesh=meshname, pos=0, ps=spacing, tag=top_tag) # add_1d_mesh_line(mesh=meshname, pos=n1_thick/2, ps=spacing, tag="mid_n1") ds.add_1d_mesh_line(mesh=meshname, pos=CdS_thickness, ps=spacing, tag=interface_tag) ds.add_1d_region(mesh=meshname, material="CdS", region=CdS_region, tag1=top_tag, tag2=interface_tag) ds.add_1d_contact(mesh=meshname, name=top_tag, tag=top_tag, material="metal") # b # add_1d_mesh_line(mesh=meshname, pos=n1_thick, ps=spacing, tag="top_b") ds.add_1d_mesh_line(mesh=meshname, pos=CdS_thickness + CdTe_thickness, ps=spacing, tag=bottom_tag) ds.add_1d_region(mesh=meshname, material="CdTe", region=CdTe_region, tag1=interface_tag, tag2=bottom_tag) ds.add_1d_interface(mesh=meshname, tag=interface_tag, name=f"{CdS_region}_to_{CdTe_region}_interface") ds.add_1d_contact(material='metal',
else: CreateSiliconDriftDiffusionAtContact(device, region, i) #---- Start ---- device = "MyDevice" region = "MyRegion" # Make a mesh for this device and region # CreateMesh(device=device, region=region) meshname = 'diode' create_1d_mesh(mesh=meshname) add_1d_mesh_line(mesh=meshname, pos=0, ps=1e-7, tag="top") add_1d_mesh_line(mesh=meshname, pos=0.5e-5, ps=1e-9, tag="mid") add_1d_mesh_line(mesh=meshname, pos=1e-5, ps=1e-7, tag="bot") add_1d_contact(mesh=meshname, name="top", tag="top", material="metal") add_1d_contact(mesh=meshname, name="bot", tag="bot", material="metal") add_1d_region(mesh=meshname, material="Si", region=region, tag1="top", tag2="bot") finalize_mesh(mesh=meshname) create_device(mesh=meshname, device=device) SetSiliconParameters(device, region, 300) set_parameter(device=device, region=region, name="taun", value=1e-8) set_parameter(device=device, region=region, name="taup", value=1e-8) # SetNetDoping(device=device, region=region) CreateNodeModel(device, region, "Acceptors", "1.0e18*step(0.5e-5-x)") CreateNodeModel(device, region, "Donors", "1.0e18*step(x-0.5e-5)")
def __init__(self, regions, mesh=Mesh1D(), interfaces=None, contacts=None, environment=Environment(), R_series=0, **kwargs): """ Creates a 1D device This constructor is responsbile for: Creating the mesh * Adding the meshlines from the Region objects inside of regions * Adding interfaces between the Regions * Upading the Region objects interfaces as needed * Creating the contacts as specified by giving a list of two Regions :param regions: List of Region objects which create this 1D device. Order matters and is from top to bottom :param interfaces: List of interfaces for this device. Does not include top and bottom contacts. Should be N-1 regions, default is no special interfaces at all :param contacts: List of Tag name of the contacts for this device. Default is one at top and one at bottom :param environment: Local environment of the measurement. Default is 25C, no B field, 50% humidity, STP :param kwargs: Other kwargs for base class """ super().__init__(regions, **kwargs) self.mesh = mesh if interfaces is None: interfaces = [None for _ in regions] interfaces.pop( ) # Should be 1 less interface than the number of materials. self.interfaces = interfaces if contacts is None: contacts = self.regions[0].mesh_data[0]['tag'], self.regions[ -1].mesh_data[-1]['tag'] self.contacts = contacts self.environment = environment # Setup our regions for region in regions: logger.debug( f"Now adding region {region.name} to the new mesh for this device" ) for mesh_info in region.mesh_data: self.mesh.add_line(**mesh_info) logger.info(f"Added mesh: {mesh_info['tag']}") add_1d_region(mesh=self.mesh.name, material=region.material.name, region=region.name, tag1=region.mesh_data[0]['tag'], tag2=region.mesh_data[-1]['tag']) for contact in contacts: logger.debug(f"Adding 1D contacts for {contact}") add_1d_contact(mesh=self.mesh.name, name=contact, tag=contact, material='metal') # TODO support contacts not ideal metals! Maybe make Contact an object? thats silly perhaps. Dict? self.mesh.finalize() logger.info( f"Creating device {self.name} associated with mesh {self.mesh.name}" ) create_device(mesh=self.mesh.name, device=self.name) self.setup_drift_diffusion()
b_band_gap = 1.636 # eV # Devsim requires you create the entire mesh first include interfaces before specifying regions # Create mesh ds.create_1d_mesh(mesh=meshname) # n1 ds.add_1d_mesh_line(mesh=meshname, pos=0, ps=spacing, tag="top_n1") # add_1d_mesh_line(mesh=meshname, pos=n1_thick/2, ps=spacing, tag="mid_n1") ds.add_1d_mesh_line(mesh=meshname, pos=n1_thick, ps=spacing, tag="bot_n1") ds.add_1d_region(mesh=meshname, material="InAs", region=n1_region, tag1="top_n1", tag2="bot_n1") ds.add_1d_contact(mesh=meshname, name="top_n1", tag="top_n1", material="metal") # b # add_1d_mesh_line(mesh=meshname, pos=n1_thick, ps=spacing, tag="top_b") ds.add_1d_mesh_line(mesh=meshname, pos=n1_thick + (b_thick / 2), ps=spacing, tag="mid_b") ds.add_1d_mesh_line(mesh=meshname, pos=n1_thick + b_thick, ps=spacing, tag="bot_b") ds.add_1d_region(mesh=meshname, material="InAs", region=b_region, tag1="bot_n1", tag2="bot_b")