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 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 plot_current(device=None, regions=None, current_names=None, title='Current Density'): if device is None: device = ds.get_device_list()[0] if regions is None: regions = ds.get_region_list(device=device) if current_names is None: current_names = ('Jn', 'Jp') plt.figure() for var_name in current_names: total_x = np.array([]) total_y = [] for region in regions: ds.edge_average_model(device=device, region=region, node_model="x", edge_model="xmid") x = np.array(ds.get_edge_model_values(device=device, region=region, name="xmid")) # print(var_name, min(x), max(x), min(x)*1e4, max(x)*1e4) total_x = np.append(total_x, x) y=ds.get_edge_model_values(device=device, region=region, name=var_name) total_y.extend(y) # plt.axis([min(x), max(x), ymin, ymax]) plt.plot(np.array(total_x)*1e4, total_y) plt.xlabel('x (um)') plt.ylabel('Current (A/cm^2)') plt.legend(current_names) plt.title(title)
if (max(node_m_vals) > ymax): ymax = max(node_m_vals) plt.semilogy(x, node_m_vals) plt.xlabel('x (cm)') plt.ylabel('Density (#/cm^3)') plt.legend(fields) ymax *= 10 plt.axis([min(x), max(x), ymin, ymax]) plt.savefig("diode_1d_density.png") plt.clf() edge_average_model(device=device, region=region, node_model="x", edge_model="xmid") xmid = get_edge_model_values(device=device, region=region, name="xmid") efields = ( "ElectronCurrent", "HoleCurrent", ) node_m_vals = get_edge_model_values(device=device, region=region, name="ElectronCurrent") ymin = min(node_m_vals) ymax = max(node_m_vals) for i in efields: node_m_vals = get_edge_model_values(device=device, region=region, name=i) if min(node_m_vals) < ymin: ymin = min(node_m_vals) elif max(node_m_vals) > ymax: ymax = max(node_m_vals)
ds.create_device(mesh=meshname, device=device) setup_physical_constants(device, region) setup_poisson_parameters(device, region, p_doping=1e18) setup_poisson(device, region) get_ds_status() ds.solve(type="dc", absolute_error=10, relative_error=10, maximum_iterations=30) get_ds_status() print("Post solve") setup_continuity(device, region) ds.solve(type="dc", absolute_error=10, relative_error=1e1, maximum_iterations=30) for volt in [-1, 0, 1]: ds.set_parameter(device=device, name='top_contact_bias', value=float(volt)) chrg = ds.get_node_model_values(device=device, region=region, name=total_charge) pot = ds.get_edge_model_values(device=device, region=region, name=e_field) for data in [chrg, pot]: plt.figure() plt.plot(data) plt.show() # Ei = (Ec + Ev) / 2