-
Notifications
You must be signed in to change notification settings - Fork 82
Description
Describe the bug
After the PDD find the solution for your set of voltages through solcore.sesame_drift_diffusion.solve_pdd.iv_sesame
it stores the voltage that should correspond to the voltage used for computation from the options.internal_voltages. Since the iv_sesame function does some reordering of the voltages, the output will not correspond to the actual votages.
To Reproduce
P = material('GaAs')(
Na = si('2e18cm-3'),
electron_minority_lifetime=5e-9,
hole_minority_lifetime=5e-9
)
N = material('GaAs')(
Nd = si('2e18cm-3'),
electron_minority_lifetime=5e-9,
hole_minority_lifetime=5e-9
)
junction = Junction([
Layer(si('160nm'), material = P),
Layer(si('160nm'), material = N)
], kind='sesame_PDD')
V = np.linspace(-2, 0, 6) # Voltages for the IV curve
#Create a mesh for the junction
mesh = np.arange(0,2*160e-9,1e-9)
junction.mesh = mesh
options = State()
options.T = 300
options.voltages = V
options.internal_voltages = V
# PDD solver options
options.sesame_verbose = False
options.sesame_periodic = True * 0 # This equals 0 (False)
options.sesame_tol = 1e-6
options.sesame_max_iterations = 1000
options.sesame_htp = 1
solar_cell_sesame = SolarCell([junction])
solar_cell_solver(solar_cell_sesame, 'iv', options)
plt.figure()
plt.plot(junction.voltage, junction.current, 'o-')
Expected behavior
As an example, if I compute the iv curve for a pin diode from -2 to 0V the sesame_pdd will rearrange so that it computes from 0 to -2V. However, since it saves junction.voltage = options.internal_voltages
then the first value of current in junction.current
will correspond to the -2V where it should correspond to 0V
Desktop (please complete the following information):
- OS: Windows 11
- Solcore Version latest in PyPi
Additional context
The fix is quite simple. Replace the junction.voltage=options.internal_voltages with junction.voltage=result_voltage