def get_ds_status(): devices = ds.get_device_list() for device in devices: print("Device: " + device) regions = ds.get_region_list(device=device) for region in regions: print("\tRegion :" + region) params = ds.get_parameter_list(device=device, region=region) for param in params: val = ds.get_parameter(device=device, region=region, name=param) print(f"\t\t{param} = {val}") n_models = ds.get_node_model_list(device=device, region=region) for node_model in n_models: nmvals = ds.get_node_model_values(device=device, region=region, name=node_model) print(f"\t\t Node Model '{node_model}' = {nmvals!s}") e_models = ds.get_edge_model_list(device=device, region=region) for edge_model in e_models: emvals = ds.get_edge_model_values(device=device, region=region, name=edge_model) print(f"\t\t Edge Model '{edge_model}' = {emvals!s}") contacts = ds.get_contact_list(device=device) for contact in contacts: print("\tContact : " + contact) c_eqs = ds.get_contact_equation_list(device=device, contact=contact) for ceq in c_eqs: print("\t\tContact Equation : " + ceq)
def create_electron_current(device, region, mu_n): """ Sets up the electron current :param device: :param region: :param mu_n: mobility :return: """ ensure_edge_from_node_model_exists(device, region, "Potential") ensure_edge_from_node_model_exists(device, region, "Electrons") ensure_edge_from_node_model_exists(device, region, "Holes") # Make sure the bernoulli functions exist if "Bern01" not in get_edge_model_list(device=device, region=region): create_bernoulli(device, region) # test for requisite models here # Jn = "ElectronCharge*{0}*EdgeInverseLength*V_t*(Electrons@n1*Bern10 - Electrons@n0*Bern01)".format(mu_n) Jn = "ElectronCharge*{0}*EdgeInverseLength*V_t*kahan3(Electrons@n1*Bern01, Electrons@n1*vdiff, -Electrons@n0*Bern01)".format( mu_n) # Jn = "ElectronCharge*{0}*EdgeInverseLength*V_t*((Electrons@n1-Electrons@n0)*Bern01 + Electrons@n1*vdiff)".format(mu_n) edge_model(device=device, region=region, name="ElectronCurrent", equation=Jn) for i in ("Electrons", "Potential", "Holes"): create_edge_model_derivatives(device, region, "ElectronCurrent", Jn, i)
def get_ds_status(short=True): """ Prints the status of the current devsim setup and all variables, solutions, node models and edge models :return: """ for device in ds.get_device_list(): print("Device: " + device) for region in ds.get_region_list(device=device): print("\tRegion :" + region) params = ds.get_parameter_list(device=device, region=region) for param in params: val = ds.get_parameter(device=device, region=region, name=param) print(f"\t\t{param} = {val}") for node_model in ds.get_node_model_list(device=device, region=region): nmvals = ds.get_node_model_values(device=device, region=region, name=node_model) nmstr = ','.join([f'{val:.3g}' for val in nmvals]) print(f"\t\tNode Model '{node_model}' = {nmstr!s}") e_models = ds.get_edge_model_list(device=device, region=region) for edge_model in e_models: emvals = ds.get_edge_model_values(device=device, region=region, name=edge_model) emstr = ','.join([f'{val:.3g}' for val in emvals]) print(f"\t\tEdge Model '{edge_model}' = {emstr}") for interface in ds.get_interface_list(device=device): print("\tInterface: " + interface) for imodel in ds.get_interface_model_list(device=device, interface=interface): intstr = ','.join([ f'{val:.3g}' for val in ds.get_interface_model_values( device=device, interface=interface, name=imodel) ]) print(f"\t\tInterface Model: '{imodel}' = {intstr}") for ieq in ds.get_interface_equation_list(device=device, interface=interface): # comm = ds.get_interface_equation_command(device=device, interface=interface, name=ieq) print(f"\t\tInterface Equation: {ieq}") contacts = ds.get_contact_list(device=device) for contact in contacts: print("\tContact : " + contact) c_eqs = ds.get_contact_equation_list(device=device, contact=contact) for ceq in c_eqs: print("\t\tContact Equation : " + ceq)
def create_hole_current(device, region, mu_p): """ Hole current """ ensure_edge_from_node_model_exists(device, region, "Potential") ensure_edge_from_node_model_exists(device, region, "Holes") # Make sure the bernoulli functions exist if "Bern01" not in get_edge_model_list(device=device, region=region): create_bernoulli(device, region) # test for requisite models here # Jp ="-ElectronCharge*{0}*EdgeInverseLength*V_t*(Holes@n1*Bern01 - Holes@n0*Bern10)".format(mu_p) Jp = "-ElectronCharge*{0}*EdgeInverseLength*V_t*kahan3(Holes@n1*Bern01, -Holes@n0*Bern01, -Holes@n0*vdiff)".format( mu_p) # Jp ="-ElectronCharge*{0}*EdgeInverseLength*V_t*((Holes@n1 - Holes@n0)*Bern01 - Holes@n0*vdiff)".format(mu_p) edge_model(device=device, region=region, name="HoleCurrent", equation=Jp) for i in ("Holes", "Potential", "Electrons"): create_edge_model_derivatives(device, region, "HoleCurrent", Jp, i)
def CreateSiliconPotentialOnlyContact(device, region, contact, is_circuit=False): """ Creates the potential equation at the contact if is_circuit is true, than use node given by GetContactBiasName """ # Means of determining contact charge # Same for all contacts if "contactcharge_node" not in get_node_model_list(device=device, region=region): create_node_model(device, region, "contactcharge_node", "ElectronCharge*IntrinsicCharge") # TODO: This is the same as D-Field if "contactcharge_edge" not in get_edge_model_list(device=device, region=region): CreateEdgeModel(device, region, "contactcharge_edge", "Permittivity*ElectricField") create_edge_model_derivatives(device, region, "contactcharge_edge", "Permittivity*ElectricField", "Potential")
def InEdgeModelList(device, region, model): """ Checks to see if this edge model is available on device and region """ return model in get_edge_model_list(device=device, region=region)