PN diode example (1D): Difference between revisions
No edit summary |
|||
(4 intermediate revisions by 2 users not shown) | |||
Line 5: | Line 5: | ||
* Doping=f(x) : use "sel z=" | * Doping=f(x) : use "sel z=" | ||
* "sel z=" if-then-else syntax (?:) | * "sel z=" if-then-else syntax (?:) | ||
* tcl "foreach" | * tcl "foreach" and "array" | ||
== 1D PN Diode Deck == | == 1D PN Diode Deck == | ||
Create 1D structure - [[PN diode example 1D - Create 1D structure explanation | explanation]] | Create 1D structure - [[PN diode example 1D - Create 1D structure explanation | explanation]] | ||
#Grid | #Grid | ||
line x loc=0.0 spac=0.1 tag=Top | line x loc=0.0 spac=0.1 tag=Top | ||
line x loc=0.5 spac=0.01 | line x loc=0.5 spac=0.01 | ||
line x loc=1.0 spac=0.1 tag=Bottom | line x loc=1.0 spac=0.1 tag=Bottom | ||
mater add name=Silicon | mater add name=Silicon | ||
region Silicon xlo=Top xhi=Bottom | region Silicon xlo=Top xhi=Bottom | ||
Line 49: | Line 44: | ||
sel z=1.0e17 name=Na | sel z=1.0e17 name=Na | ||
sel z=(Nd-Na) name=Doping | sel z=(Nd-Na) name=Doping | ||
#plot doping | #plot doping | ||
sel z=Doping | sel z=Doping | ||
plot.1d | plot.1d symb=1 | ||
Bulk Equations | Bulk Equations | ||
set eqnP "$eps * grad(DevPsi) + | set eqnP "$eps * grad(DevPsi) + Doping - Elec + Hole" | ||
set eqnE "ddt(Elec) - ($Emob) * $Vt * sgrad(Elec, DevPsi/$Vt)" | set eqnE "ddt(Elec) - ($Emob) * $Vt * sgrad(Elec, DevPsi/$Vt)" | ||
set eqnH "ddt(Hole) - ($Hmob) * $Vt * sgrad(Hole, -DevPsi/$Vt)" | set eqnH "ddt(Hole) - ($Hmob) * $Vt * sgrad(Hole, -DevPsi/$Vt)" | ||
Line 63: | Line 56: | ||
pdbSetString Silicon Elec Equation $eqnE | pdbSetString Silicon Elec Equation $eqnE | ||
pdbSetString Silicon Hole Equation $eqnH | pdbSetString Silicon Hole Equation $eqnH | ||
pdbSetDouble Silicon DevPsi DampValue $Vt | pdbSetDouble Silicon DevPsi DampValue $Vt | ||
pdbSetDouble Silicon DevPsi Abs.Error 1.0e-9 | pdbSetDouble Silicon DevPsi Abs.Error 1.0e-9 | ||
Line 71: | Line 64: | ||
Contact Equations | Contact Equations | ||
proc OhmicContact {Contact} { | proc OhmicContact {Contact} { | ||
global Vt ni | global Vt ni | ||
pdbSetBoolean $Contact Elec Flux 1 | pdbSetBoolean $Contact Elec Flux 1 | ||
pdbSetBoolean $Contact Hole Flux 1 | pdbSetBoolean $Contact Hole Flux 1 | ||
Line 80: | Line 73: | ||
pdbSetDouble $Contact Elec Flux.Scale 1.619e-19 | pdbSetDouble $Contact Elec Flux.Scale 1.619e-19 | ||
pdbSetDouble $Contact Hole Flux.Scale 1.619e-19 | pdbSetDouble $Contact Hole Flux.Scale 1.619e-19 | ||
pdbSetString $Contact DevPsi Equation " | pdbSetString $Contact DevPsi Equation "Nd - Na - Elec + Hole" | ||
pdbSetString $Contact Elec Equation "DevPsi - $Vt*log((Elec)/$ni) -$Contact" | pdbSetString $Contact Elec Equation "DevPsi - $Vt*log((Elec)/$ni) -$Contact" | ||
pdbSetString $Contact Hole Equation "DevPsi + $Vt*log((Hole)/$ni) -$Contact" | pdbSetString $Contact Hole Equation "DevPsi + $Vt*log((Hole)/$ni) -$Contact" | ||
Line 91: | Line 84: | ||
contact name=VSS voltage supply=0.0 | contact name=VSS voltage supply=0.0 | ||
contact name=GND voltage supply=0.0 | contact name=GND voltage supply=0.0 | ||
#Initial Guess | #Initial Guess | ||
sel z= {(Doping>0.0) | sel z= {(Doping>0.0) | ||
Line 101: | Line 94: | ||
1st DC Solve at Equilibrium (0V) | 1st DC Solve at Equilibrium (0V) | ||
device | device | ||
puts "Electron Flux [contact name= | puts "Electron Flux [contact name=VSS sol=Elec flux]" | ||
puts "Hole Flux [contact name= | puts "Hole Flux [contact name=VSS sol=Hole flux]" | ||
#Plot the equilibrium concentration profiles | #Plot the equilibrium concentration profiles | ||
foreach var {Doping Elec Hole} { | foreach var {Doping Elec Hole} { | ||
Line 113: | Line 106: | ||
#initialize an array, bias (Vb) and counter (i), and create and new graph window | #initialize an array, bias (Vb) and counter (i), and create and new graph window | ||
array set curr {} | array set curr {} | ||
set Vb 0.0 | #set Vb 0.0 | ||
set i 1 | set i 1 | ||
#Ramp from 0.0-1.2V and Plot | #Ramp from 0.0-1.2V and Plot | ||
for {set | set Win [CreateGraphWindow] | ||
for {set bias 0.0} {$bias < 1.2} {set bias [expr $bias+0.05]} { | |||
set Vbias($i) -$ | set Vbias($i) -$bias | ||
contact name=VSS supply=-$bias | |||
device init | device init | ||
set curr($i) [expr ([contact name= | |||
set curr($i) [expr ([contact name=VSS sol=Elec flux] - [contact name=VSS sol=Hole flux])] | |||
sel z=log10(abs(Hole)+1.0) | |||
plot.1d !cle | plot.1d !cle | ||
AddtoLine $Win IV -$ | |||
AddtoLine $Win IV -$bias $curr($i) | |||
incr i | incr i | ||
} | } | ||
Get the last few points on the IV curve to use for linear extrapolation of the built-in voltage | #Get the last few points on the IV curve to use for linear extrapolation of the built-in voltage | ||
set l [list "$Vbias(24)" "$curr(24)" "$Vbias(23)" "$curr(23)" "$Vbias(22)" "$curr(22)" ] | set l [list "$Vbias(24)" "$curr(24)" "$Vbias(23)" "$curr(23)" "$Vbias(22)" "$curr(22)" ] | ||
Fit the data points with "Bestline". The output will give the x-intercept or built-in voltage | #Fit the data points with "Bestline". The output will give the x-intercept or built-in voltage | ||
Bestline $l | Bestline $l | ||
Create a "fit" line to plot on top of IV curve using the data points and "Bestline" x-intercept result | #Create a "fit" line to plot on top of IV curve using the data points and "Bestline" x-intercept result | ||
set line [list "$Vbias(24)" "$curr(24)" "$Vbias(23)" "$curr(23)" "$Vbias(22)" "$curr(22)" 0. | set line [list "$Vbias(24)" "$curr(24)" "$Vbias(23)" "$curr(23)" "$Vbias(22)" "$curr(22)" -0.99919 0] | ||
CreateSingleLine $Win Vbi_fit $line | CreateSingleLine $Win Vbi_fit $line | ||
Line 142: | Line 140: | ||
[[Image:pn_IV_2.jpg]] | [[Image:pn_IV_2.jpg]] | ||
== Full Deck Without Explanations == | |||
Copy-paste [[PN diode (1D) - full deck | this entire deck]] into a file (for example, 1dpndiode.tcl) to make running it easy. Use the [[Startup Script | startup script]] to alias your paths to the floods executable. Then, on the BASH and then flooxs command line type: | |||
$ floods | |||
flooxs> source 1dpndiode.tcl | |||
== Exercises == | |||
== Notes == |
Latest revision as of 15:54, 17 November 2010
This example builds on the 1D resistor example, showing how to create a floods structure with a doping profile that varies with x. After solving, the example compares floods's numerical results with an analytical solution.
New Concepts
- refining the grid with non-tagged lines
- Doping=f(x) : use "sel z="
- "sel z=" if-then-else syntax (?:)
- tcl "foreach" and "array"
1D PN Diode Deck
Create 1D structure - explanation
#Grid line x loc=0.0 spac=0.1 tag=Top line x loc=0.5 spac=0.01 line x loc=1.0 spac=0.1 tag=Bottom mater add name=Silicon region Silicon xlo=Top xhi=Bottom init #Contacts contact name=VSS Silicon xlo=-0.1 xhi=0.1 add contact name=GND Silicon xlo=0.9 xhi=1.1 add
Declare solution variables
DevicePackage solution add name=DevPsi pde solve negative damp solution add name=Elec pde solve !negative solution add name=Hole pde solve !negative
Define constants
set T 300.0 set k 1.38066e-23 set q 1.619e-19 set Vt [expr {$k*$T/$q}] set ni 1.1e10 set esi [expr 11.8 * 8.85418e-14] set eps [expr $esi / $q] set Emob 350.0 set Hmob 150.0 set small 1.0e-10
Ionized dopant profile - explanation
sel z=1.0e20*(x<0.5) name=Nd sel z=1.0e17 name=Na sel z=(Nd-Na) name=Doping #plot doping sel z=Doping plot.1d symb=1
Bulk Equations
set eqnP "$eps * grad(DevPsi) + Doping - Elec + Hole" set eqnE "ddt(Elec) - ($Emob) * $Vt * sgrad(Elec, DevPsi/$Vt)" set eqnH "ddt(Hole) - ($Hmob) * $Vt * sgrad(Hole, -DevPsi/$Vt)" pdbSetString Silicon DevPsi Equation $eqnP pdbSetString Silicon Elec Equation $eqnE pdbSetString Silicon Hole Equation $eqnH pdbSetDouble Silicon DevPsi DampValue $Vt pdbSetDouble Silicon DevPsi Abs.Error 1.0e-9 pdbSetDouble Silicon Elec Abs.Error 1.0e-5 pdbSetDouble Silicon Hole Abs.Error 1.0e-5
Contact Equations
proc OhmicContact {Contact} { global Vt ni pdbSetBoolean $Contact Elec Flux 1 pdbSetBoolean $Contact Hole Flux 1 pdbSetBoolean $Contact DevPsi Flux 1 pdbSetBoolean $Contact Elec Fixed 1 pdbSetBoolean $Contact Hole Fixed 1 pdbSetBoolean $Contact DevPsi Fixed 1 pdbSetDouble $Contact Elec Flux.Scale 1.619e-19 pdbSetDouble $Contact Hole Flux.Scale 1.619e-19 pdbSetString $Contact DevPsi Equation "Nd - Na - Elec + Hole" pdbSetString $Contact Elec Equation "DevPsi - $Vt*log((Elec)/$ni) -$Contact" pdbSetString $Contact Hole Equation "DevPsi + $Vt*log((Hole)/$ni) -$Contact" } OhmicContact VSS OhmicContact GND
Initial Conditions - explanation
#Bias contacts contact name=VSS voltage supply=0.0 contact name=GND voltage supply=0.0 #Initial Guess sel z= {(Doping>0.0) ? ( 0.025*log( (Doping+$small) / $ni)) : (-0.025*log(-(Doping+$small) / $ni))} name = DevPsi sel z=$ni*exp(DevPsi/$Vt) name=Elec sel z=$ni*exp(-DevPsi/$Vt) name=Hole
1st DC Solve at Equilibrium (0V)
device puts "Electron Flux [contact name=VSS sol=Elec flux]" puts "Hole Flux [contact name=VSS sol=Hole flux]" #Plot the equilibrium concentration profiles foreach var {Doping Elec Hole} { sel z=log10(abs($var+1.0)) plot.1d !cle }
Ramp the DC Bias to make I-V plot
#initialize an array, bias (Vb) and counter (i), and create and new graph window array set curr {} #set Vb 0.0 set i 1 #Ramp from 0.0-1.2V and Plot set Win [CreateGraphWindow] for {set bias 0.0} {$bias < 1.2} {set bias [expr $bias+0.05]} { set Vbias($i) -$bias contact name=VSS supply=-$bias device init set curr($i) [expr ([contact name=VSS sol=Elec flux] - [contact name=VSS sol=Hole flux])] sel z=log10(abs(Hole)+1.0) plot.1d !cle AddtoLine $Win IV -$bias $curr($i) incr i } #Get the last few points on the IV curve to use for linear extrapolation of the built-in voltage set l [list "$Vbias(24)" "$curr(24)" "$Vbias(23)" "$curr(23)" "$Vbias(22)" "$curr(22)" ] #Fit the data points with "Bestline". The output will give the x-intercept or built-in voltage Bestline $l #Create a "fit" line to plot on top of IV curve using the data points and "Bestline" x-intercept result set line [list "$Vbias(24)" "$curr(24)" "$Vbias(23)" "$curr(23)" "$Vbias(22)" "$curr(22)" -0.99919 0] CreateSingleLine $Win Vbi_fit $line
In forward bias (negative voltage applied to the top (n-type) contact), the output IV plot with the absolute value of the built-in voltage equal to 0.9998 is shown below. The built in voltage calculated by the equation Vbi=Vt*ln((Nd*Na)/ni^2) is 0.9786.
Full Deck Without Explanations
Copy-paste this entire deck into a file (for example, 1dpndiode.tcl) to make running it easy. Use the startup script to alias your paths to the floods executable. Then, on the BASH and then flooxs command line type:
$ floods flooxs> source 1dpndiode.tcl