You are on page 1of 35

Semiconductor Process/Device

Simulation (EEE533)
Assignment 5
1D Drift Diffusion simulator for modeling
pn-junction Diode
Due date October 13 2008
Dr. Dragica Vasileska
Student
Pinakpani Nayak (995030989)
Assignment 5 1D Drift Diffusion pn Diode simulator
TABLE OF CONTENT
1 Equilibrium Solver........................................................................................................................... 2
1.1 NA = 1016 and ND = 1016 .......................................................................................................2
1.2 NA = 1016 and ND = 1018 ......................................................................................................4
1.3 NA = 1018 and ND = 1018 .......................................................................................................6
2 NonEquilibrium Solver.................................................................................................................. 8
2.1 Objective .........................................................................................................................................8
2.2 Specifications .................................................................................................................................8
2.3 Methodology....................................................................................................................................8
2.4 Flow chart for 1D Drift Diffusion Solver .....................................................................................10
2.5 Finite Difference Representation of Linearized Poissons Eqn ...................................................11
2.6 Scharfetter Gummel Discretization Scheme .............................................................................11
3 Simulation Results......................................................................................................................... 14
3.1 Conduction Band vs Device Length..............................................................................................14
3.2 Electron and Hole Densities vs Device Length.............................................................................15
3.3 IV Characteristics .........................................................................................................................17
3.4 Electron and Hole Quasi Fermi Levels ........................................................................................18
3.5 Electric Field ................................................................................................................................19
3.6 Equilibrium Condition...................................................................................................................19
4 APPENDIX A ................................................................................................................................. 21
4.1 Results from Larger Bias steps = VT. ..........................................................................................21
5 APPENDIX B ................................................................................................................................ 22
5.1 Matlab Code for 1D drift Diffusion simulator for modeling pn-junction (diodes).......................22
Pinakpani Nayak (995030989) 1
Assignment 5 1D Drift Diffusion pn Diode simulator
1 Equilibrium Solver
1.1 NA = 10
16
and ND = 10
16

POTENTIAL
MATLAB NanoHub
0 1 2 3 4 5 6 7
-15
-10
-5
0
5
10
15
x [um]
P
o
t
e
n
t
i
a
l

[
e
V
]
Potential vs Position - at Equilibrium

ELECTRIC FIELD
MATLAB NanoHub
0 1 2 3 4 5 6 7
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
0.5
x 10
4
X: 3.215
Y: -34.66
X: 3.617
Y: -3.117e+004
X: 3.985
Y: -80.89
x [um]
E
l
e
c
t
r
i
c

F
i
e
l
d

[
V
/
c
m
]
Field Profile vs Position - at Equilibrium
Width of Deplition
Region = 0.766um
Peak Electric Field
= -3.117e4 V/cm
Width of Depletion Region = 0.766um and Peak electric field = - 3.117E4 V/cm
Pinakpani Nayak (995030989) 2
Assignment 5 1D Drift Diffusion pn Diode simulator
ELECTRON AND HOLE DENSITIES
MATLAB NanoHub
0 1 2 3 4 5 6 7
10
4
10
6
10
8
10
10
10
12
10
14
10
16
x [um]
E
l
e
c
t
r
o
n

&

H
o
l
e

D
e
n
s
i
t
i
e
s

[
1
/
c
m
3
]
Electron & Hole Densities vs Position - at Equilibrium
n
p

TOTAL CHARGES
MATLAB NanoHub
0 1 2 3 4 5 6 7
-2
-1.5
-1
-0.5
0
0.5
1
1.5
2
x 10
-3
x [um]
T
o
t
a
l

C
h
a
r
g
e

D
e
n
s
i
t
y

[
C
/
c
m
3
]
Total Charge Density vs Position - at Equilibrium

Thus Nanohub and Matlab results match.
Pinakpani Nayak (995030989) 3
Assignment 5 1D Drift Diffusion pn Diode simulator
1.2 NA = 10
16
and ND = 10
18

POTENTIAL
MATLAB NanoHub
0 1 2 3 4 5 6 7
-15
-10
-5
0
5
10
15
20
X: 0.7983
Y: -13.44
X: 5.024
Y: 18.05
x [um]
P
o
t
e
n
t
i
a
l

[
e
V
]
Potential vs Position - at Equilibrium
ELECTRIC FIELD
MATLAB NanoHub
0 1 2 3 4 5 6 7
-7
-6
-5
-4
-3
-2
-1
0
1
x 10
4
X: 2.813
Y: -31.7
X: 3.366
Y: -6.017
X: 3.326
Y: -6.641e+004
x [um]
E
l
e
c
t
r
i
c

F
i
e
l
d

[
V
/
c
m
]
Field Profile vs Position - at Equilibrium
Depletion region = 0.553 um
Peak Electric Field = -6.641x10
4
V/cm
Pinakpani Nayak (995030989) 4
Assignment 5 1D Drift Diffusion pn Diode simulator
ELECTRON AND HOLE DENSITIES
MATLAB NanoHub
0 1 2 3 4 5 6 7
10
5
10
10
10
15
X: 1.25
Y: 1e+016
X: 4.46
Y: 1e+018
X: 4.911
Y: 210.2
x [um]
E
l
e
c
t
r
o
n

&

H
o
l
e

D
e
n
s
i
t
i
e
s

[
1
/
c
m
3
]
Electron & Hole Densities vs Position - at Equilibrium
X: 1.443
Y: 2.103e+004
n
p

TOTAL CHARGES
MATLAB NanoHub
0 1 2 3 4 5 6 7
-0.06
-0.04
-0.02
0
0.02
0.04
0.06
0.08
0.1
0.12
x [um]
T
o
t
a
l

C
h
a
r
g
e

D
e
n
s
i
t
y

[
C
/
c
m
3
]
Total Charge Density vs Position - at Equilibrium
Pinakpani Nayak (995030989) 5
Assignment 5 1D Drift Diffusion pn Diode simulator
1.3 NA = 10
18
and ND = 10
18

POTENTIAL
MATLAB NanoHub
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8
-20
-15
-10
-5
0
5
10
15
20
X: 0.2185
Y: -18.05
X: 0.5981
Y: 18.05
x [um]
P
o
t
e
n
t
i
a
l

[
e
V
]
Potential vs Position - at Equilibrium

ELECTRIC FIELD
MATLAB NanoHub
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
0.5
x 10
5
X: 0.3674
Y: -491.8
X: 0.4495
Y: -894.1
x [um]
E
l
e
c
t
r
i
c

F
i
e
l
d

[
V
/
c
m
]
Field Profile vs Position - at Equilibrium
X: 0.4098
Y: -3.651e+005

