# First find the equilibrium solution result = sesame.solve_equilibrium(sys) # Add illumination phi0 = 1e17 # incoming flux [1/(cm^2 sec)] alpha = 2.3e4 # absorbtion coefficient [1/cm] # Define a function for illumination profile f = lambda x,y: phi0*alpha*np.exp(-x*alpha) # f is an "inline" function # This function adds generation to the simulation sys.generation(f) # Specify the applied voltage values voltages = np.linspace(0,1,21) # Perform I-V calculation j = sesame.IVcurve(sys, voltages, result, '1dhetero_V') j = j * sys.scaling.current result = {'v':voltages, 'j':j} np.save('IV_values', result) # plot I-V curve try: import matplotlib.pyplot as plt plt.plot(voltages, j,'-o') plt.xlabel('Voltage [V]') plt.ylabel('Current [A/cm^2]') plt.grid() # add grid plt.show() # show the plot on the screen # no matplotlib installed except ImportError:
# add donor defect along GB sys.add_line_defects([p1, p2], rho_GB, S_GB, E=E_GB, transition=(1, 0)) # add acceptor defect along GB sys.add_line_defects([p1, p2], rho_GB, S_GB, E=E_GB, transition=(0, -1)) # Solve equilibirum problem first solution = sesame.solve_equilibrium(sys) # define a function for generation profile f = lambda x, y: 2.3e21 * np.exp(-2.3e4 * x) # add generation to the system sys.generation(f) # Solve problem under short-circuit current conditions solution = sesame.solve(sys, solution) # Get analyzer object to compute observables az = sesame.Analyzer(sys, solution) # Compute short-circuit current j = az.full_current() # Print Jsc print(j * sys.scaling.current * sys.scaling.length * 1e3) # specify applied voltages voltages = np.linspace(0, .1, 1) # find j-v j = sesame.IVcurve(sys, voltages, solution, '2dGB_V') # save the result result = {'voltages': voltages, 'j': j} np.save('IV_values', result)
# cycle over all parameter sets for myjobcounter in my_param_indices: # Get system for given set of parameters params = paramlist[myjobcounter] sys = system(params) # Get equilibrium solution eqsolution = sesame.solve(sys, 'Poisson') # Define a function for generation profile f = lambda x, y: 2.3e21 * np.exp(-2.3e4 * x) # add generation to the system sys.generation(f) # Specify output filename for given parameter set outputfile = '' for paramvalue in params: outputfile = outputfile + '{0}_'.format(paramvalue) # Compute J-V curve jv = sesame.IVcurve(sys, voltages, eqsolution, outputfile) # Save computed J-V in array jvset_local[myjobcounter, :] = jv # Gather results from all processors mpi_comm.Reduce(jvset_local, jvset) # Save J-V data for all parameter sets np.savez("JVset", jvset, paramlist)
# Define a function for the generation rate phi = 1e17 # photon flux [1/(cm^2 s)] alpha = 2.3e4 # absorption coefficient [1/cm] # Define a function for the generation rate def gfcn(x): return phi * alpha * np.exp(-alpha * x) # add generation to system sys.generation(gfcn) # IV curve voltages = np.linspace(0, 0.95, 40) j = sesame.IVcurve(sys, voltages, solution, '1dhomo_V') # convert dimensionless current to dimension-ful current j = j * sys.scaling.current # save voltage and current values to dictionary result = {'v': voltages, 'j': j} # save data to python data file np.save('IV_values', result) # save data to an ascii txt file np.savetxt('IV_values.txt', (voltages, j)) # save data to a matlab data file try: from scipy.io import savemat
# define a function for generation profile f = lambda x, y: 2.3e21 * np.exp(-2.3e4 * x) # add generation to the system sys.generation(f) # Solve problem under short-circuit current conditions solution = sesame.solve(sys, guess=solution) # Get analyzer object to compute observables az = sesame.Analyzer(sys, solution) # Compute short-circuit current j = az.full_current() # Print Jsc print(j * sys.scaling.current * sys.scaling.length * 1e3) # specify applied voltages voltages = np.linspace(0, .9, 10) # find j-v j = sesame.IVcurve(sys, voltages, '2dGB_V', guess=solution) j = j * sys.scaling.current * sys.scaling.length * 1e3 import matplotlib.pyplot as plt plt.plot(voltages, j, '-o') # save the result result = {'voltages': voltages, 'j': j} np.save('IV_values', result) # plot results sys, results = sesame.load_sim('2dGB_V_0.gzip') sesame.plot(sys, results['v'])
sys.contact_S(Sn_left, Sp_left, Sn_right, Sp_right) # Define a function for the generation rate phi = 1e17 # photon flux [1/(cm^2 s)] alpha = 2.3e4 # absorption coefficient [1/cm] # Define a function for the generation rate def gfcn(x,y): return phi * alpha * np.exp(-alpha * x) # add generation to system sys.generation(gfcn) # IV curve voltages = np.linspace(0, 0.95, 10) j = sesame.IVcurve(sys, voltages, '1dhomo_V') # convert dimensionless current to dimension-ful current j = j * sys.scaling.current # save voltage and current values to dictionary result = {'v':voltages, 'j':j} # save data to python data file np.save('IV_values', result) # save data to an ascii txt file np.savetxt('IV_values.txt', (voltages, j)) # save data to a matlab data file try: from scipy.io import savemat