Steady-state light-intensity dependent JV simulation

[1]:
import os, sys
try:
    import pySIMsalabim as sim
except ImportError: # add parent directory to sys.path if pySIMsalabim is not installed
    sys.path.append('..')
    import pySIMsalabim as sim
from pySIMsalabim.experiments.JV_steady_state import *

# Use the default input files shipped with the pySIMsalabim tests (pySIMsalabim/tests/sim_inputs/default):
# check that they match the SIMsalabim version and copy them into SIMsalabim/SimSS and SIMsalabim/ZimT
sys.path.append(os.path.join('..', 'pySIMsalabim', 'tests'))
from sim_inputs_setup import prepare_test_inputs, cleanup_test_inputs
prepare_test_inputs(convert=False)
Test inputs for SimSS: version matches SIMsalabim 5.37
Test inputs for ZimT: version matches SIMsalabim 5.37
Copying the SimSS test inputs to /home/lecorre/Desktop/pySIMsalabim/SIMsalabim/SimSS
Copying the ZimT test inputs to /home/lecorre/Desktop/pySIMsalabim/SIMsalabim/ZimT

Setup the simulation

[2]:
# Set the path to the simulation setup file
cwd = os.path.abspath('..')
session_path = os.path.join(cwd, 'SIMsalabim','SimSS')
simss_device_parameters = os.path.join(session_path, 'simulation_setup_test.txt')

# Set the JV parameters
Gfracs = [0.1,0.5,1.0] # Fractions of the generation rate to simulate
UUID = str(uuid.uuid4())

# Run the JV simulation
ret, mess = run_SS_JV(simss_device_parameters, session_path, JV_file_name = 'JV.dat', varFile= 'Var.dat',G_fracs = Gfracs, parallel = False, max_jobs = 3, UUID=UUID, cmd_pars=[{'par': 'l2.L', 'val': '400e-9'}])

Plot results

[3]:
plt.figure()
for Gfrac in Gfracs:
    data = pd.read_csv(os.path.join(session_path,f'JV_Gfrac_{Gfrac}_{UUID}.dat'), sep=r'\s+')
    plt.plot(data['Vext'],data['Jext'],label=f'Gfrac = {Gfrac}')
plt.xlabel('V$_{ext}$ [V]')
plt.ylabel('J$_{ext}$ [A m$^{-2}$]')
plt.legend()
plt.show()
../_images/examples_light_dep_JVs_5_0.png

Plot energy diagram from the input parameters

[4]:
# Plot the energy band diagram of the input file
fig = sim.plot_band_diagram(simss_device_parameters, session_path)
../_images/examples_light_dep_JVs_7_0.png
[5]:
# Clean up the output files (comment out if you want to keep the output files)
sim.clean_all_output(session_path)
sim.delete_folders('tmp',session_path)

# Remove the test input files copied into the SIMsalabim folder
cleanup_test_inputs()