CW Generation Rate
CW Generation Rate
# CW generation rate
# Notes:
changedevice multipleperado
ty
# Typical FDTD simulations include a single period
# Input properties
# export filename: file name used to export generation rate data to DEVICE
# axis to average: the 2D DEVICE solver can only import 2D generation rate data.
# average dimension: the dimension to compress, by averaging the generation rate over
that dimension. 'x' or 'y', or 'none'. Only for 3D simulations. 4
-
T
# periods: the number of periods to array the generation rate. X
absorption & generation
# implemented when compressing in one dimension. & plot 82Es
& we a by
# make plots: if set to 1, the analysis script will create plots of the absorption and make
generation rate making
plot = 1
.
# frequency. If the monitors have data at multiple frequency points, the data will
be averaged
# over frequency.
# Output properties
# Pabs: power absorbed per unit volume at each position (units: fraction of source
vin
power/m^3)
~
# G_export the generation rate exported to DEVICE (averaged and/or arrayed) (units: pains
-
charge pairs/m^3/s) difference between
Go G-export
# Jsc: short circuit current density (units: Amp/m^2 in both 3D and 2D)
# Tags: generation rate electron hole charge device short circuit current
#
# Copyright 2012 Lumerical Solutions Inc
##############################################
# Note that the monitor interpolation is disabled, so we also need the offset vectors
f=getdata("field","f");
x=getdata("field","x",1);
y=getdata("field","y",1);
>
-
delta_y=getdata("field","delta_y",1);
if (havedata("field","dimension")==3) {
delta_z=getdata("field","delta_z",1);
} else {
delta_z = 0;
of
Nx = length(x);
These defines the dimension the
grid . (r . y , 2) & the
of
Ny = length(y);
number
frequency points .
Nz = length(z);
Nf = length(f);
########################################################################
##
>
?"Starting absorption (Pabs) calculation";
↓
requency
3DS2- W = meshgrid4d(4,x,y,z,f*2*pi); # create 4D matrix of f .
git
SP = meshgrid4d(4,x,y,z,sourcepower(f)); # 4D matrix of source power > GD for power
point18- array
-
if (havedata("index","index_x")) {
~
Pabs_x = 0.5*eps0*W*(abs(getdata("field","Ex",1))^2*imag(getdata("index","index_x",1)^2));
Pabs_y =
Related a
-A
loss.
0.5*eps0*W*(abs(getdata("field","Ey",1))^2*imag(getdata("index","index_y",1)^2)); t
-
} else { Pabs = S/E12Im (incess 2
Pabs_x = matrix(Nx,Ny,Nz,Nf); initialize
Tower absorbed by the material
matrice due to the electric field
empty
>
-
.
component
Pabs_y = matrix(Nx,Ny,Nz,Nf); if no index data .
if (havedata("index","index_z")) {
Pabs_z = 0.5*eps0*W*(abs(getdata("field","Ez",1))^2*imag(getdata("index","index_z",1)^2));
> If
} else { powers calculation forzar's
same .
have data
Pabs_z = matrix(Nx,Ny,Nz,Nf); i
e
} Mater
# spatially interpolate absorption to standard mesh cell locations
&
grid .
>
-
interp(Pabs_z,x,y,z+delta_z,f,x,y,z,f) ) / SP;
gx = abs(getdata("field","Ex",1))^2 * imag(eps0*getdata("index","index_x",1)^2);
gy = abs(getdata("field","Ey",1))^2 * imag(eps0*getdata("index","index_y",1)^2);
component using
gy = matrix(Nx,Ny,Nz,Nf);
same principle
} as Pabs .
if (havedata("index","index_z")) {
gz = abs(getdata("field","Ez",1))^2 * imag(eps0*getdata("index","index_z",1)^2);
} else {
gz = matrix(Nx,Ny,Nz,Nf);
# interpolate absorption to standard mesh cell locations and solar frequency vector
g = 0.5 * ( interp(gx,x+delta_x,y,z,f,x,y,z,f) +
number of absorbed photons per unit volume
interp(gy,x,y+delta_y,z,f,x,y,z,f) +
,
-
> normalized Planaks constant
by
.
interp(gz,x,y,z+delta_z,f,x,y,z,f) ) / hbar;
2
generationpaime ris
s
previous
gx=0; gy=0; gz=0; # clear variables, to free memory
generation enepationquency
# Calculate the generation rate by integrating 'g' over wavelength
# The generate rate is the number of electron hole pairs per unit volume per second. (units:
mu
1/m^3/s)
vokanaya
normalize to the actual sources
to >
-
S
if (Nf>1) {
>
-
normalizationwavdgt
G_matrix = integrate2(g*norma,4,lam_nm)/(lam_nm(Nf)-lam_nm(1)); # Average
a wavelengths &
use wavelengthpange
over .
} else {
g=0;
##########################################################
?"Unfolding";
if ( (length(getdata("field","x",1)) != length(getdata("field","x",2))) ) {
xTemp = x;
x = [-flip(x-x(1),1)+x(1); x(2:Nx)];
PabsTemp = Pabs_matrix;
Pabs_matrix = matrix(2*Nx-1,Ny,Nz,Nf);
GTemp = G_matrix;
G_matrix = matrix(2*Nx-1,Ny,Nz);
Pabs_matrix(1:(Nx-1),1:Ny,1:Nz,1:Nf) = PabsTemp(Nx:-1:2,1:Ny,1:Nz,1:Nf);
Pabs_matrix(Nx:(2*Nx-1),1:Ny,1:Nz,1:Nf) = PabsTemp;
G_matrix(1:(Nx-1),1:Ny,1:Nz) = GTemp(Nx:-1:2,1:Ny,1:Nz);
G_matrix(Nx:(2*Nx-1),1:Ny,1:Nz) = GTemp;
Nx = length(x);
if (length(getdata("field","y",1)) != length(getdata("field","y",2))) {
yTemp = y;
y = [-flip(y-y(1),1)+y(1); y(2:Ny)];
PabsTemp = Pabs_matrix;
Pabs_matrix = matrix(Nx,2*Ny-1,Nz,Nf);
GTemp = G_matrix;
G_matrix = matrix(Nx,2*Ny-1,Nz);
Pabs_matrix(1:Nx,1:(Ny-1),1:Nz,1:Nf) = PabsTemp(1:Nx,Ny:-1:2,1:Nz,1:Nf);
Pabs_matrix(1:Nx,Ny:(2*Ny-1),1:Nz,1:Nf) = PabsTemp;
G_matrix(1:Nx,1:(Ny-1),1:Nz) = GTemp(1:Nx,Ny:-1:2,1:Nz);
G_matrix(1:Nx,Ny:(2*Ny-1),1:Nz) = GTemp;
Ny = length(y);
# end of unfolding
##########################################################
# Export data to DEVICE. Compress data in 3rd dimension, and Array the generation rate
'periods' time
# check inputs
dim = getdata("field","dimension");
G_temp = matrix(2,Ny,Nz);
G_temp(1,1:Ny,1:Nz) = integrate2(G_matrix,1,x)/(max(x)-min(x));
G_temp(2,1:Ny,1:Nz) = integrate2(G_matrix,1,x)/(max(x)-min(x));
G_matrix_export = G_temp;
y_export = y;
z_export = z;
G_temp = matrix(Nx,2,Nz);
G_temp(1:Nx,1,1:Nz) = integrate2(G_matrix,2,y)/(max(y)-min(y));
G_temp(1:Nx,2,1:Nz) = integrate2(G_matrix,2,y)/(max(y)-min(y));
x_export = x;
z_export = z;
G_matrix_export = G_matrix;
x_export = x;
y_export = y;
z_export = z;
G_matrix_export = matrix(Nx,Ny,2);
G_matrix_export(1:Nx,1:Ny,1) = G_matrix;
G_matrix_export(1:Nx,1:Ny,2) = G_matrix;
x_export = x;
y_export = y;
z_export = [-1e-6,1e-6];
Nz=2;
temp = G_matrix_export;
for(i=1;i<periods;i=i+1){
}
y_export = y_export - (max(y_export) + min(y_export))/2; # re-center at zero
temp = G_matrix_export;
for(i=1;i<periods;i=i+1){
temp=0;
x_original=x;
y_original=y;
z_original=z;
G=G_matrix_export;
x=x_export;
y=y_export;
z=z_export;
if(length(%export filename%)>0){
matlabsave(%export filename%,x,y,z,G);
}
x = x_original;
y = y_original;
z = z_original;
Nz=length(z);
##########################################################
paies/my electron
normLengthY = max(y) - min(y);
~ orn
Igen = e*integrate2(G_matrix,1:3,x,y,z); #A =
photon
if (dim==3) {
}
> in case
of 2D .
zenzwe
# end Jsc calculation calculatecan
-
exporteddata
# re-calculate Jsc for exported data, to confirm result is the same
Igen_export = e*integrate2(G_matrix_export,1:3,x_export,y_export,z_export); # A
if (dim==3) {
} else {
Pabs = rectilineardataset("Pabs",x,y,z);
Pabs.addparameter("lambda",c/f,"f",f);
Pabs.addattribute("Pabs",Pabs_matrix);
G = rectilineardataset("G",x,y,z);
G.addattribute("G",G_matrix);
G_export.addattribute("G",G_matrix_export);
Pabs_total.addparameter("lambda",c/f,"f",f);
Pabs_total.addattribute("Pabs_total",integrate2(Pabs_matrix,1:3,x,y,z));
#Jsc_matrix=Jsc;
#Jsc = matrixdataset("Jsc");
#Jsc.addattribute("Jsc",Jsc_matrix);
# plot results
if (%make plots%) {
pos = (max(y)+min(y))/2;
val = log10(pinch(G.G,2,find(y,pos)));
val = pinch(pinch(Pabs.Pabs,4,Nf/2),2,find(y,pos));
pos = (max(x)+min(x))/2;
val = log10(pinch(G.G,1,find(x,pos)));
val = pinch(pinch(Pabs.Pabs,4,Nf/2),1,find(x,pos));
pos = (max(z)+min(z))/2;
val = log10(pinch(G.G,3,find(z,pos)));
val = pinch(pinch(Pabs.Pabs,4,Nf/2),3,find(z,pos));
``