Width of Depletion Region = 0.0821 um
Peak Electric Field = -3.651E5 V/cm
Pinakpani Nayak (995030989) 6
Assignment 5 1D Drift Diffusion pn Diode simulator
ELECTRON AND HOLE DENSITIES
MATLAB NanoHub
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8
10
0
10
5
10
10
10
15
10
20
X: 0.1594
Y: 1e+018
X: 0.5963
Y: 1e+018
X: 0.1705
Y: 210.3
X: 0.5835
Y: 210.2
x [um]
E
l
e
c
t
r
o
n

&

H
o
l
e

D
e
n
s
i
t
i
e
s

[
1
/
c
m
3
]
Electron & Hole Densities vs Position - at Equilibrium
n
p


TOTAL CHARGES
MATLAB NanoHub

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8
-0.2
-0.15
-0.1
-0.05
0
0.05
0.1
0.15
0.2
x [um]
T
o
t
a
l

C
h
a
r
g
e

D
e
n
s
i
t
y

[
C
/
c
m
3
]
Total Charge Density vs Position - at Equilibrium

As Doping density of a particular section increases the depletion region in that section
decreases.
Pinakpani Nayak (995030989) 7
Assignment 5 1D Drift Diffusion pn Diode simulator
2 NonEquilibrium Solver
2.1 Objective
Goal of this project is to develop a one-dimensional (1D) drift-diffusion simulator for modeling pn-
junctions (diodes) under forward bias conditions. Both types of carriers have to be included in the
model (electrons and holes). Finite-difference expressions should be used for the electron and hole
current continuity equations using Sharfetter-Gummel discretization scheme.
2.2 Specifications
sc = 1.05x10
-10

ni = 1.5x10
10
cm
-3
, T = 300K.
Electron mobility = 1500 cm
2
/V-s
Hole mobility = 1000 cm
2
/V-s
Doping : NA = 10
16
cm
-3
for p-region and ND = 10
16
cm
-3
for n-region.
Numerical Methods used LU Decomposition method for the solution of 1D Poisson and 1D
electron and Hole continuity equation.
2.3 Methodology
The flow chart explains the methodology followed. Following steps were followed to simulate the non-
equilibrium condition of a 1D pn-diode.
1. Calculate the equilibrium condition of the diode by solving the linearized Poissons equation.
2. Define an initial Mesh, which should be fine enough to give correct result. If the Mesh size is
too large then the results obtained will not be correct. The mesh size is less than the Debye
Length.
3. Initialize all discretization co-efficients, doping density and potential based on charge density.
4. Solve for the updated potential using LU decomposition method.
5. Update coefficient of the linearized Poissons equation.
6. Check for convergence against a predefined error value(10
-5
).
7. Equilibrium solution gives electric field, electric potential and net doping values (n and p
concentration) to be used as the initial values for the non-equilibrium solver.
Pinakpani Nayak (995030989) 8
Assignment 5 1D Drift Diffusion pn Diode simulator
8. Based on the equilibrium values we solve the continuity equation for electron and holes to get
the current.
9. Calculate the low field mobility. mun0 = 1500 cm
2
/V-s and mup0 = 1000 cm
2
/V-s. Store the
mobility values in an array for each node points.
10. Calculate the field dependant mobility based on the local filed at each node. mun(E) for
electron and mup(E) for holes. (FDM)
11. Calculate Bernaulis function that depends on potential. (BF)
12. Determine the discretization coefficients (product of FDM and BF) of continuity eqns for
electron and holes.
13. Update the generation and recombination rate i.e. the forcing function of the continuity
equation.
) ( ) (
.
2
i n i p
i
p p n n
n n p
G
+ + +


14. Solve electron continuity eqn using LU decomposition and we get n.
15. Solve hole continuity eqn using LU decomposition and we get p.
16. Update central coefficient and forcing function in Poissons equation (now use n and p instead
of e

and e
-
).
17. Solve Poissons equation using LU decomposition.
18. Check tolerance, if not valid then go to step 9 and repeat (as we have updated the potential
the field dependant mobility has changed).

Pinakpani Nayak (995030989) 9
Assignment 5 1D Drift Diffusion pn Diode simulator
2.4 Flow chart for 1D Drift Diffusion Solver
Initialize parameters:
-Mesh size
-Discretization coefficients
-Doping density
-Potential based on charge neutrality
Solve for the updated potential
given the forcing function using LU decomposition
Update:
- Central coefficient of the linearized Poisson Equation
- Forcing function
Test maximum
absolute error update
Equilibrium solver
V
A
= V
A
+V
Calculate coefficients for:
- Electron continuity equation
- Hole continuity equation
- Update generation recombination rate
Solve electron continuity equation using LU decomposition
Solve hole continuity equation using LU decomposition
Update:
- Central coefficient of the linearized Poisson Equation
- Forcing function
Solve for the updated potential
given the forcing function using LU decomposition
Test maximum
absolute error update
Maximum voltage exceeded?
Calculate current
STOP
yes
no
> tolerance
< tolerance
Non-Equilibrium solver
> tolerance
< tolerance
V is a fraction of the
thermal voltage V
T
Pinakpani Nayak (995030989) 10
Assignment 5 1D Drift Diffusion pn Diode simulator
2.5 Finite Difference Representation of Linearized Poissons Eqn
[ ] ( )
i i
n
i i i i
n
i
n
i i i
n
i
n p C n p n p + +

,
_

+ +

+ +
+

1
1 2
1
2
1
1 2
1 2 1

At Equilibrium : ni = e

and pi = e
-
2.6 Scharfetter Gummel Discretization Scheme
Electron Current is given by
1
]
1

,
_

,
_

+ +
+
+
+
T
i i
i
T
i i
i
n
i n
i
V
B n
V
B n
eD
J
1 1
1
2 / 1
2 / 1


1
]
1

,
_

,
_

T
i i
i
T
i i
i
n
i n
i
V
B n
V
B n
eD
J

1
1
1 2 / 1
2 / 1

Hole Current is Given by
1
]
1

,
_

,
_

+ +
+
+
+
T
i i
i
T
i i
i
p
i p
i
V
B p
V
B p
eD
J

1 1
1
2 / 1
2 / 1

1
]
1

,
_

,
_

T
i i
i
T
i i
i
p
i p
i
V
B p
V
B p
eD
J
1
1
1 2 / 1
2 / 1


The electron Continuity equation is given by
i i
T
i i n
i i
T
i i n
i
T
i i n
i i
T
i i n
i
G n
V
B D n
V
B D
V
B D n
V
B D

,
_

+
1
]
1

,
_

,
_

,
_

+
+

+
+
+ 1
1
2 / 1
2
1
2 / 1
2
1
2 / 1
2
1
1
2 / 1
2
1 1 1 1


The hole Continuity equation is given by
i i
T
i i p
i i
T
i i p
i
T
i i p
i i
T
i i p
i
G p
V
B D p
V
B D
V
B D p
V
B D

