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 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)
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) # for region in regions: # DriftDiffusionInitialSolution(device, region)
def __init__(self, name=None, mesh=None): self.name = name or 'device-%s' % str(uuid.uuid4())[:8] self.mesh = mesh create_device(mesh=self.mesh.name, device=self.name) self._models = []
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()