Resistor example 1D - Ohmic contact procedure explanation
This page explains the following code snipped from the 1D Resistor example:
Ohmic contact equations using a procedure
proc OhmicContact {Contact} { global Vt ni Nd Na 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
proc - the tcl procedure
The "function" or "routine" in tcl is called the "procedure," or "proc." Use the procedure to accomplish repetitive tasks. For examples
- $Contact = the contact name as an argument
- global - because inside the proc, eveyrthing is local
- calling the procedure
Ohmic Contact Physics
Contact equations are boundary conditions. These are necessary to find a specific solution to pde's.
- fixed and flux
- 3 equations for the 3 unknowns
- charge neutrality - Efp=$Contact - Efn=$Contact
Advanced
- BEWARE: Do not use "solution const val=" variables in your contact Equation expressions. This is not relevant in the simple 1D resistor example, but keep it in mind for later.