,
_

+
1
]
1

,
_

,
_

,
_

+
+

+
+
+ 1
1
2 / 1
2
1
2 / 1
2
1
2 / 1
2
1
1
2 / 1
2
1 1 1 1


) ( ) (
.
2
int
i n i p
i
p p n n
n n p
G
+ + +


,
T
V


'
,
T T
B
V D V
q
T K D

>
1
) (

x
e
x
x B , x = normalized, nint = intrinsic carrier concentration, is normalized by LDi
Pinakpani Nayak (995030989) 11
Assignment 5 1D Drift Diffusion pn Diode simulator
For electron
( ) ( ) ( )
( )
[ ]
int
2
int
2
int
int 1 1
2 2
2 / 1
int 1
2 2
2 / 1
1
2 2
2 / 1
int 1 1
2 2
2 / 1
) 1 ( ) 1 (
.
' '
' ' ' ' ' '
n p n
n n n p
n n B
L
V
n n B
L
V
B
L
V
n n B
L
V
i n i p
i i
i i i i
Di
T
n
i
i i i i
Di
T
n
i
i i
Di
T
n
i
i i i
Di
T
n
i
+ + +

+
1
1
]
1

+
+

+ +
+

( ) ( ) ( ) [ ] ( )
[ ]
T
Di
i n i p
i i
i i i
n
i i i i
n
i i i
n
i i i i
n
i
V
L
p n
n p
n B n B B n B
2 2
1 1 2 / 1 1 2 / 1 1 2 / 1 1 1 2 / 1

) 1 ( ) 1 (
1 .

' ' ' ' ' ' ' '

+ + +

+ +
+ + + + +


So the coefficients of electron Continuity eqn are
( )
( ) ( ) [ ]
( )
[ ]
T
Di
i n i p
i i
i i
n
i
i i
n
i i i
n
i
i i
n
i
V
L
p n
n p
f
B a
B B b
B c
2 2
i
1 2 / 1 i
1 2 / 1 1 2 / 1 i
1 2 / 1 i

) 1 ( ) 1 (
1 .

' '
' ' ' '
' '

+ + +


+


+ +
+ +




Similarly for Holes the coefficients can be determined as
( )
( ) ( ) [ ]
( )
[ ]
T
Di
i n i p
i i
i i
p
i
i i
p
i i i
p
i
i i
p
i
V
L
p n
n p
f
B a
B B b
B c
2 2
i
1 2 / 1 i
1 2 / 1 1 2 / 1 i
1 2 / 1 i

) 1 ( ) 1 (
1 .

' '
' ' ' '
' '

+ + +


+


+ +
+ +




The simulation was performed by varying Anode voltage from 0 to 0.625V in 0.33*VT
steps. All the results were plotted as mentioned below.
NOTE :
It was observed that by varying the DC voltage from 0 to 0.625 with smaller bias steps
like 0.33VT gives better results compared to larger bias steps like VT . The results
obtained from smaller bias steps exactly matche with NanoHub plots.
Pinakpani Nayak (995030989) 12
nint = Intrinsic carrier concentration
LDi = Intrinsic Debye Length
= normalized mesh
VT = Thermal Voltage
ni pi = electron and hole
concentration at node i
Assignment 5 1D Drift Diffusion pn Diode simulator
Appendix A contains the graphs for Larger Bias steps and the difference can be
observed.
Pinakpani Nayak (995030989) 13
Assignment 5 1D Drift Diffusion pn Diode simulator
3 Simulation Results
Anode Voltage varied from 0 to 0.625V in steps of 0.33*Vt
3.1 Conduction Band vs Device Length
MatLab (Va = 0.625V) Nano Hub (Va = 0.625V)
0 1 2 3 4 5 6 7
-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
X: 3.088
Y: 0.303
x [um]
C
o
n
d
u
c
t
i
o
n

B
a
n
d

E
n
e
r
g
y

(
e
V
)
Conduction Band vs Position - at Applied Bias (0.625)
X: 3.413
Y: 0.1457

MatLab (Equilibrium) Nano Hub (Equilibrium)
0 1 2 3 4 5 6 7
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
x [um]
C
o
n
d
u
c
t
i
o
n

B
a
n
d

E
n
e
r
g
y

(
e
V
)
Conduction Band vs Position - at Equilibrium

Pinakpani Nayak (995030989) 14
Assignment 5 1D Drift Diffusion pn Diode simulator
3.2 Electron and Hole Densities vs Device Length
MatLab (Equilibrium) Nano Hub (Equilibrium)
0 1 2 3 4 5 6 7
10
2
10
4
10
6
10
8
10
10
10
12
10
14
10
16
10
18
x [um]
E
l
e
c
t
r
o
n

&

H
o
l
e

D
e
n
s
i
t
i
e
s

[
1
/
c
m
3
]
Electron & Hole Densities vs Position - at Equilibrium
n
p
MatLab (Va = 0.625V) Nano Hub (Va = 0.625V)
Pinakpani Nayak (995030989) 15
Assignment 5 1D Drift Diffusion pn Diode simulator
0 1 2 3 4 5 6 7
10
2
10
4
10
6
10
8
10
10
10
12
10
14
10
16
10
18
X: 3.126
Y: 2.237e+014
X: 0.1936
Y: 2.25e+004
X: 3.365
Y: 2.602e+013
X: 6.475
Y: 2250
x [um]
E
l
e
c
t
r
o
n

&

H
o
l
e

D
e
n
s
i
t
i
e
s

[
1
/
c
m
3
]
Electron & Hole Densities vs Position - at Applied Bias(0.625V)
n
p
The electron and hole densities calculated at 0.625V in Matlab matches with Nanohub values.
Pinakpani Nayak (995030989) 16
Assignment 5 1D Drift Diffusion pn Diode simulator
3.3 IV Characteristics
Total Current - MatLab (Va = 0.625) Total Current - Nano Hub (Va = 0.625V)
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7
-0.5
0
0.5
1
1.5
2
2.5
3
3.5
4
4.5
X: 0.6226
Y: 4.177
VA [V]
T
o
t
a
l

C
u
r
r
e
n
t

D
e
n
s
i
t
y

[
A
m
p
/
c
m
2
]
I vs V Plot

The final current at Va=0.6226 is 4.177 A/cm
2
. The Matlab and Nanohub values match.

IV Plot for Electron, Hole and Total Current Current Continuity
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7
-1
0
1
2
3
4
5
VA [V]
T
o
t
a
l

C
u
r
r
e
n
t

D
e
n
s
i
t
y

[
A
m
p
/
c
m
2
]
I vs V Plot
Jtotal
Jhole
Jelec

0 1 2 3 4 5 6 7
0
1
2
3
4
5
6
x [um]
T
o
t
a
l

C
u
r
r
e
n
t

D
e
n
s
i
t
y

[
A
/
c
m
2
]
Total Current Density vs Position - at Applied Bias(0.625V)
Total Current (Electron + Hole) going
from Cathode to Anode is Constant.
Total Current (sum of electron and Hole currents) for 0.625 V is found to be 4.177 A/cm
2

which matches with NanoHub Total current for the same bias voltage. The total current is
constant through the entire device from cathode to anode as shown in the plot. This proves
current continuity.
Pinakpani Nayak (995030989) 17
Assignment 5 1D Drift Diffusion pn Diode simulator
3.4 Electron and Hole Quasi Fermi Levels
MatLab (Va = 0.625V) Nano Hub (Va = 0.625V)
0 1 2 3 4 5 6 7
-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
x [um]
E
n
e
r
g
y

[
e
V
]
Quasi Fermi Levels (Efn & Efp) vs Position - at Applied Bias(0.625V)
Ec
Ev
Ei
Efn
Efp
The quasi Fermi levels are calculated as given below
Net Charge Density
MatLab (Va = 0.625V) Nano Hub (Va = 0.625V)
0 1 2 3 4 5 6 7
-6
-4
-2
0
2
4
6
8
10
12
x 10
-3
X: 3.354
Y: 0.004766
x [um]
T
o
t
a
l

C
h
a
r
g
e

D
e
n
s
i
t
y

[
C
/
c
m
3
]
Total Charge Density vs Position - at Applied Bias(0.625V)
X: 3.322
Y: -0.003202
Pinakpani Nayak (995030989) 18
Assignment 5 1D Drift Diffusion pn Diode simulator
3.5 Electric Field
MatLab (Va = 0.625V) Nano Hub (Va = 0.625V)
0 1 2 3 4 5 6 7
-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
0.5
x 10
4
X: 3.054
Y: -51.58
X: 3.432
Y: -18.2
x [um]
E
l
e
c
t
r
i
c

F
i
e
l
d

[
V
/
c
m
]
Field Profile vs Position - at Applied Bias(0.625V)
X: 3.322
Y: -1.719e+004
3.6 Equilibrium Condition
0 1 2 3 4 5 6 7
-0.4
-0.3
-0.2
-0.1
0
0.1
0.2
0.3
0.4
0.5
x [um]
P
o
t
e
n
t
i
a
l

[
e
V
]
Potential vs Position - at Equilibrium

0 1 2 3 4 5 6 7
-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
0.5
x 10
4
x [um]
E
l
e
c
t
r
i
c

F
i
e
l
d

[
V
/
c
m
]
Field Profile vs Position - at Equilibrium

0 1 2 3 4 5 6 7
-4
-2
0
2
4
6
8
10
12
14
16
x 10
-3
x [um]
T
o
t
a
l

C
h
a
r
g
e

D
e
n
s
i
t
y

[
C
/
c
m
3
]
Total Charge Density vs Position - at Equilibrium
Pinakpani Nayak (995030989) 19
Assignment 5 1D Drift Diffusion pn Diode simulator
From this project I conclude that I learnt more by designing the simulator myself compared to
generating the plots on Nanohub. Nanohub is a wonderful tool to explore device properties
and verify results. But designing ones own simulator gives greater insight into the actual
working of the commercial simulator and Nanohub. I can better understand how the
equations are solved, how it is better to take smaller biases and finer mesh sizes to solve an
equilibrium condition.
Pinakpani Nayak (995030989) 20
Assignment 5 1D Drift Diffusion pn Diode simulator
4 APPENDIX A
4.1 Results from Larger Bias steps = VT.
The output plots do not match with the actual NanoHub results when larger Bias steps are
used for Anode voltage increment. Hence finer bias steps give better results.
0 1 2 3 4 5 6 7
10
2
10
4
10
6
10
8
10
10
10
12
10
14
10
16
10
18
x [um]
E
l
e
c
t
r
o
n

&

H
o
l
e

D
e
n
s
i
t
i
e
s

[
1
/
c
m
3
]
Electron & Hole Densities vs Position - at Applied Bias(0.625V)
n
p

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7
-5
0
5
10
15
20
x 10
-3
VA [V]
T
o
t
a
l

C
u
r
r
e
n
t

D
e
n
s
i
t
y

[
A
m
p
/
c
m
2
]
I vs V Plot
The charge density values are lower than actual The total current plot is distorted and lesser.
0 1 2 3 4 5 6 7
-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
x [um]
E
n
e
r
g
y

[
e
V
]
Quasi Fermi Levels (Efn & Efp) vs Position - at Applied Bias(0.625V)
Ec
Ev
Ei
Efn
Efp

0 1 2 3 4 5 6 7
-0.2
-0.1
0
0.1
0.2
0.3
0.4
0.5
x [um]
P
o
t
e
n
t
i
a
l

[
e
V
]
Potential vs Position - at Applied Bias(0.625V)
Quasi Fermi levels are lesser than actual Potential values for 0 to 3um is less than actual
Pinakpani Nayak (995030989) 21
Assignment 5 1D Drift Diffusion pn Diode simulator
5 APPENDIX B
5.1 Matlab Code for 1D drift Diffusion simulator for modeling pn-junction (diodes)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% %%
%% 1D Drift Diffusion Model for pn Diodes %%
%% Equilibrium and Non Equilibrium Solver %%
%% %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

clear all;
close all;
% Defining the Fundamental and Material Constants %
q = 1.602E-19; % C or [J/eV]
kb = 1.38E-23; % [J/K]
eps = 1.05E-12; % This includes the eps = 11.7 for Si [F/cm]
T = 300; % [K]
ni = 1.5E10; % Intrinsic carrier concentration [1/cm^3]
Vt = kb*T/q; % [eV]
RNc = 2.8E19; % This is 2.8e20 in the FORTRAN file
TAUN0 = 0.1E-6; % Electron SRH life time
TAUP0 = 0.1E-6; % Hole SRH life time
mun0 = 1500; % Electron Mobility in cm2/V-s
mup0 = 1000; % Hole Mobility in cm2/V-s


dEc = Vt*log(RNc/ni);
% Define Doping Values %
Na = 1E16; % [1/cm^3]
Nd = 1E17; % [1/cm^3]
% Calculate relevant parameters for the simulation %
Vbi = Vt*log(Na*Nd/(ni*ni));
W = sqrt(2*eps*(Na+Nd)*Vbi/(q*Na*Nd)) % [cm]
Wn = W*sqrt(Na/(Na+Nd)) % [cm]
Wp = W*sqrt(Nd/(Na+Nd)) % [cm]
Wone = sqrt(2*eps*Vbi/(q*Na)) % [cm]
E_p = q*Nd*Wn/eps % [V/cm]
Ldn = sqrt(eps*Vt/(q*Nd));
Ldp = sqrt(eps*Vt/(q*Na));
Ldi = sqrt(eps*Vt/(q*ni))
% Calculate relevant parameters in an input file %
% Write to a file
save input_params.txt Na Nd Vbi W Wn Wp E_p Ldn Ldp
%Material_Constants %Define some material constants

% Setting the size of the simulation domain based
% on the analytical results for the width of the depletion regions
Pinakpani Nayak (995030989) 22
Assignment 5 1D Drift Diffusion pn Diode simulator
% for a simple pn-diode %
x_max = 0;
if(x_max < Wn)
x_max = Wn;
end
if(x_max < Wp)
x_max = Wp;
end
x_max = 20*x_max
% Setting the grid size based on the extrinsic Debye lengths %
dx = Ldn;
if(dx > Ldp)
dx=Ldp;
end
dx = dx/20;
% Calculate the required number of grid points and renormalize dx %
n_max = x_max/dx
n_max = round(n_max);
dx = dx/Ldi; % Renormalize lengths with Ldi
% Set up the doping C(x)=Nd(x)-Na(x) that is normalized with ni %
for i = 1:n_max
if(i <= n_max/2)
dop(i) = - Na/ni;
elseif(i > n_max/2)
dop(i) = Nd/ni;
end
end
% Initialize the potential based on the requirement of charge
% neutrality throughout the whole structure
for i = 1: n_max
zz = 0.5*dop(i);
if(zz > 0)
xx = zz*(1 + sqrt(1+1/(zz*zz)));
elseif(zz < 0)
xx = zz*(1 - sqrt(1+1/(zz*zz)));
end
fi(i) = log(xx);
n(i) = xx;
p(i) = 1/xx;
end
delta_acc = 1E-5; % Preset the Tolerance
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% %%
%% EQUILIBRIUM SOLUTION PART BEGINS %%
%% %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%(A) Define the elements of the coefficient matrix for the internal nodes and
% initialize the forcing function
Pinakpani Nayak (995030989) 23
Assignment 5 1D Drift Diffusion pn Diode simulator
dx2 = dx*dx;
for i = 1: n_max
a(i) = 1/dx2;
c(i) = 1/dx2;
b(i) = -(2/dx2+exp(fi(i))+exp(-fi(i)));
f(i) = exp(fi(i)) - exp(-fi(i)) - dop(i) - fi(i)*(exp(fi(i))+exp(-fi(i)));
end
%(B) Define the elements of the coefficient matrix and initialize the forcing
% function at the ohmic contacts
a(1) = 0;
c(1) = 0;
b(1) = 1;
f(1) = fi(1);
a(n_max) = 0;
c(n_max) = 0;
b(n_max) = 1;
f(n_max) = fi(n_max);
%(C) Start the iterative procedure for the solution of the linearized Poisson
% equation using LU decomposition method:
flag_conv = 0; % convergence of the Poisson loop
k_iter= 0;
while(~flag_conv)
k_iter = k_iter + 1;

alpha(1) = b(1);
for i=2:n_max
beta(i)=a(i)/alpha(i-1);
alpha(i)=b(i)-beta(i)*c(i-1);
end

% Solution of Lv = f %
v(1) = f(1);
for i = 2:n_max
v(i) = f(i) - beta(i)*v(i-1);
end

% Solution of U*fi = v %
temp = v(n_max)/alpha(n_max);
delta(n_max) = temp - fi(n_max);
fi(n_max)=temp;
for i = (n_max-1):-1:1 %delta%
temp = (v(i)-c(i)*fi(i+1))/alpha(i);
delta(i) = temp - fi(i);
fi(i) = temp;
end

delta_max = 0;

for i = 1: n_max
xx = abs(delta(i));
if(xx > delta_max)
delta_max=xx;
end
%sprintf('delta_max = %d',delta_max) %'k_iter = %d',k_iter,'

end
Pinakpani Nayak (995030989) 24
Assignment 5 1D Drift Diffusion pn Diode simulator
%delta_max=max(abs(delta));

% Test convergence and recalculate forcing function and
% central coefficient b if necessary

if(delta_max < delta_acc)
flag_conv = 1;
else
for i = 2: n_max-1
b(i) = -(2/dx2 + exp(fi(i)) + exp(-fi(i)));
f(i) = exp(fi(i)) - exp(-fi(i)) - dop(i) - fi(i)*(exp(fi(i)) + exp(-fi(i)));
end
end
end
xx1(1) = dx*1e4;
for i = 2:n_max-1
Ec(i) = dEc - Vt*fi(i); %Values from the second Node%
ro(i) = -ni*(exp(fi(i)) - exp(-fi(i)) - dop(i));
el_field1(i) = -(fi(i+1) - fi(i))*Vt/(dx*Ldi);
el_field2(i) = -(fi(i+1) - fi(i-1))*Vt/(2*dx*Ldi);
n(i) = exp(fi(i));
p(i) = exp(-fi(i));
xx1(i) = xx1(i-1) + dx*Ldi*1e4;
end
Ec(1) = Ec(2);
Ec(n_max) = Ec(n_max-1);
xx1(n_max) = xx1(n_max-1) + dx*Ldi*1e4;
el_field1(1) = el_field1(2);
el_field2(1) = el_field2(2);
el_field1(n_max) = el_field1(n_max-1);
el_field2(n_max) = el_field2(n_max-1);
nf = n*ni;
pf = p*ni;
ro(1) = ro(2);
ro(n_max) = ro(n_max-1);
figure(1)
plot(xx1, Vt*fi,'r','LineWidth',2)
xlabel('x [um]');
ylabel('Potential [eV]');
title('Potential vs Position - at Equilibrium');
figure(2)
plot(xx1, el_field1,'r','LineWidth',2)
hold on;
plot(xx1, el_field2,'r','LineWidth',2)
xlabel('x [um]');
ylabel('Electric Field [V/cm]');
title('Field Profile vs Position - at Equilibrium');
figure(3)
%plot(xx1, nf,'g','LineWidth',2)
semilogy(xx1, nf,'g','LineWidth',2)
hold on;
%plot(xx1, pf,'r','LineWidth',2)
semilogy(xx1, pf,'r','LineWidth',2)
xlabel('x [um]');
ylabel('Electron & Hole Densities [1/cm^3]');
Pinakpani Nayak (995030989) 25
Assignment 5 1D Drift Diffusion pn Diode simulator
title('Electron & Hole Densities vs Position - at Equilibrium');
legend('n','p');
%axis([0 6.75 0 10.2e17])
figure(4)
%plot(xx1, ro,'r','LineWidth',2)
plot(xx1, q*ro,'r','LineWidth',2)
xlabel('x [um]');
%ylabel('Total Charge Density [1/cm^3]');
ylabel('Total Charge Density [C/cm^3]');
title('Total Charge Density vs Position - at Equilibrium');
%axis([0.5 5 -3e17 8e17])
figure(5)
plot(xx1, Ec,'r','LineWidth',2)
xlabel('x [um]');
%ylabel('Total Charge Density [1/cm^3]');
ylabel('Conduction Band Energy (eV)');
title('Conduction Band vs Position - at Equilibrium');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% END OF EQUILIBRIUM SOLUTION PART %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% %%
%% NON-EQUILIBRIUM SOLUTION PART BEGINS %%
%% %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 1. Calculate Low filed mobility %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Prameters for Low field mobility calculation %%
TL = 300; % Temp in Kelvin
N = Na + Nd; % Local (total) impurity concentration
MU1N.CAUG = 55.24; % cm2/(V.s)
MU2N.CAUG = 1429.23; % cm2/(V.s)
ALPHAN.CAUG = 0.0; % unitless
BETAN.CAUG = -2.3; % unitless
GAMMAN.CAUG = -3.8; % unitless
DELTAN.CAUG = 0.73; % unitless
NCRITN.CAUG = 1.072*10^17; % cm-3
MU1P.CAUG = 49.7; % cm2/(V.s)
MU2P.CAUG = 479.37; % cm2/(V.s)
ALPHAP.CAUG = 0.0; % unitless
BETAP.CAUG = -2.2; % unitless
GAMMAP.CAUG = 13.7; % unitless
DELTAP.CAUG = 0.70; % unitless
NCRITP.CAUG = 1.606*10^17; % cm-3
BETAN = 2.0;
BETAP = 1.0;

% % mun0 = ( MU1N.CAUG*((TL/300)^ALPHAN.CAUG) ) ...
% % + (( (MU2N.CAUG*((TL/300)^BETAN.CAUG)) - (MU1N.CAUG*((TL/300)^ALPHAN.CAUG)) ) ...
% % / ( 1 + ((TL/300)^GAMMAN.CAUG) * ((N/NCRITN.CAUG)^DELTAN.CAUG) ))
% %
Pinakpani Nayak (995030989) 26
Assignment 5 1D Drift Diffusion pn Diode simulator
% %
% % mup0 = ( MU1P.CAUG*((TL/300)^ALPHAP.CAUG) ) ...
% % + (( (MU2P.CAUG*((TL/300)^BETAP.CAUG)) - (MU1P.CAUG*((TL/300)^ALPHAP.CAUG)) ) ...
% % / ( 1 + ((TL/300)^GAMMAP.CAUG) * ((N/NCRITP.CAUG)^DELTAP.CAUG) ))

VSATN = (2.4*10^7) / (1 + 0.8*exp(TL/600)); % Saturation Velocity of Electrons
VSATP = VSATN; % Saturation Velocity of Holes
%%%%%%%%%%%%%%%%%%% END of Low Field Mobility Calculation %%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 2. Start the main Loop to increment the Anode voltage by Vt=KbT/q %%
%% till it reaches 0.625V. %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
vindex=0;
for VA = 0:0.33*Vt:0.625 % Start VA increment loop
VA

Each_Step = 0.33*Vt
Total_Steps = 0.625/(0.33*Vt)
vindex = vindex +1
Vplot(vindex) = VA;

fi(1) = fi(1) + VA; % Apply potential to Anode (1st node)
%fi(1)

flag_conv2 = 0; % Convergence of the Poisson loop
k_itern= 0;

%% Initialize the First and Last Node for Poisson's eqn
a(1) = 0;
c(1) = 0;
b(1) = 1;
f(1) = fi(1);
a(n_max) = 0;
c(n_max) = 0;
b(n_max) = 1;
f(n_max) = fi(n_max);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 3. Start the Poisson equation solver loop to calculate the %%
%% potential for each Anode voltage increase %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

while(~flag_conv2) % Start Poisson's eqn

k_itern = k_itern + 1

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 3.1 . Calculate Field Dependant Mobility for each value of 'fi' %%
%% at each node point of the PN diode. %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%% To test with Constant Mobility without field dependancy.
% % for i = 1:n_max % Start Loop for Field Dep Mobility
% % mup(i) = mup0;
% % mun(i) = mun0;
% % end
Pinakpani Nayak (995030989) 27
Assignment 5 1D Drift Diffusion pn Diode simulator
%% Calculate the Electric Field at each Node
for i = 2:n_max-1
Ef(i) = abs(fi(i) - fi(i+1))*Vt/(dx*Ldi);
end

Ef(1) = Ef(2);
Ef(n_max) = Ef(n_max-1);
%% Calculate the Field Dependant Mobility at each Node
for i = 1:n_max
pdeno = (mup0 * Ef(i) / VSATP) ^ BETAP;
mup(i) = mup0 * ( (1/(1 + pdeno)) ^(1/BETAP));

ndeno = (mun0 * Ef(i) / VSATN) ^ BETAN;
mun(i) = mun0 * ( (1/(1 + ndeno)) ^(1/BETAN));

end

mup(1) = mup(2);
mup(n_max) = mup(n_max-1);

mun(1) = mun(2);
mun(n_max) = mun(n_max-1);

%%%%%%%%%%% END of FIELD Dependant Mobility Calculation %%%%%%%%%%%


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 3.2 Solve Continuity Equation for Electron and Holes using LU Decomposition %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%(A) Define the elements of the coefficient matrix and initialize the forcing
% function at the ohmic contacts for ELECTRON and HOLE Continuity Eqns
an(1) = 0; %Co-ef for electron at Anode
bn(1) = 1; %Co-ef for electron at Anode
cn(1) = 0; %Co-ef for electron at Anode
ap(1) = 0; %Co-ef for hole at Anode
bp(1) = 1; %Co-ef for hole at Anode
cp(1) = 0; %Co-ef for hole at Anode
%fnp(1) = (Ldi*Ldi*dx2/Vt) * ( p(1)*n(1) - 1 ) / ( TAUP0*(n(1) + 1 ) + TAUN0*(p(1)
+ 1 ) );
fn(1) = n(1);
fp(1) = p(1);

an(n_max) = 0; %Co-ef for electron at Cathode
bn(n_max) = 1; %Co-ef for electron at Cathode
cn(n_max) = 0; %Co-ef for electron at Cathode
ap(n_max) = 0; %Co-ef for hole at Cathode
bp(n_max) = 1; %Co-ef for hole at Cathode
cp(n_max) = 0; %Co-ef for hole at Cathode
%fnp(n_max) = (Ldi*Ldi*dx2/Vt) * ( p(n_max)*n(n_max) - 1 ) / ( TAUP0*(n(n_max) + 1)
+ TAUN0*(p(n_max) + 1) );
fn(n_max) = n(n_max);
fp(n_max) = p(n_max);
%(B) Define the elements of the coefficient matrix for the internal nodes and
% initialize the forcing function
Pinakpani Nayak (995030989) 28
Assignment 5 1D Drift Diffusion pn Diode simulator
for i = 2: n_max-1
munim1by2 = (mun(i-1)+mun(i))/2;
munip1by2 = (mun(i)+mun(i+1))/2;
mupim1by2 = (mup(i-1)+mup(i))/2;
mupip1by2 = (mup(i)+mup(i+1))/2;

%% Co-efficients for HOLE Continuity eqn
cp(i) = mupip1by2 * BER(fi(i) - fi(i+1));
ap(i) = mupim1by2 * BER(fi(i) - fi(i-1));
bp(i) = -( mupim1by2 * BER(fi(i-1) - fi(i)) + mupip1by2 * BER(fi(i+1) - fi(i)));
%% Co-efficients for ELECTRON Continuity eqn
cn(i) = munip1by2 * BER(fi(i+1) - fi(i));
an(i) = munim1by2 * BER(fi(i-1) - fi(i));
n(i) = -( munim1by2 * BER(fi(i) - fi(i-1)) + munip1by2 * BER(fi(i) - fi(i+1)));
%% Forcing Function for ELECTRON and HOLE Continuity eqns
fn(i) = (Ldi*Ldi*dx2/Vt) * ( p(i)*n(i) - 1 ) / ( TAUP0*(n(i) + 1) + TAUN0*(p(i)+1));
fp(i) = (Ldi*Ldi*dx2/Vt) * ( p(i)*n(i) - 1 ) / ( TAUP0*(n(i) + 1) + TAUN0*(p(i)+1));
end

%(C) Start the iterative procedure for the solution of the linearized Continuity
% equation for "ELECTRONS" using LU decomposition method:
alphan(1) = bn(1);
for i=2:n_max
betan(i)=an(i)/alphan(i-1);
alphan(i)=bn(i)-betan(i)*cn(i-1);
end
% Solution of Lv = f %
vn(1) = fn(1);
for i = 2:n_max
vn(i) = fn(i) - betan(i)*vn(i-1);
end
% Solution of U*fi = v %
tempn = vn(n_max)/alphan(n_max);
%deltan(n_max) = tempn - n(n_max);
n(n_max)=tempn;
for i = (n_max-1):-1:1 %delta%
tempn = (vn(i)-cn(i)*n(i+1))/alphan(i);
% deltan(i) = tempn - n(i);
n(i) = tempn;
end

%%%%%%%%%%%%%%%%%%%%%%% END of ELECTRON Continuty Solver %%%%%%%%%%%

%(D) Start the iterative procedure for the solution of the linearized Continuity
% equation for "HOLES" using LU decomposition method:
alphap(1) = bp(1);
for i=2:n_max
betap(i)=ap(i)/alphap(i-1);
alphap(i)=bp(i)-betap(i)*cp(i-1);
end
% Solution of Lv = f %
Pinakpani Nayak (995030989) 29
Assignment 5 1D Drift Diffusion pn Diode simulator
vp(1) = fp(1);
for i = 2:n_max
vp(i) = fp(i) - betap(i)*vp(i-1);
end
% Solution of U*fi = v %
tempp = vp(n_max)/alphap(n_max);
%deltap(n_max) = tempp - p(n_max);
p(n_max)=tempp;
for i = (n_max-1):-1:1 %delta%
tempp = (vp(i)-cp(i)*p(i+1))/alphap(i);
% deltap(i) = tempp - p(i);
p(i) = tempp;
end

%%%%%%%%%%%%%%%%%%%%%%% END of HOLE Continuty Solver %%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 3.3 Calculate potential fi again with new values of "n" and "p"%%
%% and check for convergence %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Recalculate forcing function and central coefficient b for fi
for i = 2: n_max-1
b(i) = -(2/dx2 + n(i) + p(i));
f(i) = n(i) - p(i) - dop(i) - (fi(i)*(n(i) + p(i)));
%% here values of n(i) and p(i) are used in place of exp(fi(i))
end

% Solve for Updated potential given the new value of Forcing
% Function using LU decomposition

alpha(1) = b(1);
for i=2:n_max
beta(i)=a(i)/alpha(i-1);
alpha(i)=b(i)-beta(i)*c(i-1);
end
% Solution of Lv = f %
v(1) = f(1);
for i = 2:n_max
v(i) = f(i) - beta(i)*v(i-1);
end
% Solution of U*fi = v %
temp = v(n_max)/alpha(n_max);
delta(n_max) = temp - fi(n_max);
fi(n_max)=temp;
for i = (n_max-1):-1:1 %delta%
temp = (v(i)-c(i)*fi(i+1))/alpha(i);
delta(i) = temp - fi(i);
fi(i) = temp;
end
delta_max = 0;
Pinakpani Nayak (995030989) 30
Assignment 5 1D Drift Diffusion pn Diode simulator
for i = 1: n_max
xx = abs(delta(i));
if(xx > delta_max)
delta_max=xx; %% Calculate the max error
end
end
%delta_max=max(abs(delta));
% Test convergence and start the loop if necessary else increase
% the applied potential
%% delta_max
if(delta_max < delta_acc)
flag_conv2 = 1;
end
end % End of WHILE Loop for Poisson's eqn solver

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% CALCULATE CURRENT %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Electron Current
for i=2:n_max-1
Jnim1by2(vindex,i) = (q*mun(i)*Vt/(dx*Ldi)) * ni*( n(i)*BER(fi(i)-fi(i-1)) \
- n(i-1)*BER(fi(i-1)-fi(i)) );
Jnip1by2(vindex,i) = (q*mun(i)*Vt/(dx*Ldi)) * ni*( n(i+1)*BER(fi(i+1)-fi(i)) \
- n(i)*BER(fi(i)-fi(i+1)) );
Jelec(vindex,i) = (Jnip1by2(vindex,i) + Jnim1by2(vindex,i))/2;

% % % Electron Current with only one node
% % Jnim1by2 = (q*mun(2)*Vt/dx*Ldi) * ( (n(2)*ni)*BER((fi(2)-fi(2-1)))
- (n(2-1)*ni)*BER((fi(2-1)-fi(2))) );
% % Jnip1by2 = (q*mun(2)*Vt/dx*Ldi) * ( (n(2+1)*ni)*BER((fi(2+1)-fi(2)))
- (n(2)*ni)*BER((fi(2)-fi(2+1))) );
% % Jelec(vindex) = (Jnip1by2 + Jnim1by2)/2;
% Hole Current
% % Jpim1by2 = (q*mup(2)*Vt/dx*Ldi) * ( (p(2)*ni)*BER((fi(2-1)-fi(2)))
- (p(2-1)*ni)*BER((fi(2)-fi(2-1))) );
% % Jpip1by2 = (q*mup(2)*Vt/dx*Ldi) * ( (p(2+1)*ni)*BER((fi(2)-fi(2+1)))
- (p(2)*ni)*BER((fi(2+1)-fi(2))) );
% % Jhole(vindex) = (Jpip1by2 + Jpim1by2)/2;
Jpim1by2(vindex,i) = (q*mup(i)*Vt/(dx*Ldi)) * ni*( p(i)*BER((fi(i-1)-fi(i))) \
- p(i-1)*BER((fi(i)-fi(i-1))) );
Jpip1by2(vindex,i) = (q*mup(i)*Vt/(dx*Ldi)) * ni*( p(i+1)*BER((fi(i)-fi(i+1))) \
- p(i)*BER((fi(i+1)-fi(i))) );
Jhole(vindex,i) = (Jpip1by2(vindex,i) + Jpim1by2(vindex,i))/2;
end
Jtotal = Jelec + Jhole;
%% Jtotal(vindex) = Jelec;


end % End of main FOR loop for VA increment.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% END OF NON-EQUILIBRIUM SOLUTION PART %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Pinakpani Nayak (995030989) 31
Assignment 5 1D Drift Diffusion pn Diode simulator
% Write the results of the simulation in files %
xx1(1) = dx*1e4;
for i = 2:n_max-1
Ec(i) = dEc - Vt*fi(i); %Values from the second Node%
ro(i) = -ni*(n(i) - p(i) - dop(i));
el_field1(i) = -(fi(i+1) - fi(i))*Vt/(dx*Ldi);
el_field2(i) = -(fi(i+1) - fi(i-1))*Vt/(2*dx*Ldi);
xx1(i) = xx1(i-1) + dx*Ldi*1e4;
end
Jtotal(:,1) = Jtotal(:,2);
Jelec(:,1) = Jelec(:,2);
Jhole(:,1) = Jhole(:,2);
Jtotal(:,n_max) = Jtotal(:,(n_max-1));
Jelec(:,n_max) = Jelec(:,(n_max-1));
Jhole(:,n_max) = Jhole(:,(n_max-1));
Ec(1) = Ec(2);
Ec(n_max) = Ec(n_max-1);
xx1(n_max) = xx1(n_max-1) + dx*Ldi*1e4;
el_field1(1) = el_field1(2);
el_field2(1) = el_field2(2);
el_field1(n_max) = el_field1(n_max-1);
el_field2(n_max) = el_field2(n_max-1);
nf = n*ni;
pf = p*ni;
ro(1) = ro(2);
ro(n_max) = ro(n_max-1);
%% Calculate Quasi Fermi Level - Efn Efp
for i = 1:n_max
Ei(i) = Ec(i) - 0.56;
Efn(i) = Ei(i) + Vt*log(nf(i)/ni);
Efp(i) = Ei(i) - Vt*log(pf(i)/ni);
end
Ev = Ec - 1.12;
figure(14)
plot(xx1, Ec,'black','LineWidth',2.5);
hold on;
plot(xx1, Ev,'black','LineWidth',2.5);
hold on;
plot(xx1, Ei,'--black','LineWidth',2.5);
hold on;
plot(xx1, Efn,'r','LineWidth',2.5);
hold on;
plot(xx1, Efp,'b','LineWidth',2.5);
xlabel('x [um]');
ylabel('Energy [eV]');
title('Quasi Fermi Levels (Efn & Efp) vs Position - at Applied Bias(0.625V)');
legend('Ec','Ev','Ei','Efn','Efp');
axis([0 7 -1 1]);
figure(6)
plot(xx1, Ec,'b','LineWidth',2)
xlabel('x [um]');
ylabel('Conduction Band Energy (eV)');
title('Conduction Band vs Position - at Applied Bias (0.625)');
Pinakpani Nayak (995030989) 32
Assignment 5 1D Drift Diffusion pn Diode simulator
figure(7)
plot(xx1, Vt*fi,'b','LineWidth',2)
xlabel('x [um]');
ylabel('Potential [eV]');
title('Potential vs Position - at Applied Bias(0.625V)');
figure(8)
plot(xx1, el_field1,'b','LineWidth',2)
hold on;
plot(xx1, el_field2,'b','LineWidth',2)
xlabel('x [um]');
ylabel('Electric Field [V/cm]');
title('Field Profile vs Position - at Applied Bias(0.625V)');
figure(9)
%plot(xx1, nf,'g','LineWidth',2)
semilogy(xx1, nf,'g','LineWidth',2)
hold on;
%plot(xx1, pf,'b','LineWidth',2)
semilogy(xx1, pf,'b','LineWidth',2)
xlabel('x [um]');
ylabel('Electron & Hole Densities [1/cm^3]');
title('Electron & Hole Densities vs Position - at Applied Bias(0.625V)');
legend('n','p');
%axis([0 6.75 0 10.2e17])
figure(10)
%plot(xx1, ro,'b','LineWidth',2)
plot(xx1, q*ro,'b','LineWidth',2)
xlabel('x [um]');
%ylabel('Total Charge Density [1/cm^3]');
ylabel('Total Charge Density [C/cm^3]');
title('Total Charge Density vs Position - at Applied Bias(0.625V)');
%axis([0.5 5 -3e17 8e17])
figure(11)
plot(Vplot, Jtotal(:,2),'r','LineWidth',2)
hold on
plot(Vplot, Jhole(:,2),'g','LineWidth',2)
hold on
plot(Vplot, Jelec(:,2),'b','LineWidth',2)
xlabel('VA [V]');
ylabel('Total Current Density [Amp/cm^2]');
title('I vs V Plot');
legend('Jtotal','Jhole','Jelec','2');
figure(12)
plot(Vplot, Jtotal(:,2),'r','LineWidth',2)
xlabel('VA [V]');
ylabel('Total Current Density [Amp/cm^2]');
title('I vs V Plot');
%legend('Jtotal','Jhole','Jelec','2');
figure(13)
plot(xx1,Jtotal((round((Total_Steps)-1)),:),'b','LineWidth',2)
xlabel('x [um]');
ylabel('Total Current Density [A/cm^2]');
title('Total Current Density vs Position - at Applied Bias(0.625V)');
axis([0 7 0 6]);
Pinakpani Nayak (995030989) 33
Assignment 5 1D Drift Diffusion pn Diode simulator
%figure(5)
%plot(xx1, n)
%hold all
%plot(xx1, p)
save cond_band xx1 Ec;
save tot_charge xx1 ro;
save el_field xx1 el_field1 el_field2;
save np_data xx1 nf pf;
save pot_1 fi;
Pinakpani Nayak (995030989) 34

You might also like