def finalize(self): """ Last step before simulation. If you use this with a Device, it will call this for you. """ logger.info(f"Finalizing mesh for {self.name}") finalize_mesh(mesh=self.name)
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 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)
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', mesh=meshname, tag=bottom_tag, name=bottom_tag) ds.finalize_mesh(mesh=meshname) ds.create_device(mesh=meshname, device=device) # Add some physics for region, params in zip(regions, [CdS_params, CdTe_params]): for name, value in params.items(): ds.set_parameter(device=device, region=region, name=name, value=value) set_dd_parameters(device=device, region=region) # Initial DC solution ds.solve(type="dc", absolute_error=1.0e10, relative_error=1e10, maximum_iterations=150)
# 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)") CreateNodeModel(device, region, "NetDoping", "Donors-Acceptors") print_node_values(device=device, region=region, name="NetDoping") # InitialSolution(device, region) circuit_contacts = None # Create Potential, Potential@n0, Potential@n1