Tutorial

pn-diode example

Now that you’ve installed Simudo, you can perform the most basic of simulations. Namely, getting a J(V) curve for a diode (pn-junction).

Download the pn-diode example, then run:

python3 pn_diode.py run

This will run the simulation, a voltage sweep from 0V to 1V. It should take 2-4 minutes, and it will produce a series of files containing spatial data (e.g., output V_stepper parameter=0.00000 csvplot.csv.0), and a CSV file containing summary data (output V_stepper meta.csv).

You can produce a plot of total current as a function of applied voltage:

../_images/tutorial-pn-diode-JV.svg

using the following code:

import pandas as pd
import matplotlib
from matplotlib import pyplot as plt

df = pd.read_csv("output V_stepper meta.csv", skiprows=[1])
df['V'] = df['parameter_value']
df['J'] = df['avg:current_CB:p_contact'] + df['avg:current_VB:p_contact']
df = df[df['V'] != 0]

fig, ax = plt.subplots()
ax.plot(df['V'], df['J'], label="$J(V)$", marker='o')
ax.set_yscale('log')
ax.set_xlabel(r'applied potential ($\mathrm{V}$)')
ax.set_ylabel(r'total current ($\mathrm{mA}/\mathrm{cm}^2$)')
ax.legend()
fig.tight_layout()
fig.savefig("tutorial-pn-diode-JV.svg")